You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-runtime

Package Overview
Dependencies
Maintainers
4
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.19.6 to 7.23.2

lib/polyfills.js

2

lib/get-runtime-path/browser.js

@@ -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,34 +7,15 @@ "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;
const pluginCorejs3 = _babelPluginPolyfillCorejs2.default || _babelPluginPolyfillCorejs2;
const pluginRegenerator = _babelPluginPolyfillRegenerator.default || _babelPluginPolyfillRegenerator;
const pluginsCompat = "#__secret_key__@babel/runtime__compatibility";
var _helpers = require("./helpers.js");
var _index = require("./get-runtime-path/index.js");
var _polyfills = require("./polyfills.js");
function supportsStaticESM(caller) {
return !!(caller != null && caller.supportsStaticESM);
}
var _default = (0, _helperPluginUtils.declare)((api, options, dirname) => {
api.assertVersion(7);
const {
corejs,
helpers: useRuntimeHelpers = true,
regenerator: useRuntimeRegenerator = true,
useESModules = false,

@@ -44,42 +25,14 @@ version: runtimeVersion = "7.0.0-beta.0",

} = options;
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 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.`);
}
{

@@ -89,7 +42,5 @@ const DUAL_MODE_RUNTIME = "7.13.0";

}
function has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
if (has(options, "useBuiltIns")) {

@@ -102,3 +53,2 @@ if (options["useBuiltIns"]) {

}
if (has(options, "polyfill")) {

@@ -111,79 +61,24 @@ 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;
const injectCoreJS2 = corejsVersion === 2;
const injectCoreJS3 = corejsVersion === 3;
const moduleName = injectCoreJS3 ? "@babel/runtime-corejs3" : injectCoreJS2 ? "@babel/runtime-corejs2" : "@babel/runtime";
const HEADER_HELPERS = ["interopRequireWildcard", "interopRequireDefault"];
const modulePath = (0, _getRuntimePath.default)(moduleName, dirname, absoluteRuntime);
function createCorejsPlugin(plugin, options, regeneratorPlugin) {
return (api, _, filename) => {
return Object.assign({}, plugin(api, options, filename), {
inherits: regeneratorPlugin
});
};
}
function createRegeneratorPlugin(options) {
if (!useRuntimeRegenerator) return undefined;
return (api, _, filename) => {
return pluginRegenerator(api, options, filename);
};
}
return {
name: "transform-runtime",
inherits: injectCoreJS2 ? createCorejsPlugin(pluginCorejs2, {
method: "usage-pure",
absoluteImports: absoluteRuntime ? modulePath : false,
[pluginsCompat]: {
runtimeVersion,
useBabelRuntime: modulePath,
ext: ""
}
}, createRegeneratorPlugin({
method: "usage-pure",
absoluteImports: absoluteRuntime ? modulePath : false,
[pluginsCompat]: {
useBabelRuntime: modulePath
}
})) : injectCoreJS3 ? createCorejsPlugin(pluginCorejs3, {
method: "usage-pure",
version: 3,
proposals,
absoluteImports: absoluteRuntime ? modulePath : false,
[pluginsCompat]: {
useBabelRuntime: modulePath,
ext: ""
}
}, createRegeneratorPlugin({
method: "usage-pure",
absoluteImports: absoluteRuntime ? modulePath : false,
[pluginsCompat]: {
useBabelRuntime: modulePath
}
})) : createRegeneratorPlugin({
method: "usage-pure",
absoluteImports: absoluteRuntime ? modulePath : false,
[pluginsCompat]: {
useBabelRuntime: modulePath
}
}),
inherits: (0, _polyfills.createBasePolyfillsPlugin)(options, runtimeVersion, absoluteRuntime),
pre(file) {
if (!useRuntimeHelpers) return;
let modulePath;
file.set("helperGenerator", name => {
if (!(file.availableHelper != null && file.availableHelper(name, runtimeVersion))) {
if (name === "regeneratorRuntime") {
return _core.types.arrowFunctionExpression([], _core.types.identifier("regeneratorRuntime"));
var _modulePath, _file$get;
(_modulePath = modulePath) != null ? _modulePath : modulePath = (0, _index.default)((_file$get = file.get("runtimeHelpersModuleName")) != null ? _file$get : "@babel/runtime", dirname, absoluteRuntime);
{
if (!(file.availableHelper != null && file.availableHelper(name, runtimeVersion))) {
if (name === "regeneratorRuntime") {
return _core.types.arrowFunctionExpression([], _core.types.identifier("regeneratorRuntime"));
}
return;
}
return;
}
const isInteropHelper = HEADER_HELPERS.indexOf(name) !== -1;

@@ -193,7 +88,6 @@ const blockHoist = isInteropHelper && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined;

let helperPath = `${modulePath}/${helpersDir}/${name}`;
if (absoluteRuntime) helperPath = (0, _getRuntimePath.resolveFSPath)(helperPath);
if (absoluteRuntime) helperPath = (0, _index.resolveFSPath)(helperPath);
return addDefaultImport(helperPath, name, blockHoist, true);
});
const cache = new Map();
function addDefaultImport(source, nameHint, blockHoist, isHelper = false) {

@@ -203,3 +97,2 @@ const cacheKey = (0, _helperModuleImports.isModule)(file.path);

let cached = cache.get(key);
if (cached) {

@@ -215,12 +108,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.23.2",
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals",

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

"dependencies": {
"@babel/helper-module-imports": "^7.18.6",
"@babel/helper-plugin-utils": "^7.19.0",
"babel-plugin-polyfill-corejs2": "^0.3.3",
"babel-plugin-polyfill-corejs3": "^0.6.0",
"babel-plugin-polyfill-regenerator": "^0.4.1",
"semver": "^6.3.0"
"@babel/helper-module-imports": "^7.22.15",
"@babel/helper-plugin-utils": "^7.22.5",
"babel-plugin-polyfill-corejs2": "^0.4.6",
"babel-plugin-polyfill-corejs3": "^0.8.5",
"babel-plugin-polyfill-regenerator": "^0.5.3",
"semver": "^6.3.1"
},

@@ -35,10 +35,8 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "^7.19.6",
"@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/core": "^7.23.0",
"@babel/helper-plugin-test-runner": "^7.22.5",
"@babel/helpers": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/runtime": "^7.23.2",
"@babel/runtime-corejs3": "^7.23.2",
"make-dir": "^2.1.0"

@@ -45,0 +43,0 @@ },

@@ -5,3 +5,3 @@ # @babel/plugin-transform-runtime

See our website [@babel/plugin-transform-runtime](https://babeljs.io/docs/en/babel-plugin-transform-runtime) for more information.
See our website [@babel/plugin-transform-runtime](https://babeljs.io/docs/babel-plugin-transform-runtime) for more information.

@@ -8,0 +8,0 @@ ## Install

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc