@angular/build 19.1.6 → 19.2.0-next.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/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  The sources for this package are in the [Angular CLI](https://github.com/angular/angular-cli) repository. Please file issues and pull requests against that repository.
4
4
 
5
- Usage information and reference details can be found in repository [README](https://github.com/angular/angular-cli/blob/main/README.md) file.
5
+ Usage information and reference details can be found in repository [README](../../../README.md) file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/build",
3
- "version": "19.1.6",
3
+ "version": "19.2.0-next.0",
4
4
  "description": "Official build system for Angular",
5
5
  "keywords": [
6
6
  "Angular CLI",
@@ -23,13 +23,13 @@
23
23
  "builders": "builders.json",
24
24
  "dependencies": {
25
25
  "@ampproject/remapping": "2.3.0",
26
- "@angular-devkit/core": "19.1.6",
27
- "@angular-devkit/architect": "0.1901.6",
26
+ "@angular-devkit/core": "19.2.0-next.0",
27
+ "@angular-devkit/architect": "0.1902.0-next.0",
28
28
  "@babel/core": "7.26.0",
29
29
  "@babel/helper-annotate-as-pure": "7.25.9",
30
30
  "@babel/helper-split-export-declaration": "7.24.7",
31
31
  "@babel/plugin-syntax-import-attributes": "7.26.0",
32
- "@inquirer/confirm": "5.1.1",
32
+ "@inquirer/confirm": "5.1.3",
33
33
  "@vitejs/plugin-basic-ssl": "1.2.0",
34
34
  "beasties": "0.2.0",
35
35
  "browserslist": "^4.23.0",
@@ -43,8 +43,8 @@
43
43
  "parse5-html-rewriting-stream": "7.0.0",
44
44
  "picomatch": "4.0.2",
45
45
  "piscina": "4.8.0",
46
- "rollup": "4.30.1",
47
- "sass": "1.83.1",
46
+ "rollup": "4.31.0",
47
+ "sass": "1.83.4",
48
48
  "semver": "7.6.3",
49
49
  "vite": "6.0.11",
50
50
  "watchpack": "2.4.2"
@@ -53,16 +53,16 @@
53
53
  "lmdb": "3.2.2"
54
54
  },
55
55
  "peerDependencies": {
56
- "@angular/compiler": "^19.0.0",
57
- "@angular/compiler-cli": "^19.0.0",
58
- "@angular/localize": "^19.0.0",
59
- "@angular/platform-server": "^19.0.0",
60
- "@angular/service-worker": "^19.0.0",
61
- "@angular/ssr": "^19.1.6",
56
+ "@angular/compiler": "^19.0.0 || ^19.2.0-next.0",
57
+ "@angular/compiler-cli": "^19.0.0 || ^19.2.0-next.0",
58
+ "@angular/localize": "^19.0.0 || ^19.2.0-next.0",
59
+ "@angular/platform-server": "^19.0.0 || ^19.2.0-next.0",
60
+ "@angular/service-worker": "^19.0.0 || ^19.2.0-next.0",
61
+ "@angular/ssr": "^19.2.0-next.0",
62
62
  "less": "^4.2.0",
63
- "ng-packagr": "^19.0.0",
63
+ "ng-packagr": "^19.0.0 || ^19.2.0-next.0",
64
64
  "postcss": "^8.4.0",
65
- "tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
65
+ "tailwindcss": "^2.0.0 || ^3.0.0",
66
66
  "typescript": ">=5.5 <5.8"
67
67
  },
68
68
  "peerDependenciesMeta": {
@@ -127,9 +127,6 @@ async function* runEsBuildBuildAction(action, options) {
127
127
  if (!watcher) {
128
128
  return;
129
129
  }
130
- // Used to force a full result on next rebuild if there were initial errors.
131
- // This ensures at least one full result is emitted.
132
- let hasInitialErrors = result.errors.length > 0;
133
130
  // Wait for changes and rebuild as needed
134
131
  const currentWatchFiles = new Set(result.watchFiles);
135
132
  try {
@@ -167,11 +164,9 @@ async function* runEsBuildBuildAction(action, options) {
167
164
  if (staleWatchFiles?.size) {
168
165
  watcher.remove([...staleWatchFiles]);
169
166
  }
170
- for (const outputResult of emitOutputResults(result, outputOptions, changes, incrementalResults && !hasInitialErrors ? rebuildState : undefined)) {
167
+ for (const outputResult of emitOutputResults(result, outputOptions, changes, incrementalResults ? rebuildState : undefined)) {
171
168
  yield outputResult;
172
169
  }
173
- // Clear initial build errors flag if no errors are now present
174
- hasInitialErrors &&= result.errors.length > 0;
175
170
  }
176
171
  }
177
172
  finally {
@@ -244,7 +239,6 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
244
239
  outputOptions,
245
240
  },
246
241
  };
247
- let hasCssUpdates = false;
248
242
  // Initially assume all previous output files have been removed
249
243
  const removedOutputFiles = new Map(previousOutputInfo);
250
244
  for (const file of outputFiles) {
@@ -260,11 +254,8 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
260
254
  incrementalResult.modified.push(file.path);
261
255
  }
262
256
  if (needFile) {
263
- if (file.path.endsWith('.css')) {
264
- hasCssUpdates = true;
265
- }
266
- else if (!/(?:\.m?js|\.map)$/.test(file.path)) {
267
- // Updates to non-JS files must signal an update with the dev server
257
+ // Updates to non-JS files must signal an update with the dev server
258
+ if (!/(?:\.m?js|\.map)$/.test(file.path)) {
268
259
  incrementalResult.background = false;
269
260
  }
270
261
  incrementalResult.files[file.path] = {
@@ -290,21 +281,12 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
290
281
  else {
291
282
  continue;
292
283
  }
293
- hasCssUpdates ||= destination.endsWith('.css');
294
284
  incrementalResult.files[destination] = {
295
285
  type: bundler_context_1.BuildOutputFileType.Browser,
296
286
  inputPath: source,
297
287
  origin: 'disk',
298
288
  };
299
289
  }
300
- // Do not remove stale files yet if there are template updates.
301
- // Component chunk files may still be referenced in running browser code.
302
- // Module evaluation time component updates will update any of these files.
303
- // This typically occurs when a lazy component is changed that has not yet
304
- // been accessed at runtime.
305
- if (hasTemplateUpdates && incrementalResult.background) {
306
- removedOutputFiles.clear();
307
- }
308
290
  // Include the removed output and asset files
309
291
  incrementalResult.removed.push(...Array.from(removedOutputFiles, ([file, { type }]) => ({
310
292
  path: file,
@@ -317,17 +299,6 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
317
299
  // If there are template updates and the incremental update was background only, a component
318
300
  // update is possible.
319
301
  if (hasTemplateUpdates && incrementalResult.background) {
320
- // Template changes may be accompanied by stylesheet changes and these should also be updated hot when possible.
321
- if (hasCssUpdates) {
322
- const styleResult = {
323
- kind: results_1.ResultKind.Incremental,
324
- added: incrementalResult.added.filter(isCssFilePath),
325
- removed: incrementalResult.removed.filter(({ path }) => isCssFilePath(path)),
326
- modified: incrementalResult.modified.filter(isCssFilePath),
327
- files: Object.fromEntries(Object.entries(incrementalResult.files).filter(([path]) => isCssFilePath(path))),
328
- };
329
- yield styleResult;
330
- }
331
302
  const updateResult = {
332
303
  kind: results_1.ResultKind.ComponentUpdate,
333
304
  updates: Array.from(templateUpdates, ([id, content]) => ({
@@ -339,6 +310,3 @@ function* emitOutputResults({ outputFiles, assetFiles, errors, warnings, externa
339
310
  yield updateResult;
340
311
  }
341
312
  }
342
- function isCssFilePath(filePath) {
343
- return /\.css(?:\.map)?$/i.test(filePath);
344
- }
@@ -38,7 +38,7 @@ async function executePostBundleSteps(metafile, options, outputFiles, assetFiles
38
38
  const allErrors = [];
39
39
  const allWarnings = [];
40
40
  const prerenderedRoutes = {};
41
- const { baseHref = '/', serviceWorker, ssrOptions, indexHtmlOptions, optimizationOptions, sourcemapOptions, outputMode, serverEntryPoint, prerenderOptions, appShellOptions, publicPath, workspaceRoot, partialSSRBuild, } = options;
41
+ const { baseHref = '/', serviceWorker, i18nOptions, indexHtmlOptions, optimizationOptions, sourcemapOptions, outputMode, serverEntryPoint, prerenderOptions, appShellOptions, publicPath, workspaceRoot, partialSSRBuild, } = options;
42
42
  // Index HTML content without CSS inlining to be used for server rendering (AppShell, SSG and SSR).
43
43
  // NOTE: Critical CSS inlining is deliberately omitted here, as it will be handled during server rendering.
44
44
  // Additionally, when using prerendering or AppShell, the index HTML file may be regenerated.
@@ -57,7 +57,7 @@ async function executePostBundleSteps(metafile, options, outputFiles, assetFiles
57
57
  }
58
58
  // Create server manifest
59
59
  const initialFilesPaths = new Set(initialFiles.keys());
60
- if (serverEntryPoint && (outputMode || prerenderOptions || appShellOptions || ssrOptions)) {
60
+ if (serverEntryPoint) {
61
61
  const { manifestContent, serverAssetsChunks } = (0, manifest_1.generateAngularServerAppManifest)(additionalHtmlOutputFiles, outputFiles, optimizationOptions.styles.inlineCritical ?? false, undefined, locale, baseHref, initialFilesPaths, metafile, publicPath);
62
62
  additionalOutputFiles.push(...serverAssetsChunks, (0, utils_1.createOutputFile)(manifest_1.SERVER_APP_MANIFEST_FILENAME, manifestContent, bundler_context_1.BuildOutputFileType.ServerApplication));
63
63
  }
@@ -44,5 +44,4 @@ export declare function normalizeOptions(context: BuilderContext, projectName: s
44
44
  host?: string;
45
45
  port?: number;
46
46
  };
47
- allowedHosts: true | string[];
48
47
  }>;
@@ -73,7 +73,7 @@ async function normalizeOptions(context, projectName, options) {
73
73
  }
74
74
  }
75
75
  // Initial options to keep
76
- const { host, port, poll, open, verbose, watch, liveReload, hmr, headers, proxyConfig, servePath, ssl, sslCert, sslKey, prebundle, allowedHosts, } = options;
76
+ const { host, port, poll, open, verbose, watch, liveReload, hmr, headers, proxyConfig, servePath, ssl, sslCert, sslKey, prebundle, } = options;
77
77
  // Return all the normalized options
78
78
  return {
79
79
  buildTarget,
@@ -97,6 +97,5 @@ async function normalizeOptions(context, projectName, options) {
97
97
  // Prebundling defaults to true but requires caching to function
98
98
  prebundle: cacheOptions.enabled && !optimization.scripts && prebundle,
99
99
  inspect,
100
- allowedHosts: allowedHosts ? allowedHosts : [],
101
100
  };
102
101
  }
@@ -2,12 +2,6 @@
2
2
  * Dev Server target options for Build Facade.
3
3
  */
4
4
  export type Schema = {
5
- /**
6
- * The hosts that can access the development server. This option sets the Vite option of the
7
- * same name. For further details:
8
- * https://vite.dev/config/server-options.html#server-allowedhosts
9
- */
10
- allowedHosts?: AllowedHosts;
11
5
  /**
12
6
  * A build builder target to serve in the format of `project:target[:configuration]`. You
13
7
  * can also pass in more than one configuration name as a comma-separated list. Example:
@@ -85,12 +79,6 @@ export type Schema = {
85
79
  */
86
80
  watch?: boolean;
87
81
  };
88
- /**
89
- * The hosts that can access the development server. This option sets the Vite option of the
90
- * same name. For further details:
91
- * https://vite.dev/config/server-options.html#server-allowedhosts
92
- */
93
- export type AllowedHosts = string[] | boolean;
94
82
  /**
95
83
  * Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are
96
84
  * enabled.
@@ -36,23 +36,6 @@
36
36
  "type": "string",
37
37
  "description": "SSL certificate to use for serving HTTPS."
38
38
  },
39
- "allowedHosts": {
40
- "description": "The hosts that can access the development server. This option sets the Vite option of the same name. For further details: https://vite.dev/config/server-options.html#server-allowedhosts",
41
- "default": [],
42
- "oneOf": [
43
- {
44
- "type": "array",
45
- "description": "List of hosts that are allowed to access the development server.",
46
- "items": {
47
- "type": "string"
48
- }
49
- },
50
- {
51
- "type": "boolean",
52
- "description": "Indicates that all hosts are allowed. This is not recommended and a security risk."
53
- }
54
- ]
55
- },
56
39
  "headers": {
57
40
  "type": "object",
58
41
  "description": "Custom HTTP headers to be added to all responses.",
@@ -161,7 +161,6 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
161
161
  },
162
162
  });
163
163
  }
164
- yield { baseUrl: '', success: false };
165
164
  continue;
166
165
  }
167
166
  // Clear existing error overlay on successful result
@@ -305,46 +304,6 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
305
304
  const serverConfiguration = await setupServer(serverOptions, generatedFiles, assetFiles, browserOptions.preserveSymlinks, externalMetadata, ssrMode, prebundleTransformer, target, (0, internal_1.isZonelessApp)(polyfills), componentStyles, templateUpdates, browserOptions.loader, browserOptions.define, extensions?.middleware, transformers?.indexHtml, thirdPartySourcemaps);
306
305
  server = await createServer(serverConfiguration);
307
306
  await server.listen();
308
- // Setup builder context logging for browser clients
309
- server.hot.on('angular:log', (data) => {
310
- if (typeof data?.text !== 'string') {
311
- context.logger.warn('Development server client sent invalid internal log event.');
312
- }
313
- switch (data.kind) {
314
- case 'error':
315
- context.logger.error(`[CLIENT ERROR]: ${data.text}`);
316
- break;
317
- case 'warning':
318
- context.logger.warn(`[CLIENT WARNING]: ${data.text}`);
319
- break;
320
- default:
321
- context.logger.info(`[CLIENT INFO]: ${data.text}`);
322
- break;
323
- }
324
- });
325
- // Setup component HMR invalidation
326
- // Invalidation occurs when the runtime cannot update a component
327
- server.hot.on('angular:invalidate', (data) => {
328
- if (typeof data?.id !== 'string') {
329
- context.logger.warn('Development server client sent invalid internal invalidate event.');
330
- }
331
- // Clear invalid template update
332
- templateUpdates.delete(data.id);
333
- // Some cases are expected unsupported update scenarios but some may be errors.
334
- // If an error occurred, log the error in addition to the invalidation.
335
- if (data.error) {
336
- context.logger.error(`Component update failed${data.message ? `: ${data.message}` : '.'}` +
337
- '\nPlease consider reporting the error at https://github.com/angular/angular-cli/issues');
338
- }
339
- else {
340
- context.logger.warn(`Component update unsupported${data.message ? `: ${data.message}` : '.'}`);
341
- }
342
- server?.ws.send({
343
- type: 'full-reload',
344
- path: '*',
345
- });
346
- context.logger.info('Page reload sent to client(s).');
347
- });
348
307
  const urls = server.resolvedUrls;
349
308
  if (urls && (urls.local.length || urls.network.length)) {
350
309
  serverUrl = new URL(urls.local[0] ?? urls.network[0]);
@@ -461,7 +420,7 @@ function handleUpdate(server, serverOptions, logger, componentStyles, updatedFil
461
420
  type: 'update',
462
421
  updates,
463
422
  });
464
- logger.info('Stylesheet update sent to client(s).');
423
+ logger.info('HMR update sent to client(s).');
465
424
  return;
466
425
  }
467
426
  }
@@ -574,14 +533,6 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
574
533
  mainFields: ['es2020', 'browser', 'module', 'main'],
575
534
  preserveSymlinks,
576
535
  },
577
- dev: {
578
- // This is needed when `externalDependencies` is used to prevent Vite load errors.
579
- // NOTE: If Vite adds direct support for externals, this can be removed.
580
- // NOTE: Vite breaks the resolution of browser modules in SSR
581
- // when accessing a url with two or more segments (e.g., 'foo/bar'),
582
- // as they are not re-based from the base href.
583
- preTransformRequests: externalMetadata.explicitBrowser.length === 0 && ssrMode === plugins_1.ServerSsrMode.NoSsr,
584
- },
585
536
  server: {
586
537
  warmup: {
587
538
  ssrFiles,
@@ -590,7 +541,6 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
590
541
  strictPort: true,
591
542
  host: serverOptions.host,
592
543
  open: serverOptions.open,
593
- allowedHosts: serverOptions.allowedHosts,
594
544
  headers: serverOptions.headers,
595
545
  // Disable the websocket if live reload is disabled (false/undefined are the only valid values)
596
546
  ws: serverOptions.liveReload === false && serverOptions.hmr === false ? false : undefined,
@@ -619,6 +569,9 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
619
569
  ...[...assets.values()].map(({ source }) => source),
620
570
  ],
621
571
  },
572
+ // This is needed when `externalDependencies` is used to prevent Vite load errors.
573
+ // NOTE: If Vite adds direct support for externals, this can be removed.
574
+ preTransformRequests: externalMetadata.explicitBrowser.length === 0,
622
575
  },
623
576
  ssr: {
624
577
  // Note: `true` and `/.*/` have different sematics. When true, the `external` option is ignored.
@@ -80,9 +80,6 @@ class AngularCompilation {
80
80
  enableResourceInlining: false,
81
81
  supportTestBed: false,
82
82
  supportJitMode: false,
83
- // Disable removing of comments as TS is quite aggressive with these and can
84
- // remove important annotations, such as /* @__PURE__ */ and comments like /* vite-ignore */.
85
- removeComments: false,
86
83
  }));
87
84
  }
88
85
  async diagnoseFiles(modes = DiagnosticModes.All) {
@@ -47,13 +47,24 @@ async function createAngularMemoryPlugin(options) {
47
47
  // `/@id/${source}` but is currently closer to a raw external than a resolved file path.
48
48
  return source;
49
49
  }
50
- if (importer && source[0] === '.') {
50
+ if (importer) {
51
51
  const normalizedImporter = normalizePath(importer);
52
- if (normalizedImporter.startsWith(virtualProjectRoot)) {
52
+ if (source[0] === '.' && normalizedImporter.startsWith(virtualProjectRoot)) {
53
53
  // Remove query if present
54
54
  const [importerFile] = normalizedImporter.split('?', 1);
55
55
  source = '/' + (0, node_path_1.join)((0, node_path_1.dirname)((0, node_path_1.relative)(virtualProjectRoot, importerFile)), source);
56
56
  }
57
+ else if (!ssr &&
58
+ source[0] === '/' &&
59
+ importer.endsWith('index.html') &&
60
+ normalizedImporter.startsWith(virtualProjectRoot)) {
61
+ // This is only needed when using SSR and `angularSsrMiddleware` (old style) to correctly resolve
62
+ // .js files when using lazy-loading.
63
+ // Remove query if present
64
+ const [importerFile] = normalizedImporter.split('?', 1);
65
+ source =
66
+ '/' + (0, node_path_1.join)((0, node_path_1.dirname)((0, node_path_1.relative)(virtualProjectRoot, importerFile)), (0, node_path_1.basename)(source));
67
+ }
57
68
  }
58
69
  const [file] = source.split('?', 1);
59
70
  if (outputFiles.has(normalizePath(file))) {
@@ -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.6';
13
+ const VERSION = '19.2.0-next.0';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -9,7 +9,7 @@ import type { Config, Filesystem } from '@angular/service-worker/config';
9
9
  import { promises as fsPromises } from 'node:fs';
10
10
  import { BuildOutputFile } from '../tools/esbuild/bundler-context';
11
11
  import { BuildOutputAsset } from '../tools/esbuild/bundler-execution-result';
12
- export declare function augmentAppWithServiceWorker(appRoot: string, workspaceRoot: string, outputPath: string, baseHref: string, ngswConfigPath?: string, inputFileSystem?: typeof fsPromises, outputFileSystem?: typeof fsPromises): Promise<void>;
12
+ export declare function augmentAppWithServiceWorker(appRoot: string, workspaceRoot: string, outputPath: string, baseHref: string, ngswConfigPath?: string, inputputFileSystem?: typeof fsPromises, outputFileSystem?: typeof fsPromises): Promise<void>;
13
13
  export declare function augmentAppWithServiceWorkerEsbuild(workspaceRoot: string, configPath: string, baseHref: string, indexHtml: string | undefined, outputFiles: BuildOutputFile[], assetFiles: BuildOutputAsset[]): Promise<{
14
14
  manifest: string;
15
15
  assetFiles: BuildOutputAsset[];
@@ -133,7 +133,7 @@ class ResultFilesystem {
133
133
  throw new Error('Serviceworker manifest generator should not attempted to write.');
134
134
  }
135
135
  }
136
- async function augmentAppWithServiceWorker(appRoot, workspaceRoot, outputPath, baseHref, ngswConfigPath, inputFileSystem = node_fs_1.promises, outputFileSystem = node_fs_1.promises) {
136
+ async function augmentAppWithServiceWorker(appRoot, workspaceRoot, outputPath, baseHref, ngswConfigPath, inputputFileSystem = node_fs_1.promises, outputFileSystem = node_fs_1.promises) {
137
137
  // Determine the configuration file path
138
138
  const configPath = ngswConfigPath
139
139
  ? path.join(workspaceRoot, ngswConfigPath)
@@ -141,7 +141,7 @@ async function augmentAppWithServiceWorker(appRoot, workspaceRoot, outputPath, b
141
141
  // Read the configuration file
142
142
  let config;
143
143
  try {
144
- const configurationData = await inputFileSystem.readFile(configPath, 'utf-8');
144
+ const configurationData = await inputputFileSystem.readFile(configPath, 'utf-8');
145
145
  config = JSON.parse(configurationData);
146
146
  }
147
147
  catch (error) {
@@ -158,7 +158,11 @@ async function augmentAppWithServiceWorker(appRoot, workspaceRoot, outputPath, b
158
158
  const result = await augmentAppWithServiceWorkerCore(config, new CliFilesystem(outputFileSystem, outputPath), baseHref);
159
159
  const copy = async (src, dest) => {
160
160
  const resolvedDest = path.join(outputPath, dest);
161
- return outputFileSystem.writeFile(resolvedDest, await inputFileSystem.readFile(src));
161
+ return inputputFileSystem === outputFileSystem
162
+ ? // Native FS (Builder).
163
+ inputputFileSystem.copyFile(src, resolvedDest, node_fs_1.constants.COPYFILE_FICLONE)
164
+ : // memfs (Webpack): Read the file from the input FS (disk) and write it to the output FS (memory).
165
+ outputFileSystem.writeFile(resolvedDest, await inputputFileSystem.readFile(src));
162
166
  };
163
167
  await outputFileSystem.writeFile(path.join(outputPath, 'ngsw.json'), result.manifest);
164
168
  for (const { source, destination } of result.assetFiles) {