@babel/plugin-transform-runtime
Advanced tools
Comparing version 7.19.6 to 7.21.0
@@ -8,3 +8,2 @@ "use strict"; | ||
exports.resolveFSPath = resolveFSPath; | ||
function _default(moduleName, dirname, absoluteRuntime) { | ||
@@ -14,3 +13,2 @@ if (absoluteRuntime === false) return moduleName; | ||
} | ||
function resolveFSPath() { | ||
@@ -17,0 +15,0 @@ throw new Error("The 'absoluteRuntime' option is not supported when using @babel/standalone."); |
@@ -8,7 +8,4 @@ "use strict"; | ||
exports.resolveFSPath = resolveFSPath; | ||
var _path = require("path"); | ||
var _module = require("module"); | ||
function _default(moduleName, dirname, absoluteRuntime) { | ||
@@ -18,3 +15,2 @@ if (absoluteRuntime === false) return moduleName; | ||
} | ||
function resolveAbsoluteRuntime(moduleName, dirname) { | ||
@@ -26,3 +22,2 @@ try { | ||
let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); | ||
if (f) return f; | ||
@@ -44,3 +39,2 @@ f = new Error(`Cannot resolve module '${r}'`); | ||
} | ||
function resolveFSPath(path) { | ||
@@ -47,0 +41,0 @@ return require.resolve(path).replace(/\\/g, "/"); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.hasMinVersion = hasMinVersion; | ||
var _semver = require("semver"); | ||
function hasMinVersion(minVersion, runtimeVersion) { | ||
@@ -12,0 +10,0 @@ if (!runtimeVersion) return true; |
@@ -7,19 +7,10 @@ "use strict"; | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var _helperModuleImports = require("@babel/helper-module-imports"); | ||
var _core = require("@babel/core"); | ||
var _helpers = require("./helpers"); | ||
var _getRuntimePath = require("./get-runtime-path"); | ||
var _babelPluginPolyfillCorejs = require("babel-plugin-polyfill-corejs2"); | ||
var _babelPluginPolyfillCorejs2 = require("babel-plugin-polyfill-corejs3"); | ||
var _babelPluginPolyfillRegenerator = require("babel-plugin-polyfill-regenerator"); | ||
const pluginCorejs2 = _babelPluginPolyfillCorejs.default || _babelPluginPolyfillCorejs; | ||
@@ -29,7 +20,5 @@ const pluginCorejs3 = _babelPluginPolyfillCorejs2.default || _babelPluginPolyfillCorejs2; | ||
const pluginsCompat = "#__secret_key__@babel/runtime__compatibility"; | ||
function supportsStaticESM(caller) { | ||
return !!(caller != null && caller.supportsStaticESM); | ||
} | ||
var _default = (0, _helperPluginUtils.declare)((api, options, dirname) => { | ||
@@ -47,3 +36,2 @@ api.assertVersion(7); | ||
let rawVersion; | ||
if (typeof corejs === "object" && corejs !== null) { | ||
@@ -55,33 +43,24 @@ rawVersion = corejs.version; | ||
} | ||
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 useRuntimeRegenerator !== "boolean") { | ||
throw new Error("The 'regenerator' option must be undefined, or a boolean."); | ||
} | ||
if (typeof useRuntimeHelpers !== "boolean") { | ||
throw new Error("The 'helpers' option must be undefined, or a boolean."); | ||
} | ||
if (typeof useESModules !== "boolean" && useESModules !== "auto") { | ||
throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'."); | ||
} | ||
if (typeof absoluteRuntime !== "boolean" && typeof absoluteRuntime !== "string") { | ||
throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string."); | ||
} | ||
if (typeof runtimeVersion !== "string") { | ||
throw new Error(`The 'version' option must be a version string.`); | ||
} | ||
{ | ||
@@ -91,7 +70,5 @@ const DUAL_MODE_RUNTIME = "7.13.0"; | ||
} | ||
function has(obj, key) { | ||
return Object.prototype.hasOwnProperty.call(obj, key); | ||
} | ||
if (has(options, "useBuiltIns")) { | ||
@@ -104,3 +81,2 @@ if (options["useBuiltIns"]) { | ||
} | ||
if (has(options, "polyfill")) { | ||
@@ -113,7 +89,5 @@ if (options["polyfill"] === false) { | ||
} | ||
if (has(options, "moduleName")) { | ||
throw new Error("The 'moduleName' option has been removed. @babel/transform-runtime " + "no longer supports arbitrary runtimes. If you were using this to " + "set an absolute path for Babel's standard runtimes, please use the " + "'absoluteRuntime' option."); | ||
} | ||
const esModules = useESModules === "auto" ? api.caller(supportsStaticESM) : useESModules; | ||
@@ -125,3 +99,2 @@ const injectCoreJS2 = corejsVersion === 2; | ||
const modulePath = (0, _getRuntimePath.default)(moduleName, dirname, absoluteRuntime); | ||
function createCorejsPlugin(plugin, options, regeneratorPlugin) { | ||
@@ -134,3 +107,2 @@ return (api, _, filename) => { | ||
} | ||
function createRegeneratorPlugin(options) { | ||
@@ -142,3 +114,2 @@ if (!useRuntimeRegenerator) return undefined; | ||
} | ||
return { | ||
@@ -182,3 +153,2 @@ name: "transform-runtime", | ||
}), | ||
pre(file) { | ||
@@ -191,6 +161,4 @@ if (!useRuntimeHelpers) return; | ||
} | ||
return; | ||
} | ||
const isInteropHelper = HEADER_HELPERS.indexOf(name) !== -1; | ||
@@ -204,3 +172,2 @@ const blockHoist = isInteropHelper && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined; | ||
const cache = new Map(); | ||
function addDefaultImport(source, nameHint, blockHoist, isHelper = false) { | ||
@@ -210,3 +177,2 @@ const cacheKey = (0, _helperModuleImports.isModule)(file.path); | ||
let cached = cache.get(key); | ||
if (cached) { | ||
@@ -222,12 +188,9 @@ cached = _core.types.cloneNode(cached); | ||
} | ||
return cached; | ||
} | ||
} | ||
}; | ||
}); | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/plugin-transform-runtime", | ||
"version": "7.19.6", | ||
"version": "7.21.0", | ||
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", | ||
@@ -24,3 +24,3 @@ "repository": { | ||
"@babel/helper-module-imports": "^7.18.6", | ||
"@babel/helper-plugin-utils": "^7.19.0", | ||
"@babel/helper-plugin-utils": "^7.20.2", | ||
"babel-plugin-polyfill-corejs2": "^0.3.3", | ||
@@ -35,10 +35,10 @@ "babel-plugin-polyfill-corejs3": "^0.6.0", | ||
"devDependencies": { | ||
"@babel/core": "^7.19.6", | ||
"@babel/core": "^7.21.0", | ||
"@babel/helper-plugin-test-runner": "^7.18.6", | ||
"@babel/helpers": "^7.19.4", | ||
"@babel/preset-env": "^7.19.4", | ||
"@babel/runtime": "^7.19.4", | ||
"@babel/runtime-corejs3": "^7.19.6", | ||
"@babel/template": "^7.18.10", | ||
"@babel/types": "^7.19.4", | ||
"@babel/helpers": "^7.21.0", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/runtime": "^7.21.0", | ||
"@babel/runtime-corejs3": "^7.21.0", | ||
"@babel/template": "^7.20.7", | ||
"@babel/types": "^7.21.0", | ||
"make-dir": "^2.1.0" | ||
@@ -45,0 +45,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37799