From 26a09f08cf1ed43c640879f23fdad56c5c9282f7 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:02:38 +0800 Subject: [PATCH] TODO#139884 Banner 1 文案調整 --- PAMapp/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js | 28 +++++++++++++++++++++++----- 1 files changed, 23 insertions(+), 5 deletions(-) diff --git a/PAMapp/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js b/PAMapp/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js index 7057b88..fee5191 100644 --- a/PAMapp/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js +++ b/PAMapp/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js @@ -22,17 +22,18 @@ 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"))) { @@ -74,6 +75,16 @@ } 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) { @@ -134,7 +145,7 @@ 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 }); @@ -192,6 +203,13 @@ (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); + } + }); } } -- Gitblit v1.8.0