@angular-devkit/build-angular 18.0.0-next.5 → 18.0.0-rc.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 CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "18.0.0-next.5",
3
+ "version": "18.0.0-rc.1",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "2.3.0",
10
- "@angular/build": "18.0.0-next.5",
11
- "@angular-devkit/architect": "0.1800.0-next.5",
12
- "@angular-devkit/build-webpack": "0.1800.0-next.5",
13
- "@angular-devkit/core": "18.0.0-next.5",
14
- "@babel/core": "7.24.4",
15
- "@babel/generator": "7.24.4",
10
+ "@angular/build": "18.0.0-rc.1",
11
+ "@angular-devkit/architect": "0.1800.0-rc.1",
12
+ "@angular-devkit/build-webpack": "0.1800.0-rc.1",
13
+ "@angular-devkit/core": "18.0.0-rc.1",
14
+ "@babel/core": "7.24.5",
15
+ "@babel/generator": "7.24.5",
16
16
  "@babel/helper-annotate-as-pure": "7.22.5",
17
- "@babel/helper-split-export-declaration": "7.22.6",
17
+ "@babel/helper-split-export-declaration": "7.24.5",
18
18
  "@babel/plugin-transform-async-generator-functions": "7.24.3",
19
19
  "@babel/plugin-transform-async-to-generator": "7.24.1",
20
20
  "@babel/plugin-transform-runtime": "7.24.3",
21
- "@babel/preset-env": "7.24.4",
22
- "@babel/runtime": "7.24.4",
21
+ "@babel/preset-env": "7.24.5",
22
+ "@babel/runtime": "7.24.5",
23
23
  "@discoveryjs/json-ext": "0.5.7",
24
- "@ngtools/webpack": "18.0.0-next.5",
24
+ "@ngtools/webpack": "18.0.0-rc.1",
25
25
  "@vitejs/plugin-basic-ssl": "1.1.0",
26
26
  "ansi-colors": "4.1.3",
27
27
  "autoprefixer": "10.4.19",
@@ -35,7 +35,7 @@
35
35
  "fast-glob": "3.3.2",
36
36
  "https-proxy-agent": "7.0.4",
37
37
  "http-proxy-middleware": "3.0.0",
38
- "inquirer": "9.2.19",
38
+ "inquirer": "9.2.20",
39
39
  "jsonc-parser": "3.2.1",
40
40
  "karma-source-map-support": "1.4.0",
41
41
  "less": "4.2.0",
@@ -54,16 +54,16 @@
54
54
  "postcss-loader": "8.1.1",
55
55
  "resolve-url-loader": "5.0.0",
56
56
  "rxjs": "7.8.1",
57
- "sass": "1.75.0",
57
+ "sass": "1.76.0",
58
58
  "sass-loader": "14.2.1",
59
59
  "semver": "7.6.0",
60
60
  "source-map-loader": "5.0.0",
61
61
  "source-map-support": "0.5.21",
62
- "terser": "5.30.4",
62
+ "terser": "5.31.0",
63
63
  "tree-kill": "1.2.2",
64
64
  "tslib": "2.6.2",
65
- "undici": "6.14.1",
66
- "vite": "5.2.10",
65
+ "undici": "6.15.0",
66
+ "vite": "5.2.11",
67
67
  "watchpack": "2.4.1",
68
68
  "webpack": "5.91.0",
69
69
  "webpack-dev-middleware": "7.2.1",
@@ -75,6 +75,7 @@ async function render({ serverBundlePath, document, url }) {
75
75
  });
76
76
  }
77
77
  // The below should really handled by the framework!!!.
78
+ // See: https://github.com/angular/angular/issues/51549
78
79
  let timer;
79
80
  const renderingTimeout = new Promise((_, reject) => (timer = setTimeout(() => reject(new Error(`Page ${new URL(url, 'resolve://').pathname} did not render in 30 seconds.`)), 30_000)));
80
81
  return Promise.race([renderAppPromise, renderingTimeout]).finally(() => clearTimeout(timer));
@@ -38,6 +38,7 @@ export declare function execute(options: DevServerBuilderOptions, context: Build
38
38
  middleware?: ((req: http.IncomingMessage, res: http.ServerResponse, next: (err?: unknown) => void) => void)[];
39
39
  builderSelector?: (info: BuilderSelectorInfo, logger: BuilderContext['logger']) => string;
40
40
  }): Observable<DevServerBuilderOutput>;
41
+ export declare function isEsbuildBased(builderName: string): builderName is '@angular/build:application' | '@angular-devkit/build-angular:application' | '@angular-devkit/build-angular:browser-esbuild';
41
42
  interface BuilderSelectorInfo {
42
43
  builderName: string;
43
44
  forceEsbuild: boolean;
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  return result;
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.execute = void 0;
33
+ exports.isEsbuildBased = exports.execute = void 0;
34
34
  const private_1 = require("@angular/build/private");
35
35
  const rxjs_1 = require("rxjs");
36
36
  const options_1 = require("./options");
@@ -62,10 +62,6 @@ function execute(options, context, transforms = {}, extensions) {
62
62
  if (transforms?.logging || transforms?.webpackConfiguration) {
63
63
  throw new Error(`The "application" and "browser-esbuild" builders do not support Webpack transforms.`);
64
64
  }
65
- // Warn if the initial options provided by the user enable prebundling but caching is disabled
66
- if (options.prebundle && !normalizedOptions.cacheOptions.enabled) {
67
- context.logger.warn(`Prebundling has been configured but will not be used because caching has been disabled.`);
68
- }
69
65
  if (options.allowedHosts?.length) {
70
66
  context.logger.warn(`The "allowedHosts" option will not be used because it is not supported by the "${builderName}" builder.`);
71
67
  }
@@ -136,6 +132,7 @@ function isEsbuildBased(builderName) {
136
132
  }
137
133
  return false;
138
134
  }
135
+ exports.isEsbuildBased = isEsbuildBased;
139
136
  function defaultBuilderSelector(info, logger) {
140
137
  if (isEsbuildBased(info.builderName)) {
141
138
  return info.builderName;
@@ -14,6 +14,8 @@ exports.normalizeOptions = void 0;
14
14
  const architect_1 = require("@angular-devkit/architect");
15
15
  const node_path_1 = __importDefault(require("node:path"));
16
16
  const normalize_cache_1 = require("../../utils/normalize-cache");
17
+ const normalize_optimization_1 = require("../../utils/normalize-optimization");
18
+ const builder_1 = require("./builder");
17
19
  /**
18
20
  * Normalize the user provided options by creating full paths for all path based options
19
21
  * and converting multi-form options into a single form that can be directly used
@@ -25,13 +27,29 @@ const normalize_cache_1 = require("../../utils/normalize-cache");
25
27
  * @returns An object containing normalized options required to perform the build.
26
28
  */
27
29
  async function normalizeOptions(context, projectName, options) {
28
- const workspaceRoot = context.workspaceRoot;
30
+ const { workspaceRoot, logger } = context;
29
31
  const projectMetadata = await context.getProjectMetadata(projectName);
30
32
  const projectRoot = node_path_1.default.join(workspaceRoot, projectMetadata.root ?? '');
31
33
  const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot);
32
34
  // Target specifier defaults to the current project's build target using a development configuration
33
35
  const buildTargetSpecifier = options.buildTarget ?? options.browserTarget ?? `::development`;
34
36
  const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
37
+ // Get the application builder options.
38
+ const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
39
+ const rawBuildOptions = await context.getTargetOptions(buildTarget);
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ const buildOptions = (await context.validateOptions(rawBuildOptions, browserBuilderName));
42
+ const optimization = (0, normalize_optimization_1.normalizeOptimization)(buildOptions.optimization);
43
+ if (options.prebundle !== false && (0, builder_1.isEsbuildBased)(browserBuilderName)) {
44
+ if (!cacheOptions.enabled) {
45
+ // Warn if the initial options provided by the user enable prebundling but caching is disabled
46
+ logger.warn('Prebundling has been configured but will not be used because caching has been disabled.');
47
+ }
48
+ else if (optimization.scripts) {
49
+ // Warn if the initial options provided by the user enable prebundling but script optimization is enabled.
50
+ logger.warn('Prebundling has been configured but will not be used because scripts optimization is enabled.');
51
+ }
52
+ }
35
53
  // Initial options to keep
36
54
  const { host, port, poll, open, verbose, watch, allowedHosts, disableHostCheck, liveReload, hmr, headers, proxyConfig, servePath, publicHost, ssl, sslCert, sslKey, forceEsbuild, prebundle, } = options;
37
55
  // Return all the normalized options
@@ -59,7 +77,7 @@ async function normalizeOptions(context, projectName, options) {
59
77
  sslKey,
60
78
  forceEsbuild,
61
79
  // Prebundling defaults to true but requires caching to function
62
- prebundle: cacheOptions.enabled && (prebundle ?? true),
80
+ prebundle: cacheOptions.enabled && !optimization.scripts && (prebundle ?? true),
63
81
  };
64
82
  }
65
83
  exports.normalizeOptions = normalizeOptions;
@@ -35,6 +35,5 @@
35
35
  "description": "Name of the file to output."
36
36
  }
37
37
  },
38
- "additionalProperties": false,
39
- "anyOf": [{ "required": ["buildTarget"] }, { "required": ["browserTarget"] }]
38
+ "additionalProperties": false
40
39
  }
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeCacheOptions = void 0;
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 = '18.0.0-next.5';
13
+ const VERSION = '18.0.0-rc.1';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&