From efbc2ffe6a1ee5ec38a4396305561d6515d0943e Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 30 Aug 2024 17:21:18 +0800 Subject: node fixes, updates --- node_modules/@babel/preset-env/lib/normalize-options.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'node_modules/@babel/preset-env/lib/normalize-options.js') diff --git a/node_modules/@babel/preset-env/lib/normalize-options.js b/node_modules/@babel/preset-env/lib/normalize-options.js index d22fba19..c80a3a51 100644 --- a/node_modules/@babel/preset-env/lib/normalize-options.js +++ b/node_modules/@babel/preset-env/lib/normalize-options.js @@ -13,7 +13,7 @@ var _moduleTransformations = require("./module-transformations.js"); var _options = require("./options.js"); var _helperValidatorOption = require("@babel/helper-validator-option"); var _babel7Plugins = require("./polyfills/babel-7-plugins.cjs"); -const corejs3Polyfills = JSON.parse(require("fs").readFileSync(require.resolve("core-js-compat/data.json"))); +const corejs3Polyfills = require("core-js-compat/data.json"); const v = new _helperValidatorOption.OptionValidator("@babel/preset-env"); const allPluginsList = Object.keys(_pluginsCompatData.plugins); const modulePlugins = ["transform-dynamic-import", ...Object.keys(_moduleTransformations.default).map(m => _moduleTransformations.default[m])]; @@ -33,7 +33,7 @@ const getValidIncludesAndExcludes = (type, corejs) => { function flatMap(array, fn) { return Array.prototype.concat.apply([], array.map(fn)); } -const normalizePluginName = plugin => plugin.replace(/^(@babel\/|babel-)(plugin-)?/, ""); +const normalizePluginName = plugin => plugin.replace(/^(?:@babel\/|babel-)(?:plugin-)?/, ""); exports.normalizePluginName = normalizePluginName; const expandIncludesAndExcludes = (filterList = [], type, corejs) => { if (filterList.length === 0) return []; @@ -44,7 +44,7 @@ const expandIncludesAndExcludes = (filterList = [], type, corejs) => { if (typeof filter === "string") { try { re = new RegExp(`^${normalizePluginName(filter)}$`); - } catch (e) { + } catch (_) { invalidFilters.push(filter); return []; } @@ -62,7 +62,7 @@ const expandIncludesAndExcludes = (filterList = [], type, corejs) => { return selectedPlugins; }; const checkDuplicateIncludeExcludes = (include = [], exclude = []) => { - const duplicates = include.filter(opt => exclude.indexOf(opt) >= 0); + const duplicates = include.filter(opt => exclude.includes(opt)); v.invariant(duplicates.length === 0, `The plugins/built-ins '${duplicates.join(", ")}' were found in both the "include" and "exclude" options.`); }; -- cgit v1.2.3