@angular/build 20.0.0-rc.3 → 20.0.0
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 +13 -13
- package/src/builders/dev-server/vite-server.js +3 -4
- package/src/tools/esbuild/angular/compiler-plugin.d.ts +6 -0
- package/src/tools/esbuild/angular/compiler-plugin.js +2 -1
- package/src/tools/esbuild/javascript-transformer-worker.js +11 -12
- package/src/tools/esbuild/javascript-transformer.js +4 -1
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "20.0.0
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"builders": "builders.json",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ampproject/remapping": "2.3.0",
|
|
26
|
-
"@angular-devkit/architect": "0.2000.0
|
|
26
|
+
"@angular-devkit/architect": "0.2000.0",
|
|
27
27
|
"@babel/core": "7.27.1",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.27.1",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.7",
|
|
30
30
|
"@inquirer/confirm": "5.1.10",
|
|
31
31
|
"@vitejs/plugin-basic-ssl": "2.0.0",
|
|
32
|
-
"beasties": "0.3.
|
|
32
|
+
"beasties": "0.3.4",
|
|
33
33
|
"browserslist": "^4.23.0",
|
|
34
|
-
"esbuild": "0.25.
|
|
34
|
+
"esbuild": "0.25.5",
|
|
35
35
|
"https-proxy-agent": "7.0.6",
|
|
36
36
|
"istanbul-lib-instrument": "6.0.3",
|
|
37
37
|
"jsonc-parser": "3.3.1",
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
"lmdb": "3.3.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@angular/core": "^20.0.0
|
|
57
|
-
"@angular/compiler": "^20.0.0
|
|
58
|
-
"@angular/compiler-cli": "^20.0.0
|
|
59
|
-
"@angular/localize": "^20.0.0
|
|
60
|
-
"@angular/platform-browser": "^20.0.0
|
|
61
|
-
"@angular/platform-server": "^20.0.0
|
|
62
|
-
"@angular/service-worker": "^20.0.0
|
|
63
|
-
"@angular/ssr": "^20.0.0
|
|
56
|
+
"@angular/core": "^20.0.0",
|
|
57
|
+
"@angular/compiler": "^20.0.0",
|
|
58
|
+
"@angular/compiler-cli": "^20.0.0",
|
|
59
|
+
"@angular/localize": "^20.0.0",
|
|
60
|
+
"@angular/platform-browser": "^20.0.0",
|
|
61
|
+
"@angular/platform-server": "^20.0.0",
|
|
62
|
+
"@angular/service-worker": "^20.0.0",
|
|
63
|
+
"@angular/ssr": "^20.0.0",
|
|
64
64
|
"karma": "^6.4.0",
|
|
65
65
|
"less": "^4.2.0",
|
|
66
|
-
"ng-packagr": "^20.0.0
|
|
66
|
+
"ng-packagr": "^20.0.0",
|
|
67
67
|
"postcss": "^8.4.0",
|
|
68
68
|
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
|
|
69
69
|
"tslib": "^2.3.0",
|
|
@@ -114,13 +114,12 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
|
|
|
114
114
|
// https://nodejs.org/api/process.html#processsetsourcemapsenabledval
|
|
115
115
|
process.setSourceMapsEnabled(true);
|
|
116
116
|
}
|
|
117
|
+
const componentsHmrCanBeUsed = browserOptions.aot && serverOptions.liveReload && serverOptions.hmr;
|
|
117
118
|
// Enable to support link-based component style hot reloading (`NG_HMR_CSTYLES=1` can be used to enable)
|
|
118
|
-
browserOptions.externalRuntimeStyles =
|
|
119
|
-
serverOptions.liveReload && serverOptions.hmr && environment_options_1.useComponentStyleHmr;
|
|
119
|
+
browserOptions.externalRuntimeStyles = componentsHmrCanBeUsed && environment_options_1.useComponentStyleHmr;
|
|
120
120
|
// Enable to support component template hot replacement (`NG_HMR_TEMPLATE=0` can be used to disable selectively)
|
|
121
121
|
// This will also replace file-based/inline styles as code if external runtime styles are not enabled.
|
|
122
|
-
browserOptions.templateUpdates =
|
|
123
|
-
serverOptions.liveReload && serverOptions.hmr && environment_options_1.useComponentTemplateHmr;
|
|
122
|
+
browserOptions.templateUpdates = componentsHmrCanBeUsed && environment_options_1.useComponentTemplateHmr;
|
|
124
123
|
browserOptions.incrementalResults = true;
|
|
125
124
|
// Setup the prebundling transformer that will be shared across Vite prebundling requests
|
|
126
125
|
const prebundleTransformer = new internal_1.JavaScriptTransformer(
|
|
@@ -14,6 +14,12 @@ export interface CompilerPluginOptions {
|
|
|
14
14
|
sourcemap: boolean | 'external';
|
|
15
15
|
tsconfig: string;
|
|
16
16
|
jit?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Include class metadata and JIT information in built code.
|
|
19
|
+
* The Angular TestBed APIs require additional metadata for the Angular aspects of the application
|
|
20
|
+
* such as Components, Modules, Pipes, etc.
|
|
21
|
+
* TestBed may also leverage JIT capabilities during testing (e.g., overrideComponent).
|
|
22
|
+
*/
|
|
17
23
|
includeTestMetadata?: boolean;
|
|
18
24
|
advancedOptimizations?: boolean;
|
|
19
25
|
thirdPartySourcemaps?: boolean;
|
|
@@ -89,7 +89,7 @@ function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBun
|
|
|
89
89
|
sourcemap: !!pluginOptions.sourcemap,
|
|
90
90
|
thirdPartySourcemaps: pluginOptions.thirdPartySourcemaps,
|
|
91
91
|
advancedOptimizations: pluginOptions.advancedOptimizations,
|
|
92
|
-
jit: pluginOptions.jit,
|
|
92
|
+
jit: pluginOptions.jit || pluginOptions.includeTestMetadata,
|
|
93
93
|
}, environment_options_1.maxWorkers, cacheStore?.createCache('jstransformer'));
|
|
94
94
|
// Setup defines based on the values used by the Angular compiler-cli
|
|
95
95
|
build.initialOptions.define ??= {};
|
|
@@ -553,6 +553,7 @@ function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserve
|
|
|
553
553
|
externalRuntimeStyles: pluginOptions.externalRuntimeStyles,
|
|
554
554
|
_enableHmr: !!pluginOptions.templateUpdates,
|
|
555
555
|
supportTestBed: !!pluginOptions.includeTestMetadata,
|
|
556
|
+
supportJitMode: !!pluginOptions.includeTestMetadata,
|
|
556
557
|
};
|
|
557
558
|
};
|
|
558
559
|
}
|
|
@@ -51,6 +51,13 @@ const piscina_1 = __importDefault(require("piscina"));
|
|
|
51
51
|
const load_esm_1 = require("../../utils/load-esm");
|
|
52
52
|
const textDecoder = new TextDecoder();
|
|
53
53
|
const textEncoder = new TextEncoder();
|
|
54
|
+
/**
|
|
55
|
+
* The function name prefix for all Angular partial compilation functions.
|
|
56
|
+
* Used to determine if linking of a JavaScript file is required.
|
|
57
|
+
* If any additional declarations are added or otherwise changed in the linker,
|
|
58
|
+
* the names MUST begin with this prefix.
|
|
59
|
+
*/
|
|
60
|
+
const LINKER_DECLARATION_PREFIX = 'ɵɵngDeclare';
|
|
54
61
|
async function transformJavaScript(request) {
|
|
55
62
|
const { filename, data, ...options } = request;
|
|
56
63
|
const textData = typeof data === 'string' ? data : textDecoder.decode(data);
|
|
@@ -62,10 +69,6 @@ async function transformJavaScript(request) {
|
|
|
62
69
|
* Cached instance of the compiler-cli linker's createEs2015LinkerPlugin function.
|
|
63
70
|
*/
|
|
64
71
|
let linkerPluginCreator;
|
|
65
|
-
/**
|
|
66
|
-
* Cached instance of the compiler-cli linker's needsLinking function.
|
|
67
|
-
*/
|
|
68
|
-
let needsLinking;
|
|
69
72
|
async function transformWithBabel(filename, data, options) {
|
|
70
73
|
const shouldLink = !options.skipLinker && (await requiresLinking(filename, data));
|
|
71
74
|
const useInputSourcemap = options.sourcemap &&
|
|
@@ -120,14 +123,10 @@ async function requiresLinking(path, source) {
|
|
|
120
123
|
if (/[\\/]@angular[\\/](?:compiler|core)|\.tsx?$/.test(path)) {
|
|
121
124
|
return false;
|
|
122
125
|
}
|
|
123
|
-
if
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const linkerModule = await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli/linker');
|
|
128
|
-
needsLinking = linkerModule.needsLinking;
|
|
129
|
-
}
|
|
130
|
-
return needsLinking(path, source);
|
|
126
|
+
// Check if the source code includes one of the declaration functions.
|
|
127
|
+
// There is a low chance of a false positive but the names are fairly unique
|
|
128
|
+
// and the result would be an unnecessary no-op additional plugin pass.
|
|
129
|
+
return source.includes(LINKER_DECLARATION_PREFIX);
|
|
131
130
|
}
|
|
132
131
|
async function createLinkerPlugin(options) {
|
|
133
132
|
linkerPluginCreator ??= (await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli/linker/babel')).createEs2015LinkerPlugin;
|
|
@@ -39,6 +39,9 @@ class JavaScriptTransformer {
|
|
|
39
39
|
this.#fileCacheKeyBase = Buffer.from(JSON.stringify(this.#commonOptions), 'utf-8');
|
|
40
40
|
}
|
|
41
41
|
#ensureWorkerPool() {
|
|
42
|
+
if (this.#workerPool) {
|
|
43
|
+
return this.#workerPool;
|
|
44
|
+
}
|
|
42
45
|
const workerPoolOptions = {
|
|
43
46
|
filename: require.resolve('./javascript-transformer-worker'),
|
|
44
47
|
maxThreads: this.maxThreads,
|
|
@@ -48,7 +51,7 @@ class JavaScriptTransformer {
|
|
|
48
51
|
if (process.execArgv.length !== filteredExecArgv.length) {
|
|
49
52
|
workerPoolOptions.execArgv = filteredExecArgv;
|
|
50
53
|
}
|
|
51
|
-
this.#workerPool
|
|
54
|
+
this.#workerPool = new worker_pool_1.WorkerPool(workerPoolOptions);
|
|
52
55
|
return this.#workerPool;
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
@@ -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
|
|
13
|
+
const VERSION = '20.0.0';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|
package/src/utils/version.js
CHANGED
|
@@ -28,7 +28,7 @@ function assertCompatibleAngularVersion(projectRoot) {
|
|
|
28
28
|
'This likely indicates a corrupted local installation. Please try reinstalling your packages.');
|
|
29
29
|
process.exit(2);
|
|
30
30
|
}
|
|
31
|
-
const supportedAngularSemver = '^20.0.0
|
|
31
|
+
const supportedAngularSemver = '^20.0.0';
|
|
32
32
|
if (angularPkgJson['version'] === '0.0.0' || supportedAngularSemver.startsWith('0.0.0')) {
|
|
33
33
|
// Internal CLI and FW testing version.
|
|
34
34
|
return;
|