@angular/build 19.0.0-next.3 → 19.0.0-next.4
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 +3 -3
- package/src/builders/dev-server/vite-server.d.ts +5 -1
- package/src/builders/dev-server/vite-server.js +14 -10
- package/src/tools/angular/compilation/parallel-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/parallel-compilation.js +5 -0
- package/src/tools/esbuild/javascript-transformer.js +6 -0
- package/src/tools/sass/sass-service.js +6 -0
- package/src/tools/sass/worker.d.ts +13 -32
- package/src/tools/sass/worker.js +1 -0
- package/src/typings.d.ts +7 -0
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/manifest.js +2 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.4",
|
|
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.1900.0-next.
|
|
26
|
+
"@angular-devkit/architect": "0.1900.0-next.4",
|
|
27
27
|
"@babel/core": "7.25.2",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.24.7",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.7",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@angular/localize": "^19.0.0-next.0",
|
|
54
54
|
"@angular/platform-server": "^19.0.0-next.0",
|
|
55
55
|
"@angular/service-worker": "^19.0.0-next.0",
|
|
56
|
-
"@angular/ssr": "^19.0.0-next.
|
|
56
|
+
"@angular/ssr": "^19.0.0-next.4",
|
|
57
57
|
"less": "^4.2.0",
|
|
58
58
|
"postcss": "^8.4.0",
|
|
59
59
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
@@ -20,6 +20,10 @@ interface OutputFileRecord {
|
|
|
20
20
|
servable: boolean;
|
|
21
21
|
type: BuildOutputFileType;
|
|
22
22
|
}
|
|
23
|
+
interface DevServerExternalResultMetadata extends Omit<ExternalResultMetadata, 'explicit'> {
|
|
24
|
+
explicitBrowser: string[];
|
|
25
|
+
explicitServer: string[];
|
|
26
|
+
}
|
|
23
27
|
export type BuilderAction = (options: ApplicationBuilderInternalOptions, context: BuilderContext, plugins?: Plugin[]) => AsyncIterable<Result>;
|
|
24
28
|
export declare function serveWithVite(serverOptions: NormalizedDevServerOptions, builderName: string, builderAction: BuilderAction, context: BuilderContext, transformers?: {
|
|
25
29
|
indexHtml?: (content: string) => Promise<string>;
|
|
@@ -27,6 +31,6 @@ export declare function serveWithVite(serverOptions: NormalizedDevServerOptions,
|
|
|
27
31
|
middleware?: Connect.NextHandleFunction[];
|
|
28
32
|
buildPlugins?: Plugin[];
|
|
29
33
|
}): AsyncIterableIterator<DevServerBuilderOutput>;
|
|
30
|
-
export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata:
|
|
34
|
+
export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata: DevServerExternalResultMetadata, ssr: boolean, prebundleTransformer: JavaScriptTransformer, target: string[], zoneless: boolean, prebundleLoaderExtensions: EsbuildLoaderOption | undefined, extensionMiddleware?: Connect.NextHandleFunction[], indexHtmlTransformer?: (content: string) => Promise<string>, thirdPartySourcemaps?: boolean): Promise<InlineConfig>;
|
|
31
35
|
type EsbuildLoaderOption = Exclude<DepOptimizationConfig['esbuildOptions'], undefined>['loader'];
|
|
32
36
|
export {};
|
|
@@ -107,7 +107,8 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
|
|
|
107
107
|
const externalMetadata = {
|
|
108
108
|
implicitBrowser: [],
|
|
109
109
|
implicitServer: [],
|
|
110
|
-
|
|
110
|
+
explicitBrowser: [],
|
|
111
|
+
explicitServer: [],
|
|
111
112
|
};
|
|
112
113
|
// Add cleanup logic via a builder teardown.
|
|
113
114
|
let deferred;
|
|
@@ -187,15 +188,18 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
|
|
|
187
188
|
requiresServerRestart = implicitServerFiltered.some((dep) => !previousImplicitServer.has(dep));
|
|
188
189
|
}
|
|
189
190
|
// Empty Arrays to avoid growing unlimited with every re-build.
|
|
190
|
-
externalMetadata.
|
|
191
|
+
externalMetadata.explicitBrowser.length = 0;
|
|
192
|
+
externalMetadata.explicitServer.length = 0;
|
|
191
193
|
externalMetadata.implicitServer.length = 0;
|
|
192
194
|
externalMetadata.implicitBrowser.length = 0;
|
|
193
|
-
externalMetadata.
|
|
195
|
+
externalMetadata.explicitBrowser.push(...explicit);
|
|
196
|
+
externalMetadata.explicitServer.push(...explicit, ...nodeJsBuiltinModules);
|
|
194
197
|
externalMetadata.implicitServer.push(...implicitServerFiltered);
|
|
195
198
|
externalMetadata.implicitBrowser.push(...implicitBrowserFiltered);
|
|
196
199
|
// The below needs to be sorted as Vite uses these options are part of the hashing invalidation algorithm.
|
|
197
200
|
// See: https://github.com/vitejs/vite/blob/0873bae0cfe0f0718ad2f5743dd34a17e4ab563d/packages/vite/src/node/optimizer/index.ts#L1203-L1239
|
|
198
|
-
externalMetadata.
|
|
201
|
+
externalMetadata.explicitBrowser.sort();
|
|
202
|
+
externalMetadata.explicitServer.sort();
|
|
199
203
|
externalMetadata.implicitServer.sort();
|
|
200
204
|
externalMetadata.implicitBrowser.sort();
|
|
201
205
|
}
|
|
@@ -433,18 +437,18 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
|
|
|
433
437
|
},
|
|
434
438
|
// This is needed when `externalDependencies` is used to prevent Vite load errors.
|
|
435
439
|
// NOTE: If Vite adds direct support for externals, this can be removed.
|
|
436
|
-
preTransformRequests: externalMetadata.
|
|
440
|
+
preTransformRequests: externalMetadata.explicitBrowser.length === 0,
|
|
437
441
|
},
|
|
438
442
|
ssr: {
|
|
439
443
|
// Note: `true` and `/.*/` have different sematics. When true, the `external` option is ignored.
|
|
440
444
|
noExternal: /.*/,
|
|
441
445
|
// Exclude any Node.js built in module and provided dependencies (currently build defined externals)
|
|
442
|
-
external: externalMetadata.
|
|
446
|
+
external: externalMetadata.explicitServer,
|
|
443
447
|
optimizeDeps: getDepOptimizationConfig({
|
|
444
448
|
// Only enable with caching since it causes prebundle dependencies to be cached
|
|
445
449
|
disabled: serverOptions.prebundle === false,
|
|
446
450
|
// Exclude any explicitly defined dependencies (currently build defined externals and node.js built-ins)
|
|
447
|
-
exclude: externalMetadata.
|
|
451
|
+
exclude: externalMetadata.explicitServer,
|
|
448
452
|
// Include all implict dependencies from the external packages internal option
|
|
449
453
|
include: externalMetadata.implicitServer,
|
|
450
454
|
ssr: true,
|
|
@@ -463,19 +467,19 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
|
|
|
463
467
|
outputFiles,
|
|
464
468
|
assets,
|
|
465
469
|
ssr,
|
|
466
|
-
external: externalMetadata.
|
|
470
|
+
external: externalMetadata.explicitBrowser,
|
|
467
471
|
indexHtmlTransformer,
|
|
468
472
|
extensionMiddleware,
|
|
469
473
|
normalizePath,
|
|
470
474
|
}),
|
|
471
|
-
(0, id_prefix_plugin_1.createRemoveIdPrefixPlugin)(externalMetadata.
|
|
475
|
+
(0, id_prefix_plugin_1.createRemoveIdPrefixPlugin)(externalMetadata.explicitBrowser),
|
|
472
476
|
],
|
|
473
477
|
// Browser only optimizeDeps. (This does not run for SSR dependencies).
|
|
474
478
|
optimizeDeps: getDepOptimizationConfig({
|
|
475
479
|
// Only enable with caching since it causes prebundle dependencies to be cached
|
|
476
480
|
disabled: serverOptions.prebundle === false,
|
|
477
481
|
// Exclude any explicitly defined dependencies (currently build defined externals)
|
|
478
|
-
exclude: externalMetadata.
|
|
482
|
+
exclude: externalMetadata.explicitBrowser,
|
|
479
483
|
// Include all implict dependencies from the external packages internal option
|
|
480
484
|
include: externalMetadata.implicitBrowser,
|
|
481
485
|
ssr: false,
|
|
@@ -22,7 +22,7 @@ export declare class ParallelCompilation extends AngularCompilation {
|
|
|
22
22
|
#private;
|
|
23
23
|
readonly jit: boolean;
|
|
24
24
|
constructor(jit: boolean);
|
|
25
|
-
initialize(tsconfig: string, hostOptions: AngularHostOptions, compilerOptionsTransformer?: (
|
|
25
|
+
initialize(tsconfig: string, hostOptions: AngularHostOptions, compilerOptionsTransformer?: (compilerOptions: CompilerOptions) => CompilerOptions): Promise<{
|
|
26
26
|
affectedFiles: ReadonlySet<SourceFile>;
|
|
27
27
|
compilerOptions: CompilerOptions;
|
|
28
28
|
referencedFiles: readonly string[];
|
|
@@ -40,6 +40,11 @@ class ParallelCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
40
40
|
useAtomics: !process.versions.webcontainer,
|
|
41
41
|
filename: localRequire.resolve('./parallel-worker'),
|
|
42
42
|
recordTiming: false,
|
|
43
|
+
env: {
|
|
44
|
+
...process.env,
|
|
45
|
+
// Enable compile code caching if enabled for the main process (only exists on Node.js v22.8+)
|
|
46
|
+
'NODE_COMPILE_CACHE': (0, node_module_1.getCompileCacheDir)?.(),
|
|
47
|
+
},
|
|
43
48
|
});
|
|
44
49
|
}
|
|
45
50
|
initialize(tsconfig, hostOptions, compilerOptionsTransformer) {
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.JavaScriptTransformer = void 0;
|
|
14
14
|
const node_crypto_1 = require("node:crypto");
|
|
15
15
|
const promises_1 = require("node:fs/promises");
|
|
16
|
+
const node_module_1 = require("node:module");
|
|
16
17
|
const piscina_1 = __importDefault(require("piscina"));
|
|
17
18
|
/**
|
|
18
19
|
* A class that performs transformation of JavaScript files and raw data.
|
|
@@ -48,6 +49,11 @@ class JavaScriptTransformer {
|
|
|
48
49
|
// Shutdown idle threads after 1 second of inactivity
|
|
49
50
|
idleTimeout: 1000,
|
|
50
51
|
recordTiming: false,
|
|
52
|
+
env: {
|
|
53
|
+
...process.env,
|
|
54
|
+
// Enable compile code caching if enabled for the main process (only exists on Node.js v22.8+)
|
|
55
|
+
'NODE_COMPILE_CACHE': (0, node_module_1.getCompileCacheDir)?.(),
|
|
56
|
+
},
|
|
51
57
|
});
|
|
52
58
|
return this.#workerPool;
|
|
53
59
|
}
|
|
@@ -64,6 +64,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
64
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
65
|
exports.SassWorkerImplementation = void 0;
|
|
66
66
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
67
|
+
const node_module_1 = require("node:module");
|
|
67
68
|
const node_url_1 = require("node:url");
|
|
68
69
|
const node_worker_threads_1 = require("node:worker_threads");
|
|
69
70
|
const piscina_1 = require("piscina");
|
|
@@ -100,6 +101,11 @@ class SassWorkerImplementation {
|
|
|
100
101
|
// Shutdown idle threads after 1 second of inactivity
|
|
101
102
|
idleTimeout: 1000,
|
|
102
103
|
recordTiming: false,
|
|
104
|
+
env: {
|
|
105
|
+
...process.env,
|
|
106
|
+
// Enable compile code caching if enabled for the main process (only exists on Node.js v22.8+)
|
|
107
|
+
'NODE_COMPILE_CACHE': (0, node_module_1.getCompileCacheDir)?.(),
|
|
108
|
+
},
|
|
103
109
|
});
|
|
104
110
|
return this.#workerPool;
|
|
105
111
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
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 { RawSourceMap } from '@ampproject/remapping';
|
|
8
9
|
import { MessagePort } from 'node:worker_threads';
|
|
9
10
|
import { SourceSpan, StringOptions } from 'sass';
|
|
10
11
|
import type { SerializableWarningMessage } from './sass-service';
|
|
@@ -38,45 +39,25 @@ interface RenderRequestMessage {
|
|
|
38
39
|
*/
|
|
39
40
|
rebase: boolean;
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
interface RenderResult {
|
|
42
43
|
warnings: SerializableWarningMessage[] | undefined;
|
|
43
44
|
result: {
|
|
44
|
-
loadedUrls: string[];
|
|
45
45
|
css: string;
|
|
46
|
-
|
|
46
|
+
loadedUrls: string[];
|
|
47
|
+
sourceMap?: RawSourceMap;
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
}
|
|
50
|
+
interface RenderError {
|
|
50
51
|
warnings: SerializableWarningMessage[] | undefined;
|
|
51
52
|
error: {
|
|
52
|
-
|
|
53
|
+
message: string;
|
|
54
|
+
stack?: string;
|
|
55
|
+
span?: Omit<SourceSpan, 'url'> & {
|
|
53
56
|
url?: string;
|
|
54
57
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
sassMessage: string;
|
|
58
|
-
sassStack: string;
|
|
59
|
-
};
|
|
60
|
-
result?: undefined;
|
|
61
|
-
} | {
|
|
62
|
-
warnings: SerializableWarningMessage[] | undefined;
|
|
63
|
-
error: {
|
|
64
|
-
message: string;
|
|
65
|
-
stack: string | undefined;
|
|
66
|
-
span?: undefined;
|
|
67
|
-
sassMessage?: undefined;
|
|
68
|
-
sassStack?: undefined;
|
|
58
|
+
sassMessage?: string;
|
|
59
|
+
sassStack?: string;
|
|
69
60
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
warnings: SerializableWarningMessage[] | undefined;
|
|
73
|
-
error: {
|
|
74
|
-
message: string;
|
|
75
|
-
span?: undefined;
|
|
76
|
-
stack?: undefined;
|
|
77
|
-
sassMessage?: undefined;
|
|
78
|
-
sassStack?: undefined;
|
|
79
|
-
};
|
|
80
|
-
result?: undefined;
|
|
81
|
-
}>;
|
|
61
|
+
}
|
|
62
|
+
export default function renderSassStylesheet(request: RenderRequestMessage): Promise<RenderResult | RenderError>;
|
|
82
63
|
export {};
|
package/src/tools/sass/worker.js
CHANGED
|
@@ -95,6 +95,7 @@ async function renderSassStylesheet(request) {
|
|
|
95
95
|
warnings,
|
|
96
96
|
result: {
|
|
97
97
|
...result,
|
|
98
|
+
sourceMap: result.sourceMap,
|
|
98
99
|
// URL is not serializable so to convert to string here and back to URL in the parent.
|
|
99
100
|
loadedUrls: result.loadedUrls.map((p) => (0, node_url_1.fileURLToPath)(p)),
|
|
100
101
|
},
|
package/src/typings.d.ts
CHANGED
|
@@ -17,3 +17,10 @@
|
|
|
17
17
|
declare module 'esbuild' {
|
|
18
18
|
export * from 'esbuild-wasm';
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Augment the Node.js module builtin types to support the v22.8+ compile cache functions
|
|
23
|
+
*/
|
|
24
|
+
declare module 'node:module' {
|
|
25
|
+
function getCompileCacheDir(): string | undefined;
|
|
26
|
+
}
|
|
@@ -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 = '19.0.0-next.
|
|
13
|
+
const VERSION = '19.0.0-next.4';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|
|
@@ -70,15 +70,13 @@ function generateAngularServerAppManifest(additionalHtmlOutputFiles, outputFiles
|
|
|
70
70
|
for (const file of [...additionalHtmlOutputFiles.values(), ...outputFiles]) {
|
|
71
71
|
if (file.path === options_1.INDEX_HTML_SERVER ||
|
|
72
72
|
file.path === options_1.INDEX_HTML_CSR ||
|
|
73
|
-
file.path.endsWith('.css')) {
|
|
73
|
+
(inlineCriticalCss && file.path.endsWith('.css'))) {
|
|
74
74
|
serverAssetsContent.push(`['${file.path}', async () => ${JSON.stringify(file.text)}]`);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
const manifestContent = `
|
|
78
|
-
import bootstrap from './main.server.mjs';
|
|
79
|
-
|
|
80
78
|
export default {
|
|
81
|
-
bootstrap: () =>
|
|
79
|
+
bootstrap: () => import('./main.server.mjs').then(m => m.default),
|
|
82
80
|
inlineCriticalCss: ${inlineCriticalCss},
|
|
83
81
|
routes: ${JSON.stringify(routes, undefined, 2)},
|
|
84
82
|
assets: new Map([${serverAssetsContent.join(', \n')}]),
|