@babel/plugin-transform-runtime
Advanced tools
Comparing version 7.16.0 to 7.16.4
@@ -7,6 +7,11 @@ "use strict"; | ||
exports.default = _default; | ||
exports.resolveFSPath = resolveFSPath; | ||
function _default(moduleName, dirname, absoluteRuntime) { | ||
if (absoluteRuntime === false) return moduleName; | ||
resolveFSPath(); | ||
} | ||
function resolveFSPath() { | ||
throw new Error("The 'absoluteRuntime' option is not supported when using @babel/standalone."); | ||
} |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.default = _default; | ||
exports.resolveFSPath = resolveFSPath; | ||
@@ -40,2 +41,6 @@ var _path = require("path"); | ||
} | ||
} | ||
function resolveFSPath(path) { | ||
return require.resolve(path); | ||
} |
@@ -132,3 +132,2 @@ "use strict"; | ||
const corejsExt = absoluteRuntime ? ".js" : ""; | ||
return { | ||
@@ -138,9 +137,11 @@ name: "transform-runtime", | ||
method: "usage-pure", | ||
absoluteImports: absoluteRuntime ? modulePath : false, | ||
[pluginsCompat]: { | ||
runtimeVersion, | ||
useBabelRuntime: modulePath, | ||
ext: corejsExt | ||
ext: "" | ||
} | ||
}, createRegeneratorPlugin({ | ||
method: "usage-pure", | ||
absoluteImports: absoluteRuntime ? modulePath : false, | ||
[pluginsCompat]: { | ||
@@ -153,8 +154,10 @@ useBabelRuntime: modulePath | ||
proposals, | ||
absoluteImports: absoluteRuntime ? modulePath : false, | ||
[pluginsCompat]: { | ||
useBabelRuntime: modulePath, | ||
ext: corejsExt | ||
ext: "" | ||
} | ||
}, createRegeneratorPlugin({ | ||
method: "usage-pure", | ||
absoluteImports: absoluteRuntime ? modulePath : false, | ||
[pluginsCompat]: { | ||
@@ -165,2 +168,3 @@ useBabelRuntime: modulePath | ||
method: "usage-pure", | ||
absoluteImports: absoluteRuntime ? modulePath : false, | ||
[pluginsCompat]: { | ||
@@ -181,3 +185,5 @@ useBabelRuntime: modulePath | ||
const helpersDir = esModules && file.path.node.sourceType === "module" ? "helpers/esm" : "helpers"; | ||
return addDefaultImport(`${modulePath}/${helpersDir}/${name}`, name, blockHoist, true); | ||
let helperPath = `${modulePath}/${helpersDir}/${name}`; | ||
if (absoluteRuntime) helperPath = (0, _getRuntimePath.resolveFSPath)(helperPath); | ||
return addDefaultImport(helperPath, name, blockHoist, true); | ||
}); | ||
@@ -184,0 +190,0 @@ const cache = new Map(); |
{ | ||
"name": "@babel/plugin-transform-runtime", | ||
"version": "7.16.0", | ||
"version": "7.16.4", | ||
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", | ||
@@ -25,5 +25,5 @@ "repository": { | ||
"@babel/helper-plugin-utils": "^7.14.5", | ||
"babel-plugin-polyfill-corejs2": "^0.2.3", | ||
"babel-plugin-polyfill-corejs3": "^0.3.0", | ||
"babel-plugin-polyfill-regenerator": "^0.2.3", | ||
"babel-plugin-polyfill-corejs2": "^0.3.0", | ||
"babel-plugin-polyfill-corejs3": "^0.4.0", | ||
"babel-plugin-polyfill-regenerator": "^0.3.0", | ||
"semver": "^6.3.0" | ||
@@ -37,7 +37,7 @@ }, | ||
"@babel/helper-plugin-test-runner": "^7.16.0", | ||
"@babel/helpers": "^7.16.0", | ||
"@babel/helpers": "^7.16.3", | ||
"@babel/plugin-transform-typeof-symbol": "^7.16.0", | ||
"@babel/preset-env": "^7.16.0", | ||
"@babel/runtime": "^7.16.0", | ||
"@babel/runtime-corejs3": "^7.16.0", | ||
"@babel/preset-env": "^7.16.4", | ||
"@babel/runtime": "^7.16.3", | ||
"@babel/runtime-corejs3": "^7.16.3", | ||
"@babel/template": "^7.16.0", | ||
@@ -44,0 +44,0 @@ "@babel/types": "^7.16.0", |
export default function (moduleName, dirname, absoluteRuntime) { | ||
if (absoluteRuntime === false) return moduleName; | ||
resolveFSPath(); | ||
} | ||
export function resolveFSPath() { | ||
throw new Error( | ||
@@ -5,0 +9,0 @@ "The 'absoluteRuntime' option is not supported when using @babel/standalone.", |
@@ -35,1 +35,5 @@ import path from "path"; | ||
} | ||
export function resolveFSPath(path) { | ||
return require.resolve(path); | ||
} |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
14048
271
3
+ Added@babel/helper-define-polyfill-provider@0.3.3(transitive)
+ Addedbabel-plugin-polyfill-corejs2@0.3.3(transitive)
+ Addedbabel-plugin-polyfill-corejs3@0.4.0(transitive)
+ Addedbabel-plugin-polyfill-regenerator@0.3.1(transitive)
- Removed@babel/helper-define-polyfill-provider@0.2.4(transitive)
- Removedbabel-plugin-polyfill-corejs2@0.2.3(transitive)
- Removedbabel-plugin-polyfill-corejs3@0.3.0(transitive)
- Removedbabel-plugin-polyfill-regenerator@0.2.3(transitive)