@angular/build 22.0.1 → 22.0.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": "22.0.
|
|
3
|
+
"version": "22.0.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.2200.
|
|
26
|
+
"@angular-devkit/architect": "0.2200.2",
|
|
27
27
|
"@babel/core": "7.29.0",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.27.3",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.7",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@vitejs/plugin-basic-ssl": "2.3.0",
|
|
32
32
|
"beasties": "0.4.2",
|
|
33
33
|
"browserslist": "^4.26.0",
|
|
34
|
-
"esbuild": "0.28.
|
|
34
|
+
"esbuild": "0.28.1",
|
|
35
35
|
"https-proxy-agent": "9.0.0",
|
|
36
36
|
"jsonc-parser": "3.3.1",
|
|
37
37
|
"listr2": "10.2.1",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@angular/platform-browser": "^22.0.0",
|
|
60
60
|
"@angular/platform-server": "^22.0.0",
|
|
61
61
|
"@angular/service-worker": "^22.0.0",
|
|
62
|
-
"@angular/ssr": "^22.0.
|
|
62
|
+
"@angular/ssr": "^22.0.2",
|
|
63
63
|
"istanbul-lib-instrument": "^6.0.0",
|
|
64
64
|
"karma": "^6.4.0",
|
|
65
65
|
"less": "^4.2.0",
|
|
@@ -25,9 +25,17 @@ class JavaScriptTransformer {
|
|
|
25
25
|
#workerPool;
|
|
26
26
|
#commonOptions;
|
|
27
27
|
#fileCacheKeyBase;
|
|
28
|
+
/** Queue of pending transformation tasks waiting for an active concurrency slot. */
|
|
29
|
+
#pendingTasks = [];
|
|
30
|
+
/** Current count of actively executing transformation tasks. */
|
|
31
|
+
#activeTasks = 0;
|
|
32
|
+
/** Maximum number of transformation tasks allowed to execute concurrently. */
|
|
33
|
+
#maxConcurrent;
|
|
28
34
|
constructor(options, maxThreads, cache) {
|
|
29
35
|
this.maxThreads = maxThreads;
|
|
30
36
|
this.cache = cache;
|
|
37
|
+
// Maintain 2 active tasks per worker thread to keep transformation pipelines fully saturated
|
|
38
|
+
this.#maxConcurrent = Math.max(1, maxThreads * 2);
|
|
31
39
|
// Extract options to ensure only the named options are serialized and sent to the worker
|
|
32
40
|
const { sourcemap, thirdPartySourcemaps = false, advancedOptimizations = false, jit = false, } = options;
|
|
33
41
|
this.#commonOptions = {
|
|
@@ -38,6 +46,34 @@ class JavaScriptTransformer {
|
|
|
38
46
|
};
|
|
39
47
|
this.#fileCacheKeyBase = Buffer.from(JSON.stringify(this.#commonOptions), 'utf-8');
|
|
40
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Executes a transformation action using a semaphore-based backpressure throttle.
|
|
51
|
+
* Prevents libuv thread pool saturation and excessive V8 heap accumulation.
|
|
52
|
+
* @param action A callback that produces a promise for the transformation result.
|
|
53
|
+
* @returns A promise resolving to the transformation result.
|
|
54
|
+
*/
|
|
55
|
+
async #runWithThrottle(action) {
|
|
56
|
+
if (this.#activeTasks >= this.#maxConcurrent) {
|
|
57
|
+
await new Promise((resolve, reject) => {
|
|
58
|
+
this.#pendingTasks.push({ resolve, reject });
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.#activeTasks++;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
return await action();
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
const next = this.#pendingTasks.shift();
|
|
69
|
+
if (next) {
|
|
70
|
+
next.resolve();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.#activeTasks--;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
41
77
|
#ensureWorkerPool() {
|
|
42
78
|
if (this.#workerPool) {
|
|
43
79
|
return this.#workerPool;
|
|
@@ -63,50 +99,52 @@ class JavaScriptTransformer {
|
|
|
63
99
|
* @returns A promise that resolves to a UTF-8 encoded Uint8Array containing the result.
|
|
64
100
|
*/
|
|
65
101
|
async transformFile(filename, skipLinker, sideEffects, instrumentForCoverage) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
result = await this.cache?.get(cacheKey);
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
// Failure to get the value should not fail the transform
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (result === undefined) {
|
|
86
|
-
// If there is no cache or no cached entry, process the file
|
|
87
|
-
result = (await this.#ensureWorkerPool().run({
|
|
88
|
-
filename,
|
|
89
|
-
data,
|
|
90
|
-
skipLinker,
|
|
91
|
-
sideEffects,
|
|
92
|
-
instrumentForCoverage,
|
|
93
|
-
...this.#commonOptions,
|
|
94
|
-
}, {
|
|
95
|
-
// The below is disable as with Yarn PNP this causes build failures with the below message
|
|
96
|
-
// `Unable to deserialize cloned data`.
|
|
97
|
-
transferList: process.versions.pnp ? undefined : [data.buffer],
|
|
98
|
-
}));
|
|
99
|
-
// If there is a cache then store the result
|
|
100
|
-
if (this.cache && cacheKey) {
|
|
102
|
+
return this.#runWithThrottle(async () => {
|
|
103
|
+
const data = await (0, promises_1.readFile)(filename);
|
|
104
|
+
let result;
|
|
105
|
+
let cacheKey;
|
|
106
|
+
if (this.cache) {
|
|
107
|
+
// Create a cache key from the file data and options that effect the output.
|
|
108
|
+
// NOTE: If additional options are added, this may need to be updated.
|
|
109
|
+
// TODO: Consider xxhash or similar instead of SHA256
|
|
110
|
+
const hash = (0, node_crypto_1.createHash)('sha256');
|
|
111
|
+
hash.update(`${!!skipLinker}--${!!sideEffects}`);
|
|
112
|
+
hash.update(data);
|
|
113
|
+
hash.update(this.#fileCacheKeyBase);
|
|
114
|
+
cacheKey = hash.digest('hex');
|
|
101
115
|
try {
|
|
102
|
-
await this.cache
|
|
116
|
+
result = await this.cache?.get(cacheKey);
|
|
103
117
|
}
|
|
104
118
|
catch {
|
|
105
|
-
// Failure to
|
|
119
|
+
// Failure to get the value should not fail the transform
|
|
106
120
|
}
|
|
107
121
|
}
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
if (result === undefined) {
|
|
123
|
+
// If there is no cache or no cached entry, process the file
|
|
124
|
+
result = (await this.#ensureWorkerPool().run({
|
|
125
|
+
filename,
|
|
126
|
+
data,
|
|
127
|
+
skipLinker,
|
|
128
|
+
sideEffects,
|
|
129
|
+
instrumentForCoverage,
|
|
130
|
+
...this.#commonOptions,
|
|
131
|
+
}, {
|
|
132
|
+
// The below is disable as with Yarn PNP this causes build failures with the below message
|
|
133
|
+
// `Unable to deserialize cloned data`.
|
|
134
|
+
transferList: process.versions.pnp ? undefined : [data.buffer],
|
|
135
|
+
}));
|
|
136
|
+
// If there is a cache then store the result
|
|
137
|
+
if (this.cache && cacheKey) {
|
|
138
|
+
try {
|
|
139
|
+
await this.cache.put(cacheKey, result);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Failure to store the value in the cache should not fail the transform
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
});
|
|
110
148
|
}
|
|
111
149
|
/**
|
|
112
150
|
* Performs JavaScript transformations on the provided data of a file. The file does not need
|
|
@@ -125,20 +163,25 @@ class JavaScriptTransformer {
|
|
|
125
163
|
(!!this.#commonOptions.thirdPartySourcemaps || !/[\\/]node_modules[\\/]/.test(filename));
|
|
126
164
|
return Buffer.from(keepSourcemap ? data : data.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, ''), 'utf-8');
|
|
127
165
|
}
|
|
128
|
-
return this.#ensureWorkerPool().run({
|
|
166
|
+
return this.#runWithThrottle(() => this.#ensureWorkerPool().run({
|
|
129
167
|
filename,
|
|
130
168
|
data,
|
|
131
169
|
skipLinker,
|
|
132
170
|
sideEffects,
|
|
133
171
|
instrumentForCoverage,
|
|
134
172
|
...this.#commonOptions,
|
|
135
|
-
});
|
|
173
|
+
}));
|
|
136
174
|
}
|
|
137
175
|
/**
|
|
138
176
|
* Stops all active transformation tasks and shuts down all workers.
|
|
139
177
|
* @returns A void promise that resolves when closing is complete.
|
|
140
178
|
*/
|
|
141
179
|
async close() {
|
|
180
|
+
const pending = this.#pendingTasks;
|
|
181
|
+
this.#pendingTasks = [];
|
|
182
|
+
for (const task of pending) {
|
|
183
|
+
task.reject(new Error('JavaScriptTransformer closed.'));
|
|
184
|
+
}
|
|
142
185
|
if (this.#workerPool) {
|
|
143
186
|
try {
|
|
144
187
|
await this.#workerPool.destroy();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javascript-transformer.js","sourceRoot":"","sources":["javascript-transformer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6CAAyC;AACzC,+CAA4C;AAC5C,mFAA2F;AAC3F,yDAAwE;AAaxE;;;;;;GAMG;AACH,MAAa,qBAAqB;
|
|
1
|
+
{"version":3,"file":"javascript-transformer.js","sourceRoot":"","sources":["javascript-transformer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6CAAyC;AACzC,+CAA4C;AAC5C,mFAA2F;AAC3F,yDAAwE;AAaxE;;;;;;GAMG;AACH,MAAa,qBAAqB;IAgBrB;IACQ;IAhBnB,WAAW,CAAyB;IACpC,cAAc,CAAyC;IACvD,iBAAiB,CAAa;IAE9B,oFAAoF;IACp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C"}
|
|
@@ -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 = '22.0.
|
|
13
|
+
const VERSION = '22.0.2';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|