( environments: Record<string, EnvironmentOptions>, plugins: Plugin[], logger: Logger, configEnv: ConfigEnv, isSsrTargetWebworkerSet: boolean, )
| 2733 | } |
| 2734 | |
| 2735 | async function runConfigEnvironmentHook( |
| 2736 | environments: Record<string, EnvironmentOptions>, |
| 2737 | plugins: Plugin[], |
| 2738 | logger: Logger, |
| 2739 | configEnv: ConfigEnv, |
| 2740 | isSsrTargetWebworkerSet: boolean, |
| 2741 | ): Promise<void> { |
| 2742 | const context = new BasicMinimalPluginContext< |
| 2743 | Omit<PluginContextMeta, 'watchMode'> |
| 2744 | >(basePluginContextMeta, logger) |
| 2745 | |
| 2746 | const environmentNames = Object.keys(environments) |
| 2747 | for (const p of getSortedPluginsByHook('configEnvironment', plugins)) { |
| 2748 | const hook = p.configEnvironment |
| 2749 | const handler = getHookHandler(hook) |
| 2750 | for (const name of environmentNames) { |
| 2751 | const res = await handler.call(context, name, environments[name], { |
| 2752 | ...configEnv, |
| 2753 | isSsrTargetWebworker: isSsrTargetWebworkerSet && name === 'ssr', |
| 2754 | }) |
| 2755 | if (res) { |
| 2756 | environments[name] = mergeConfig(environments[name], res) |
| 2757 | } |
| 2758 | } |
| 2759 | } |
| 2760 | } |
| 2761 | |
| 2762 | function optimizeDepsDisabledBackwardCompatibility( |
| 2763 | resolved: ResolvedConfig, |
no test coverage detected