Innovenergy_trunk/frontend/node_modules/@babel/plugin-transform-classes/lib/index.js.map

1 line
5.9 KiB
Plaintext

{"version":3,"names":["getBuiltinClasses","category","Object","keys","globals","filter","name","test","builtinClasses","Set","declare","api","options","assertVersion","loose","setClassMethods","assumption","constantSuper","superIsCallableConstructor","noClassCalls","supportUnicodeId","isRequired","targets","VISITED","WeakSet","visitor","ExportDefaultDeclaration","path","get","isClassDeclaration","splitExportDeclaration","ClassDeclaration","node","ref","id","scope","generateUidIdentifier","replaceWith","t","variableDeclaration","variableDeclarator","toExpression","ClassExpression","state","has","inferred","nameFunction","undefined","add","replacedPath","transformClass","file","isCallExpression","annotateAsPure","callee","isArrowFunctionExpression","arrowFunctionToExpression"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { isRequired } from \"@babel/helper-compilation-targets\";\nimport annotateAsPure from \"@babel/helper-annotate-as-pure\";\nimport nameFunction from \"@babel/helper-function-name\";\nimport splitExportDeclaration from \"@babel/helper-split-export-declaration\";\nimport { types as t } from \"@babel/core\";\nimport globals from \"globals\";\nimport transformClass from \"./transformClass\";\n\nconst getBuiltinClasses = (category: keyof typeof globals) =>\n Object.keys(globals[category]).filter(name => /^[A-Z]/.test(name));\n\nconst builtinClasses = new Set([\n ...getBuiltinClasses(\"builtin\"),\n ...getBuiltinClasses(\"browser\"),\n]);\n\nexport interface Options {\n loose?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(7);\n\n const { loose = false } = options;\n\n const setClassMethods = api.assumption(\"setClassMethods\") ?? loose;\n const constantSuper = api.assumption(\"constantSuper\") ?? loose;\n const superIsCallableConstructor =\n api.assumption(\"superIsCallableConstructor\") ?? loose;\n const noClassCalls = api.assumption(\"noClassCalls\") ?? loose;\n const supportUnicodeId = !isRequired(\n \"transform-unicode-escapes\",\n api.targets(),\n );\n\n // todo: investigate traversal requeueing\n const VISITED = new WeakSet();\n\n return {\n name: \"transform-classes\",\n\n visitor: {\n ExportDefaultDeclaration(path) {\n if (!path.get(\"declaration\").isClassDeclaration()) return;\n splitExportDeclaration(path);\n },\n\n ClassDeclaration(path) {\n const { node } = path;\n\n const ref = node.id || path.scope.generateUidIdentifier(\"class\");\n\n path.replaceWith(\n t.variableDeclaration(\"let\", [\n t.variableDeclarator(ref, t.toExpression(node)),\n ]),\n );\n },\n\n ClassExpression(path, state) {\n const { node } = path;\n if (VISITED.has(node)) return;\n\n const inferred = nameFunction(path, undefined, supportUnicodeId);\n if (inferred && inferred !== node) {\n path.replaceWith(inferred);\n return;\n }\n\n VISITED.add(node);\n\n const [replacedPath] = path.replaceWith(\n transformClass(\n path,\n state.file,\n builtinClasses,\n loose,\n {\n setClassMethods,\n constantSuper,\n superIsCallableConstructor,\n noClassCalls,\n },\n supportUnicodeId,\n ),\n );\n\n if (replacedPath.isCallExpression()) {\n annotateAsPure(replacedPath);\n const callee = replacedPath.get(\"callee\");\n if (callee.isArrowFunctionExpression()) {\n // This is an IIFE, so we don't need to worry about the noNewArrows assumption\n callee.arrowFunctionToExpression();\n }\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,iBAAiB,GAAIC,QAA8B,IACvDC,MAAM,CAACC,IAAI,CAACC,QAAO,CAACH,QAAQ,CAAC,CAAC,CAACI,MAAM,CAACC,IAAI,IAAI,QAAQ,CAACC,IAAI,CAACD,IAAI,CAAC,CAAC;AAEpE,MAAME,cAAc,GAAG,IAAIC,GAAG,CAAC,CAC7B,GAAGT,iBAAiB,CAAC,SAAS,CAAC,EAC/B,GAAGA,iBAAiB,CAAC,SAAS,CAAC,CAChC,CAAC;AAAC,eAMY,IAAAU,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAAA;EAChDD,GAAG,CAACE,aAAa,CAAC,CAAC,CAAC;EAEpB,MAAM;IAAEC,KAAK,GAAG;EAAM,CAAC,GAAGF,OAAO;EAEjC,MAAMG,eA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