@angular/build 20.3.3 → 20.3.5

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.3.3",
3
+ "version": "20.3.5",
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.2003.3",
26
+ "@angular-devkit/architect": "0.2003.5",
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",
@@ -41,7 +41,7 @@
41
41
  "parse5-html-rewriting-stream": "8.0.0",
42
42
  "picomatch": "4.0.3",
43
43
  "piscina": "5.1.3",
44
- "rolldown": "1.0.0-beta.38",
44
+ "rollup": "4.52.3",
45
45
  "sass": "1.90.0",
46
46
  "semver": "7.7.2",
47
47
  "source-map-support": "0.5.21",
@@ -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.3.3",
63
+ "@angular/ssr": "^20.3.5",
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.17.1",
115
+ "packageManager": "pnpm@10.18.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",
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.optimizeChunks = optimizeChunks;
14
14
  const node_assert_1 = __importDefault(require("node:assert"));
15
- const rolldown_1 = require("rolldown");
15
+ const rollup_1 = require("rollup");
16
16
  const bundler_context_1 = require("../../tools/esbuild/bundler-context");
17
17
  const utils_1 = require("../../tools/esbuild/utils");
18
18
  const error_1 = require("../../utils/error");
@@ -171,7 +171,7 @@ async function optimizeChunks(original, sourcemap) {
171
171
  let bundle;
172
172
  let optimizedOutput;
173
173
  try {
174
- bundle = await (0, rolldown_1.rolldown)({
174
+ bundle = await (0, rollup_1.rollup)({
175
175
  input: mainFile,
176
176
  plugins: [
177
177
  {
@@ -198,8 +198,7 @@ async function optimizeChunks(original, sourcemap) {
198
198
  ],
199
199
  });
200
200
  const result = await bundle.generate({
201
- minify: { mangle: false, compress: false },
202
- advancedChunks: { minSize: 8192 },
201
+ compact: true,
203
202
  sourcemap,
204
203
  chunkFileNames: (chunkInfo) => `${chunkInfo.name.replace(/-[a-zA-Z0-9]{8}$/, '')}-[hash].js`,
205
204
  });
@@ -46,6 +46,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.execute = execute;
47
47
  exports.writeTestFiles = writeTestFiles;
48
48
  const node_crypto_1 = require("node:crypto");
49
+ const node_fs_1 = require("node:fs");
49
50
  const fs = __importStar(require("node:fs/promises"));
50
51
  const node_module_1 = require("node:module");
51
52
  const node_path_1 = __importDefault(require("node:path"));
@@ -305,6 +306,11 @@ async function collectEntrypoints(options, context, projectSourceRoot) {
305
306
  async function initializeApplication(options, context, karmaOptions, transforms) {
306
307
  const outputPath = node_path_1.default.join(context.workspaceRoot, 'dist/test-out', (0, node_crypto_1.randomUUID)());
307
308
  const projectSourceRoot = await getProjectSourceRoot(context);
309
+ // Setup exit cleanup for temporary directory
310
+ const handleProcessExit = () => (0, node_fs_1.rmSync)(outputPath, { recursive: true, force: true });
311
+ process.once('exit', handleProcessExit);
312
+ process.once('SIGINT', handleProcessExit);
313
+ process.once('uncaughtException', handleProcessExit);
308
314
  const [karma, entryPoints] = await Promise.all([
309
315
  Promise.resolve().then(() => __importStar(require('karma'))),
310
316
  collectEntrypoints(options, context, projectSourceRoot),
@@ -8,7 +8,6 @@
8
8
  import type { PluginObj } from '@babel/core';
9
9
  /**
10
10
  * A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
11
- *
12
11
  * @returns A babel plugin object instance.
13
12
  */
14
13
  export default function (): PluginObj;
@@ -47,7 +47,11 @@ exports.default = default_1;
47
47
  const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
48
48
  const tslib = __importStar(require("tslib"));
49
49
  /**
50
- * A cached set of TypeScript helper function names used by the helper name matcher utility function.
50
+ * A set of constructor names that are considered to be side-effect free.
51
+ */
52
+ const sideEffectFreeConstructors = new Set(['InjectionToken']);
53
+ /**
54
+ * A set of TypeScript helper function names used by the helper name matcher utility function.
51
55
  */
52
56
  const tslibHelpers = new Set(Object.keys(tslib).filter((h) => h.startsWith('__')));
53
57
  /**
@@ -76,13 +80,16 @@ function isBabelHelperName(name) {
76
80
  }
77
81
  /**
78
82
  * A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
79
- *
80
83
  * @returns A babel plugin object instance.
81
84
  */
82
85
  function default_1() {
83
86
  return {
84
87
  visitor: {
85
- CallExpression(path) {
88
+ CallExpression(path, state) {
89
+ const { topLevelSafeMode = false } = state.opts;
90
+ if (topLevelSafeMode) {
91
+ return;
92
+ }
86
93
  // If the expression has a function parent, it is not top-level
87
94
  if (path.getFunctionParent()) {
88
95
  return;
@@ -100,9 +107,18 @@ function default_1() {
100
107
  }
101
108
  (0, helper_annotate_as_pure_1.default)(path);
102
109
  },
103
- NewExpression(path) {
110
+ NewExpression(path, state) {
104
111
  // If the expression has a function parent, it is not top-level
105
- if (!path.getFunctionParent()) {
112
+ if (path.getFunctionParent()) {
113
+ return;
114
+ }
115
+ const { topLevelSafeMode = false } = state.opts;
116
+ if (!topLevelSafeMode) {
117
+ (0, helper_annotate_as_pure_1.default)(path);
118
+ return;
119
+ }
120
+ const callee = path.get('callee');
121
+ if (callee.isIdentifier() && sideEffectFreeConstructors.has(callee.node.name)) {
106
122
  (0, helper_annotate_as_pure_1.default)(path);
107
123
  }
108
124
  },
@@ -84,16 +84,10 @@ async function transformWithBabel(filename, data, options) {
84
84
  plugins.push(linkerPlugin);
85
85
  }
86
86
  if (options.advancedOptimizations) {
87
+ const { adjustStaticMembers, adjustTypeScriptEnums, elideAngularMetadata, markTopLevelPure } = await Promise.resolve().then(() => __importStar(require('../babel/plugins')));
87
88
  const sideEffectFree = options.sideEffects === false;
88
89
  const safeAngularPackage = sideEffectFree && /[\\/]node_modules[\\/]@angular[\\/]/.test(filename);
89
- const { adjustStaticMembers, adjustTypeScriptEnums, elideAngularMetadata, markTopLevelPure } = await Promise.resolve().then(() => __importStar(require('../babel/plugins')));
90
- if (safeAngularPackage) {
91
- plugins.push(markTopLevelPure);
92
- }
93
- plugins.push(elideAngularMetadata, adjustTypeScriptEnums, [
94
- adjustStaticMembers,
95
- { wrapDecorators: sideEffectFree },
96
- ]);
90
+ plugins.push([markTopLevelPure, { topLevelSafeMode: !safeAngularPackage }], elideAngularMetadata, adjustTypeScriptEnums, [adjustStaticMembers, { wrapDecorators: sideEffectFree }]);
97
91
  }
98
92
  // If no additional transformations are needed, return the data directly
99
93
  if (plugins.length === 0) {
@@ -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.3.3';
13
+ const VERSION = '20.3.5';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&