You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@babel/plugin-transform-runtime

Package Overview
Dependencies
Maintainers
4
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-runtime - npm Package Compare versions

Comparing version
8.0.0-beta.3
to
8.0.0-beta.4
+8
-18
lib/index.js

@@ -6,3 +6,3 @@ import { declare } from "@babel/helper-plugin-utils";

export default declare((api, options, dirname) => {
api.assertVersion("8.0.0-beta.3");
api.assertVersion("^7.0.0-0 || ^8.0.0 || 8.0.0-beta.4");
const {

@@ -22,3 +22,2 @@ version: runtimeVersion = "8.0.0-beta.0",

}
;
if (Object.hasOwn(options, "useBuiltIns")) {

@@ -38,16 +37,10 @@ if (options.useBuiltIns) {

}
{
if (Object.hasOwn(options, "regenerator")) {
throw new Error("The 'regenerator' option has been removed. The generators transform " + "no longers relies on a 'regeneratorRuntime' global. " + "If you still need to replace imports to the 'regeneratorRuntime' " + "global, you can use babel-plugin-polyfill-regenerator.");
}
if (Object.hasOwn(options, "regenerator")) {
throw new Error("The 'regenerator' option has been removed. The generators transform " + "no longers relies on a 'regeneratorRuntime' global. " + "If you still need to replace imports to the 'regeneratorRuntime' " + "global, you can use babel-plugin-polyfill-regenerator.");
}
{
if (Object.hasOwn(options, "useESModules")) {
throw new Error("The 'useESModules' option has been removed. @babel/runtime now uses " + "package.json#exports to support both CommonJS and ESM helpers.");
}
if (Object.hasOwn(options, "useESModules")) {
throw new Error("The 'useESModules' option has been removed. @babel/runtime now uses " + "package.json#exports to support both CommonJS and ESM helpers.");
}
{
if (Object.hasOwn(options, "helpers")) {
throw new Error("The 'helpers' option has been removed. " + "Remove the plugin from your config if " + "you want to disable helpers import injection.");
}
if (Object.hasOwn(options, "helpers")) {
throw new Error("The 'helpers' option has been removed. " + "Remove the plugin from your config if " + "you want to disable helpers import injection.");
}

@@ -59,9 +52,6 @@ const HEADER_HELPERS = new Set(["interopRequireWildcard", "interopRequireDefault"]);

pre(file) {
;
let modulePath;
file.set("helperGenerator", name => {
modulePath ??= getRuntimePath(moduleName ?? file.get("runtimeHelpersModuleName") ?? "@babel/runtime", dirname, absoluteRuntime);
{
if (!file.availableHelper(name, runtimeVersion)) return;
}
if (!file.availableHelper(name, runtimeVersion)) return;
const blockHoist = HEADER_HELPERS.has(name) && !isModule(file.path) ? 4 : undefined;

@@ -68,0 +58,0 @@ let helperPath = `${modulePath}/helpers/${name}`;

@@ -1,1 +0,1 @@

{"version":3,"names":["declare","addDefault","isModule","types","t","getRuntimePath","resolveFSPath","api","options","dirname","assertVersion","version","runtimeVersion","absoluteRuntime","moduleName","Error","Object","hasOwn","useBuiltIns","polyfill","HEADER_HELPERS","Set","name","inherits","undefined","pre","file","modulePath","set","get","availableHelper","blockHoist","has","path","helperPath","addDefaultImport","cache","Map","source","nameHint","isHelper","cacheKey","key","cached","cloneNode","importedInterop"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { addDefault, isModule } from \"@babel/helper-module-imports\";\nimport { types as t } from \"@babel/core\";\n\nimport getRuntimePath, { resolveFSPath } from \"./get-runtime-path/index.ts\";\n\n// TODO(Babel 8): Remove this\nimport babel7 from \"./babel-7/index.cjs\" with { if: \"!process.env.BABEL_8_BREAKING\" };\nimport semver from \"semver\" with { if: \"!process.env.BABEL_8_BREAKING\" };\n\nexport interface Options {\n absoluteRuntime?: boolean;\n corejs?: string | number | { version: string | number; proposals?: boolean };\n helpers?: boolean;\n version?: string;\n moduleName?: null | string;\n}\n\nexport default declare((api, options: Options, dirname) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const {\n version: runtimeVersion = process.env.BABEL_8_BREAKING\n ? \"8.0.0-beta.0\"\n : \"7.0.0-beta.0\",\n absoluteRuntime = false,\n moduleName = null,\n } = options;\n\n if (\n typeof absoluteRuntime !== \"boolean\" &&\n typeof absoluteRuntime !== \"string\"\n ) {\n throw new Error(\n \"The 'absoluteRuntime' option must be undefined, a boolean, or a string.\",\n );\n }\n\n if (typeof runtimeVersion !== \"string\") {\n throw new Error(`The 'version' option must be a version string.`);\n }\n\n if (moduleName !== null && typeof moduleName !== \"string\") {\n throw new Error(\"The 'moduleName' option must be null or a string.\");\n }\n\n if (!process.env.BABEL_8_BREAKING) {\n // In recent @babel/runtime versions, we can use require(\"helper\").default\n // instead of require(\"helper\") so that it has the same interface as the\n // ESM helper, and bundlers can better exchange one format for the other.\n\n // eslint-disable-next-line no-var\n var supportsCJSDefault: boolean;\n if (!runtimeVersion) {\n // If the range is unavailable, we're running the script during Babel's\n // build process, and we want to assume that all versions are satisfied so\n // that the built output will include all definitions.\n supportsCJSDefault = true;\n } else {\n // semver.intersects() has some surprising behavior with comparing ranges\n // with pre-release versions. We add '^' to ensure that we are always\n // comparing ranges with ranges, which sidesteps this logic.\n // For example:\n //\n // semver.intersects(`<7.0.1`, \"7.0.0-beta.0\") // false - surprising\n // semver.intersects(`<7.0.1`, \"^7.0.0-beta.0\") // true - expected\n //\n // This is because the first falls back to\n //\n // semver.satisfies(\"7.0.0-beta.0\", `<7.0.1`) // false - surprising\n //\n // and this fails because a prerelease version can only satisfy a range\n // if it is a prerelease within the same major/minor/patch range.\n //\n // Note: If this is found to have issues, please also revisit the logic in\n // babel-core's availableHelper() API.\n const normalizedRuntimeVersion = semver.valid(runtimeVersion)\n ? `^${runtimeVersion}`\n : runtimeVersion;\n\n supportsCJSDefault =\n !semver.intersects(`<7.13.0`, normalizedRuntimeVersion) &&\n !semver.intersects(`>=8.0.0`, normalizedRuntimeVersion);\n }\n }\n\n if (Object.hasOwn(options, \"useBuiltIns\")) {\n // @ts-expect-error deprecated options\n if (options.useBuiltIns) {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. The @babel/runtime \" +\n \"module now uses builtins by default.\",\n );\n } else {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (Object.hasOwn(options, \"polyfill\")) {\n // @ts-expect-error deprecated options\n if (options.polyfill === false) {\n throw new Error(\n \"The 'polyfill' option has been removed. The @babel/runtime \" +\n \"module now skips polyfilling by default.\",\n );\n } else {\n throw new Error(\n \"The 'polyfill' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (process.env.BABEL_8_BREAKING) {\n if (Object.hasOwn(options, \"regenerator\")) {\n throw new Error(\n \"The 'regenerator' option has been removed. The generators transform \" +\n \"no longers relies on a 'regeneratorRuntime' global. \" +\n \"If you still need to replace imports to the 'regeneratorRuntime' \" +\n \"global, you can use babel-plugin-polyfill-regenerator.\",\n );\n }\n }\n\n if (process.env.BABEL_8_BREAKING) {\n if (Object.hasOwn(options, \"useESModules\")) {\n throw new Error(\n \"The 'useESModules' option has been removed. @babel/runtime now uses \" +\n \"package.json#exports to support both CommonJS and ESM helpers.\",\n );\n }\n } else {\n // @ts-expect-error(Babel 7 vs Babel 8)\n const { useESModules = false } = options;\n if (typeof useESModules !== \"boolean\" && useESModules !== \"auto\") {\n throw new Error(\n \"The 'useESModules' option must be undefined, or a boolean, or 'auto'.\",\n );\n }\n\n // eslint-disable-next-line no-var\n var esModules =\n useESModules === \"auto\"\n ? api.caller(caller => !!caller?.supportsStaticESM)\n : useESModules;\n }\n\n if (process.env.BABEL_8_BREAKING) {\n if (Object.hasOwn(options, \"helpers\")) {\n throw new Error(\n \"The 'helpers' option has been removed. \" +\n \"Remove the plugin from your config if \" +\n \"you want to disable helpers import injection.\",\n );\n }\n } else {\n // eslint-disable-next-line no-var\n var { helpers: useRuntimeHelpers = true } = options;\n\n if (typeof useRuntimeHelpers !== \"boolean\") {\n throw new Error(\"The 'helpers' option must be undefined, or a boolean.\");\n }\n }\n\n const HEADER_HELPERS = new Set([\n \"interopRequireWildcard\",\n \"interopRequireDefault\",\n ]);\n\n return {\n name: \"transform-runtime\",\n\n inherits: process.env.BABEL_8_BREAKING\n ? undefined\n : babel7.createPolyfillPlugins(options, runtimeVersion, absoluteRuntime),\n\n pre(file) {\n if (!process.env.BABEL_8_BREAKING && !useRuntimeHelpers) return;\n\n let modulePath: string;\n\n file.set(\"helperGenerator\", (name: string) => {\n modulePath ??= getRuntimePath(\n moduleName ??\n file.get(\"runtimeHelpersModuleName\") ??\n \"@babel/runtime\",\n dirname,\n absoluteRuntime,\n );\n\n // If the helper didn't exist yet at the version given, we bail\n // out and let Babel either insert it directly, or throw an error\n // so that plugins can handle that case properly.\n if (!process.env.BABEL_8_BREAKING) {\n if (!file.availableHelper?.(name, runtimeVersion)) {\n if (name === \"regeneratorRuntime\") {\n // For regeneratorRuntime, we can fallback to the old behavior of\n // relying on the regeneratorRuntime global. If the 'regenerator'\n // option is not disabled, babel-plugin-polyfill-regenerator will\n // then replace it with a @babel/helpers/regenerator import.\n //\n // We must wrap it in a function, because built-in Babel helpers\n // are functions.\n return t.arrowFunctionExpression(\n [],\n t.identifier(\"regeneratorRuntime\"),\n );\n }\n if (\n name === \"regenerator\" ||\n name === \"regeneratorKeys\" ||\n name === \"regeneratorAsync\" ||\n name === \"regeneratorAsyncGen\"\n ) {\n // See the `newHelpersAvailable` function in\n // babel-plugin-transform-regenerator/src/regenerator/util.ts\n return t.identifier(\"__interal_marker_fallback_regenerator__\");\n }\n return;\n }\n } else {\n if (!file.availableHelper(name, runtimeVersion)) return;\n }\n\n // Explicitly set the CommonJS interop helpers to their reserve\n // blockHoist of 4 so they are guaranteed to exist\n // when other things used them to import.\n const blockHoist =\n HEADER_HELPERS.has(name) && !isModule(file.path) ? 4 : undefined;\n\n let helperPath = `${modulePath}/helpers/${\n !process.env.BABEL_8_BREAKING &&\n esModules &&\n file.path.node.sourceType === \"module\"\n ? \"esm/\" + name\n : name\n }`;\n if (absoluteRuntime) helperPath = resolveFSPath(helperPath);\n\n return addDefaultImport(helperPath, name, blockHoist, true);\n });\n\n const cache = new Map();\n\n function addDefaultImport(\n source: string,\n nameHint: string,\n blockHoist: number,\n isHelper = false,\n ) {\n // If something on the page adds a helper when the file is an ES6\n // file, we can't reused the cached helper name after things have been\n // transformed because it has almost certainly been renamed.\n const cacheKey = isModule(file.path);\n const key = `${source}:${nameHint}:${cacheKey || \"\"}`;\n\n let cached = cache.get(key);\n if (cached) {\n cached = t.cloneNode(cached);\n } else {\n cached = addDefault(file.path, source, {\n importedInterop: (\n process.env.BABEL_8_BREAKING\n ? isHelper\n : isHelper && supportsCJSDefault\n )\n ? \"compiled\"\n : \"uncompiled\",\n nameHint,\n blockHoist,\n });\n\n cache.set(key, cached);\n }\n return cached;\n }\n },\n };\n});\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,4BAA4B;AACpD,SAASC,UAAU,EAAEC,QAAQ,QAAQ,8BAA8B;AACnE,SAASC,KAAK,IAAIC,CAAC,QAAQ,aAAa;AAExC,OAAOC,cAAc,IAAIC,aAAa,QAAQ,6BAA6B;AAc3E,eAAeN,OAAO,CAAC,CAACO,GAAG,EAAEC,OAAgB,EAAEC,OAAO,KAAK;EACzDF,GAAG,CAACG,aAAa,eAAoB,CAAC;EAEtC,MAAM;IACJC,OAAO,EAAEC,cAAc,GACnB,cACc;IAClBC,eAAe,GAAG,KAAK;IACvBC,UAAU,GAAG;EACf,CAAC,GAAGN,OAAO;EAEX,IACE,OAAOK,eAAe,KAAK,SAAS,IACpC,OAAOA,eAAe,KAAK,QAAQ,EACnC;IACA,MAAM,IAAIE,KAAK,CACb,yEACF,CAAC;EACH;EAEA,IAAI,OAAOH,cAAc,KAAK,QAAQ,EAAE;IACtC,MAAM,IAAIG,KAAK,CAAC,gDAAgD,CAAC;EACnE;EAEA,IAAID,UAAU,KAAK,IAAI,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACzD,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;EACtE;EAAC;EA0CD,IAAIC,MAAM,CAACC,MAAM,CAACT,OAAO,EAAE,aAAa,CAA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B;QACA,OAAOA,MAAM;MACf;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
{"version":3,"names":["declare","addDefault","isModule","types","t","getRuntimePath","resolveFSPath","api","options","dirname","assertVersion","version","runtimeVersion","absoluteRuntime","moduleName","Error","Object","hasOwn","useBuiltIns","polyfill","HEADER_HELPERS","Set","name","inherits","undefined","pre","file","modulePath","set","get","availableHelper","blockHoist","has","path","helperPath","addDefaultImport","cache","Map","source","nameHint","isHelper","cacheKey","key","cached","cloneNode","importedInterop"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport { addDefault, isModule } from \"@babel/helper-module-imports\";\nimport { types as t } from \"@babel/core\";\n\nimport getRuntimePath, { resolveFSPath } from \"./get-runtime-path/index.ts\";\n\n// TODO(Babel 8): Remove this\n\nexport interface Options {\n absoluteRuntime?: boolean;\n corejs?: string | number | { version: string | number; proposals?: boolean };\n helpers?: boolean;\n version?: string;\n moduleName?: null | string;\n}\n\nexport default declare((api, options: Options, dirname) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n const {\n version: runtimeVersion = \"8.0.0-beta.0\",\n absoluteRuntime = false,\n moduleName = null,\n } = options;\n\n if (\n typeof absoluteRuntime !== \"boolean\" &&\n typeof absoluteRuntime !== \"string\"\n ) {\n throw new Error(\n \"The 'absoluteRuntime' option must be undefined, a boolean, or a string.\",\n );\n }\n\n if (typeof runtimeVersion !== \"string\") {\n throw new Error(`The 'version' option must be a version string.`);\n }\n\n if (moduleName !== null && typeof moduleName !== \"string\") {\n throw new Error(\"The 'moduleName' option must be null or a string.\");\n }\n\n if (Object.hasOwn(options, \"useBuiltIns\")) {\n // @ts-expect-error deprecated options\n if (options.useBuiltIns) {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. The @babel/runtime \" +\n \"module now uses builtins by default.\",\n );\n } else {\n throw new Error(\n \"The 'useBuiltIns' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (Object.hasOwn(options, \"polyfill\")) {\n // @ts-expect-error deprecated options\n if (options.polyfill === false) {\n throw new Error(\n \"The 'polyfill' option has been removed. The @babel/runtime \" +\n \"module now skips polyfilling by default.\",\n );\n } else {\n throw new Error(\n \"The 'polyfill' option has been removed. Use the 'corejs'\" +\n \"option to polyfill with `core-js` via @babel/runtime.\",\n );\n }\n }\n\n if (Object.hasOwn(options, \"regenerator\")) {\n throw new Error(\n \"The 'regenerator' option has been removed. The generators transform \" +\n \"no longers relies on a 'regeneratorRuntime' global. \" +\n \"If you still need to replace imports to the 'regeneratorRuntime' \" +\n \"global, you can use babel-plugin-polyfill-regenerator.\",\n );\n }\n\n if (Object.hasOwn(options, \"useESModules\")) {\n throw new Error(\n \"The 'useESModules' option has been removed. @babel/runtime now uses \" +\n \"package.json#exports to support both CommonJS and ESM helpers.\",\n );\n }\n\n if (Object.hasOwn(options, \"helpers\")) {\n throw new Error(\n \"The 'helpers' option has been removed. \" +\n \"Remove the plugin from your config if \" +\n \"you want to disable helpers import injection.\",\n );\n }\n\n const HEADER_HELPERS = new Set([\n \"interopRequireWildcard\",\n \"interopRequireDefault\",\n ]);\n\n return {\n name: \"transform-runtime\",\n\n inherits: undefined,\n pre(file) {\n let modulePath: string;\n\n file.set(\"helperGenerator\", (name: string) => {\n modulePath ??= getRuntimePath(\n moduleName ??\n file.get(\"runtimeHelpersModuleName\") ??\n \"@babel/runtime\",\n dirname,\n absoluteRuntime,\n );\n\n // If the helper didn't exist yet at the version given, we bail\n // out and let Babel either insert it directly, or throw an error\n // so that plugins can handle that case properly.\n\n if (!file.availableHelper(name, runtimeVersion)) return;\n\n // Explicitly set the CommonJS interop helpers to their reserve\n // blockHoist of 4 so they are guaranteed to exist\n // when other things used them to import.\n const blockHoist =\n HEADER_HELPERS.has(name) && !isModule(file.path) ? 4 : undefined;\n\n let helperPath = `${modulePath}/helpers/${name}`;\n if (absoluteRuntime) helperPath = resolveFSPath(helperPath);\n\n return addDefaultImport(helperPath, name, blockHoist, true);\n });\n\n const cache = new Map();\n\n function addDefaultImport(\n source: string,\n nameHint: string,\n blockHoist: number,\n isHelper = false,\n ) {\n // If something on the page adds a helper when the file is an ES6\n // file, we can't reused the cached helper name after things have been\n // transformed because it has almost certainly been renamed.\n const cacheKey = isModule(file.path);\n const key = `${source}:${nameHint}:${cacheKey || \"\"}`;\n\n let cached = cache.get(key);\n if (cached) {\n cached = t.cloneNode(cached);\n } else {\n cached = addDefault(file.path, source, {\n importedInterop: isHelper ? \"compiled\" : \"uncompiled\",\n nameHint,\n blockHoist,\n });\n\n cache.set(key, cached);\n }\n return cached;\n }\n },\n };\n});\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,4BAA4B;AACpD,SAASC,UAAU,EAAEC,QAAQ,QAAQ,8BAA8B;AACnE,SAASC,KAAK,IAAIC,CAAC,QAAQ,aAAa;AAExC,OAAOC,cAAc,IAAIC,aAAa,QAAQ,6BAA6B;AAY3E,eAAeN,OAAO,CAAC,CAACO,GAAG,EAAEC,OAAgB,EAAEC,OAAO,KAAK;EACzDF,GAAG,CAACG,aAAa,qCAAoB,CAAC;EAEtC,MAAM;IACJC,OAAO,EAAEC,cAAc,GAAG,cAAc;IACxCC,eAAe,GAAG,KAAK;IACvBC,UAAU,GAAG;EACf,CAAC,GAAGN,OAAO;EAEX,IACE,OAAOK,eAAe,KAAK,SAAS,IACpC,OAAOA,eAAe,KAAK,QAAQ,EACnC;IACA,MAAM,IAAIE,KAAK,CACb,yEACF,CAAC;EACH;EAEA,IAAI,OAAOH,cAAc,KAAK,QAAQ,EAAE;IACtC,MAAM,IAAIG,KAAK,CAAC,gDAAgD,CAAC;EACnE;EAEA,IAAID,UAAU,KAAK,IAAI,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACzD,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;EACtE;EAEA,IAAIC,MAAM,CAACC,MAAM,CAACT,OAAO,EAAE,aAAa,CAAC,EA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C","ignoreList":[]}
{
"name": "@babel/plugin-transform-runtime",
"version": "8.0.0-beta.3",
"version": "8.0.0-beta.4",
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals",

@@ -23,15 +23,15 @@ "repository": {

"dependencies": {
"@babel/helper-module-imports": "^8.0.0-beta.3",
"@babel/helper-plugin-utils": "^8.0.0-beta.3"
"@babel/helper-module-imports": "^8.0.0-beta.4",
"@babel/helper-plugin-utils": "^8.0.0-beta.4"
},
"peerDependencies": {
"@babel/core": "^8.0.0-beta.3"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^8.0.0-beta.3",
"@babel/helper-plugin-test-runner": "^8.0.0-beta.3",
"@babel/helpers": "^8.0.0-beta.3",
"@babel/preset-env": "^8.0.0-beta.3",
"@babel/runtime": "^8.0.0-beta.3",
"@babel/runtime-corejs3": "^8.0.0-beta.3",
"@babel/core": "^8.0.0-beta.4",
"@babel/helper-plugin-test-runner": "^8.0.0-beta.4",
"@babel/helpers": "^8.0.0-beta.4",
"@babel/preset-env": "^8.0.0-beta.4",
"@babel/runtime": "^8.0.0-beta.4",
"@babel/runtime-corejs3": "^8.0.0-beta.4",
"babel-plugin-polyfill-corejs3": "^0.13.0"

@@ -38,0 +38,0 @@ },

Object.defineProperty(exports, "createPolyfillPlugins", {
get: () => require("./polyfills.cjs")
});
//# sourceMappingURL=index.cjs.map
{"version":3,"names":["Object","defineProperty","exports","get","require"],"sources":["../../src/babel-7/index.cjs"],"sourcesContent":["Object.defineProperty(exports, \"createPolyfillPlugins\", {\n get: () => require(\"./polyfills.cjs\"),\n});\n"],"mappings":"AAAAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,uBAAuB,EAAE;EACtDC,GAAG,EAAEA,CAAA,KAAMC,OAAO,CAAC,iBAAiB;AACtC,CAAC,CAAC","ignoreList":[]}
{
throw new Error("Internal Babel error: This file should only be loaded in Babel 7");
}
const pluginCorejs2 = require("babel-plugin-polyfill-corejs2").default;
const pluginCorejs3 = require("babel-plugin-polyfill-corejs3").default;
const pluginRegenerator = require("babel-plugin-polyfill-regenerator").default;
const pluginsCompat = "#__secret_key__@babel/runtime__compatibility";
function createCorejs2Plugin(options) {
return (api, _, filename) => pluginCorejs2(api, options, filename);
}
function createCorejs3Plugin(options) {
return (api, _, filename) => pluginCorejs3(api, options, filename);
}
function createRegeneratorPlugin(options, useRuntimeRegenerator, corejsPlugin) {
if (!useRuntimeRegenerator) return corejsPlugin ?? undefined;
return (api, _, filename) => {
return Object.assign({}, pluginRegenerator(api, options, filename), {
inherits: corejsPlugin ?? undefined
});
};
}
module.exports = function createBasePolyfillsPlugin({
corejs,
regenerator = true,
moduleName
}, runtimeVersion, absoluteImports) {
let proposals = false;
let rawVersion;
if (typeof corejs === "object" && corejs !== null) {
rawVersion = corejs.version;
proposals = Boolean(corejs.proposals);
} else {
rawVersion = corejs;
}
const corejsVersion = rawVersion ? Number(rawVersion) : false;
if (![false, 2, 3].includes(corejsVersion)) {
throw new Error(`The \`core-js\` version must be false, 2 or 3, but got ${JSON.stringify(rawVersion)}.`);
}
if (proposals && (!corejsVersion || corejsVersion < 3)) {
throw new Error("The 'proposals' option is only supported when using 'corejs: 3'");
}
if (typeof regenerator !== "boolean") {
throw new Error("The 'regenerator' option must be undefined, or a boolean.");
}
const polyfillOpts = {
method: "usage-pure",
absoluteImports,
proposals,
[pluginsCompat]: {
useBabelRuntime: true,
runtimeVersion,
ext: "",
moduleName
}
};
return createRegeneratorPlugin(polyfillOpts, regenerator, corejsVersion === 2 ? createCorejs2Plugin(polyfillOpts) : corejsVersion === 3 ? createCorejs3Plugin(polyfillOpts) : null);
};
//# sourceMappingURL=polyfills.cjs.map
{"version":3,"names":["Error","pluginCorejs2","require","default","pluginCorejs3","pluginRegenerator","pluginsCompat","createCorejs2Plugin","options","api","_","filename","createCorejs3Plugin","createRegeneratorPlugin","useRuntimeRegenerator","corejsPlugin","undefined","Object","assign","inherits","module","exports","createBasePolyfillsPlugin","corejs","regenerator","moduleName","runtimeVersion","absoluteImports","proposals","rawVersion","version","Boolean","corejsVersion","Number","includes","JSON","stringify","polyfillOpts","method","useBabelRuntime","ext"],"sources":["../../src/babel-7/polyfills.cjs"],"sourcesContent":["// TODO(Babel 8) Remove this file\nif (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Internal Babel error: This file should only be loaded in Babel 7\",\n );\n}\n\nconst pluginCorejs2 = require(\"babel-plugin-polyfill-corejs2\").default;\nconst pluginCorejs3 = require(\"babel-plugin-polyfill-corejs3\").default;\nconst pluginRegenerator = require(\"babel-plugin-polyfill-regenerator\").default;\n\nconst pluginsCompat = \"#__secret_key__@babel/runtime__compatibility\";\n\nfunction createCorejs2Plugin(options) {\n return (api, _, filename) => pluginCorejs2(api, options, filename);\n}\n\nfunction createCorejs3Plugin(options) {\n return (api, _, filename) => pluginCorejs3(api, options, filename);\n}\n\nfunction createRegeneratorPlugin(options, useRuntimeRegenerator, corejsPlugin) {\n if (!useRuntimeRegenerator) return corejsPlugin ?? undefined;\n return (api, _, filename) => {\n return {\n ...pluginRegenerator(api, options, filename),\n inherits: corejsPlugin ?? undefined,\n };\n };\n}\n\nmodule.exports = function createBasePolyfillsPlugin(\n { corejs, regenerator = true, moduleName },\n runtimeVersion,\n absoluteImports,\n) {\n let proposals = false;\n let rawVersion;\n\n if (typeof corejs === \"object\" && corejs !== null) {\n rawVersion = corejs.version;\n proposals = Boolean(corejs.proposals);\n } else {\n rawVersion = corejs;\n }\n\n const corejsVersion = rawVersion ? Number(rawVersion) : false;\n\n if (![false, 2, 3].includes(corejsVersion)) {\n throw new Error(\n `The \\`core-js\\` version must be false, 2 or 3, but got ${JSON.stringify(\n rawVersion,\n )}.`,\n );\n }\n\n if (proposals && (!corejsVersion || corejsVersion < 3)) {\n throw new Error(\n \"The 'proposals' option is only supported when using 'corejs: 3'\",\n );\n }\n\n if (typeof regenerator !== \"boolean\") {\n throw new Error(\n \"The 'regenerator' option must be undefined, or a boolean.\",\n );\n }\n\n const polyfillOpts = {\n method: \"usage-pure\",\n absoluteImports,\n proposals,\n [pluginsCompat]: {\n useBabelRuntime: true,\n runtimeVersion,\n ext: \"\",\n moduleName,\n },\n };\n\n return createRegeneratorPlugin(\n polyfillOpts,\n regenerator,\n corejsVersion === 2\n ? createCorejs2Plugin(polyfillOpts)\n : corejsVersion === 3\n ? createCorejs3Plugin(polyfillOpts)\n : null,\n );\n};\n"],"mappings":"AACkC;EAChC,MAAM,IAAIA,KAAK,CACb,kEACF,CAAC;AACH;AAEA,MAAMC,aAAa,GAAGC,OAAO,CAAC,+BAA+B,CAAC,CAACC,OAAO;AACtE,MAAMC,aAAa,GAAGF,OAAO,CAAC,+BAA+B,CAAC,CAACC,OAAO;AACtE,MAAME,iBAAiB,GAAGH,OAAO,CAAC,mCAAmC,CAAC,CAACC,OAAO;AAE9E,MAAMG,aAAa,GAAG,8CAA8C;AAEpE,SAASC,mBAAmBA,CAACC,OAAO,EAAE;EACpC,OAAO,CAACC,GAAG,EAAEC,CAAC,EAAEC,QAAQ,KAAKV,aAAa,CAACQ,GAAG,EAAED,OAAO,EAAEG,QAAQ,CAAC;AACpE;AAEA,SAASC,mBAAmBA,CAACJ,OAAO,EAAE;EACpC,OAAO,CAACC,GAAG,EAAEC,CAAC,EAAEC,QAAQ,KAAKP,aAAa,CAACK,GAAG,EAAED,OAAO,EAAEG,QAAQ,CAAC;AACpE;AAEA,SAASE,uBAAuBA,CAACL,OAAO,EAAEM,qBAAqB,EAAEC,YAAY,EAAE;EAC7E,IAAI,CAACD,qBAAqB,EAAE,OAAOC,YAAY,IAAIC,SAAS;EAC5D,OAAO,CAACP,GAAG,EAAEC,CAAC,EAAEC,QAAQ,KAAK;IAC3B,OAAAM,MAAA,CAAAC,MAAA,KACKb,iBAAiB,CAACI,GAAG,EAAED,OAAO,EAAEG,QAAQ,CAAC;MAC5CQ,QAAQ,EAAEJ,YAAY,IAAIC;IAAS;EAEvC,CAAC;AACH;AAEAI,MAAM,CAACC,OAAO,G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