@nx/nest 23.2.0-beta.1 → 23.2.0-beta.11

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.
Files changed (27) hide show
  1. package/README.md +2 -2
  2. package/dist/src/generators/application/application.js +4 -0
  3. package/dist/src/generators/application/lib/create-files.js +1 -1
  4. package/dist/src/generators/application/lib/normalize-options.js +6 -4
  5. package/dist/src/generators/application/schema.d.ts +8 -3
  6. package/dist/src/generators/application/schema.json +16 -7
  7. package/dist/src/generators/class/schema.json +1 -1
  8. package/dist/src/generators/controller/schema.json +1 -1
  9. package/dist/src/generators/filter/schema.json +1 -1
  10. package/dist/src/generators/gateway/schema.json +1 -1
  11. package/dist/src/generators/guard/schema.json +1 -1
  12. package/dist/src/generators/interceptor/schema.json +1 -1
  13. package/dist/src/generators/library/lib/normalize-options.js +10 -6
  14. package/dist/src/generators/library/library.js +4 -0
  15. package/dist/src/generators/library/schema.d.ts +6 -2
  16. package/dist/src/generators/library/schema.json +12 -8
  17. package/dist/src/generators/middleware/schema.json +1 -1
  18. package/dist/src/generators/pipe/schema.json +1 -1
  19. package/dist/src/generators/provider/schema.json +1 -1
  20. package/dist/src/generators/resolver/schema.json +1 -1
  21. package/dist/src/generators/resource/schema.json +1 -1
  22. package/dist/src/generators/service/schema.json +1 -1
  23. package/dist/src/generators/utils/normalize-options.js +1 -1
  24. package/dist/src/generators/utils/types.d.ts +1 -1
  25. package/dist/src/utils/assert-vitest-supported.d.ts +10 -0
  26. package/dist/src/utils/assert-vitest-supported.js +30 -0
  27. package/package.json +5 -5
package/README.md CHANGED
@@ -7,9 +7,9 @@
7
7
 
8
8
  <div style="text-align: center;">
9
9
 
10
- [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
10
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)](<>)
11
11
  [![NPM Version](https://badge.fury.io/js/nx.svg)](https://www.npmjs.com/package/nx)
12
- [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
12
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](<>)
13
13
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
14
14
  [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
15
15
  [![Nx Sandboxing](https://staging.nx.app/workspaces/62d013ea0852fe0a2df74438/sandbox-badge.svg)](https://nx.dev/docs/features/ci-features/sandboxing)
@@ -7,6 +7,7 @@ const node_1 = require("@nx/node");
7
7
  const init_1 = require("../init/init");
8
8
  const lib_1 = require("./lib");
9
9
  const assert_supported_nestjs_version_1 = require("../../utils/assert-supported-nestjs-version");
10
+ const assert_vitest_supported_1 = require("../../utils/assert-vitest-supported");
10
11
  const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
11
12
  async function applicationGenerator(tree, rawOptions) {
12
13
  return await applicationGeneratorInternal(tree, {
@@ -18,6 +19,9 @@ async function applicationGenerator(tree, rawOptions) {
18
19
  async function applicationGeneratorInternal(tree, rawOptions) {
19
20
  (0, assert_supported_nestjs_version_1.assertSupportedNestJsVersion)(tree);
20
21
  const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
22
+ if (options.unitTestRunner === 'vitest') {
23
+ (0, assert_vitest_supported_1.assertVitestSupported)(tree);
24
+ }
21
25
  const tasks = [];
22
26
  const initTask = await (0, init_1.initGenerator)(tree, {
23
27
  skipPackageJson: options.skipPackageJson,
@@ -9,7 +9,7 @@ function createFiles(tree, options) {
9
9
  name: options.appProjectName,
10
10
  root: options.appProjectRoot,
11
11
  });
12
- if (options.unitTestRunner === 'jest') {
12
+ if (options.unitTestRunner !== 'none') {
13
13
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, '..', 'files', 'test'), (0, path_1.join)(options.appProjectRoot, 'src'), {
14
14
  tmpl: '',
15
15
  });
@@ -4,7 +4,8 @@ exports.normalizeOptions = normalizeOptions;
4
4
  exports.toNodeApplicationGeneratorOptions = toNodeApplicationGeneratorOptions;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const internal_1 = require("@nx/devkit/internal");
7
- const internal_2 = require("@nx/js/internal");
7
+ const internal_2 = require("@nx/eslint/internal");
8
+ const internal_3 = require("@nx/js/internal");
8
9
  async function normalizeOptions(tree, options) {
9
10
  await (0, internal_1.ensureRootProjectName)(options, 'application');
10
11
  const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
@@ -23,10 +24,10 @@ async function normalizeOptions(tree, options) {
23
24
  strict: options.strict ?? false,
24
25
  appProjectName,
25
26
  appProjectRoot,
26
- linter: options.linter ?? 'eslint',
27
+ linter: await (0, internal_3.normalizeLinterOption)(tree, options.linter),
27
28
  unitTestRunner: options.unitTestRunner ?? 'jest',
28
29
  e2eTestRunner: options.e2eTestRunner ?? 'jest',
29
- useProjectJson: options.useProjectJson ?? !(0, internal_2.isUsingTsSolutionSetup)(tree),
30
+ useProjectJson: options.useProjectJson ?? !(0, internal_3.isUsingTsSolutionSetup)(tree),
30
31
  };
31
32
  }
32
33
  function toNodeApplicationGeneratorOptions(options) {
@@ -35,12 +36,13 @@ function toNodeApplicationGeneratorOptions(options) {
35
36
  directory: options.directory,
36
37
  frontendProject: options.frontendProject,
37
38
  linter: options.linter,
39
+ formatter: options.formatter,
38
40
  skipFormat: true,
39
41
  skipPackageJson: options.skipPackageJson,
40
42
  tags: options.tags,
41
43
  unitTestRunner: options.unitTestRunner,
42
44
  e2eTestRunner: options.e2eTestRunner,
43
- setParserOptionsProject: options.setParserOptionsProject,
45
+ enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
44
46
  rootProject: options.rootProject,
45
47
  bundler: 'webpack', // Some features require webpack plugins such as TS transformers
46
48
  isNest: true,
@@ -1,15 +1,20 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
 
3
3
  export interface ApplicationGeneratorOptions {
4
4
  directory: string;
5
5
  name?: string;
6
6
  frontendProject?: string;
7
- linter?: Linter | LinterType;
7
+ linter?: LinterType;
8
+ formatter?: 'none' | 'prettier' | 'oxfmt';
8
9
  skipFormat?: boolean;
9
10
  skipPackageJson?: boolean;
10
11
  tags?: string;
11
- unitTestRunner?: 'jest' | 'none';
12
+ unitTestRunner?: 'jest' | 'vitest' | 'none';
12
13
  e2eTestRunner?: 'jest' | 'none';
14
+ enableTypedLinting?: boolean;
15
+ /**
16
+ * @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
17
+ */
13
18
  setParserOptionsProject?: boolean;
14
19
  rootProject?: boolean;
15
20
  strict?: boolean;
@@ -34,17 +34,20 @@
34
34
  "x-priority": "internal"
35
35
  },
36
36
  "linter": {
37
- "description": "The tool to use for running lint checks.",
37
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
38
38
  "type": "string",
39
- "enum": ["eslint", "none"],
40
- "default": "none",
41
- "x-prompt": "Which linter would you like to use?",
39
+ "enum": ["eslint", "oxlint", "none"],
42
40
  "x-priority": "important"
43
41
  },
42
+ "formatter": {
43
+ "description": "The tool to use for code formatting.",
44
+ "type": "string",
45
+ "enum": ["none", "prettier", "oxfmt"]
46
+ },
44
47
  "unitTestRunner": {
45
48
  "description": "Test runner to use for unit tests.",
46
49
  "type": "string",
47
- "enum": ["jest", "none"],
50
+ "enum": ["jest", "vitest", "none"],
48
51
  "default": "none",
49
52
  "x-prompt": "Which unit test runner would you like to use?"
50
53
  },
@@ -63,11 +66,17 @@
63
66
  "type": "string",
64
67
  "x-priority": "important"
65
68
  },
66
- "setParserOptionsProject": {
69
+ "enableTypedLinting": {
67
70
  "type": "boolean",
68
- "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
71
+ "description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
69
72
  "default": false
70
73
  },
74
+ "setParserOptionsProject": {
75
+ "type": "boolean",
76
+ "description": "Deprecated alias for `enableTypedLinting`.",
77
+ "default": false,
78
+ "x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
79
+ },
71
80
  "strict": {
72
81
  "type": "boolean",
73
82
  "description": "Adds strictNullChecks, noImplicitAny, strictBindCallApply, forceConsistentCasingInFileNames and noFallthroughCasesInSwitch to tsconfig.",
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -4,7 +4,8 @@ exports.normalizeOptions = normalizeOptions;
4
4
  exports.toJsLibraryGeneratorOptions = toJsLibraryGeneratorOptions;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const internal_1 = require("@nx/devkit/internal");
7
- const internal_2 = require("@nx/js/internal");
7
+ const internal_2 = require("@nx/eslint/internal");
8
+ const internal_3 = require("@nx/js/internal");
8
9
  async function normalizeOptions(tree, options) {
9
10
  await (0, internal_1.ensureRootProjectName)(options, 'library');
10
11
  const { projectName, names: projectNames, projectRoot, importPath, } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
@@ -24,17 +25,17 @@ async function normalizeOptions(tree, options) {
24
25
  // this helper is called before the jsLibraryGenerator is called, so, if the
25
26
  // TS solution setup is not configured, we additionally check if the TS
26
27
  // solution setup will be configured by the jsLibraryGenerator
27
- const isUsingTsSolutionsConfig = (0, internal_2.isUsingTsSolutionSetup)(tree) ||
28
- (0, internal_2.shouldConfigureTsSolutionSetup)(tree, addPlugin);
28
+ const isUsingTsSolutionsConfig = (0, internal_3.isUsingTsSolutionSetup)(tree) ||
29
+ (0, internal_3.shouldConfigureTsSolutionSetup)(tree, addPlugin);
29
30
  const normalized = {
30
31
  ...options,
31
32
  strict: options.strict ?? true,
32
33
  controller: options.controller ?? false,
33
34
  fileName,
34
35
  global: options.global ?? false,
35
- linter: options.linter ?? 'eslint',
36
+ linter: await (0, internal_3.normalizeLinterOption)(tree, options.linter),
36
37
  parsedTags,
37
- prefix: (0, internal_2.getNpmScope)(tree), // we could also allow customizing this
38
+ prefix: (0, internal_3.getNpmScope)(tree), // we could also allow customizing this
38
39
  projectName: isUsingTsSolutionsConfig && !options.name ? importPath : projectName,
39
40
  projectRoot,
40
41
  importPath,
@@ -62,7 +63,10 @@ function toJsLibraryGeneratorOptions(options) {
62
63
  tags: options.tags,
63
64
  testEnvironment: options.testEnvironment,
64
65
  unitTestRunner: options.unitTestRunner,
65
- setParserOptionsProject: options.setParserOptionsProject,
66
+ // `deleteFiles` drops the generated spec, and a library without a
67
+ // controller or service is left with none at all.
68
+ passWithNoTests: true,
69
+ enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
66
70
  addPlugin: options.addPlugin,
67
71
  useProjectJson: options.useProjectJson,
68
72
  };
@@ -7,6 +7,7 @@ const internal_1 = require("@nx/devkit/internal");
7
7
  const devkit_1 = require("@nx/devkit");
8
8
  const js_1 = require("@nx/js");
9
9
  const assert_supported_nestjs_version_1 = require("../../utils/assert-supported-nestjs-version");
10
+ const assert_vitest_supported_1 = require("../../utils/assert-vitest-supported");
10
11
  const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
11
12
  const init_1 = tslib_1.__importDefault(require("../init/init"));
12
13
  const lib_1 = require("./lib");
@@ -20,6 +21,9 @@ async function libraryGenerator(tree, rawOptions) {
20
21
  async function libraryGeneratorInternal(tree, rawOptions) {
21
22
  (0, assert_supported_nestjs_version_1.assertSupportedNestJsVersion)(tree);
22
23
  const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
24
+ if (options.unitTestRunner === 'vitest') {
25
+ (0, assert_vitest_supported_1.assertVitestSupported)(tree);
26
+ }
23
27
  const jsLibraryTask = await (0, js_1.libraryGenerator)(tree, (0, lib_1.toJsLibraryGeneratorOptions)(options));
24
28
  updatePackageJson(tree, options);
25
29
  const initTask = await (0, init_1.default)(tree, rawOptions);
@@ -1,4 +1,4 @@
1
- import type { Linter, LinterType } from '@nx/eslint';
1
+ import type { LinterType } from '@nx/js';
2
2
  import type { UnitTestRunner } from '../utils';
3
3
 
4
4
  export interface LibraryGeneratorOptions {
@@ -8,7 +8,7 @@ export interface LibraryGeneratorOptions {
8
8
  controller?: boolean;
9
9
  global?: boolean;
10
10
  importPath?: string;
11
- linter?: Linter | LinterType;
11
+ linter?: LinterType;
12
12
  publishable?: boolean;
13
13
  service?: boolean;
14
14
  skipFormat?: boolean;
@@ -28,6 +28,10 @@ export interface LibraryGeneratorOptions {
28
28
  | 'es2021';
29
29
  testEnvironment?: 'jsdom' | 'node';
30
30
  unitTestRunner?: UnitTestRunner;
31
+ enableTypedLinting?: boolean;
32
+ /**
33
+ * @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
34
+ */
31
35
  setParserOptionsProject?: boolean;
32
36
  skipPackageJson?: boolean;
33
37
  addPlugin?: boolean;
@@ -28,17 +28,15 @@
28
28
  "type": "string"
29
29
  },
30
30
  "linter": {
31
- "description": "The tool to use for running lint checks.",
31
+ "description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
32
32
  "type": "string",
33
- "enum": ["eslint", "none"],
34
- "default": "none",
35
- "x-prompt": "Which linter would you like to use?",
33
+ "enum": ["eslint", "oxlint", "none"],
36
34
  "x-priority": "important"
37
35
  },
38
36
  "unitTestRunner": {
39
37
  "description": "Test runner to use for unit tests.",
40
38
  "type": "string",
41
- "enum": ["jest", "none"],
39
+ "enum": ["jest", "vitest", "none"],
42
40
  "default": "none",
43
41
  "x-prompt": "Which unit test runner would you like to use?",
44
42
  "x-priority": "important"
@@ -91,7 +89,7 @@
91
89
  "default": false
92
90
  },
93
91
  "testEnvironment": {
94
- "description": "The test environment for jest, for node applications this should stay as node unless doing DOM testing.",
92
+ "description": "The test environment for the unit test runner. For node applications this should stay as node unless doing DOM testing.",
95
93
  "type": "string",
96
94
  "enum": ["jsdom", "node"],
97
95
  "default": "node"
@@ -118,11 +116,17 @@
118
116
  "type": "boolean",
119
117
  "default": true
120
118
  },
121
- "setParserOptionsProject": {
119
+ "enableTypedLinting": {
122
120
  "type": "boolean",
123
- "description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
121
+ "description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
124
122
  "default": false
125
123
  },
124
+ "setParserOptionsProject": {
125
+ "type": "boolean",
126
+ "description": "Deprecated alias for `enableTypedLinting`.",
127
+ "default": false,
128
+ "x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
129
+ },
126
130
  "skipPackageJson": {
127
131
  "description": "Do not add dependencies to `package.json`.",
128
132
  "type": "boolean",
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -30,7 +30,7 @@
30
30
  "unitTestRunner": {
31
31
  "description": "Test runner to use for unit tests.",
32
32
  "type": "string",
33
- "enum": ["jest", "none"],
33
+ "enum": ["jest", "vitest", "none"],
34
34
  "default": "jest"
35
35
  },
36
36
  "type": {
@@ -34,7 +34,7 @@
34
34
  "unitTestRunner": {
35
35
  "description": "Test runner to use for unit tests.",
36
36
  "type": "string",
37
- "enum": ["jest", "none"],
37
+ "enum": ["jest", "vitest", "none"],
38
38
  "default": "jest"
39
39
  },
40
40
  "language": {
@@ -30,5 +30,5 @@ async function normalizeOptions(tree, options, normalizationOptions = {}) {
30
30
  };
31
31
  }
32
32
  function unitTestRunnerToSpec(unitTestRunner) {
33
- return unitTestRunner !== undefined ? unitTestRunner === 'jest' : undefined;
33
+ return unitTestRunner !== undefined ? unitTestRunner !== 'none' : undefined;
34
34
  }
@@ -1,5 +1,5 @@
1
1
  export type Language = 'js' | 'ts';
2
- export type UnitTestRunner = 'jest' | 'none';
2
+ export type UnitTestRunner = 'jest' | 'vitest' | 'none';
3
3
  export type NestSchematic = 'class' | 'controller' | 'decorator' | 'filter' | 'gateway' | 'guard' | 'interceptor' | 'interface' | 'middleware' | 'module' | 'pipe' | 'provider' | 'resolver' | 'resource' | 'service';
4
4
  export type TransportLayer = 'rest' | 'graphql-code-first' | 'graphql-schema-first' | 'microservice' | 'ws';
5
5
  export type NestGeneratorOptions = {
@@ -0,0 +1,10 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare const minSupportedViteMajorForVitest = 8;
3
+ /**
4
+ * Nest resolves constructor dependencies from `design:paramtypes`, which only
5
+ * exists when the transform honors `emitDecoratorMetadata`. Vite < 8 transforms
6
+ * TypeScript with esbuild, which drops it, so the injector sees no dependencies
7
+ * and every generated spec that injects a provider fails. Vite 8's oxc transform
8
+ * emits it.
9
+ */
10
+ export declare function assertVitestSupported(tree: Tree): void;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.minSupportedViteMajorForVitest = void 0;
4
+ exports.assertVitestSupported = assertVitestSupported;
5
+ const devkit_1 = require("@nx/devkit");
6
+ const semver_1 = require("semver");
7
+ exports.minSupportedViteMajorForVitest = 8;
8
+ /**
9
+ * Nest resolves constructor dependencies from `design:paramtypes`, which only
10
+ * exists when the transform honors `emitDecoratorMetadata`. Vite < 8 transforms
11
+ * TypeScript with esbuild, which drops it, so the injector sees no dependencies
12
+ * and every generated spec that injects a provider fails. Vite 8's oxc transform
13
+ * emits it.
14
+ */
15
+ function assertVitestSupported(tree) {
16
+ const declaredVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'vite');
17
+ if (!declaredVersion) {
18
+ // Vite isn't installed yet, so @nx/vitest will install a supported major.
19
+ return;
20
+ }
21
+ const version = (0, semver_1.clean)(declaredVersion) ?? (0, semver_1.coerce)(declaredVersion)?.version;
22
+ // An unparseable range (workspace:, catalog:, a git url) isn't evidence of an
23
+ // unsupported version, so don't block on it.
24
+ if (!version || (0, semver_1.major)(version) >= exports.minSupportedViteMajorForVitest) {
25
+ return;
26
+ }
27
+ throw new Error(`Using vitest with @nx/nest requires Vite ${exports.minSupportedViteMajorForVitest} or later, but found Vite ${version}.\n` +
28
+ `Nest dependency injection needs "emitDecoratorMetadata", which the esbuild transform used by Vite < ${exports.minSupportedViteMajorForVitest} does not emit.\n` +
29
+ `Upgrade Vite, or generate with "--unitTestRunner=jest".`);
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/nest",
3
- "version": "23.2.0-beta.1",
3
+ "version": "23.2.0-beta.11",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -62,10 +62,10 @@
62
62
  "@nestjs/schematics": "^11.0.0",
63
63
  "semver": "^7.6.3",
64
64
  "tslib": "^2.3.0",
65
- "@nx/devkit": "23.2.0-beta.1",
66
- "@nx/js": "23.2.0-beta.1",
67
- "@nx/eslint": "23.2.0-beta.1",
68
- "@nx/node": "23.2.0-beta.1"
65
+ "@nx/devkit": "23.2.0-beta.11",
66
+ "@nx/js": "23.2.0-beta.11",
67
+ "@nx/eslint": "23.2.0-beta.11",
68
+ "@nx/node": "23.2.0-beta.11"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@nestjs/core": ">=10.0.0 <12.0.0",