amis-rpc-design/node_modules/@babel/plugin-transform-runtime/lib/polyfills.js.map

1 line
7.0 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"names":["_babelPluginPolyfillCorejs","require","_babelPluginPolyfillCorejs2","_babelPluginPolyfillRegenerator","pluginCorejs2","_pluginCorejs2","default","pluginCorejs3","_pluginCorejs3","pluginRegenerator","_pluginRegenerator","pluginsCompat","createCorejsPlugin","plugin","options","regeneratorPlugin","api","_","filename","Object","assign","inherits","createRegeneratorPlugin","useRuntimeRegenerator","undefined","createBasePolyfillsPlugin","corejs","regenerator","runtimeVersion","absoluteImports","proposals","rawVersion","version","Boolean","corejsVersion","Number","includes","Error","JSON","stringify","polyfillOpts","method","useBabelRuntime","ext"],"sources":["../src/polyfills.ts"],"sourcesContent":["// TODO(Babel 8): Remove at least support for babel-plugin-polyfill-regenerator,\n// which isn't needed anymore, and babel-plugin-polyfill-corejs2, since core-js\n// 2 isn't maintained anymore.\n// Consider also removing babel-plugin-polyfill-corejs3 from here, and ask users\n// to explicitly enable it in their Babel configuration files.\n\nimport type { PluginAPI, PluginObject } from \"@babel/core\";\nimport _pluginCorejs2 from \"babel-plugin-polyfill-corejs2\";\nimport _pluginCorejs3 from \"babel-plugin-polyfill-corejs3\";\nimport _pluginRegenerator from \"babel-plugin-polyfill-regenerator\";\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst pluginCorejs2 = (_pluginCorejs2.default ||\n _pluginCorejs2) as typeof _pluginCorejs2.default;\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst pluginCorejs3 = (_pluginCorejs3.default ||\n _pluginCorejs3) as typeof _pluginCorejs3.default;\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst pluginRegenerator = (_pluginRegenerator.default ||\n _pluginRegenerator) as typeof _pluginRegenerator.default;\n\nimport type { Options } from \"./index.ts\";\n\nconst pluginsCompat = \"#__secret_key__@babel/runtime__compatibility\";\n\ninterface CoreJS2PluginOptions {\n absoluteImports: boolean;\n method: \"usage-pure\";\n [pluginsCompat]: {\n runtimeVersion: string;\n useBabelRuntime: boolean;\n ext: string;\n };\n}\n\ninterface RegeneratorPluginOptions {\n absoluteImports: boolean;\n method: \"usage-pure\";\n [pluginsCompat]: {\n useBabelRuntime: boolean;\n };\n}\n\ninterface CoreJS3PluginOptions {\n absoluteImports: boolean;\n method: \"usage-pure\";\n proposals: boolean;\n version: number;\n [pluginsCompat]: {\n useBabelRuntime: boolean;\n ext: string;\n };\n}\n\nfunction createCorejsPlugin<Options extends {}>(\n plugin: (api: PluginAPI, options: Options, filename: string) => PluginObject,\n options: Options,\n regeneratorPlugin: (\n api: PluginAPI,\n options: RegeneratorPluginOptions,\n filename: string,\n ) => PluginObject,\n): (api: PluginAPI, options: {}, filename: string) => PluginObject {\n return (api: PluginAPI, _: {}, filename: string) => {\n return {\n ...plugin(api, options, filename),\n inherits: regeneratorPlugin,\n };\n };\n}\n\nfunction createRegeneratorPlugin(\n options: RegeneratorPluginOptions,\n useRuntimeRegenerator: boolean,\n): (\n api: PluginAPI,\n options: RegeneratorPluginOptions,\n filename: string,\n) => PluginObject {\n if (!useRuntimeRegenerator) return undefined;\n return (api, _, filename) => {\n return pluginRegenerator(api, options, filename);\n };\n}\n\nexport function createBasePolyfillsPlugin(\n { corejs, regenerator: useRuntimeRegenerator = true }: Options,\n runtimeVersion: string,\n absoluteImports: boolean,\n) {\n let proposals = false;\n let rawVersion;\n\n if (typeof corejs === \"object\" && corejs !== null) {\n rawVersion = corejs.version;\n proposals = Boolean(corejs.proposals);\n } else {\n rawVersion = corejs;\n }\n\n const corejsVersion = rawVersion ? Number(rawVersion) : false;\n\n if (![false, 2, 3].includes(corejsVersion)) {\n throw new Error(\n `The \\`core-js\\` version must be false, 2 or 3, but got ${JSON.stringify(\n