@nx/vite 23.0.0-beta.7 → 23.0.0-beta.9
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/executors.d.ts +0 -2
- package/executors.d.ts.map +1 -1
- package/executors.js +1 -3
- package/executors.json +0 -10
- package/generators.json +0 -5
- package/index.d.ts +0 -2
- package/index.d.ts.map +1 -1
- package/index.js +1 -3
- package/migrations.json +5 -0
- package/package.json +6 -7
- package/src/executors/build/build.impl.d.ts.map +1 -1
- package/src/executors/build/build.impl.js +2 -0
- package/src/executors/build/schema.json +1 -0
- package/src/executors/dev-server/dev-server.impl.d.ts.map +1 -1
- package/src/executors/dev-server/dev-server.impl.js +2 -0
- package/src/executors/dev-server/schema.json +1 -0
- package/src/executors/preview-server/preview-server.impl.d.ts.map +1 -1
- package/src/executors/preview-server/preview-server.impl.js +2 -0
- package/src/executors/preview-server/schema.json +1 -0
- package/src/generators/configuration/configuration.d.ts.map +1 -1
- package/src/generators/configuration/configuration.js +14 -3
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.js +0 -7
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +0 -1
- package/src/generators/init/lib/utils.d.ts.map +1 -1
- package/src/generators/init/lib/utils.js +0 -3
- package/src/migrations/update-23-0-0/ensure-vitest-package-migration.d.ts +3 -0
- package/src/migrations/update-23-0-0/ensure-vitest-package-migration.d.ts.map +1 -0
- package/src/migrations/update-23-0-0/ensure-vitest-package-migration.js +205 -0
- package/src/plugins/plugin.d.ts +0 -9
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +7 -191
- package/src/utils/deprecation.d.ts +8 -0
- package/src/utils/deprecation.d.ts.map +1 -0
- package/src/utils/deprecation.js +31 -0
- package/src/utils/ensure-dependencies.d.ts +0 -1
- package/src/utils/ensure-dependencies.d.ts.map +1 -1
- package/src/utils/ensure-dependencies.js +0 -16
- package/src/utils/executor-utils.d.ts +0 -1
- package/src/utils/executor-utils.d.ts.map +1 -1
- package/src/utils/executor-utils.js +0 -4
- package/src/utils/generator-utils.d.ts +0 -2
- package/src/utils/generator-utils.d.ts.map +1 -1
- package/src/utils/generator-utils.js +0 -28
- package/src/utils/options-utils.d.ts.map +1 -1
- package/src/utils/options-utils.js +0 -3
- package/src/utils/version-utils.d.ts +0 -11
- package/src/utils/version-utils.d.ts.map +1 -1
- package/src/utils/version-utils.js +0 -61
- package/src/utils/versions.d.ts +0 -19
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +1 -22
- package/src/executors/test/compat.d.ts +0 -3
- package/src/executors/test/compat.d.ts.map +0 -1
- package/src/executors/test/compat.js +0 -6
- package/src/executors/test/lib/nx-reporter.d.ts +0 -19
- package/src/executors/test/lib/nx-reporter.d.ts.map +0 -1
- package/src/executors/test/lib/nx-reporter.js +0 -39
- package/src/executors/test/lib/utils.d.ts +0 -5
- package/src/executors/test/lib/utils.d.ts.map +0 -1
- package/src/executors/test/lib/utils.js +0 -68
- package/src/executors/test/schema.d.ts +0 -7
- package/src/executors/test/schema.json +0 -36
- package/src/executors/test/vitest.impl.d.ts +0 -10
- package/src/executors/test/vitest.impl.d.ts.map +0 -1
- package/src/executors/test/vitest.impl.js +0 -49
- package/src/generators/convert-to-inferred/lib/test-post-target-transformer.d.ts +0 -6
- package/src/generators/convert-to-inferred/lib/test-post-target-transformer.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/test-post-target-transformer.js +0 -56
- package/src/generators/vitest/files/tsconfig.spec.json__tmpl__ +0 -22
- package/src/generators/vitest/schema.d.ts +0 -15
- package/src/generators/vitest/schema.json +0 -65
- package/src/generators/vitest/vitest-generator.d.ts +0 -8
- package/src/generators/vitest/vitest-generator.d.ts.map +0 -1
- package/src/generators/vitest/vitest-generator.js +0 -51
package/executors.d.ts
CHANGED
|
@@ -4,6 +4,4 @@ export { type ViteDevServerExecutorOptions } from './src/executors/dev-server/sc
|
|
|
4
4
|
export { viteDevServerExecutor } from './src/executors/dev-server/dev-server.impl';
|
|
5
5
|
export { type VitePreviewServerExecutorOptions } from './src/executors/preview-server/schema';
|
|
6
6
|
export { vitePreviewServerExecutor } from './src/executors/preview-server/preview-server.impl';
|
|
7
|
-
export { type VitestExecutorOptions } from './src/executors/test/schema';
|
|
8
|
-
export { vitestExecutor } from './src/executors/test/vitest.impl';
|
|
9
7
|
//# sourceMappingURL=executors.d.ts.map
|
package/executors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executors.d.ts","sourceRoot":"","sources":["../../../packages/vite/executors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC
|
|
1
|
+
{"version":3,"file":"executors.d.ts","sourceRoot":"","sources":["../../../packages/vite/executors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC"}
|
package/executors.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.vitePreviewServerExecutor = exports.viteDevServerExecutor = exports.viteBuildExecutor = void 0;
|
|
4
4
|
var build_impl_1 = require("./src/executors/build/build.impl");
|
|
5
5
|
Object.defineProperty(exports, "viteBuildExecutor", { enumerable: true, get: function () { return build_impl_1.viteBuildExecutor; } });
|
|
6
6
|
var dev_server_impl_1 = require("./src/executors/dev-server/dev-server.impl");
|
|
7
7
|
Object.defineProperty(exports, "viteDevServerExecutor", { enumerable: true, get: function () { return dev_server_impl_1.viteDevServerExecutor; } });
|
|
8
8
|
var preview_server_impl_1 = require("./src/executors/preview-server/preview-server.impl");
|
|
9
9
|
Object.defineProperty(exports, "vitePreviewServerExecutor", { enumerable: true, get: function () { return preview_server_impl_1.vitePreviewServerExecutor; } });
|
|
10
|
-
var vitest_impl_1 = require("./src/executors/test/vitest.impl");
|
|
11
|
-
Object.defineProperty(exports, "vitestExecutor", { enumerable: true, get: function () { return vitest_impl_1.vitestExecutor; } });
|
package/executors.json
CHANGED
|
@@ -10,11 +10,6 @@
|
|
|
10
10
|
"schema": "./src/executors/build/schema.json",
|
|
11
11
|
"description": "Build with Vite."
|
|
12
12
|
},
|
|
13
|
-
"test": {
|
|
14
|
-
"implementation": "./src/executors/test/compat",
|
|
15
|
-
"schema": "./src/executors/test/schema.json",
|
|
16
|
-
"description": "Test with Vitest"
|
|
17
|
-
},
|
|
18
13
|
"preview-server": {
|
|
19
14
|
"implementation": "./src/executors/preview-server/compat",
|
|
20
15
|
"schema": "./src/executors/preview-server/schema.json",
|
|
@@ -32,11 +27,6 @@
|
|
|
32
27
|
"schema": "./src/executors/build/schema.json",
|
|
33
28
|
"description": "Build with Vite."
|
|
34
29
|
},
|
|
35
|
-
"test": {
|
|
36
|
-
"implementation": "./src/executors/test/vitest.impl",
|
|
37
|
-
"schema": "./src/executors/test/schema.json",
|
|
38
|
-
"description": "Test with Vitest"
|
|
39
|
-
},
|
|
40
30
|
"preview-server": {
|
|
41
31
|
"implementation": "./src/executors/preview-server/preview-server.impl",
|
|
42
32
|
"schema": "./src/executors/preview-server/schema.json",
|
package/generators.json
CHANGED
|
@@ -25,11 +25,6 @@
|
|
|
25
25
|
"factory": "./src/generators/convert-to-inferred/convert-to-inferred",
|
|
26
26
|
"schema": "./src/generators/convert-to-inferred/schema.json",
|
|
27
27
|
"description": "Convert existing Vite project(s) using `@nx/vite:*` executors to use `@nx/vite/plugin`. Defaults to migrating all projects. Pass '--project' to migrate only one target."
|
|
28
|
-
},
|
|
29
|
-
"vitest": {
|
|
30
|
-
"factory": "./src/generators/vitest/vitest-generator",
|
|
31
|
-
"schema": "./src/generators/vitest/schema.json",
|
|
32
|
-
"description": "Generate a vitest configuration."
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
30
|
}
|
package/index.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ export * from './src/utils/generator-utils';
|
|
|
3
3
|
export * from './src/utils/e2e-web-server-info-utils';
|
|
4
4
|
export { type ViteConfigurationGeneratorSchema } from './src/generators/configuration/schema';
|
|
5
5
|
export { viteConfigurationGenerator } from './src/generators/configuration/configuration';
|
|
6
|
-
export { type VitestGeneratorSchema } from './src/generators/vitest/schema';
|
|
7
|
-
export { vitestGenerator } from './src/generators/vitest/vitest-generator';
|
|
8
6
|
export { type InitGeneratorSchema } from './src/generators/init/schema';
|
|
9
7
|
export { initGenerator } from './src/generators/init/init';
|
|
10
8
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initGenerator = exports.
|
|
3
|
+
exports.initGenerator = exports.viteConfigurationGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./src/utils/versions"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./src/utils/generator-utils"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./src/utils/e2e-web-server-info-utils"), exports);
|
|
8
8
|
var configuration_1 = require("./src/generators/configuration/configuration");
|
|
9
9
|
Object.defineProperty(exports, "viteConfigurationGenerator", { enumerable: true, get: function () { return configuration_1.viteConfigurationGenerator; } });
|
|
10
|
-
var vitest_generator_1 = require("./src/generators/vitest/vitest-generator");
|
|
11
|
-
Object.defineProperty(exports, "vitestGenerator", { enumerable: true, get: function () { return vitest_generator_1.vitestGenerator; } });
|
|
12
10
|
var init_1 = require("./src/generators/init/init");
|
|
13
11
|
Object.defineProperty(exports, "initGenerator", { enumerable: true, get: function () { return init_1.initGenerator; } });
|
package/migrations.json
CHANGED
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
"version": "22.2.0-beta.2",
|
|
38
38
|
"description": "Migrate Vitest usage from @nx/vite to @nx/vitest package.",
|
|
39
39
|
"implementation": "./src/migrations/update-22-2-0/migrate-vitest-to-vitest-package"
|
|
40
|
+
},
|
|
41
|
+
"ensure-vitest-package-migration-23": {
|
|
42
|
+
"version": "23.0.0-beta.0",
|
|
43
|
+
"description": "Safety net: ensure any remaining @nx/vite:test executor usages are swapped to @nx/vitest:test and @nx/vitest is installed.",
|
|
44
|
+
"implementation": "./src/migrations/update-23-0-0/ensure-vitest-package-migration"
|
|
40
45
|
}
|
|
41
46
|
},
|
|
42
47
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"migrations": "./migrations.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nx/devkit": "23.0.0-beta.
|
|
34
|
+
"@nx/devkit": "23.0.0-beta.9",
|
|
35
35
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
36
36
|
"enquirer": "~2.3.6",
|
|
37
|
-
"@nx/js": "23.0.0-beta.
|
|
38
|
-
"@nx/vitest": "23.0.0-beta.
|
|
37
|
+
"@nx/js": "23.0.0-beta.9",
|
|
38
|
+
"@nx/vitest": "23.0.0-beta.9",
|
|
39
39
|
"picomatch": "4.0.4",
|
|
40
40
|
"tsconfig-paths": "^4.1.2",
|
|
41
41
|
"semver": "^7.6.3",
|
|
@@ -43,11 +43,10 @@
|
|
|
43
43
|
"ajv": "^8.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"nx": "23.0.0-beta.
|
|
46
|
+
"nx": "23.0.0-beta.9"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
50
|
-
"vitest": "^1.3.1 || ^2.0.0 || ^3.0.0 || ^4.0.0"
|
|
49
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
51
50
|
},
|
|
52
51
|
"publishConfig": {
|
|
53
52
|
"access": "public"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,eAAe,EAMhB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,eAAe,EAMhB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAkBpD,wBAAuB,iBAAiB,CACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,wBAAwB,EACvD,OAAO,EAAE,eAAe;aAiFgB,OAAO;cAAY,MAAM;aAmIlE;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC;IAET,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,CAAC,CAuDD;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -42,8 +42,10 @@ const js_1 = require("@nx/js");
|
|
|
42
42
|
const fs_1 = require("fs");
|
|
43
43
|
const path_1 = require("path");
|
|
44
44
|
const executor_utils_1 = require("../../utils/executor-utils");
|
|
45
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
45
46
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
46
47
|
async function* viteBuildExecutor(options, context) {
|
|
48
|
+
(0, deprecation_1.warnViteBuildExecutorDeprecation)();
|
|
47
49
|
process.env.VITE_CJS_IGNORE_WARNING = 'true';
|
|
48
50
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
49
51
|
const { mergeConfig, build, resolveConfig, createBuilder } = await (0, executor_utils_1.loadViteDynamicImport)();
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"cli": "nx",
|
|
6
6
|
"description": "Builds a Vite application for production.",
|
|
7
7
|
"type": "object",
|
|
8
|
+
"x-deprecated": "The `@nx/vite:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` to migrate to the `@nx/vite/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
8
9
|
"presets": [
|
|
9
10
|
{
|
|
10
11
|
"name": "Default minimum setup",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"dev-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAUxD,wBAAuB,qBAAqB,CAC1C,OAAO,EAAE,4BAA4B,EACrC,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA4FvD;AAiBD,eAAe,qBAAqB,CAAC"}
|
|
@@ -37,9 +37,11 @@ exports.viteDevServerExecutor = viteDevServerExecutor;
|
|
|
37
37
|
const devkit_1 = require("@nx/devkit");
|
|
38
38
|
const options_utils_1 = require("../../utils/options-utils");
|
|
39
39
|
const executor_utils_1 = require("../../utils/executor-utils");
|
|
40
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
40
41
|
const path_1 = require("path");
|
|
41
42
|
const build_impl_1 = require("../build/build.impl");
|
|
42
43
|
async function* viteDevServerExecutor(options, context) {
|
|
44
|
+
(0, deprecation_1.warnViteDevServerExecutorDeprecation)();
|
|
43
45
|
process.env.VITE_CJS_IGNORE_WARNING = 'true';
|
|
44
46
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
45
47
|
const { mergeConfig, createServer, resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"cli": "nx",
|
|
7
7
|
"description": "Starts a dev server using Vite.",
|
|
8
8
|
"type": "object",
|
|
9
|
+
"x-deprecated": "The `@nx/vite:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` to migrate to the `@nx/vite/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
10
|
"presets": [
|
|
10
11
|
{
|
|
11
12
|
"name": "Default minimum setup",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/preview-server/preview-server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"preview-server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/executors/preview-server/preview-server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAM5D,wBAAuB,yBAAyB,CAC9C,OAAO,EAAE,gCAAgC,EACzC,OAAO,EAAE,eAAe;;;kBAwKzB;AAoBD,eAAe,yBAAyB,CAAC"}
|
|
@@ -39,7 +39,9 @@ const options_utils_1 = require("../../utils/options-utils");
|
|
|
39
39
|
const path_1 = require("path");
|
|
40
40
|
const build_impl_1 = require("../build/build.impl");
|
|
41
41
|
const executor_utils_1 = require("../../utils/executor-utils");
|
|
42
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
42
43
|
async function* vitePreviewServerExecutor(options, context) {
|
|
44
|
+
(0, deprecation_1.warnVitePreviewServerExecutorDeprecation)();
|
|
43
45
|
process.env.VITE_CJS_IGNORE_WARNING = 'true';
|
|
44
46
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
45
47
|
const { mergeConfig, preview, resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"description": "Preview Server for Vite.",
|
|
7
7
|
"continuous": true,
|
|
8
8
|
"type": "object",
|
|
9
|
+
"x-deprecated": "The `@nx/vite:preview-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/vite:convert-to-inferred` to migrate to the `@nx/vite/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
10
|
"presets": [
|
|
10
11
|
{
|
|
11
12
|
"name": "Default minimum setup",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAMjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAyBpB,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAE5D,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gCAAgC,8BAMzC;AAED,wBAAsB,kCAAkC,CACtD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gCAAgC,8BAgKzC;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -9,9 +9,10 @@ const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
|
9
9
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
10
|
const posix_1 = require("node:path/posix");
|
|
11
11
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
12
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
12
13
|
const generator_utils_1 = require("../../utils/generator-utils");
|
|
14
|
+
const versions_1 = require("../../utils/versions");
|
|
13
15
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
14
|
-
const vitest_generator_1 = tslib_1.__importDefault(require("../vitest/vitest-generator"));
|
|
15
16
|
const convert_non_vite_1 = require("./lib/convert-non-vite");
|
|
16
17
|
function viteConfigurationGenerator(host, schema) {
|
|
17
18
|
return viteConfigurationGeneratorInternal(host, {
|
|
@@ -57,6 +58,13 @@ async function viteConfigurationGeneratorInternal(tree, schema) {
|
|
|
57
58
|
? p === '@nx/vite/plugin'
|
|
58
59
|
: p.plugin === '@nx/vite/plugin');
|
|
59
60
|
if (!hasPlugin) {
|
|
61
|
+
const willScaffoldExecutorTargets = !projectAlreadyHasViteTargets.build ||
|
|
62
|
+
(!schema.includeLib &&
|
|
63
|
+
(!projectAlreadyHasViteTargets.serve ||
|
|
64
|
+
!projectAlreadyHasViteTargets.preview));
|
|
65
|
+
if (willScaffoldExecutorTargets) {
|
|
66
|
+
(0, deprecation_1.warnViteExecutorGenerating)();
|
|
67
|
+
}
|
|
60
68
|
if (!projectAlreadyHasViteTargets.build) {
|
|
61
69
|
(0, generator_utils_1.addBuildTarget)(tree, schema, 'build');
|
|
62
70
|
}
|
|
@@ -108,7 +116,9 @@ async function viteConfigurationGeneratorInternal(tree, schema) {
|
|
|
108
116
|
}
|
|
109
117
|
}
|
|
110
118
|
if (schema.includeVitest) {
|
|
111
|
-
|
|
119
|
+
(0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
|
|
120
|
+
const { configurationGenerator: vitestConfigurationGenerator } = await Promise.resolve().then(() => tslib_1.__importStar(require('@nx/vitest/generators')));
|
|
121
|
+
const vitestTask = await vitestConfigurationGenerator(tree, {
|
|
112
122
|
project: schema.project,
|
|
113
123
|
uiFramework: schema.uiFramework,
|
|
114
124
|
inSourceTests: schema.inSourceTests,
|
|
@@ -119,7 +129,8 @@ async function viteConfigurationGeneratorInternal(tree, schema) {
|
|
|
119
129
|
addPlugin: schema.addPlugin,
|
|
120
130
|
compiler: schema.compiler,
|
|
121
131
|
projectType,
|
|
122
|
-
|
|
132
|
+
testEnvironment: schema.testEnvironment,
|
|
133
|
+
});
|
|
123
134
|
tasks.push(vitestTask);
|
|
124
135
|
}
|
|
125
136
|
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAW7E,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBA+ClE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -7,7 +7,6 @@ const plugin_1 = require("../../plugins/plugin");
|
|
|
7
7
|
const build_post_target_transformer_1 = require("./lib/build-post-target-transformer");
|
|
8
8
|
const serve_post_target_transformer_1 = require("./lib/serve-post-target-transformer");
|
|
9
9
|
const preview_post_target_transformer_1 = require("./lib/preview-post-target-transformer");
|
|
10
|
-
const test_post_target_transformer_1 = require("./lib/test-post-target-transformer");
|
|
11
10
|
async function convertToInferred(tree, options) {
|
|
12
11
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
13
12
|
const migrationLogs = new internal_1.AggregatedLog();
|
|
@@ -15,7 +14,6 @@ async function convertToInferred(tree, options) {
|
|
|
15
14
|
buildTargetName: 'build',
|
|
16
15
|
serveTargetName: 'serve',
|
|
17
16
|
previewTargetName: 'preview',
|
|
18
|
-
testTargetName: 'test',
|
|
19
17
|
serveStaticTargetName: 'serve-static',
|
|
20
18
|
}, [
|
|
21
19
|
{
|
|
@@ -33,11 +31,6 @@ async function convertToInferred(tree, options) {
|
|
|
33
31
|
postTargetTransformer: (0, preview_post_target_transformer_1.previewPostTargetTransformer)(migrationLogs),
|
|
34
32
|
targetPluginOptionMapper: (target) => ({ previewTargetName: target }),
|
|
35
33
|
},
|
|
36
|
-
{
|
|
37
|
-
executors: ['@nx/vite:test'],
|
|
38
|
-
postTargetTransformer: test_post_target_transformer_1.testPostTargetTransformer,
|
|
39
|
-
targetPluginOptionMapper: (target) => ({ testTargetName: target }),
|
|
40
|
-
},
|
|
41
34
|
], options.project);
|
|
42
35
|
if (migratedProjects.size === 0) {
|
|
43
36
|
throw new internal_1.NoTargetsToMigrateError();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,QAe9C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,8BAEpE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,QAe9C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,8BAEpE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,8BA0D5B;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -29,7 +29,6 @@ async function initGeneratorInternal(tree, schema) {
|
|
|
29
29
|
if (schema.addPlugin) {
|
|
30
30
|
await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/vite/plugin', plugin_1.createNodesV2, {
|
|
31
31
|
buildTargetName: ['build', 'vite:build', 'vite-build'],
|
|
32
|
-
testTargetName: ['test', 'vite:test', 'vite-test'],
|
|
33
32
|
serveTargetName: ['serve', 'vite:serve', 'vite-serve'],
|
|
34
33
|
devTargetName: ['dev', 'vite:dev', 'vite-dev'],
|
|
35
34
|
previewTargetName: ['preview', 'vite:preview', 'vite-preview'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/init/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/init/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAsBhD,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,mDAmD5B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,cAgB/C"}
|
|
@@ -22,7 +22,6 @@ function hasIncompatibleInstalledEsbuild(host) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
async function checkDependenciesInstalled(host, schema) {
|
|
25
|
-
const { vitest } = await (0, version_utils_1.getVitestDependenciesVersionsToInstall)(host);
|
|
26
25
|
// Determine which vite version to install:
|
|
27
26
|
// 1. Explicit flags take priority (useViteV5/V6/V7)
|
|
28
27
|
// 2. If vite is already installed, keep the matching major version
|
|
@@ -57,8 +56,6 @@ async function checkDependenciesInstalled(host, schema) {
|
|
|
57
56
|
'@nx/vite': versions_2.nxVersion,
|
|
58
57
|
'@nx/web': versions_2.nxVersion,
|
|
59
58
|
vite: viteVersionToInstall,
|
|
60
|
-
vitest: vitest,
|
|
61
|
-
'@vitest/ui': vitest,
|
|
62
59
|
jiti: versions_2.jitiVersion,
|
|
63
60
|
}, undefined, schema.keepExistingVersions);
|
|
64
61
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-vitest-package-migration.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/migrations/update-23-0-0/ensure-vitest-package-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AASpB,wBAA8B,4BAA4B,CACxD,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,iBAAiB,CAAC,CAiB5B"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = ensureVitestPackageMigration;
|
|
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
|
+
// @nx/vite no longer infers vitest targets, nor provides vitest executor.
|
|
8
|
+
// - swap @nx/vite:test -> @nx/vitest:test
|
|
9
|
+
// - register @nx/vitest plugin
|
|
10
|
+
async function ensureVitestPackageMigration(tree) {
|
|
11
|
+
const migratedExecutors = migrateExecutorUsages(tree);
|
|
12
|
+
const migratedPlugins = migratePluginConfigurations(tree);
|
|
13
|
+
const migratedTargetDefaults = migrateTargetDefaults(tree);
|
|
14
|
+
const registeredVitestPlugin = await ensureVitestPluginRegistration(tree);
|
|
15
|
+
if (migratedExecutors ||
|
|
16
|
+
migratedPlugins ||
|
|
17
|
+
migratedTargetDefaults ||
|
|
18
|
+
registeredVitestPlugin) {
|
|
19
|
+
const installTask = installVitestPackage(tree);
|
|
20
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
21
|
+
return installTask;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return () => { };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function installVitestPackage(tree) {
|
|
28
|
+
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
29
|
+
const hasNxVitest = packageJson.dependencies?.['@nx/vitest'] ||
|
|
30
|
+
packageJson.devDependencies?.['@nx/vitest'];
|
|
31
|
+
if (hasNxVitest) {
|
|
32
|
+
return () => { };
|
|
33
|
+
}
|
|
34
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/vitest': versions_1.nxVersion });
|
|
35
|
+
}
|
|
36
|
+
function migrateExecutorUsages(tree) {
|
|
37
|
+
const projectsToUpdate = new Set();
|
|
38
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/vite:test', (_options, projectName) => {
|
|
39
|
+
projectsToUpdate.add(projectName);
|
|
40
|
+
});
|
|
41
|
+
if (projectsToUpdate.size === 0) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
for (const projectName of projectsToUpdate) {
|
|
45
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
46
|
+
for (const target of Object.values(projectConfig.targets ?? {})) {
|
|
47
|
+
if (target.executor === '@nx/vite:test') {
|
|
48
|
+
target.executor = '@nx/vitest:test';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
function migratePluginConfigurations(tree) {
|
|
56
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
57
|
+
if (!nxJson?.plugins) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const newPlugins = [];
|
|
61
|
+
let changed = false;
|
|
62
|
+
for (const plugin of nxJson.plugins) {
|
|
63
|
+
if (typeof plugin === 'string' || 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
|
+
if (!testTargetName && !ciTargetName && !ciGroupName) {
|
|
70
|
+
newPlugins.push(plugin);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const vitestOptions = {};
|
|
74
|
+
if (testTargetName)
|
|
75
|
+
vitestOptions.testTargetName = testTargetName;
|
|
76
|
+
if (ciTargetName)
|
|
77
|
+
vitestOptions.ciTargetName = ciTargetName;
|
|
78
|
+
if (ciGroupName)
|
|
79
|
+
vitestOptions.ciGroupName = ciGroupName;
|
|
80
|
+
const vitestPlugin = { plugin: '@nx/vitest' };
|
|
81
|
+
if (Object.keys(vitestOptions).length > 0) {
|
|
82
|
+
vitestPlugin.options = vitestOptions;
|
|
83
|
+
}
|
|
84
|
+
if (plugin.include)
|
|
85
|
+
vitestPlugin.include = plugin.include;
|
|
86
|
+
if (plugin.exclude)
|
|
87
|
+
vitestPlugin.exclude = plugin.exclude;
|
|
88
|
+
const updatedVitePlugin = { ...plugin };
|
|
89
|
+
if (Object.keys(viteOptions).length > 0) {
|
|
90
|
+
updatedVitePlugin.options = viteOptions;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
delete updatedVitePlugin.options;
|
|
94
|
+
}
|
|
95
|
+
newPlugins.push(updatedVitePlugin);
|
|
96
|
+
newPlugins.push(vitestPlugin);
|
|
97
|
+
changed = true;
|
|
98
|
+
}
|
|
99
|
+
if (!changed) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
nxJson.plugins = newPlugins;
|
|
103
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
function migrateTargetDefaults(tree) {
|
|
107
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
108
|
+
if (!nxJson?.targetDefaults) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
let hasChanges = false;
|
|
112
|
+
for (const [targetOrExecutor, targetConfig] of Object.entries(nxJson.targetDefaults)) {
|
|
113
|
+
if (targetOrExecutor === '@nx/vite:test') {
|
|
114
|
+
nxJson.targetDefaults['@nx/vitest:test'] ??= {};
|
|
115
|
+
Object.assign(nxJson.targetDefaults['@nx/vitest:test'], targetConfig);
|
|
116
|
+
delete nxJson.targetDefaults['@nx/vite:test'];
|
|
117
|
+
hasChanges = true;
|
|
118
|
+
}
|
|
119
|
+
else if (targetConfig.executor === '@nx/vite:test') {
|
|
120
|
+
targetConfig.executor = '@nx/vitest:test';
|
|
121
|
+
hasChanges = true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (hasChanges) {
|
|
125
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
126
|
+
}
|
|
127
|
+
return hasChanges;
|
|
128
|
+
}
|
|
129
|
+
async function ensureVitestPluginRegistration(tree) {
|
|
130
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
131
|
+
if (!nxJson?.plugins?.length) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
const vitePluginRegistrations = nxJson.plugins.filter((p) => typeof p === 'string'
|
|
135
|
+
? p === '@nx/vite/plugin'
|
|
136
|
+
: p.plugin === '@nx/vite/plugin');
|
|
137
|
+
if (vitePluginRegistrations.length === 0) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
// Only register @nx/vitest when the workspace actually uses vitest.
|
|
141
|
+
// Otherwise we'd add a plugin (and trigger an install) for vite-only setups.
|
|
142
|
+
if (!(await workspaceUsesVitest(tree))) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
// Skip @nx/vite/plugin entries whose scope already has a matching @nx/vitest.
|
|
146
|
+
// Mixed-shape configs (one scope split by migratePluginConfigurations, another
|
|
147
|
+
// bare) need per-scope checks rather than a global short-circuit.
|
|
148
|
+
const coveredScopes = new Set(nxJson.plugins
|
|
149
|
+
.filter((p) => typeof p === 'string' ? p === '@nx/vitest' : p.plugin === '@nx/vitest')
|
|
150
|
+
.map((p) => scopeKey(typeof p === 'string' ? { plugin: p } : p)));
|
|
151
|
+
let added = false;
|
|
152
|
+
for (const vitePlugin of vitePluginRegistrations) {
|
|
153
|
+
const vitestPlugin = { plugin: '@nx/vitest' };
|
|
154
|
+
if (typeof vitePlugin !== 'string') {
|
|
155
|
+
if (vitePlugin.include) {
|
|
156
|
+
vitestPlugin.include = vitePlugin.include;
|
|
157
|
+
}
|
|
158
|
+
if (vitePlugin.exclude) {
|
|
159
|
+
vitestPlugin.exclude = vitePlugin.exclude;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (coveredScopes.has(scopeKey(vitestPlugin))) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
nxJson.plugins.push(vitestPlugin);
|
|
166
|
+
coveredScopes.add(scopeKey(vitestPlugin));
|
|
167
|
+
added = true;
|
|
168
|
+
}
|
|
169
|
+
if (!added) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
function scopeKey(entry) {
|
|
176
|
+
return [
|
|
177
|
+
(entry.include ?? []).join(','),
|
|
178
|
+
(entry.exclude ?? []).join(','),
|
|
179
|
+
].join('|');
|
|
180
|
+
}
|
|
181
|
+
async function workspaceUsesVitest(tree) {
|
|
182
|
+
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
183
|
+
if (packageJson.dependencies?.['vitest'] ||
|
|
184
|
+
packageJson.devDependencies?.['vitest']) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
// Inference-only setup: vitest.config.* anywhere, or vite.config.* with a
|
|
188
|
+
// top-level `test:` key. Catches workspaces that relied on @nx/vite/plugin's
|
|
189
|
+
// test inference without an explicit executor or root vitest dep.
|
|
190
|
+
const configFiles = await (0, devkit_1.globAsync)(tree, [
|
|
191
|
+
'**/{vite,vitest}.config.{js,ts,mjs,mts,cjs,cts}',
|
|
192
|
+
]);
|
|
193
|
+
for (const configFile of configFiles) {
|
|
194
|
+
if (configFile.includes('vitest.config')) {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
const content = tree.read(configFile, 'utf-8') ?? '';
|
|
198
|
+
// Bias toward over-install: a commented-out `test:` will false-positive,
|
|
199
|
+
// which is safer than missing real usage and dropping inferred targets.
|
|
200
|
+
if (/(^|[\s,{])test\s*:/m.test(content)) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
}
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CreateDependencies, CreateNodesV2 } from '@nx/devkit';
|
|
2
2
|
export interface VitePluginOptions {
|
|
3
3
|
buildTargetName?: string;
|
|
4
|
-
testTargetName?: string;
|
|
5
4
|
/**
|
|
6
5
|
* @deprecated Use devTargetName instead. This option will be removed in Nx 22.
|
|
7
6
|
*/
|
|
@@ -19,14 +18,6 @@ export interface VitePluginOptions {
|
|
|
19
18
|
compiler?: 'tsc' | 'tsgo' | 'vue-tsc';
|
|
20
19
|
watchDepsTargetName?: string;
|
|
21
20
|
buildDepsTargetName?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Atomizer for vitest
|
|
24
|
-
*/
|
|
25
|
-
ciTargetName?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The name that should be used to group atomized tasks on CI
|
|
28
|
-
*/
|
|
29
|
-
ciGroupName?: string;
|
|
30
21
|
}
|
|
31
22
|
/**
|
|
32
23
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/plugins/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kBAAkB,EAGlB,aAAa,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/plugins/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAMd,MAAM,YAAY,CAAC;AAgBpB,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAOD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,iBAAiB,CAiHxD,CAAC;AAEF,eAAO,MAAM,aAAa,kCAAc,CAAC"}
|