( config: InlineConfig, plugins: Plugin[], configEnv: ConfigEnv, )
| 2688 | } |
| 2689 | |
| 2690 | async function runConfigHook( |
| 2691 | config: InlineConfig, |
| 2692 | plugins: Plugin[], |
| 2693 | configEnv: ConfigEnv, |
| 2694 | ): Promise<InlineConfig> { |
| 2695 | let conf = config |
| 2696 | |
| 2697 | const tempLogger = createLogger(config.logLevel, { |
| 2698 | allowClearScreen: config.clearScreen, |
| 2699 | customLogger: config.customLogger, |
| 2700 | }) |
| 2701 | const context = new BasicMinimalPluginContext< |
| 2702 | Omit<PluginContextMeta, 'watchMode'> |
| 2703 | >(basePluginContextMeta, tempLogger) |
| 2704 | |
| 2705 | for (const p of getSortedPluginsByHook('config', plugins)) { |
| 2706 | const hook = p.config |
| 2707 | const handler = getHookHandler(hook) |
| 2708 | const res = await handler.call(context, conf, configEnv) |
| 2709 | if (res && res !== conf) { |
| 2710 | if (hasBothRollupOptionsAndRolldownOptions(res)) { |
| 2711 | context.warn( |
| 2712 | `Both \`rollupOptions\` and \`rolldownOptions\` were specified by ${JSON.stringify(p.name)} plugin. ` + |
| 2713 | `\`rollupOptions\` specified by that plugin will be ignored.`, |
| 2714 | ) |
| 2715 | } |
| 2716 | if (res.esbuild) { |
| 2717 | context.warn( |
| 2718 | `\`esbuild\` option was specified by ${JSON.stringify(p.name)} plugin. ` + |
| 2719 | `This option is deprecated, please use \`oxc\` instead.`, |
| 2720 | ) |
| 2721 | } |
| 2722 | if (res.optimizeDeps?.esbuildOptions) { |
| 2723 | context.warn( |
| 2724 | `\`optimizeDeps.esbuildOptions\` option was specified by ${JSON.stringify(p.name)} plugin. ` + |
| 2725 | `This option is deprecated, please use \`optimizeDeps.rolldownOptions\` instead.`, |
| 2726 | ) |
| 2727 | } |
| 2728 | conf = mergeConfig(conf, res) |
| 2729 | } |
| 2730 | } |
| 2731 | |
| 2732 | return conf |
| 2733 | } |
| 2734 | |
| 2735 | async function runConfigEnvironmentHook( |
| 2736 | environments: Record<string, EnvironmentOptions>, |
no test coverage detected