@nx/vite 23.0.0-beta.2 → 23.0.0-beta.21
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/dist/PLUGIN.md +33 -0
- package/{executors.d.ts → dist/executors.d.ts} +0 -3
- package/{executors.js → dist/executors.js} +1 -3
- package/{index.d.ts → dist/index.d.ts} +0 -3
- package/{index.js → dist/index.js} +1 -3
- package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
- package/{plugins → dist/plugins}/nx-copy-assets.plugin.d.ts +1 -2
- package/{plugins → dist/plugins}/nx-copy-assets.plugin.js +2 -2
- package/{plugins → dist/plugins}/nx-tsconfig-paths.plugin.d.ts +0 -1
- package/{plugins → dist/plugins}/nx-tsconfig-paths.plugin.js +7 -8
- package/{plugins → dist/plugins}/nx-vite-build-coordination.plugin.d.ts +0 -1
- package/{plugins → dist/plugins}/rollup-replace-files.plugin.d.ts +0 -1
- package/{src → dist/src}/executors/build/build.impl.d.ts +0 -1
- package/{src → dist/src}/executors/build/build.impl.js +10 -40
- package/{src → dist/src}/executors/build/compat.d.ts +0 -1
- package/{src → dist/src}/executors/build/schema.json +1 -0
- package/{src → dist/src}/executors/dev-server/compat.d.ts +0 -1
- package/{src → dist/src}/executors/dev-server/dev-server.impl.d.ts +0 -1
- package/{src → dist/src}/executors/dev-server/dev-server.impl.js +5 -35
- package/{src → dist/src}/executors/dev-server/schema.json +1 -0
- package/{src → dist/src}/executors/preview-server/compat.d.ts +0 -1
- package/{src → dist/src}/executors/preview-server/preview-server.impl.d.ts +0 -1
- package/{src → dist/src}/executors/preview-server/preview-server.impl.js +5 -35
- package/{src → dist/src}/executors/preview-server/schema.json +1 -0
- package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
- package/{src → dist/src}/generators/configuration/configuration.js +23 -11
- package/{src → dist/src}/generators/configuration/lib/convert-non-vite.d.ts +0 -1
- package/{src → dist/src}/generators/configuration/lib/convert-non-vite.js +2 -2
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +4 -12
- package/{src → dist/src}/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/lib/build-post-target-transformer.js +2 -2
- package/{src → dist/src}/generators/convert-to-inferred/lib/preview-post-target-transformer.d.ts +1 -2
- package/{src → dist/src}/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts +1 -2
- package/{src → dist/src}/generators/convert-to-inferred/lib/utils.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.js +2 -3
- package/{src → dist/src}/generators/init/lib/utils.d.ts +0 -1
- package/{src → dist/src}/generators/init/lib/utils.js +13 -16
- package/dist/src/generators/setup-paths-plugin/lib/utils.d.ts +1 -0
- package/dist/src/generators/setup-paths-plugin/lib/utils.js +2 -0
- package/{src → dist/src}/generators/setup-paths-plugin/setup-paths-plugin.d.ts +0 -1
- package/{src → dist/src}/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.d.ts +0 -1
- package/dist/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.md +12 -0
- package/{src → dist/src}/migrations/update-20-5-0/eslint-ignore-vite-temp-files.d.ts +0 -1
- package/dist/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.js +44 -0
- package/dist/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.md +45 -0
- package/{src → dist/src}/migrations/update-20-5-0/install-jiti.d.ts +0 -1
- package/dist/src/migrations/update-20-5-0/install-jiti.md +6 -0
- package/{src → dist/src}/migrations/update-20-5-0/update-resolve-conditions.d.ts +0 -1
- package/dist/src/migrations/update-20-5-0/update-resolve-conditions.md +42 -0
- package/{src → dist/src}/migrations/update-22-2-0/migrate-vitest-to-vitest-package.d.ts +0 -1
- package/{src → dist/src}/migrations/update-22-2-0/migrate-vitest-to-vitest-package.js +30 -14
- package/dist/src/migrations/update-23-0-0/ai-instructions-for-vite-8.md +254 -0
- package/dist/src/migrations/update-23-0-0/ensure-vitest-package-migration.d.ts +2 -0
- package/dist/src/migrations/update-23-0-0/ensure-vitest-package-migration.js +205 -0
- package/dist/src/migrations/update-23-0-0/ensure-vitest-package-migration.md +18 -0
- package/dist/src/migrations/update-23-0-0/rename-rollup-options-to-rolldown-options.d.ts +2 -0
- package/dist/src/migrations/update-23-0-0/rename-rollup-options-to-rolldown-options.js +47 -0
- package/dist/src/migrations/update-23-0-0/rename-rollup-options-to-rolldown-options.md +65 -0
- package/{src → dist/src}/plugins/plugin.d.ts +0 -10
- package/{src → dist/src}/plugins/plugin.js +22 -215
- package/dist/src/utils/deprecation.d.ts +7 -0
- package/dist/src/utils/deprecation.js +31 -0
- package/{src → dist/src}/utils/detect-ui-framework.d.ts +0 -1
- package/{src → dist/src}/utils/e2e-web-server-info-utils.d.ts +2 -3
- package/{src → dist/src}/utils/e2e-web-server-info-utils.js +9 -10
- package/{src → dist/src}/utils/ensure-dependencies.d.ts +0 -2
- package/{src → dist/src}/utils/ensure-dependencies.js +0 -16
- package/{src → dist/src}/utils/executor-utils.d.ts +0 -2
- package/{src → dist/src}/utils/executor-utils.js +3 -7
- package/{src → dist/src}/utils/find-vite-config.d.ts +0 -1
- package/{src → dist/src}/utils/generator-utils.d.ts +1 -4
- package/{src → dist/src}/utils/generator-utils.js +10 -38
- package/{src → dist/src}/utils/ignore-vite-temp-files.d.ts +0 -1
- package/{src → dist/src}/utils/ignore-vite-temp-files.js +7 -35
- package/{src → dist/src}/utils/nx-tsconfig-paths-find-file.d.ts +0 -1
- package/{src → dist/src}/utils/options-utils.d.ts +0 -1
- package/{src → dist/src}/utils/options-utils.js +0 -3
- package/{src → dist/src}/utils/test-files/test-vite-configs.d.ts +3 -4
- package/{src → dist/src}/utils/test-files/test-vite-configs.js +3 -3
- package/dist/src/utils/version-utils.d.ts +3 -0
- package/dist/src/utils/version-utils.js +26 -0
- package/dist/src/utils/versions.d.ts +11 -0
- package/dist/src/utils/versions.js +16 -0
- package/{src → dist/src}/utils/vite-config-edit-utils.d.ts +0 -1
- package/executors.json +12 -22
- package/generators.json +8 -13
- package/migrations.json +44 -7
- package/package.json +75 -30
- package/executors.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/plugin.d.ts.map +0 -1
- package/plugins/nx-copy-assets.plugin.d.ts.map +0 -1
- package/plugins/nx-tsconfig-paths.plugin.d.ts.map +0 -1
- package/plugins/nx-vite-build-coordination.plugin.d.ts.map +0 -1
- package/plugins/rollup-replace-files.plugin.d.ts.map +0 -1
- package/src/executors/build/build.impl.d.ts.map +0 -1
- package/src/executors/build/compat.d.ts.map +0 -1
- package/src/executors/dev-server/compat.d.ts.map +0 -1
- package/src/executors/dev-server/dev-server.impl.d.ts.map +0 -1
- package/src/executors/preview-server/compat.d.ts.map +0 -1
- package/src/executors/preview-server/preview-server.impl.d.ts.map +0 -1
- 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/configuration/configuration.d.ts.map +0 -1
- package/src/generators/configuration/lib/convert-non-vite.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/preview-post-target-transformer.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts.map +0 -1
- 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/convert-to-inferred/lib/utils.d.ts.map +0 -1
- package/src/generators/init/init.d.ts.map +0 -1
- package/src/generators/init/lib/utils.d.ts.map +0 -1
- package/src/generators/setup-paths-plugin/lib/utils.d.ts +0 -1
- package/src/generators/setup-paths-plugin/lib/utils.d.ts.map +0 -1
- package/src/generators/setup-paths-plugin/lib/utils.js +0 -0
- package/src/generators/setup-paths-plugin/setup-paths-plugin.d.ts.map +0 -1
- 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/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.d.ts.map +0 -1
- package/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.d.ts.map +0 -1
- package/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.js +0 -76
- package/src/migrations/update-20-5-0/install-jiti.d.ts.map +0 -1
- package/src/migrations/update-20-5-0/update-resolve-conditions.d.ts.map +0 -1
- package/src/migrations/update-22-2-0/create-ai-instructions-for-vitest-4.d.ts +0 -3
- package/src/migrations/update-22-2-0/create-ai-instructions-for-vitest-4.d.ts.map +0 -1
- package/src/migrations/update-22-2-0/create-ai-instructions-for-vitest-4.js +0 -16
- package/src/migrations/update-22-2-0/migrate-vitest-to-vitest-package.d.ts.map +0 -1
- package/src/plugins/plugin.d.ts.map +0 -1
- package/src/utils/detect-ui-framework.d.ts.map +0 -1
- package/src/utils/e2e-web-server-info-utils.d.ts.map +0 -1
- package/src/utils/ensure-dependencies.d.ts.map +0 -1
- package/src/utils/executor-utils.d.ts.map +0 -1
- package/src/utils/find-vite-config.d.ts.map +0 -1
- package/src/utils/generator-utils.d.ts.map +0 -1
- package/src/utils/ignore-vite-temp-files.d.ts.map +0 -1
- package/src/utils/nx-tsconfig-paths-find-file.d.ts.map +0 -1
- package/src/utils/options-utils.d.ts.map +0 -1
- package/src/utils/test-files/test-vite-configs.d.ts.map +0 -1
- package/src/utils/version-utils.d.ts +0 -15
- package/src/utils/version-utils.d.ts.map +0 -1
- package/src/utils/version-utils.js +0 -87
- package/src/utils/versions.d.ts +0 -31
- package/src/utils/versions.d.ts.map +0 -1
- package/src/utils/versions.js +0 -36
- package/src/utils/vite-config-edit-utils.d.ts.map +0 -1
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{plugin.js → dist/plugin.js} +0 -0
- /package/{plugins → dist/plugins}/nx-vite-build-coordination.plugin.js +0 -0
- /package/{plugins → dist/plugins}/rollup-replace-files.plugin.js +0 -0
- /package/{src → dist/src}/executors/build/compat.js +0 -0
- /package/{src → dist/src}/executors/build/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/dev-server/compat.js +0 -0
- /package/{src → dist/src}/executors/dev-server/schema.d.ts +0 -0
- /package/{src → dist/src}/executors/preview-server/compat.js +0 -0
- /package/{src → dist/src}/executors/preview-server/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/configuration/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/configuration/schema.json +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/preview-post-target-transformer.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/serve-post-target-transformer.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/utils.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/init/schema.json +0 -0
- /package/{src → dist/src}/generators/setup-paths-plugin/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/setup-paths-plugin/schema.json +0 -0
- /package/{src → dist/src}/generators/setup-paths-plugin/setup-paths-plugin.js +0 -0
- /package/{src → dist/src}/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.js +0 -0
- /package/{src → dist/src}/migrations/update-20-5-0/install-jiti.js +0 -0
- /package/{src → dist/src}/migrations/update-20-5-0/update-resolve-conditions.js +0 -0
- /package/{src/migrations/update-22-2-0/files → dist/src/migrations/update-22-2-0}/ai-instructions-for-vitest-4.md +0 -0
- /package/{src → dist/src}/utils/detect-ui-framework.js +0 -0
- /package/{src → dist/src}/utils/find-vite-config.js +0 -0
- /package/{src → dist/src}/utils/nx-tsconfig-paths-find-file.js +0 -0
- /package/{src → dist/src}/utils/vite-config-edit-utils.js +0 -0
|
@@ -1,61 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.createNodesV2 = exports.createNodes = exports.createDependencies = void 0;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
37
5
|
const devkit_1 = require("@nx/devkit");
|
|
38
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
39
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
40
6
|
const js_1 = require("@nx/js");
|
|
41
|
-
const
|
|
42
|
-
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
43
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
44
8
|
const node_fs_1 = require("node:fs");
|
|
45
9
|
const node_path_1 = require("node:path");
|
|
46
10
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
47
11
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
48
|
-
const plugins_1 = require("nx/src/utils/plugins");
|
|
49
12
|
const executor_utils_1 = require("../utils/executor-utils");
|
|
50
13
|
const picomatch = require("picomatch");
|
|
51
|
-
function readTargetsCache(cachePath) {
|
|
52
|
-
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false' && (0, node_fs_1.existsSync)(cachePath)
|
|
53
|
-
? (0, devkit_1.readJsonFile)(cachePath)
|
|
54
|
-
: {};
|
|
55
|
-
}
|
|
56
|
-
function writeTargetsToCache(cachePath, results) {
|
|
57
|
-
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
58
|
-
}
|
|
59
14
|
/**
|
|
60
15
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
61
16
|
*/
|
|
@@ -63,15 +18,15 @@ const createDependencies = () => {
|
|
|
63
18
|
return [];
|
|
64
19
|
};
|
|
65
20
|
exports.createDependencies = createDependencies;
|
|
66
|
-
const
|
|
21
|
+
const viteConfigGlob = '**/vite.config.{js,ts,mjs,mts,cjs,cts}';
|
|
67
22
|
exports.createNodes = [
|
|
68
|
-
|
|
23
|
+
viteConfigGlob,
|
|
69
24
|
async (configFilePaths, options, context) => {
|
|
70
25
|
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
71
26
|
const normalizedOptions = normalizeOptions(options);
|
|
72
27
|
const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `vite-${optionsHash}.hash`);
|
|
73
|
-
const targetsCache =
|
|
74
|
-
const isUsingTsSolutionSetup = (0,
|
|
28
|
+
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
29
|
+
const isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
75
30
|
const { roots: projectRoots, configFiles: validConfigFiles } = configFilePaths.reduce((acc, configFile) => {
|
|
76
31
|
const potentialRoot = (0, node_path_1.dirname)(configFile);
|
|
77
32
|
if (checkIfConfigFileShouldBeProject(potentialRoot, context)) {
|
|
@@ -87,7 +42,7 @@ exports.createNodes = [
|
|
|
87
42
|
const pmc = (0, devkit_1.getPackageManagerCommand)(detectedPackageManager);
|
|
88
43
|
const lockfile = (0, js_1.getLockFileName)(detectedPackageManager);
|
|
89
44
|
const tsconfigChainsByProjectRoot = collectTsconfigInputsByProjectRoot(projectRoots, context.workspaceRoot);
|
|
90
|
-
const hashes = await (0,
|
|
45
|
+
const hashes = await (0, internal_1.calculateHashesForCreateNodes)(projectRoots, { ...normalizedOptions, isUsingTsSolutionSetup }, context, projectRoots.map((root) => [
|
|
91
46
|
lockfile,
|
|
92
47
|
...(tsconfigChainsByProjectRoot.get(root) ?? []),
|
|
93
48
|
]));
|
|
@@ -103,13 +58,11 @@ exports.createNodes = [
|
|
|
103
58
|
parts[1] === 'config' &&
|
|
104
59
|
parts.length > 2);
|
|
105
60
|
});
|
|
106
|
-
// results from vitest.config.js will be different from results of vite.config.js
|
|
107
|
-
// but the hash will be the same because it is based on the files under the project root.
|
|
108
|
-
// Adding the config file path to the hash ensures that the final hash value is different
|
|
109
|
-
// for different config files.
|
|
110
61
|
const hash = hashes[idx] + configFile;
|
|
111
|
-
|
|
112
|
-
await buildViteTargets(configFile, projectRoot, normalizedOptions, tsConfigFiles, hasReactRouterConfig, isUsingTsSolutionSetup, context, pmc, tsconfigChainsByProjectRoot.get(projectRoot) ?? []));
|
|
62
|
+
if (!targetsCache.has(hash)) {
|
|
63
|
+
targetsCache.set(hash, await buildViteTargets(configFile, projectRoot, normalizedOptions, tsConfigFiles, hasReactRouterConfig, isUsingTsSolutionSetup, context, pmc, tsconfigChainsByProjectRoot.get(projectRoot) ?? []));
|
|
64
|
+
}
|
|
65
|
+
const { projectType, metadata, targets } = targetsCache.get(hash);
|
|
113
66
|
const project = {
|
|
114
67
|
root: projectRoot,
|
|
115
68
|
targets,
|
|
@@ -128,7 +81,7 @@ exports.createNodes = [
|
|
|
128
81
|
}, validConfigFiles, options, context);
|
|
129
82
|
}
|
|
130
83
|
finally {
|
|
131
|
-
|
|
84
|
+
targetsCache.writeToDisk();
|
|
132
85
|
}
|
|
133
86
|
},
|
|
134
87
|
];
|
|
@@ -156,115 +109,23 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
|
|
|
156
109
|
catch {
|
|
157
110
|
// Plugin not installed or not needed, ignore
|
|
158
111
|
}
|
|
159
|
-
// Workaround for race condition with vitest/node on Node 24+
|
|
160
|
-
// When multiple vitest.config files are processed in parallel, Node can throw:
|
|
161
|
-
// Error [ERR_INTERNAL_ASSERTION]: Cannot require() ES Module vitest/dist/node.js
|
|
162
|
-
// because it is not yet fully loaded.
|
|
163
|
-
// See: https://github.com/nrwl/nx/issues/34028
|
|
164
|
-
try {
|
|
165
|
-
const importVitestNode = () => new Function('return import("vitest/node")')();
|
|
166
|
-
await importVitestNode();
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
// vitest/node not available or not needed, ignore
|
|
170
|
-
}
|
|
171
112
|
const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
|
|
172
113
|
const viteBuildConfig = await resolveConfig({
|
|
173
114
|
configFile: absoluteConfigFilePath,
|
|
174
115
|
mode: 'development',
|
|
175
116
|
root: projectRoot,
|
|
176
117
|
}, 'build');
|
|
177
|
-
|
|
178
|
-
const { buildOutputs,
|
|
179
|
-
const namedInputs = (0,
|
|
118
|
+
const metadata = {};
|
|
119
|
+
const { buildOutputs, isBuildable, hasServeConfig } = getOutputs(viteBuildConfig, projectRoot, context.workspaceRoot);
|
|
120
|
+
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
180
121
|
const targets = {};
|
|
181
|
-
// if file is vitest.config or vite.config has definition for test, create targets for test and/or atomized tests
|
|
182
|
-
if (configFilePath.includes('vitest.config') || hasTest) {
|
|
183
|
-
const isTypecheckEnabled = !!viteBuildConfig?.test?.typecheck
|
|
184
|
-
?.enabled;
|
|
185
|
-
targets[options.testTargetName] = await testTarget(namedInputs, testOutputs, projectRoot, pmc, isTypecheckEnabled, tsconfigInputs);
|
|
186
|
-
if (options.ciTargetName) {
|
|
187
|
-
const groupName = options.ciGroupName ?? (0, plugins_1.deriveGroupNameFromTarget)(options.ciTargetName);
|
|
188
|
-
const targetGroup = [];
|
|
189
|
-
const dependsOn = [];
|
|
190
|
-
metadata = {
|
|
191
|
-
targetGroups: {
|
|
192
|
-
[groupName]: targetGroup,
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
const projectRootRelativeTestPaths = await getTestPathsRelativeToProjectRoot(projectRoot, context.workspaceRoot);
|
|
196
|
-
for (const relativePath of projectRootRelativeTestPaths) {
|
|
197
|
-
if (relativePath.includes('../')) {
|
|
198
|
-
throw new Error('@nx/vite/plugin attempted to run tests outside of the project root. This is not supported and should not happen. Please open an issue at https://github.com/nrwl/nx/issues/new/choose with the following information:\n\n' +
|
|
199
|
-
`\n\n${JSON.stringify({
|
|
200
|
-
projectRoot,
|
|
201
|
-
relativePath,
|
|
202
|
-
projectRootRelativeTestPaths,
|
|
203
|
-
context,
|
|
204
|
-
}, null, 2)}`);
|
|
205
|
-
}
|
|
206
|
-
const targetName = `${options.ciTargetName}--${relativePath}`;
|
|
207
|
-
dependsOn.push(targetName);
|
|
208
|
-
targets[targetName] = {
|
|
209
|
-
// It does not make sense to run atomized tests in watch mode as they are intended to be run in CI
|
|
210
|
-
command: `vitest run ${relativePath}`,
|
|
211
|
-
cache: targets[options.testTargetName].cache,
|
|
212
|
-
inputs: targets[options.testTargetName].inputs,
|
|
213
|
-
outputs: targets[options.testTargetName].outputs,
|
|
214
|
-
options: {
|
|
215
|
-
cwd: projectRoot,
|
|
216
|
-
env: targets[options.testTargetName].options.env,
|
|
217
|
-
},
|
|
218
|
-
metadata: {
|
|
219
|
-
technologies: ['vitest'],
|
|
220
|
-
description: `Run Vitest Tests in ${relativePath}`,
|
|
221
|
-
help: {
|
|
222
|
-
command: `${pmc.exec} vitest --help`,
|
|
223
|
-
example: {
|
|
224
|
-
options: {
|
|
225
|
-
coverage: true,
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
targetGroup.push(targetName);
|
|
232
|
-
}
|
|
233
|
-
if (targetGroup.length > 0) {
|
|
234
|
-
targets[options.ciTargetName] = {
|
|
235
|
-
executor: 'nx:noop',
|
|
236
|
-
cache: true,
|
|
237
|
-
inputs: targets[options.testTargetName].inputs,
|
|
238
|
-
outputs: targets[options.testTargetName].outputs,
|
|
239
|
-
dependsOn,
|
|
240
|
-
metadata: {
|
|
241
|
-
technologies: ['vitest'],
|
|
242
|
-
description: 'Run Vitest Tests in CI',
|
|
243
|
-
nonAtomizedTarget: options.testTargetName,
|
|
244
|
-
help: {
|
|
245
|
-
command: `${pmc.exec} vitest --help`,
|
|
246
|
-
example: {
|
|
247
|
-
options: {
|
|
248
|
-
coverage: true,
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
targetGroup.unshift(options.ciTargetName);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
122
|
if (hasReactRouterConfig) {
|
|
259
123
|
// If we have a react-router config, we can skip the rest of the targets
|
|
260
124
|
return { targets, metadata: {}, projectType: 'application' };
|
|
261
125
|
}
|
|
262
|
-
// If file is not vitest.config and buildable, create targets for build, serve, preview and serve-static
|
|
263
126
|
const hasRemixPlugin = viteBuildConfig.plugins &&
|
|
264
127
|
viteBuildConfig.plugins.some((p) => p.name === 'remix');
|
|
265
|
-
if (!
|
|
266
|
-
!hasRemixPlugin &&
|
|
267
|
-
isBuildable) {
|
|
128
|
+
if (!hasRemixPlugin && isBuildable) {
|
|
268
129
|
targets[options.buildTargetName] = await buildTarget(options.buildTargetName, namedInputs, buildOutputs, projectRoot, isUsingTsSolutionSetup, pmc);
|
|
269
130
|
// If running in library mode, then there is nothing to serve.
|
|
270
131
|
if (!viteBuildConfig.build?.lib || hasServeConfig) {
|
|
@@ -328,7 +189,7 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
|
|
|
328
189
|
];
|
|
329
190
|
}
|
|
330
191
|
}
|
|
331
|
-
(0,
|
|
192
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
332
193
|
return {
|
|
333
194
|
targets,
|
|
334
195
|
metadata,
|
|
@@ -417,42 +278,6 @@ function previewTarget(projectRoot, buildTargetName, pmc) {
|
|
|
417
278
|
};
|
|
418
279
|
return targetConfig;
|
|
419
280
|
}
|
|
420
|
-
async function testTarget(namedInputs, outputs, projectRoot, pmc, isTypecheckEnabled, tsconfigInputs) {
|
|
421
|
-
const depOutputsGlob = isTypecheckEnabled ? '**/*.{js,d.ts}' : '**/*.js';
|
|
422
|
-
return {
|
|
423
|
-
command: `vitest`,
|
|
424
|
-
options: { cwd: (0, devkit_1.joinPathFragments)(projectRoot) },
|
|
425
|
-
cache: true,
|
|
426
|
-
inputs: [
|
|
427
|
-
...('production' in namedInputs
|
|
428
|
-
? ['default', '^production']
|
|
429
|
-
: ['default', '^default']),
|
|
430
|
-
...tsconfigInputs.map((f) => ({
|
|
431
|
-
json: `{workspaceRoot}/${f}`,
|
|
432
|
-
fields: ['compilerOptions'],
|
|
433
|
-
})),
|
|
434
|
-
{
|
|
435
|
-
externalDependencies: ['vitest'],
|
|
436
|
-
},
|
|
437
|
-
{ env: 'CI' },
|
|
438
|
-
{ dependentTasksOutputFiles: depOutputsGlob, transitive: true },
|
|
439
|
-
],
|
|
440
|
-
outputs,
|
|
441
|
-
metadata: {
|
|
442
|
-
technologies: ['vite'],
|
|
443
|
-
description: `Run Vite tests`,
|
|
444
|
-
help: {
|
|
445
|
-
command: `${pmc.exec} vitest --help`,
|
|
446
|
-
example: {
|
|
447
|
-
options: {
|
|
448
|
-
bail: 1,
|
|
449
|
-
coverage: true,
|
|
450
|
-
},
|
|
451
|
-
},
|
|
452
|
-
},
|
|
453
|
-
},
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
281
|
function serveStaticTarget(options, isUsingTsSolutionSetup) {
|
|
457
282
|
const targetConfig = {
|
|
458
283
|
continuous: true,
|
|
@@ -471,8 +296,8 @@ function getOutputs(viteBuildConfig, projectRoot, workspaceRoot) {
|
|
|
471
296
|
// TODO(jack): Remove this cast when @nx/vite switches to moduleResolution:
|
|
472
297
|
// "nodenext". Vite 8's rolldown types are ESM-only (.d.mts) and not
|
|
473
298
|
// resolvable under moduleResolution: "node", which breaks rolldownOptions
|
|
474
|
-
//
|
|
475
|
-
const { build,
|
|
299
|
+
// on ResolvedConfig.
|
|
300
|
+
const { build, server } = viteBuildConfig;
|
|
476
301
|
const buildOutputPath = normalizeOutputPath(build?.outDir, projectRoot, workspaceRoot, 'dist');
|
|
477
302
|
const isBuildable = Boolean(build?.lib ||
|
|
478
303
|
viteBuildConfig?.builder?.buildApp ||
|
|
@@ -480,11 +305,8 @@ function getOutputs(viteBuildConfig, projectRoot, workspaceRoot) {
|
|
|
480
305
|
build?.rolldownOptions?.input || // Vite >=8
|
|
481
306
|
(0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRoot, projectRoot, 'index.html')));
|
|
482
307
|
const hasServeConfig = Boolean(server?.host || server?.port);
|
|
483
|
-
const reportsDirectoryPath = normalizeOutputPath(test?.coverage?.reportsDirectory, projectRoot, workspaceRoot, 'coverage');
|
|
484
308
|
return {
|
|
485
309
|
buildOutputs: [buildOutputPath],
|
|
486
|
-
testOutputs: [reportsDirectoryPath],
|
|
487
|
-
hasTest: !!test,
|
|
488
310
|
isBuildable,
|
|
489
311
|
hasServeConfig,
|
|
490
312
|
};
|
|
@@ -518,7 +340,6 @@ function normalizeOptions(options) {
|
|
|
518
340
|
options.serveTargetName ??= 'serve';
|
|
519
341
|
options.devTargetName ??= 'dev';
|
|
520
342
|
options.previewTargetName ??= 'preview';
|
|
521
|
-
options.testTargetName ??= 'test';
|
|
522
343
|
options.serveStaticTargetName ??= 'serve-static';
|
|
523
344
|
options.typecheckTargetName ??= 'typecheck';
|
|
524
345
|
return options;
|
|
@@ -565,7 +386,7 @@ function collectTsconfigInputsByProjectRoot(projectRoots, workspaceRoot) {
|
|
|
565
386
|
// Walk the project tsconfig's extends chain
|
|
566
387
|
const projectTsconfig = (0, node_path_1.join)(workspaceRoot, projectRoot, 'tsconfig.json');
|
|
567
388
|
if ((0, node_fs_1.existsSync)(projectTsconfig)) {
|
|
568
|
-
(0,
|
|
389
|
+
(0, internal_2.walkTsconfigExtendsChain)(projectTsconfig, (absPath) => {
|
|
569
390
|
collect(absPath);
|
|
570
391
|
return 'continue';
|
|
571
392
|
}, { jsonCache });
|
|
@@ -576,7 +397,7 @@ function collectTsconfigInputsByProjectRoot(projectRoots, workspaceRoot) {
|
|
|
576
397
|
while (dir && dir !== '.') {
|
|
577
398
|
const ancestorTsconfig = (0, node_path_1.join)(workspaceRoot, dir, 'tsconfig.json');
|
|
578
399
|
if ((0, node_fs_1.existsSync)(ancestorTsconfig)) {
|
|
579
|
-
(0,
|
|
400
|
+
(0, internal_2.walkTsconfigExtendsChain)(ancestorTsconfig, (absPath) => {
|
|
580
401
|
collect(absPath);
|
|
581
402
|
return 'continue';
|
|
582
403
|
}, { jsonCache });
|
|
@@ -589,7 +410,7 @@ function collectTsconfigInputsByProjectRoot(projectRoots, workspaceRoot) {
|
|
|
589
410
|
// Check the workspace root itself (dirname loop above stops at '.')
|
|
590
411
|
const rootTsconfig = (0, node_path_1.join)(workspaceRoot, 'tsconfig.json');
|
|
591
412
|
if ((0, node_fs_1.existsSync)(rootTsconfig)) {
|
|
592
|
-
(0,
|
|
413
|
+
(0, internal_2.walkTsconfigExtendsChain)(rootTsconfig, (absPath) => {
|
|
593
414
|
collect(absPath);
|
|
594
415
|
return 'continue';
|
|
595
416
|
}, { jsonCache });
|
|
@@ -609,17 +430,3 @@ function checkIfConfigFileShouldBeProject(projectRoot, context) {
|
|
|
609
430
|
}
|
|
610
431
|
return true;
|
|
611
432
|
}
|
|
612
|
-
async function getTestPathsRelativeToProjectRoot(projectRoot, workspaceRoot) {
|
|
613
|
-
const fullProjectRoot = (0, node_path_1.join)(workspaceRoot, projectRoot);
|
|
614
|
-
const { createVitest } = await Promise.resolve().then(() => __importStar(require('vitest/node')));
|
|
615
|
-
const vitest = await createVitest('test', {
|
|
616
|
-
root: fullProjectRoot,
|
|
617
|
-
dir: fullProjectRoot,
|
|
618
|
-
filesOnly: true,
|
|
619
|
-
watch: false,
|
|
620
|
-
});
|
|
621
|
-
const relevantTestSpecifications = await vitest.getRelevantTestSpecifications();
|
|
622
|
-
return relevantTestSpecifications
|
|
623
|
-
.filter((ts) => projectRoot === '.' ? true : ts.moduleId.startsWith(fullProjectRoot))
|
|
624
|
-
.map((ts) => (0, devkit_1.normalizePath)((0, node_path_1.relative)(projectRoot, ts.moduleId)));
|
|
625
|
-
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE = "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 targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
2
|
+
export declare const VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "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 targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
3
|
+
export declare const VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "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 targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
4
|
+
export declare function warnViteBuildExecutorDeprecation(): void;
|
|
5
|
+
export declare function warnViteDevServerExecutorDeprecation(): void;
|
|
6
|
+
export declare function warnVitePreviewServerExecutorDeprecation(): void;
|
|
7
|
+
export declare function warnViteExecutorGenerating(): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
4
|
+
exports.warnViteBuildExecutorDeprecation = warnViteBuildExecutorDeprecation;
|
|
5
|
+
exports.warnViteDevServerExecutorDeprecation = warnViteDevServerExecutorDeprecation;
|
|
6
|
+
exports.warnVitePreviewServerExecutorDeprecation = warnVitePreviewServerExecutorDeprecation;
|
|
7
|
+
exports.warnViteExecutorGenerating = warnViteExecutorGenerating;
|
|
8
|
+
const devkit_1 = require("@nx/devkit");
|
|
9
|
+
// TODO(v24): Remove the @nx/vite:build, @nx/vite:dev-server, and
|
|
10
|
+
// @nx/vite:preview-server executors. The inferred plugin (@nx/vite/plugin)
|
|
11
|
+
// and the convert-to-inferred generator stay supported. (`@nx/vite:test`
|
|
12
|
+
// is being deprecated in a separate change for the test-runner batch.)
|
|
13
|
+
exports.VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE = '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 targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
14
|
+
exports.VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = '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 targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
15
|
+
exports.VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE = '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 targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
16
|
+
function warnViteBuildExecutorDeprecation() {
|
|
17
|
+
devkit_1.logger.warn(exports.VITE_BUILD_EXECUTOR_DEPRECATION_MESSAGE);
|
|
18
|
+
}
|
|
19
|
+
function warnViteDevServerExecutorDeprecation() {
|
|
20
|
+
devkit_1.logger.warn(exports.VITE_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
|
|
21
|
+
}
|
|
22
|
+
function warnVitePreviewServerExecutorDeprecation() {
|
|
23
|
+
devkit_1.logger.warn(exports.VITE_PREVIEW_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
|
|
24
|
+
}
|
|
25
|
+
// Fired when the @nx/vite:configuration generator is about to generate
|
|
26
|
+
// targets that use the deprecated executors — i.e. when @nx/vite/plugin
|
|
27
|
+
// isn't registered in nx.json. Surfaces the deprecation at generation time
|
|
28
|
+
// rather than only when the user later runs the generated targets.
|
|
29
|
+
function warnViteExecutorGenerating() {
|
|
30
|
+
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
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
|
-
export declare function getViteE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number, e2eCIPortOverride?: number): Promise<import("@nx/devkit/
|
|
3
|
-
export declare function getReactRouterE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number, e2eCIPortOverride?: number): Promise<import("@nx/devkit/
|
|
4
|
-
//# sourceMappingURL=e2e-web-server-info-utils.d.ts.map
|
|
2
|
+
export declare function getViteE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number, e2eCIPortOverride?: number): Promise<import("@nx/devkit/internal").E2EWebServerDetails>;
|
|
3
|
+
export declare function getReactRouterE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number, e2eCIPortOverride?: number): Promise<import("@nx/devkit/internal").E2EWebServerDetails>;
|
|
@@ -3,19 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getViteE2EWebServerInfo = getViteE2EWebServerInfo;
|
|
4
4
|
exports.getReactRouterE2EWebServerInfo = getReactRouterE2EWebServerInfo;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
async function getViteE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded, e2ePortOverride, e2eCIPortOverride) {
|
|
8
8
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
9
9
|
let e2ePort = e2ePortOverride ?? 4200;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
nxJson.targetDefaults?.['serve'].options?.port;
|
|
10
|
+
const devPort = (0, internal_1.readTargetDefaultsForTarget)('dev', nxJson.targetDefaults)
|
|
11
|
+
?.options?.port;
|
|
12
|
+
const servePort = (0, internal_1.readTargetDefaultsForTarget)('serve', nxJson.targetDefaults)
|
|
13
|
+
?.options?.port;
|
|
14
|
+
if (devPort || servePort) {
|
|
15
|
+
e2ePort = devPort ?? servePort;
|
|
17
16
|
}
|
|
18
|
-
return (0,
|
|
17
|
+
return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
|
|
19
18
|
plugin: '@nx/vite/plugin',
|
|
20
19
|
serveTargetName: 'devTargetName',
|
|
21
20
|
serveStaticTargetName: 'previewTargetName',
|
|
@@ -30,7 +29,7 @@ async function getViteE2EWebServerInfo(tree, projectName, configFilePath, isPlug
|
|
|
30
29
|
}
|
|
31
30
|
async function getReactRouterE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded, e2ePortOverride, e2eCIPortOverride) {
|
|
32
31
|
const e2ePort = e2ePortOverride ?? parseInt(process.env.PORT) ?? 4200;
|
|
33
|
-
return await (0,
|
|
32
|
+
return await (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
|
|
34
33
|
plugin: '@nx/react/router-plugin',
|
|
35
34
|
serveTargetName: 'devTargetName',
|
|
36
35
|
serveStaticTargetName: 'devTargetName',
|
|
@@ -3,7 +3,5 @@ export type EnsureDependenciesOptions = {
|
|
|
3
3
|
uiFramework: 'angular' | 'react' | 'none';
|
|
4
4
|
compiler?: 'babel' | 'swc';
|
|
5
5
|
includeLib?: boolean;
|
|
6
|
-
testEnvironment?: 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string;
|
|
7
6
|
};
|
|
8
7
|
export declare function ensureDependencies(host: Tree, schema: EnsureDependenciesOptions): GeneratorCallback;
|
|
9
|
-
//# sourceMappingURL=ensure-dependencies.d.ts.map
|
|
@@ -6,22 +6,6 @@ const semver_1 = require("semver");
|
|
|
6
6
|
const versions_1 = require("./versions");
|
|
7
7
|
function ensureDependencies(host, schema) {
|
|
8
8
|
const devDependencies = {};
|
|
9
|
-
if (schema.testEnvironment === 'jsdom') {
|
|
10
|
-
devDependencies['jsdom'] = versions_1.jsdomVersion;
|
|
11
|
-
}
|
|
12
|
-
else if (schema.testEnvironment === 'happy-dom') {
|
|
13
|
-
devDependencies['happy-dom'] = versions_1.happyDomVersion;
|
|
14
|
-
}
|
|
15
|
-
else if (schema.testEnvironment === 'edge-runtime') {
|
|
16
|
-
devDependencies['@edge-runtime/vm'] = versions_1.edgeRuntimeVmVersion;
|
|
17
|
-
}
|
|
18
|
-
else if (schema.testEnvironment !== 'node' && schema.testEnvironment) {
|
|
19
|
-
devkit_1.logger.info(`A custom environment was provided: ${schema.testEnvironment}. You need to install it manually.`);
|
|
20
|
-
}
|
|
21
|
-
if (schema.uiFramework === 'angular') {
|
|
22
|
-
devDependencies['@analogjs/vitest-angular'] = versions_1.analogVitestAngular;
|
|
23
|
-
devDependencies['@analogjs/vite-plugin-angular'] = versions_1.analogVitestAngular;
|
|
24
|
-
}
|
|
25
9
|
if (schema.uiFramework === 'react') {
|
|
26
10
|
if (schema.compiler === 'swc') {
|
|
27
11
|
devDependencies['@vitejs/plugin-react-swc'] = versions_1.vitePluginReactSwcVersion;
|
|
@@ -9,5 +9,3 @@ export declare function createBuildableTsConfig(projectRoot: string, options: {
|
|
|
9
9
|
buildLibsFromSource?: boolean;
|
|
10
10
|
}, context: ExecutorContext): string;
|
|
11
11
|
export declare function loadViteDynamicImport(): Promise<typeof import("vite")>;
|
|
12
|
-
export declare function loadVitestDynamicImport(): Promise<typeof import("vitest/node")>;
|
|
13
|
-
//# sourceMappingURL=executor-utils.d.ts.map
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validateTypes = validateTypes;
|
|
4
4
|
exports.createBuildableTsConfig = createBuildableTsConfig;
|
|
5
5
|
exports.loadViteDynamicImport = loadViteDynamicImport;
|
|
6
|
-
exports.loadVitestDynamicImport = loadVitestDynamicImport;
|
|
7
6
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
9
8
|
const options_utils_1 = require("./options-utils");
|
|
10
9
|
const node_child_process_1 = require("node:child_process");
|
|
11
10
|
const js_1 = require("@nx/js");
|
|
@@ -37,13 +36,13 @@ function createBuildableTsConfig(projectRoot, options, context) {
|
|
|
37
36
|
const tsConfig = options.tsConfig ?? (0, options_utils_1.getProjectTsConfigPath)(projectRoot);
|
|
38
37
|
options['buildLibsFromSource'] ??= true;
|
|
39
38
|
if (!options['buildLibsFromSource']) {
|
|
40
|
-
const { dependencies } = (0,
|
|
39
|
+
const { dependencies } = (0, internal_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName,
|
|
41
40
|
// When using incremental building and the serve target is called
|
|
42
41
|
// we need to get the deps for the 'build' target instead.
|
|
43
42
|
context.targetName === 'serve' ? 'build' : context.targetName, context.configurationName);
|
|
44
43
|
// This tsconfig is used via the Vite ts paths plugin.
|
|
45
44
|
// It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).
|
|
46
|
-
const tmpTsConfigPath = (0,
|
|
45
|
+
const tmpTsConfigPath = (0, internal_1.createTmpTsConfig)(tsConfig, context.root, projectRoot, dependencies);
|
|
47
46
|
process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;
|
|
48
47
|
return tmpTsConfigPath;
|
|
49
48
|
}
|
|
@@ -52,6 +51,3 @@ function createBuildableTsConfig(projectRoot, options, context) {
|
|
|
52
51
|
function loadViteDynamicImport() {
|
|
53
52
|
return Function('return import("vite")')();
|
|
54
53
|
}
|
|
55
|
-
function loadVitestDynamicImport() {
|
|
56
|
-
return Function('return import("vitest/node")')();
|
|
57
|
-
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
2
|
import { ViteConfigurationGeneratorSchema } from '../generators/configuration/schema';
|
|
3
|
-
import { VitestGeneratorSchema } from '../generators/vitest/schema';
|
|
4
3
|
export type Target = 'build' | 'serve' | 'test' | 'preview';
|
|
5
4
|
export type TargetFlags = Partial<Record<Target, boolean>>;
|
|
6
5
|
export type UserProvidedTargetName = Partial<Record<Target, string>>;
|
|
@@ -11,7 +10,6 @@ export declare function findExistingJsBuildTargetInProject(targets: {
|
|
|
11
10
|
supported?: string;
|
|
12
11
|
unsupported?: string;
|
|
13
12
|
};
|
|
14
|
-
export declare function addOrChangeTestTarget(tree: Tree, options: VitestGeneratorSchema, hasPlugin: boolean): void;
|
|
15
13
|
export declare function addBuildTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
|
|
16
14
|
export declare function addServeTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
|
|
17
15
|
/**
|
|
@@ -31,7 +29,7 @@ export interface ViteConfigFileOptions {
|
|
|
31
29
|
includeVitest?: boolean;
|
|
32
30
|
inSourceTests?: boolean;
|
|
33
31
|
testEnvironment?: 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' | string;
|
|
34
|
-
|
|
32
|
+
rolldownOptionsExternal?: string[];
|
|
35
33
|
imports?: string[];
|
|
36
34
|
plugins?: string[];
|
|
37
35
|
coverageProvider?: 'v8' | 'istanbul' | 'custom';
|
|
@@ -45,4 +43,3 @@ export declare function normalizeViteConfigFilePathWithTree(tree: Tree, projectR
|
|
|
45
43
|
export declare function getViteConfigPathForProject(tree: Tree, projectName: string, target?: string): string;
|
|
46
44
|
export declare function handleUnsupportedUserProvidedTargets(userProvidedTargetIsUnsupported: TargetFlags, userProvidedTargetName: UserProvidedTargetName, validFoundTargetName: ValidFoundTargetName): Promise<void>;
|
|
47
45
|
export declare function handleUnknownConfiguration(projectName: string): Promise<void>;
|
|
48
|
-
//# sourceMappingURL=generator-utils.d.ts.map
|