@angular-devkit/build-angular 20.0.0-rc.1 → 20.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "20.0.0-rc.1",
3
+ "version": "20.0.0-rc.3",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "2.3.0",
10
- "@angular-devkit/architect": "0.2000.0-rc.1",
11
- "@angular-devkit/build-webpack": "0.2000.0-rc.1",
12
- "@angular-devkit/core": "20.0.0-rc.1",
13
- "@angular/build": "20.0.0-rc.1",
10
+ "@angular-devkit/architect": "0.2000.0-rc.3",
11
+ "@angular-devkit/build-webpack": "0.2000.0-rc.3",
12
+ "@angular-devkit/core": "20.0.0-rc.3",
13
+ "@angular/build": "20.0.0-rc.3",
14
14
  "@babel/core": "7.27.1",
15
15
  "@babel/generator": "7.27.1",
16
16
  "@babel/helper-annotate-as-pure": "7.27.1",
@@ -21,7 +21,7 @@
21
21
  "@babel/preset-env": "7.27.2",
22
22
  "@babel/runtime": "7.27.1",
23
23
  "@discoveryjs/json-ext": "0.6.3",
24
- "@ngtools/webpack": "20.0.0-rc.1",
24
+ "@ngtools/webpack": "20.0.0-rc.3",
25
25
  "@vitejs/plugin-basic-ssl": "2.0.0",
26
26
  "ansi-colors": "4.1.3",
27
27
  "autoprefixer": "10.4.21",
@@ -72,7 +72,7 @@
72
72
  "@angular/platform-browser": "^20.0.0 || ^20.0.0-next.0",
73
73
  "@angular/platform-server": "^20.0.0 || ^20.0.0-next.0",
74
74
  "@angular/service-worker": "^20.0.0 || ^20.0.0-next.0",
75
- "@angular/ssr": "^20.0.0-rc.1",
75
+ "@angular/ssr": "^20.0.0-rc.3",
76
76
  "@web/test-runner": "^0.20.0",
77
77
  "browser-sync": "^3.0.2",
78
78
  "jest": "^29.5.0",
@@ -140,7 +140,7 @@
140
140
  },
141
141
  "packageManager": "pnpm@9.15.9",
142
142
  "engines": {
143
- "node": "^20.11.1 || ^22.11.0 || >=24.0.0",
143
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
144
144
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
145
145
  "yarn": ">= 1.13.0"
146
146
  },
@@ -115,13 +115,20 @@ async function execute(options, context, transforms) {
115
115
  return node_path_1.default.relative(from, to);
116
116
  },
117
117
  };
118
+ const duplicateTranslationBehavior = normalizedOptions.i18nOptions.duplicateTranslationBehavior;
118
119
  const diagnostics = checkDuplicateMessages(
119
120
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
120
- checkFileSystem, extractionResult.messages, 'warning',
121
+ checkFileSystem, extractionResult.messages, duplicateTranslationBehavior,
121
122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
123
  extractionResult.basePath);
123
- if (diagnostics.messages.length > 0) {
124
- context.logger.warn(diagnostics.formatDiagnostics(''));
124
+ if (diagnostics.messages.length > 0 && duplicateTranslationBehavior !== 'ignore') {
125
+ if (duplicateTranslationBehavior === 'error') {
126
+ context.logger.error(`Extraction Failed: ${diagnostics.formatDiagnostics('')}`);
127
+ return { success: false };
128
+ }
129
+ else {
130
+ context.logger.warn(diagnostics.formatDiagnostics(''));
131
+ }
125
132
  }
126
133
  // Serialize all extracted messages
127
134
  const serializer = await createSerializer(localizeToolsModule, normalizedOptions.format, normalizedOptions.i18nOptions.sourceLocale, extractionResult.basePath, extractionResult.useLegacyIds, diagnostics);
@@ -5,6 +5,8 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
+ import { type I18nOptions } from '@angular/build/private';
9
+ import { type DiagnosticHandlingStrategy } from '@angular/localize/tools';
8
10
  import { BuilderContext } from '@angular-devkit/architect';
9
11
  import { Schema as ExtractI18nOptions, Format } from './schema';
10
12
  export type NormalizedExtractI18nOptions = Awaited<ReturnType<typeof normalizeOptions>>;
@@ -22,7 +24,9 @@ export declare function normalizeOptions(context: BuilderContext, projectName: s
22
24
  workspaceRoot: string;
23
25
  projectRoot: string;
24
26
  buildTarget: import("@angular-devkit/architect").Target;
25
- i18nOptions: import("@angular/build/private").I18nOptions;
27
+ i18nOptions: I18nOptions & {
28
+ duplicateTranslationBehavior: DiagnosticHandlingStrategy;
29
+ };
26
30
  format: Format.Arb | Format.Json | Format.LegacyMigrate | Format.Xliff | Format.Xliff2 | Format.Xmb;
27
31
  outFile: string;
28
32
  progress: boolean;
@@ -33,7 +33,10 @@ async function normalizeOptions(context, projectName, options) {
33
33
  // Target specifier defaults to the current project's build target with no specified configuration
34
34
  const buildTargetSpecifier = options.buildTarget ?? ':';
35
35
  const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
36
- const i18nOptions = (0, private_1.createI18nOptions)(projectMetadata, /** inline */ false, context.logger);
36
+ const i18nOptions = {
37
+ ...(0, private_1.createI18nOptions)(projectMetadata, /** inline */ false, context.logger),
38
+ duplicateTranslationBehavior: options.i18nDuplicateTranslation || 'warning',
39
+ };
37
40
  // Normalize xliff format extensions
38
41
  let format = options.format;
39
42
  switch (format) {
@@ -12,6 +12,10 @@ export type Schema = {
12
12
  * Output format for the generated file.
13
13
  */
14
14
  format?: Format;
15
+ /**
16
+ * How to handle duplicate translations.
17
+ */
18
+ i18nDuplicateTranslation?: I18NDuplicateTranslation;
15
19
  /**
16
20
  * Name of the file to output.
17
21
  */
@@ -39,3 +43,11 @@ export declare enum Format {
39
43
  Xliff2 = "xliff2",
40
44
  Xmb = "xmb"
41
45
  }
46
+ /**
47
+ * How to handle duplicate translations.
48
+ */
49
+ export declare enum I18NDuplicateTranslation {
50
+ Error = "error",
51
+ Ignore = "ignore",
52
+ Warning = "warning"
53
+ }
@@ -2,7 +2,7 @@
2
2
  // THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
3
3
  // CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.Format = void 0;
5
+ exports.I18NDuplicateTranslation = exports.Format = void 0;
6
6
  /**
7
7
  * Output format for the generated file.
8
8
  */
@@ -18,3 +18,12 @@ var Format;
18
18
  Format["Xliff2"] = "xliff2";
19
19
  Format["Xmb"] = "xmb";
20
20
  })(Format || (exports.Format = Format = {}));
21
+ /**
22
+ * How to handle duplicate translations.
23
+ */
24
+ var I18NDuplicateTranslation;
25
+ (function (I18NDuplicateTranslation) {
26
+ I18NDuplicateTranslation["Error"] = "error";
27
+ I18NDuplicateTranslation["Ignore"] = "ignore";
28
+ I18NDuplicateTranslation["Warning"] = "warning";
29
+ })(I18NDuplicateTranslation || (exports.I18NDuplicateTranslation = I18NDuplicateTranslation = {}));
@@ -27,6 +27,11 @@
27
27
  "outFile": {
28
28
  "type": "string",
29
29
  "description": "Name of the file to output."
30
+ },
31
+ "i18nDuplicateTranslation": {
32
+ "type": "string",
33
+ "description": "How to handle duplicate translations.",
34
+ "enum": ["error", "warning", "ignore"]
30
35
  }
31
36
  },
32
37
  "additionalProperties": false
@@ -192,7 +192,7 @@ async function addProxyConfig(root, proxyConfig) {
192
192
  // Load the ESM configuration file using the TypeScript dynamic import workaround.
193
193
  // Once TypeScript provides support for keeping the dynamic import this workaround can be
194
194
  // changed to a direct dynamic import.
195
- proxyConfiguration = (await (0, load_esm_1.loadEsmModule)((0, node_url_1.pathToFileURL)(proxyPath))).default;
195
+ proxyConfiguration = await (0, load_esm_1.loadEsmModule)((0, node_url_1.pathToFileURL)(proxyPath));
196
196
  break;
197
197
  case '.cjs':
198
198
  proxyConfiguration = require(proxyPath);
@@ -211,9 +211,12 @@ async function addProxyConfig(root, proxyConfig) {
211
211
  // Load the ESM configuration file using the TypeScript dynamic import workaround.
212
212
  // Once TypeScript provides support for keeping the dynamic import this workaround can be
213
213
  // changed to a direct dynamic import.
214
- proxyConfiguration = (await (0, load_esm_1.loadEsmModule)((0, node_url_1.pathToFileURL)(proxyPath))).default;
214
+ proxyConfiguration = await (0, load_esm_1.loadEsmModule)((0, node_url_1.pathToFileURL)(proxyPath));
215
215
  }
216
216
  }
217
+ if ('default' in proxyConfiguration) {
218
+ proxyConfiguration = proxyConfiguration.default;
219
+ }
217
220
  return normalizeProxyConfiguration(proxyConfiguration);
218
221
  }
219
222
  /**
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeCacheOptions = normalizeCacheOptions;
11
11
  const node_path_1 = require("node:path");
12
12
  /** Version placeholder is replaced during the build process with actual package version */
13
- const VERSION = '20.0.0-rc.1';
13
+ const VERSION = '20.0.0-rc.3';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&