@angular/build 20.2.0 → 20.2.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/build",
3
- "version": "20.2.0",
3
+ "version": "20.2.2",
4
4
  "description": "Official build system for Angular",
5
5
  "keywords": [
6
6
  "Angular CLI",
@@ -23,7 +23,7 @@
23
23
  "builders": "builders.json",
24
24
  "dependencies": {
25
25
  "@ampproject/remapping": "2.3.0",
26
- "@angular-devkit/architect": "0.2002.0",
26
+ "@angular-devkit/architect": "0.2002.2",
27
27
  "@babel/core": "7.28.3",
28
28
  "@babel/helper-annotate-as-pure": "7.27.3",
29
29
  "@babel/helper-split-export-declaration": "7.24.7",
@@ -60,7 +60,7 @@
60
60
  "@angular/platform-browser": "^20.0.0",
61
61
  "@angular/platform-server": "^20.0.0",
62
62
  "@angular/service-worker": "^20.0.0",
63
- "@angular/ssr": "^20.2.0",
63
+ "@angular/ssr": "^20.2.2",
64
64
  "karma": "^6.4.0",
65
65
  "less": "^4.2.0",
66
66
  "ng-packagr": "^20.0.0",
@@ -112,7 +112,7 @@
112
112
  "type": "git",
113
113
  "url": "https://github.com/angular/angular-cli.git"
114
114
  },
115
- "packageManager": "pnpm@10.14.0",
115
+ "packageManager": "pnpm@10.15.1",
116
116
  "engines": {
117
117
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
118
118
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
@@ -317,6 +317,7 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
317
317
  // Setup server and start listening
318
318
  const serverConfiguration = await setupServer(serverOptions, generatedFiles, assetFiles, browserOptions.preserveSymlinks, externalMetadata, ssrMode, prebundleTransformer, target, (0, internal_1.isZonelessApp)(polyfills), componentStyles, templateUpdates, browserOptions.loader, {
319
319
  ...browserOptions.define,
320
+ 'ngJitMode': browserOptions.aot ? 'false' : 'true',
320
321
  'ngHmrMode': browserOptions.templateUpdates ? 'true' : 'false',
321
322
  }, extensions?.middleware, transformers?.indexHtml, thirdPartySourcemaps);
322
323
  server = await createServer(serverConfiguration);
@@ -170,6 +170,8 @@ class AngularPolyfillsPlugin {
170
170
  included: true,
171
171
  watched: false,
172
172
  });
173
+ // Karma needs a return value for a factory and Karma's multi-reporter expects an `adapters` array
174
+ return { adapters: [] };
173
175
  }, AngularPolyfillsPlugin),
174
176
  ],
175
177
  };
@@ -26,6 +26,16 @@ const application_builder_1 = require("../karma/application_builder");
26
26
  const find_tests_1 = require("../karma/find-tests");
27
27
  const karma_bridge_1 = require("./karma-bridge");
28
28
  const options_1 = require("./options");
29
+ function adjustOutputHashing(hashing) {
30
+ switch (hashing) {
31
+ case schema_1.OutputHashing.All:
32
+ case schema_1.OutputHashing.Media:
33
+ // Ensure media is continued to be hashed to avoid overwriting of output media files
34
+ return schema_1.OutputHashing.Media;
35
+ default:
36
+ return schema_1.OutputHashing.None;
37
+ }
38
+ }
29
39
  /**
30
40
  * @experimental Direct usage of this function is considered experimental.
31
41
  */
@@ -91,7 +101,7 @@ async function* execute(options, context, extensions = {}) {
91
101
  ssr: false,
92
102
  prerender: false,
93
103
  sourceMap: { scripts: true, vendor: false, styles: false },
94
- outputHashing: schema_1.OutputHashing.None,
104
+ outputHashing: adjustOutputHashing(buildTargetOptions.outputHashing),
95
105
  optimization: false,
96
106
  tsConfig: normalizedOptions.tsConfig,
97
107
  entryPoints,
@@ -55,6 +55,7 @@ const profiling_1 = require("../profiling");
55
55
  const compilation_state_1 = require("./compilation-state");
56
56
  const file_reference_tracker_1 = require("./file-reference-tracker");
57
57
  const jit_plugin_callbacks_1 = require("./jit-plugin-callbacks");
58
+ const rewrite_bazel_paths_1 = require("./rewrite-bazel-paths");
58
59
  // eslint-disable-next-line max-lines-per-function
59
60
  function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBundler) {
60
61
  return {
@@ -321,7 +322,7 @@ function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBun
321
322
  return result;
322
323
  });
323
324
  build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
324
- const request = path.normalize(pluginOptions.fileReplacements?.[path.normalize(args.path)] ?? args.path);
325
+ const request = (0, rewrite_bazel_paths_1.rewriteForBazel)(path.normalize(pluginOptions.fileReplacements?.[path.normalize(args.path)] ?? args.path));
325
326
  const isJS = /\.[cm]?js$/.test(request);
326
327
  // Skip TS load attempt if JS TypeScript compilation not enabled and file is JS
327
328
  if (shouldTsIgnoreJs && isJS) {
@@ -375,10 +376,11 @@ function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBun
375
376
  return {
376
377
  contents,
377
378
  loader,
379
+ resolveDir: path.dirname(request),
378
380
  };
379
381
  });
380
382
  build.onLoad({ filter: /\.[cm]?js$/ }, (0, load_result_cache_1.createCachedLoad)(pluginOptions.loadResultCache, async (args) => {
381
- let request = args.path;
383
+ let request = (0, rewrite_bazel_paths_1.rewriteForBazel)(args.path);
382
384
  if (pluginOptions.fileReplacements) {
383
385
  const replacement = pluginOptions.fileReplacements[path.normalize(args.path)];
384
386
  if (replacement) {
@@ -391,6 +393,7 @@ function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBun
391
393
  return {
392
394
  contents,
393
395
  loader: 'js',
396
+ resolveDir: path.dirname(request),
394
397
  watchFiles: request !== args.path ? [request] : undefined,
395
398
  };
396
399
  }, true);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ export declare function rewriteForBazel(path: string): string;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.rewriteForBazel = rewriteForBazel;
11
+ const node_path_1 = require("node:path");
12
+ const bazelBinDirectory = process.env['BAZEL_BINDIR'];
13
+ const bazelExecRoot = process.env['JS_BINARY__EXECROOT'];
14
+ function rewriteForBazel(path) {
15
+ if (!bazelBinDirectory || !bazelExecRoot) {
16
+ return path;
17
+ }
18
+ const fromExecRoot = (0, node_path_1.relative)(bazelExecRoot, path);
19
+ if (!fromExecRoot.startsWith('..')) {
20
+ return path;
21
+ }
22
+ const fromBinDirectory = (0, node_path_1.relative)(bazelBinDirectory, path);
23
+ if (fromBinDirectory.startsWith('..')) {
24
+ return path;
25
+ }
26
+ return (0, node_path_1.join)(bazelExecRoot, fromBinDirectory);
27
+ }
@@ -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.2.0';
13
+ const VERSION = '20.2.2';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&