Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/preset-env

Package Overview
Dependencies
Maintainers
5
Versions
180
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.6.3 to 7.7.0

data/overlapping-plugins.js

1

lib/available-plugins.js

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

"syntax-optional-catch-binding": require("@babel/plugin-syntax-optional-catch-binding"),
"syntax-top-level-await": require("@babel/plugin-syntax-top-level-await"),
"transform-async-to-generator": require("@babel/plugin-transform-async-to-generator"),

@@ -15,0 +16,0 @@ "proposal-async-generator-functions": require("@babel/plugin-proposal-async-generator-functions"),

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

exports.default = _default;
exports.removeUnnecessaryItems = removeUnnecessaryItems;

@@ -72,2 +73,9 @@ var _semver = _interopRequireDefault(require("semver"));

return result;
}
function removeUnnecessaryItems(items, overlapping) {
items.forEach(item => {
const names = overlapping.get(item);
if (names) names.forEach(name => items.delete(name));
});
}

@@ -30,2 +30,4 @@ "use strict";

var _overlappingPlugins = _interopRequireDefault(require("../data/overlapping-plugins"));
var _usagePlugin = _interopRequireDefault(require("./polyfills/corejs2/usage-plugin"));

@@ -87,3 +89,4 @@

shouldTransformESM,
shouldTransformDynamicImport
shouldTransformDynamicImport,
shouldParseTopLevelAwait
}) => {

@@ -110,2 +113,6 @@ const modulesPluginNames = [];

if (shouldParseTopLevelAwait) {
modulesPluginNames.push("syntax-top-level-await");
}
return modulesPluginNames;

@@ -179,2 +186,6 @@ };

function supportsTopLevelAwait(caller) {
return !!(caller && caller.supportsTopLevelAwait);
}
var _default = (0, _helperPluginUtils.declare)((api, opts) => {

@@ -229,3 +240,4 @@ api.assertVersion(7);

shouldTransformESM: modules !== "auto" || !api.caller || !api.caller(supportsStaticESM),
shouldTransformDynamicImport: modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport)
shouldTransformDynamicImport: modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport),
shouldParseTopLevelAwait: api.caller(supportsTopLevelAwait)
});

@@ -235,2 +247,3 @@ const pluginNames = (0, _filterItems.default)(shippedProposals ? _plugins.default : pluginListWithoutProposals, include.plugins, exclude.plugins, transformTargets, modulesPluginNames, (0, _getOptionSpecificExcludes.default)({

}), _shippedProposals.pluginSyntaxMap);
(0, _filterItems.removeUnnecessaryItems)(pluginNames, _overlappingPlugins.default);
const polyfillPlugins = getPolyfillPlugins({

@@ -237,0 +250,0 @@ useBuiltIns,

2

lib/polyfills/corejs3/built-in-definitions.js

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

indexOf: ["es.array.index-of"],
italic: ["es.string.italics"],
italics: ["es.string.italics"],
join: ["es.array.join"],

@@ -97,0 +97,0 @@ keys: ArrayNatureIteratorsWithTag,

@@ -47,2 +47,13 @@ "use strict";

const available = new Set((0, _getModulesListForTargetVersion.default)(corejs.version));
function shouldReplace(source, modules) {
if (!modules) return false;
if (modules.length === 1 && polyfills.has(modules[0]) && available.has(modules[0]) && (0, _utils.getModulePath)(modules[0]) === source) {
return false;
}
return true;
}
const isPolyfillImport = {

@@ -58,3 +69,3 @@ ImportDeclaration(path) {

if (modules) {
if (shouldReplace(source, modules)) {
this.replaceBySeparateModulesImport(path, modules);

@@ -65,19 +76,34 @@ }

Program(path) {
path.get("body").forEach(bodyPath => {
const source = (0, _utils.getRequireSource)(bodyPath);
if (!source) return;
Program: {
enter(path) {
path.get("body").forEach(bodyPath => {
const source = (0, _utils.getRequireSource)(bodyPath);
if (!source) return;
if (isBabelPolyfillSource(source)) {
console.warn(BABEL_POLYFILL_DEPRECATION);
} else {
const modules = isCoreJSSource(source);
if (isBabelPolyfillSource(source)) {
console.warn(BABEL_POLYFILL_DEPRECATION);
} else {
const modules = isCoreJSSource(source);
if (modules) {
this.replaceBySeparateModulesImport(bodyPath, modules);
if (shouldReplace(source, modules)) {
this.replaceBySeparateModulesImport(bodyPath, modules);
}
}
});
},
exit(path) {
const filtered = (0, _utils.intersection)(polyfills, this.polyfillsSet, available);
const reversed = Array.from(filtered).reverse();
for (const module of reversed) {
if (!this.injectedPolyfills.has(module)) {
(0, _utils.createImport)(path, module);
}
}
});
filtered.forEach(module => this.injectedPolyfills.add(module));
}
}
};

@@ -89,2 +115,3 @@ return {

pre() {
this.injectedPolyfills = new Set();
this.polyfillsSet = new Set();

@@ -101,14 +128,5 @@

post({
path
}) {
const filtered = (0, _utils.intersection)(polyfills, this.polyfillsSet, available);
const reversed = Array.from(filtered).reverse();
for (const module of reversed) {
(0, _utils.createImport)(path, module);
}
post() {
if (debug) {
(0, _debug.logEntryPolyfills)("core-js", this.polyfillsSet.size > 0, filtered, this.file.opts.filename, polyfillTargets, _data.default);
(0, _debug.logEntryPolyfills)("core-js", this.injectedPolyfills.size > 0, this.injectedPolyfills, this.file.opts.filename, polyfillTargets, _data.default);
}

@@ -115,0 +133,0 @@ }

@@ -109,9 +109,25 @@ "use strict";

Program(path) {
path.get("body").forEach(bodyPath => {
if ((0, _utils.isPolyfillSource)((0, _utils.getRequireSource)(bodyPath))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
bodyPath.remove();
Program: {
enter(path) {
path.get("body").forEach(bodyPath => {
if ((0, _utils.isPolyfillSource)((0, _utils.getRequireSource)(bodyPath))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
bodyPath.remove();
}
});
},
exit(path) {
const filtered = (0, _utils.intersection)(polyfills, this.polyfillsSet, available);
const reversed = Array.from(filtered).reverse();
for (const module of reversed) {
if (!this.injectedPolyfills.has(module)) {
(0, _utils.createImport)(path, module);
}
}
});
filtered.forEach(module => this.injectedPolyfills.add(module));
}
},

@@ -209,2 +225,3 @@

pre() {
this.injectedPolyfills = new Set();
this.polyfillsSet = new Set();

@@ -257,14 +274,5 @@

post({
path
}) {
const filtered = (0, _utils.intersection)(polyfills, this.polyfillsSet, available);
const reversed = Array.from(filtered).reverse();
for (const module of reversed) {
(0, _utils.createImport)(path, module);
}
post() {
if (debug) {
(0, _debug.logUsagePolyfills)(filtered, this.file.opts.filename, polyfillTargets, _data.default);
(0, _debug.logUsagePolyfills)(this.injectedPolyfills, this.file.opts.filename, polyfillTargets, _data.default);
}

@@ -271,0 +279,0 @@ },

{
"name": "@babel/preset-env",
"version": "7.6.3",
"version": "7.7.0",
"description": "A Babel preset for each environment.",

@@ -17,10 +17,10 @@ "author": "Henry Zhu <hi@henryzoo.com>",

"dependencies": {
"@babel/helper-module-imports": "^7.0.0",
"@babel/helper-module-imports": "^7.7.0",
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-proposal-async-generator-functions": "^7.2.0",
"@babel/plugin-proposal-dynamic-import": "^7.5.0",
"@babel/plugin-proposal-async-generator-functions": "^7.7.0",
"@babel/plugin-proposal-dynamic-import": "^7.7.0",
"@babel/plugin-proposal-json-strings": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/plugin-proposal-optional-catch-binding": "^7.2.0",
"@babel/plugin-proposal-unicode-property-regex": "^7.6.2",
"@babel/plugin-proposal-unicode-property-regex": "^7.7.0",
"@babel/plugin-syntax-async-generators": "^7.2.0",

@@ -31,21 +31,22 @@ "@babel/plugin-syntax-dynamic-import": "^7.2.0",

"@babel/plugin-syntax-optional-catch-binding": "^7.2.0",
"@babel/plugin-syntax-top-level-await": "^7.7.0",
"@babel/plugin-transform-arrow-functions": "^7.2.0",
"@babel/plugin-transform-async-to-generator": "^7.5.0",
"@babel/plugin-transform-async-to-generator": "^7.7.0",
"@babel/plugin-transform-block-scoped-functions": "^7.2.0",
"@babel/plugin-transform-block-scoping": "^7.6.3",
"@babel/plugin-transform-classes": "^7.5.5",
"@babel/plugin-transform-classes": "^7.7.0",
"@babel/plugin-transform-computed-properties": "^7.2.0",
"@babel/plugin-transform-destructuring": "^7.6.0",
"@babel/plugin-transform-dotall-regex": "^7.6.2",
"@babel/plugin-transform-dotall-regex": "^7.7.0",
"@babel/plugin-transform-duplicate-keys": "^7.5.0",
"@babel/plugin-transform-exponentiation-operator": "^7.2.0",
"@babel/plugin-transform-for-of": "^7.4.4",
"@babel/plugin-transform-function-name": "^7.4.4",
"@babel/plugin-transform-function-name": "^7.7.0",
"@babel/plugin-transform-literals": "^7.2.0",
"@babel/plugin-transform-member-expression-literals": "^7.2.0",
"@babel/plugin-transform-modules-amd": "^7.5.0",
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
"@babel/plugin-transform-modules-systemjs": "^7.5.0",
"@babel/plugin-transform-modules-umd": "^7.2.0",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.6.3",
"@babel/plugin-transform-modules-commonjs": "^7.7.0",
"@babel/plugin-transform-modules-systemjs": "^7.7.0",
"@babel/plugin-transform-modules-umd": "^7.7.0",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0",
"@babel/plugin-transform-new-target": "^7.4.4",

@@ -55,3 +56,3 @@ "@babel/plugin-transform-object-super": "^7.5.5",

"@babel/plugin-transform-property-literals": "^7.2.0",
"@babel/plugin-transform-regenerator": "^7.4.5",
"@babel/plugin-transform-regenerator": "^7.7.0",
"@babel/plugin-transform-reserved-words": "^7.2.0",

@@ -63,4 +64,4 @@ "@babel/plugin-transform-shorthand-properties": "^7.2.0",

"@babel/plugin-transform-typeof-symbol": "^7.2.0",
"@babel/plugin-transform-unicode-regex": "^7.6.2",
"@babel/types": "^7.6.3",
"@babel/plugin-transform-unicode-regex": "^7.7.0",
"@babel/types": "^7.7.0",
"browserslist": "^4.6.0",

@@ -76,4 +77,4 @@ "core-js-compat": "^3.1.1",

"devDependencies": {
"@babel/cli": "^7.6.3",
"@babel/core": "^7.6.3",
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.0",
"@babel/helper-fixtures": "^7.6.3",

@@ -86,3 +87,3 @@ "@babel/helper-plugin-test-runner": "^7.0.0",

},
"gitHead": "d329156ebc17da01382acb83e212cb4328534ebc"
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}
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