hexo/node_modules/@babel/plugin-transform-modules-co.../lib/index.js.map

1 line
18 KiB
Plaintext
Raw Normal View History

2023-09-25 15:58:56 +08:00
{"version":3,"names":["declare","api","options","assertVersion","strictNamespace","mjsStrictNamespace","allowTopLevelThis","strict","strictMode","noInterop","importInterop","lazy","allowCommonJSExports","loose","constantReexports","assumption","enumerableModuleMeta","noIncompleteNsImportDetection","Array","isArray","every","item","Error","getAssertion","localName","template","expression","ast","moduleExportsVisitor","ReferencedIdentifier","path","node","name","localBinding","scope","getBinding","rootBinding","parentPath","isObjectProperty","value","isObjectPattern","isAssignmentExpression","left","replaceWith","UpdateExpression","arg","get","isIdentifier","t","assignmentExpression","operator","AssignmentExpression","right","sequenceExpression","isPattern","ids","getOuterBindingIdentifiers","Object","keys","filter","pre","file","set","visitor","CallExpression","has","isImport","callee","rename","parent","transformDynamicImport","Program","exit","state","isModule","simplifyAccess","Set","traverse","moduleName","getModuleName","opts","stringLiteral","meta","headers","rewriteModuleStatementsAndPrepareHeader","exportName","esNamespaceOnly","filename","test","source","metadata","loadExpr","callExpression","identifier","header","isSideEffectImport","expressionStatement","referenced","init","wrapInterop","interop","statement","loc","push","buildNamespaceInitStatements","ensureStatementsHoisted","unshiftContainer","forEach","indexOf","isVariableDeclaration","registerDeclaration"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport {\n isModule,\n rewriteModuleStatementsAndPrepareHeader,\n type RewriteModuleStatementsAndPrepareHeaderOptions,\n isSideEffectImport,\n buildNamespaceInitStatements,\n ensureStatementsHoisted,\n wrapInterop,\n getModuleName,\n} from \"@babel/helper-module-transforms\";\nimport simplifyAccess from \"@babel/helper-simple-access\";\nimport { template, types as t } from \"@babel/core\";\nimport type { PluginOptions } from \"@babel/helper-module-transforms\";\nimport type { Visitor, Scope } from \"@babel/traverse\";\n\nimport { transformDynamicImport } from \"./dynamic-import\";\n\nexport interface Options extends PluginOptions {\n allowCommonJSExports?: boolean;\n allowTopLevelThis?: boolean;\n importInterop?: RewriteModuleStatementsAndPrepareHeaderOptions[\"importInterop\"];\n lazy?: RewriteModuleStatementsAndPrepareHeaderOptions[\"lazy\"];\n loose?: boolean;\n mjsStrictNamespace?: boolean;\n noInterop?: boolean;\n strict?: boolean;\n strictMode?: boolean;\n strictNamespace?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(7);\n\n const {\n // 'true' for imports to strictly have .default, instead of having\n // destructuring-like behavior for their properties. This matches the behavior\n // of the initial Node.js (v12) behavior when importing a CommonJS without\n // the __esMoule property.\n // .strictNamespace is for non-mjs files, mjsStrictNamespace if for mjs files.\n strictNamespace = false,\n mjsStrictNamespace = strictNamespace,\n\n allowTopLevelThis,\n strict,\n strictMode,\n noInterop,\n importInterop,\n lazy = false,\n // Defaulting to 'true' for now. May change before 7.x major.\n allowCommonJSExports = true,\n loose = false,\n } = options;\n\n const constantReexports = api.assumption(\"constantReexports\") ?? loose;\n const enumerableModuleMeta = api.assumption(\"enumerableModuleMeta\") ?? loose;\n const noIncompleteNsImportDetection =\n api.assumption(\"noIncompleteNsImportDetection\") ?? false;\n\n if (\n typeof lazy !== \"boolean\" &&\n typeof lazy !== \"function\" &&\n (!Array.isArray(lazy) || !lazy.every(item => typeof item === \"string\"))\n ) {\n throw new Error(`.lazy must be a boolean, array of strings, or a function`);\n }\n\n if (typeof strictNamespace !== \"boolean\") {\n throw new Error(`.strictNamespace must be a boolean, or undefined`);\n }\n if (typeof mjsStrictNamespace !== \"boolean\"