@babel/plugin-transform-runtime
Advanced tools
Comparing version 7.23.3 to 7.23.6
@@ -12,11 +12,9 @@ "use strict"; | ||
var _index = require("./get-runtime-path/index.js"); | ||
var _polyfills = require("./polyfills.js"); | ||
function supportsStaticESM(caller) { | ||
return !!(caller != null && caller.supportsStaticESM); | ||
} | ||
var _coreJs = require("./core-js.js"); | ||
var _index2 = require("./babel-7/index.cjs"); | ||
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options, dirname) => { | ||
var _options$corejs; | ||
api.assertVersion(7); | ||
const { | ||
helpers: useRuntimeHelpers = true, | ||
useESModules = false, | ||
version: runtimeVersion = "7.0.0-beta.0", | ||
@@ -28,5 +26,2 @@ absoluteRuntime = false | ||
} | ||
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") { | ||
@@ -62,7 +57,16 @@ throw new Error("The 'absoluteRuntime' option must be undefined, a boolean, or a string."); | ||
} | ||
const esModules = useESModules === "auto" ? api.caller(supportsStaticESM) : useESModules; | ||
; | ||
{ | ||
const { | ||
useESModules = false | ||
} = options; | ||
if (typeof useESModules !== "boolean" && useESModules !== "auto") { | ||
throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'."); | ||
} | ||
var esModules = useESModules === "auto" ? api.caller(caller => !!(caller != null && caller.supportsStaticESM)) : useESModules; | ||
} | ||
const HEADER_HELPERS = ["interopRequireWildcard", "interopRequireDefault"]; | ||
return { | ||
name: "transform-runtime", | ||
inherits: (0, _polyfills.createBasePolyfillsPlugin)(options, runtimeVersion, absoluteRuntime), | ||
inherits: _index2.createPolyfillPlugins(options, runtimeVersion, absoluteRuntime, options.corejs === 3 || ((_options$corejs = options.corejs) == null ? void 0 : _options$corejs.version) === 3 ? (0, _coreJs.createCorejs3Plugin)(options.corejs, absoluteRuntime) : null), | ||
pre(file) { | ||
@@ -84,4 +88,3 @@ if (!useRuntimeHelpers) return; | ||
const blockHoist = isInteropHelper && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined; | ||
const helpersDir = esModules && file.path.node.sourceType === "module" ? "helpers/esm" : "helpers"; | ||
let helperPath = `${modulePath}/${helpersDir}/${name}`; | ||
let helperPath = `${modulePath}/helpers/${esModules && file.path.node.sourceType === "module" ? "esm/" + name : name}`; | ||
if (absoluteRuntime) helperPath = (0, _index.resolveFSPath)(helperPath); | ||
@@ -88,0 +91,0 @@ return addDefaultImport(helperPath, name, blockHoist, true); |
{ | ||
"name": "@babel/plugin-transform-runtime", | ||
"version": "7.23.3", | ||
"version": "7.23.6", | ||
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", | ||
@@ -34,8 +34,8 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "^7.23.3", | ||
"@babel/core": "^7.23.6", | ||
"@babel/helper-plugin-test-runner": "^7.22.5", | ||
"@babel/helpers": "^7.23.2", | ||
"@babel/preset-env": "^7.23.3", | ||
"@babel/runtime": "^7.23.2", | ||
"@babel/runtime-corejs3": "^7.23.2", | ||
"@babel/helpers": "^7.23.6", | ||
"@babel/preset-env": "^7.23.6", | ||
"@babel/runtime": "^7.23.6", | ||
"@babel/runtime-corejs3": "^7.23.6", | ||
"make-dir": "^2.1.0" | ||
@@ -42,0 +42,0 @@ }, |
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
41399
19
307