@nx/angular 22.4.0-beta.3 → 22.4.0-beta.4

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/migrations.json CHANGED
@@ -2170,6 +2170,77 @@
2170
2170
  "alwaysAddToPackageJson": false
2171
2171
  }
2172
2172
  }
2173
+ },
2174
+ "22.4.0": {
2175
+ "version": "22.4.0-beta.4",
2176
+ "x-prompt": "Do you want to update the Angular version to v21.1?",
2177
+ "requires": {
2178
+ "@angular/core": ">=21.0.0 <21.1.0"
2179
+ },
2180
+ "packages": {
2181
+ "@angular/cli": {
2182
+ "version": "~21.1.0",
2183
+ "alwaysAddToPackageJson": false,
2184
+ "ignorePackageGroup": true,
2185
+ "ignoreMigrations": true
2186
+ },
2187
+ "@angular-devkit/build-angular": {
2188
+ "version": "~21.1.0",
2189
+ "alwaysAddToPackageJson": false
2190
+ },
2191
+ "@angular-devkit/core": {
2192
+ "version": "~21.1.0",
2193
+ "alwaysAddToPackageJson": false
2194
+ },
2195
+ "@angular-devkit/schematics": {
2196
+ "version": "~21.1.0",
2197
+ "alwaysAddToPackageJson": false
2198
+ },
2199
+ "@angular/build": {
2200
+ "version": "~21.1.0",
2201
+ "alwaysAddToPackageJson": false
2202
+ },
2203
+ "@angular/pwa": {
2204
+ "version": "~21.1.0",
2205
+ "alwaysAddToPackageJson": false
2206
+ },
2207
+ "@angular/ssr": {
2208
+ "version": "~21.1.0",
2209
+ "alwaysAddToPackageJson": false
2210
+ },
2211
+ "@schematics/angular": {
2212
+ "version": "~21.1.0",
2213
+ "alwaysAddToPackageJson": false
2214
+ },
2215
+ "@angular-devkit/architect": {
2216
+ "version": "~0.2101.0",
2217
+ "alwaysAddToPackageJson": false
2218
+ },
2219
+ "@angular-devkit/build-webpack": {
2220
+ "version": "~0.2101.0",
2221
+ "alwaysAddToPackageJson": false
2222
+ },
2223
+ "@angular/core": {
2224
+ "version": "~21.1.0",
2225
+ "alwaysAddToPackageJson": true
2226
+ },
2227
+ "@angular/material": {
2228
+ "version": "~21.1.0",
2229
+ "alwaysAddToPackageJson": false
2230
+ },
2231
+ "@angular/cdk": {
2232
+ "version": "~21.1.0",
2233
+ "alwaysAddToPackageJson": false
2234
+ },
2235
+ "@angular/google-maps": {
2236
+ "version": "~21.1.0",
2237
+ "alwaysAddToPackageJson": false
2238
+ },
2239
+ "ng-packagr": {
2240
+ "version": "~21.1.0",
2241
+ "alwaysAddToPackageJson": false
2242
+ }
2243
+ }
2173
2244
  }
2174
2245
  }
2175
2246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "22.4.0-beta.3",
3
+ "version": "22.4.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -62,14 +62,14 @@
62
62
  "migrations": "./migrations.json"
63
63
  },
64
64
  "dependencies": {
65
- "@nx/devkit": "22.4.0-beta.3",
66
- "@nx/eslint": "22.4.0-beta.3",
67
- "@nx/js": "22.4.0-beta.3",
68
- "@nx/module-federation": "22.4.0-beta.3",
69
- "@nx/rspack": "22.4.0-beta.3",
70
- "@nx/web": "22.4.0-beta.3",
71
- "@nx/webpack": "22.4.0-beta.3",
72
- "@nx/workspace": "22.4.0-beta.3",
65
+ "@nx/devkit": "22.4.0-beta.4",
66
+ "@nx/eslint": "22.4.0-beta.4",
67
+ "@nx/js": "22.4.0-beta.4",
68
+ "@nx/module-federation": "22.4.0-beta.4",
69
+ "@nx/rspack": "22.4.0-beta.4",
70
+ "@nx/web": "22.4.0-beta.4",
71
+ "@nx/webpack": "22.4.0-beta.4",
72
+ "@nx/workspace": "22.4.0-beta.4",
73
73
  "@phenomnomnominal/tsquery": "~6.1.4",
74
74
  "@typescript-eslint/type-utils": "^8.0.0",
75
75
  "enquirer": "~2.3.6",
@@ -68,8 +68,7 @@
68
68
  },
69
69
  "ui": {
70
70
  "type": "boolean",
71
- "description": "Enables the Vitest UI for interactive test execution. This option is only available for the Vitest runner.",
72
- "default": false
71
+ "description": "Enables the Vitest UI for interactive test execution. This option is only available for the Vitest runner."
73
72
  },
74
73
  "coverage": {
75
74
  "type": "boolean",
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAOD,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AACF,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,aAAa,GAAG,SAAS,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;CACtD,CAAC;AAkDF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,oBAAoB,CAqB7D,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAYpB,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAOD,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AACF,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,aAAa,GAAG,SAAS,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;CACtD,CAAC;AAkDF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,oBAAoB,CAqB7D,CAAC"}
@@ -12,6 +12,7 @@ const posix = tslib_1.__importStar(require("node:path/posix"));
12
12
  const devkit_internals_1 = require("nx/src/devkit-internals");
13
13
  const cache_directory_1 = require("nx/src/utils/cache-directory");
14
14
  const targets_1 = require("../utils/targets");
15
+ const vitest_1 = require("./utils/vitest");
15
16
  const knownExecutors = {
16
17
  appShell: new Set(['@angular-devkit/build-angular:app-shell']),
17
18
  build: new Set([
@@ -134,7 +135,7 @@ async function buildAngularProjects(configFilePath, options, angularWorkspaceRoo
134
135
  };
135
136
  }
136
137
  else if (knownExecutors.test.has(angularTarget.builder)) {
137
- updateTestTarget(projectName, targets[nxTargetName], angularTarget, context, angularWorkspaceRoot, project.root, namedInputs, externalDependencies);
138
+ await updateTestTarget(projectName, targets[nxTargetName], angularTarget, context, angularWorkspaceRoot, project.root, namedInputs, externalDependencies);
138
139
  }
139
140
  else if (knownExecutors.server.has(angularTarget.builder)) {
140
141
  updateServerTarget(targets[nxTargetName], angularTarget, context, angularWorkspaceRoot, project.root, namedInputs);
@@ -238,7 +239,7 @@ async function updateBuildTarget(projectName, targetName, target, angularTarget,
238
239
  target.metadata.help.example.options = { localize: true };
239
240
  }
240
241
  }
241
- function updateTestTarget(projectName, target, angularTarget, context, angularWorkspaceRoot, projectRoot, namedInputs, externalDependencies) {
242
+ async function updateTestTarget(projectName, target, angularTarget, context, angularWorkspaceRoot, projectRoot, namedInputs, externalDependencies) {
242
243
  target.cache = true;
243
244
  target.inputs =
244
245
  'production' in namedInputs
@@ -252,10 +253,8 @@ function updateTestTarget(projectName, target, angularTarget, context, angularWo
252
253
  externalDependencies.push('karma');
253
254
  }
254
255
  else {
256
+ target.outputs = await getVitestTargetOutputs(angularTarget, angularWorkspaceRoot, projectRoot, context);
255
257
  externalDependencies.push('vitest');
256
- // this is currently hard-coded in the vitest executor
257
- // https://github.com/angular/angular-cli/blob/5cc8c8479a3f6959f2834145b5163ef2245c2f31/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts#L280
258
- target.outputs = [`{workspaceRoot}/coverage/${projectName}`];
259
258
  }
260
259
  if (angularTarget.builder === '@angular/build:unit-test') {
261
260
  target.metadata.help.example.options = { coverage: true };
@@ -369,6 +368,86 @@ function getKarmaTargetOutputs(target, angularWorkspaceRoot, projectRoot, contex
369
368
  }
370
369
  return [defaultOutput];
371
370
  }
371
+ function normalizeVitestOutputPath(outputPath, workspaceRoot, angularWorkspaceRoot, projectRoot) {
372
+ const fullPath = (0, node_path_1.isAbsolute)(outputPath)
373
+ ? outputPath
374
+ : (0, node_path_1.join)(workspaceRoot, angularWorkspaceRoot, projectRoot, outputPath);
375
+ return getOutput(fullPath, workspaceRoot, angularWorkspaceRoot, projectRoot);
376
+ }
377
+ async function getVitestTargetOutputs(target, angularWorkspaceRoot, projectRoot, context) {
378
+ // https://github.com/angular/angular-cli/blob/d9cd609c5d13fe492b1f31973d9be518f8529387/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts#L365
379
+ const defaultOutput = posix.join('{workspaceRoot}', angularWorkspaceRoot, 'coverage/{projectName}');
380
+ const outputs = [];
381
+ try {
382
+ const runnerConfig = target.options?.runnerConfig;
383
+ let vitestConfigPath = false;
384
+ if (typeof runnerConfig === 'string') {
385
+ vitestConfigPath = (0, node_path_1.join)(context.workspaceRoot, angularWorkspaceRoot, projectRoot, runnerConfig);
386
+ }
387
+ else if (runnerConfig === true) {
388
+ vitestConfigPath = await (0, vitest_1.findVitestBaseConfig)([
389
+ (0, node_path_1.join)(context.workspaceRoot, angularWorkspaceRoot, projectRoot),
390
+ (0, node_path_1.join)(context.workspaceRoot, angularWorkspaceRoot),
391
+ ]);
392
+ }
393
+ let vitestConfig;
394
+ if (vitestConfigPath) {
395
+ const { resolveConfig } = await (0, vitest_1.loadVite)();
396
+ vitestConfig = await resolveConfig({ configFile: vitestConfigPath, mode: 'development' }, 'build');
397
+ }
398
+ // coverage.reportsDirectory from config
399
+ const configReportsDir = vitestConfig?.test?.coverage?.reportsDirectory;
400
+ if (configReportsDir) {
401
+ outputs.push(normalizeVitestOutputPath(configReportsDir, context.workspaceRoot, angularWorkspaceRoot, projectRoot));
402
+ }
403
+ else {
404
+ outputs.push(defaultOutput);
405
+ }
406
+ // outputFile - executor wins over config
407
+ if (target.options?.outputFile) {
408
+ outputs.push(normalizeVitestOutputPath(target.options.outputFile, context.workspaceRoot, angularWorkspaceRoot, projectRoot));
409
+ }
410
+ else {
411
+ const configOutputFile = vitestConfig?.test
412
+ ?.outputFile;
413
+ if (typeof configOutputFile === 'string') {
414
+ outputs.push(normalizeVitestOutputPath(configOutputFile, context.workspaceRoot, angularWorkspaceRoot, projectRoot));
415
+ }
416
+ else if (typeof configOutputFile === 'object' && configOutputFile) {
417
+ for (const path of Object.values(configOutputFile)) {
418
+ if (typeof path === 'string') {
419
+ outputs.push(normalizeVitestOutputPath(path, context.workspaceRoot, angularWorkspaceRoot, projectRoot));
420
+ }
421
+ }
422
+ }
423
+ }
424
+ // reporters outputFile - executor wins over config
425
+ if (Array.isArray(target.options?.reporters)) {
426
+ for (const reporter of target.options.reporters) {
427
+ if (Array.isArray(reporter) && reporter[1]?.outputFile) {
428
+ outputs.push(normalizeVitestOutputPath(reporter[1].outputFile, context.workspaceRoot, angularWorkspaceRoot, projectRoot));
429
+ }
430
+ }
431
+ }
432
+ else {
433
+ const configReporters = vitestConfig?.test
434
+ ?.reporters;
435
+ if (Array.isArray(configReporters)) {
436
+ for (const reporter of configReporters) {
437
+ if (Array.isArray(reporter) &&
438
+ reporter[1]?.outputFile) {
439
+ outputs.push(normalizeVitestOutputPath(reporter[1].outputFile, context.workspaceRoot, angularWorkspaceRoot, projectRoot));
440
+ }
441
+ }
442
+ }
443
+ }
444
+ }
445
+ catch {
446
+ // Silent fallback to defaults on any error
447
+ }
448
+ const uniqueOutputs = [...new Set(outputs)];
449
+ return uniqueOutputs.length > 0 ? uniqueOutputs : [defaultOutput];
450
+ }
372
451
  function getBrowserAndServerTargetInputsAndOutputs(projectName, targetName, projects, angularJson) {
373
452
  const { browserTarget, serverTarget } = extractBrowserAndServerTargets(angularJson, projectName, targetName);
374
453
  if (!browserTarget || !serverTarget) {
@@ -0,0 +1,3 @@
1
+ export declare function loadVite(): Promise<typeof import('vite')>;
2
+ export declare function findVitestBaseConfig(searchDirs: string[]): Promise<string | false>;
3
+ //# sourceMappingURL=vitest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/plugins/utils/vitest.ts"],"names":[],"mappings":"AAaA,wBAAgB,QAAQ,IAAI,OAAO,CAAC,cAAc,MAAM,CAAC,CAAC,CAEzD;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAiBzB"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadVite = loadVite;
4
+ exports.findVitestBaseConfig = findVitestBaseConfig;
5
+ const promises_1 = require("node:fs/promises");
6
+ const node_path_1 = require("node:path");
7
+ // https://github.com/angular/angular-cli/blob/03b86fe28e34c489b91858614236dd14e2cb9985/packages/angular/build/src/builders/unit-test/runners/vitest/configuration.ts#L17-L28
8
+ const VITEST_CONFIG_FILES = [
9
+ 'vitest-base.config.ts',
10
+ 'vitest-base.config.mts',
11
+ 'vitest-base.config.cts',
12
+ 'vitest-base.config.js',
13
+ 'vitest-base.config.mjs',
14
+ 'vitest-base.config.cjs',
15
+ ];
16
+ function loadVite() {
17
+ return Function('return import("vite")')();
18
+ }
19
+ async function findVitestBaseConfig(searchDirs) {
20
+ for (const dir of searchDirs) {
21
+ try {
22
+ const entries = await (0, promises_1.readdir)(dir, { withFileTypes: true });
23
+ const files = new Set(entries.filter((e) => e.isFile()).map((e) => e.name));
24
+ for (const configFile of VITEST_CONFIG_FILES) {
25
+ if (files.has(configFile)) {
26
+ return (0, node_path_1.join)(dir, configFile);
27
+ }
28
+ }
29
+ }
30
+ catch {
31
+ // Ignore directories that cannot be read
32
+ }
33
+ }
34
+ return false;
35
+ }
@@ -1,7 +1,7 @@
1
1
  export declare const nxVersion: any;
2
- export declare const angularVersion = "~21.0.0";
3
- export declare const angularDevkitVersion = "~21.0.0";
4
- export declare const ngPackagrVersion = "~21.0.0";
2
+ export declare const angularVersion = "~21.1.0";
3
+ export declare const angularDevkitVersion = "~21.1.0";
4
+ export declare const ngPackagrVersion = "~21.1.0";
5
5
  export declare const ngrxVersion = "^21.0.0";
6
6
  export declare const rxjsVersion = "~7.8.0";
7
7
  export declare const zoneJsVersion = "~0.15.0";
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jsoncEslintParserVersion = exports.jsdomVersion = exports.vitestVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.lessVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.webpackMergeVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.angularVersion = '~21.0.0';
6
- exports.angularDevkitVersion = '~21.0.0';
7
- exports.ngPackagrVersion = '~21.0.0';
5
+ exports.angularVersion = '~21.1.0';
6
+ exports.angularDevkitVersion = '~21.1.0';
7
+ exports.ngPackagrVersion = '~21.1.0';
8
8
  exports.ngrxVersion = '^21.0.0';
9
9
  exports.rxjsVersion = '~7.8.0';
10
10
  exports.zoneJsVersion = '~0.15.0';