@angular-devkit/build-angular 18.2.1 → 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 CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "18.2.1",
3
+ "version": "19.0.0-next.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-devkit/architect": "0.1802.1",
11
- "@angular-devkit/build-webpack": "0.1802.1",
12
- "@angular-devkit/core": "18.2.1",
13
- "@angular/build": "18.2.1",
10
+ "@angular-devkit/architect": "0.1900.0-next.1",
11
+ "@angular-devkit/build-webpack": "0.1900.0-next.1",
12
+ "@angular-devkit/core": "19.0.0-next.1",
13
+ "@angular/build": "19.0.0-next.1",
14
14
  "@babel/core": "7.25.2",
15
- "@babel/generator": "7.25.0",
15
+ "@babel/generator": "7.25.4",
16
16
  "@babel/helper-annotate-as-pure": "7.24.7",
17
17
  "@babel/helper-split-export-declaration": "7.24.7",
18
- "@babel/plugin-transform-async-generator-functions": "7.25.0",
18
+ "@babel/plugin-transform-async-generator-functions": "7.25.4",
19
19
  "@babel/plugin-transform-async-to-generator": "7.24.7",
20
- "@babel/plugin-transform-runtime": "7.24.7",
21
- "@babel/preset-env": "7.25.3",
22
- "@babel/runtime": "7.25.0",
20
+ "@babel/plugin-transform-runtime": "7.25.4",
21
+ "@babel/preset-env": "7.25.4",
22
+ "@babel/runtime": "7.25.4",
23
23
  "@discoveryjs/json-ext": "0.6.1",
24
- "@ngtools/webpack": "18.2.1",
24
+ "@ngtools/webpack": "19.0.0-next.1",
25
25
  "@vitejs/plugin-basic-ssl": "1.1.0",
26
26
  "ansi-colors": "4.1.3",
27
27
  "autoprefixer": "10.4.20",
@@ -30,7 +30,7 @@
30
30
  "copy-webpack-plugin": "12.0.2",
31
31
  "critters": "0.0.24",
32
32
  "css-loader": "7.1.2",
33
- "esbuild-wasm": "0.23.0",
33
+ "esbuild-wasm": "0.23.1",
34
34
  "fast-glob": "3.3.2",
35
35
  "http-proxy-middleware": "3.0.0",
36
36
  "https-proxy-agent": "7.0.5",
@@ -42,7 +42,7 @@
42
42
  "license-webpack-plugin": "4.0.2",
43
43
  "loader-utils": "3.3.1",
44
44
  "magic-string": "0.30.11",
45
- "mini-css-extract-plugin": "2.9.0",
45
+ "mini-css-extract-plugin": "2.9.1",
46
46
  "mrmime": "2.0.0",
47
47
  "open": "10.1.0",
48
48
  "ora": "5.4.1",
@@ -53,36 +53,37 @@
53
53
  "postcss-loader": "8.1.1",
54
54
  "resolve-url-loader": "5.0.0",
55
55
  "rxjs": "7.8.1",
56
- "sass": "1.77.6",
57
- "sass-loader": "16.0.0",
56
+ "sass": "1.77.8",
57
+ "sass-loader": "16.0.1",
58
58
  "semver": "7.6.3",
59
59
  "source-map-loader": "5.0.0",
60
60
  "source-map-support": "0.5.21",
61
61
  "terser": "5.31.6",
62
62
  "tree-kill": "1.2.2",
63
63
  "tslib": "2.6.3",
64
- "vite": "5.4.0",
65
- "watchpack": "2.4.1",
64
+ "vite": "5.4.2",
65
+ "watchpack": "2.4.2",
66
66
  "webpack": "5.93.0",
67
- "webpack-dev-middleware": "7.3.0",
67
+ "webpack-dev-middleware": "7.4.2",
68
68
  "webpack-dev-server": "5.0.4",
69
69
  "webpack-merge": "6.0.1",
70
70
  "webpack-subresource-integrity": "5.1.0"
71
71
  },
72
72
  "optionalDependencies": {
73
- "esbuild": "0.23.0"
73
+ "esbuild": "0.23.1"
74
74
  },
75
75
  "peerDependencies": {
76
- "@angular/compiler-cli": "^18.0.0",
77
- "@angular/localize": "^18.0.0",
78
- "@angular/platform-server": "^18.0.0",
79
- "@angular/service-worker": "^18.0.0",
76
+ "@angular/compiler-cli": "^19.0.0-next.0",
77
+ "@angular/localize": "^19.0.0-next.0",
78
+ "@angular/platform-server": "^19.0.0-next.0",
79
+ "@angular/service-worker": "^19.0.0-next.0",
80
+ "@angular/ssr": "^19.0.0-next.1",
80
81
  "@web/test-runner": "^0.18.0",
81
82
  "browser-sync": "^3.0.2",
82
83
  "jest": "^29.5.0",
83
84
  "jest-environment-jsdom": "^29.5.0",
84
85
  "karma": "^6.3.0",
85
- "ng-packagr": "^18.0.0",
86
+ "ng-packagr": "^19.0.0-next.0",
86
87
  "protractor": "^7.0.0",
87
88
  "tailwindcss": "^2.0.0 || ^3.0.0",
88
89
  "typescript": ">=5.4 <5.6"
@@ -97,6 +98,9 @@
97
98
  "@angular/service-worker": {
98
99
  "optional": true
99
100
  },
101
+ "@angular/ssr": {
102
+ "optional": true
103
+ },
100
104
  "@web/test-runner": {
101
105
  "optional": true
102
106
  },
@@ -32,7 +32,7 @@ async function normalizeOptions(context, projectName, options) {
32
32
  const projectRoot = node_path_1.default.join(workspaceRoot, projectMetadata.root ?? '');
33
33
  const cacheOptions = (0, normalize_cache_1.normalizeCacheOptions)(projectMetadata, workspaceRoot);
34
34
  // Target specifier defaults to the current project's build target using a development configuration
35
- const buildTargetSpecifier = options.buildTarget ?? options.browserTarget ?? `::development`;
35
+ const buildTargetSpecifier = options.buildTarget ?? `::development`;
36
36
  const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
37
37
  // Get the application builder options.
38
38
  const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
@@ -7,19 +7,12 @@ export interface Schema {
7
7
  * using the 'application' or other esbuild-based builders.
8
8
  */
9
9
  allowedHosts?: string[];
10
- /**
11
- * A browser builder target to serve in the format of `project:target[:configuration]`. You
12
- * can also pass in more than one configuration name as a comma-separated list. Example:
13
- * `project:target:production,staging`.
14
- * @deprecated Use 'buildTarget' instead.
15
- */
16
- browserTarget?: string;
17
10
  /**
18
11
  * A build builder target to serve in the format of `project:target[:configuration]`. You
19
12
  * can also pass in more than one configuration name as a comma-separated list. Example:
20
13
  * `project:target:production,staging`.
21
14
  */
22
- buildTarget?: string;
15
+ buildTarget: string;
23
16
  /**
24
17
  * Don't verify connected clients are part of allowed hosts. This option has no effect when
25
18
  * using the 'application' or other esbuild-based builders.
@@ -4,12 +4,6 @@
4
4
  "description": "Dev Server target options for Build Facade.",
5
5
  "type": "object",
6
6
  "properties": {
7
- "browserTarget": {
8
- "type": "string",
9
- "description": "A browser builder target to serve in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
10
- "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
11
- "x-deprecated": "Use 'buildTarget' instead."
12
- },
13
7
  "buildTarget": {
14
8
  "type": "string",
15
9
  "description": "A build builder target to serve in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
@@ -138,5 +132,5 @@
138
132
  }
139
133
  },
140
134
  "additionalProperties": false,
141
- "anyOf": [{ "required": ["buildTarget"] }, { "required": ["browserTarget"] }]
135
+ "required": ["buildTarget"]
142
136
  }
@@ -31,7 +31,7 @@ async function normalizeOptions(context, projectName, options) {
31
31
  const projectMetadata = await context.getProjectMetadata(projectName);
32
32
  const projectRoot = node_path_1.default.join(workspaceRoot, projectMetadata.root ?? '');
33
33
  // Target specifier defaults to the current project's build target with no specified configuration
34
- const buildTargetSpecifier = options.buildTarget ?? options.browserTarget ?? ':';
34
+ const buildTargetSpecifier = options.buildTarget ?? ':';
35
35
  const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
36
36
  const i18nOptions = (0, private_1.createI18nOptions)(projectMetadata);
37
37
  // Normalize xliff format extensions
@@ -2,13 +2,6 @@
2
2
  * Extract i18n target options for Build Facade.
3
3
  */
4
4
  export interface Schema {
5
- /**
6
- * A browser builder target to extract i18n messages in the format of
7
- * `project:target[:configuration]`. You can also pass in more than one configuration name
8
- * as a comma-separated list. Example: `project:target:production,staging`.
9
- * @deprecated Use 'buildTarget' instead.
10
- */
11
- browserTarget?: string;
12
5
  /**
13
6
  * A builder target to extract i18n messages in the format of
14
7
  * `project:target[:configuration]`. You can also pass in more than one configuration name
@@ -4,12 +4,6 @@
4
4
  "description": "Extract i18n target options for Build Facade.",
5
5
  "type": "object",
6
6
  "properties": {
7
- "browserTarget": {
8
- "type": "string",
9
- "description": "A browser builder target to extract i18n messages in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
10
- "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
11
- "x-deprecated": "Use 'buildTarget' instead."
12
- },
13
7
  "buildTarget": {
14
8
  "type": "string",
15
9
  "description": "A builder target to extract i18n messages in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
@@ -39,14 +39,15 @@ const path = __importStar(require("node:path"));
39
39
  const node_worker_threads_1 = require("node:worker_threads");
40
40
  const { zonePackage, serverBundlePath, outputPath, indexFile } = node_worker_threads_1.workerData;
41
41
  async function extract() {
42
- const { AppServerModule, extractRoutes, default: bootstrapAppFn, } = (await Promise.resolve(`${serverBundlePath}`).then(s => __importStar(require(s))));
42
+ const { AppServerModule, ɵgetRoutesFromAngularRouterConfig: getRoutesFromAngularRouterConfig, default: bootstrapAppFn, } = (await Promise.resolve(`${serverBundlePath}`).then(s => __importStar(require(s))));
43
43
  const browserIndexInputPath = path.join(outputPath, indexFile);
44
44
  const document = await fs.promises.readFile(browserIndexInputPath, 'utf8');
45
45
  const bootstrapAppFnOrModule = bootstrapAppFn || AppServerModule;
46
46
  (0, node_assert_1.default)(bootstrapAppFnOrModule, `The file "${serverBundlePath}" does not have a default export for an AppServerModule or a bootstrapping function.`);
47
47
  const routes = [];
48
- for await (const { route, success } of extractRoutes(bootstrapAppFnOrModule, document)) {
49
- if (success) {
48
+ const { routes: extractRoutes } = await getRoutesFromAngularRouterConfig(bootstrapAppFnOrModule, document, new URL('http://localhost'));
49
+ for (const { route, redirectTo } of extractRoutes) {
50
+ if (redirectTo === undefined && !/[:*]/.test(route)) {
50
51
  routes.push(route);
51
52
  }
52
53
  }
@@ -183,13 +183,16 @@ function getPlatformServerExportsConfig(wco) {
183
183
  // Only add `@angular/platform-server` exports when it is installed.
184
184
  // In some cases this builder is used when `@angular/platform-server` is not installed.
185
185
  // Example: when using `@nguniversal/common/clover` which does not need `@angular/platform-server`.
186
- return (0, helpers_1.isPlatformServerInstalled)(wco.root)
186
+ return (0, helpers_1.isPackageInstalled)(wco.root, '@angular/platform-server')
187
187
  ? {
188
188
  module: {
189
189
  rules: [
190
190
  {
191
191
  loader: require.resolve('./platform-server-exports-loader'),
192
192
  include: [path.resolve(wco.root, wco.buildOptions.main)],
193
+ options: {
194
+ angularSSRInstalled: (0, helpers_1.isPackageInstalled)(wco.root, '@angular/ssr'),
195
+ },
193
196
  },
194
197
  ],
195
198
  },
@@ -10,4 +10,6 @@
10
10
  * allow exports from multiple files in the same entry.
11
11
  * @see https://github.com/webpack/webpack/issues/15936.
12
12
  */
13
- export default function (this: import('webpack').LoaderContext<{}>, content: string, map: Parameters<import('webpack').LoaderDefinitionFunction>[1]): void;
13
+ export default function (this: import('webpack').LoaderContext<{
14
+ angularSSRInstalled: boolean;
15
+ }>, content: string, map: Parameters<import('webpack').LoaderDefinitionFunction>[1]): void;
@@ -8,23 +8,23 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.default = default_1;
11
- const node_fs_1 = require("node:fs");
12
- const node_path_1 = require("node:path");
13
11
  /**
14
12
  * This loader is needed to add additional exports and is a workaround for a Webpack bug that doesn't
15
13
  * allow exports from multiple files in the same entry.
16
14
  * @see https://github.com/webpack/webpack/issues/15936.
17
15
  */
18
16
  function default_1(content, map) {
19
- const extractorPath = (0, node_path_1.join)((0, node_path_1.dirname)(require.resolve('@angular/build/package.json')), 'src/utils/routes-extractor/extractor.js');
20
- const source = `${content}
17
+ const { angularSSRInstalled } = this.getOptions();
18
+ let source = `${content}
21
19
 
22
20
  // EXPORTS added by @angular-devkit/build-angular
23
21
  export { renderApplication, renderModule, ɵSERVER_CONTEXT } from '@angular/platform-server';
24
- ` +
25
- // We do not import it directly so that node.js modules are resolved using the correct context.
26
- // Remove source map URL comments from the code if a sourcemap is present as this will not match the file.
27
- (0, node_fs_1.readFileSync)(extractorPath, 'utf-8').replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, '');
22
+ `;
23
+ if (angularSSRInstalled) {
24
+ source += `
25
+ export { ɵgetRoutesFromAngularRouterConfig } from '@angular/ssr';
26
+ `;
27
+ }
28
28
  this.callback(null, source, map);
29
29
  return;
30
30
  }
@@ -62,7 +62,8 @@ async function getCommonConfig(wco) {
62
62
  // Load ESM `@angular/compiler-cli` using the TypeScript dynamic import workaround.
63
63
  // Once TypeScript provides support for keeping the dynamic import this workaround can be
64
64
  // changed to a direct dynamic import.
65
- const { GLOBAL_DEFS_FOR_TERSER, GLOBAL_DEFS_FOR_TERSER_WITH_AOT, VERSION: NG_VERSION, } = await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli');
65
+ const { VERSION: NG_VERSION } = await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli');
66
+ const { GLOBAL_DEFS_FOR_TERSER, GLOBAL_DEFS_FOR_TERSER_WITH_AOT } = await (0, load_esm_1.loadEsmModule)('@angular/compiler-cli/private/tooling');
66
67
  // determine hashing format
67
68
  const hashFormat = (0, helpers_1.getOutputHashFormat)(buildOptions.outputHashing);
68
69
  if (buildOptions.progress) {
@@ -85,7 +86,8 @@ async function getCommonConfig(wco) {
85
86
  if (isPlatformServer) {
86
87
  // Fixes Critical dependency: the request of a dependency is an expression
87
88
  extraPlugins.push(new webpack_2.ContextReplacementPlugin(/@?hapi|express[\\/]/));
88
- if ((0, helpers_1.isPlatformServerInstalled)(wco.root) && Array.isArray(entryPoints['main'])) {
89
+ if ((0, helpers_1.isPackageInstalled)(wco.root, '@angular/platform-server') &&
90
+ Array.isArray(entryPoints['main'])) {
89
91
  // This import must come before any imports (direct or transitive) that rely on DOM built-ins being
90
92
  // available, such as `@angular/elements`.
91
93
  entryPoints['main'].unshift('@angular/platform-server/init');
@@ -34,7 +34,10 @@ export declare function globalScriptsByBundleName(scripts: ScriptElement[]): {
34
34
  export declare function assetPatterns(root: string, assets: AssetPatternClass[]): ObjectPattern[];
35
35
  export declare function getStatsOptions(verbose?: boolean): WebpackStatsOptions;
36
36
  /**
37
- * @param root the workspace root
38
- * @returns `true` when `@angular/platform-server` is installed.
37
+ * Checks if a specified package is installed in the given workspace.
38
+ *
39
+ * @param root - The root directory of the workspace.
40
+ * @param name - The name of the package to check for.
41
+ * @returns `true` if the package is installed, `false` otherwise.
39
42
  */
40
- export declare function isPlatformServerInstalled(root: string): boolean;
43
+ export declare function isPackageInstalled(root: string, name: string): boolean;
@@ -42,7 +42,7 @@ exports.getCacheSettings = getCacheSettings;
42
42
  exports.globalScriptsByBundleName = globalScriptsByBundleName;
43
43
  exports.assetPatterns = assetPatterns;
44
44
  exports.getStatsOptions = getStatsOptions;
45
- exports.isPlatformServerInstalled = isPlatformServerInstalled;
45
+ exports.isPackageInstalled = isPackageInstalled;
46
46
  const crypto_1 = require("crypto");
47
47
  const fast_glob_1 = __importDefault(require("fast-glob"));
48
48
  const path = __importStar(require("path"));
@@ -276,12 +276,15 @@ function getStatsOptions(verbose = false) {
276
276
  : webpackOutputOptions;
277
277
  }
278
278
  /**
279
- * @param root the workspace root
280
- * @returns `true` when `@angular/platform-server` is installed.
279
+ * Checks if a specified package is installed in the given workspace.
280
+ *
281
+ * @param root - The root directory of the workspace.
282
+ * @param name - The name of the package to check for.
283
+ * @returns `true` if the package is installed, `false` otherwise.
281
284
  */
282
- function isPlatformServerInstalled(root) {
285
+ function isPackageInstalled(root, name) {
283
286
  try {
284
- require.resolve('@angular/platform-server', { paths: [root] });
287
+ require.resolve(name, { paths: [root] });
285
288
  return true;
286
289
  }
287
290
  catch {
@@ -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 = '18.2.1';
13
+ const VERSION = '19.0.0-next.1';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&