index.js.map
41.9 KB
{"version":3,"names":["buildTemplate","template","statement","buildExportAll","MISSING_PLUGIN_WARNING","MISSING_PLUGIN_ERROR","getExportSpecifierName","node","stringSpecifiers","type","name","stringValue","value","isIdentifierName","add","Error","constructExportCall","path","exportIdent","exportNames","exportValues","exportStarTarget","statements","length","push","t","expressionStatement","callExpression","stringLiteral","objectProperties","i","exportName","exportValue","objectProperty","has","identifier","objectExpression","exportObj","scope","generateUid","variableDeclaration","variableDeclarator","KEY","generateUidIdentifier","EXPORT_OBJ","TARGET","assignmentExpression","memberExpression","declare","api","options","assertVersion","systemGlobal","allowTopLevelThis","reassignmentVisited","WeakSet","reassignmentVisitor","arg","isAssignmentExpression","get","isObjectPattern","isArrayPattern","exprs","Object","keys","getBindingIdentifiers","getBinding","exportedNames","exports","exportedName","buildCall","expression","replaceWith","sequenceExpression","isIdentifier","isPostUpdateExpression","isUpdateExpression","prefix","binaryExpression","operator","unaryExpression","cloneNode","argument","numericLiteral","pre","file","set","visitor","CallExpression","state","isImport","callee","console","warn","contextIdent","getDynamicImportSource","MetaProperty","meta","property","ReferencedIdentifier","hasBinding","Program","enter","Set","rewriteThis","exit","exportMap","create","modules","beforeBody","setters","sources","variableIds","removedPaths","addExportName","key","val","pushModule","source","specifiers","module","forEach","m","imports","concat","buildExportCall","body","isFunctionDeclaration","isClassDeclaration","id","toExpression","isVariableDeclaration","kind","isImportDeclaration","removeBinding","remove","isExportAllDeclaration","isExportDefaultDeclaration","declar","declaration","buildUndefinedNode","isExportNamedDeclaration","isFunction","isClass","nodes","specifier","local","exported","binding","replaceWithMultiple","setterBody","target","isImportNamespaceSpecifier","isImportDefaultSpecifier","importSpecifier","isImportSpecifier","imported","hasExportStar","isExportSpecifier","isStringLiteral","functionExpression","blockStatement","moduleName","getModuleName","opts","hoistVariables","hasInit","unshift","map","traverse","hasTLA","AwaitExpression","stop","Function","skip","noScope","SYSTEM_REGISTER","BEFORE_BODY","MODULE_NAME","SETTERS","arrayExpression","EXECUTE","SOURCES","EXPORT_IDENTIFIER","CONTEXT_IDENTIFIER"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport hoistVariables from \"@babel/helper-hoist-variables\";\nimport { template, types as t } from \"@babel/core\";\nimport {\n rewriteThis,\n getModuleName,\n getDynamicImportSource,\n} from \"@babel/helper-module-transforms\";\nimport type { PluginOptions } from \"@babel/helper-module-transforms\";\nimport { isIdentifierName } from \"@babel/helper-validator-identifier\";\nimport type { NodePath, Scope, Visitor } from \"@babel/traverse\";\n\nconst buildTemplate = template.statement(`\n SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n \"use strict\";\n BEFORE_BODY;\n return {\n setters: SETTERS,\n execute: EXECUTE,\n };\n });\n`);\n\nconst buildExportAll = template.statement(`\n for (var KEY in TARGET) {\n if (KEY !== \"default\" && KEY !== \"__esModule\") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n`);\n\nconst MISSING_PLUGIN_WARNING = `\\\nWARNING: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8 will\n no longer transform import() without using that plugin.\n`;\n\nconst MISSING_PLUGIN_ERROR = `\\\nERROR: Dynamic import() transformation must be enabled using the\n @babel/plugin-proposal-dynamic-import plugin. Babel 8\n no longer transforms import() without using that plugin.\n`;\n\n//todo: use getExportSpecifierName in `helper-module-transforms` when this library is refactored to NodePath usage.\n\nexport function getExportSpecifierName(\n node: t.Node,\n stringSpecifiers: Set<string>,\n): string {\n if (node.type === \"Identifier\") {\n return node.name;\n } else if (node.type === \"StringLiteral\") {\n const stringValue = node.value;\n // add specifier value to `stringSpecifiers` only when it can not be converted to an identifier name\n // i.e In `import { \"foo\" as bar }`\n // we do not consider `\"foo\"` to be a `stringSpecifier` because we can treat it as\n // `import { foo as bar }`\n // This helps minimize the size of `stringSpecifiers` and reduce overhead of checking valid identifier names\n // when building transpiled code from metadata\n if (!isIdentifierName(stringValue)) {\n stringSpecifiers.add(stringValue);\n }\n return stringValue;\n } else {\n throw new Error(\n `Expected export specifier to be either Identifier or StringLiteral, got ${node.type}`,\n );\n }\n}\n\ntype PluginState = {\n contextIdent: string;\n // List of names that should only be printed as string literals.\n // i.e. `import { \"any unicode\" as foo } from \"some-module\"`\n // `stringSpecifiers` is Set(1) [\"any unicode\"]\n // In most cases `stringSpecifiers` is an empty Set\n stringSpecifiers: Set<string>;\n};\n\ntype ModuleMetadata = {\n key: string;\n imports: any[];\n exports: any[];\n};\n\nfunction constructExportCall(\n path: NodePath<t.Program>,\n exportIdent: t.Identifier,\n exportNames: string[],\n exportValues: t.Expression[],\n exportStarTarget: t.Identifier | null,\n stringSpecifiers: Set<string>,\n) {\n const statements = [];\n if (!exportStarTarget) {\n if (exportNames.length === 1) {\n statements.push(\n t.expressionStatement(\n t.callExpression(exportIdent, [\n t.stringLiteral(exportNames[0]),\n exportValues[0],\n ]),\n ),\n );\n } else {\n const objectProperties = [];\n for (let i = 0; i < exportNames.length; i++) {\n const exportName = exportNames[i];\n const exportValue = exportValues[i];\n objectProperties.push(\n t.objectProperty(\n stringSpecifiers.has(exportName)\n ? t.stringLiteral(exportName)\n : t.identifier(exportName),\n exportValue,\n ),\n );\n }\n statements.push(\n t.expressionStatement(\n t.callExpression(exportIdent, [t.objectExpression(objectProperties)]),\n ),\n );\n }\n } else {\n const exportObj = path.scope.generateUid(\"exportObj\");\n\n statements.push(\n t.variableDeclaration(\"var\", [\n t.variableDeclarator(t.identifier(exportObj), t.objectExpression([])),\n ]),\n );\n\n statements.push(\n buildExportAll({\n KEY: path.scope.generateUidIdentifier(\"key\"),\n EXPORT_OBJ: t.identifier(exportObj),\n TARGET: exportStarTarget,\n }),\n );\n\n for (let i = 0; i < exportNames.length; i++) {\n const exportName = exportNames[i];\n const exportValue = exportValues[i];\n\n statements.push(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(\n t.identifier(exportObj),\n t.identifier(exportName),\n ),\n exportValue,\n ),\n ),\n );\n }\n\n statements.push(\n t.expressionStatement(\n t.callExpression(exportIdent, [t.identifier(exportObj)]),\n ),\n );\n }\n return statements;\n}\n\nexport interface Options extends PluginOptions {\n allowTopLevelThis?: boolean;\n systemGlobal?: string;\n}\n\ntype ReassignmentVisitorState = {\n scope: Scope;\n exports: any;\n buildCall: (name: string, value: t.Expression) => t.ExpressionStatement;\n};\n\nexport default declare<PluginState>((api, options: Options) => {\n api.assertVersion(7);\n\n const { systemGlobal = \"System\", allowTopLevelThis = false } = options;\n const reassignmentVisited = new WeakSet();\n\n const reassignmentVisitor: Visitor<ReassignmentVisitorState> = {\n \"AssignmentExpression|UpdateExpression\"(\n path: NodePath<t.AssignmentExpression | t.UpdateExpression>,\n ) {\n if (reassignmentVisited.has(path.node)) return;\n reassignmentVisited.add(path.node);\n\n const arg = path.isAssignmentExpression()\n ? path.get(\"left\")\n : path.get(\"argument\");\n\n if (arg.isObjectPattern() || arg.isArrayPattern()) {\n const exprs: t.SequenceExpression[\"expressions\"] = [path.node];\n for (const name of Object.keys(arg.getBindingIdentifiers())) {\n if (this.scope.getBinding(name) !== path.scope.getBinding(name)) {\n return;\n }\n const exportedNames = this.exports[name];\n if (!exportedNames) continue;\n for (const exportedName of exportedNames) {\n exprs.push(\n this.buildCall(exportedName, t.identifier(name)).expression,\n );\n }\n }\n path.replaceWith(t.sequenceExpression(exprs));\n return;\n }\n\n if (!arg.isIdentifier()) return;\n\n const name = arg.node.name;\n\n // redeclared in this scope\n if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;\n\n const exportedNames = this.exports[name];\n if (!exportedNames) return;\n\n let node: t.Expression = path.node;\n\n // if it is a non-prefix update expression (x++ etc)\n // then we must replace with the expression (_export('x', x + 1), x++)\n // in order to ensure the same update expression value\n const isPostUpdateExpression = t.isUpdateExpression(node, {\n prefix: false,\n });\n if (isPostUpdateExpression) {\n node = t.binaryExpression(\n // @ts-expect-error The operator of a post-update expression must be \"++\" | \"--\"\n node.operator[0],\n t.unaryExpression(\n \"+\",\n t.cloneNode(\n // @ts-expect-error node is UpdateExpression\n node.argument,\n ),\n ),\n t.numericLiteral(1),\n );\n }\n\n for (const exportedName of exportedNames) {\n node = this.buildCall(exportedName, node).expression;\n }\n\n if (isPostUpdateExpression) {\n node = t.sequenceExpression([node, path.node]);\n }\n\n path.replaceWith(node);\n },\n };\n\n return {\n name: \"transform-modules-systemjs\",\n\n pre() {\n this.file.set(\"@babel/plugin-transform-modules-*\", \"systemjs\");\n },\n\n visitor: {\n CallExpression(path, state: PluginState) {\n if (t.isImport(path.node.callee)) {\n if (!this.file.has(\"@babel/plugin-proposal-dynamic-import\")) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(MISSING_PLUGIN_ERROR);\n } else {\n console.warn(MISSING_PLUGIN_WARNING);\n }\n }\n\n path.replaceWith(\n t.callExpression(\n t.memberExpression(\n t.identifier(state.contextIdent),\n t.identifier(\"import\"),\n ),\n [getDynamicImportSource(path.node)],\n ),\n );\n }\n },\n\n MetaProperty(path, state: PluginState) {\n if (\n path.node.meta.name === \"import\" &&\n path.node.property.name === \"meta\"\n ) {\n path.replaceWith(\n t.memberExpression(\n t.identifier(state.contextIdent),\n t.identifier(\"meta\"),\n ),\n );\n }\n },\n\n ReferencedIdentifier(path, state) {\n if (\n path.node.name === \"__moduleName\" &&\n !path.scope.hasBinding(\"__moduleName\")\n ) {\n path.replaceWith(\n t.memberExpression(\n t.identifier(state.contextIdent),\n t.identifier(\"id\"),\n ),\n );\n }\n },\n\n Program: {\n enter(path, state) {\n state.contextIdent = path.scope.generateUid(\"context\");\n state.stringSpecifiers = new Set();\n if (!allowTopLevelThis) {\n rewriteThis(path);\n }\n },\n exit(path, state) {\n const scope = path.scope;\n const exportIdent = scope.generateUid(\"export\");\n const { contextIdent, stringSpecifiers } = state;\n\n const exportMap: Record<string, string[]> = Object.create(null);\n const modules: ModuleMetadata[] = [];\n\n const beforeBody = [];\n const setters: t.Expression[] = [];\n const sources: t.StringLiteral[] = [];\n const variableIds = [];\n const removedPaths = [];\n\n function addExportName(key: string, val: string) {\n exportMap[key] = exportMap[key] || [];\n exportMap[key].push(val);\n }\n\n function pushModule(\n source: string,\n key: \"imports\" | \"exports\",\n specifiers: t.ModuleSpecifier[] | t.ExportAllDeclaration,\n ) {\n let module: ModuleMetadata;\n modules.forEach(function (m) {\n if (m.key === source) {\n module = m;\n }\n });\n if (!module) {\n modules.push(\n (module = { key: source, imports: [], exports: [] }),\n );\n }\n module[key] = module[key].concat(specifiers);\n }\n\n function buildExportCall(name: string, val: t.Expression) {\n return t.expressionStatement(\n t.callExpression(t.identifier(exportIdent), [\n t.stringLiteral(name),\n val,\n ]),\n );\n }\n\n const exportNames = [];\n const exportValues: t.Expression[] = [];\n\n const body = path.get(\"body\");\n\n for (const path of body) {\n if (path.isFunctionDeclaration()) {\n beforeBody.push(path.node);\n removedPaths.push(path);\n } else if (path.isClassDeclaration()) {\n variableIds.push(t.cloneNode(path.node.id));\n path.replaceWith(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(path.node.id),\n t.toExpression(path.node),\n ),\n ),\n );\n } else if (path.isVariableDeclaration()) {\n // Convert top-level variable declarations to \"var\",\n // because they must be hoisted\n path.node.kind = \"var\";\n } else if (path.isImportDeclaration()) {\n const source = path.node.source.value;\n pushModule(source, \"imports\", path.node.specifiers);\n for (const name of Object.keys(path.getBindingIdentifiers())) {\n scope.removeBinding(name);\n variableIds.push(t.identifier(name));\n }\n path.remove();\n } else if (path.isExportAllDeclaration()) {\n pushModule(path.node.source.value, \"exports\", path.node);\n path.remove();\n } else if (path.isExportDefaultDeclaration()) {\n const declar = path.node.declaration;\n if (t.isClassDeclaration(declar)) {\n const id = declar.id;\n if (id) {\n exportNames.push(\"default\");\n exportValues.push(scope.buildUndefinedNode());\n variableIds.push(t.cloneNode(id));\n addExportName(id.name, \"default\");\n path.replaceWith(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(id),\n t.toExpression(declar),\n ),\n ),\n );\n } else {\n exportNames.push(\"default\");\n exportValues.push(t.toExpression(declar));\n removedPaths.push(path);\n }\n } else if (t.isFunctionDeclaration(declar)) {\n const id = declar.id;\n if (id) {\n beforeBody.push(declar);\n exportNames.push(\"default\");\n exportValues.push(t.cloneNode(id));\n addExportName(id.name, \"default\");\n } else {\n exportNames.push(\"default\");\n exportValues.push(t.toExpression(declar));\n }\n removedPaths.push(path);\n } else {\n // @ts-expect-error TSDeclareFunction is not expected here\n path.replaceWith(buildExportCall(\"default\", declar));\n }\n } else if (path.isExportNamedDeclaration()) {\n const declar = path.node.declaration;\n\n if (declar) {\n path.replaceWith(declar);\n\n if (t.isFunction(declar)) {\n const name = declar.id.name;\n addExportName(name, name);\n beforeBody.push(declar);\n exportNames.push(name);\n exportValues.push(t.cloneNode(declar.id));\n removedPaths.push(path);\n } else if (t.isClass(declar)) {\n const name = declar.id.name;\n exportNames.push(name);\n exportValues.push(scope.buildUndefinedNode());\n variableIds.push(t.cloneNode(declar.id));\n path.replaceWith(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(declar.id),\n t.toExpression(declar),\n ),\n ),\n );\n addExportName(name, name);\n } else {\n if (t.isVariableDeclaration(declar)) {\n // Convert top-level variable declarations to \"var\",\n // because they must be hoisted\n declar.kind = \"var\";\n }\n for (const name of Object.keys(\n t.getBindingIdentifiers(declar),\n )) {\n addExportName(name, name);\n }\n }\n } else {\n const specifiers = path.node.specifiers;\n if (specifiers?.length) {\n if (path.node.source) {\n pushModule(path.node.source.value, \"exports\", specifiers);\n path.remove();\n } else {\n const nodes = [];\n\n for (const specifier of specifiers) {\n // @ts-expect-error This isn't an \"export ... from\" declaration\n // because path.node.source is falsy, so the local specifier exists.\n const { local, exported } = specifier;\n\n const binding = scope.getBinding(local.name);\n const exportedName = getExportSpecifierName(\n exported,\n stringSpecifiers,\n );\n // hoisted function export\n if (\n binding &&\n t.isFunctionDeclaration(binding.path.node)\n ) {\n exportNames.push(exportedName);\n exportValues.push(t.cloneNode(local));\n }\n // only globals also exported this way\n else if (!binding) {\n nodes.push(buildExportCall(exportedName, local));\n }\n addExportName(local.name, exportedName);\n }\n\n path.replaceWithMultiple(nodes);\n }\n } else {\n path.remove();\n }\n }\n }\n }\n\n modules.forEach(function (specifiers) {\n const setterBody = [];\n const target = scope.generateUid(specifiers.key);\n\n for (let specifier of specifiers.imports) {\n if (t.isImportNamespaceSpecifier(specifier)) {\n setterBody.push(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n specifier.local,\n t.identifier(target),\n ),\n ),\n );\n } else if (t.isImportDefaultSpecifier(specifier)) {\n specifier = t.importSpecifier(\n specifier.local,\n t.identifier(\"default\"),\n );\n }\n\n if (t.isImportSpecifier(specifier)) {\n const { imported } = specifier;\n setterBody.push(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n specifier.local,\n t.memberExpression(\n t.identifier(target),\n specifier.imported,\n /* computed */ imported.type === \"StringLiteral\",\n ),\n ),\n ),\n );\n }\n }\n\n if (specifiers.exports.length) {\n const exportNames = [];\n const exportValues = [];\n let hasExportStar = false;\n\n for (const node of specifiers.exports) {\n if (t.isExportAllDeclaration(node)) {\n hasExportStar = true;\n } else if (t.isExportSpecifier(node)) {\n const exportedName = getExportSpecifierName(\n node.exported,\n stringSpecifiers,\n );\n exportNames.push(exportedName);\n exportValues.push(\n t.memberExpression(\n t.identifier(target),\n node.local,\n t.isStringLiteral(node.local),\n ),\n );\n } else {\n // todo\n }\n }\n\n setterBody.push(\n ...constructExportCall(\n path,\n t.identifier(exportIdent),\n exportNames,\n exportValues,\n hasExportStar ? t.identifier(target) : null,\n stringSpecifiers,\n ),\n );\n }\n\n sources.push(t.stringLiteral(specifiers.key));\n setters.push(\n t.functionExpression(\n null,\n [t.identifier(target)],\n t.blockStatement(setterBody),\n ),\n );\n });\n\n let moduleName = getModuleName(this.file.opts, options);\n // @ts-expect-error todo(flow->ts): do not reuse variables\n if (moduleName) moduleName = t.stringLiteral(moduleName);\n\n hoistVariables(path, (id, name, hasInit) => {\n variableIds.push(id);\n if (!hasInit && name in exportMap) {\n for (const exported of exportMap[name]) {\n exportNames.push(exported);\n exportValues.push(scope.buildUndefinedNode());\n }\n }\n });\n\n if (variableIds.length) {\n beforeBody.unshift(\n t.variableDeclaration(\n \"var\",\n variableIds.map(id => t.variableDeclarator(id)),\n ),\n );\n }\n\n if (exportNames.length) {\n beforeBody.push(\n ...constructExportCall(\n path,\n t.identifier(exportIdent),\n exportNames,\n exportValues,\n null,\n stringSpecifiers,\n ),\n );\n }\n\n path.traverse(reassignmentVisitor, {\n exports: exportMap,\n buildCall: buildExportCall,\n scope,\n });\n\n for (const path of removedPaths) {\n path.remove();\n }\n\n let hasTLA = false;\n path.traverse({\n AwaitExpression(path) {\n hasTLA = true;\n path.stop();\n },\n Function(path) {\n path.skip();\n },\n // @ts-expect-error - todo: add noScope to type definitions\n noScope: true,\n });\n\n path.node.body = [\n buildTemplate({\n SYSTEM_REGISTER: t.memberExpression(\n t.identifier(systemGlobal),\n t.identifier(\"register\"),\n ),\n BEFORE_BODY: beforeBody,\n MODULE_NAME: moduleName,\n SETTERS: t.arrayExpression(setters),\n EXECUTE: t.functionExpression(\n null,\n [],\n t.blockStatement(path.node.body),\n false,\n hasTLA,\n ),\n SOURCES: t.arrayExpression(sources),\n EXPORT_IDENTIFIER: t.identifier(exportIdent),\n CONTEXT_IDENTIFIER: t.identifier(contextIdent),\n }),\n ];\n },\n },\n },\n };\n});\n"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAMA;;AAGA,MAAMA,aAAa,GAAGC,cAAA,CAASC,SAAT,CAAoB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CATsB,CAAtB;;AAWA,MAAMC,cAAc,GAAGF,cAAA,CAASC,SAAT,CAAoB;AAC3C;AACA;AACA;AACA,CAJuB,CAAvB;;AAMA,MAAME,sBAAsB,GA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