odin-js-fundamentals-part-4/node_modules/@babel/helper-module-transforms/lib/index.js.map

1 line
28 KiB
Plaintext

{"version":3,"names":["_assert","require","_core","_helperModuleImports","_rewriteThis","_rewriteLiveReferences","_normalizeAndLoadMetadata","_dynamicImport","_getModuleName","booleanLiteral","callExpression","cloneNode","directive","directiveLiteral","expressionStatement","identifier","isIdentifier","memberExpression","stringLiteral","valueToNode","variableDeclaration","variableDeclarator","t","exports","getDynamicImportSource","rewriteModuleStatementsAndPrepareHeader","path","exportName","strict","allowTopLevelThis","strictMode","noInterop","importInterop","lazy","esNamespaceOnly","filename","constantReexports","arguments","loose","enumerableModuleMeta","noIncompleteNsImportDetection","validateImportInteropOption","assert","isModule","node","sourceType","meta","normalizeModuleAndLoadMetadata","initializeReexports","rewriteThis","rewriteLiveReferences","hasStrict","directives","some","value","unshiftContainer","headers","hasExports","push","buildESModuleHeader","nameList","buildExportNameListDeclaration","exportNameListName","name","statement","buildExportInitializationStatements","ensureStatementsHoisted","statements","forEach","header","_blockHoist","wrapInterop","programPath","expr","type","hub","addHelper","helper","Error","buildNamespaceInitStatements","metadata","sourceMetadata","srcNamespace","localName","importsNamespace","template","NAME","SOURCE","buildReexportsFromMeta","reexportNamespace","EXPORTS","NAMESPACE","reexportAll","buildNamespaceReexport","loc","ReexportTemplate","constant","constantComputed","spec","namespace","stringSpecifiers","Array","from","reexports","importName","NAMESPACE_IMPORT","interop","has","astNodes","EXPORT_NAME","VERIFY_NAME_LIST","EXPORTS_LIST","exportedVars","Object","create","data","local","values","names","hasReexport","source","keys","length","scope","generateUidIdentifier","default","initStatements","kind","buildInitStatement","reexportsStatements","i","sort","a","b","results","initStatement","chunkSize","uninitializedExportNames","j","buildUndefinedNode","InitTemplate","computed","expression","exportNames","initExpr","reduce","acc","params","VALUE"],"sources":["../src/index.ts"],"sourcesContent":["import assert from \"assert\";\nimport { template, types as t } from \"@babel/core\";\n\nimport { isModule } from \"@babel/helper-module-imports\";\n\nimport rewriteThis from \"./rewrite-this\";\nimport rewriteLiveReferences from \"./rewrite-live-references\";\nimport normalizeModuleAndLoadMetadata, {\n hasExports,\n isSideEffectImport,\n validateImportInteropOption,\n} from \"./normalize-and-load-metadata\";\nimport type {\n ImportInterop,\n InteropType,\n Lazy,\n ModuleMetadata,\n SourceModuleMetadata,\n} from \"./normalize-and-load-metadata\";\nimport type { NodePath } from \"@babel/traverse\";\n\nconst {\n booleanLiteral,\n callExpression,\n cloneNode,\n directive,\n directiveLiteral,\n expressionStatement,\n identifier,\n isIdentifier,\n memberExpression,\n stringLiteral,\n valueToNode,\n variableDeclaration,\n variableDeclarator,\n} = t;\n\nexport { buildDynamicImport } from \"./dynamic-import\";\n\nif (!process.env.BABEL_8_BREAKING) {\n if (!USE_ESM) {\n if (!IS_STANDALONE) {\n // eslint-disable-next-line no-restricted-globals\n exports.getDynamicImportSource =\n // eslint-disable-next-line no-restricted-globals\n require(\"./dynamic-import\").getDynamicImportSource;\n }\n }\n}\n\nexport { default as getModuleName } from \"./get-module-name\";\nexport type { PluginOptions } from \"./get-module-name\";\n\nexport { hasExports, isSideEffectImport, isModule, rewriteThis };\n\nexport interface RewriteModuleStatementsAndPrepareHeaderOptions {\n exportName?: string;\n strict: boolean;\n allowTopLevelThis?: boolean;\n strictMode: boolean;\n loose?: boolean;\n importInterop?: ImportInterop;\n noInterop?: boolean;\n lazy?: Lazy;\n esNamespaceOnly?: boolean;\n filename: string | undefined;\n constantReexports?: boolean | void;\n enumerableModuleMeta?: boolean | void;\n noIncompleteNsImportDetection?: boolean | void;\n}\n\n/**\n * Perform all of the generic ES6 module rewriting needed to handle initial\n * module processing. This function will rewrite the majority of the given\n * program to reference the modules described by the returned metadata,\n * and returns a list of statements for use when initializing the module.\n */\nexport function rewriteModuleStatementsAndPrepareHeader(\n path: NodePath<t.Program>,\n {\n exportName,\n strict,\n allowTopLevelThis,\n strictMode,\n noInterop,\n importInterop = noInterop ? \"none\" : \"babel\",\n lazy,\n esNamespaceOnly,\n filename,\n\n constantReexports = process.env.BABEL_8_BREAKING\n ? undefined\n : arguments[1].loose,\n enumerableModuleMeta = process.env.BABEL_8_BREAKING\n ? undefined\n : arguments[1].loose,\n noIncompleteNsImportDetection,\n }: RewriteModuleStatementsAndPrepareHeaderOptions,\n) {\n validateImportInteropOption(importInterop);\n assert(isModule(path), \"Cannot process module statements in a script\");\n path.node.sourceType = \"script\";\n\n const meta = normalizeModuleAndLoadMetadata(path, exportName, {\n importInterop,\n initializeReexports: constantReexports,\n lazy,\n esNamespaceOnly,\n filename,\n });\n\n if (!allowTopLevelThis) {\n rewriteThis(path);\n }\n\n rewriteLiveReferences(path, meta);\n\n if (strictMode !== false) {\n const hasStrict = path.node.directives.some(directive => {\n return directive.value.value === \"use strict\";\n });\n if (!hasStrict) {\n path.unshiftContainer(\n \"directives\",\n directive(directiveLiteral(\"use strict\")),\n );\n }\n }\n\n const headers = [];\n if (hasExports(meta) && !strict) {\n headers.push(buildESModuleHeader(meta, enumerableModuleMeta));\n }\n\n const nameList = buildExportNameListDeclaration(path, meta);\n\n if (nameList) {\n meta.exportNameListName = nameList.name;\n headers.push(nameList.statement);\n }\n\n // Create all of the statically known named exports.\n headers.push(\n ...buildExportInitializationStatements(\n path,\n meta,\n constantReexports,\n noIncompleteNsImportDetection,\n ),\n );\n\n return { meta, headers };\n}\n\n/**\n * Flag a set of statements as hoisted above all else so that module init\n * statements all run before user code.\n */\nexport function ensureStatementsHoisted(statements: t.Statement[]) {\n // Force all of the header fields to be at the top of the file.\n statements.forEach(header => {\n // @ts-expect-error Fixme: handle _blockHoist property\n header._blockHoist = 3;\n });\n}\n\n/**\n * Given an expression for a standard import object, like \"require('foo')\",\n * wrap it in a call to the interop helpers based on the type.\n */\nexport function wrapInterop(\n programPath: NodePath,\n expr: t.Expression,\n type: InteropType,\n): t.CallExpression {\n if (type === \"none\") {\n return null;\n }\n\n if (type === \"node-namespace\") {\n return callExpression(programPath.hub.addHelper(\"interopRequireWildcard\"), [\n expr,\n booleanLiteral(true),\n ]);\n } else if (type === \"node-default\") {\n return null;\n }\n\n let helper;\n if (type === \"default\") {\n helper = \"interopRequireDefault\";\n } else if (type === \"namespace\") {\n helper = \"interopRequireWildcard\";\n } else {\n throw new Error(`Unknown interop: ${type}`);\n }\n\n return callExpression(programPath.hub.addHelper(helper), [expr]);\n}\n\n/**\n * Create the runtime initialization statements for a given requested source.\n * These will initialize all of the runtime import/export logic that\n * can't be handled statically by the statements created by\n * buildExportInitializationStatements().\n */\nexport function buildNamespaceInitStatements(\n metadata: ModuleMetadata,\n sourceMetadata: SourceModuleMetadata,\n constantReexports: boolean | void = false,\n) {\n const statements = [];\n\n let srcNamespace: t.Node = identifier(sourceMetadata.name);\n if (sourceMetadata.lazy) srcNamespace = callExpression(srcNamespace, []);\n\n for (const localName of sourceMetadata.importsNamespace) {\n if (localName === sourceMetadata.name) continue;\n\n // Create and assign binding to namespace object\n statements.push(\n template.statement`var NAME = SOURCE;`({\n NAME: localName,\n SOURCE: cloneNode(srcNamespace),\n }),\n );\n }\n if (constantReexports) {\n statements.push(...buildReexportsFromMeta(metadata, sourceMetadata, true));\n }\n for (const exportName of sourceMetadata.reexportNamespace) {\n // Assign export to namespace object.\n statements.push(\n (sourceMetadata.lazy\n ? template.statement`\n Object.defineProperty(EXPORTS, \"NAME\", {\n enumerable: true,\n get: function() {\n return NAMESPACE;\n }\n });\n `\n : template.statement`EXPORTS.NAME = NAMESPACE;`)({\n EXPORTS: metadata.exportName,\n NAME: exportName,\n NAMESPACE: cloneNode(srcNamespace),\n }),\n );\n }\n if (sourceMetadata.reexportAll) {\n const statement = buildNamespaceReexport(\n metadata,\n cloneNode(srcNamespace),\n constantReexports,\n );\n statement.loc = sourceMetadata.reexportAll.loc;\n\n // Iterate props creating getter for each prop.\n statements.push(statement);\n }\n return statements;\n}\n\nconst ReexportTemplate = {\n constant: template.statement`EXPORTS.EXPORT_NAME = NAMESPACE_IMPORT;`,\n constantComputed: template.statement`EXPORTS[\"EXPORT_NAME\"] = NAMESPACE_IMPORT;`,\n spec: template.statement`\n Object.defineProperty(EXPORTS, \"EXPORT_NAME\", {\n enumerable: true,\n get: function() {\n return NAMESPACE_IMPORT;\n },\n });\n `,\n};\n\nfunction buildReexportsFromMeta(\n meta: ModuleMetadata,\n metadata: SourceModuleMetadata,\n constantReexports: boolean,\n) {\n const namespace = metadata.lazy\n ? callExpression(identifier(metadata.name), [])\n : identifier(metadata.name);\n\n const { stringSpecifiers } = meta;\n return Array.from(metadata.reexports, ([exportName, importName]) => {\n let NAMESPACE_IMPORT: t.Expression = cloneNode(namespace);\n if (importName === \"default\" && metadata.interop === \"node-default\") {\n // Nothing, it's ok as-is\n } else if (stringSpecifiers.has(importName)) {\n NAMESPACE_IMPORT = memberExpression(\n NAMESPACE_IMPORT,\n stringLiteral(importName),\n true,\n );\n } else {\n NAMESPACE_IMPORT = memberExpression(\n NAMESPACE_IMPORT,\n identifier(importName),\n );\n }\n const astNodes = {\n EXPORTS: meta.exportName,\n EXPORT_NAME: exportName,\n NAMESPACE_IMPORT,\n };\n if (constantReexports || isIdentifier(NAMESPACE_IMPORT)) {\n if (stringSpecifiers.has(exportName)) {\n return ReexportTemplate.constantComputed(astNodes);\n } else {\n return ReexportTemplate.constant(astNodes);\n }\n } else {\n return ReexportTemplate.spec(astNodes);\n }\n });\n}\n\n/**\n * Build an \"__esModule\" header statement setting the property on a given object.\n */\nfunction buildESModuleHeader(\n metadata: ModuleMetadata,\n enumerableModuleMeta: boolean | void = false,\n) {\n return (\n enumerableModuleMeta\n ? template.statement`\n EXPORTS.__esModule = true;\n `\n : template.statement`\n Object.defineProperty(EXPORTS, \"__esModule\", {\n value: true,\n });\n `\n )({ EXPORTS: metadata.exportName });\n}\n\n/**\n * Create a re-export initialization loop for a specific imported namespace.\n */\nfunction buildNamespaceReexport(\n metadata: ModuleMetadata,\n namespace: t.Identifier | t.CallExpression,\n constantReexports: boolean | void,\n) {\n return (\n constantReexports\n ? template.statement`\n Object.keys(NAMESPACE).forEach(function(key) {\n if (key === \"default\" || key === \"__esModule\") return;\n VERIFY_NAME_LIST;\n if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return;\n\n EXPORTS[key] = NAMESPACE[key];\n });\n `\n : // Also skip already assigned bindings if they are strictly equal\n // to be somewhat more spec-compliant when a file has multiple\n // namespace re-exports that would cause a binding to be exported\n // multiple times. However, multiple bindings of the same name that\n // export the same primitive value are silently skipped\n // (the spec requires an \"ambiguous bindings\" early error here).\n template.statement`\n Object.keys(NAMESPACE).forEach(function(key) {\n if (key === \"default\" || key === \"__esModule\") return;\n VERIFY_NAME_LIST;\n if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return;\n\n Object.defineProperty(EXPORTS, key, {\n enumerable: true,\n get: function() {\n return NAMESPACE[key];\n },\n });\n });\n `\n )({\n NAMESPACE: namespace,\n EXPORTS: metadata.exportName,\n VERIFY_NAME_LIST: metadata.exportNameListName\n ? template`\n if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return;\n `({ EXPORTS_LIST: metadata.exportNameListName })\n : null,\n });\n}\n\n/**\n * Build a statement declaring a variable that contains all of the exported\n * variable names in an object so they can easily be referenced from an\n * export * from statement to check for conflicts.\n */\nfunction buildExportNameListDeclaration(\n programPath: NodePath,\n metadata: ModuleMetadata,\n) {\n const exportedVars = Object.create(null);\n for (const data of metadata.local.values()) {\n for (const name of data.names) {\n exportedVars[name] = true;\n }\n }\n\n let hasReexport = false;\n for (const data of metadata.source.values()) {\n for (const exportName of data.reexports.keys()) {\n exportedVars[exportName] = true;\n }\n for (const exportName of data.reexportNamespace) {\n exportedVars[exportName] = true;\n }\n\n hasReexport = hasReexport || !!data.reexportAll;\n }\n\n if (!hasReexport || Object.keys(exportedVars).length === 0) return null;\n\n const name = programPath.scope.generateUidIdentifier(\"exportNames\");\n\n delete exportedVars.default;\n\n return {\n name: name.name,\n statement: variableDeclaration(\"var\", [\n variableDeclarator(name, valueToNode(exportedVars)),\n ]),\n };\n}\n\n/**\n * Create a set of statements that will initialize all of the statically-known\n * export names with their expected values.\n */\nfunction buildExportInitializationStatements(\n programPath: NodePath,\n metadata: ModuleMetadata,\n constantReexports: boolean | void = false,\n noIncompleteNsImportDetection: boolean | void = false,\n) {\n const initStatements: Array<[string, t.Statement | null]> = [];\n\n for (const [localName, data] of metadata.local) {\n if (data.kind === \"import\") {\n // No-open since these are explicitly set with the \"reexports\" block.\n } else if (data.kind === \"hoisted\") {\n initStatements.push([\n // data.names is always of length 1 because a hoisted export\n // name must be id of a function declaration\n data.names[0],\n buildInitStatement(metadata, data.names, identifier(localName)),\n ]);\n } else if (!noIncompleteNsImportDetection) {\n for (const exportName of data.names) {\n initStatements.push([exportName, null]);\n }\n }\n }\n\n for (const data of metadata.source.values()) {\n if (!constantReexports) {\n const reexportsStatements = buildReexportsFromMeta(metadata, data, false);\n const reexports = [...data.reexports.keys()];\n for (let i = 0; i < reexportsStatements.length; i++) {\n initStatements.push([reexports[i], reexportsStatements[i]]);\n }\n }\n if (!noIncompleteNsImportDetection) {\n for (const exportName of data.reexportNamespace) {\n initStatements.push([exportName, null]);\n }\n }\n }\n\n // https://tc39.es/ecma262/#sec-module-namespace-exotic-objects\n // The [Exports] list is ordered as if an Array of those String values\n // had been sorted using %Array.prototype.sort% using undefined as comparefn\n initStatements.sort(([a], [b]) => {\n if (a < b) return -1;\n if (b < a) return 1;\n return 0;\n });\n\n const results = [];\n if (noIncompleteNsImportDetection) {\n for (const [, initStatement] of initStatements) {\n results.push(initStatement);\n }\n } else {\n // We generate init statements (`exports.a = exports.b = ... = void 0`)\n // for every 100 exported names to avoid deeply-nested AST structures.\n const chunkSize = 100;\n for (let i = 0; i < initStatements.length; i += chunkSize) {\n let uninitializedExportNames = [];\n for (let j = 0; j < chunkSize && i + j < initStatements.length; j++) {\n const [exportName, initStatement] = initStatements[i + j];\n if (initStatement !== null) {\n if (uninitializedExportNames.length > 0) {\n results.push(\n buildInitStatement(\n metadata,\n uninitializedExportNames,\n programPath.scope.buildUndefinedNode(),\n ),\n );\n // reset after uninitializedExportNames has been transformed\n // to init statements\n uninitializedExportNames = [];\n }\n results.push(initStatement);\n } else {\n uninitializedExportNames.push(exportName);\n }\n }\n if (uninitializedExportNames.length > 0) {\n results.push(\n buildInitStatement(\n metadata,\n uninitializedExportNames,\n programPath.scope.buildUndefinedNode(),\n ),\n );\n }\n }\n }\n\n return results;\n}\n\n/**\n * Given a set of export names, create a set of nested assignments to\n * initialize them all to a given expression.\n */\nconst InitTemplate = {\n computed: template.expression`EXPORTS[\"NAME\"] = VALUE`,\n default: template.expression`EXPORTS.NAME = VALUE`,\n};\n\nfunction buildInitStatement(\n metadata: ModuleMetadata,\n exportNames: string[],\n initExpr: t.Expression,\n) {\n const { stringSpecifiers, exportName: EXPORTS } = metadata;\n return expressionStatement(\n exportNames.reduce((acc, exportName) => {\n const params = {\n EXPORTS,\n NAME: exportName,\n VALUE: acc,\n };\n if (stringSpecifiers.has(exportName)) {\n return InitTemplate.computed(params);\n } else {\n return InitTemplate.default(params);\n }\n }, initExpr),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAL,OAAA;AA8BA,IAAAM,cAAA,GAAAN,OAAA;AAaA,IAAAO,cAAA,GAAAP,OAAA;AA7BA,MAAM;EACJQ,cAAc;EACdC,cAAc;EACdC,SAAS;EACTC,SAAS;EACTC,gBAAgB;EAChBC,mBAAmB;EACnBC,UAAU;EACVC,YAAY;EACZC,gBAAgB;EAChBC,aAAa;EACbC,WAAW;EACXC,mBAAmB;EACnBC;AACF,CAAC,GAAGC,WAAC;AAI8B;EACnB;IACQ;MAElBC,OAAO,CAACC,sBAAsB,GAE5B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