Alan Agius 3bb48c1c88 refactor(@angular-devkit/build-angular): remove resourcesOutputPath option from application builder.
This `resourcesOutputPath` option is removed from the application builder. Instead the CSS resources will always be emitted in a directory named `media`. This is preparation to output server and browser bundles in different directories.
2023-07-06 09:36:02 -07:00

71 lines
2.0 KiB
TypeScript

/**
* @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.io/license
*/
import { BuilderContext } from '@angular-devkit/architect';
import { Schema as BrowserBuilderOptions } from '../browser/schema';
const UNSUPPORTED_OPTIONS: Array<keyof BrowserBuilderOptions> = [
'budgets',
// * i18n support
'localize',
// The following two have no effect when localize is not enabled
// 'i18nDuplicateTranslation',
// 'i18nMissingTranslation',
// * Deprecated
'deployUrl',
// * Always enabled with esbuild
// 'commonChunk',
// * Unused by builder and will be removed in a future release
'namedChunks',
'vendorChunk',
// * Currently unsupported by esbuild
'webWorkerTsConfig',
];
export function logBuilderStatusWarnings(options: BrowserBuilderOptions, context: BuilderContext) {
context.logger.warn(
`The esbuild-based browser application builder ('browser-esbuild') is currently in developer preview` +
' and is not yet recommended for production use.' +
' For additional information, please see https://angular.io/guide/esbuild',
);
// 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 === 'namedChunks' ||
unsupportedOption === 'vendorChunk' ||
unsupportedOption === 'resourcesOutputPath' ||
unsupportedOption === 'deployUrl'
) {
context.logger.warn(
`The '${unsupportedOption}' option is not used by this builder and will be ignored.`,
);
continue;
}
context.logger.warn(`The '${unsupportedOption}' option is not yet supported by this builder.`);
}
}