diff --git a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/builder-status-warnings.ts b/packages/angular_devkit/build_angular/src/builders/browser-esbuild/builder-status-warnings.ts deleted file mode 100644 index d5fc1342dd14..000000000000 --- a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/builder-status-warnings.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -import { BuilderContext } from '@angular-devkit/architect'; -import { Schema as BrowserBuilderOptions } from './schema'; - -const UNSUPPORTED_OPTIONS: Array = [ - // * Always enabled with esbuild - // 'commonChunk', - - // * Unused by builder and will be removed in a future release - 'vendorChunk', - 'resourcesOutputPath', - - // * Currently unsupported by esbuild - 'webWorkerTsConfig', -]; - -export function logBuilderStatusWarnings( - options: BrowserBuilderOptions, - { logger }: BuilderContext, -) { - // Validate supported options - for (const unsupportedOption of UNSUPPORTED_OPTIONS) { - const value = (options as unknown as BrowserBuilderOptions)[unsupportedOption]; - - if (value === undefined || value === false) { - continue; - } - if (Array.isArray(value) && value.length === 0) { - continue; - } - if (typeof value === 'object' && Object.keys(value).length === 0) { - continue; - } - - if (unsupportedOption === 'vendorChunk' || unsupportedOption === 'resourcesOutputPath') { - logger.warn( - `The '${unsupportedOption}' option is not used by this builder and will be ignored.`, - ); - continue; - } - - logger.warn(`The '${unsupportedOption}' option is not yet supported by this builder.`); - } -} diff --git a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/index.ts b/packages/angular_devkit/build_angular/src/builders/browser-esbuild/index.ts index 6fcc8feb1535..dd91944b55b8 100644 --- a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/index.ts +++ b/packages/angular_devkit/build_angular/src/builders/browser-esbuild/index.ts @@ -9,7 +9,6 @@ import { type ApplicationBuilderOptions, buildApplication } from '@angular/build'; import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect'; import type { Plugin } from 'esbuild'; -import { logBuilderStatusWarnings } from './builder-status-warnings'; import type { Schema as BrowserBuilderOptions } from './schema'; export type { BrowserBuilderOptions }; @@ -31,10 +30,25 @@ export async function* buildEsbuildBrowser( }, plugins?: Plugin[], ): AsyncIterable { - // Inform user of status of builder and options - logBuilderStatusWarnings(userOptions, context); + // Warn about any unsupported options + if (userOptions['vendorChunk']) { + context.logger.warn( + `The 'vendorChunk' option is not used by this builder and will be ignored.`, + ); + } + if (userOptions['commonChunk'] === false) { + context.logger.warn( + `The 'commonChunk' option is always enabled by this builder and will be ignored.`, + ); + } + if (userOptions['webWorkerTsConfig']) { + context.logger.warn(`The 'webWorkerTsConfig' option is not yet supported by this builder.`); + } + // Convert browser builder options to application builder options const normalizedOptions = convertBrowserOptions(userOptions); + + // Execute the application builder yield* buildApplication(normalizedOptions, context, { codePlugins: plugins }); }