@angular/build 19.0.0-next.0 → 19.0.0-next.1
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 +7 -7
- package/src/builders/extract-i18n/application-extraction.js +4 -0
- package/src/tools/angular/compilation/jit-compilation.js +2 -1
- package/src/tools/esbuild/angular/compiler-plugin.js +3 -1
- package/src/tools/esbuild/application-code-bundle.js +0 -25
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/prerender.js +16 -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.1",
|
|
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.1",
|
|
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",
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
"@vitejs/plugin-basic-ssl": "1.1.0",
|
|
33
33
|
"browserslist": "^4.23.0",
|
|
34
34
|
"critters": "0.0.24",
|
|
35
|
-
"esbuild": "0.23.
|
|
35
|
+
"esbuild": "0.23.1",
|
|
36
36
|
"fast-glob": "3.3.2",
|
|
37
37
|
"https-proxy-agent": "7.0.5",
|
|
38
38
|
"listr2": "8.2.4",
|
|
39
|
-
"lmdb": "3.0.
|
|
39
|
+
"lmdb": "3.0.14",
|
|
40
40
|
"magic-string": "0.30.11",
|
|
41
41
|
"mrmime": "2.0.0",
|
|
42
42
|
"parse5-html-rewriting-stream": "7.0.0",
|
|
43
43
|
"picomatch": "4.0.2",
|
|
44
44
|
"piscina": "4.6.1",
|
|
45
|
-
"rollup": "4.
|
|
45
|
+
"rollup": "4.21.0",
|
|
46
46
|
"sass": "1.77.8",
|
|
47
47
|
"semver": "7.6.3",
|
|
48
|
-
"vite": "5.4.
|
|
48
|
+
"vite": "5.4.2",
|
|
49
49
|
"watchpack": "2.4.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -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.1",
|
|
57
57
|
"less": "^4.2.0",
|
|
58
58
|
"postcss": "^8.4.0",
|
|
59
59
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
@@ -11,6 +11,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.extractMessages = extractMessages;
|
|
14
|
+
const node_fs_1 = require("node:fs");
|
|
14
15
|
const node_path_1 = __importDefault(require("node:path"));
|
|
15
16
|
const application_1 = require("../application");
|
|
16
17
|
const results_1 = require("../application/results");
|
|
@@ -72,6 +73,9 @@ function setupLocalizeExtractor(extractorConstructor, files, context) {
|
|
|
72
73
|
if (file?.origin === 'memory') {
|
|
73
74
|
content = textDecoder.decode(file.contents);
|
|
74
75
|
}
|
|
76
|
+
else if (file?.origin === 'disk') {
|
|
77
|
+
content = (0, node_fs_1.readFileSync)(file.inputPath, 'utf-8');
|
|
78
|
+
}
|
|
75
79
|
if (content === undefined) {
|
|
76
80
|
throw new Error('Unknown file requested: ' + requestedPath);
|
|
77
81
|
}
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.JitCompilation = void 0;
|
|
14
14
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
15
15
|
const typescript_1 = __importDefault(require("typescript"));
|
|
16
|
+
const load_esm_1 = require("../../../utils/load-esm");
|
|
16
17
|
const profiling_1 = require("../../esbuild/profiling");
|
|
17
18
|
const angular_host_1 = require("../angular-host");
|
|
18
19
|
const jit_resource_transformer_1 = require("../transformers/jit-resource-transformer");
|
|
@@ -36,7 +37,7 @@ class JitCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
36
37
|
#state;
|
|
37
38
|
async initialize(tsconfig, hostOptions, compilerOptionsTransformer) {
|
|
38
39
|
// Dynamically load the Angular compiler CLI package
|
|
39
|
-
const { constructorParametersDownlevelTransform } = await
|
|
40
|
+
const { constructorParametersDownlevelTransform } = await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli/private/tooling');
|
|
40
41
|
// Load the compiler configuration and transform as needed
|
|
41
42
|
const { options: originalCompilerOptions, rootNames, errors: configurationDiagnostics, } = await this.loadConfiguration(tsconfig);
|
|
42
43
|
const compilerOptions = compilerOptionsTransformer?.(originalCompilerOptions) ?? originalCompilerOptions;
|
|
@@ -145,7 +145,9 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
|
|
145
145
|
stylesheetResult = await stylesheetBundler.bundleFile(stylesheetFile);
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
148
|
-
stylesheetResult = await stylesheetBundler.bundleInline(data, containingFile,
|
|
148
|
+
stylesheetResult = await stylesheetBundler.bundleInline(data, containingFile,
|
|
149
|
+
// Inline stylesheets from a template style element are always CSS
|
|
150
|
+
containingFile.endsWith('.html') ? 'css' : styleOptions.inlineStyleLanguage);
|
|
149
151
|
}
|
|
150
152
|
const { contents, outputFiles, metafile, referencedFiles, errors, warnings } = stylesheetResult;
|
|
151
153
|
if (errors) {
|
|
@@ -322,12 +322,10 @@ function getEsBuildCommonPolyfillsOptions(options, namespace, tryToResolvePolyfi
|
|
|
322
322
|
namespace,
|
|
323
323
|
cache: sourceFileCache?.loadResultCache,
|
|
324
324
|
loadContent: async (_, build) => {
|
|
325
|
-
let hasLocalizePolyfill = false;
|
|
326
325
|
let polyfillPaths = polyfills;
|
|
327
326
|
let warnings;
|
|
328
327
|
if (tryToResolvePolyfillsAsRelative) {
|
|
329
328
|
polyfillPaths = await Promise.all(polyfills.map(async (path) => {
|
|
330
|
-
hasLocalizePolyfill ||= path.startsWith('@angular/localize');
|
|
331
329
|
if (path.startsWith('zone.js') || !(0, node_path_1.extname)(path)) {
|
|
332
330
|
return path;
|
|
333
331
|
}
|
|
@@ -339,29 +337,6 @@ function getEsBuildCommonPolyfillsOptions(options, namespace, tryToResolvePolyfi
|
|
|
339
337
|
return result.path ? potentialPathRelative : path;
|
|
340
338
|
}));
|
|
341
339
|
}
|
|
342
|
-
else {
|
|
343
|
-
hasLocalizePolyfill = polyfills.some((p) => p.startsWith('@angular/localize'));
|
|
344
|
-
}
|
|
345
|
-
// Add localize polyfill if needed.
|
|
346
|
-
// TODO: remove in version 19 or later.
|
|
347
|
-
if (!i18nOptions.shouldInline && !hasLocalizePolyfill) {
|
|
348
|
-
const result = await build.resolve('@angular/localize', {
|
|
349
|
-
kind: 'import-statement',
|
|
350
|
-
resolveDir: workspaceRoot,
|
|
351
|
-
});
|
|
352
|
-
if (result.path) {
|
|
353
|
-
polyfillPaths.push('@angular/localize/init');
|
|
354
|
-
(warnings ??= []).push({
|
|
355
|
-
text: 'Polyfill for "@angular/localize/init" was added automatically.',
|
|
356
|
-
notes: [
|
|
357
|
-
{
|
|
358
|
-
text: 'In the future, this functionality will be removed. ' +
|
|
359
|
-
'Please add this polyfill in the "polyfills" section of your "angular.json" instead.',
|
|
360
|
-
},
|
|
361
|
-
],
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
340
|
// Generate module contents with an import statement per defined polyfill
|
|
366
341
|
let contents = polyfillPaths
|
|
367
342
|
.map((file) => `import '${file.replace(/\\/g, '/')}';`)
|
|
@@ -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.1';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|
|
@@ -49,11 +49,14 @@ async function prerenderPages(workspaceRoot, appShellOptions = {}, prerenderOpti
|
|
|
49
49
|
assetsReversed[addLeadingSlash(destination.replace(/\\/g, node_path_1.posix.sep))] = source;
|
|
50
50
|
}
|
|
51
51
|
// Get routes to prerender
|
|
52
|
-
const { routes: allRoutes, warnings: routesWarnings } = await getAllRoutes(workspaceRoot, outputFilesForWorker, assetsReversed, document, appShellOptions, prerenderOptions, sourcemap, verbose);
|
|
52
|
+
const { routes: allRoutes, warnings: routesWarnings, errors: routesErrors, } = await getAllRoutes(workspaceRoot, outputFilesForWorker, assetsReversed, document, appShellOptions, prerenderOptions, sourcemap, verbose);
|
|
53
|
+
if (routesErrors?.length) {
|
|
54
|
+
errors.push(...routesErrors);
|
|
55
|
+
}
|
|
53
56
|
if (routesWarnings?.length) {
|
|
54
57
|
warnings.push(...routesWarnings);
|
|
55
58
|
}
|
|
56
|
-
if (allRoutes.size < 1) {
|
|
59
|
+
if (allRoutes.size < 1 || errors.length > 0) {
|
|
57
60
|
return {
|
|
58
61
|
errors,
|
|
59
62
|
warnings,
|
|
@@ -109,7 +112,8 @@ async function renderPages(sourcemap, allRoutes, maxThreads, workspaceRoot, outp
|
|
|
109
112
|
const isAppShellRoute = appShellRoute === route;
|
|
110
113
|
const serverContext = isAppShellRoute ? 'app-shell' : 'ssg';
|
|
111
114
|
const render = renderWorker.run({ route, serverContext });
|
|
112
|
-
const renderResult = render
|
|
115
|
+
const renderResult = render
|
|
116
|
+
.then(({ content, warnings, errors }) => {
|
|
113
117
|
if (content !== undefined) {
|
|
114
118
|
const outPath = isAppShellRoute
|
|
115
119
|
? 'index.html'
|
|
@@ -122,6 +126,10 @@ async function renderPages(sourcemap, allRoutes, maxThreads, workspaceRoot, outp
|
|
|
122
126
|
if (errors) {
|
|
123
127
|
errors.push(...errors);
|
|
124
128
|
}
|
|
129
|
+
})
|
|
130
|
+
.catch((err) => {
|
|
131
|
+
errors.push(`An error occurred while prerendering route '${route}'.\n\n${err.stack}`);
|
|
132
|
+
void renderWorker.destroy();
|
|
125
133
|
});
|
|
126
134
|
renderingPromises.push(renderResult);
|
|
127
135
|
}
|
|
@@ -173,15 +181,19 @@ async function getAllRoutes(workspaceRoot, outputFilesForWorker, assetFilesForWo
|
|
|
173
181
|
execArgv: workerExecArgv,
|
|
174
182
|
recordTiming: false,
|
|
175
183
|
});
|
|
184
|
+
const errors = [];
|
|
176
185
|
const { routes: extractedRoutes, warnings } = await renderWorker
|
|
177
186
|
.run({})
|
|
187
|
+
.catch((err) => {
|
|
188
|
+
errors.push(`An error occurred while extracting routes.\n\n${err.stack}`);
|
|
189
|
+
})
|
|
178
190
|
.finally(() => {
|
|
179
191
|
void renderWorker.destroy();
|
|
180
192
|
});
|
|
181
193
|
for (const route of extractedRoutes) {
|
|
182
194
|
routes.add(route);
|
|
183
195
|
}
|
|
184
|
-
return { routes, warnings };
|
|
196
|
+
return { routes, warnings, errors };
|
|
185
197
|
}
|
|
186
198
|
function addLeadingSlash(value) {
|
|
187
199
|
return value.charAt(0) === '/' ? value : '/' + value;
|