{"version":3,"file":"index.node.mjs","sources":["../src/utils.ts","../src/imports-injector.ts","../src/debug-utils.ts","../src/normalize-options.ts","../src/visitors/usage.ts","../src/visitors/entry.ts","../src/node/dependencies.ts","../src/meta-resolver.ts","../src/index.ts"],"sourcesContent":["import { types as t, template } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { Utils } from \"./types\";\nimport type ImportsCachedInjector from \"./imports-injector\";\n\nexport function intersection(a: Set, b: Set): Set {\n const result = new Set();\n a.forEach(v => b.has(v) && result.add(v));\n return result;\n}\n\nexport function has(object: any, key: string) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nfunction getType(target: any): string {\n return Object.prototype.toString.call(target).slice(8, -1);\n}\n\nfunction resolveId(path): string {\n if (\n path.isIdentifier() &&\n !path.scope.hasBinding(path.node.name, /* noGlobals */ true)\n ) {\n return path.node.name;\n }\n\n if (path.isPure()) {\n const { deopt } = path.evaluate();\n if (deopt && deopt.isIdentifier()) {\n return deopt.node.name;\n }\n }\n}\n\nexport function resolveKey(\n path: NodePath,\n computed: boolean = false,\n) {\n const { scope } = path;\n if (path.isStringLiteral()) return path.node.value;\n const isIdentifier = path.isIdentifier();\n if (\n isIdentifier &&\n !(computed || (path.parent as t.MemberExpression).computed)\n ) {\n return path.node.name;\n }\n\n if (\n computed &&\n path.isMemberExpression() &&\n path.get(\"object\").isIdentifier({ name: \"Symbol\" }) &&\n !scope.hasBinding(\"Symbol\", /* noGlobals */ true)\n ) {\n const sym = resolveKey(path.get(\"property\"), path.node.computed);\n if (sym) return \"Symbol.\" + sym;\n }\n\n if (\n isIdentifier\n ? scope.hasBinding(path.node.name, /* noGlobals */ true)\n : path.isPure()\n ) {\n const { value } = path.evaluate();\n if (typeof value === \"string\") return value;\n }\n}\n\nexport function resolveSource(obj: NodePath): {\n id: string | null;\n placement: \"prototype\" | \"static\" | null;\n} {\n if (\n obj.isMemberExpression() &&\n obj.get(\"property\").isIdentifier({ name: \"prototype\" })\n ) {\n const id = resolveId(obj.get(\"object\"));\n\n if (id) {\n return { id, placement: \"prototype\" };\n }\n return { id: null, placement: null };\n }\n\n const id = resolveId(obj);\n if (id) {\n return { id, placement: \"static\" };\n }\n\n if (obj.isRegExpLiteral()) {\n return { id: \"RegExp\", placement: \"prototype\" };\n } else if (obj.isFunction()) {\n return { id: \"Function\", placement: \"prototype\" };\n } else if (obj.isPure()) {\n const { value } = obj.evaluate();\n if (value !== undefined) {\n return { id: getType(value), placement: \"prototype\" };\n }\n }\n\n return { id: null, placement: null };\n}\n\nexport function getImportSource({ node }: NodePath) {\n if (node.specifiers.length === 0) return node.source.value;\n}\n\nexport function getRequireSource({ node }: NodePath) {\n if (!t.isExpressionStatement(node)) return;\n const { expression } = node;\n if (\n t.isCallExpression(expression) &&\n t.isIdentifier(expression.callee) &&\n expression.callee.name === \"require\" &&\n expression.arguments.length === 1 &&\n t.isStringLiteral(expression.arguments[0])\n ) {\n return expression.arguments[0].value;\n }\n}\n\nfunction hoist(node: t.Node) {\n // @ts-expect-error\n node._blockHoist = 3;\n return node;\n}\n\nexport function createUtilsGetter(cache: ImportsCachedInjector) {\n return (path: NodePath): Utils => {\n const prog = path.findParent(p => p.isProgram()) as NodePath;\n\n return {\n injectGlobalImport(url, moduleName) {\n cache.storeAnonymous(prog, url, moduleName, (isScript, source) => {\n return isScript\n ? template.statement.ast`require(${source})`\n : t.importDeclaration([], source);\n });\n },\n injectNamedImport(url, name, hint = name, moduleName) {\n return cache.storeNamed(\n prog,\n url,\n name,\n moduleName,\n (isScript, source, name) => {\n const id = prog.scope.generateUidIdentifier(hint);\n return {\n node: isScript\n ? hoist(template.statement.ast`\n var ${id} = require(${source}).${name}\n `)\n : t.importDeclaration([t.importSpecifier(id, name)], source),\n name: id.name,\n };\n },\n );\n },\n injectDefaultImport(url, hint = url, moduleName) {\n return cache.storeNamed(\n prog,\n url,\n \"default\",\n moduleName,\n (isScript, source) => {\n const id = prog.scope.generateUidIdentifier(hint);\n return {\n node: isScript\n ? hoist(template.statement.ast`var ${id} = require(${source})`)\n : t.importDeclaration([t.importDefaultSpecifier(id)], source),\n name: id.name,\n };\n },\n );\n },\n };\n };\n}\n","import type { NodePath } from \"@babel/traverse\";\nimport { types as t } from \"@babel/core\";\n\ntype StrMap = Map;\n\nexport default class ImportsCachedInjector {\n _imports: WeakMap, StrMap>;\n _anonymousImports: WeakMap, Set>;\n _lastImports: WeakMap<\n NodePath,\n Array<{ path: NodePath; index: number }>\n >;\n _resolver: (url: string) => string;\n _getPreferredIndex: (url: string) => number;\n\n constructor(\n resolver: (url: string) => string,\n getPreferredIndex: (url: string) => number,\n ) {\n this._imports = new WeakMap();\n this._anonymousImports = new WeakMap();\n this._lastImports = new WeakMap();\n this._resolver = resolver;\n this._getPreferredIndex = getPreferredIndex;\n }\n\n storeAnonymous(\n programPath: NodePath,\n url: string,\n moduleName: string,\n getVal: (isScript: boolean, source: t.StringLiteral) => t.Node,\n ) {\n const key = this._normalizeKey(programPath, url);\n const imports = this._ensure>(\n this._anonymousImports,\n programPath,\n Set,\n );\n\n if (imports.has(key)) return;\n\n const node = getVal(\n programPath.node.sourceType === \"script\",\n t.stringLiteral(this._resolver(url)),\n );\n imports.add(key);\n this._injectImport(programPath, node, moduleName);\n }\n\n storeNamed(\n programPath: NodePath,\n url: string,\n name: string,\n moduleName: string,\n getVal: (\n isScript: boolean,\n // eslint-disable-next-line no-undef\n source: t.StringLiteral,\n // eslint-disable-next-line no-undef\n name: t.Identifier,\n ) => { node: t.Node; name: string },\n ) {\n const key = this._normalizeKey(programPath, url, name);\n const imports = this._ensure>(\n this._imports,\n programPath,\n Map,\n );\n\n if (!imports.has(key)) {\n const { node, name: id } = getVal(\n programPath.node.sourceType === \"script\",\n t.stringLiteral(this._resolver(url)),\n t.identifier(name),\n );\n imports.set(key, id);\n this._injectImport(programPath, node, moduleName);\n }\n\n return t.identifier(imports.get(key));\n }\n\n _injectImport(\n programPath: NodePath,\n node: t.Node,\n moduleName: string,\n ) {\n const newIndex = this._getPreferredIndex(moduleName);\n const lastImports = this._lastImports.get(programPath) ?? [];\n\n const isPathStillValid = (path: NodePath) =>\n path.node &&\n // Sometimes the AST is modified and the \"last import\"\n // we have has been replaced\n path.parent === programPath.node &&\n path.container === programPath.node.body;\n\n let last: NodePath;\n\n if (newIndex === Infinity) {\n // Fast path: we can always just insert at the end if newIndex is `Infinity`\n if (lastImports.length > 0) {\n last = lastImports[lastImports.length - 1].path;\n if (!isPathStillValid(last)) last = undefined;\n }\n } else {\n for (const [i, data] of lastImports.entries()) {\n const { path, index } = data;\n if (isPathStillValid(path)) {\n if (newIndex < index) {\n const [newPath] = path.insertBefore(node);\n lastImports.splice(i, 0, { path: newPath, index: newIndex });\n return;\n }\n last = path;\n }\n }\n }\n\n if (last) {\n const [newPath] = last.insertAfter(node);\n lastImports.push({ path: newPath, index: newIndex });\n } else {\n const [newPath] = programPath.unshiftContainer(\"body\", node);\n this._lastImports.set(programPath, [{ path: newPath, index: newIndex }]);\n }\n }\n\n _ensure | Set>(\n map: WeakMap, C>,\n programPath: NodePath,\n Collection: { new (...args: any): C },\n ): C {\n let collection = map.get(programPath);\n if (!collection) {\n collection = new Collection();\n map.set(programPath, collection);\n }\n return collection;\n }\n\n _normalizeKey(\n programPath: NodePath,\n url: string,\n name: string = \"\",\n ): string {\n const { sourceType } = programPath.node;\n\n // If we rely on the imported binding (the \"name\" parameter), we also need to cache\n // based on the sourceType. This is because the module transforms change the names\n // of the import variables.\n return `${name && sourceType}::${url}::${name}`;\n }\n}\n","import { prettifyTargets } from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"./types\";\n\nexport const presetEnvSilentDebugHeader =\n \"#__secret_key__@babel/preset-env__don't_log_debug_header_and_resolved_targets\";\n\nexport function stringifyTargetsMultiline(targets: Targets): string {\n return JSON.stringify(prettifyTargets(targets), null, 2);\n}\n\nexport function stringifyTargets(targets: Targets): string {\n return JSON.stringify(targets)\n .replace(/,/g, \", \")\n .replace(/^\\{\"/, '{ \"')\n .replace(/\"\\}$/, '\" }');\n}\n","import { intersection } from \"./utils\";\nimport type {\n Pattern,\n PluginOptions,\n MissingDependenciesOption,\n} from \"./types\";\n\nfunction patternToRegExp(pattern: Pattern): RegExp | null {\n if (pattern instanceof RegExp) return pattern;\n\n try {\n return new RegExp(`^${pattern}$`);\n } catch {\n return null;\n }\n}\n\nfunction buildUnusedError(label, unused) {\n if (!unused.length) return \"\";\n return (\n ` - The following \"${label}\" patterns didn't match any polyfill:\\n` +\n unused.map(original => ` ${String(original)}\\n`).join(\"\")\n );\n}\n\nfunction buldDuplicatesError(duplicates) {\n if (!duplicates.size) return \"\";\n return (\n ` - The following polyfills were matched both by \"include\" and \"exclude\" patterns:\\n` +\n Array.from(duplicates, name => ` ${name}\\n`).join(\"\")\n );\n}\n\nexport function validateIncludeExclude(\n provider: string,\n polyfills: Map,\n includePatterns: Pattern[],\n excludePatterns: Pattern[],\n) {\n let current;\n const filter = pattern => {\n const regexp = patternToRegExp(pattern);\n if (!regexp) return false;\n\n let matched = false;\n for (const polyfill of polyfills.keys()) {\n if (regexp.test(polyfill)) {\n matched = true;\n current.add(polyfill);\n }\n }\n return !matched;\n };\n\n // prettier-ignore\n const include = current = new Set ();\n const unusedInclude = Array.from(includePatterns).filter(filter);\n\n // prettier-ignore\n const exclude = current = new Set ();\n const unusedExclude = Array.from(excludePatterns).filter(filter);\n\n const duplicates = intersection(include, exclude);\n\n if (\n duplicates.size > 0 ||\n unusedInclude.length > 0 ||\n unusedExclude.length > 0\n ) {\n throw new Error(\n `Error while validating the \"${provider}\" provider options:\\n` +\n buildUnusedError(\"include\", unusedInclude) +\n buildUnusedError(\"exclude\", unusedExclude) +\n buldDuplicatesError(duplicates),\n );\n }\n\n return { include, exclude };\n}\n\nexport function applyMissingDependenciesDefaults(\n options: PluginOptions,\n babelApi: any,\n): MissingDependenciesOption {\n const { missingDependencies = {} } = options;\n if (missingDependencies === false) return false;\n\n const caller = babelApi.caller(caller => caller?.name);\n\n const {\n log = \"deferred\",\n inject = caller === \"rollup-plugin-babel\" ? \"throw\" : \"import\",\n all = false,\n } = missingDependencies;\n\n return { log, inject, all };\n}\n","import type { NodePath } from \"@babel/traverse\";\nimport { types as t } from \"@babel/core\";\nimport type { CallProvider } from \"./index\";\n\nimport { resolveKey, resolveSource } from \"../utils\";\n\nfunction isRemoved(path: NodePath) {\n if (path.removed) return true;\n if (!path.parentPath) return false;\n if (path.listKey) {\n if (!path.parentPath.node[path.listKey].includes(path.node)) return true;\n } else {\n if (path.parentPath.node[path.key] !== path.node) return true;\n }\n return isRemoved(path.parentPath);\n}\n\nexport default (callProvider: CallProvider) => {\n function property(object, key, placement, path) {\n return callProvider({ kind: \"property\", object, key, placement }, path);\n }\n\n function handleReferencedIdentifier(path) {\n const {\n node: { name },\n scope,\n } = path;\n if (scope.getBindingIdentifier(name)) return;\n\n callProvider({ kind: \"global\", name }, path);\n }\n\n return {\n // Symbol(), new Promise\n ReferencedIdentifier(path: NodePath) {\n if (path.parentPath.isMemberExpression({ object: path.node })) {\n // Handled in the MemberExpression visitor\n return;\n }\n handleReferencedIdentifier(path);\n },\n\n MemberExpression(path: NodePath) {\n const key = resolveKey(path.get(\"property\"), path.node.computed);\n if (!key || key === \"prototype\") return;\n\n const object = path.get(\"object\");\n let objectIsGlobalIdentifier = object.isIdentifier();\n if (objectIsGlobalIdentifier) {\n const binding = object.scope.getBinding(\n (object.node as t.Identifier).name,\n );\n if (binding) {\n if (binding.path.isImportNamespaceSpecifier()) return;\n objectIsGlobalIdentifier = false;\n }\n }\n\n const source = resolveSource(object);\n let skipObject = property(source.id, key, source.placement, path);\n skipObject ||=\n !objectIsGlobalIdentifier ||\n path.shouldSkip ||\n object.shouldSkip ||\n isRemoved(object);\n\n if (!skipObject) handleReferencedIdentifier(object);\n },\n\n ObjectPattern(path: NodePath) {\n const { parentPath, parent } = path;\n let obj;\n\n // const { keys, values } = Object\n if (parentPath.isVariableDeclarator()) {\n obj = parentPath.get(\"init\");\n // ({ keys, values } = Object)\n } else if (parentPath.isAssignmentExpression()) {\n obj = parentPath.get(\"right\");\n // !function ({ keys, values }) {...} (Object)\n // resolution does not work after properties transform :-(\n } else if (parentPath.isFunction()) {\n const grand = parentPath.parentPath;\n if (grand.isCallExpression() || grand.isNewExpression()) {\n if (grand.node.callee === parent) {\n obj = grand.get(\"arguments\")[path.key];\n }\n }\n }\n\n let id = null;\n let placement = null;\n if (obj) ({ id, placement } = resolveSource(obj));\n\n for (const prop of path.get(\"properties\")) {\n if (prop.isObjectProperty()) {\n const key = resolveKey(prop.get(\"key\"));\n if (key) property(id, key, placement, prop);\n }\n }\n },\n\n BinaryExpression(path: NodePath) {\n if (path.node.operator !== \"in\") return;\n\n const source = resolveSource(path.get(\"right\"));\n const key = resolveKey(path.get(\"left\"), true);\n\n if (!key) return;\n\n callProvider(\n {\n kind: \"in\",\n object: source.id,\n key,\n placement: source.placement,\n },\n path,\n );\n },\n };\n};\n","import type { NodePath } from \"@babel/traverse\";\nimport { types as t } from \"@babel/core\";\nimport type { CallProvider } from \"./index\";\n\nimport { getImportSource, getRequireSource } from \"../utils\";\n\nexport default (callProvider: CallProvider) => ({\n ImportDeclaration(path: NodePath) {\n const source = getImportSource(path);\n if (!source) return;\n callProvider({ kind: \"import\", source }, path);\n },\n Program(path: NodePath) {\n path.get(\"body\").forEach(bodyPath => {\n const source = getRequireSource(bodyPath);\n if (!source) return;\n callProvider({ kind: \"import\", source }, bodyPath);\n });\n },\n});\n","import path from \"path\";\nimport debounce from \"lodash.debounce\";\nimport requireResolve from \"resolve\";\n\nconst nativeRequireResolve = parseFloat(process.versions.node) >= 8.9;\n\nimport { createRequire } from \"module\";\nconst require = createRequire(import /*::(_)*/.meta.url); // eslint-disable-line\n\nfunction myResolve(name: string, basedir: string) {\n if (nativeRequireResolve) {\n return require\n .resolve(name, {\n paths: [basedir],\n })\n .replace(/\\\\/g, \"/\");\n } else {\n return requireResolve.sync(name, { basedir }).replace(/\\\\/g, \"/\");\n }\n}\n\nexport function resolve(\n dirname: string,\n moduleName: string,\n absoluteImports: boolean | string,\n): string {\n if (absoluteImports === false) return moduleName;\n\n let basedir = dirname;\n if (typeof absoluteImports === \"string\") {\n basedir = path.resolve(basedir, absoluteImports);\n }\n\n try {\n return myResolve(moduleName, basedir);\n } catch (err) {\n if (err.code !== \"MODULE_NOT_FOUND\") throw err;\n\n throw Object.assign(\n new Error(`Failed to resolve \"${moduleName}\" relative to \"${dirname}\"`),\n {\n code: \"BABEL_POLYFILL_NOT_FOUND\",\n polyfill: moduleName,\n dirname,\n },\n );\n }\n}\n\nexport function has(basedir: string, name: string) {\n try {\n myResolve(name, basedir);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function logMissing(missingDeps: Set) {\n if (missingDeps.size === 0) return;\n\n const deps = Array.from(missingDeps).sort().join(\" \");\n\n console.warn(\n \"\\nSome polyfills have been added but are not present in your dependencies.\\n\" +\n \"Please run one of the following commands:\\n\" +\n `\\tnpm install --save ${deps}\\n` +\n `\\tyarn add ${deps}\\n`,\n );\n\n process.exitCode = 1;\n}\n\nlet allMissingDeps = new Set();\n\nconst laterLogMissingDependencies = debounce(() => {\n logMissing(allMissingDeps);\n allMissingDeps = new Set();\n}, 100);\n\nexport function laterLogMissing(missingDeps: Set) {\n if (missingDeps.size === 0) return;\n\n missingDeps.forEach(name => allMissingDeps.add(name));\n laterLogMissingDependencies();\n}\n","import type {\n MetaDescriptor,\n ResolverPolyfills,\n ResolvedPolyfill,\n} from \"./types\";\n\nimport { has } from \"./utils\";\n\ntype ResolverFn = (meta: MetaDescriptor) => void | ResolvedPolyfill;\n\nconst PossibleGlobalObjects = new Set([\n \"global\",\n \"globalThis\",\n \"self\",\n \"window\",\n]);\n\nexport default function createMetaResolver(\n polyfills: ResolverPolyfills,\n): ResolverFn {\n const { static: staticP, instance: instanceP, global: globalP } = polyfills;\n\n return meta => {\n if (meta.kind === \"global\" && globalP && has(globalP, meta.name)) {\n return { kind: \"global\", desc: globalP[meta.name], name: meta.name };\n }\n\n if (meta.kind === \"property\" || meta.kind === \"in\") {\n const { placement, object, key } = meta;\n\n if (object && placement === \"static\") {\n if (globalP && PossibleGlobalObjects.has(object) && has(globalP, key)) {\n return { kind: \"global\", desc: globalP[key], name: key };\n }\n\n if (staticP && has(staticP, object) && has(staticP[object], key)) {\n return {\n kind: \"static\",\n desc: staticP[object][key],\n name: `${object}$${key}`,\n };\n }\n }\n\n if (instanceP && has(instanceP, key)) {\n return { kind: \"instance\", desc: instanceP[key], name: `${key}` };\n }\n }\n };\n}\n","import { declare } from \"@babel/helper-plugin-utils\";\nimport type { NodePath } from \"@babel/traverse\";\n\nimport _getTargets, {\n isRequired,\n getInclusionReasons,\n} from \"@babel/helper-compilation-targets\";\nconst getTargets = _getTargets.default || _getTargets;\n\nimport { createUtilsGetter } from \"./utils\";\nimport ImportsCachedInjector from \"./imports-injector\";\nimport {\n stringifyTargetsMultiline,\n presetEnvSilentDebugHeader,\n} from \"./debug-utils\";\nimport {\n validateIncludeExclude,\n applyMissingDependenciesDefaults,\n} from \"./normalize-options\";\n\nimport type {\n ProviderApi,\n MethodString,\n Targets,\n MetaDescriptor,\n PolyfillProvider,\n PluginOptions,\n ProviderOptions,\n} from \"./types\";\n\nimport * as v from \"./visitors\";\nimport * as deps from \"./node/dependencies\";\n\nimport createMetaResolver from \"./meta-resolver\";\n\nexport type { PolyfillProvider, MetaDescriptor, Utils, Targets } from \"./types\";\n\nfunction resolveOptions(\n options: PluginOptions,\n babelApi,\n): {\n method: MethodString;\n methodName: \"usageGlobal\" | \"entryGlobal\" | \"usagePure\";\n targets: Targets;\n debug: boolean | typeof presetEnvSilentDebugHeader;\n shouldInjectPolyfill:\n | ((name: string, shouldInject: boolean) => boolean)\n | undefined;\n providerOptions: ProviderOptions;\n absoluteImports: string | boolean;\n} {\n const {\n method,\n targets: targetsOption,\n ignoreBrowserslistConfig,\n configPath,\n debug,\n shouldInjectPolyfill,\n absoluteImports,\n ...providerOptions\n } = options;\n\n if (isEmpty(options)) {\n throw new Error(\n `\\\nThis plugin requires options, for example:\n {\n \"plugins\": [\n [\"\", { method: \"usage-pure\" }]\n ]\n }\n\nSee more options at https://github.com/babel/babel-polyfills/blob/main/docs/usage.md`,\n );\n }\n\n let methodName;\n if (method === \"usage-global\") methodName = \"usageGlobal\";\n else if (method === \"entry-global\") methodName = \"entryGlobal\";\n else if (method === \"usage-pure\") methodName = \"usagePure\";\n else if (typeof method !== \"string\") {\n throw new Error(\".method must be a string\");\n } else {\n throw new Error(\n `.method must be one of \"entry-global\", \"usage-global\"` +\n ` or \"usage-pure\" (received ${JSON.stringify(method)})`,\n );\n }\n\n if (typeof shouldInjectPolyfill === \"function\") {\n if (options.include || options.exclude) {\n throw new Error(\n `.include and .exclude are not supported when using the` +\n ` .shouldInjectPolyfill function.`,\n );\n }\n } else if (shouldInjectPolyfill != null) {\n throw new Error(\n `.shouldInjectPolyfill must be a function, or undefined` +\n ` (received ${JSON.stringify(shouldInjectPolyfill)})`,\n );\n }\n\n if (\n absoluteImports != null &&\n typeof absoluteImports !== \"boolean\" &&\n typeof absoluteImports !== \"string\"\n ) {\n throw new Error(\n `.absoluteImports must be a boolean, a string, or undefined` +\n ` (received ${JSON.stringify(absoluteImports)})`,\n );\n }\n\n let targets;\n\n if (\n // If any browserslist-related option is specified, fallback to the old\n // behavior of not using the targets specified in the top-level options.\n targetsOption ||\n configPath ||\n ignoreBrowserslistConfig\n ) {\n const targetsObj =\n typeof targetsOption === \"string\" || Array.isArray(targetsOption)\n ? { browsers: targetsOption }\n : targetsOption;\n\n targets = getTargets(targetsObj, {\n ignoreBrowserslistConfig,\n configPath,\n });\n } else {\n targets = babelApi.targets();\n }\n\n return {\n method,\n methodName,\n targets,\n absoluteImports: absoluteImports ?? false,\n shouldInjectPolyfill,\n debug: !!debug,\n providerOptions: providerOptions as any as ProviderOptions,\n };\n}\n\nfunction instantiateProvider(\n factory: PolyfillProvider,\n options: PluginOptions,\n missingDependencies,\n dirname,\n debugLog,\n babelApi,\n) {\n const {\n method,\n methodName,\n targets,\n debug,\n shouldInjectPolyfill,\n providerOptions,\n absoluteImports,\n } = resolveOptions(options, babelApi);\n\n // eslint-disable-next-line prefer-const\n let include, exclude;\n let polyfillsSupport;\n let polyfillsNames: Map | undefined;\n let filterPolyfills;\n\n const getUtils = createUtilsGetter(\n new ImportsCachedInjector(\n moduleName => deps.resolve(dirname, moduleName, absoluteImports),\n (name: string) => polyfillsNames?.get(name) ?? Infinity,\n ),\n );\n\n const depsCache = new Map();\n\n const api: ProviderApi = {\n babel: babelApi,\n getUtils,\n method: options.method,\n targets,\n createMetaResolver,\n shouldInjectPolyfill(name) {\n if (polyfillsNames === undefined) {\n throw new Error(\n `Internal error in the ${factory.name} provider: ` +\n `shouldInjectPolyfill() can't be called during initialization.`,\n );\n }\n if (!polyfillsNames.has(name)) {\n console.warn(\n `Internal error in the ${providerName} provider: ` +\n `unknown polyfill \"${name}\".`,\n );\n }\n\n if (filterPolyfills && !filterPolyfills(name)) return false;\n\n let shouldInject = isRequired(name, targets, {\n compatData: polyfillsSupport,\n includes: include,\n excludes: exclude,\n });\n\n if (shouldInjectPolyfill) {\n shouldInject = shouldInjectPolyfill(name, shouldInject);\n if (typeof shouldInject !== \"boolean\") {\n throw new Error(`.shouldInjectPolyfill must return a boolean.`);\n }\n }\n\n return shouldInject;\n },\n debug(name) {\n debugLog().found = true;\n\n if (!debug || !name) return;\n\n if (debugLog().polyfills.has(providerName)) return;\n debugLog().polyfills.add(name);\n debugLog().polyfillsSupport ??= polyfillsSupport;\n },\n assertDependency(name, version = \"*\") {\n if (missingDependencies === false) return;\n if (absoluteImports) {\n // If absoluteImports is not false, we will try resolving\n // the dependency and throw if it's not possible. We can\n // skip the check here.\n return;\n }\n\n const dep = version === \"*\" ? name : `${name}@^${version}`;\n\n const found = missingDependencies.all\n ? false\n : mapGetOr(depsCache, `${name} :: ${dirname}`, () =>\n deps.has(dirname, name),\n );\n\n if (!found) {\n debugLog().missingDeps.add(dep);\n }\n },\n };\n\n const provider = factory(api, providerOptions, dirname);\n const providerName = provider.name || factory.name;\n\n if (typeof provider[methodName] !== \"function\") {\n throw new Error(\n `The \"${providerName}\" provider doesn't support the \"${method}\" polyfilling method.`,\n );\n }\n\n if (Array.isArray(provider.polyfills)) {\n polyfillsNames = new Map(\n provider.polyfills.map((name, index) => [name, index]),\n );\n filterPolyfills = provider.filterPolyfills;\n } else if (provider.polyfills) {\n polyfillsNames = new Map(\n Object.keys(provider.polyfills).map((name, index) => [name, index]),\n );\n polyfillsSupport = provider.polyfills;\n filterPolyfills = provider.filterPolyfills;\n } else {\n polyfillsNames = new Map();\n }\n\n ({ include, exclude } = validateIncludeExclude(\n providerName,\n polyfillsNames,\n providerOptions.include || [],\n providerOptions.exclude || [],\n ));\n\n let callProvider: (payload: MetaDescriptor, path: NodePath) => boolean;\n if (methodName === \"usageGlobal\") {\n callProvider = (payload, path) => {\n const utils = getUtils(path);\n return (\n (provider[methodName](payload, utils, path) satisfies boolean) ?? false\n );\n };\n } else {\n callProvider = (payload, path) => {\n const utils = getUtils(path);\n provider[methodName](payload, utils, path) satisfies void;\n return false;\n };\n }\n\n return {\n debug,\n method,\n targets,\n provider,\n providerName,\n callProvider,\n };\n}\n\nexport default function definePolyfillProvider(\n factory: PolyfillProvider,\n) {\n return declare((babelApi, options: PluginOptions, dirname: string) => {\n babelApi.assertVersion(\"^7.0.0 || ^8.0.0-alpha.0\");\n const { traverse } = babelApi;\n\n let debugLog;\n\n const missingDependencies = applyMissingDependenciesDefaults(\n options,\n babelApi,\n );\n\n const { debug, method, targets, provider, providerName, callProvider } =\n instantiateProvider(\n factory,\n options,\n missingDependencies,\n dirname,\n () => debugLog,\n babelApi,\n );\n\n const createVisitor = method === \"entry-global\" ? v.entry : v.usage;\n\n const visitor = provider.visitor\n ? traverse.visitors.merge([createVisitor(callProvider), provider.visitor])\n : createVisitor(callProvider);\n\n if (debug && debug !== presetEnvSilentDebugHeader) {\n console.log(`${providerName}: \\`DEBUG\\` option`);\n console.log(`\\nUsing targets: ${stringifyTargetsMultiline(targets)}`);\n console.log(`\\nUsing polyfills with \\`${method}\\` method:`);\n }\n\n const { runtimeName } = provider;\n\n return {\n name: \"inject-polyfills\",\n visitor,\n\n pre(file) {\n if (runtimeName) {\n if (\n file.get(\"runtimeHelpersModuleName\") &&\n file.get(\"runtimeHelpersModuleName\") !== runtimeName\n ) {\n console.warn(\n `Two different polyfill providers` +\n ` (${file.get(\"runtimeHelpersModuleProvider\")}` +\n ` and ${providerName}) are trying to define two` +\n ` conflicting @babel/runtime alternatives:` +\n ` ${file.get(\"runtimeHelpersModuleName\")} and ${runtimeName}.` +\n ` The second one will be ignored.`,\n );\n } else {\n file.set(\"runtimeHelpersModuleName\", runtimeName);\n file.set(\"runtimeHelpersModuleProvider\", providerName);\n }\n }\n\n debugLog = {\n polyfills: new Set(),\n polyfillsSupport: undefined,\n found: false,\n providers: new Set(),\n missingDeps: new Set(),\n };\n\n provider.pre?.apply(this, arguments);\n },\n post() {\n provider.post?.apply(this, arguments);\n\n if (missingDependencies !== false) {\n if (missingDependencies.log === \"per-file\") {\n deps.logMissing(debugLog.missingDeps);\n } else {\n deps.laterLogMissing(debugLog.missingDeps);\n }\n }\n\n if (!debug) return;\n\n if (this.filename) console.log(`\\n[${this.filename}]`);\n\n if (debugLog.polyfills.size === 0) {\n console.log(\n method === \"entry-global\"\n ? debugLog.found\n ? `Based on your targets, the ${providerName} polyfill did not add any polyfill.`\n : `The entry point for the ${providerName} polyfill has not been found.`\n : `Based on your code and targets, the ${providerName} polyfill did not add any polyfill.`,\n );\n\n return;\n }\n\n if (method === \"entry-global\") {\n console.log(\n `The ${providerName} polyfill entry has been replaced with ` +\n `the following polyfills:`,\n );\n } else {\n console.log(\n `The ${providerName} polyfill added the following polyfills:`,\n );\n }\n\n for (const name of debugLog.polyfills) {\n if (debugLog.polyfillsSupport?.[name]) {\n const filteredTargets = getInclusionReasons(\n name,\n targets,\n debugLog.polyfillsSupport,\n );\n\n const formattedTargets = JSON.stringify(filteredTargets)\n .replace(/,/g, \", \")\n .replace(/^\\{\"/, '{ \"')\n .replace(/\"\\}$/, '\" }');\n\n console.log(` ${name} ${formattedTargets}`);\n } else {\n console.log(` ${name}`);\n }\n }\n },\n };\n });\n}\n\nfunction mapGetOr(map, key, getDefault) {\n let val = map.get(key);\n if (val === undefined) {\n val = getDefault();\n map.set(key, val);\n }\n return val;\n}\n\nfunction isEmpty(obj) {\n return Object.keys(obj).length === 0;\n}\n"],"names":["types","t","template","_babel","default","intersection","a","b","result","Set","forEach","v","has","add","object","key","Object","prototype","hasOwnProperty","call","getType","target","toString","slice","resolveId","path","isIdentifier","scope","hasBinding","node","name","isPure","deopt","evaluate","resolveKey","computed","isStringLiteral","value","parent","isMemberExpression","get","sym","resolveSource","obj","id","placement","isRegExpLiteral","isFunction","undefined","getImportSource","specifiers","length","source","getRequireSource","isExpressionStatement","expression","isCallExpression","callee","arguments","hoist","_blockHoist","createUtilsGetter","cache","prog","findParent","p","isProgram","injectGlobalImport","url","moduleName","storeAnonymous","isScript","statement","ast","importDeclaration","injectNamedImport","hint","storeNamed","generateUidIdentifier","importSpecifier","injectDefaultImport","importDefaultSpecifier","ImportsCachedInjector","constructor","resolver","getPreferredIndex","_imports","WeakMap","_anonymousImports","_lastImports","_resolver","_getPreferredIndex","programPath","getVal","_normalizeKey","imports","_ensure","sourceType","stringLiteral","_injectImport","Map","identifier","set","_this$_lastImports$ge","newIndex","lastImports","isPathStillValid","container","body","last","Infinity","i","data","entries","index","newPath","insertBefore","splice","insertAfter","push","unshiftContainer","map","Collection","collection","presetEnvSilentDebugHeader","stringifyTargetsMultiline","targets","JSON","stringify","prettifyTargets","patternToRegExp","pattern","RegExp","buildUnusedError","label","unused","original","String","join","buldDuplicatesError","duplicates","size","Array","from","validateIncludeExclude","provider","polyfills","includePatterns","excludePatterns","current","filter","regexp","matched","polyfill","keys","test","include","unusedInclude","exclude","unusedExclude","Error","applyMissingDependenciesDefaults","options","babelApi","missingDependencies","caller","log","inject","all","isRemoved","removed","parentPath","listKey","includes","callProvider","property","kind","handleReferencedIdentifier","getBindingIdentifier","ReferencedIdentifier","MemberExpression","objectIsGlobalIdentifier","binding","getBinding","isImportNamespaceSpecifier","skipObject","shouldSkip","ObjectPattern","isVariableDeclarator","isAssignmentExpression","grand","isNewExpression","prop","isObjectProperty","BinaryExpression","operator","ImportDeclaration","Program","bodyPath","nativeRequireResolve","parseFloat","process","versions","require","createRequire","import","meta","myResolve","basedir","resolve","paths","replace","requireResolve","sync","dirname","absoluteImports","err","code","assign","logMissing","missingDeps","deps","sort","console","warn","exitCode","allMissingDeps","laterLogMissingDependencies","debounce","laterLogMissing","PossibleGlobalObjects","createMetaResolver","static","staticP","instance","instanceP","global","globalP","desc","getTargets","_getTargets","resolveOptions","method","targetsOption","ignoreBrowserslistConfig","configPath","debug","shouldInjectPolyfill","providerOptions","isEmpty","methodName","targetsObj","isArray","browsers","instantiateProvider","factory","debugLog","polyfillsSupport","polyfillsNames","filterPolyfills","getUtils","_polyfillsNames$get","_polyfillsNames","depsCache","api","babel","providerName","shouldInject","isRequired","compatData","excludes","_debugLog","_debugLog$polyfillsSu","found","assertDependency","version","dep","mapGetOr","payload","_ref","utils","definePolyfillProvider","declare","assertVersion","traverse","createVisitor","visitor","visitors","merge","runtimeName","pre","file","_provider$pre","providers","apply","post","_provider$post","filename","_debugLog$polyfillsSu2","filteredTargets","getInclusionReasons","formattedTargets","getDefault","val"],"mappings":";;;;;;;;;EAASA,KAAK,EAAIC,GAAC;EAAEC,QAAQ,EAARA;AAAQ,IAAAC,MAAA,CAAAC,OAAA,IAAAD,MAAA;AAKtB,SAASE,YAAYA,CAAIC,CAAS,EAAEC,CAAS,EAAU;EAC5D,MAAMC,MAAM,GAAG,IAAIC,GAAG,EAAK;EAC3BH,CAAC,CAACI,OAAO,CAACC,CAAC,IAAIJ,CAAC,CAACK,GAAG,CAACD,CAAC,CAAC,IAAIH,MAAM,CAACK,GAAG,CAACF,CAA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