You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
3.1 KiB

1 month ago
{"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,aAA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