@angular/build 20.0.0-next.4 → 20.0.0-next.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/build",
3
- "version": "20.0.0-next.4",
3
+ "version": "20.0.0-next.6",
4
4
  "description": "Official build system for Angular",
5
5
  "keywords": [
6
6
  "Angular CLI",
@@ -23,51 +23,56 @@
23
23
  "builders": "builders.json",
24
24
  "dependencies": {
25
25
  "@ampproject/remapping": "2.3.0",
26
- "@angular-devkit/architect": "0.2000.0-next.4",
26
+ "@angular-devkit/architect": "0.2000.0-next.6",
27
27
  "@babel/core": "7.26.10",
28
28
  "@babel/helper-annotate-as-pure": "7.25.9",
29
29
  "@babel/helper-split-export-declaration": "7.24.7",
30
- "@inquirer/confirm": "5.1.8",
30
+ "@inquirer/confirm": "5.1.9",
31
31
  "@vitejs/plugin-basic-ssl": "2.0.0",
32
- "beasties": "0.2.0",
32
+ "beasties": "0.3.2",
33
33
  "browserslist": "^4.23.0",
34
34
  "esbuild": "0.25.2",
35
35
  "https-proxy-agent": "7.0.6",
36
36
  "istanbul-lib-instrument": "6.0.3",
37
37
  "jsonc-parser": "3.3.1",
38
- "listr2": "8.2.5",
38
+ "listr2": "8.3.2",
39
39
  "magic-string": "0.30.17",
40
40
  "mrmime": "2.0.1",
41
41
  "parse5-html-rewriting-stream": "7.0.0",
42
42
  "picomatch": "4.0.2",
43
43
  "piscina": "4.9.2",
44
- "rollup": "4.39.0",
45
- "sass": "1.86.1",
44
+ "rollup": "4.40.0",
45
+ "sass": "1.86.3",
46
46
  "semver": "7.7.1",
47
47
  "source-map-support": "0.5.21",
48
48
  "tinyglobby": "0.2.12",
49
- "vite": "6.2.4",
49
+ "vite": "6.2.6",
50
50
  "watchpack": "2.4.2"
51
51
  },
52
52
  "optionalDependencies": {
53
53
  "lmdb": "3.2.6"
54
54
  },
55
55
  "peerDependencies": {
56
+ "@angular/core": "^20.0.0 || ^20.0.0-next.0",
56
57
  "@angular/compiler": "^20.0.0 || ^20.0.0-next.0",
57
58
  "@angular/compiler-cli": "^20.0.0 || ^20.0.0-next.0",
58
59
  "@angular/localize": "^20.0.0 || ^20.0.0-next.0",
59
60
  "@angular/platform-browser": "^20.0.0 || ^20.0.0-next.0",
60
61
  "@angular/platform-server": "^20.0.0 || ^20.0.0-next.0",
61
62
  "@angular/service-worker": "^20.0.0 || ^20.0.0-next.0",
62
- "@angular/ssr": "^20.0.0-next.4",
63
+ "@angular/ssr": "^20.0.0-next.6",
63
64
  "karma": "^6.4.0",
64
65
  "less": "^4.2.0",
65
66
  "ng-packagr": "^20.0.0 || ^20.0.0-next.0",
66
67
  "postcss": "^8.4.0",
67
68
  "tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
69
+ "tslib": "^2.3.0",
68
70
  "typescript": ">=5.8 <5.9"
69
71
  },
70
72
  "peerDependenciesMeta": {
73
+ "@angular/core": {
74
+ "optional": true
75
+ },
71
76
  "@angular/localize": {
72
77
  "optional": true
73
78
  },
@@ -476,7 +476,11 @@ function normalizeExternals(value) {
476
476
  if (!value) {
477
477
  return undefined;
478
478
  }
479
- return [...new Set(value.map((d) => (d.endsWith('/*') ? d.slice(0, -2) : d)))];
479
+ return [
480
+ ...new Set(value.map((d) =>
481
+ // remove "/*" wildcard in the end if provided string is not path-like
482
+ d.endsWith('/*') && !/^\.{0,2}\//.test(d) ? d.slice(0, -2) : d)),
483
+ ];
480
484
  }
481
485
  async function findFrameworkVersion(projectRoot) {
482
486
  // Create a custom require function for ESM compliance.
@@ -247,8 +247,9 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
247
247
  externalMetadata.explicitServer.length = 0;
248
248
  externalMetadata.implicitServer.length = 0;
249
249
  externalMetadata.implicitBrowser.length = 0;
250
- externalMetadata.explicitBrowser.push(...explicit);
251
- externalMetadata.explicitServer.push(...explicit, ...node_module_1.builtinModules);
250
+ const externalDeps = browserOptions.externalDependencies ?? [];
251
+ externalMetadata.explicitBrowser.push(...explicit, ...externalDeps);
252
+ externalMetadata.explicitServer.push(...explicit, ...externalDeps, ...node_module_1.builtinModules);
252
253
  externalMetadata.implicitServer.push(...implicitServerFiltered);
253
254
  externalMetadata.implicitBrowser.push(...implicitBrowserFiltered);
254
255
  // The below needs to be sorted as Vite uses these options are part of the hashing invalidation algorithm.
@@ -307,7 +308,10 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
307
308
  });
308
309
  }
309
310
  // Setup server and start listening
310
- 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);
311
+ const serverConfiguration = await setupServer(serverOptions, generatedFiles, assetFiles, browserOptions.preserveSymlinks, externalMetadata, ssrMode, prebundleTransformer, target, (0, internal_1.isZonelessApp)(polyfills), componentStyles, templateUpdates, browserOptions.loader, {
312
+ ...browserOptions.define,
313
+ 'ngHmrMode': browserOptions.templateUpdates ? 'true' : 'false',
314
+ }, extensions?.middleware, transformers?.indexHtml, thirdPartySourcemaps);
311
315
  server = await createServer(serverConfiguration);
312
316
  await server.listen();
313
317
  // Setup builder context logging for browser clients
@@ -323,6 +323,7 @@ async function initializeApplication(options, context, karmaOptions, transforms
323
323
  entryPoints,
324
324
  tsConfig: options.tsConfig,
325
325
  outputPath,
326
+ preserveSymlinks: options.preserveSymlinks,
326
327
  aot: options.aot,
327
328
  index: false,
328
329
  outputHashing: schema_1.OutputHashing.None,
@@ -57,7 +57,7 @@ const purge_cache_1 = require("../../utils/purge-cache");
57
57
  async function* execute(options, context) {
58
58
  // Purge old build disk cache.
59
59
  await (0, purge_cache_1.purgeStaleBuildCache)(context);
60
- const root = context.workspaceRoot;
60
+ const workspaceRoot = context.workspaceRoot;
61
61
  let packager;
62
62
  try {
63
63
  packager = (await Promise.resolve().then(() => __importStar(require('ng-packagr')))).ngPackagr();
@@ -72,15 +72,18 @@ async function* execute(options, context) {
72
72
  }
73
73
  throw error;
74
74
  }
75
- packager.forProject((0, node_path_1.resolve)(root, options.project));
76
- if (options.tsConfig) {
77
- packager.withTsConfig((0, node_path_1.resolve)(root, options.tsConfig));
78
- }
79
75
  const projectName = context.target?.project;
80
76
  if (!projectName) {
81
77
  throw new Error('The builder requires a target.');
82
78
  }
83
79
  const metadata = await context.getProjectMetadata(projectName);
80
+ const ngPackagrConfig = options.project
81
+ ? (0, node_path_1.join)(workspaceRoot, options.project)
82
+ : (0, node_path_1.join)(workspaceRoot, metadata.root ?? '', 'ng-package.json');
83
+ packager.forProject(ngPackagrConfig);
84
+ if (options.tsConfig) {
85
+ packager.withTsConfig((0, node_path_1.resolve)(workspaceRoot, options.tsConfig));
86
+ }
84
87
  const { enabled: cacheEnabled, path: cacheDirectory } = (0, normalize_cache_1.normalizeCacheOptions)(metadata, context.workspaceRoot);
85
88
  const ngPackagrOptions = {
86
89
  cacheEnabled,
@@ -9,7 +9,7 @@ export type Schema = {
9
9
  /**
10
10
  * The file path for the ng-packagr configuration file, relative to the current workspace.
11
11
  */
12
- project: string;
12
+ project?: string;
13
13
  /**
14
14
  * The full path for the TypeScript configuration file, relative to the current workspace.
15
15
  */
@@ -22,6 +22,5 @@
22
22
  "description": "Enable and define the file watching poll time period in milliseconds."
23
23
  }
24
24
  },
25
- "additionalProperties": false,
26
- "required": ["project"]
25
+ "additionalProperties": false
27
26
  }
@@ -14,6 +14,7 @@ export interface CompilerPluginOptions {
14
14
  sourcemap: boolean | 'external';
15
15
  tsconfig: string;
16
16
  jit?: boolean;
17
+ includeTestMetadata?: boolean;
17
18
  advancedOptimizations?: boolean;
18
19
  thirdPartySourcemaps?: boolean;
19
20
  fileReplacements?: Record<string, string>;
@@ -233,7 +233,7 @@ function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBun
233
233
  let referencedFiles;
234
234
  let externalStylesheets;
235
235
  try {
236
- const initializationResult = await compilation.initialize(pluginOptions.tsconfig, hostOptions, createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, build.initialOptions.conditions, build.initialOptions.absWorkingDir));
236
+ const initializationResult = await compilation.initialize(pluginOptions.tsconfig, hostOptions, createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, build.initialOptions.conditions));
237
237
  shouldTsIgnoreJs = !initializationResult.compilerOptions.allowJs;
238
238
  // Isolated modules option ensures safe non-TypeScript transpilation.
239
239
  // Typescript printing support for sourcemaps is not yet integrated.
@@ -474,7 +474,7 @@ async function bundleExternalStylesheet(stylesheetBundler, stylesheetFile, exter
474
474
  });
475
475
  }
476
476
  }
477
- function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, customConditions, absWorkingDir) {
477
+ function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, customConditions) {
478
478
  return (compilerOptions) => {
479
479
  // target of 9 is ES2022 (using the number avoids an expensive import of typescript just for an enum)
480
480
  if (compilerOptions.target === undefined || compilerOptions.target < 9 /** ES2022 */) {
@@ -536,12 +536,14 @@ function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserve
536
536
  }
537
537
  // Synchronize custom resolve conditions.
538
538
  // Set if using the supported bundler resolution mode (bundler is the default in new projects)
539
- if (compilerOptions.moduleResolution === 100 /* ModuleResolutionKind.Bundler */) {
539
+ if (compilerOptions.moduleResolution === 100 /* ModuleResolutionKind.Bundler */ ||
540
+ compilerOptions.module === 200 /** ModuleKind.Preserve */) {
540
541
  compilerOptions.customConditions = customConditions;
541
542
  }
542
543
  return {
543
544
  ...compilerOptions,
544
545
  noEmitOnError: false,
546
+ composite: false,
545
547
  inlineSources: !!pluginOptions.sourcemap,
546
548
  inlineSourceMap: !!pluginOptions.sourcemap,
547
549
  sourceMap: undefined,
@@ -550,6 +552,7 @@ function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserve
550
552
  preserveSymlinks,
551
553
  externalRuntimeStyles: pluginOptions.externalRuntimeStyles,
552
554
  _enableHmr: !!pluginOptions.templateUpdates,
555
+ supportTestBed: !!pluginOptions.includeTestMetadata,
553
556
  };
554
557
  };
555
558
  }
@@ -58,6 +58,10 @@ class ComponentStylesheetBundler {
58
58
  else {
59
59
  buildOptions.entryPoints = [entry];
60
60
  }
61
+ // Angular encapsulation does not support nesting
62
+ // See: https://github.com/angular/angular/issues/58996
63
+ buildOptions.supported ??= {};
64
+ buildOptions.supported['nesting'] = false;
61
65
  return buildOptions;
62
66
  });
63
67
  });
@@ -89,6 +93,10 @@ class ComponentStylesheetBundler {
89
93
  else {
90
94
  buildOptions.entryPoints = [`${namespace};${entry}`];
91
95
  }
96
+ // Angular encapsulation does not support nesting
97
+ // See: https://github.com/angular/angular/issues/58996
98
+ buildOptions.supported ??= {};
99
+ buildOptions.supported['nesting'] = false;
92
100
  buildOptions.plugins.push({
93
101
  name: 'angular-component-styles',
94
102
  setup(build) {
@@ -9,7 +9,7 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.createCompilerPluginOptions = createCompilerPluginOptions;
11
11
  function createCompilerPluginOptions(options, sourceFileCache, loadResultCache, templateUpdates) {
12
- const { sourcemapOptions, tsconfig, fileReplacements, advancedOptimizations, jit, externalRuntimeStyles, instrumentForCoverage, } = options;
12
+ const { sourcemapOptions, tsconfig, fileReplacements, advancedOptimizations, jit, externalRuntimeStyles, instrumentForCoverage, optimizationOptions, } = options;
13
13
  const incremental = !!options.watch;
14
14
  return {
15
15
  sourcemap: !!sourcemapOptions.scripts && (sourcemapOptions.hidden ? 'external' : true),
@@ -24,5 +24,6 @@ function createCompilerPluginOptions(options, sourceFileCache, loadResultCache,
24
24
  externalRuntimeStyles,
25
25
  instrumentForCoverage,
26
26
  templateUpdates,
27
+ includeTestMetadata: !optimizationOptions.scripts,
27
28
  };
28
29
  }
@@ -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-next.4';
13
+ const VERSION = '20.0.0-next.6';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&