mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Prior to this commit, functions that issued warnings were not wrapped with `ngDevMode` at the point of invocation but had the `ngDevMode` check inside. This meant they acted as no-ops in production. In this commit, we wrap them externally with `ngDevMode`, so they are entirely removed. PR Close #59408
45 lines
1.4 KiB
TypeScript
45 lines
1.4 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.dev/license
|
|
*/
|
|
|
|
function createListOfWarnings(warnings: string[]): string {
|
|
const LINE_START = '\n - ';
|
|
return `${LINE_START}${warnings
|
|
.filter(Boolean)
|
|
.map((warning) => warning)
|
|
.join(LINE_START)}`;
|
|
}
|
|
|
|
export function warnValidation(warnings: string[]): void {
|
|
console.warn(`animation validation warnings:${createListOfWarnings(warnings)}`);
|
|
}
|
|
|
|
export function warnTriggerBuild(name: string, warnings: string[]): void {
|
|
console.warn(
|
|
`The animation trigger "${name}" has built with the following warnings:${createListOfWarnings(
|
|
warnings,
|
|
)}`,
|
|
);
|
|
}
|
|
|
|
export function warnRegister(warnings: string[]): void {
|
|
console.warn(`Animation built with the following warnings:${createListOfWarnings(warnings)}`);
|
|
}
|
|
|
|
export function triggerParsingWarnings(name: string, warnings: string[]): void {
|
|
console.warn(
|
|
`Animation parsing for the ${name} trigger presents the following warnings:${createListOfWarnings(
|
|
warnings,
|
|
)}`,
|
|
);
|
|
}
|
|
|
|
export function pushUnrecognizedPropertiesWarning(warnings: string[], props: string[]): void {
|
|
if (props.length) {
|
|
warnings.push(`The following provided properties are not recognized: ${props.join(', ')}`);
|
|
}
|
|
}
|