@babel/plugin-transform-runtime
Advanced tools
Comparing version 7.22.9 to 8.0.0-alpha.0
@@ -1,13 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = _default; | ||
exports.resolveFSPath = resolveFSPath; | ||
function _default(moduleName, dirname, absoluteRuntime) { | ||
export default function (moduleName, dirname, absoluteRuntime) { | ||
if (absoluteRuntime === false) return moduleName; | ||
resolveFSPath(); | ||
} | ||
function resolveFSPath() { | ||
export function resolveFSPath() { | ||
throw new Error("The 'absoluteRuntime' option is not supported when using @babel/standalone."); | ||
@@ -14,0 +7,0 @@ } |
@@ -1,25 +0,11 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = _default; | ||
exports.resolveFSPath = resolveFSPath; | ||
var _path = require("path"); | ||
var _module = require("module"); | ||
function _default(moduleName, dirname, absoluteRuntime) { | ||
import path from "path"; | ||
import { createRequire } from "module"; | ||
const require = createRequire(import.meta.url); | ||
export default function (moduleName, dirname, absoluteRuntime) { | ||
if (absoluteRuntime === false) return moduleName; | ||
return resolveAbsoluteRuntime(moduleName, _path.resolve(dirname, absoluteRuntime === true ? "." : absoluteRuntime)); | ||
return resolveAbsoluteRuntime(moduleName, path.resolve(dirname, absoluteRuntime === true ? "." : absoluteRuntime)); | ||
} | ||
function resolveAbsoluteRuntime(moduleName, dirname) { | ||
try { | ||
return _path.dirname((((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, { | ||
paths: [b] | ||
}, M = require("module")) => { | ||
let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); | ||
if (f) return f; | ||
f = new Error(`Cannot resolve module '${r}'`); | ||
f.code = "MODULE_NOT_FOUND"; | ||
throw f; | ||
})(`${moduleName}/package.json`, { | ||
return path.dirname(require.resolve(`${moduleName}/package.json`, { | ||
paths: [dirname] | ||
@@ -36,3 +22,3 @@ })).replace(/\\/g, "/"); | ||
} | ||
function resolveFSPath(path) { | ||
export function resolveFSPath(path) { | ||
return require.resolve(path).replace(/\\/g, "/"); | ||
@@ -39,0 +25,0 @@ } |
@@ -1,14 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.hasMinVersion = hasMinVersion; | ||
var _semver = require("semver"); | ||
function hasMinVersion(minVersion, runtimeVersion) { | ||
import semver from "semver"; | ||
export function hasMinVersion(minVersion, runtimeVersion) { | ||
if (!runtimeVersion) return true; | ||
if (_semver.valid(runtimeVersion)) runtimeVersion = `^${runtimeVersion}`; | ||
return !_semver.intersects(`<${minVersion}`, runtimeVersion) && !_semver.intersects(`>=8.0.0`, runtimeVersion); | ||
if (semver.valid(runtimeVersion)) runtimeVersion = `^${runtimeVersion}`; | ||
return !semver.intersects(`<${minVersion}`, runtimeVersion) && !semver.intersects(`>=8.0.0`, runtimeVersion); | ||
} | ||
//# sourceMappingURL=helpers.js.map |
@@ -1,17 +0,11 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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 _polyfills = require("./polyfills"); | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import { addDefault, isModule } from "@babel/helper-module-imports"; | ||
import { types as t } from "@babel/core"; | ||
import { hasMinVersion } from "./helpers.js"; | ||
import getRuntimePath, { resolveFSPath } from "./get-runtime-path/index.js"; | ||
import { createBasePolyfillsPlugin } from "./polyfills.js"; | ||
function supportsStaticESM(caller) { | ||
return !!(caller != null && caller.supportsStaticESM); | ||
return !!caller?.supportsStaticESM; | ||
} | ||
var _default = (0, _helperPluginUtils.declare)((api, options, dirname) => { | ||
export default declare((api, options, dirname) => { | ||
api.assertVersion(7); | ||
@@ -36,6 +30,3 @@ const { | ||
} | ||
{ | ||
const DUAL_MODE_RUNTIME = "7.13.0"; | ||
var supportsCJSDefault = (0, _helpers.hasMinVersion)(DUAL_MODE_RUNTIME, runtimeVersion); | ||
} | ||
; | ||
function has(obj, key) { | ||
@@ -65,3 +56,3 @@ return Object.prototype.hasOwnProperty.call(obj, key); | ||
name: "transform-runtime", | ||
inherits: (0, _polyfills.createBasePolyfillsPlugin)(options, runtimeVersion, absoluteRuntime), | ||
inherits: createBasePolyfillsPlugin(options, runtimeVersion, absoluteRuntime), | ||
pre(file) { | ||
@@ -71,17 +62,11 @@ if (!useRuntimeHelpers) return; | ||
file.set("helperGenerator", name => { | ||
var _modulePath, _file$get; | ||
(_modulePath = modulePath) != null ? _modulePath : modulePath = (0, _getRuntimePath.default)((_file$get = file.get("runtimeHelpersModuleName")) != null ? _file$get : "@babel/runtime", dirname, absoluteRuntime); | ||
modulePath ??= getRuntimePath(file.get("runtimeHelpersModuleName") ?? "@babel/runtime", dirname, absoluteRuntime); | ||
{ | ||
if (!(file.availableHelper != null && file.availableHelper(name, runtimeVersion))) { | ||
if (name === "regeneratorRuntime") { | ||
return _core.types.arrowFunctionExpression([], _core.types.identifier("regeneratorRuntime")); | ||
} | ||
return; | ||
} | ||
if (!file.availableHelper(name, runtimeVersion)) return; | ||
} | ||
const isInteropHelper = HEADER_HELPERS.indexOf(name) !== -1; | ||
const blockHoist = isInteropHelper && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined; | ||
const blockHoist = isInteropHelper && !isModule(file.path) ? 4 : undefined; | ||
const helpersDir = esModules && file.path.node.sourceType === "module" ? "helpers/esm" : "helpers"; | ||
let helperPath = `${modulePath}/${helpersDir}/${name}`; | ||
if (absoluteRuntime) helperPath = (0, _getRuntimePath.resolveFSPath)(helperPath); | ||
if (absoluteRuntime) helperPath = resolveFSPath(helperPath); | ||
return addDefaultImport(helperPath, name, blockHoist, true); | ||
@@ -91,10 +76,10 @@ }); | ||
function addDefaultImport(source, nameHint, blockHoist, isHelper = false) { | ||
const cacheKey = (0, _helperModuleImports.isModule)(file.path); | ||
const cacheKey = isModule(file.path); | ||
const key = `${source}:${nameHint}:${cacheKey || ""}`; | ||
let cached = cache.get(key); | ||
if (cached) { | ||
cached = _core.types.cloneNode(cached); | ||
cached = t.cloneNode(cached); | ||
} else { | ||
cached = (0, _helperModuleImports.addDefault)(file.path, source, { | ||
importedInterop: isHelper && supportsCJSDefault ? "compiled" : "uncompiled", | ||
cached = addDefault(file.path, source, { | ||
importedInterop: isHelper ? "compiled" : "uncompiled", | ||
nameHint, | ||
@@ -110,4 +95,3 @@ blockHoist | ||
}); | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
@@ -1,13 +0,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createBasePolyfillsPlugin = createBasePolyfillsPlugin; | ||
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; | ||
import _pluginCorejs2 from "babel-plugin-polyfill-corejs2"; | ||
import _pluginCorejs3 from "babel-plugin-polyfill-corejs3"; | ||
import _pluginRegenerator from "babel-plugin-polyfill-regenerator"; | ||
const pluginCorejs2 = _pluginCorejs2.default || _pluginCorejs2; | ||
const pluginCorejs3 = _pluginCorejs3.default || _pluginCorejs3; | ||
const pluginRegenerator = _pluginRegenerator.default || _pluginRegenerator; | ||
const pluginsCompat = "#__secret_key__@babel/runtime__compatibility"; | ||
@@ -27,3 +21,3 @@ function createCorejsPlugin(plugin, options, regeneratorPlugin) { | ||
} | ||
function createBasePolyfillsPlugin({ | ||
export function createBasePolyfillsPlugin({ | ||
corejs, | ||
@@ -30,0 +24,0 @@ regenerator: useRuntimeRegenerator = true |
{ | ||
"name": "@babel/plugin-transform-runtime", | ||
"version": "7.22.9", | ||
"version": "8.0.0-alpha.0", | ||
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", | ||
@@ -23,27 +23,30 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-module-imports": "^7.22.5", | ||
"@babel/helper-plugin-utils": "^7.22.5", | ||
"@babel/helper-module-imports": "^8.0.0-alpha.0", | ||
"@babel/helper-plugin-utils": "^8.0.0-alpha.0", | ||
"babel-plugin-polyfill-corejs2": "^0.4.4", | ||
"babel-plugin-polyfill-corejs3": "^0.8.2", | ||
"babel-plugin-polyfill-regenerator": "^0.5.1", | ||
"semver": "^6.3.1" | ||
"semver": "^7.3.4" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^7.0.0-0" | ||
"@babel/core": "^8.0.0-alpha.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.22.9", | ||
"@babel/helper-plugin-test-runner": "^7.22.5", | ||
"@babel/helpers": "^7.22.6", | ||
"@babel/preset-env": "^7.22.9", | ||
"@babel/runtime": "^7.22.6", | ||
"@babel/runtime-corejs3": "^7.22.6", | ||
"make-dir": "^2.1.0" | ||
"@babel/core": "^8.0.0-alpha.0", | ||
"@babel/helper-plugin-test-runner": "^8.0.0-alpha.0", | ||
"@babel/helpers": "^8.0.0-alpha.0", | ||
"@babel/preset-env": "^8.0.0-alpha.0", | ||
"@babel/runtime": "^8.0.0-alpha.0", | ||
"@babel/runtime-corejs3": "^8.0.0-alpha.0" | ||
}, | ||
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-runtime", | ||
"engines": { | ||
"node": ">=6.9.0" | ||
"node": "^16.20.0 || ^18.16.0 || >=20.0.0" | ||
}, | ||
"author": "The Babel Team (https://babel.dev/team)", | ||
"type": "commonjs" | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"type": "module" | ||
} |
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
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
6
Yes
35844
237
1
+ Added@babel/code-frame@8.0.0-alpha.12(transitive)
+ Added@babel/compat-data@8.0.0-alpha.12(transitive)
+ Added@babel/core@8.0.0-alpha.12(transitive)
+ Added@babel/generator@8.0.0-alpha.12(transitive)
+ Added@babel/helper-compilation-targets@8.0.0-alpha.12(transitive)
+ Added@babel/helper-module-imports@8.0.0-alpha.12(transitive)
+ Added@babel/helper-plugin-utils@8.0.0-alpha.12(transitive)
+ Added@babel/helper-string-parser@8.0.0-alpha.12(transitive)
+ Added@babel/helper-validator-identifier@8.0.0-alpha.12(transitive)
+ Added@babel/helper-validator-option@8.0.0-alpha.12(transitive)
+ Added@babel/helpers@8.0.0-alpha.12(transitive)
+ Added@babel/highlight@8.0.0-alpha.12(transitive)
+ Added@babel/parser@8.0.0-alpha.12(transitive)
+ Added@babel/template@8.0.0-alpha.12(transitive)
+ Added@babel/traverse@8.0.0-alpha.12(transitive)
+ Added@babel/types@8.0.0-alpha.12(transitive)
+ Addedglobals@15.11.0(transitive)
+ Addedjs-tokens@8.0.3(transitive)
+ Addedlru-cache@7.18.3(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedto-fast-properties@3.0.1(transitive)
- Removed@babel/code-frame@7.25.7(transitive)
- Removed@babel/core@7.25.8(transitive)
- Removed@babel/generator@7.25.7(transitive)
- Removed@babel/helper-module-imports@7.25.7(transitive)
- Removed@babel/helper-module-transforms@7.25.7(transitive)
- Removed@babel/helper-simple-access@7.25.7(transitive)
- Removed@babel/helper-string-parser@7.25.7(transitive)
- Removed@babel/helper-validator-identifier@7.25.7(transitive)
- Removed@babel/helpers@7.25.7(transitive)
- Removed@babel/highlight@7.25.7(transitive)
- Removed@babel/parser@7.25.8(transitive)
- Removed@babel/template@7.25.7(transitive)
- Removed@babel/traverse@7.25.7(transitive)
- Removed@babel/types@7.25.8(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedglobals@11.12.0(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedto-fast-properties@2.0.0(transitive)
Updatedsemver@^7.3.4