@nx/vite 23.0.0-beta.20 → 23.0.0-beta.22

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 (32) hide show
  1. package/dist/plugins/nx-copy-assets.plugin.d.ts +6 -0
  2. package/dist/plugins/nx-copy-assets.plugin.js +8 -0
  3. package/dist/plugins/nx-tsconfig-paths.plugin.d.ts +7 -0
  4. package/dist/plugins/nx-tsconfig-paths.plugin.js +9 -0
  5. package/dist/src/generators/configuration/configuration.js +2 -0
  6. package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +2 -0
  7. package/dist/src/generators/init/init.js +2 -0
  8. package/dist/src/generators/init/lib/utils.js +1 -1
  9. package/dist/src/generators/init/schema.json +1 -1
  10. package/dist/src/generators/setup-paths-plugin/setup-paths-plugin.js +2 -0
  11. package/dist/src/migrations/update-23-0-0/ai-instructions-for-vitest-3.md +604 -0
  12. package/dist/src/migrations/update-23-0-0/ai-instructions-for-vitest-4.md +817 -0
  13. package/dist/src/migrations/update-23-0-0/lib/ast-edits.d.ts +26 -0
  14. package/dist/src/migrations/update-23-0-0/lib/ast-edits.js +49 -0
  15. package/dist/src/migrations/update-23-0-0/lib/ci-files.d.ts +3 -0
  16. package/dist/src/migrations/update-23-0-0/lib/ci-files.js +30 -0
  17. package/dist/src/migrations/update-23-0-0/lib/vitest-config-files.d.ts +5 -0
  18. package/dist/src/migrations/update-23-0-0/lib/vitest-config-files.js +34 -0
  19. package/dist/src/migrations/update-23-0-0/migrate-to-vitest-3.d.ts +10 -0
  20. package/dist/src/migrations/update-23-0-0/migrate-to-vitest-3.js +335 -0
  21. package/dist/src/migrations/update-23-0-0/migrate-to-vitest-4.d.ts +17 -0
  22. package/dist/src/migrations/update-23-0-0/migrate-to-vitest-4.js +726 -0
  23. package/dist/src/utils/assert-supported-vite-version.d.ts +2 -0
  24. package/dist/src/utils/assert-supported-vite-version.js +8 -0
  25. package/dist/src/utils/deprecation.d.ts +4 -0
  26. package/dist/src/utils/deprecation.js +26 -1
  27. package/dist/src/utils/ensure-dependencies.js +1 -1
  28. package/dist/src/utils/generator-utils.js +2 -0
  29. package/dist/src/utils/versions.d.ts +1 -0
  30. package/dist/src/utils/versions.js +7 -1
  31. package/migrations.json +116 -9
  32. package/package.json +6 -6
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function assertSupportedViteVersion(tree: Tree): void;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSupportedViteVersion = assertSupportedViteVersion;
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ const versions_1 = require("./versions");
6
+ function assertSupportedViteVersion(tree) {
7
+ (0, internal_1.assertSupportedPackageVersion)(tree, 'vite', versions_1.minSupportedViteVersion);
8
+ }
@@ -5,3 +5,7 @@ export declare function warnViteBuildExecutorDeprecation(): void;
5
5
  export declare function warnViteDevServerExecutorDeprecation(): void;
6
6
  export declare function warnVitePreviewServerExecutorDeprecation(): void;
7
7
  export declare function warnViteExecutorGenerating(): void;
8
+ export declare const NX_VITE_TS_PATHS_DEPRECATION_MESSAGE = "The `nxViteTsPaths` plugin from `@nx/vite/plugins/nx-tsconfig-paths.plugin` is deprecated and will be removed in Nx v24. Replace it with `tsconfigPaths()` from the `vite-tsconfig-paths` package. See https://nx.dev/docs/technologies/build-tools/vite/configure-vite for details.";
9
+ export declare const NX_COPY_ASSETS_PLUGIN_DEPRECATION_MESSAGE = "The `nxCopyAssetsPlugin` plugin from `@nx/vite/plugins/nx-copy-assets.plugin` is deprecated and will be removed in Nx v24. Use Vite's native `publicDir` option or the `vite-plugin-static-copy` package instead. See https://nx.dev/docs/technologies/build-tools/vite/configure-vite for details.";
10
+ export declare function warnNxViteTsPathsDeprecation(): void;
11
+ export declare function warnNxCopyAssetsPluginDeprecation(): void;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE = void 0;
3
+ exports.NX_COPY_ASSETS_PLUGIN_DEPRECATION_MESSAGE = exports.NX_VITE_TS_PATHS_DEPRECATION_MESSAGE = exports.VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = exports.VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE = void 0;
4
4
  exports.warnViteBuildExecutorDeprecation = warnViteBuildExecutorDeprecation;
5
5
  exports.warnViteDevServerExecutorDeprecation = warnViteDevServerExecutorDeprecation;
6
6
  exports.warnVitePreviewServerExecutorDeprecation = warnVitePreviewServerExecutorDeprecation;
7
7
  exports.warnViteExecutorGenerating = warnViteExecutorGenerating;
8
+ exports.warnNxViteTsPathsDeprecation = warnNxViteTsPathsDeprecation;
9
+ exports.warnNxCopyAssetsPluginDeprecation = warnNxCopyAssetsPluginDeprecation;
8
10
  const devkit_1 = require("@nx/devkit");
9
11
  // TODO(v24): Remove the @nx/vite:build, @nx/vite:dev-server, and
10
12
  // @nx/vite:preview-server executors. The inferred plugin (@nx/vite/plugin)
@@ -29,3 +31,26 @@ function warnVitePreviewServerExecutorDeprecation() {
29
31
  function warnViteExecutorGenerating() {
30
32
  devkit_1.logger.warn('Generating targets that use the deprecated `@nx/vite:build`, `@nx/vite:dev-server`, and `@nx/vite:preview-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` next to migrate these targets to the `@nx/vite/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
31
33
  }
34
+ // TODO(v24): Remove `nxViteTsPaths` and `nxCopyAssetsPlugin` helpers.
35
+ // The inferred `@nx/vite/plugin` already ensures projects extend the base
36
+ // tsconfig, so the community `vite-tsconfig-paths` package handles path
37
+ // resolution end-to-end. Asset copying is covered by Vite's native
38
+ // `publicDir` option or the `vite-plugin-static-copy` package.
39
+ exports.NX_VITE_TS_PATHS_DEPRECATION_MESSAGE = 'The `nxViteTsPaths` plugin from `@nx/vite/plugins/nx-tsconfig-paths.plugin` is deprecated and will be removed in Nx v24. Replace it with `tsconfigPaths()` from the `vite-tsconfig-paths` package. See https://nx.dev/docs/technologies/build-tools/vite/configure-vite for details.';
40
+ exports.NX_COPY_ASSETS_PLUGIN_DEPRECATION_MESSAGE = "The `nxCopyAssetsPlugin` plugin from `@nx/vite/plugins/nx-copy-assets.plugin` is deprecated and will be removed in Nx v24. Use Vite's native `publicDir` option or the `vite-plugin-static-copy` package instead. See https://nx.dev/docs/technologies/build-tools/vite/configure-vite for details.";
41
+ let nxViteTsPathsWarned = false;
42
+ let nxCopyAssetsPluginWarned = false;
43
+ // Warn-once per process so users don't see the message repeated on every
44
+ // dev-server HMR reload or vitest run within the same Node process.
45
+ function warnNxViteTsPathsDeprecation() {
46
+ if (nxViteTsPathsWarned)
47
+ return;
48
+ nxViteTsPathsWarned = true;
49
+ devkit_1.logger.warn(exports.NX_VITE_TS_PATHS_DEPRECATION_MESSAGE);
50
+ }
51
+ function warnNxCopyAssetsPluginDeprecation() {
52
+ if (nxCopyAssetsPluginWarned)
53
+ return;
54
+ nxCopyAssetsPluginWarned = true;
55
+ devkit_1.logger.warn(exports.NX_COPY_ASSETS_PLUGIN_DEPRECATION_MESSAGE);
56
+ }
@@ -28,5 +28,5 @@ function ensureDependencies(host, schema) {
28
28
  devDependencies['ajv'] = versions_1.ajvVersion;
29
29
  }
30
30
  }
31
- return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies);
31
+ return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies, undefined, true);
32
32
  }
@@ -290,6 +290,8 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
290
290
  imports.push(`import dts from 'vite-plugin-dts'`, `import * as path from 'path'`);
291
291
  }
292
292
  if (!isTsSolutionSetup) {
293
+ // TODO(v24): drop this branch; emit `tsconfigPaths()` from
294
+ // `vite-tsconfig-paths` instead of the deprecated nx helpers.
293
295
  imports.push(`import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'`, `import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'`);
294
296
  plugins.push(`nxViteTsPaths()`, `nxCopyAssetsPlugin(['*.md'])`);
295
297
  }
@@ -3,6 +3,7 @@ export declare const viteVersion = "^8.0.0";
3
3
  export declare const viteV7Version = "^7.0.0";
4
4
  export declare const viteV6Version = "^6.0.0";
5
5
  export declare const viteV5Version = "^5.0.0";
6
+ export declare const minSupportedViteVersion = "5.0.0";
6
7
  export declare const vitePluginReactVersion = "^6.0.0";
7
8
  export declare const vitePluginReactV4Version = "^4.2.0";
8
9
  export declare const vitePluginReactSwcVersion = "^4.3.0";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jitiVersion = exports.ajvVersion = exports.vitePluginDtsVersion = exports.vitePluginReactSwcVersion = exports.vitePluginReactV4Version = exports.vitePluginReactVersion = exports.viteV5Version = exports.viteV6Version = exports.viteV7Version = exports.viteVersion = exports.nxVersion = void 0;
3
+ exports.jitiVersion = exports.ajvVersion = exports.vitePluginDtsVersion = exports.vitePluginReactSwcVersion = exports.vitePluginReactV4Version = exports.vitePluginReactVersion = exports.minSupportedViteVersion = exports.viteV5Version = exports.viteV6Version = exports.viteV7Version = exports.viteVersion = exports.nxVersion = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.nxVersion = require((0, path_1.join)('@nx/vite', 'package.json')).version;
6
6
  // Also update @nx/remix/utils/versions when changing vite version
@@ -8,8 +8,14 @@ exports.viteVersion = '^8.0.0';
8
8
  exports.viteV7Version = '^7.0.0';
9
9
  exports.viteV6Version = '^6.0.0';
10
10
  exports.viteV5Version = '^5.0.0';
11
+ // Lowest supported vite major. Kept at v5 because @nx/cypress (v13) still
12
+ // installs vite 5; generators throw below this floor via assertSupportedViteVersion.
13
+ exports.minSupportedViteVersion = '5.0.0';
11
14
  exports.vitePluginReactVersion = '^6.0.0';
12
15
  exports.vitePluginReactV4Version = '^4.2.0';
16
+ // Single constants: peer ranges span the whole supported vite window
17
+ // (vite-plugin-dts -> `vite: *`, plugin-react-swc -> `vite: ^4..^8`), so no
18
+ // per-major map is needed.
13
19
  exports.vitePluginReactSwcVersion = '^4.3.0';
14
20
  exports.vitePluginDtsVersion = '~4.5.0';
15
21
  exports.ajvVersion = '^8.0.0';
package/migrations.json CHANGED
@@ -3,27 +3,38 @@
3
3
  "update-20-0-4": {
4
4
  "version": "20.0.4-beta.0",
5
5
  "description": "Add gitignore entry for temporary vite config files.",
6
- "implementation": "./dist/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore"
6
+ "implementation": "./dist/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore",
7
+ "documentation": "./dist/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.md"
7
8
  },
8
9
  "update-20-0-6": {
9
10
  "version": "20.0.6-beta.0",
10
11
  "description": "Add gitignore entry for temporary vite config files and remove previous incorrect glob.",
11
- "implementation": "./dist/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore"
12
+ "implementation": "./dist/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore",
13
+ "documentation": "./dist/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.md"
12
14
  },
13
15
  "update-20-5-0-install-jiti": {
14
16
  "version": "20.5.0-beta.2",
17
+ "requires": {
18
+ "vite": ">=6.0.0"
19
+ },
15
20
  "description": "Install jiti as a devDependency to allow vite to parse TS postcss files.",
16
- "implementation": "./dist/src/migrations/update-20-5-0/install-jiti"
21
+ "implementation": "./dist/src/migrations/update-20-5-0/install-jiti",
22
+ "documentation": "./dist/src/migrations/update-20-5-0/install-jiti.md"
17
23
  },
18
24
  "update-20-5-0-update-resolve-conditions": {
19
25
  "version": "20.5.0-beta.3",
26
+ "requires": {
27
+ "vite": ">=6.0.0"
28
+ },
20
29
  "description": "Update resolve.conditions to include defaults that are no longer provided by Vite.",
21
- "implementation": "./dist/src/migrations/update-20-5-0/update-resolve-conditions"
30
+ "implementation": "./dist/src/migrations/update-20-5-0/update-resolve-conditions",
31
+ "documentation": "./dist/src/migrations/update-20-5-0/update-resolve-conditions.md"
22
32
  },
23
33
  "eslint-ignore-vite-temp-files": {
24
34
  "version": "20.5.0-beta.3",
25
35
  "description": "Add vite config temporary files to the ESLint configuration ignore patterns if ESLint is used.",
26
- "implementation": "./dist/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files"
36
+ "implementation": "./dist/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files",
37
+ "documentation": "./dist/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.md"
27
38
  },
28
39
  "update-22-2-0": {
29
40
  "version": "22.2.0-beta.1",
@@ -41,7 +52,8 @@
41
52
  "ensure-vitest-package-migration-23": {
42
53
  "version": "23.0.0-beta.10",
43
54
  "description": "Safety net: ensure any remaining @nx/vite:test executor usages are swapped to @nx/vitest:test and @nx/vitest is installed.",
44
- "implementation": "./dist/src/migrations/update-23-0-0/ensure-vitest-package-migration"
55
+ "implementation": "./dist/src/migrations/update-23-0-0/ensure-vitest-package-migration",
56
+ "documentation": "./dist/src/migrations/update-23-0-0/ensure-vitest-package-migration.md"
45
57
  },
46
58
  "rename-rollup-options-to-rolldown-options": {
47
59
  "version": "23.0.0-beta.10",
@@ -49,7 +61,8 @@
49
61
  "vite": ">=8.0.0"
50
62
  },
51
63
  "description": "Rename `rollupOptions` to `rolldownOptions` in vite config files (top-level and inside `environments`). Vite 8 replaced Rollup with Rolldown.",
52
- "implementation": "./dist/src/migrations/update-23-0-0/rename-rollup-options-to-rolldown-options"
64
+ "implementation": "./dist/src/migrations/update-23-0-0/rename-rollup-options-to-rolldown-options",
65
+ "documentation": "./dist/src/migrations/update-23-0-0/rename-rollup-options-to-rolldown-options.md"
53
66
  },
54
67
  "create-ai-instructions-for-vite-8": {
55
68
  "version": "23.0.0-beta.10",
@@ -58,6 +71,24 @@
58
71
  },
59
72
  "description": "Create AI Instructions to help migrate users workspaces past breaking changes for Vite 8.",
60
73
  "prompt": "./dist/src/migrations/update-23-0-0/ai-instructions-for-vite-8.md"
74
+ },
75
+ "migrate-to-vitest-3": {
76
+ "version": "23.0.0-beta.22",
77
+ "requires": {
78
+ "vitest": ">=3.0.0"
79
+ },
80
+ "description": "Migrate workspaces past breaking changes for Vitest 3.",
81
+ "implementation": "./dist/src/migrations/update-23-0-0/migrate-to-vitest-3",
82
+ "prompt": "./dist/src/migrations/update-23-0-0/ai-instructions-for-vitest-3.md"
83
+ },
84
+ "migrate-to-vitest-4": {
85
+ "version": "23.0.0-beta.22",
86
+ "requires": {
87
+ "vitest": ">=4.0.0"
88
+ },
89
+ "description": "Migrate workspaces past breaking changes for Vitest 4.",
90
+ "implementation": "./dist/src/migrations/update-23-0-0/migrate-to-vitest-4",
91
+ "prompt": "./dist/src/migrations/update-23-0-0/ai-instructions-for-vitest-4.md"
61
92
  }
62
93
  },
63
94
  "packageJsonUpdates": {
@@ -76,11 +107,22 @@
76
107
  },
77
108
  "20.5.0": {
78
109
  "version": "20.5.0-beta.3",
110
+ "requires": {
111
+ "vite": ">=5.0.0 <6.0.0"
112
+ },
79
113
  "packages": {
80
114
  "vite": {
81
115
  "version": "^6.0.0",
82
116
  "alwaysAddToPackageJson": false
83
- },
117
+ }
118
+ }
119
+ },
120
+ "20.5.0-vite-plugin-dts": {
121
+ "version": "20.5.0-beta.3",
122
+ "requires": {
123
+ "vite-plugin-dts": ">=3.0.0 <4.0.0"
124
+ },
125
+ "packages": {
84
126
  "vite-plugin-dts": {
85
127
  "version": "~4.5.0",
86
128
  "alwaysAddToPackageJson": false
@@ -124,6 +166,9 @@
124
166
  },
125
167
  "21.5.0": {
126
168
  "version": "21.5.0-beta.0",
169
+ "requires": {
170
+ "vite": ">=6.0.0 <7.0.0"
171
+ },
127
172
  "packages": {
128
173
  "vite": {
129
174
  "version": "^7.1.3",
@@ -160,11 +205,22 @@
160
205
  },
161
206
  "22.2.0-analog": {
162
207
  "version": "22.2.0-beta.3",
208
+ "requires": {
209
+ "@analogjs/vite-plugin-angular": ">=1.0.0 <2.0.0"
210
+ },
163
211
  "packages": {
164
212
  "@analogjs/vite-plugin-angular": {
165
213
  "version": "~2.1.2",
166
214
  "alwaysAddToPackageJson": false
167
- },
215
+ }
216
+ }
217
+ },
218
+ "22.2.0-analog-vitest-angular": {
219
+ "version": "22.2.0-beta.3",
220
+ "requires": {
221
+ "@analogjs/vitest-angular": ">=1.0.0 <2.0.0"
222
+ },
223
+ "packages": {
168
224
  "@analogjs/vitest-angular": {
169
225
  "version": "~2.1.2",
170
226
  "alwaysAddToPackageJson": false
@@ -173,6 +229,9 @@
173
229
  },
174
230
  "23.0.0": {
175
231
  "version": "23.0.0-beta.10",
232
+ "requires": {
233
+ "vite": ">=7.0.0 <8.0.0"
234
+ },
176
235
  "packages": {
177
236
  "vite": {
178
237
  "version": "^8.0.0",
@@ -186,6 +245,54 @@
186
245
  "incompatibleWith": {
187
246
  "@remix-run/dev": "*"
188
247
  }
248
+ },
249
+ "23.0.0-vitest-v3-floor": {
250
+ "version": "23.0.0-beta.22",
251
+ "requires": {
252
+ "vitest": "<3.0.0"
253
+ },
254
+ "packages": {
255
+ "vitest": {
256
+ "version": "^3.0.0",
257
+ "alwaysAddToPackageJson": false
258
+ },
259
+ "@vitest/coverage-v8": {
260
+ "version": "^3.0.0",
261
+ "alwaysAddToPackageJson": false
262
+ },
263
+ "@vitest/coverage-istanbul": {
264
+ "version": "^3.0.0",
265
+ "alwaysAddToPackageJson": false
266
+ },
267
+ "@vitest/ui": {
268
+ "version": "^3.0.0",
269
+ "alwaysAddToPackageJson": false
270
+ }
271
+ }
272
+ },
273
+ "23.0.0-vitest-v4": {
274
+ "version": "23.0.0-beta.22",
275
+ "requires": {
276
+ "vitest": ">=3.0.0 <4.0.0"
277
+ },
278
+ "packages": {
279
+ "vitest": {
280
+ "version": "^4.0.0",
281
+ "alwaysAddToPackageJson": false
282
+ },
283
+ "@vitest/coverage-v8": {
284
+ "version": "^4.0.0",
285
+ "alwaysAddToPackageJson": false
286
+ },
287
+ "@vitest/coverage-istanbul": {
288
+ "version": "^4.0.0",
289
+ "alwaysAddToPackageJson": false
290
+ },
291
+ "@vitest/ui": {
292
+ "version": "^4.0.0",
293
+ "alwaysAddToPackageJson": false
294
+ }
295
+ }
189
296
  }
190
297
  }
191
298
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/vite",
3
- "version": "23.0.0-beta.20",
3
+ "version": "23.0.0-beta.22",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -101,13 +101,13 @@
101
101
  "semver": "^7.6.3",
102
102
  "tslib": "^2.3.0",
103
103
  "ajv": "^8.0.0",
104
- "@nx/devkit": "23.0.0-beta.20",
105
- "@nx/js": "23.0.0-beta.20",
106
- "@nx/vitest": "23.0.0-beta.20"
104
+ "@nx/devkit": "23.0.0-beta.22",
105
+ "@nx/js": "23.0.0-beta.22",
106
+ "@nx/vitest": "23.0.0-beta.22"
107
107
  },
108
108
  "devDependencies": {
109
- "@nx/eslint": "23.0.0-beta.20",
110
- "nx": "23.0.0-beta.20"
109
+ "@nx/eslint": "23.0.0-beta.22",
110
+ "nx": "23.0.0-beta.22"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"