| | |
| | | const transformImportCall = (0, _utils.createDynamicImportTransform)(api); |
| | | const { |
| | | strictNamespace = false, |
| | | mjsStrictNamespace = true, |
| | | mjsStrictNamespace = strictNamespace, |
| | | allowTopLevelThis, |
| | | strict, |
| | | strictMode, |
| | | noInterop, |
| | | importInterop, |
| | | lazy = false, |
| | | allowCommonJSExports = true |
| | | allowCommonJSExports = true, |
| | | loose = false |
| | | } = options; |
| | | const constantReexports = (_api$assumption = api.assumption("constantReexports")) != null ? _api$assumption : options.loose; |
| | | const enumerableModuleMeta = (_api$assumption2 = api.assumption("enumerableModuleMeta")) != null ? _api$assumption2 : options.loose; |
| | | const constantReexports = (_api$assumption = api.assumption("constantReexports")) != null ? _api$assumption : loose; |
| | | const enumerableModuleMeta = (_api$assumption2 = api.assumption("enumerableModuleMeta")) != null ? _api$assumption2 : loose; |
| | | const noIncompleteNsImportDetection = (_api$assumption3 = api.assumption("noIncompleteNsImportDetection")) != null ? _api$assumption3 : false; |
| | | |
| | | if (typeof lazy !== "boolean" && typeof lazy !== "function" && (!Array.isArray(lazy) || !lazy.every(item => typeof item === "string"))) { |
| | |
| | | } |
| | | |
| | | path.replaceWith(getAssertion(localName)); |
| | | }, |
| | | |
| | | UpdateExpression(path) { |
| | | const arg = path.get("argument"); |
| | | const localName = arg.node.name; |
| | | if (localName !== "module" && localName !== "exports") return; |
| | | const localBinding = path.scope.getBinding(localName); |
| | | const rootBinding = this.scope.getBinding(localName); |
| | | if (rootBinding !== localBinding) return; |
| | | path.replaceWith(_core.types.assignmentExpression(path.node.operator[0] + "=", arg.node, getAssertion(localName))); |
| | | }, |
| | | |
| | | AssignmentExpression(path) { |
| | |
| | | path.scope.rename("__dirname"); |
| | | |
| | | if (!allowCommonJSExports) { |
| | | (0, _helperSimpleAccess.default)(path, new Set(["module", "exports"])); |
| | | (0, _helperSimpleAccess.default)(path, new Set(["module", "exports"]), false); |
| | | path.traverse(moduleExportsVisitor, { |
| | | scope: path.scope |
| | | }); |
| | |
| | | |
| | | (0, _helperModuleTransforms.ensureStatementsHoisted)(headers); |
| | | path.unshiftContainer("body", headers); |
| | | path.get("body").forEach(path => { |
| | | if (headers.indexOf(path.node) === -1) return; |
| | | |
| | | if (path.isVariableDeclaration()) { |
| | | path.scope.registerDeclaration(path); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |