@nx/vite 22.2.0-beta.1 → 22.2.0-beta.3

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
@@ -32,6 +32,11 @@
32
32
  },
33
33
  "description": "Create AI Instructions to help migrate users workspaces past breaking changes for Vitest 4.",
34
34
  "implementation": "./src/migrations/update-22-2-0/create-ai-instructions-for-vitest-4"
35
+ },
36
+ "migrate-vitest-to-vitest-package": {
37
+ "version": "22.2.0-beta.2",
38
+ "description": "Migrate Vitest usage from @nx/vite to @nx/vitest package.",
39
+ "implementation": "./src/migrations/update-22-2-0/migrate-vitest-to-vitest-package"
35
40
  }
36
41
  },
37
42
  "packageJsonUpdates": {
@@ -131,6 +136,19 @@
131
136
  "alwaysAddToPackageJson": false
132
137
  }
133
138
  }
139
+ },
140
+ "22.2.0-analog": {
141
+ "version": "22.2.0-beta.3",
142
+ "packages": {
143
+ "@analogjs/vite-plugin-angular": {
144
+ "version": "~2.1.2",
145
+ "alwaysAddToPackageJson": false
146
+ },
147
+ "@analogjs/vitest-angular": {
148
+ "version": "~2.1.2",
149
+ "alwaysAddToPackageJson": false
150
+ }
151
+ }
134
152
  }
135
153
  }
136
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/vite",
3
- "version": "22.2.0-beta.1",
3
+ "version": "22.2.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for building and testing applications using Vite",
6
6
  "repository": {
@@ -30,11 +30,11 @@
30
30
  "migrations": "./migrations.json"
31
31
  },
32
32
  "dependencies": {
33
- "@nx/devkit": "22.2.0-beta.1",
33
+ "@nx/devkit": "22.2.0-beta.3",
34
34
  "@phenomnomnominal/tsquery": "~5.0.1",
35
35
  "enquirer": "~2.3.6",
36
- "@nx/js": "22.2.0-beta.1",
37
- "@nx/vitest": "22.2.0-beta.1",
36
+ "@nx/js": "22.2.0-beta.3",
37
+ "@nx/vitest": "22.2.0-beta.3",
38
38
  "picomatch": "4.0.2",
39
39
  "tsconfig-paths": "^4.1.2",
40
40
  "semver": "^7.6.3",
@@ -42,7 +42,7 @@
42
42
  "ajv": "^8.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "nx": "22.2.0-beta.1"
45
+ "nx": "22.2.0-beta.3"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -3,6 +3,8 @@ import { VitestExecutorOptions } from './schema';
3
3
  /**
4
4
  * @deprecated Use `@nx/vitest:test` instead. This executor will be removed in Nx 23.
5
5
  */
6
- export declare function vitestExecutor(options: VitestExecutorOptions, context: ExecutorContext): AsyncGenerator<never, void, unknown>;
6
+ export declare function vitestExecutor(options: VitestExecutorOptions, context: ExecutorContext): AsyncGenerator<never, {
7
+ success: boolean;
8
+ }, unknown>;
7
9
  export default vitestExecutor;
8
10
  //# sourceMappingURL=vitest.impl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/test/vitest.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,wBAAuB,cAAc,CACnC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe,wCAYzB;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"vitest.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/test/vitest.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,wBAAuB,cAAc,CACnC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe;;YAYzB;AAED,eAAe,cAAc,CAAC"}
@@ -11,6 +11,6 @@ async function* vitestExecutor(options, context) {
11
11
  devkit_1.logger.warn(`The '@nx/vite:test' executor is deprecated. Please use '@nx/vitest:test' instead. This executor will be removed in Nx 23.`);
12
12
  (0, devkit_2.ensurePackage)('@nx/vitest', versions_1.nxVersion);
13
13
  const { vitestExecutor: actualVitestExecutor } = await Promise.resolve().then(() => require('@nx/vitest/executors'));
14
- yield* actualVitestExecutor(options, context);
14
+ return yield* actualVitestExecutor(options, context);
15
15
  }
16
16
  exports.default = vitestExecutor;
@@ -0,0 +1,12 @@
1
+ import { type GeneratorCallback, type Tree } from '@nx/devkit';
2
+ /**
3
+ * Migrates Vitest usage from @nx/vite to @nx/vitest package.
4
+ *
5
+ * This migration:
6
+ * 1. Installs @nx/vitest package if not present
7
+ * 2. Converts @nx/vite:test executor usages to @nx/vitest:test
8
+ * 3. Splits @nx/vite/plugin configurations to add @nx/vitest plugin
9
+ * 4. Migrates targetDefaults from @nx/vite:test to @nx/vitest:test
10
+ */
11
+ export default function migrateVitestToVitestPackage(tree: Tree): Promise<GeneratorCallback>;
12
+ //# sourceMappingURL=migrate-vitest-to-vitest-package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-vitest-to-vitest-package.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/migrations/update-22-2-0/migrate-vitest-to-vitest-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EAItB,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAYpB;;;;;;;;GAQG;AACH,wBAA8B,4BAA4B,CACxD,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,iBAAiB,CAAC,CAS5B"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = migrateVitestToVitestPackage;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
+ const versions_1 = require("../../utils/versions");
7
+ /**
8
+ * Migrates Vitest usage from @nx/vite to @nx/vitest package.
9
+ *
10
+ * This migration:
11
+ * 1. Installs @nx/vitest package if not present
12
+ * 2. Converts @nx/vite:test executor usages to @nx/vitest:test
13
+ * 3. Splits @nx/vite/plugin configurations to add @nx/vitest plugin
14
+ * 4. Migrates targetDefaults from @nx/vite:test to @nx/vitest:test
15
+ */
16
+ async function migrateVitestToVitestPackage(tree) {
17
+ const installTask = installVitestPackageIfNeeded(tree);
18
+ migrateExecutorUsages(tree);
19
+ migratePluginConfigurations(tree);
20
+ migrateTargetDefaults(tree);
21
+ await (0, devkit_1.formatFiles)(tree);
22
+ return installTask;
23
+ }
24
+ function installVitestPackageIfNeeded(tree) {
25
+ const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
26
+ const hasVitest = packageJson.dependencies?.['@nx/vitest'] ||
27
+ packageJson.devDependencies?.['@nx/vitest'];
28
+ if (hasVitest) {
29
+ return () => { };
30
+ }
31
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/vitest': versions_1.nxVersion });
32
+ }
33
+ function migrateExecutorUsages(tree) {
34
+ const projectsToUpdate = new Set();
35
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/vite:test', (_options, projectName, _targetName, _configuration) => {
36
+ projectsToUpdate.add(projectName);
37
+ });
38
+ for (const projectName of projectsToUpdate) {
39
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
40
+ for (const [targetName, target] of Object.entries(projectConfig.targets || {})) {
41
+ if (target.executor === '@nx/vite:test') {
42
+ target.executor = '@nx/vitest:test';
43
+ }
44
+ }
45
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
46
+ }
47
+ }
48
+ function migratePluginConfigurations(tree) {
49
+ const nxJson = (0, devkit_1.readNxJson)(tree);
50
+ if (!nxJson?.plugins) {
51
+ return;
52
+ }
53
+ const newPlugins = [];
54
+ const vitestPluginsToAdd = [];
55
+ const hasVitestPlugin = nxJson.plugins.some((p) => typeof p === 'string' ? p === '@nx/vitest' : p.plugin === '@nx/vitest');
56
+ for (const plugin of nxJson.plugins) {
57
+ // Handle string plugin format
58
+ if (typeof plugin === 'string') {
59
+ newPlugins.push(plugin);
60
+ continue;
61
+ }
62
+ // Handle non-vite plugins
63
+ if (plugin.plugin !== '@nx/vite/plugin') {
64
+ newPlugins.push(plugin);
65
+ continue;
66
+ }
67
+ const options = plugin.options || {};
68
+ const { testTargetName, ciTargetName, ciGroupName, ...viteOptions } = options;
69
+ // Check if this plugin has test-related options
70
+ if (testTargetName || ciTargetName || ciGroupName) {
71
+ // Build vitest plugin for THIS specific vite plugin registration
72
+ const vitestPluginOptions = {};
73
+ if (testTargetName) {
74
+ vitestPluginOptions.testTargetName = testTargetName;
75
+ }
76
+ if (ciTargetName) {
77
+ vitestPluginOptions.ciTargetName = ciTargetName;
78
+ }
79
+ if (ciGroupName) {
80
+ vitestPluginOptions.ciGroupName = ciGroupName;
81
+ }
82
+ const vitestPlugin = {
83
+ plugin: '@nx/vitest',
84
+ };
85
+ if (Object.keys(vitestPluginOptions).length > 0) {
86
+ vitestPlugin.options = vitestPluginOptions;
87
+ }
88
+ if (plugin.include) {
89
+ vitestPlugin.include = plugin.include;
90
+ }
91
+ if (plugin.exclude) {
92
+ vitestPlugin.exclude = plugin.exclude;
93
+ }
94
+ vitestPluginsToAdd.push(vitestPlugin);
95
+ // Update the vite plugin to remove test options
96
+ const updatedVitePlugin = { ...plugin };
97
+ if (Object.keys(viteOptions).length > 0) {
98
+ updatedVitePlugin.options = viteOptions;
99
+ }
100
+ else {
101
+ delete updatedVitePlugin.options;
102
+ }
103
+ newPlugins.push(updatedVitePlugin);
104
+ }
105
+ else {
106
+ newPlugins.push(plugin);
107
+ }
108
+ }
109
+ // Add all vitest plugins if @nx/vitest not already present
110
+ if (!hasVitestPlugin && vitestPluginsToAdd.length > 0) {
111
+ newPlugins.push(...vitestPluginsToAdd);
112
+ }
113
+ nxJson.plugins = newPlugins;
114
+ (0, devkit_1.updateNxJson)(tree, nxJson);
115
+ }
116
+ function migrateTargetDefaults(tree) {
117
+ const nxJson = (0, devkit_1.readNxJson)(tree);
118
+ if (!nxJson?.targetDefaults) {
119
+ return;
120
+ }
121
+ let hasChanges = false;
122
+ for (const [targetOrExecutor, targetConfig] of Object.entries(nxJson.targetDefaults)) {
123
+ // Pattern A: Executor-keyed (e.g., "@nx/vite:test": { ... })
124
+ if (targetOrExecutor === '@nx/vite:test') {
125
+ // Move config to new executor key
126
+ nxJson.targetDefaults['@nx/vitest:test'] ??= {};
127
+ Object.assign(nxJson.targetDefaults['@nx/vitest:test'], targetConfig);
128
+ delete nxJson.targetDefaults['@nx/vite:test'];
129
+ hasChanges = true;
130
+ }
131
+ // Pattern B: Target-name-keyed (e.g., "test": { "executor": "@nx/vite:test", ... })
132
+ else if (targetConfig.executor === '@nx/vite:test') {
133
+ targetConfig.executor = '@nx/vitest:test';
134
+ hasChanges = true;
135
+ }
136
+ }
137
+ if (hasChanges) {
138
+ (0, devkit_1.updateNxJson)(tree, nxJson);
139
+ }
140
+ }
@@ -15,7 +15,7 @@ export declare const ajvVersion = "^8.0.0";
15
15
  export declare const happyDomVersion = "~9.20.3";
16
16
  export declare const edgeRuntimeVmVersion = "~3.0.2";
17
17
  export declare const jitiVersion = "2.4.2";
18
- export declare const analogVitestAngular = "~1.19.1";
18
+ export declare const analogVitestAngular = "~2.1.2";
19
19
  export declare const vitestV4CoverageV8Version = "^4.0.0";
20
20
  export declare const vitestV3CoverageV8Version = "^3.0.5";
21
21
  export declare const vitestV2CoverageV8Version = "^2.1.8";
@@ -1 +1 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM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W,CAAC;AACxC,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,aAAa,WAAkB,CAAC;AAC7C,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAC/C,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,YAAY,YAAY,CAAC;AACtC,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,eAAe,YAAY,CAAC;AACzC,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAG5C,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,uBAAuB,WAA4B,CAAC;AACjE,eAAO,MAAM,+BAA+B,WAAW,CAAC;AACxD,eAAO,MAAM,+BAA+B,WAAW,CAAC;AACxD,eAAO,MAAM,+BAA+B,WAAW,CAAC;AACxD,eAAO,MAAM,6BAA6B,WAAkC,CAAC;AAC7E,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,+BAA+B,WAAW,CAAC"}
@@ -20,7 +20,7 @@ exports.ajvVersion = '^8.0.0';
20
20
  exports.happyDomVersion = '~9.20.3';
21
21
  exports.edgeRuntimeVmVersion = '~3.0.2';
22
22
  exports.jitiVersion = '2.4.2';
23
- exports.analogVitestAngular = '~1.19.1';
23
+ exports.analogVitestAngular = '~2.1.2';
24
24
  // Coverage providers
25
25
  exports.vitestV4CoverageV8Version = '^4.0.0';
26
26
  exports.vitestV3CoverageV8Version = '^3.0.5';