full.js.map 27 KB

1
  1. {"version":3,"names":["_gensync","data","require","_async","_util","context","_plugin","_item","_configChain","_deepArray","_traverse","_caching","_options","_plugins","_configApi","_partial","_configError","_default","exports","default","gensync","loadFullConfig","inputOpts","_opts$assumptions","result","loadPrivatePartialConfig","options","fileHandling","optionDefaults","plugins","presets","Error","presetContext","Object","assign","targets","toDescriptor","item","desc","getItemDescriptor","presetsDescriptors","map","initialPluginsDescriptors","pluginDescriptorsByPass","passes","externalDependencies","ignored","enhanceError","recursePresetDescriptors","rawPresets","pluginDescriptorsPass","i","length","descriptor","preset","loadPresetDescriptor","e","code","checkNoUnwrappedItemOptionPairs","push","ownPass","chain","pass","unshift","splice","o","filter","p","forEach","opts","mergeOptions","pluginContext","assumptions","loadPluginDescriptors","descs","plugin","loadPluginDescriptor","slice","passPerPreset","freezeDeepArray","fn","arg1","arg2","test","message","_context$filename","filename","makeDescriptorLoader","apiFactory","makeWeakCache","value","dirname","alias","cache","factory","maybeAsync","api","JSON","stringify","isThenable","configured","mode","error","pluginDescriptorLoader","makePluginAPI","presetDescriptorLoader","makePresetAPI","instantiatePlugin","pluginObj","validatePluginObject","visitor","traverse","explode","inherits","inheritsDescriptor","name","undefined","forwardAsync","run","invalidate","pre","chainMaybeAsync","post","manipulateOptions","visitors","merge","Plugin","needsFilename","val","validateIfOptionNeedsFilename","include","exclude","formattedPresetName","ConfigError","join","validatePreset","_options$overrides","overrides","overrideOptions","instantiatePreset","makeWeakCacheSync","validate","buildPresetChain","a","b","args","res","apply","then"],"sources":["../../src/config/full.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\nimport {\n forwardAsync,\n maybeAsync,\n isThenable,\n} from \"../gensync-utils/async.ts\";\n\nimport { mergeOptions } from \"./util.ts\";\nimport * as context from \"../index.ts\";\nimport Plugin from \"./plugin.ts\";\nimport { getItemDescriptor } from \"./item.ts\";\nimport { buildPresetChain } from \"./config-chain.ts\";\nimport { finalize as freezeDeepArray } from \"./helpers/deep-array.ts\";\nimport type { DeepArray, ReadonlyDeepArray } from \"./helpers/deep-array.ts\";\nimport type {\n ConfigContext,\n ConfigChain,\n PresetInstance,\n} from \"./config-chain.ts\";\nimport type { UnloadedDescriptor } from \"./config-descriptors.ts\";\nimport traverse from \"@babel/traverse\";\nimport { makeWeakCache, makeWeakCacheSync } from \"./caching.ts\";\nimport type { CacheConfigurator } from \"./caching.ts\";\nimport {\n validate,\n checkNoUnwrappedItemOptionPairs,\n} from \"./validation/options.ts\";\nimport type { InputOptions, PluginItem } from \"./validation/options.ts\";\nimport { validatePluginObject } from \"./validation/plugins.ts\";\nimport { makePluginAPI, makePresetAPI } from \"./helpers/config-api.ts\";\nimport type { PluginAPI, PresetAPI } from \"./helpers/config-api.ts\";\n\nimport loadPrivatePartialConfig from \"./partial.ts\";\nimport type { ValidatedOptions } from \"./validation/options.ts\";\n\nimport type * as Context from \"./cache-contexts.ts\";\nimport ConfigError from \"../errors/config-error.ts\";\n\ntype LoadedDescriptor = {\n value: any;\n options: object;\n dirname: string;\n alias: string;\n externalDependencies: ReadonlyDeepArray<string>;\n};\n\nexport type { InputOptions } from \"./validation/options.ts\";\n\nexport type ResolvedConfig = {\n options: any;\n passes: PluginPasses;\n externalDependencies: ReadonlyDeepArray<string>;\n};\n\nexport type { Plugin };\nexport type PluginPassList = Array<Plugin>;\nexport type PluginPasses = Array<PluginPassList>;\n\nexport default gensync(function* loadFullConfig(\n inputOpts: InputOptions,\n): Handler<ResolvedConfig | null> {\n const result = yield* loadPrivatePartialConfig(inputOpts);\n if (!result) {\n return null;\n }\n const { options, context, fileHandling } = result;\n\n if (fileHandling === \"ignored\") {\n return null;\n }\n\n const optionDefaults: ValidatedOptions = {};\n\n const { plugins, presets } = options;\n\n if (!plugins || !presets) {\n throw new Error(\"Assertion failure - plugins and presets exist\");\n }\n\n const presetContext: Context.FullPreset = {\n ...context,\n targets: options.targets,\n };\n\n const toDescriptor = (item: PluginItem) => {\n const desc = getItemDescriptor(item);\n if (!desc) {\n throw new Error(\"Assertion failure - must be config item\");\n }\n\n return desc;\n };\n\n const presetsDescriptors = presets.map(toDescriptor);\n const initialPluginsDescriptors = plugins.map(toDescriptor);\n const pluginDescriptorsByPass: Array<Array<UnloadedDescriptor<PluginAPI>>> = [\n [],\n ];\n const passes: Array<Array<Plugin>> = [];\n\n const externalDependencies: DeepArray<string> = [];\n\n const ignored = yield* enhanceError(\n context,\n function* recursePresetDescriptors(\n rawPresets: Array<UnloadedDescriptor<PresetAPI>>,\n pluginDescriptorsPass: Array<UnloadedDescriptor<PluginAPI>>,\n ): Handler<true | void> {\n const presets: Array<{\n preset: ConfigChain | null;\n pass: Array<UnloadedDescriptor<PluginAPI>>;\n }> = [];\n\n for (let i = 0; i < rawPresets.length; i++) {\n const descriptor = rawPresets[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var preset = yield* loadPresetDescriptor(descriptor, presetContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_OPTION\") {\n checkNoUnwrappedItemOptionPairs(rawPresets, i, \"preset\", e);\n }\n throw e;\n }\n\n externalDependencies.push(preset.externalDependencies);\n\n // Presets normally run in reverse order, but if they\n // have their own pass they run after the presets\n // in the previous pass.\n if (descriptor.ownPass) {\n presets.push({ preset: preset.chain, pass: [] });\n } else {\n presets.unshift({\n preset: preset.chain,\n pass: pluginDescriptorsPass,\n });\n }\n }\n }\n\n // resolve presets\n if (presets.length > 0) {\n // The passes are created in the same order as the preset list, but are inserted before any\n // existing additional passes.\n pluginDescriptorsByPass.splice(\n 1,\n 0,\n ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass),\n );\n\n for (const { preset, pass } of presets) {\n if (!preset) return true;\n\n pass.push(...preset.plugins);\n\n const ignored = yield* recursePresetDescriptors(preset.presets, pass);\n if (ignored) return true;\n\n preset.options.forEach(opts => {\n mergeOptions(optionDefaults, opts);\n });\n }\n }\n },\n )(presetsDescriptors, pluginDescriptorsByPass[0]);\n\n if (ignored) return null;\n\n const opts: ValidatedOptions = optionDefaults;\n mergeOptions(opts, options);\n\n const pluginContext: Context.FullPlugin = {\n ...presetContext,\n assumptions: opts.assumptions ?? {},\n };\n\n yield* enhanceError(context, function* loadPluginDescriptors() {\n pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors);\n\n for (const descs of pluginDescriptorsByPass) {\n const pass: Plugin[] = [];\n passes.push(pass);\n\n for (let i = 0; i < descs.length; i++) {\n const descriptor = descs[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var plugin = yield* loadPluginDescriptor(descriptor, pluginContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_PLUGIN_PROPERTY\") {\n // print special message for `plugins: [\"@babel/foo\", { foo: \"option\" }]`\n checkNoUnwrappedItemOptionPairs(descs, i, \"plugin\", e);\n }\n throw e;\n }\n pass.push(plugin);\n\n externalDependencies.push(plugin.externalDependencies);\n }\n }\n }\n })();\n\n opts.plugins = passes[0];\n opts.presets = passes\n .slice(1)\n .filter(plugins => plugins.length > 0)\n .map(plugins => ({ plugins }));\n opts.passPerPreset = opts.presets.length > 0;\n\n return {\n options: opts,\n passes: passes,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n});\n\nfunction enhanceError<T extends Function>(context: ConfigContext, fn: T): T {\n return function* (arg1: unknown, arg2: unknown) {\n try {\n return yield* fn(arg1, arg2);\n } catch (e) {\n // There are a few case where thrown errors will try to annotate themselves multiple times, so\n // to keep things simple we just bail out if re-wrapping the message.\n if (!/^\\[BABEL\\]/.test(e.message)) {\n e.message = `[BABEL] ${context.filename ?? \"unknown file\"}: ${\n e.message\n }`;\n }\n\n throw e;\n }\n } as any;\n}\n\n/**\n * Load a generic plugin/preset from the given descriptor loaded from the config object.\n */\nconst makeDescriptorLoader = <Context, API>(\n apiFactory: (\n cache: CacheConfigurator<Context>,\n externalDependencies: Array<string>,\n ) => API,\n) =>\n makeWeakCache(function* (\n { value, options, dirname, alias }: UnloadedDescriptor<API>,\n cache: CacheConfigurator<Context>,\n ): Handler<LoadedDescriptor> {\n // Disabled presets should already have been filtered out\n if (options === false) throw new Error(\"Assertion failure\");\n\n options = options || {};\n\n const externalDependencies: Array<string> = [];\n\n let item: unknown = value;\n if (typeof value === \"function\") {\n const factory = maybeAsync(\n value as (api: API, options: object, dirname: string) => unknown,\n `You appear to be using an async plugin/preset, but Babel has been called synchronously`,\n );\n\n const api = {\n ...context,\n ...apiFactory(cache, externalDependencies),\n };\n try {\n item = yield* factory(api, options, dirname);\n } catch (e) {\n if (alias) {\n e.message += ` (While processing: ${JSON.stringify(alias)})`;\n }\n throw e;\n }\n }\n\n if (!item || typeof item !== \"object\") {\n throw new Error(\"Plugin/Preset did not return an object.\");\n }\n\n if (isThenable(item)) {\n // if we want to support async plugins\n yield* [];\n\n throw new Error(\n `You appear to be using a promise as a plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, ` +\n `you may need to upgrade your @babel/core version. ` +\n `As an alternative, you can prefix the promise with \"await\". ` +\n `(While processing: ${JSON.stringify(alias)})`,\n );\n }\n\n if (\n externalDependencies.length > 0 &&\n (!cache.configured() || cache.mode() === \"forever\")\n ) {\n let error =\n `A plugin/preset has external untracked dependencies ` +\n `(${externalDependencies[0]}), but the cache `;\n if (!cache.configured()) {\n error += `has not been configured to be invalidated when the external dependencies change. `;\n } else {\n error += ` has been configured to never be invalidated. `;\n }\n error +=\n `Plugins/presets should configure their cache to be invalidated when the external ` +\n `dependencies change, for example using \\`api.cache.invalidate(() => ` +\n `statSync(filepath).mtimeMs)\\` or \\`api.cache.never()\\`\\n` +\n `(While processing: ${JSON.stringify(alias)})`;\n\n throw new Error(error);\n }\n\n return {\n value: item,\n options,\n dirname,\n alias,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n });\n\nconst pluginDescriptorLoader = makeDescriptorLoader<\n Context.SimplePlugin,\n PluginAPI\n>(makePluginAPI);\nconst presetDescriptorLoader = makeDescriptorLoader<\n Context.SimplePreset,\n PresetAPI\n>(makePresetAPI);\n\nconst instantiatePlugin = makeWeakCache(function* (\n { value, options, dirname, alias, externalDependencies }: LoadedDescriptor,\n cache: CacheConfigurator<Context.SimplePlugin>,\n): Handler<Plugin> {\n const pluginObj = validatePluginObject(value);\n\n const plugin = {\n ...pluginObj,\n };\n if (plugin.visitor) {\n plugin.visitor = traverse.explode({\n ...plugin.visitor,\n });\n }\n\n if (plugin.inherits) {\n const inheritsDescriptor: UnloadedDescriptor<PluginAPI> = {\n name: undefined,\n alias: `${alias}$inherits`,\n value: plugin.inherits,\n options,\n dirname,\n };\n\n const inherits = yield* forwardAsync(loadPluginDescriptor, run => {\n // If the inherited plugin changes, reinstantiate this plugin.\n return cache.invalidate(data => run(inheritsDescriptor, data));\n });\n\n plugin.pre = chainMaybeAsync(inherits.pre, plugin.pre);\n plugin.post = chainMaybeAsync(inherits.post, plugin.post);\n plugin.manipulateOptions = chainMaybeAsync(\n inherits.manipulateOptions,\n plugin.manipulateOptions,\n );\n plugin.visitor = traverse.visitors.merge([\n inherits.visitor || {},\n plugin.visitor || {},\n ]);\n\n if (inherits.externalDependencies.length > 0) {\n if (externalDependencies.length === 0) {\n externalDependencies = inherits.externalDependencies;\n } else {\n externalDependencies = freezeDeepArray([\n externalDependencies,\n inherits.externalDependencies,\n ]);\n }\n }\n }\n\n return new Plugin(plugin, options, alias, externalDependencies);\n});\n\n/**\n * Instantiate a plugin for the given descriptor, returning the plugin/options pair.\n */\nfunction* loadPluginDescriptor(\n descriptor: UnloadedDescriptor<PluginAPI>,\n context: Context.SimplePlugin,\n): Handler<Plugin> {\n if (descriptor.value instanceof Plugin) {\n if (descriptor.options) {\n throw new Error(\n \"Passed options to an existing Plugin instance will not work.\",\n );\n }\n\n return descriptor.value;\n }\n\n return yield* instantiatePlugin(\n yield* pluginDescriptorLoader(descriptor, context),\n context,\n );\n}\n\nconst needsFilename = (val: unknown) => val && typeof val !== \"function\";\n\nconst validateIfOptionNeedsFilename = (\n options: ValidatedOptions,\n descriptor: UnloadedDescriptor<PresetAPI>,\n): void => {\n if (\n needsFilename(options.test) ||\n needsFilename(options.include) ||\n needsFilename(options.exclude)\n ) {\n const formattedPresetName = descriptor.name\n ? `\"${descriptor.name}\"`\n : \"/* your preset */\";\n throw new ConfigError(\n [\n `Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`,\n `\\`\\`\\``,\n `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`,\n `\\`\\`\\``,\n `See https://babeljs.io/docs/en/options#filename for more information.`,\n ].join(\"\\n\"),\n );\n }\n};\n\nconst validatePreset = (\n preset: PresetInstance,\n context: ConfigContext,\n descriptor: UnloadedDescriptor<PresetAPI>,\n): void => {\n if (!context.filename) {\n const { options } = preset;\n validateIfOptionNeedsFilename(options, descriptor);\n options.overrides?.forEach(overrideOptions =>\n validateIfOptionNeedsFilename(overrideOptions, descriptor),\n );\n }\n};\n\nconst instantiatePreset = makeWeakCacheSync(\n ({\n value,\n dirname,\n alias,\n externalDependencies,\n }: LoadedDescriptor): PresetInstance => {\n return {\n options: validate(\"preset\", value),\n alias,\n dirname,\n externalDependencies,\n };\n },\n);\n\n/**\n * Generate a config object that will act as the root of a new nested config.\n */\nfunction* loadPresetDescriptor(\n descriptor: UnloadedDescriptor<PresetAPI>,\n context: Context.FullPreset,\n): Handler<{\n chain: ConfigChain | null;\n externalDependencies: ReadonlyDeepArray<string>;\n}> {\n const preset = instantiatePreset(\n yield* presetDescriptorLoader(descriptor, context),\n );\n validatePreset(preset, context, descriptor);\n return {\n chain: yield* buildPresetChain(preset, context),\n externalDependencies: preset.externalDependencies,\n };\n}\n\nfunction chainMaybeAsync<Args extends any[], R extends void | Promise<void>>(\n a: undefined | ((...args: Args) => R),\n b: undefined | ((...args: Args) => R),\n): (...args: Args) => R {\n if (!a) return b;\n if (!b) return a;\n\n return function (this: unknown, ...args: Args) {\n const res = a.apply(this, args);\n if (res && typeof res.then === \"function\") {\n return res.then(() => b.apply(this, args));\n }\n return b.apply(this, args);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