diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.cjs | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.cjs')
| -rw-r--r-- | node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.cjs | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.cjs b/node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.cjs deleted file mode 100644 index 2e578b1e..00000000 --- a/node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.cjs +++ /dev/null @@ -1,69 +0,0 @@ -; -const { - getImportSource, - getRequireSource, - isPolyfillSource -} = require("./utils.cjs"); -const BABEL_POLYFILL_DEPRECATION = ` - \`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\` - and \`regenerator-runtime/runtime\` separately`; -const NO_DIRECT_POLYFILL_IMPORT = ` - When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed. - Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`; -module.exports = function ({ - template -}, { - regenerator, - deprecated, - usage -}) { - return { - name: "preset-env/replace-babel-polyfill", - visitor: { - ImportDeclaration(path) { - const src = getImportSource(path); - if (usage && isPolyfillSource(src)) { - console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src)); - if (!deprecated) path.remove(); - } else if (src === "@babel/polyfill") { - if (deprecated) { - console.warn(BABEL_POLYFILL_DEPRECATION); - } else if (regenerator) { - path.replaceWithMultiple(template.ast` - import "core-js"; - import "regenerator-runtime/runtime.js"; - `); - } else { - path.replaceWith(template.ast` - import "core-js"; - `); - } - } - }, - Program(path) { - path.get("body").forEach(bodyPath => { - const src = getRequireSource(bodyPath); - if (usage && isPolyfillSource(src)) { - console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src)); - if (!deprecated) bodyPath.remove(); - } else if (src === "@babel/polyfill") { - if (deprecated) { - console.warn(BABEL_POLYFILL_DEPRECATION); - } else if (regenerator) { - bodyPath.replaceWithMultiple(template.ast` - require("core-js"); - require("regenerator-runtime/runtime.js"); - `); - } else { - bodyPath.replaceWith(template.ast` - require("core-js"); - `); - } - } - }); - } - } - }; -}; - -//# sourceMappingURL=babel-polyfill.cjs.map |
