NET-Web-API-w-Angular/my-app/node_modules/@babel/preset-env/lib/normalize-options.js.map

1 line
18 KiB
Text
Raw Normal View History

2024-02-09 00:38:41 +00:00
{"version":3,"names":["_semver","require","_corejs2BuiltIns","_coreJsCompat","_pluginsCompatData","_moduleTransformations","_options","_helperValidatorOption","corejs2DefaultWebIncludes","v","OptionValidator","allPluginsList","Object","keys","pluginsList","modulePlugins","moduleTransformations","map","m","getValidIncludesAndExcludes","type","corejs","set","Set","add","corejs2Polyfills","corejs3Polyfills","Array","from","flatMap","array","fn","prototype","concat","apply","normalizePluginName","plugin","replace","exports","expandIncludesAndExcludes","filterList","length","filterableItems","invalidFilters","selectedPlugins","filter","re","RegExp","e","push","items","item","test","invariant","join","checkDuplicateIncludeExcludes","include","exclude","duplicates","opt","indexOf","normalizeTargets","targets","isArray","browsers","assign","validateModulesOption","modulesOpt","ModulesOption","auto","toString","false","validateUseBuiltInsOption","builtInsOpt","UseBuiltInsOption","normalizeCoreJSOption","useBuiltIns","proposals","rawVersion","undefined","console","warn","version","Boolean","semver","coerce","String","major","RangeError","normalizeOptions","opts","validateTopLevelOptions","TopLevelOptions","validateBooleanOption","loose","spec","bugfixes","configPath","validateStringOption","process","cwd","debug","forceAllTransforms","ignoreBrowserslistConfig","modules","shippedProposals","browserslistEnv"],"sources":["../src/normalize-options.ts"],"sourcesContent":["import semver, { type SemVer } from \"semver\";\nimport corejs2Polyfills from \"@babel/compat-data/corejs2-built-ins\";\n// @ts-expect-error Fixme: TS can not infer types from ../data/core-js-compat.js\n// but we can't import core-js-compat/data.json because JSON imports do\n// not work on Node 14\nimport corejs3Polyfills from \"../data/core-js-compat.js\";\nimport { plugins as pluginsList } from \"./plugins-compat-data.ts\";\nimport moduleTransformations from \"./module-transformations.ts\";\nimport {\n TopLevelOptions,\n ModulesOption,\n UseBuiltInsOption,\n} from \"./options.ts\";\nimport { OptionValidator } from \"@babel/helper-validator-option\";\n\nconst corejs2DefaultWebIncludes = [\n \"web.timers\",\n \"web.immediate\",\n \"web.dom.iterable\",\n];\n\nimport type {\n BuiltInsOption,\n CorejsOption,\n ModuleOption,\n Options,\n PluginListOption,\n} from \"./types.ts\";\n\nconst v = new OptionValidator(PACKAGE_JSON.name);\n\nconst allPluginsList = Object.keys(pluginsList);\n\n// NOTE: Since module plugins are handled separately compared to other plugins (via the \"modules\" option) it\n// should only be possible to exclude and not include module plugins, otherwise it's possible that preset-env\n// will add a module plugin twice.\nconst modulePlugins = [\n \"transform-dynamic-import\",\n ...Object.keys(moduleTransformations).map(m => moduleTransformations[m]),\n];\n\nconst getValidIncludesAndExcludes = (\n type: \"include\" | \"exclude\",\n corejs: number | false,\n) => {\n const set = new Set(allPluginsList);\n if (type === \"exclude\") modulePlugins.map(set.add, set);\n if (corejs) {\n if (process.env.BABEL_8_BREAKING) {\n Object.keys(corejs3Polyfills).map(set.add, set);\n } else {\n if (corejs === 2) {\n Object.keys(corejs2Polyfills).map(set.add, set);\n corejs2DefaultWebIncludes.map(set.add, set);\n } else {\n Object.keys(corejs3Polyfills).map(set.add, set);\n }\n }\n }\n return Array.from(set);\n};\n\nfunction flatMap<T, U>(array: Array<T>, fn: (item: T) => Array<U>): Array<U> {\n return Array.prototype.concat.apply([], array.map(fn));\n}\n\nexport const normalizePluginName = (plugin: string) =>\n plugin.replace(/^(@babel\\/|babel-)(plugin-)?/, \"\");\n\nconst expandIncludesAndExcludes = (\n filterList: PluginListOption = [],\n type: \"include\" | \"exclude\",\n corejs: number | false,\n) => {\n if (filterList.length === 0) return [];\n\n const filterableItems = getValidIncludesAndExcludes(type, corejs);\n\n const invalidFilters: PluginListOption = [];\n const selectedPlugins = fl