@angular/build 22.2.0-next.3 → 22.2.0-next.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 +10 -10
- package/src/builders/application/chunk-optimizer.d.ts +2 -2
- package/src/builders/application/chunk-optimizer.js +5 -5
- package/src/builders/application/chunk-optimizer.js.map +1 -1
- package/src/builders/application/execute-build.js +42 -17
- package/src/builders/application/execute-build.js.map +1 -1
- package/src/builders/application/execute-post-bundle.d.ts +2 -2
- package/src/builders/application/execute-post-bundle.js +4 -4
- package/src/builders/application/execute-post-bundle.js.map +1 -1
- package/src/builders/application/i18n.js +35 -2
- package/src/builders/application/i18n.js.map +1 -1
- package/src/builders/application/options.d.ts +14 -0
- package/src/builders/application/options.js +2 -1
- package/src/builders/application/options.js.map +1 -1
- package/src/builders/application/setup-bundling.js +3 -1
- package/src/builders/application/setup-bundling.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/build-options.js +6 -0
- package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
- package/src/tools/angular/angular-host.d.ts +1 -2
- package/src/tools/angular/angular-host.js +3 -3
- package/src/tools/angular/angular-host.js.map +1 -1
- package/src/tools/angular/compilation/angular-compilation.d.ts +23 -10
- package/src/tools/angular/compilation/angular-compilation.js +11 -1
- package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
- package/src/tools/angular/compilation/aot-compilation.d.ts +4 -10
- package/src/tools/angular/compilation/aot-compilation.js +23 -14
- package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
- package/src/tools/angular/compilation/factory.d.ts +5 -3
- package/src/tools/angular/compilation/factory.js +10 -5
- package/src/tools/angular/compilation/factory.js.map +1 -1
- package/src/tools/angular/compilation/index.d.ts +2 -2
- package/src/tools/angular/compilation/index.js.map +1 -1
- package/src/tools/angular/compilation/jit-compilation.d.ts +4 -7
- package/src/tools/angular/compilation/jit-compilation.js +14 -11
- package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
- package/src/tools/angular/compilation/noop-compilation.d.ts +3 -8
- package/src/tools/angular/compilation/noop-compilation.js +1 -1
- package/src/tools/angular/compilation/noop-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-compilation.d.ts +2 -8
- package/src/tools/angular/compilation/parallel-compilation.js +43 -19
- package/src/tools/angular/compilation/parallel-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-worker.d.ts +3 -15
- package/src/tools/angular/compilation/parallel-worker.js +94 -66
- package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
- package/src/tools/angular/linker/oxc-linker.d.ts +13 -17
- package/src/tools/angular/linker/oxc-linker.js +27 -89
- package/src/tools/angular/linker/oxc-linker.js.map +1 -1
- package/src/tools/esbuild/angular/compiler-plugin.js +51 -21
- package/src/tools/esbuild/angular/compiler-plugin.js.map +1 -1
- package/src/tools/esbuild/angular/component-stylesheets.d.ts +3 -3
- package/src/tools/esbuild/angular/component-stylesheets.js +43 -15
- package/src/tools/esbuild/angular/component-stylesheets.js.map +1 -1
- package/src/tools/esbuild/angular/source-file-cache.d.ts +1 -2
- package/src/tools/esbuild/angular/source-file-cache.js +1 -11
- package/src/tools/esbuild/angular/source-file-cache.js.map +1 -1
- package/src/tools/esbuild/application-code-bundle.js +10 -9
- package/src/tools/esbuild/application-code-bundle.js.map +1 -1
- package/src/tools/esbuild/budget-stats.js +3 -3
- package/src/tools/esbuild/budget-stats.js.map +1 -1
- package/src/tools/esbuild/bundler-context.d.ts +23 -7
- package/src/tools/esbuild/bundler-context.js +108 -42
- package/src/tools/esbuild/bundler-context.js.map +1 -1
- package/src/tools/esbuild/cache.d.ts +10 -0
- package/src/tools/esbuild/cache.js +18 -0
- package/src/tools/esbuild/cache.js.map +1 -1
- package/src/tools/esbuild/i18n-inliner-worker.d.ts +59 -6
- package/src/tools/esbuild/i18n-inliner-worker.js +252 -71
- package/src/tools/esbuild/i18n-inliner-worker.js.map +1 -1
- package/src/tools/esbuild/i18n-inliner.d.ts +39 -5
- package/src/tools/esbuild/i18n-inliner.js +209 -83
- package/src/tools/esbuild/i18n-inliner.js.map +1 -1
- package/src/tools/esbuild/i18n-locale-plugin.d.ts +32 -0
- package/src/tools/esbuild/i18n-locale-plugin.js +112 -103
- package/src/tools/esbuild/i18n-locale-plugin.js.map +1 -1
- package/src/tools/esbuild/i18n-translation-encoder.d.ts +20 -0
- package/src/tools/esbuild/i18n-translation-encoder.js +92 -0
- package/src/tools/esbuild/i18n-translation-encoder.js.map +1 -0
- package/src/tools/esbuild/i18n-translation-reader.d.ts +40 -0
- package/src/tools/esbuild/i18n-translation-reader.js +164 -0
- package/src/tools/esbuild/i18n-translation-reader.js.map +1 -0
- package/src/tools/esbuild/javascript-transformer-worker.js +36 -46
- package/src/tools/esbuild/javascript-transformer-worker.js.map +1 -1
- package/src/tools/esbuild/license-extractor.d.ts +1 -1
- package/src/tools/esbuild/license-extractor.js +89 -86
- package/src/tools/esbuild/license-extractor.js.map +1 -1
- package/src/tools/esbuild/load-result-cache.d.ts +1 -0
- package/src/tools/esbuild/load-result-cache.js +24 -11
- package/src/tools/esbuild/load-result-cache.js.map +1 -1
- package/src/tools/esbuild/utils.d.ts +2 -2
- package/src/tools/esbuild/utils.js +9 -6
- package/src/tools/esbuild/utils.js.map +1 -1
- package/src/tools/oxc/oxc-transform.d.ts +3 -0
- package/src/tools/oxc/oxc-transform.js +53 -32
- package/src/tools/oxc/oxc-transform.js.map +1 -1
- package/src/utils/i18n-options.d.ts +1 -0
- package/src/utils/i18n-options.js.map +1 -1
- package/src/utils/index-file/auto-csp.js +36 -17
- package/src/utils/index-file/auto-csp.js.map +1 -1
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +12 -9
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js.map +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/utils.d.ts +8 -0
- package/src/utils/server-rendering/esm-in-memory-loader/utils.js +30 -0
- package/src/utils/server-rendering/esm-in-memory-loader/utils.js.map +1 -1
- package/src/utils/server-rendering/prerender.js +70 -30
- package/src/utils/server-rendering/prerender.js.map +1 -1
- package/src/utils/server-rendering/render-worker.d.ts +7 -4
- package/src/utils/server-rendering/render-worker.js +29 -7
- package/src/utils/server-rendering/render-worker.js.map +1 -1
|
@@ -46,6 +46,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
46
46
|
exports.JitCompilation = void 0;
|
|
47
47
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
48
48
|
const typescript_1 = __importDefault(require("typescript"));
|
|
49
|
+
const path_1 = require("../../../utils/path");
|
|
49
50
|
const profiling_1 = require("../../esbuild/profiling");
|
|
50
51
|
const angular_host_1 = require("../angular-host");
|
|
51
52
|
const jit_resource_transformer_1 = require("../transformers/jit-resource-transformer");
|
|
@@ -69,6 +70,7 @@ class JitCompilationState {
|
|
|
69
70
|
class JitCompilation extends angular_compilation_1.AngularCompilation {
|
|
70
71
|
browserOnlyBuild;
|
|
71
72
|
#state;
|
|
73
|
+
#sourceFiles = new Map();
|
|
72
74
|
constructor(browserOnlyBuild) {
|
|
73
75
|
super();
|
|
74
76
|
this.browserOnlyBuild = browserOnlyBuild;
|
|
@@ -79,16 +81,20 @@ class JitCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
79
81
|
// Load the compiler configuration and transform as needed
|
|
80
82
|
const { options: originalCompilerOptions, rootNames, errors: configurationDiagnostics, } = await this.loadConfiguration(tsconfig);
|
|
81
83
|
const compilerOptions = compilerOptionsTransformer?.(originalCompilerOptions) ?? originalCompilerOptions;
|
|
84
|
+
if (hostOptions.modifiedFiles) {
|
|
85
|
+
for (const modifiedFile of hostOptions.modifiedFiles) {
|
|
86
|
+
this.#sourceFiles.delete((0, path_1.toPosixPath)(modifiedFile));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
82
89
|
// Create Angular compiler host
|
|
83
|
-
const host = (0, angular_host_1.createAngularCompilerHost)(typescript_1.default, compilerOptions, hostOptions, undefined);
|
|
90
|
+
const host = (0, angular_host_1.createAngularCompilerHost)(typescript_1.default, compilerOptions, hostOptions, undefined, this.#sourceFiles);
|
|
84
91
|
// Create the TypeScript Program
|
|
85
92
|
const typeScriptProgram = (0, profiling_1.profileSync)('TS_CREATE_PROGRAM', () => typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, this.#state?.typeScriptProgram ?? typescript_1.default.readBuilderProgram(compilerOptions, host), configurationDiagnostics));
|
|
86
|
-
const affectedFiles = (0, profiling_1.profileSync)('TS_FIND_AFFECTED', () => findAffectedFiles(typeScriptProgram));
|
|
87
93
|
this.#state = new JitCompilationState(host, typeScriptProgram, constructorParametersDownlevelTransform(typeScriptProgram.getProgram()), (0, jit_resource_transformer_1.createJitResourceTransformer)(() => typeScriptProgram.getProgram().getTypeChecker()), (0, web_worker_transformer_1.createWorkerTransformer)(hostOptions.processWebWorker.bind(hostOptions)));
|
|
88
94
|
const referencedFiles = typeScriptProgram
|
|
89
95
|
.getSourceFiles()
|
|
90
96
|
.map((sourceFile) => sourceFile.fileName);
|
|
91
|
-
return {
|
|
97
|
+
return { compilerOptions, referencedFiles };
|
|
92
98
|
}
|
|
93
99
|
*collectDiagnostics(modes) {
|
|
94
100
|
(0, node_assert_1.default)(this.#state, 'Compilation must be initialized prior to collecting diagnostics.');
|
|
@@ -137,14 +143,11 @@ class JitCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
137
143
|
}
|
|
138
144
|
return emittedFiles;
|
|
139
145
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
let result;
|
|
145
|
-
while ((result = builder.getSemanticDiagnosticsOfNextAffectedFile())) {
|
|
146
|
-
affectedFiles.add(result.affected);
|
|
146
|
+
async update(files) {
|
|
147
|
+
for (const file of files) {
|
|
148
|
+
this.#sourceFiles.delete((0, path_1.toPosixPath)(file));
|
|
149
|
+
}
|
|
147
150
|
}
|
|
148
|
-
return affectedFiles;
|
|
149
151
|
}
|
|
152
|
+
exports.JitCompilation = JitCompilation;
|
|
150
153
|
//# sourceMappingURL=jit-compilation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jit-compilation.js","sourceRoot":"","sources":["jit-compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,8DAAiC;AACjC,4DAA4B;AAC5B,uDAAsD;AACtD,kDAAgF;AAChF,uFAAwF;AACxF,qFAAgF;AAChF,mFAAiF;AACjF,+
|
|
1
|
+
{"version":3,"file":"jit-compilation.js","sourceRoot":"","sources":["jit-compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,8DAAiC;AACjC,4DAA4B;AAC5B,8CAAkD;AAClD,uDAAsD;AACtD,kDAAgF;AAChF,uFAAwF;AACxF,qFAAgF;AAChF,mFAAiF;AACjF,+DAK+B;AAE/B,MAAM,mBAAmB;IAEL;IACA;IACA;IACA;IACA;IALlB,YACkB,YAA6B,EAC7B,iBAA8D,EAC9D,uCAA6E,EAC7E,yBAA+D,EAC/D,kBAAwD;QAJxD,iBAAY,GAAZ,YAAY,CAAiB;QAC7B,sBAAiB,GAAjB,iBAAiB,CAA6C;QAC9D,4CAAuC,GAAvC,uCAAuC,CAAsC;QAC7E,8BAAyB,GAAzB,yBAAyB,CAAsC;QAC/D,uBAAkB,GAAlB,kBAAkB,CAAsC;IACvE,CAAC;CACL;AAED,MAAa,cAAe,SAAQ,wCAAkB;IAIvB;IAH7B,MAAM,CAAuB;IACpB,YAAY,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEzD,YAA6B,gBAAyB;QACpD,KAAK,EAAE,CAAC;QADmB,qBAAgB,GAAhB,gBAAgB,CAAS;IAEtD,CAAC;IAED,KAA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,KAAkB;QACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AA7ID,wCA6IC"}
|
|
@@ -6,15 +6,10 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type * as ng from '@angular/compiler-cli';
|
|
9
|
-
import type ts from 'typescript';
|
|
10
9
|
import { AngularHostOptions } from '../angular-host';
|
|
11
|
-
import { AngularCompilation } from './angular-compilation';
|
|
10
|
+
import { AngularCompilation, AngularCompilationResult } from './angular-compilation';
|
|
12
11
|
export declare class NoopCompilation extends AngularCompilation {
|
|
13
|
-
initialize(tsconfig: string, hostOptions: AngularHostOptions, compilerOptionsTransformer?: (compilerOptions: ng.CompilerOptions) => ng.CompilerOptions): Promise<
|
|
14
|
-
|
|
15
|
-
compilerOptions: ng.CompilerOptions;
|
|
16
|
-
referencedFiles: readonly string[];
|
|
17
|
-
}>;
|
|
18
|
-
collectDiagnostics(): never;
|
|
12
|
+
initialize(tsconfig: string, hostOptions: AngularHostOptions, compilerOptionsTransformer?: (compilerOptions: ng.CompilerOptions) => ng.CompilerOptions): Promise<AngularCompilationResult>;
|
|
13
|
+
protected collectDiagnostics(): never;
|
|
19
14
|
emitAffectedFiles(): never;
|
|
20
15
|
}
|
|
@@ -14,7 +14,7 @@ class NoopCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
14
14
|
// Load the compiler configuration and transform as needed
|
|
15
15
|
const { options: originalCompilerOptions } = await this.loadConfiguration(tsconfig);
|
|
16
16
|
const compilerOptions = compilerOptionsTransformer?.(originalCompilerOptions) ?? originalCompilerOptions;
|
|
17
|
-
return {
|
|
17
|
+
return { compilerOptions, referencedFiles: [] };
|
|
18
18
|
}
|
|
19
19
|
collectDiagnostics() {
|
|
20
20
|
throw new Error('Not available when using noop compilation.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop-compilation.js","sourceRoot":"","sources":["noop-compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"noop-compilation.js","sourceRoot":"","sources":["noop-compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,+DAAqF;AAErF,MAAa,eAAgB,SAAQ,wCAAkB;IACrD,KAAK,CAAC,UAAU,CACd,QAAgB,EAChB,WAA+B,EAC/B,0BAAwF;QAExF,0DAA0D;QAC1D,MAAM,EAAE,OAAO,EAAE,uBAAuB,EAAE,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACpF,MAAM,eAAe,GACnB,0BAA0B,EAAE,CAAC,uBAAuB,CAAC,IAAI,uBAAuB,CAAC;QAEnF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC;IAClD,CAAC;IAEkB,kBAAkB;QACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAEQ,iBAAiB;QACxB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;CACF;AArBD,0CAqBC"}
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { CompilerOptions } from '@angular/compiler-cli';
|
|
9
9
|
import type { PartialMessage } from 'esbuild';
|
|
10
|
-
import type { SourceFile } from 'typescript';
|
|
11
10
|
import type { AngularHostOptions } from '../angular-host';
|
|
12
|
-
import { AngularCompilation, DiagnosticModes, EmitFileResult } from './angular-compilation';
|
|
11
|
+
import { AngularCompilation, AngularCompilationResult, DiagnosticModes, EmitFileResult } from './angular-compilation';
|
|
13
12
|
/**
|
|
14
13
|
* An Angular compilation which uses a Node.js Worker thread to load and execute
|
|
15
14
|
* the TypeScript and Angular compilers. This allows for longer synchronous actions
|
|
@@ -23,12 +22,7 @@ export declare class ParallelCompilation extends AngularCompilation {
|
|
|
23
22
|
private readonly jit;
|
|
24
23
|
private readonly browserOnlyBuild;
|
|
25
24
|
constructor(jit: boolean, browserOnlyBuild: boolean);
|
|
26
|
-
initialize(tsconfig: string, hostOptions: AngularHostOptions, compilerOptionsTransformer?: (compilerOptions: CompilerOptions) => CompilerOptions): Promise<
|
|
27
|
-
affectedFiles: ReadonlySet<SourceFile>;
|
|
28
|
-
compilerOptions: CompilerOptions;
|
|
29
|
-
referencedFiles: readonly string[];
|
|
30
|
-
externalStylesheets?: ReadonlyMap<string, string>;
|
|
31
|
-
}>;
|
|
25
|
+
initialize(tsconfig: string, hostOptions: AngularHostOptions, compilerOptionsTransformer?: (compilerOptions: CompilerOptions) => CompilerOptions): Promise<AngularCompilationResult>;
|
|
32
26
|
/**
|
|
33
27
|
* This is not needed with this compilation type since the worker will already send a response
|
|
34
28
|
* with the serializable esbuild compatible diagnostics.
|
|
@@ -25,6 +25,7 @@ class ParallelCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
25
25
|
jit;
|
|
26
26
|
browserOnlyBuild;
|
|
27
27
|
#worker;
|
|
28
|
+
#webWorkerChannel;
|
|
28
29
|
constructor(jit, browserOnlyBuild) {
|
|
29
30
|
super();
|
|
30
31
|
this.jit = jit;
|
|
@@ -37,7 +38,7 @@ class ParallelCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
37
38
|
filename: localRequire.resolve('./parallel-worker'),
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
initialize(tsconfig, hostOptions, compilerOptionsTransformer) {
|
|
41
|
+
async initialize(tsconfig, hostOptions, compilerOptionsTransformer) {
|
|
41
42
|
const stylesheetChannel = new node_worker_threads_1.MessageChannel();
|
|
42
43
|
// The request identifier is required because Angular can issue multiple concurrent requests
|
|
43
44
|
stylesheetChannel.port1.on('message', ({ requestId, data, containingFile, stylesheetFile, order, className }) => {
|
|
@@ -46,9 +47,11 @@ class ParallelCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
46
47
|
.then((value) => stylesheetChannel.port1.postMessage({ requestId, value }))
|
|
47
48
|
.catch((error) => stylesheetChannel.port1.postMessage({ requestId, error }));
|
|
48
49
|
});
|
|
50
|
+
this.#webWorkerChannel?.port1.close();
|
|
49
51
|
// The web worker processing is a synchronous operation and uses shared memory combined with
|
|
50
52
|
// the Atomics API to block execution here until a response is received.
|
|
51
53
|
const webWorkerChannel = new node_worker_threads_1.MessageChannel();
|
|
54
|
+
this.#webWorkerChannel = webWorkerChannel;
|
|
52
55
|
const webWorkerSignal = new Int32Array(new SharedArrayBuffer(4));
|
|
53
56
|
webWorkerChannel.port1.on('message', ({ workerFile, containingFile }) => {
|
|
54
57
|
try {
|
|
@@ -73,28 +76,41 @@ class ParallelCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
73
76
|
optionsChannel.port1.postMessage({ transformedOptions });
|
|
74
77
|
}
|
|
75
78
|
catch (error) {
|
|
76
|
-
|
|
79
|
+
optionsChannel.port1.postMessage({ error });
|
|
77
80
|
}
|
|
78
81
|
finally {
|
|
79
82
|
Atomics.store(optionsSignal, 0, 1);
|
|
80
83
|
Atomics.notify(optionsSignal, 0);
|
|
81
84
|
}
|
|
82
85
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
let success = false;
|
|
87
|
+
try {
|
|
88
|
+
// Execute the initialize function in the worker thread
|
|
89
|
+
const result = await this.#worker.run({
|
|
90
|
+
fileReplacements: hostOptions.fileReplacements,
|
|
91
|
+
tsconfig,
|
|
92
|
+
jit: this.jit,
|
|
93
|
+
browserOnlyBuild: this.browserOnlyBuild,
|
|
94
|
+
stylesheetPort: stylesheetChannel.port2,
|
|
95
|
+
optionsPort: optionsChannel.port2,
|
|
96
|
+
optionsSignal,
|
|
97
|
+
webWorkerPort: webWorkerChannel.port2,
|
|
98
|
+
webWorkerSignal,
|
|
99
|
+
}, {
|
|
100
|
+
name: 'initialize',
|
|
101
|
+
transferList: [stylesheetChannel.port2, optionsChannel.port2, webWorkerChannel.port2],
|
|
102
|
+
});
|
|
103
|
+
success = true;
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
stylesheetChannel.port1.close();
|
|
108
|
+
optionsChannel.port1.close();
|
|
109
|
+
if (!success) {
|
|
110
|
+
this.#webWorkerChannel?.port1.close();
|
|
111
|
+
this.#webWorkerChannel = undefined;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
98
114
|
}
|
|
99
115
|
/**
|
|
100
116
|
* This is not needed with this compilation type since the worker will already send a response
|
|
@@ -110,13 +126,21 @@ class ParallelCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
110
126
|
}
|
|
111
127
|
return result;
|
|
112
128
|
}
|
|
113
|
-
emitAffectedFiles() {
|
|
114
|
-
|
|
129
|
+
async emitAffectedFiles() {
|
|
130
|
+
try {
|
|
131
|
+
return await this.#worker.run(undefined, { name: 'emit' });
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
this.#webWorkerChannel?.port1.close();
|
|
135
|
+
this.#webWorkerChannel = undefined;
|
|
136
|
+
}
|
|
115
137
|
}
|
|
116
138
|
update(files) {
|
|
117
139
|
return this.#worker.run(files, { name: 'update' });
|
|
118
140
|
}
|
|
119
141
|
close() {
|
|
142
|
+
this.#webWorkerChannel?.port1.close();
|
|
143
|
+
this.#webWorkerChannel = undefined;
|
|
120
144
|
return this.#worker.destroy();
|
|
121
145
|
}
|
|
122
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel-compilation.js","sourceRoot":"","sources":["parallel-compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,6CAA4C;AAC5C,6DAAqD;
|
|
1
|
+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,kDA+IC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { PartialMessage } from 'esbuild';
|
|
9
9
|
import { type MessagePort } from 'node:worker_threads';
|
|
10
|
-
import type { DiagnosticModes } from './angular-compilation';
|
|
10
|
+
import type { AngularCompilationResult, DiagnosticModes } from './angular-compilation';
|
|
11
11
|
export interface InitRequest {
|
|
12
12
|
jit: boolean;
|
|
13
13
|
browserOnlyBuild: boolean;
|
|
@@ -19,23 +19,11 @@ export interface InitRequest {
|
|
|
19
19
|
webWorkerPort: MessagePort;
|
|
20
20
|
webWorkerSignal: Int32Array;
|
|
21
21
|
}
|
|
22
|
-
export declare function initialize(request: InitRequest): Promise<
|
|
23
|
-
externalStylesheets: ReadonlyMap<string, string> | undefined;
|
|
24
|
-
templateUpdates: ReadonlyMap<string, string> | undefined;
|
|
25
|
-
referencedFiles: readonly string[];
|
|
26
|
-
compilerOptions: {
|
|
27
|
-
allowJs: boolean | undefined;
|
|
28
|
-
isolatedModules: boolean | undefined;
|
|
29
|
-
sourceMap: boolean | undefined;
|
|
30
|
-
inlineSourceMap: boolean | undefined;
|
|
31
|
-
_useTypeScriptTranspilation: boolean | undefined;
|
|
32
|
-
};
|
|
33
|
-
componentResourcesDependencies: ReadonlyMap<string, readonly string[]> | undefined;
|
|
34
|
-
}>;
|
|
22
|
+
export declare function initialize(request: InitRequest): Promise<AngularCompilationResult>;
|
|
35
23
|
export declare function diagnose(modes: DiagnosticModes): Promise<{
|
|
36
24
|
errors?: PartialMessage[];
|
|
37
25
|
warnings?: PartialMessage[];
|
|
38
26
|
timings?: Record<string, number[]>;
|
|
39
27
|
}>;
|
|
40
28
|
export declare function emit(): Promise<import("./angular-compilation").EmitFileResult[]>;
|
|
41
|
-
export declare function update(files: Set<string>): void
|
|
29
|
+
export declare function update(files: Set<string>): Promise<void>;
|
|
@@ -18,77 +18,96 @@ const node_assert_1 = __importDefault(require("node:assert"));
|
|
|
18
18
|
const node_crypto_1 = require("node:crypto");
|
|
19
19
|
const node_worker_threads_1 = require("node:worker_threads");
|
|
20
20
|
const hash_1 = require("../../../utils/hash");
|
|
21
|
-
const source_file_cache_1 = require("../../esbuild/angular/source-file-cache");
|
|
22
21
|
const profiling_1 = require("../../esbuild/profiling");
|
|
23
22
|
const aot_compilation_1 = require("./aot-compilation");
|
|
24
23
|
const jit_compilation_1 = require("./jit-compilation");
|
|
25
24
|
let compilation;
|
|
26
|
-
|
|
25
|
+
let activeWebWorkerPort;
|
|
26
|
+
const modifiedFiles = new Set();
|
|
27
27
|
async function initialize(request) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
28
|
+
activeWebWorkerPort?.close();
|
|
29
|
+
activeWebWorkerPort = request.webWorkerPort;
|
|
30
|
+
const currentModifiedFiles = new Set(modifiedFiles);
|
|
31
|
+
modifiedFiles.clear();
|
|
32
|
+
let success = false;
|
|
33
|
+
try {
|
|
34
|
+
await (0, hash_1.initializeHash)();
|
|
35
|
+
compilation ??= request.jit
|
|
36
|
+
? new jit_compilation_1.JitCompilation(request.browserOnlyBuild)
|
|
37
|
+
: new aot_compilation_1.AotCompilation(request.browserOnlyBuild);
|
|
38
|
+
const stylesheetRequests = new Map();
|
|
39
|
+
request.stylesheetPort.on('message', ({ requestId, value, error }) => {
|
|
40
|
+
const handlers = stylesheetRequests.get(requestId);
|
|
41
|
+
if (handlers) {
|
|
42
|
+
stylesheetRequests.delete(requestId);
|
|
43
|
+
if (error) {
|
|
44
|
+
handlers[1](error);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
handlers[0](value);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const { compilerOptions, referencedFiles, externalStylesheets, templateUpdates, componentResourcesDependencies, } = await compilation.initialize(request.tsconfig, {
|
|
52
|
+
fileReplacements: request.fileReplacements,
|
|
53
|
+
modifiedFiles: currentModifiedFiles,
|
|
54
|
+
transformStylesheet(data, containingFile, stylesheetFile, order, className) {
|
|
55
|
+
const requestId = (0, node_crypto_1.randomUUID)();
|
|
56
|
+
const resultPromise = new Promise((resolve, reject) => stylesheetRequests.set(requestId, [resolve, reject]));
|
|
57
|
+
request.stylesheetPort.postMessage({
|
|
58
|
+
requestId,
|
|
59
|
+
data,
|
|
60
|
+
containingFile,
|
|
61
|
+
stylesheetFile,
|
|
62
|
+
order,
|
|
63
|
+
className,
|
|
64
|
+
});
|
|
65
|
+
return resultPromise;
|
|
66
|
+
},
|
|
67
|
+
processWebWorker(workerFile, containingFile) {
|
|
68
|
+
Atomics.store(request.webWorkerSignal, 0, 0);
|
|
69
|
+
request.webWorkerPort.postMessage({ workerFile, containingFile });
|
|
70
|
+
Atomics.wait(request.webWorkerSignal, 0, 0);
|
|
71
|
+
const result = (0, node_worker_threads_1.receiveMessageOnPort)(request.webWorkerPort)?.message;
|
|
72
|
+
if (result?.error) {
|
|
73
|
+
throw result.error;
|
|
74
|
+
}
|
|
75
|
+
return result?.workerCodeFile ?? workerFile;
|
|
76
|
+
},
|
|
77
|
+
}, (compilerOptions) => {
|
|
78
|
+
Atomics.store(request.optionsSignal, 0, 0);
|
|
79
|
+
request.optionsPort.postMessage(compilerOptions);
|
|
80
|
+
Atomics.wait(request.optionsSignal, 0, 0);
|
|
81
|
+
const result = (0, node_worker_threads_1.receiveMessageOnPort)(request.optionsPort)?.message;
|
|
63
82
|
if (result?.error) {
|
|
64
83
|
throw result.error;
|
|
65
84
|
}
|
|
66
|
-
return result?.
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
return result?.transformedOptions ?? compilerOptions;
|
|
86
|
+
});
|
|
87
|
+
success = true;
|
|
88
|
+
return {
|
|
89
|
+
externalStylesheets,
|
|
90
|
+
templateUpdates,
|
|
91
|
+
referencedFiles,
|
|
92
|
+
// TODO: Expand? `allowJs`, `isolatedModules`, `sourceMap`, `inlineSourceMap` are the only fields needed currently.
|
|
93
|
+
compilerOptions: {
|
|
94
|
+
allowJs: compilerOptions.allowJs,
|
|
95
|
+
isolatedModules: compilerOptions.isolatedModules,
|
|
96
|
+
sourceMap: compilerOptions.sourceMap,
|
|
97
|
+
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
98
|
+
_useTypeScriptTranspilation: compilerOptions['_useTypeScriptTranspilation'],
|
|
99
|
+
},
|
|
100
|
+
componentResourcesDependencies,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
request.stylesheetPort.close();
|
|
105
|
+
request.optionsPort.close();
|
|
106
|
+
if (!success) {
|
|
107
|
+
activeWebWorkerPort?.close();
|
|
108
|
+
activeWebWorkerPort = undefined;
|
|
75
109
|
}
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
return {
|
|
79
|
-
externalStylesheets,
|
|
80
|
-
templateUpdates,
|
|
81
|
-
referencedFiles,
|
|
82
|
-
// TODO: Expand? `allowJs`, `isolatedModules`, `sourceMap`, `inlineSourceMap` are the only fields needed currently.
|
|
83
|
-
compilerOptions: {
|
|
84
|
-
allowJs: compilerOptions.allowJs,
|
|
85
|
-
isolatedModules: compilerOptions.isolatedModules,
|
|
86
|
-
sourceMap: compilerOptions.sourceMap,
|
|
87
|
-
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
88
|
-
_useTypeScriptTranspilation: compilerOptions['_useTypeScriptTranspilation'],
|
|
89
|
-
},
|
|
90
|
-
componentResourcesDependencies,
|
|
91
|
-
};
|
|
110
|
+
}
|
|
92
111
|
}
|
|
93
112
|
async function diagnose(modes) {
|
|
94
113
|
(0, node_assert_1.default)(compilation);
|
|
@@ -101,10 +120,19 @@ async function diagnose(modes) {
|
|
|
101
120
|
}
|
|
102
121
|
async function emit() {
|
|
103
122
|
(0, node_assert_1.default)(compilation);
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
try {
|
|
124
|
+
const files = await compilation.emitAffectedFiles();
|
|
125
|
+
return [...files];
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
activeWebWorkerPort?.close();
|
|
129
|
+
activeWebWorkerPort = undefined;
|
|
130
|
+
}
|
|
106
131
|
}
|
|
107
|
-
function update(files) {
|
|
108
|
-
|
|
132
|
+
async function update(files) {
|
|
133
|
+
for (const file of files) {
|
|
134
|
+
modifiedFiles.add(file);
|
|
135
|
+
}
|
|
136
|
+
await compilation?.update?.(files);
|
|
109
137
|
}
|
|
110
138
|
//# sourceMappingURL=parallel-worker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel-worker.js","sourceRoot":"","sources":["parallel-worker.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;
|
|
1
|
+
{"version":3,"file":"parallel-worker.js","sourceRoot":"","sources":["parallel-worker.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAiCH,gCAgHC;AAED,4BAcC;AAED,oBAWC;AAED,wBAKC;AAlLD,8DAAiC;AACjC,6CAAyC;AACzC,6DAA6E;AAC7E,8CAAqD;AACrD,uDAAyE;AAMzE,uDAAmD;AACnD,uDAAmD;AAcnD,IAAI,WAA2C,CAAC;AAChD,IAAI,mBAA4C,CAAC;AAEjD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjC,KAAK,UAAU,UAAU,CAAC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M,KAAK,GAAG,MAAM,WAAW,CAAC,iBAAiB,EAAE,CAAC;QAEpD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IACpB,CAAC;YAAS,CAAC;QACT,mBAAmB,EAAE,KAAK,EAAE,CAAC;QAC7B,mBAAmB,GAAG,SAAS,CAAC;IAClC,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,MAAM,CAAC,KAAkB;IAC7C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,MAAM,WAAW,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -5,22 +5,18 @@
|
|
|
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 {
|
|
9
|
-
export interface OxcLinkerOptions {
|
|
10
|
-
sourcemap?: boolean;
|
|
11
|
-
jit?: boolean;
|
|
12
|
-
skipCheck?: boolean;
|
|
13
|
-
}
|
|
8
|
+
import type { CallExpression } from '@oxc-project/types';
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
16
|
-
* using `oxc-parser` and `magic-string`.
|
|
17
|
-
*
|
|
18
|
-
* @param filename The full path to the file.
|
|
19
|
-
* @param code The source code content.
|
|
20
|
-
* @param options Linker options (sourcemap, jit, skipCheck).
|
|
21
|
-
* @returns An object containing the transformed code and optional source map.
|
|
10
|
+
* Manages Angular partial declaration linking using Oxc AST nodes.
|
|
22
11
|
*/
|
|
23
|
-
export declare
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
export declare class OxcLinker {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(filename: string, code: string, jit?: boolean);
|
|
15
|
+
/**
|
|
16
|
+
* Attempts to link an Angular partial declaration CallExpression.
|
|
17
|
+
*
|
|
18
|
+
* @param node The CallExpression AST node to check and link.
|
|
19
|
+
* @returns The linked code string if the node is a partial declaration, or undefined otherwise.
|
|
20
|
+
*/
|
|
21
|
+
linkCallExpression(node: CallExpression): string | undefined;
|
|
22
|
+
}
|