Socket
Socket
Sign inDemoInstall

@babel/preset-env

Package Overview
Dependencies
Maintainers
4
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/preset-env - npm Package Compare versions

Comparing version 7.19.4 to 7.22.2

141

lib/available-plugins.js

@@ -7,143 +7,75 @@ "use strict";

exports.minVersions = exports.default = void 0;
var _pluginSyntaxAsyncGenerators = require("@babel/plugin-syntax-async-generators");
var _pluginSyntaxClassProperties = require("@babel/plugin-syntax-class-properties");
var _pluginSyntaxClassStaticBlock = require("@babel/plugin-syntax-class-static-block");
var _pluginSyntaxDynamicImport = require("@babel/plugin-syntax-dynamic-import");
var _pluginSyntaxExportNamespaceFrom = require("@babel/plugin-syntax-export-namespace-from");
var _pluginSyntaxImportAssertions = require("@babel/plugin-syntax-import-assertions");
var _pluginSyntaxImportAttributes = require("@babel/plugin-syntax-import-attributes");
var _pluginSyntaxImportMeta = require("@babel/plugin-syntax-import-meta");
var _pluginSyntaxJsonStrings = require("@babel/plugin-syntax-json-strings");
var _pluginSyntaxLogicalAssignmentOperators = require("@babel/plugin-syntax-logical-assignment-operators");
var _pluginSyntaxNullishCoalescingOperator = require("@babel/plugin-syntax-nullish-coalescing-operator");
var _pluginSyntaxNumericSeparator = require("@babel/plugin-syntax-numeric-separator");
var _pluginSyntaxObjectRestSpread = require("@babel/plugin-syntax-object-rest-spread");
var _pluginSyntaxOptionalCatchBinding = require("@babel/plugin-syntax-optional-catch-binding");
var _pluginSyntaxOptionalChaining = require("@babel/plugin-syntax-optional-chaining");
var _pluginSyntaxPrivatePropertyInObject = require("@babel/plugin-syntax-private-property-in-object");
var _pluginSyntaxTopLevelAwait = require("@babel/plugin-syntax-top-level-await");
var _pluginProposalAsyncGeneratorFunctions = require("@babel/plugin-proposal-async-generator-functions");
var _pluginProposalClassProperties = require("@babel/plugin-proposal-class-properties");
var _pluginProposalClassStaticBlock = require("@babel/plugin-proposal-class-static-block");
var _pluginProposalDynamicImport = require("@babel/plugin-proposal-dynamic-import");
var _pluginProposalExportNamespaceFrom = require("@babel/plugin-proposal-export-namespace-from");
var _pluginProposalJsonStrings = require("@babel/plugin-proposal-json-strings");
var _pluginProposalLogicalAssignmentOperators = require("@babel/plugin-proposal-logical-assignment-operators");
var _pluginProposalNullishCoalescingOperator = require("@babel/plugin-proposal-nullish-coalescing-operator");
var _pluginProposalNumericSeparator = require("@babel/plugin-proposal-numeric-separator");
var _pluginProposalObjectRestSpread = require("@babel/plugin-proposal-object-rest-spread");
var _pluginProposalOptionalCatchBinding = require("@babel/plugin-proposal-optional-catch-binding");
var _pluginProposalOptionalChaining = require("@babel/plugin-proposal-optional-chaining");
var _pluginProposalPrivateMethods = require("@babel/plugin-proposal-private-methods");
var _pluginProposalPrivatePropertyInObject = require("@babel/plugin-proposal-private-property-in-object");
var _pluginProposalUnicodePropertyRegex = require("@babel/plugin-proposal-unicode-property-regex");
var _pluginTransformAsyncGeneratorFunctions = require("@babel/plugin-transform-async-generator-functions");
var _pluginTransformClassProperties = require("@babel/plugin-transform-class-properties");
var _pluginTransformClassStaticBlock = require("@babel/plugin-transform-class-static-block");
var _pluginTransformDynamicImport = require("@babel/plugin-transform-dynamic-import");
var _pluginTransformExportNamespaceFrom = require("@babel/plugin-transform-export-namespace-from");
var _pluginTransformJsonStrings = require("@babel/plugin-transform-json-strings");
var _pluginTransformLogicalAssignmentOperators = require("@babel/plugin-transform-logical-assignment-operators");
var _pluginTransformNullishCoalescingOperator = require("@babel/plugin-transform-nullish-coalescing-operator");
var _pluginTransformNumericSeparator = require("@babel/plugin-transform-numeric-separator");
var _pluginTransformObjectRestSpread = require("@babel/plugin-transform-object-rest-spread");
var _pluginTransformOptionalCatchBinding = require("@babel/plugin-transform-optional-catch-binding");
var _pluginTransformOptionalChaining = require("@babel/plugin-transform-optional-chaining");
var _pluginTransformPrivateMethods = require("@babel/plugin-transform-private-methods");
var _pluginTransformPrivatePropertyInObject = require("@babel/plugin-transform-private-property-in-object");
var _pluginTransformUnicodePropertyRegex = require("@babel/plugin-transform-unicode-property-regex");
var _pluginTransformAsyncToGenerator = require("@babel/plugin-transform-async-to-generator");
var _pluginTransformArrowFunctions = require("@babel/plugin-transform-arrow-functions");
var _pluginTransformBlockScopedFunctions = require("@babel/plugin-transform-block-scoped-functions");
var _pluginTransformBlockScoping = require("@babel/plugin-transform-block-scoping");
var _pluginTransformClasses = require("@babel/plugin-transform-classes");
var _pluginTransformComputedProperties = require("@babel/plugin-transform-computed-properties");
var _pluginTransformDestructuring = require("@babel/plugin-transform-destructuring");
var _pluginTransformDotallRegex = require("@babel/plugin-transform-dotall-regex");
var _pluginTransformDuplicateKeys = require("@babel/plugin-transform-duplicate-keys");
var _pluginTransformExponentiationOperator = require("@babel/plugin-transform-exponentiation-operator");
var _pluginTransformForOf = require("@babel/plugin-transform-for-of");
var _pluginTransformFunctionName = require("@babel/plugin-transform-function-name");
var _pluginTransformLiterals = require("@babel/plugin-transform-literals");
var _pluginTransformMemberExpressionLiterals = require("@babel/plugin-transform-member-expression-literals");
var _pluginTransformModulesAmd = require("@babel/plugin-transform-modules-amd");
var _pluginTransformModulesCommonjs = require("@babel/plugin-transform-modules-commonjs");
var _pluginTransformModulesSystemjs = require("@babel/plugin-transform-modules-systemjs");
var _pluginTransformModulesUmd = require("@babel/plugin-transform-modules-umd");
var _pluginTransformNamedCapturingGroupsRegex = require("@babel/plugin-transform-named-capturing-groups-regex");
var _pluginTransformNewTarget = require("@babel/plugin-transform-new-target");
var _pluginTransformObjectSuper = require("@babel/plugin-transform-object-super");
var _pluginTransformParameters = require("@babel/plugin-transform-parameters");
var _pluginTransformPropertyLiterals = require("@babel/plugin-transform-property-literals");
var _pluginTransformRegenerator = require("@babel/plugin-transform-regenerator");
var _pluginTransformReservedWords = require("@babel/plugin-transform-reserved-words");
var _pluginTransformShorthandProperties = require("@babel/plugin-transform-shorthand-properties");
var _pluginTransformSpread = require("@babel/plugin-transform-spread");
var _pluginTransformStickyRegex = require("@babel/plugin-transform-sticky-regex");
var _pluginTransformTemplateLiterals = require("@babel/plugin-transform-template-literals");
var _pluginTransformTypeofSymbol = require("@babel/plugin-transform-typeof-symbol");
var _pluginTransformUnicodeEscapes = require("@babel/plugin-transform-unicode-escapes");
var _pluginTransformUnicodeRegex = require("@babel/plugin-transform-unicode-regex");
var _pluginTransformUnicodeSetsRegex = require("@babel/plugin-transform-unicode-sets-regex");
var _transformAsyncArrowsInClass = require("@babel/preset-modules/lib/plugins/transform-async-arrows-in-class");
var _transformEdgeDefaultParameters = require("@babel/preset-modules/lib/plugins/transform-edge-default-parameters");
var _transformEdgeFunctionName = require("@babel/preset-modules/lib/plugins/transform-edge-function-name");
var _transformTaggedTemplateCaching = require("@babel/preset-modules/lib/plugins/transform-tagged-template-caching");
var _transformSafariBlockShadowing = require("@babel/preset-modules/lib/plugins/transform-safari-block-shadowing");
var _transformSafariForShadowing = require("@babel/preset-modules/lib/plugins/transform-safari-for-shadowing");
var _pluginBugfixSafariIdDestructuringCollisionInFunctionExpression = require("@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression");
var _pluginBugfixV8SpreadParametersInOptionalChaining = require("@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining");
var _default = {

@@ -164,2 +96,4 @@ "bugfix/transform-async-arrows-in-class": () => _transformAsyncArrowsInClass,

"syntax-import-assertions": () => _pluginSyntaxImportAssertions.default,
"syntax-import-attributes": () => _pluginSyntaxImportAttributes.default,
"syntax-import-meta": () => _pluginSyntaxImportMeta,
"syntax-json-strings": () => _pluginSyntaxJsonStrings,

@@ -174,9 +108,10 @@ "syntax-logical-assignment-operators": () => _pluginSyntaxLogicalAssignmentOperators,

"syntax-top-level-await": () => _pluginSyntaxTopLevelAwait,
"syntax-unicode-sets-regex": () => require("@babel/plugin-syntax-unicode-sets-regex"),
"transform-arrow-functions": () => _pluginTransformArrowFunctions.default,
"transform-async-generator-functions": () => _pluginProposalAsyncGeneratorFunctions.default,
"transform-async-generator-functions": () => _pluginTransformAsyncGeneratorFunctions.default,
"transform-async-to-generator": () => _pluginTransformAsyncToGenerator.default,
"transform-block-scoped-functions": () => _pluginTransformBlockScopedFunctions.default,
"transform-block-scoping": () => _pluginTransformBlockScoping.default,
"transform-class-properties": () => _pluginProposalClassProperties.default,
"transform-class-static-block": () => _pluginProposalClassStaticBlock.default,
"transform-class-properties": () => _pluginTransformClassProperties.default,
"transform-class-static-block": () => _pluginTransformClassStaticBlock.default,
"transform-classes": () => _pluginTransformClasses.default,

@@ -187,10 +122,10 @@ "transform-computed-properties": () => _pluginTransformComputedProperties.default,

"transform-duplicate-keys": () => _pluginTransformDuplicateKeys.default,
"transform-dynamic-import": () => _pluginProposalDynamicImport.default,
"transform-dynamic-import": () => _pluginTransformDynamicImport.default,
"transform-exponentiation-operator": () => _pluginTransformExponentiationOperator.default,
"transform-export-namespace-from": () => _pluginProposalExportNamespaceFrom.default,
"transform-export-namespace-from": () => _pluginTransformExportNamespaceFrom.default,
"transform-for-of": () => _pluginTransformForOf.default,
"transform-function-name": () => _pluginTransformFunctionName.default,
"transform-json-strings": () => _pluginProposalJsonStrings.default,
"transform-json-strings": () => _pluginTransformJsonStrings.default,
"transform-literals": () => _pluginTransformLiterals.default,
"transform-logical-assignment-operators": () => _pluginProposalLogicalAssignmentOperators.default,
"transform-logical-assignment-operators": () => _pluginTransformLogicalAssignmentOperators.default,
"transform-member-expression-literals": () => _pluginTransformMemberExpressionLiterals.default,

@@ -203,11 +138,11 @@ "transform-modules-amd": () => _pluginTransformModulesAmd.default,

"transform-new-target": () => _pluginTransformNewTarget.default,
"transform-nullish-coalescing-operator": () => _pluginProposalNullishCoalescingOperator.default,
"transform-numeric-separator": () => _pluginProposalNumericSeparator.default,
"transform-object-rest-spread": () => _pluginProposalObjectRestSpread.default,
"transform-nullish-coalescing-operator": () => _pluginTransformNullishCoalescingOperator.default,
"transform-numeric-separator": () => _pluginTransformNumericSeparator.default,
"transform-object-rest-spread": () => _pluginTransformObjectRestSpread.default,
"transform-object-super": () => _pluginTransformObjectSuper.default,
"transform-optional-catch-binding": () => _pluginProposalOptionalCatchBinding.default,
"transform-optional-chaining": () => _pluginProposalOptionalChaining.default,
"transform-optional-catch-binding": () => _pluginTransformOptionalCatchBinding.default,
"transform-optional-chaining": () => _pluginTransformOptionalChaining.default,
"transform-parameters": () => _pluginTransformParameters.default,
"transform-private-methods": () => _pluginProposalPrivateMethods.default,
"transform-private-property-in-object": () => _pluginProposalPrivatePropertyInObject.default,
"transform-private-methods": () => _pluginTransformPrivateMethods.default,
"transform-private-property-in-object": () => _pluginTransformPrivatePropertyInObject.default,
"transform-property-literals": () => _pluginTransformPropertyLiterals.default,

@@ -222,4 +157,5 @@ "transform-regenerator": () => _pluginTransformRegenerator.default,

"transform-unicode-escapes": () => _pluginTransformUnicodeEscapes.default,
"transform-unicode-property-regex": () => _pluginProposalUnicodePropertyRegex.default,
"transform-unicode-regex": () => _pluginTransformUnicodeRegex.default
"transform-unicode-property-regex": () => _pluginTransformUnicodePropertyRegex.default,
"transform-unicode-regex": () => _pluginTransformUnicodeRegex.default,
"transform-unicode-sets-regex": () => _pluginTransformUnicodeSetsRegex.default
};

@@ -229,2 +165,3 @@ exports.default = _default;

"bugfix/transform-safari-id-destructuring-collision-in-function-expression": "7.16.0",
"syntax-import-attributes": "7.22.0",
"transform-class-static-block": "7.12.0",

@@ -231,0 +168,0 @@ "transform-private-property-in-object": "7.10.0"

@@ -7,19 +7,15 @@ "use strict";

exports.logPlugin = void 0;
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
var _plugins = require("@babel/compat-data/plugins");
const logPlugin = (item, targetVersions, list) => {
const filteredList = (0, _helperCompilationTargets.getInclusionReasons)(item, targetVersions, list);
const support = list[item];
if (item.startsWith("transform-")) {
const proposalName = `proposal-${item.slice(10)}`;
if (proposalName === "proposal-dynamic-import" || Object.prototype.hasOwnProperty.call(_plugins, proposalName)) {
item = proposalName;
{
if (item.startsWith("transform-")) {
const proposalName = `proposal-${item.slice(10)}`;
if (proposalName === "proposal-dynamic-import" || Object.prototype.hasOwnProperty.call(_plugins, proposalName)) {
item = proposalName;
}
}
}
if (!support) {

@@ -29,6 +25,4 @@ console.log(` ${item}`);

}
let formattedTargets = `{`;
let first = true;
for (const target of Object.keys(filteredList)) {

@@ -40,9 +34,7 @@ if (!first) formattedTargets += `,`;

}
formattedTargets += ` }`;
console.log(` ${item} ${formattedTargets}`);
};
exports.logPlugin = logPlugin;
//# sourceMappingURL=debug.js.map

@@ -9,9 +9,5 @@ "use strict";

exports.removeUnsupportedItems = removeUnsupportedItems;
var _semver = require("semver");
var _availablePlugins = require("./available-plugins");
const has = Function.call.bind(Object.hasOwnProperty);
function addProposalSyntaxPlugins(items, proposalSyntaxPlugins) {

@@ -22,11 +18,8 @@ proposalSyntaxPlugins.forEach(plugin => {

}
function removeUnnecessaryItems(items, overlapping) {
items.forEach(item => {
var _overlapping$item;
(_overlapping$item = overlapping[item]) == null ? void 0 : _overlapping$item.forEach(name => items.delete(name));
});
}
function removeUnsupportedItems(items, babelVersion) {

@@ -33,0 +26,0 @@ items.forEach(item => {

@@ -8,3 +8,2 @@ "use strict";

const defaultExcludesForLooseMode = ["transform-typeof-symbol"];
function _default({

@@ -11,0 +10,0 @@ loose

@@ -9,39 +9,21 @@ "use strict";

exports.transformIncludesAndExcludes = void 0;
var _semver = require("semver");
var _debug = require("./debug");
var _getOptionSpecificExcludes = require("./get-option-specific-excludes");
var _filterItems = require("./filter-items");
var _moduleTransformations = require("./module-transformations");
var _normalizeOptions = require("./normalize-options");
var _shippedProposals = require("./shipped-proposals");
var _pluginsCompatData = require("./plugins-compat-data");
var _regenerator = require("./polyfills/regenerator");
var _babelPolyfill = require("./polyfills/babel-polyfill");
var _babelPluginPolyfillCorejs = require("babel-plugin-polyfill-corejs2");
var _babelPluginPolyfillCorejs2 = require("babel-plugin-polyfill-corejs3");
var _babelPluginPolyfillRegenerator = require("babel-plugin-polyfill-regenerator");
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
var _availablePlugins = require("./available-plugins");
var _helperPluginUtils = require("@babel/helper-plugin-utils");
const pluginCoreJS2 = _babelPluginPolyfillCorejs.default || _babelPluginPolyfillCorejs;
const pluginCoreJS3 = _babelPluginPolyfillCorejs2.default || _babelPluginPolyfillCorejs2;
const pluginRegenerator = _babelPluginPolyfillRegenerator.default || _babelPluginPolyfillRegenerator;
function isPluginRequired(targets, support) {

@@ -54,3 +36,2 @@ return (0, _helperCompilationTargets.isRequired)("fake-name", targets, {

}
function filterStageFromList(list, stageList) {

@@ -61,7 +42,5 @@ return Object.keys(list).reduce((result, item) => {

}
return result;
}, {});
}
const pluginLists = {

@@ -77,3 +56,2 @@ withProposals: {

};
function getPluginList(proposals, bugfixes) {

@@ -86,13 +64,9 @@ if (proposals) {

}
const getPlugin = pluginName => {
const plugin = _availablePlugins.default[pluginName]();
if (!plugin) {
throw new Error(`Could not find plugin "${pluginName}". Ensure there is an entry in ./available-plugins.js for it.`);
}
return plugin;
};
const transformIncludesAndExcludes = opts => {

@@ -109,5 +83,3 @@ return opts.reduce((result, opt) => {

};
exports.transformIncludesAndExcludes = transformIncludesAndExcludes;
const getModulesPluginNames = ({

@@ -122,3 +94,2 @@ modules,

const modulesPluginNames = [];
if (modules !== false && transformations[modules]) {

@@ -128,3 +99,2 @@ if (shouldTransformESM) {

}
if (shouldTransformDynamicImport && shouldTransformESM && modules !== "umd") {

@@ -136,3 +106,2 @@ modulesPluginNames.push("transform-dynamic-import");

}
modulesPluginNames.push("syntax-dynamic-import");

@@ -143,3 +112,2 @@ }

}
if (shouldTransformExportNamespaceFrom) {

@@ -150,12 +118,9 @@ modulesPluginNames.push("transform-export-namespace-from");

}
if (shouldParseTopLevelAwait) {
modulesPluginNames.push("syntax-top-level-await");
}
modulesPluginNames.push("syntax-import-meta");
return modulesPluginNames;
};
exports.getModulesPluginNames = getModulesPluginNames;
const getPolyfillPlugins = ({

@@ -173,3 +138,2 @@ useBuiltIns,

const polyfillPlugins = [];
if (useBuiltIns === "usage" || useBuiltIns === "entry") {

@@ -184,5 +148,7 @@ const pluginOptions = {

shippedProposals,
debug
debug,
"#__secret_key__@babel/preset-env__compatibility": {
noRuntimeName: true
}
};
if (corejs) {

@@ -200,3 +166,2 @@ if (useBuiltIns === "usage") {

}
if (regenerator) {

@@ -217,3 +182,2 @@ polyfillPlugins.push([pluginRegenerator, {

}]);
if (!regenerator) {

@@ -226,8 +190,5 @@ polyfillPlugins.push([_regenerator.default, pluginOptions]);

}
return polyfillPlugins;
};
exports.getPolyfillPlugins = getPolyfillPlugins;
function getLocalTargets(optionsTargets, ignoreBrowserslistConfig, configPath, browserslistEnv) {

@@ -240,3 +201,2 @@ if (optionsTargets != null && optionsTargets.esmodules && optionsTargets.browsers) {

}
return (0, _helperCompilationTargets.default)(optionsTargets, {

@@ -248,19 +208,14 @@ ignoreBrowserslistConfig,

}
function supportsStaticESM(caller) {
return !!(caller != null && caller.supportsStaticESM);
}
function supportsDynamicImport(caller) {
return !!(caller != null && caller.supportsDynamicImport);
}
function supportsExportNamespaceFrom(caller) {
return !!(caller != null && caller.supportsExportNamespaceFrom);
}
function supportsTopLevelAwait(caller) {
return !!(caller != null && caller.supportsTopLevelAwait);
}
var _default = (0, _helperPluginUtils.declarePreset)((api, opts) => {

@@ -290,7 +245,5 @@ api.assertVersion(7);

let targets = babelTargets;
if (_semver.lt(api.version, "7.13.0") || opts.targets || opts.configPath || opts.browserslistEnv || opts.ignoreBrowserslistConfig) {
{
var hasUglifyTarget = false;
if (optionsTargets != null && optionsTargets.uglify) {

@@ -307,3 +260,2 @@ hasUglifyTarget = true;

}
const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets;

@@ -329,9 +281,7 @@ const include = transformIncludesAndExcludes(optionsInclude);

}), _shippedProposals.pluginSyntaxMap);
(0, _filterItems.removeUnnecessaryItems)(pluginNames, _pluginsCompatData.overlappingPlugins);
(0, _filterItems.removeUnsupportedItems)(pluginNames, api.version);
if (shippedProposals) {
(0, _filterItems.addProposalSyntaxPlugins)(pluginNames, _shippedProposals.proposalSyntaxPlugins);
}
(0, _filterItems.removeUnsupportedItems)(pluginNames, api.version);
(0, _filterItems.removeUnnecessaryItems)(pluginNames, _pluginsCompatData.overlappingPlugins);
const polyfillPlugins = getPolyfillPlugins({

@@ -355,3 +305,7 @@ useBuiltIns,

}
if (pluginName === "syntax-import-attributes") {
return [getPlugin(pluginName), {
deprecatedAssertSyntax: true
}];
}
return [getPlugin(pluginName), {

@@ -363,3 +317,2 @@ spec,

}).concat(polyfillPlugins);
if (debug) {

@@ -374,3 +327,2 @@ console.log("@babel/preset-env: `DEBUG` option");

});
if (!useBuiltIns) {

@@ -380,3 +332,2 @@ console.log("\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.");

}
return {

@@ -386,5 +337,4 @@ plugins

});
exports.default = _default;
//# sourceMappingURL=index.js.map

@@ -10,17 +10,9 @@ "use strict";

exports.validateUseBuiltInsOption = exports.validateModulesOption = exports.normalizePluginName = void 0;
var _semver = require("semver");
var _corejs2BuiltIns = require("@babel/compat-data/corejs2-built-ins");
var _coreJsCompat = require("../data/core-js-compat");
var _pluginsCompatData = require("./plugins-compat-data");
var _moduleTransformations = require("./module-transformations");
var _options = require("./options");
var _helperValidatorOption = require("@babel/helper-validator-option");
const corejs2DefaultWebIncludes = ["web.timers", "web.immediate", "web.dom.iterable"];

@@ -30,9 +22,8 @@ const v = new _helperValidatorOption.OptionValidator("@babel/preset-env");

const modulePlugins = ["transform-dynamic-import", ...Object.keys(_moduleTransformations.default).map(m => _moduleTransformations.default[m])];
const getValidIncludesAndExcludes = (type, corejs) => Array.from(new Set([...allPluginsList, ...(type === "exclude" ? modulePlugins : []), ...(corejs ? corejs == 2 ? [...Object.keys(_corejs2BuiltIns), ...corejs2DefaultWebIncludes] : Object.keys(_coreJsCompat) : [])]));
function flatMap(array, fn) {
return Array.prototype.concat.apply([], array.map(fn));
}
const normalizePluginName = plugin => plugin.replace(/^(@babel\/|babel-)(plugin-)?/, "");
exports.normalizePluginName = normalizePluginName;
const expandIncludesAndExcludes = (filterList = [], type, corejs) => {

@@ -44,3 +35,2 @@ if (filterList.length === 0) return [];

let re;
if (typeof filter === "string") {

@@ -56,4 +46,5 @@ try {

}
const items = filterableItems.filter(item => re.test(item) || re.test(item.replace(/^transform-/, "proposal-")));
const items = filterableItems.filter(item => {
return re.test(item) || re.test(item.replace(/^transform-/, "proposal-"));
});
if (items.length === 0) invalidFilters.push(filter);

@@ -66,7 +57,2 @@ return items;

};
const normalizePluginName = plugin => plugin.replace(/^(@babel\/|babel-)(plugin-)?/, "");
exports.normalizePluginName = normalizePluginName;
const checkDuplicateIncludeExcludes = (include = [], exclude = []) => {

@@ -77,5 +63,3 @@ const duplicates = include.filter(opt => exclude.indexOf(opt) >= 0);

};
exports.checkDuplicateIncludeExcludes = checkDuplicateIncludeExcludes;
const normalizeTargets = targets => {

@@ -87,6 +71,4 @@ if (typeof targets === "string" || Array.isArray(targets)) {

}
return Object.assign({}, targets);
};
const validateModulesOption = (modulesOpt = _options.ModulesOption.auto) => {

@@ -96,5 +78,3 @@ v.invariant(_options.ModulesOption[modulesOpt.toString()] || modulesOpt === _options.ModulesOption.false, `The 'modules' option must be one of \n` + ` - 'false' to indicate no module processing\n` + ` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'` + ` - 'auto' (default) which will automatically select 'false' if the current\n` + ` process is known to support ES module syntax, or "commonjs" otherwise\n`);

};
exports.validateModulesOption = validateModulesOption;
const validateUseBuiltInsOption = (builtInsOpt = false) => {

@@ -107,9 +87,6 @@ v.invariant(_options.UseBuiltInsOption[builtInsOpt.toString()] || builtInsOpt === _options.UseBuiltInsOption.false, `The 'useBuiltIns' option must be either

};
exports.validateUseBuiltInsOption = validateUseBuiltInsOption;
function normalizeCoreJSOption(corejs, useBuiltIns) {
let proposals = false;
let rawVersion;
if (useBuiltIns && corejs === undefined) {

@@ -124,13 +101,9 @@ rawVersion = 2;

}
const version = rawVersion ? _semver.coerce(String(rawVersion)) : false;
if (!useBuiltIns && version) {
console.warn("\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n");
}
if (useBuiltIns && (!version || version.major < 2 || version.major > 3)) {
throw new RangeError("Invalid Option: The version passed to `corejs` is invalid. Currently, " + "only core-js@2 and core-js@3 are supported.");
}
return {

@@ -141,3 +114,2 @@ version,

}
function normalizeOptions(opts) {

@@ -144,0 +116,0 @@ v.validateTopLevelOptions(opts, _options.TopLevelOptions);

@@ -7,11 +7,6 @@ "use strict";

exports.pluginsBugfixes = exports.plugins = exports.overlappingPlugins = void 0;
var _plugins = require("@babel/compat-data/plugins");
var _pluginBugfixes = require("@babel/compat-data/plugin-bugfixes");
var _overlappingPlugins = require("@babel/compat-data/overlapping-plugins");
var _availablePlugins = require("./available-plugins");
const keys = Object.keys;

@@ -24,6 +19,5 @@ const plugins = filterAvailable(_plugins);

exports.overlappingPlugins = overlappingPlugins;
overlappingPlugins["syntax-import-attributes"] = ["syntax-import-assertions"];
function filterAvailable(data) {
const result = {};
for (const plugin of keys(data)) {

@@ -34,3 +28,2 @@ if (Object.hasOwnProperty.call(_availablePlugins.default, plugin)) {

}
return result;

@@ -37,0 +30,0 @@ }

@@ -7,5 +7,3 @@ "use strict";

exports.default = _default;
var _utils = require("./utils");
const BABEL_POLYFILL_DEPRECATION = `

@@ -17,3 +15,2 @@ \`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`

Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`;
function _default({

@@ -31,3 +28,2 @@ template

const src = (0, _utils.getImportSource)(path);
if (usage && (0, _utils.isPolyfillSource)(src)) {

@@ -51,7 +47,5 @@ console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src));

},
Program(path) {
path.get("body").forEach(bodyPath => {
const src = (0, _utils.getRequireSource)(bodyPath);
if (usage && (0, _utils.isPolyfillSource)(src)) {

@@ -76,3 +70,2 @@ console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src));

}
}

@@ -79,0 +72,0 @@ };

@@ -7,9 +7,6 @@ "use strict";

exports.default = _default;
var _utils = require("./utils");
function isRegeneratorSource(source) {
return source === "regenerator-runtime/runtime" || source === "regenerator-runtime/runtime.js";
}
function _default() {

@@ -23,3 +20,2 @@ const visitor = {

},
Program(path) {

@@ -33,3 +29,2 @@ path.get("body").forEach(bodyPath => {

}
};

@@ -39,19 +34,14 @@ return {

visitor,
pre() {
this.regeneratorImportExcluded = false;
},
post() {
if (this.opts.debug && this.regeneratorImportExcluded) {
let filename = this.file.opts.filename;
if (process.env.BABEL_ENV === "test") {
filename = filename.replace(/\\/g, "/");
}
console.log(`\n[${filename}] Based on your targets, regenerator-runtime import excluded.`);
}
}
};

@@ -58,0 +48,0 @@ }

@@ -9,5 +9,3 @@ "use strict";

exports.isPolyfillSource = isPolyfillSource;
var _t = require("@babel/types");
const {

@@ -19,3 +17,2 @@ isCallExpression,

} = _t;
function getImportSource({

@@ -26,3 +23,2 @@ node

}
function getRequireSource({

@@ -35,3 +31,2 @@ node

} = node;
if (isCallExpression(expression) && isIdentifier(expression.callee) && expression.callee.name === "require" && expression.arguments.length === 1 && isStringLiteral(expression.arguments[0])) {

@@ -41,3 +36,2 @@ return expression.arguments[0].value;

}
function isPolyfillSource(source) {

@@ -44,0 +38,0 @@ return source === "@babel/polyfill" || source === "core-js";

@@ -9,3 +9,3 @@ "use strict";

exports.proposalPlugins = proposalPlugins;
const proposalSyntaxPlugins = ["syntax-import-assertions"];
const proposalSyntaxPlugins = ["syntax-import-assertions", "syntax-import-attributes"];
exports.proposalSyntaxPlugins = proposalSyntaxPlugins;

@@ -12,0 +12,0 @@ const pluginSyntaxObject = {

@@ -18,5 +18,4 @@ "use strict";

});
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
//# sourceMappingURL=targets-parser.js.map
{
"name": "@babel/preset-env",
"version": "7.19.4",
"version": "7.22.2",
"description": "A Babel preset for each environment.",

@@ -19,23 +19,9 @@ "author": "The Babel Team (https://babel.dev/team)",

"dependencies": {
"@babel/compat-data": "^7.19.4",
"@babel/helper-compilation-targets": "^7.19.3",
"@babel/helper-plugin-utils": "^7.19.0",
"@babel/helper-validator-option": "^7.18.6",
"@babel/compat-data": "^7.22.0",
"@babel/helper-compilation-targets": "^7.22.1",
"@babel/helper-plugin-utils": "^7.21.5",
"@babel/helper-validator-option": "^7.21.0",
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6",
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9",
"@babel/plugin-proposal-async-generator-functions": "^7.19.1",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-class-static-block": "^7.18.6",
"@babel/plugin-proposal-dynamic-import": "^7.18.6",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-json-strings": "^7.18.6",
"@babel/plugin-proposal-logical-assignment-operators": "^7.18.9",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.19.4",
"@babel/plugin-proposal-optional-catch-binding": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
"@babel/plugin-proposal-unicode-property-regex": "^7.18.6",
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.22.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.0",
"@babel/plugin-syntax-async-generators": "^7.8.4",

@@ -46,3 +32,5 @@ "@babel/plugin-syntax-class-properties": "^7.12.13",

"@babel/plugin-syntax-export-namespace-from": "^7.8.3",
"@babel/plugin-syntax-import-assertions": "^7.18.6",
"@babel/plugin-syntax-import-assertions": "^7.20.0",
"@babel/plugin-syntax-import-attributes": "^7.22.0",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-syntax-json-strings": "^7.8.3",

@@ -57,40 +45,57 @@ "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4",

"@babel/plugin-syntax-top-level-await": "^7.14.5",
"@babel/plugin-transform-arrow-functions": "^7.18.6",
"@babel/plugin-transform-async-to-generator": "^7.18.6",
"@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
"@babel/plugin-transform-arrow-functions": "^7.21.5",
"@babel/plugin-transform-async-generator-functions": "^7.22.0",
"@babel/plugin-transform-async-to-generator": "^7.20.7",
"@babel/plugin-transform-block-scoped-functions": "^7.18.6",
"@babel/plugin-transform-block-scoping": "^7.19.4",
"@babel/plugin-transform-classes": "^7.19.0",
"@babel/plugin-transform-computed-properties": "^7.18.9",
"@babel/plugin-transform-destructuring": "^7.19.4",
"@babel/plugin-transform-block-scoping": "^7.21.0",
"@babel/plugin-transform-class-properties": "^7.22.0",
"@babel/plugin-transform-class-static-block": "^7.22.0",
"@babel/plugin-transform-classes": "^7.21.0",
"@babel/plugin-transform-computed-properties": "^7.21.5",
"@babel/plugin-transform-destructuring": "^7.21.3",
"@babel/plugin-transform-dotall-regex": "^7.18.6",
"@babel/plugin-transform-duplicate-keys": "^7.18.9",
"@babel/plugin-transform-dynamic-import": "^7.22.1",
"@babel/plugin-transform-exponentiation-operator": "^7.18.6",
"@babel/plugin-transform-for-of": "^7.18.8",
"@babel/plugin-transform-export-namespace-from": "^7.22.0",
"@babel/plugin-transform-for-of": "^7.21.5",
"@babel/plugin-transform-function-name": "^7.18.9",
"@babel/plugin-transform-json-strings": "^7.22.0",
"@babel/plugin-transform-literals": "^7.18.9",
"@babel/plugin-transform-logical-assignment-operators": "^7.22.0",
"@babel/plugin-transform-member-expression-literals": "^7.18.6",
"@babel/plugin-transform-modules-amd": "^7.18.6",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/plugin-transform-modules-systemjs": "^7.19.0",
"@babel/plugin-transform-modules-amd": "^7.20.11",
"@babel/plugin-transform-modules-commonjs": "^7.21.5",
"@babel/plugin-transform-modules-systemjs": "^7.22.0",
"@babel/plugin-transform-modules-umd": "^7.18.6",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1",
"@babel/plugin-transform-new-target": "^7.18.6",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.22.0",
"@babel/plugin-transform-new-target": "^7.22.0",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.22.0",
"@babel/plugin-transform-numeric-separator": "^7.22.0",
"@babel/plugin-transform-object-rest-spread": "^7.22.0",
"@babel/plugin-transform-object-super": "^7.18.6",
"@babel/plugin-transform-parameters": "^7.18.8",
"@babel/plugin-transform-optional-catch-binding": "^7.22.0",
"@babel/plugin-transform-optional-chaining": "^7.22.0",
"@babel/plugin-transform-parameters": "^7.22.0",
"@babel/plugin-transform-private-methods": "^7.22.0",
"@babel/plugin-transform-private-property-in-object": "^7.22.0",
"@babel/plugin-transform-property-literals": "^7.18.6",
"@babel/plugin-transform-regenerator": "^7.18.6",
"@babel/plugin-transform-regenerator": "^7.21.5",
"@babel/plugin-transform-reserved-words": "^7.18.6",
"@babel/plugin-transform-shorthand-properties": "^7.18.6",
"@babel/plugin-transform-spread": "^7.19.0",
"@babel/plugin-transform-spread": "^7.20.7",
"@babel/plugin-transform-sticky-regex": "^7.18.6",
"@babel/plugin-transform-template-literals": "^7.18.9",
"@babel/plugin-transform-typeof-symbol": "^7.18.9",
"@babel/plugin-transform-unicode-escapes": "^7.18.10",
"@babel/plugin-transform-unicode-escapes": "^7.21.5",
"@babel/plugin-transform-unicode-property-regex": "^7.22.0",
"@babel/plugin-transform-unicode-regex": "^7.18.6",
"@babel/plugin-transform-unicode-sets-regex": "^7.22.0",
"@babel/preset-modules": "^0.1.5",
"@babel/types": "^7.19.4",
"babel-plugin-polyfill-corejs2": "^0.3.3",
"babel-plugin-polyfill-corejs3": "^0.6.0",
"babel-plugin-polyfill-regenerator": "^0.4.1",
"core-js-compat": "^3.25.1",
"@babel/types": "^7.22.0",
"babel-plugin-polyfill-corejs2": "^0.4.2",
"babel-plugin-polyfill-corejs3": "^0.8.1",
"babel-plugin-polyfill-regenerator": "^0.5.0",
"core-js-compat": "^3.30.2",
"semver": "^6.3.0"

@@ -102,6 +107,6 @@ },

"devDependencies": {
"@babel/core": "^7.19.3",
"@babel/core": "^7.22.1",
"@babel/core-7.12": "npm:@babel/core@7.12.9",
"@babel/helper-plugin-test-runner": "^7.18.6",
"@babel/traverse": "^7.19.4"
"@babel/traverse": "^7.22.1"
},

@@ -108,0 +113,0 @@ "engines": {

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

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

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc