@angular/build 19.1.2 → 19.1.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/application/build-action.js +92 -87
- package/src/builders/application/index.d.ts +1 -2
- package/src/builders/application/options.js +1 -1
- package/src/builders/application/schema.d.ts +36 -36
- package/src/builders/dev-server/index.d.ts +1 -2
- package/src/builders/dev-server/schema.d.ts +4 -4
- package/src/builders/extract-i18n/index.d.ts +1 -2
- package/src/builders/extract-i18n/schema.d.ts +2 -2
- package/src/builders/ng-packagr/index.d.ts +1 -2
- package/src/builders/ng-packagr/schema.d.ts +2 -2
- package/src/tools/angular/compilation/aot-compilation.js +5 -1
- package/src/tools/vite/middlewares/component-middleware.d.ts +2 -2
- package/src/tools/vite/middlewares/component-middleware.js +4 -2
- package/src/tools/vite/plugins/angular-memory-plugin.js +1 -2
- package/src/tools/vite/plugins/setup-middlewares-plugin.js +1 -1
- package/src/utils/i18n-options.d.ts +1 -1
- package/src/utils/i18n-options.js +24 -20
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/prerender.js +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "19.1.
|
|
3
|
+
"version": "19.1.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.1901.
|
|
26
|
+
"@angular-devkit/architect": "0.1901.4",
|
|
27
27
|
"@babel/core": "7.26.0",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.25.9",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.7",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@angular/localize": "^19.0.0",
|
|
58
58
|
"@angular/platform-server": "^19.0.0",
|
|
59
59
|
"@angular/service-worker": "^19.0.0",
|
|
60
|
-
"@angular/ssr": "^19.1.
|
|
60
|
+
"@angular/ssr": "^19.1.4",
|
|
61
61
|
"less": "^4.2.0",
|
|
62
62
|
"ng-packagr": "^19.0.0",
|
|
63
63
|
"postcss": "^8.4.0",
|
|
@@ -187,30 +187,11 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
|
|
|
187
187
|
};
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
kind: results_1.ResultKind.ComponentUpdate,
|
|
195
|
-
updates: Array.from(templateUpdates, ([id, content]) => ({
|
|
196
|
-
type: 'template',
|
|
197
|
-
id,
|
|
198
|
-
content,
|
|
199
|
-
})),
|
|
200
|
-
};
|
|
201
|
-
yield updateResult;
|
|
202
|
-
}
|
|
203
|
-
// Use an incremental result if previous output information is available
|
|
204
|
-
if (rebuildState && changes) {
|
|
205
|
-
const { previousAssetsInfo, previousOutputInfo } = rebuildState;
|
|
206
|
-
const incrementalResult = {
|
|
207
|
-
kind: results_1.ResultKind.Incremental,
|
|
190
|
+
// Use a full result if there is no rebuild state (no prior build result)
|
|
191
|
+
if (!rebuildState || !changes) {
|
|
192
|
+
const result = {
|
|
193
|
+
kind: results_1.ResultKind.Full,
|
|
208
194
|
warnings: warnings,
|
|
209
|
-
// These files need to be updated in the dev server but should not signal any updates
|
|
210
|
-
background: hasTemplateUpdates,
|
|
211
|
-
added: [],
|
|
212
|
-
removed: [],
|
|
213
|
-
modified: [],
|
|
214
195
|
files: {},
|
|
215
196
|
detail: {
|
|
216
197
|
externalMetadata,
|
|
@@ -219,67 +200,37 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
|
|
|
219
200
|
outputOptions,
|
|
220
201
|
},
|
|
221
202
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
for (const file of outputFiles) {
|
|
225
|
-
removedOutputFiles.delete(file.path);
|
|
226
|
-
const previousHash = previousOutputInfo.get(file.path)?.hash;
|
|
227
|
-
let needFile = false;
|
|
228
|
-
if (previousHash === undefined) {
|
|
229
|
-
needFile = true;
|
|
230
|
-
incrementalResult.added.push(file.path);
|
|
231
|
-
}
|
|
232
|
-
else if (previousHash !== file.hash) {
|
|
233
|
-
needFile = true;
|
|
234
|
-
incrementalResult.modified.push(file.path);
|
|
235
|
-
}
|
|
236
|
-
if (needFile) {
|
|
237
|
-
// Updates to non-JS files must signal an update with the dev server
|
|
238
|
-
if (!/(?:\.m?js|\.map)?$/.test(file.path)) {
|
|
239
|
-
incrementalResult.background = false;
|
|
240
|
-
}
|
|
241
|
-
incrementalResult.files[file.path] = {
|
|
242
|
-
type: file.type,
|
|
243
|
-
contents: file.contents,
|
|
244
|
-
origin: 'memory',
|
|
245
|
-
hash: file.hash,
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
// Initially assume all previous assets files have been removed
|
|
250
|
-
const removedAssetFiles = new Map(previousAssetsInfo);
|
|
251
|
-
for (const { source, destination } of assetFiles) {
|
|
252
|
-
removedAssetFiles.delete(source);
|
|
253
|
-
if (!previousAssetsInfo.has(source)) {
|
|
254
|
-
incrementalResult.added.push(destination);
|
|
255
|
-
}
|
|
256
|
-
else if (changes.modified.has(source)) {
|
|
257
|
-
incrementalResult.modified.push(destination);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
incrementalResult.files[destination] = {
|
|
203
|
+
for (const file of assetFiles) {
|
|
204
|
+
result.files[file.destination] = {
|
|
263
205
|
type: bundler_context_1.BuildOutputFileType.Browser,
|
|
264
|
-
inputPath: source,
|
|
206
|
+
inputPath: file.source,
|
|
265
207
|
origin: 'disk',
|
|
266
208
|
};
|
|
267
209
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
yield
|
|
210
|
+
for (const file of outputFiles) {
|
|
211
|
+
result.files[file.path] = {
|
|
212
|
+
type: file.type,
|
|
213
|
+
contents: file.contents,
|
|
214
|
+
origin: 'memory',
|
|
215
|
+
hash: file.hash,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
yield result;
|
|
277
219
|
return;
|
|
278
220
|
}
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
|
|
221
|
+
// Template updates only exist if no other JS changes have occurred.
|
|
222
|
+
// A full page reload may be required based on the following incremental output change analysis.
|
|
223
|
+
const hasTemplateUpdates = !!templateUpdates?.size;
|
|
224
|
+
// Use an incremental result if previous output information is available
|
|
225
|
+
const { previousAssetsInfo, previousOutputInfo } = rebuildState;
|
|
226
|
+
const incrementalResult = {
|
|
227
|
+
kind: results_1.ResultKind.Incremental,
|
|
282
228
|
warnings: warnings,
|
|
229
|
+
// Initially attempt to use a background update of files to support component updates.
|
|
230
|
+
background: hasTemplateUpdates,
|
|
231
|
+
added: [],
|
|
232
|
+
removed: [],
|
|
233
|
+
modified: [],
|
|
283
234
|
files: {},
|
|
284
235
|
detail: {
|
|
285
236
|
externalMetadata,
|
|
@@ -288,20 +239,74 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
|
|
|
288
239
|
outputOptions,
|
|
289
240
|
},
|
|
290
241
|
};
|
|
291
|
-
|
|
292
|
-
|
|
242
|
+
// Initially assume all previous output files have been removed
|
|
243
|
+
const removedOutputFiles = new Map(previousOutputInfo);
|
|
244
|
+
for (const file of outputFiles) {
|
|
245
|
+
removedOutputFiles.delete(file.path);
|
|
246
|
+
const previousHash = previousOutputInfo.get(file.path)?.hash;
|
|
247
|
+
let needFile = false;
|
|
248
|
+
if (previousHash === undefined) {
|
|
249
|
+
needFile = true;
|
|
250
|
+
incrementalResult.added.push(file.path);
|
|
251
|
+
}
|
|
252
|
+
else if (previousHash !== file.hash) {
|
|
253
|
+
needFile = true;
|
|
254
|
+
incrementalResult.modified.push(file.path);
|
|
255
|
+
}
|
|
256
|
+
if (needFile) {
|
|
257
|
+
// Updates to non-JS files must signal an update with the dev server
|
|
258
|
+
if (!/(?:\.m?js|\.map)$/.test(file.path)) {
|
|
259
|
+
incrementalResult.background = false;
|
|
260
|
+
}
|
|
261
|
+
incrementalResult.files[file.path] = {
|
|
262
|
+
type: file.type,
|
|
263
|
+
contents: file.contents,
|
|
264
|
+
origin: 'memory',
|
|
265
|
+
hash: file.hash,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// Initially assume all previous assets files have been removed
|
|
270
|
+
const removedAssetFiles = new Map(previousAssetsInfo);
|
|
271
|
+
for (const { source, destination } of assetFiles) {
|
|
272
|
+
removedAssetFiles.delete(source);
|
|
273
|
+
if (!previousAssetsInfo.has(source)) {
|
|
274
|
+
incrementalResult.added.push(destination);
|
|
275
|
+
incrementalResult.background = false;
|
|
276
|
+
}
|
|
277
|
+
else if (changes.modified.has(source)) {
|
|
278
|
+
incrementalResult.modified.push(destination);
|
|
279
|
+
incrementalResult.background = false;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
incrementalResult.files[destination] = {
|
|
293
285
|
type: bundler_context_1.BuildOutputFileType.Browser,
|
|
294
|
-
inputPath:
|
|
286
|
+
inputPath: source,
|
|
295
287
|
origin: 'disk',
|
|
296
288
|
};
|
|
297
289
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
290
|
+
// Include the removed output and asset files
|
|
291
|
+
incrementalResult.removed.push(...Array.from(removedOutputFiles, ([file, { type }]) => ({
|
|
292
|
+
path: file,
|
|
293
|
+
type,
|
|
294
|
+
})), ...Array.from(removedAssetFiles.values(), (file) => ({
|
|
295
|
+
path: file,
|
|
296
|
+
type: bundler_context_1.BuildOutputFileType.Browser,
|
|
297
|
+
})));
|
|
298
|
+
yield incrementalResult;
|
|
299
|
+
// If there are template updates and the incremental update was background only, a component
|
|
300
|
+
// update is possible.
|
|
301
|
+
if (hasTemplateUpdates && incrementalResult.background) {
|
|
302
|
+
const updateResult = {
|
|
303
|
+
kind: results_1.ResultKind.ComponentUpdate,
|
|
304
|
+
updates: Array.from(templateUpdates, ([id, content]) => ({
|
|
305
|
+
type: 'template',
|
|
306
|
+
id,
|
|
307
|
+
content,
|
|
308
|
+
})),
|
|
304
309
|
};
|
|
310
|
+
yield updateResult;
|
|
305
311
|
}
|
|
306
|
-
yield result;
|
|
307
312
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Builder, BuilderContext, BuilderOutput } from '@angular-devkit/architect';
|
|
9
|
-
import { json } from '@angular-devkit/core';
|
|
10
9
|
import { ApplicationBuilderExtensions, ApplicationBuilderInternalOptions } from './options';
|
|
11
10
|
import { Result } from './results';
|
|
12
11
|
import { Schema as ApplicationBuilderOptions } from './schema';
|
|
@@ -29,5 +28,5 @@ export declare function buildApplicationInternal(options: ApplicationBuilderInte
|
|
|
29
28
|
* @returns The build output results of the build.
|
|
30
29
|
*/
|
|
31
30
|
export declare function buildApplication(options: ApplicationBuilderOptions, context: BuilderContext, extensions?: ApplicationBuilderExtensions): AsyncIterable<BuilderOutput>;
|
|
32
|
-
declare const builder: Builder<ApplicationBuilderOptions
|
|
31
|
+
declare const builder: Builder<ApplicationBuilderOptions>;
|
|
33
32
|
export default builder;
|
|
@@ -63,7 +63,7 @@ async function normalizeOptions(context, projectName, options, extensions) {
|
|
|
63
63
|
// Gather persistent caching option and provide a project specific cache location
|
|
64
64
|
const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot);
|
|
65
65
|
cacheOptions.path = node_path_1.default.join(cacheOptions.path, projectName);
|
|
66
|
-
const i18nOptions = (0, i18n_options_1.createI18nOptions)(projectMetadata, options.localize, context.logger);
|
|
66
|
+
const i18nOptions = (0, i18n_options_1.createI18nOptions)(projectMetadata, options.localize, context.logger, !!options.ssr);
|
|
67
67
|
i18nOptions.duplicateTranslationBehavior = options.i18nDuplicateTranslation;
|
|
68
68
|
i18nOptions.missingTranslationBehavior = options.i18nMissingTranslation;
|
|
69
69
|
if (options.forceI18nFlatOutput) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Application builder target options
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Schema = {
|
|
5
5
|
/**
|
|
6
6
|
* A list of CommonJS or AMD packages that are allowed to be used without a build time
|
|
7
7
|
* warning. Use `'*'` to allow all.
|
|
@@ -208,9 +208,9 @@ export interface Schema {
|
|
|
208
208
|
* TypeScript configuration for Web Worker modules.
|
|
209
209
|
*/
|
|
210
210
|
webWorkerTsConfig?: string;
|
|
211
|
-
}
|
|
211
|
+
};
|
|
212
212
|
export type AssetPattern = AssetPatternClass | string;
|
|
213
|
-
export
|
|
213
|
+
export type AssetPatternClass = {
|
|
214
214
|
/**
|
|
215
215
|
* Allow glob patterns to follow symlink directories. This allows subdirectories of the
|
|
216
216
|
* symlink to be searched.
|
|
@@ -232,8 +232,8 @@ export interface AssetPatternClass {
|
|
|
232
232
|
* Absolute path within the output.
|
|
233
233
|
*/
|
|
234
234
|
output?: string;
|
|
235
|
-
}
|
|
236
|
-
export
|
|
235
|
+
};
|
|
236
|
+
export type Budget = {
|
|
237
237
|
/**
|
|
238
238
|
* The baseline size for comparison.
|
|
239
239
|
*/
|
|
@@ -270,7 +270,7 @@ export interface Budget {
|
|
|
270
270
|
* The threshold for warning relative to the baseline (min & max).
|
|
271
271
|
*/
|
|
272
272
|
warning?: string;
|
|
273
|
-
}
|
|
273
|
+
};
|
|
274
274
|
/**
|
|
275
275
|
* The type of budget.
|
|
276
276
|
*/
|
|
@@ -291,10 +291,10 @@ export declare enum CrossOrigin {
|
|
|
291
291
|
None = "none",
|
|
292
292
|
UseCredentials = "use-credentials"
|
|
293
293
|
}
|
|
294
|
-
export
|
|
294
|
+
export type FileReplacement = {
|
|
295
295
|
replace: string;
|
|
296
296
|
with: string;
|
|
297
|
-
}
|
|
297
|
+
};
|
|
298
298
|
/**
|
|
299
299
|
* How to handle duplicate translations for i18n.
|
|
300
300
|
*
|
|
@@ -309,7 +309,7 @@ export declare enum I18NTranslation {
|
|
|
309
309
|
* Configures the generation of the application's HTML index.
|
|
310
310
|
*/
|
|
311
311
|
export type IndexUnion = boolean | IndexObject | string;
|
|
312
|
-
export
|
|
312
|
+
export type IndexObject = {
|
|
313
313
|
/**
|
|
314
314
|
* The path of a file to use for the application's generated HTML index.
|
|
315
315
|
*/
|
|
@@ -325,7 +325,7 @@ export interface IndexObject {
|
|
|
325
325
|
*/
|
|
326
326
|
preloadInitial?: boolean;
|
|
327
327
|
[property: string]: any;
|
|
328
|
-
}
|
|
328
|
+
};
|
|
329
329
|
/**
|
|
330
330
|
* The stylesheet language to use for the application's inline component styles.
|
|
331
331
|
*/
|
|
@@ -346,7 +346,7 @@ export type Localize = string[] | boolean;
|
|
|
346
346
|
* https://angular.dev/reference/configs/workspace-config#optimization-configuration.
|
|
347
347
|
*/
|
|
348
348
|
export type OptimizationUnion = boolean | OptimizationClass;
|
|
349
|
-
export
|
|
349
|
+
export type OptimizationClass = {
|
|
350
350
|
/**
|
|
351
351
|
* Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY`
|
|
352
352
|
* environment variable can be used to specify a proxy server.
|
|
@@ -360,25 +360,25 @@ export interface OptimizationClass {
|
|
|
360
360
|
* Enables optimization of the styles output.
|
|
361
361
|
*/
|
|
362
362
|
styles?: StylesUnion;
|
|
363
|
-
}
|
|
363
|
+
};
|
|
364
364
|
/**
|
|
365
365
|
* Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY`
|
|
366
366
|
* environment variable can be used to specify a proxy server.
|
|
367
367
|
*/
|
|
368
368
|
export type FontsUnion = boolean | FontsClass;
|
|
369
|
-
export
|
|
369
|
+
export type FontsClass = {
|
|
370
370
|
/**
|
|
371
371
|
* Reduce render blocking requests by inlining external Google Fonts and Adobe Fonts CSS
|
|
372
372
|
* definitions in the application's HTML index file. This option requires internet access.
|
|
373
373
|
* `HTTPS_PROXY` environment variable can be used to specify a proxy server.
|
|
374
374
|
*/
|
|
375
375
|
inline?: boolean;
|
|
376
|
-
}
|
|
376
|
+
};
|
|
377
377
|
/**
|
|
378
378
|
* Enables optimization of the styles output.
|
|
379
379
|
*/
|
|
380
380
|
export type StylesUnion = boolean | StylesClass;
|
|
381
|
-
export
|
|
381
|
+
export type StylesClass = {
|
|
382
382
|
/**
|
|
383
383
|
* Extract and inline critical CSS definitions to improve first paint time.
|
|
384
384
|
*/
|
|
@@ -393,7 +393,7 @@ export interface StylesClass {
|
|
|
393
393
|
* '//!' or '/*!'.
|
|
394
394
|
*/
|
|
395
395
|
removeSpecialComments?: boolean;
|
|
396
|
-
}
|
|
396
|
+
};
|
|
397
397
|
/**
|
|
398
398
|
* Define the output filename cache-busting hashing mode.
|
|
399
399
|
*/
|
|
@@ -416,7 +416,7 @@ export declare enum OutputMode {
|
|
|
416
416
|
* Specify the output path relative to workspace root.
|
|
417
417
|
*/
|
|
418
418
|
export type OutputPathUnion = OutputPathClass | string;
|
|
419
|
-
export
|
|
419
|
+
export type OutputPathClass = {
|
|
420
420
|
/**
|
|
421
421
|
* Specify the output path relative to workspace root.
|
|
422
422
|
*/
|
|
@@ -436,12 +436,12 @@ export interface OutputPathClass {
|
|
|
436
436
|
* 'server'.
|
|
437
437
|
*/
|
|
438
438
|
server?: string;
|
|
439
|
-
}
|
|
439
|
+
};
|
|
440
440
|
/**
|
|
441
441
|
* Prerender (SSG) pages of your application during build time.
|
|
442
442
|
*/
|
|
443
443
|
export type PrerenderUnion = boolean | PrerenderClass;
|
|
444
|
-
export
|
|
444
|
+
export type PrerenderClass = {
|
|
445
445
|
/**
|
|
446
446
|
* Whether the builder should process the Angular Router configuration to find all
|
|
447
447
|
* unparameterized routes and prerender them.
|
|
@@ -452,9 +452,9 @@ export interface PrerenderClass {
|
|
|
452
452
|
* newlines. This option is useful if you want to prerender routes with parameterized URLs.
|
|
453
453
|
*/
|
|
454
454
|
routesFile?: string;
|
|
455
|
-
}
|
|
455
|
+
};
|
|
456
456
|
export type ScriptElement = ScriptClass | string;
|
|
457
|
-
export
|
|
457
|
+
export type ScriptClass = {
|
|
458
458
|
/**
|
|
459
459
|
* The bundle name for this extra entry point.
|
|
460
460
|
*/
|
|
@@ -467,32 +467,32 @@ export interface ScriptClass {
|
|
|
467
467
|
* The file to include.
|
|
468
468
|
*/
|
|
469
469
|
input: string;
|
|
470
|
-
}
|
|
470
|
+
};
|
|
471
471
|
/**
|
|
472
472
|
* Security features to protect against XSS and other common attacks
|
|
473
473
|
*/
|
|
474
|
-
export
|
|
474
|
+
export type Security = {
|
|
475
475
|
/**
|
|
476
476
|
* Enables automatic generation of a hash-based Strict Content Security Policy
|
|
477
477
|
* (https://web.dev/articles/strict-csp#choose-hash) based on scripts in index.html. Will
|
|
478
478
|
* default to true once we are out of experimental/preview phases.
|
|
479
479
|
*/
|
|
480
480
|
autoCsp?: AutoCspUnion;
|
|
481
|
-
}
|
|
481
|
+
};
|
|
482
482
|
/**
|
|
483
483
|
* Enables automatic generation of a hash-based Strict Content Security Policy
|
|
484
484
|
* (https://web.dev/articles/strict-csp#choose-hash) based on scripts in index.html. Will
|
|
485
485
|
* default to true once we are out of experimental/preview phases.
|
|
486
486
|
*/
|
|
487
487
|
export type AutoCspUnion = boolean | AutoCspClass;
|
|
488
|
-
export
|
|
488
|
+
export type AutoCspClass = {
|
|
489
489
|
/**
|
|
490
490
|
* Include the `unsafe-eval` directive (https://web.dev/articles/strict-csp#remove-eval) in
|
|
491
491
|
* the auto-CSP. Please only enable this if you are absolutely sure that you need to, as
|
|
492
492
|
* allowing calls to eval will weaken the XSS defenses provided by the auto-CSP.
|
|
493
493
|
*/
|
|
494
494
|
unsafeEval?: boolean;
|
|
495
|
-
}
|
|
495
|
+
};
|
|
496
496
|
/**
|
|
497
497
|
* Generates a service worker configuration.
|
|
498
498
|
*/
|
|
@@ -502,7 +502,7 @@ export type ServiceWorker = boolean | string;
|
|
|
502
502
|
* https://angular.dev/reference/configs/workspace-config#source-map-configuration.
|
|
503
503
|
*/
|
|
504
504
|
export type SourceMapUnion = boolean | SourceMapClass;
|
|
505
|
-
export
|
|
505
|
+
export type SourceMapClass = {
|
|
506
506
|
/**
|
|
507
507
|
* Output source maps used for error reporting tools.
|
|
508
508
|
*/
|
|
@@ -519,12 +519,12 @@ export interface SourceMapClass {
|
|
|
519
519
|
* Resolve vendor packages source maps.
|
|
520
520
|
*/
|
|
521
521
|
vendor?: boolean;
|
|
522
|
-
}
|
|
522
|
+
};
|
|
523
523
|
/**
|
|
524
524
|
* Server side render (SSR) pages of your application during runtime.
|
|
525
525
|
*/
|
|
526
526
|
export type SsrUnion = boolean | SsrClass;
|
|
527
|
-
export
|
|
527
|
+
export type SsrClass = {
|
|
528
528
|
/**
|
|
529
529
|
* The server entry-point that when executed will spawn the web server.
|
|
530
530
|
*/
|
|
@@ -543,7 +543,7 @@ export interface SsrClass {
|
|
|
543
543
|
* versions.
|
|
544
544
|
*/
|
|
545
545
|
experimentalPlatform?: ExperimentalPlatform;
|
|
546
|
-
}
|
|
546
|
+
};
|
|
547
547
|
/**
|
|
548
548
|
* Specifies the platform for which the server bundle is generated. This affects the APIs
|
|
549
549
|
* and modules available in the server-side code.
|
|
@@ -564,7 +564,7 @@ export declare enum ExperimentalPlatform {
|
|
|
564
564
|
/**
|
|
565
565
|
* Options to pass to style preprocessors.
|
|
566
566
|
*/
|
|
567
|
-
export
|
|
567
|
+
export type StylePreprocessorOptions = {
|
|
568
568
|
/**
|
|
569
569
|
* Paths to include. Paths will be resolved to workspace root.
|
|
570
570
|
*/
|
|
@@ -573,11 +573,11 @@ export interface StylePreprocessorOptions {
|
|
|
573
573
|
* Options to pass to the sass preprocessor.
|
|
574
574
|
*/
|
|
575
575
|
sass?: Sass;
|
|
576
|
-
}
|
|
576
|
+
};
|
|
577
577
|
/**
|
|
578
578
|
* Options to pass to the sass preprocessor.
|
|
579
579
|
*/
|
|
580
|
-
export
|
|
580
|
+
export type Sass = {
|
|
581
581
|
/**
|
|
582
582
|
* A set of deprecations to treat as fatal. If a deprecation warning of any provided type is
|
|
583
583
|
* encountered during compilation, the compiler will error instead. If a Version is
|
|
@@ -595,9 +595,9 @@ export interface Sass {
|
|
|
595
595
|
* encountered during compilation, the compiler will ignore it instead.
|
|
596
596
|
*/
|
|
597
597
|
silenceDeprecations?: string[];
|
|
598
|
-
}
|
|
598
|
+
};
|
|
599
599
|
export type StyleElement = StyleClass | string;
|
|
600
|
-
export
|
|
600
|
+
export type StyleClass = {
|
|
601
601
|
/**
|
|
602
602
|
* The bundle name for this extra entry point.
|
|
603
603
|
*/
|
|
@@ -610,4 +610,4 @@ export interface StyleClass {
|
|
|
610
610
|
* The file to include.
|
|
611
611
|
*/
|
|
612
612
|
input: string;
|
|
613
|
-
}
|
|
613
|
+
};
|
|
@@ -6,11 +6,10 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Builder } from '@angular-devkit/architect';
|
|
9
|
-
import { json } from '@angular-devkit/core';
|
|
10
9
|
import { execute } from './builder';
|
|
11
10
|
import type { DevServerBuilderOutput } from './output';
|
|
12
11
|
import type { Schema as DevServerBuilderOptions } from './schema';
|
|
13
12
|
export { type DevServerBuilderOptions, type DevServerBuilderOutput, execute as executeDevServerBuilder, };
|
|
14
|
-
declare const builder: Builder<DevServerBuilderOptions
|
|
13
|
+
declare const builder: Builder<DevServerBuilderOptions>;
|
|
15
14
|
export default builder;
|
|
16
15
|
export { execute as executeDevServer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dev Server target options for Build Facade.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Schema = {
|
|
5
5
|
/**
|
|
6
6
|
* A build builder target to serve in the format of `project:target[:configuration]`. You
|
|
7
7
|
* can also pass in more than one configuration name as a comma-separated list. Example:
|
|
@@ -78,7 +78,7 @@ export interface Schema {
|
|
|
78
78
|
* Rebuild on change.
|
|
79
79
|
*/
|
|
80
80
|
watch?: boolean;
|
|
81
|
-
}
|
|
81
|
+
};
|
|
82
82
|
/**
|
|
83
83
|
* Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are
|
|
84
84
|
* enabled.
|
|
@@ -89,10 +89,10 @@ export type Inspect = boolean | string;
|
|
|
89
89
|
* enable prebundling, the Angular CLI cache must also be enabled.
|
|
90
90
|
*/
|
|
91
91
|
export type PrebundleUnion = boolean | PrebundleClass;
|
|
92
|
-
export
|
|
92
|
+
export type PrebundleClass = {
|
|
93
93
|
/**
|
|
94
94
|
* List of package imports that should not be prebundled by the development server. The
|
|
95
95
|
* packages will be bundled into the application code itself.
|
|
96
96
|
*/
|
|
97
97
|
exclude: string[];
|
|
98
|
-
}
|
|
98
|
+
};
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Builder } from '@angular-devkit/architect';
|
|
9
|
-
import { json } from '@angular-devkit/core';
|
|
10
9
|
import { execute } from './builder';
|
|
11
10
|
import type { Schema as ExtractI18nBuilderOptions } from './schema';
|
|
12
11
|
export { ExtractI18nBuilderOptions, execute };
|
|
13
|
-
declare const builder: Builder<ExtractI18nBuilderOptions
|
|
12
|
+
declare const builder: Builder<ExtractI18nBuilderOptions>;
|
|
14
13
|
export default builder;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Extract i18n target options for Build Facade.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Schema = {
|
|
5
5
|
/**
|
|
6
6
|
* A builder target to extract i18n messages in the format of
|
|
7
7
|
* `project:target[:configuration]`. You can also pass in more than one configuration name
|
|
@@ -24,7 +24,7 @@ export interface Schema {
|
|
|
24
24
|
* Log progress to the console.
|
|
25
25
|
*/
|
|
26
26
|
progress?: boolean;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
/**
|
|
29
29
|
* Output format for the generated file.
|
|
30
30
|
*/
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Builder } from '@angular-devkit/architect';
|
|
9
|
-
import { json } from '@angular-devkit/core';
|
|
10
9
|
import { execute } from './builder';
|
|
11
10
|
import type { Schema as NgPackagrBuilderOptions } from './schema';
|
|
12
11
|
export { type NgPackagrBuilderOptions, execute };
|
|
13
|
-
declare const builder: Builder<NgPackagrBuilderOptions
|
|
12
|
+
declare const builder: Builder<NgPackagrBuilderOptions>;
|
|
14
13
|
export default builder;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ng-packagr target options for Build Architect. Use to build library projects.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Schema = {
|
|
5
5
|
/**
|
|
6
6
|
* Enable and define the file watching poll time period in milliseconds.
|
|
7
7
|
*/
|
|
@@ -18,4 +18,4 @@ export interface Schema {
|
|
|
18
18
|
* Run build when files change.
|
|
19
19
|
*/
|
|
20
20
|
watch?: boolean;
|
|
21
|
-
}
|
|
21
|
+
};
|
|
@@ -120,7 +120,11 @@ class AotCompilation extends angular_compilation_1.AngularCompilation {
|
|
|
120
120
|
relativePath = relativePath.replaceAll('\\', '/');
|
|
121
121
|
const updateId = encodeURIComponent(`${host.getCanonicalFileName(relativePath)}@${node.name?.text}`);
|
|
122
122
|
const updateText = angularCompiler.emitHmrUpdateModule(node);
|
|
123
|
-
|
|
123
|
+
// If compiler cannot generate an update for the component, prevent template updates.
|
|
124
|
+
// Also prevent template updates if $localize is directly present which also currently
|
|
125
|
+
// prevents a template update at runtime.
|
|
126
|
+
// TODO: Support localized template update modules and remove this check.
|
|
127
|
+
if (updateText === null || updateText.includes('$localize')) {
|
|
124
128
|
// Build is needed if a template cannot be updated
|
|
125
129
|
templateUpdates = undefined;
|
|
126
130
|
break;
|
|
@@ -5,5 +5,5 @@
|
|
|
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 { Connect } from 'vite';
|
|
9
|
-
export declare function createAngularComponentMiddleware(templateUpdates: ReadonlyMap<string, string>): Connect.NextHandleFunction;
|
|
8
|
+
import type { Connect, ViteDevServer } from 'vite';
|
|
9
|
+
export declare function createAngularComponentMiddleware(server: ViteDevServer, templateUpdates: ReadonlyMap<string, string>): Connect.NextHandleFunction;
|
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.createAngularComponentMiddleware = createAngularComponentMiddleware;
|
|
11
|
+
const utils_1 = require("../utils");
|
|
11
12
|
const ANGULAR_COMPONENT_PREFIX = '/@ng/component';
|
|
12
|
-
function createAngularComponentMiddleware(templateUpdates) {
|
|
13
|
+
function createAngularComponentMiddleware(server, templateUpdates) {
|
|
13
14
|
return function angularComponentMiddleware(req, res, next) {
|
|
14
15
|
if (req.url === undefined || res.writableEnded) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
const pathname = (0, utils_1.pathnameWithoutBasePath)(req.url, server.config.base);
|
|
19
|
+
if (!pathname.includes(ANGULAR_COMPONENT_PREFIX)) {
|
|
18
20
|
next();
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
@@ -35,8 +35,7 @@ async function createAngularMemoryPlugin(options) {
|
|
|
35
35
|
// Vite will resolve these these files example:
|
|
36
36
|
// `file:///@ng/component?c=src%2Fapp%2Fapp.component.ts%40AppComponent&t=1737017253850`
|
|
37
37
|
const sourcePath = (0, node_url_1.fileURLToPath)(source);
|
|
38
|
-
const
|
|
39
|
-
const sourceWithoutRoot = normalizePath('/' + sourcePath.slice(root.length));
|
|
38
|
+
const sourceWithoutRoot = normalizePath('/' + (0, node_path_1.relative)(virtualProjectRoot, sourcePath));
|
|
40
39
|
if (sourceWithoutRoot.startsWith(ANGULAR_PREFIX)) {
|
|
41
40
|
const [, query] = source.split('?', 2);
|
|
42
41
|
return `\0${sourceWithoutRoot}?${query}`;
|
|
@@ -49,7 +49,7 @@ function createAngularSetupMiddlewaresPlugin(options) {
|
|
|
49
49
|
const { indexHtmlTransformer, outputFiles, extensionMiddleware, assets, componentStyles, templateUpdates, ssrMode, resetComponentUpdates, } = options;
|
|
50
50
|
// Headers, assets and resources get handled first
|
|
51
51
|
server.middlewares.use((0, middlewares_1.createAngularHeadersMiddleware)(server));
|
|
52
|
-
server.middlewares.use((0, middlewares_1.createAngularComponentMiddleware)(templateUpdates));
|
|
52
|
+
server.middlewares.use((0, middlewares_1.createAngularComponentMiddleware)(server, templateUpdates));
|
|
53
53
|
server.middlewares.use((0, middlewares_1.createAngularAssetsMiddleware)(server, assets, outputFiles, componentStyles, await createEncapsulateStyle()));
|
|
54
54
|
extensionMiddleware?.forEach((middleware) => server.middlewares.use(middleware));
|
|
55
55
|
// Returning a function, installs middleware after the main transform middleware but
|
|
@@ -29,7 +29,7 @@ export declare function createI18nOptions(projectMetadata: {
|
|
|
29
29
|
i18n?: unknown;
|
|
30
30
|
}, inline?: boolean | string[], logger?: {
|
|
31
31
|
warn(message: string): void;
|
|
32
|
-
}): I18nOptions;
|
|
32
|
+
}, ssrEnabled?: boolean): I18nOptions;
|
|
33
33
|
export declare function loadTranslations(locale: string, desc: LocaleDescription, workspaceRoot: string, loader: TranslationLoader, logger: {
|
|
34
34
|
warn: (message: string) => void;
|
|
35
35
|
error: (message: string) => void;
|
|
@@ -45,7 +45,7 @@ function ensureValidSubPath(value, name) {
|
|
|
45
45
|
throw new Error(`Project field '${name}' is invalid. It can only contain letters, numbers, hyphens, and underscores.`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function createI18nOptions(projectMetadata, inline, logger) {
|
|
48
|
+
function createI18nOptions(projectMetadata, inline, logger, ssrEnabled) {
|
|
49
49
|
const { i18n: metadata = {} } = projectMetadata;
|
|
50
50
|
ensureObject(metadata, 'i18n');
|
|
51
51
|
const i18n = {
|
|
@@ -71,10 +71,12 @@ function createI18nOptions(projectMetadata, inline, logger) {
|
|
|
71
71
|
}
|
|
72
72
|
if (metadata.sourceLocale.baseHref !== undefined) {
|
|
73
73
|
ensureString(metadata.sourceLocale.baseHref, 'i18n.sourceLocale.baseHref');
|
|
74
|
-
|
|
75
|
-
`
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
if (ssrEnabled) {
|
|
75
|
+
logger?.warn(`'baseHref' in 'i18n.sourceLocale' may lead to undefined behavior when used with SSR. ` +
|
|
76
|
+
`Consider using 'subPath' instead.\n\n` +
|
|
77
|
+
`Note: 'subPath' specifies the URL segment for the locale, serving as both the HTML base HREF ` +
|
|
78
|
+
`and the output directory name.\nBy default, if not explicitly set, 'subPath' defaults to the locale code.`);
|
|
79
|
+
}
|
|
78
80
|
rawSourceLocaleBaseHref = metadata.sourceLocale.baseHref;
|
|
79
81
|
}
|
|
80
82
|
if (metadata.sourceLocale.subPath !== undefined) {
|
|
@@ -104,10 +106,12 @@ function createI18nOptions(projectMetadata, inline, logger) {
|
|
|
104
106
|
translationFiles = normalizeTranslationFileOption(options.translation, locale, false);
|
|
105
107
|
if ('baseHref' in options) {
|
|
106
108
|
ensureString(options.baseHref, `i18n.locales.${locale}.baseHref`);
|
|
107
|
-
|
|
108
|
-
`
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
if (ssrEnabled) {
|
|
110
|
+
logger?.warn(`'baseHref' in 'i18n.locales.${locale}' may lead to undefined behavior when used with SSR. ` +
|
|
111
|
+
`Consider using 'subPath' instead.\n\n` +
|
|
112
|
+
`Note: 'subPath' specifies the URL segment for the locale, serving as both the HTML base HREF ` +
|
|
113
|
+
`and the output directory name.\nBy default, if not explicitly set, 'subPath' defaults to the locale code.`);
|
|
114
|
+
}
|
|
111
115
|
baseHref = options.baseHref;
|
|
112
116
|
}
|
|
113
117
|
if ('subPath' in options) {
|
|
@@ -131,17 +135,6 @@ function createI18nOptions(projectMetadata, inline, logger) {
|
|
|
131
135
|
};
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
|
-
// Check that subPaths are unique.
|
|
135
|
-
const localesData = Object.entries(i18n.locales);
|
|
136
|
-
for (let i = 0; i < localesData.length; i++) {
|
|
137
|
-
const [localeA, { subPath: subPathA }] = localesData[i];
|
|
138
|
-
for (let j = i + 1; j < localesData.length; j++) {
|
|
139
|
-
const [localeB, { subPath: subPathB }] = localesData[j];
|
|
140
|
-
if (subPathA === subPathB) {
|
|
141
|
-
throw new Error(`Invalid i18n configuration: Locales '${localeA}' and '${localeB}' cannot have the same subPath: '${subPathB}'.`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
138
|
if (inline === true) {
|
|
146
139
|
i18n.inlineLocales.add(i18n.sourceLocale);
|
|
147
140
|
Object.keys(i18n.locales).forEach((locale) => i18n.inlineLocales.add(locale));
|
|
@@ -154,6 +147,17 @@ function createI18nOptions(projectMetadata, inline, logger) {
|
|
|
154
147
|
i18n.inlineLocales.add(locale);
|
|
155
148
|
}
|
|
156
149
|
}
|
|
150
|
+
// Check that subPaths are unique only the locales that we are inlining.
|
|
151
|
+
const localesData = Object.entries(i18n.locales).filter(([locale]) => i18n.inlineLocales.has(locale));
|
|
152
|
+
for (let i = 0; i < localesData.length; i++) {
|
|
153
|
+
const [localeA, { subPath: subPathA }] = localesData[i];
|
|
154
|
+
for (let j = i + 1; j < localesData.length; j++) {
|
|
155
|
+
const [localeB, { subPath: subPathB }] = localesData[j];
|
|
156
|
+
if (subPathA === subPathB) {
|
|
157
|
+
throw new Error(`Invalid i18n configuration: Locales '${localeA}' and '${localeB}' cannot have the same subPath: '${subPathB}'.`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
157
161
|
return i18n;
|
|
158
162
|
}
|
|
159
163
|
function loadTranslations(locale, desc, workspaceRoot, loader, logger, usedFormats, duplicateTranslation) {
|
|
@@ -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.1.
|
|
13
|
+
const VERSION = '19.1.4';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|
|
@@ -16,6 +16,7 @@ const error_1 = require("../error");
|
|
|
16
16
|
const url_1 = require("../url");
|
|
17
17
|
const worker_pool_1 = require("../worker-pool");
|
|
18
18
|
const utils_1 = require("./esm-in-memory-loader/utils");
|
|
19
|
+
const manifest_1 = require("./manifest");
|
|
19
20
|
const models_1 = require("./models");
|
|
20
21
|
async function prerenderPages(workspaceRoot, baseHref, appShellOptions, prerenderOptions, outputFiles, assets, outputMode, sourcemap = false, maxThreads = 1) {
|
|
21
22
|
const outputFilesForWorker = {};
|
|
@@ -89,6 +90,12 @@ async function prerenderPages(workspaceRoot, baseHref, appShellOptions, prerende
|
|
|
89
90
|
serializableRouteTreeNode,
|
|
90
91
|
};
|
|
91
92
|
}
|
|
93
|
+
// Add the extracted routes to the manifest file.
|
|
94
|
+
// We could re-generate it from the start, but that would require a number of options to be passed down.
|
|
95
|
+
const manifest = outputFilesForWorker[manifest_1.SERVER_APP_MANIFEST_FILENAME];
|
|
96
|
+
if (manifest) {
|
|
97
|
+
outputFilesForWorker[manifest_1.SERVER_APP_MANIFEST_FILENAME] = manifest.replace('routes: undefined,', `routes: ${JSON.stringify(serializableRouteTreeNodeForPrerender, undefined, 2)},`);
|
|
98
|
+
}
|
|
92
99
|
// Render routes
|
|
93
100
|
const { errors: renderingErrors, output } = await renderPages(baseHref, sourcemap, serializableRouteTreeNodeForPrerender, maxThreads, workspaceRoot, outputFilesForWorker, assetsReversed, outputMode, appShellRoute ?? appShellOptions?.route);
|
|
94
101
|
errors.push(...renderingErrors);
|