diff options
Diffstat (limited to 'node_modules/@babel/plugin-transform-function-name/lib')
| -rw-r--r-- | node_modules/@babel/plugin-transform-function-name/lib/index.js | 15 | ||||
| -rw-r--r-- | node_modules/@babel/plugin-transform-function-name/lib/index.js.map | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/node_modules/@babel/plugin-transform-function-name/lib/index.js b/node_modules/@babel/plugin-transform-function-name/lib/index.js index 16df763b..40e29f96 100644 --- a/node_modules/@babel/plugin-transform-function-name/lib/index.js +++ b/node_modules/@babel/plugin-transform-function-name/lib/index.js @@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { exports.default = void 0; var _helperCompilationTargets = require("@babel/helper-compilation-targets"); var _helperPluginUtils = require("@babel/helper-plugin-utils"); -var _helperFunctionName = require("@babel/helper-function-name"); var _default = exports.default = (0, _helperPluginUtils.declare)(api => { api.assertVersion(7); const supportUnicodeId = !(0, _helperCompilationTargets.isRequired)("transform-unicode-escapes", api.targets()); @@ -16,16 +15,22 @@ var _default = exports.default = (0, _helperPluginUtils.declare)(api => { FunctionExpression: { exit(path) { if (path.key !== "value" && !path.parentPath.isObjectProperty()) { - const replacement = (0, _helperFunctionName.default)(path); - if (replacement) path.replaceWith(replacement); + { + var _path$ensureFunctionN; + (_path$ensureFunctionN = path.ensureFunctionName) != null ? _path$ensureFunctionN : path.ensureFunctionName = require("@babel/traverse").NodePath.prototype.ensureFunctionName; + } + path.ensureFunctionName(supportUnicodeId); } } }, ObjectProperty(path) { const value = path.get("value"); if (value.isFunction()) { - const newNode = (0, _helperFunctionName.default)(value, false, supportUnicodeId); - if (newNode) value.replaceWith(newNode); + { + var _value$ensureFunction; + (_value$ensureFunction = value.ensureFunctionName) != null ? _value$ensureFunction : value.ensureFunctionName = require("@babel/traverse").NodePath.prototype.ensureFunctionName; + } + value.ensureFunctionName(supportUnicodeId); } } } diff --git a/node_modules/@babel/plugin-transform-function-name/lib/index.js.map b/node_modules/@babel/plugin-transform-function-name/lib/index.js.map index 75833124..85640fda 100644 --- a/node_modules/@babel/plugin-transform-function-name/lib/index.js.map +++ b/node_modules/@babel/plugin-transform-function-name/lib/index.js.map @@ -1 +1 @@ -{"version":3,"names":["_helperCompilationTargets","require","_helperPluginUtils","_helperFunctionName","_default","exports","default","declare","api","assertVersion","supportUnicodeId","isRequired","targets","name","visitor","FunctionExpression","exit","path","key","parentPath","isObjectProperty","replacement","nameFunction","replaceWith","ObjectProperty","value","get","isFunction","newNode"],"sources":["../src/index.ts"],"sourcesContent":["import { isRequired } from \"@babel/helper-compilation-targets\";\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport nameFunction from \"@babel/helper-function-name\";\n\nexport default declare(api => {\n api.assertVersion(REQUIRED_VERSION(7));\n const supportUnicodeId = !isRequired(\n \"transform-unicode-escapes\",\n api.targets(),\n );\n\n return {\n name: \"transform-function-name\",\n\n visitor: {\n FunctionExpression: {\n exit(path) {\n if (path.key !== \"value\" && !path.parentPath.isObjectProperty()) {\n const replacement = nameFunction(path);\n if (replacement) path.replaceWith(replacement);\n }\n },\n },\n\n ObjectProperty(path) {\n const value = path.get(\"value\");\n if (value.isFunction()) {\n const newNode = nameFunction(\n // @ts-expect-error Fixme: should check ArrowFunctionExpression\n value,\n false,\n supportUnicodeId,\n );\n if (newNode) value.replaceWith(newNode);\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAAuD,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExC,IAAAC,0BAAO,EAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAa,CAAkB,CAAE,CAAC;EACtC,MAAMC,gBAAgB,GAAG,CAAC,IAAAC,oCAAU,EAClC,2BAA2B,EAC3BH,GAAG,CAACI,OAAO,CAAC,CACd,CAAC;EAED,OAAO;IACLC,IAAI,EAAE,yBAAyB;IAE/BC,OAAO,EAAE;MACPC,kBAAkB,EAAE;QAClBC,IAAIA,CAACC,IAAI,EAAE;UACT,IAAIA,IAAI,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,IAAI,CAACE,UAAU,CAACC,gBAAgB,CAAC,CAAC,EAAE;YAC/D,MAAMC,WAAW,GAAG,IAAAC,2BAAY,EAACL,IAAI,CAAC;YACtC,IAAII,WAAW,EAAEJ,IAAI,CAACM,WAAW,CAACF,WAAW,CAAC;UAChD;QACF;MACF,CAAC;MAEDG,cAAcA,CAACP,IAAI,EAAE;QACnB,MAAMQ,KAAK,GAAGR,IAAI,CAACS,GAAG,CAAC,OAAO,CAAC;QAC/B,IAAID,KAAK,CAACE,UAAU,CAAC,CAAC,EAAE;UACtB,MAAMC,OAAO,GAAG,IAAAN,2BAAY,EAE1BG,KAAK,EACL,KAAK,EACLf,gBACF,CAAC;UACD,IAAIkB,OAAO,EAAEH,KAAK,CAACF,WAAW,CAACK,OAAO,CAAC;QACzC;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
\ No newline at end of file +{"version":3,"names":["_helperCompilationTargets","require","_helperPluginUtils","_default","exports","default","declare","api","assertVersion","supportUnicodeId","isRequired","targets","name","visitor","FunctionExpression","exit","path","key","parentPath","isObjectProperty","_path$ensureFunctionN","ensureFunctionName","NodePath","prototype","ObjectProperty","value","get","isFunction","_value$ensureFunction"],"sources":["../src/index.ts"],"sourcesContent":["import { isRequired } from \"@babel/helper-compilation-targets\";\nimport { declare } from \"@babel/helper-plugin-utils\";\n\nexport default declare(api => {\n api.assertVersion(REQUIRED_VERSION(7));\n const supportUnicodeId = !isRequired(\n \"transform-unicode-escapes\",\n api.targets(),\n );\n\n return {\n name: \"transform-function-name\",\n\n visitor: {\n FunctionExpression: {\n exit(path) {\n if (path.key !== \"value\" && !path.parentPath.isObjectProperty()) {\n if (!process.env.BABEL_8_BREAKING && !USE_ESM && !IS_STANDALONE) {\n // polyfill when being run by an older Babel version\n path.ensureFunctionName ??=\n // eslint-disable-next-line no-restricted-globals\n require(\"@babel/traverse\").NodePath.prototype.ensureFunctionName;\n }\n path.ensureFunctionName(supportUnicodeId);\n }\n },\n },\n\n ObjectProperty(path) {\n const value = path.get(\"value\");\n if (value.isFunction()) {\n if (!process.env.BABEL_8_BREAKING && !USE_ESM && !IS_STANDALONE) {\n // polyfill when being run by an older Babel version\n value.ensureFunctionName ??=\n // eslint-disable-next-line no-restricted-globals\n require(\"@babel/traverse\").NodePath.prototype.ensureFunctionName;\n }\n // @ts-expect-error Fixme: should check ArrowFunctionExpression\n value.ensureFunctionName(supportUnicodeId);\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAAqD,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEtC,IAAAC,0BAAO,EAACC,GAAG,IAAI;EAC5BA,GAAG,CAACC,aAAa,CAAkB,CAAE,CAAC;EACtC,MAAMC,gBAAgB,GAAG,CAAC,IAAAC,oCAAU,EAClC,2BAA2B,EAC3BH,GAAG,CAACI,OAAO,CAAC,CACd,CAAC;EAED,OAAO;IACLC,IAAI,EAAE,yBAAyB;IAE/BC,OAAO,EAAE;MACPC,kBAAkB,EAAE;QAClBC,IAAIA,CAACC,IAAI,EAAE;UACT,IAAIA,IAAI,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,IAAI,CAACE,UAAU,CAACC,gBAAgB,CAAC,CAAC,EAAE;YACE;cAAA,IAAAC,qBAAA;cAE/D,CAAAA,qBAAA,GAAAJ,IAAI,CAACK,kBAAkB,YAAAD,qBAAA,GAAvBJ,IAAI,CAACK,kBAAkB,GAErBpB,OAAO,CAAC,iBAAiB,CAAC,CAACqB,QAAQ,CAACC,SAAS,CAACF,kBAAkB;YACpE;YACAL,IAAI,CAACK,kBAAkB,CAACZ,gBAAgB,CAAC;UAC3C;QACF;MACF,CAAC;MAEDe,cAAcA,CAACR,IAAI,EAAE;QACnB,MAAMS,KAAK,GAAGT,IAAI,CAACU,GAAG,CAAC,OAAO,CAAC;QAC/B,IAAID,KAAK,CAACE,UAAU,CAAC,CAAC,EAAE;UAC2C;YAAA,IAAAC,qBAAA;YAE/D,CAAAA,qBAAA,GAAAH,KAAK,CAACJ,kBAAkB,YAAAO,qBAAA,GAAxBH,KAAK,CAACJ,kBAAkB,GAEtBpB,OAAO,CAAC,iBAAiB,CAAC,CAACqB,QAAQ,CAACC,SAAS,CAACF,kBAAkB;UACpE;UAEAI,KAAK,CAACJ,kBAAkB,CAACZ,gBAAgB,CAAC;QAC5C;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
\ No newline at end of file |
