@angular-devkit/build-angular 19.1.0-next.0 → 19.1.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,16 +1,16 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "19.1.0-next.0",
3
+ "version": "19.1.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.1901.0-next.0",
11
- "@angular-devkit/build-webpack": "0.1901.0-next.0",
12
- "@angular-devkit/core": "19.1.0-next.0",
13
- "@angular/build": "19.1.0-next.0",
10
+ "@angular-devkit/architect": "0.1901.0-next.1",
11
+ "@angular-devkit/build-webpack": "0.1901.0-next.1",
12
+ "@angular-devkit/core": "19.1.0-next.1",
13
+ "@angular/build": "19.1.0-next.1",
14
14
  "@babel/core": "7.26.0",
15
15
  "@babel/generator": "7.26.3",
16
16
  "@babel/helper-annotate-as-pure": "7.25.9",
@@ -21,7 +21,7 @@
21
21
  "@babel/preset-env": "7.26.0",
22
22
  "@babel/runtime": "7.26.0",
23
23
  "@discoveryjs/json-ext": "0.6.3",
24
- "@ngtools/webpack": "19.1.0-next.0",
24
+ "@ngtools/webpack": "19.1.0-next.1",
25
25
  "@vitejs/plugin-basic-ssl": "1.2.0",
26
26
  "ansi-colors": "4.1.3",
27
27
  "autoprefixer": "10.4.20",
@@ -53,12 +53,12 @@
53
53
  "semver": "7.6.3",
54
54
  "source-map-loader": "5.0.0",
55
55
  "source-map-support": "0.5.21",
56
- "terser": "5.36.0",
56
+ "terser": "5.37.0",
57
57
  "tree-kill": "1.2.2",
58
58
  "tslib": "2.8.1",
59
- "webpack": "5.97.0",
59
+ "webpack": "5.97.1",
60
60
  "webpack-dev-middleware": "7.4.2",
61
- "webpack-dev-server": "5.1.0",
61
+ "webpack-dev-server": "5.2.0",
62
62
  "webpack-merge": "6.0.1",
63
63
  "webpack-subresource-integrity": "5.1.0"
64
64
  },
@@ -70,7 +70,7 @@
70
70
  "@angular/localize": "^19.0.0 || ^19.1.0-next.0",
71
71
  "@angular/platform-server": "^19.0.0 || ^19.1.0-next.0",
72
72
  "@angular/service-worker": "^19.0.0 || ^19.1.0-next.0",
73
- "@angular/ssr": "^19.1.0-next.0",
73
+ "@angular/ssr": "^19.1.0-next.1",
74
74
  "@web/test-runner": "^0.19.0",
75
75
  "browser-sync": "^3.0.2",
76
76
  "jest": "^29.5.0",
@@ -316,10 +316,15 @@ function buildWebpackBrowser(options, context, transforms = {}) {
316
316
  })));
317
317
  }));
318
318
  function getLocaleBaseHref(i18n, locale) {
319
- if (i18n.locales[locale] && i18n.locales[locale]?.baseHref !== '') {
320
- return (0, utils_1.urlJoin)(options.baseHref || '', i18n.locales[locale].baseHref ?? `/${locale}/`);
319
+ if (i18n.flatOutput) {
320
+ return undefined;
321
321
  }
322
- return undefined;
322
+ const localeData = i18n.locales[locale];
323
+ if (!localeData) {
324
+ return undefined;
325
+ }
326
+ const baseHrefSuffix = localeData.baseHref ?? localeData.subPath + '/';
327
+ return baseHrefSuffix !== '' ? (0, utils_1.urlJoin)(options.baseHref || '', baseHrefSuffix) : undefined;
323
328
  }
324
329
  }
325
330
  function assertNever(input) {
@@ -33,7 +33,7 @@ async function normalizeOptions(context, projectName, options) {
33
33
  // Target specifier defaults to the current project's build target with no specified configuration
34
34
  const buildTargetSpecifier = options.buildTarget ?? ':';
35
35
  const buildTarget = (0, architect_1.targetFromTargetString)(buildTargetSpecifier, projectName, 'build');
36
- const i18nOptions = (0, private_1.createI18nOptions)(projectMetadata);
36
+ const i18nOptions = (0, private_1.createI18nOptions)(projectMetadata, /** inline */ false, context.logger);
37
37
  // Normalize xliff format extensions
38
38
  let format = options.format;
39
39
  switch (format) {
@@ -206,21 +206,7 @@ function normalizePolyfills(polyfills) {
206
206
  async function collectEntrypoints(options, context, projectSourceRoot) {
207
207
  // Glob for files to test.
208
208
  const testFiles = await (0, find_tests_1.findTests)(options.include ?? [], options.exclude ?? [], context.workspaceRoot, projectSourceRoot);
209
- const seen = new Set();
210
- return new Map(Array.from(testFiles, (testFile) => {
211
- const relativePath = path
212
- .relative(testFile.startsWith(projectSourceRoot) ? projectSourceRoot : context.workspaceRoot, testFile)
213
- .replace(/^[./]+/, '_')
214
- .replace(/\//g, '-');
215
- let uniqueName = `spec-${path.basename(relativePath, path.extname(relativePath))}`;
216
- let suffix = 2;
217
- while (seen.has(uniqueName)) {
218
- uniqueName = `${relativePath}-${suffix}`;
219
- ++suffix;
220
- }
221
- seen.add(uniqueName);
222
- return [uniqueName, testFile];
223
- }));
209
+ return (0, find_tests_1.getTestEntrypoints)(testFiles, { projectSourceRoot, workspaceRoot: context.workspaceRoot });
224
210
  }
225
211
  async function initializeApplication(options, context, karmaOptions, transforms = {}) {
226
212
  if (transforms.webpackConfiguration) {
@@ -49,7 +49,7 @@ const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
49
49
  const schema_1 = require("../browser/schema");
50
50
  const find_tests_plugin_1 = require("./find-tests-plugin");
51
51
  function execute(options, context, karmaOptions, transforms = {}) {
52
- return (0, rxjs_1.from)(initializeBrowser(options, context)).pipe((0, rxjs_1.switchMap)(async ([karma, webpackConfig]) => {
52
+ return (0, rxjs_1.from)(initializeBrowser(options, context, transforms.webpackConfiguration)).pipe((0, rxjs_1.switchMap)(async ([karma, webpackConfig]) => {
53
53
  const projectName = context.target?.project;
54
54
  if (!projectName) {
55
55
  throw new Error(`The 'karma' builder requires a target to be specified.`);
@@ -6,3 +6,10 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  export declare function findTests(include: string[], exclude: string[], workspaceRoot: string, projectSourceRoot: string): Promise<string[]>;
9
+ interface TestEntrypointsOptions {
10
+ projectSourceRoot: string;
11
+ workspaceRoot: string;
12
+ }
13
+ /** Generate unique bundle names for a set of test files. */
14
+ export declare function getTestEntrypoints(testFiles: string[], { projectSourceRoot, workspaceRoot }: TestEntrypointsOptions): Map<string, string>;
15
+ export {};
@@ -41,6 +41,7 @@ var __importStar = (this && this.__importStar) || (function () {
41
41
  })();
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.findTests = findTests;
44
+ exports.getTestEntrypoints = getTestEntrypoints;
44
45
  const fast_glob_1 = __importStar(require("fast-glob"));
45
46
  const fs_1 = require("fs");
46
47
  const path_1 = require("path");
@@ -51,6 +52,26 @@ async function findTests(include, exclude, workspaceRoot, projectSourceRoot) {
51
52
  // Unique file names
52
53
  return [...new Set(files.flat())];
53
54
  }
55
+ /** Generate unique bundle names for a set of test files. */
56
+ function getTestEntrypoints(testFiles, { projectSourceRoot, workspaceRoot }) {
57
+ const seen = new Set();
58
+ return new Map(Array.from(testFiles, (testFile) => {
59
+ const relativePath = removeRoots(testFile, [projectSourceRoot, workspaceRoot])
60
+ // Strip leading dots and path separators.
61
+ .replace(/^[./\\]+/, '')
62
+ // Replace any path separators with dashes.
63
+ .replace(/[/\\]/g, '-');
64
+ const baseName = `spec-${(0, path_1.basename)(relativePath, (0, path_1.extname)(relativePath))}`;
65
+ let uniqueName = baseName;
66
+ let suffix = 2;
67
+ while (seen.has(uniqueName)) {
68
+ uniqueName = `${baseName}-${suffix}`.replace(/([^\w](?:spec|test))-([\d]+)$/, '-$2$1');
69
+ ++suffix;
70
+ }
71
+ seen.add(uniqueName);
72
+ return [uniqueName, testFile];
73
+ }));
74
+ }
54
75
  const normalizePath = (path) => path.replace(/\\/g, '/');
55
76
  const removeLeadingSlash = (pattern) => {
56
77
  if (pattern.charAt(0) === '/') {
@@ -64,6 +85,14 @@ const removeRelativeRoot = (path, root) => {
64
85
  }
65
86
  return path;
66
87
  };
88
+ function removeRoots(path, roots) {
89
+ for (const root of roots) {
90
+ if (path.startsWith(root)) {
91
+ return path.substring(root.length);
92
+ }
93
+ }
94
+ return (0, path_1.basename)(path);
95
+ }
67
96
  async function findMatchingTests(pattern, ignore, workspaceRoot, projectSourceRoot) {
68
97
  // normalize pattern, glob lib only accepts forward slashes
69
98
  let normalizedPattern = normalizePath(pattern);
@@ -30,7 +30,7 @@ async function configureI18nBuild(context, options) {
30
30
  const buildOptions = { ...options };
31
31
  const tsConfig = await (0, read_tsconfig_1.readTsconfig)(buildOptions.tsConfig, context.workspaceRoot);
32
32
  const metadata = await context.getProjectMetadata(context.target);
33
- const i18n = (0, private_1.createI18nOptions)(metadata, buildOptions.localize);
33
+ const i18n = (0, private_1.createI18nOptions)(metadata, buildOptions.localize, context.logger);
34
34
  // No additional processing needed if no inlining requested and no source locale defined.
35
35
  if (!i18n.shouldInline && !i18n.hasDefinedSourceLocale) {
36
36
  return { buildOptions, i18n };
@@ -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.0-next.0';
13
+ const VERSION = '19.1.0-next.1';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -14,7 +14,7 @@ function ensureOutputPaths(baseOutputPath, i18n) {
14
14
  const outputPaths = i18n.shouldInline
15
15
  ? [...i18n.inlineLocales].map((l) => [
16
16
  l,
17
- i18n.flatOutput ? baseOutputPath : (0, path_1.join)(baseOutputPath, l),
17
+ i18n.flatOutput ? baseOutputPath : (0, path_1.join)(baseOutputPath, i18n.locales[l].subPath),
18
18
  ])
19
19
  : [['', baseOutputPath]];
20
20
  for (const [, outputPath] of outputPaths) {