@nx/vite 23.0.0-beta.12 → 23.0.0-beta.13
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/package.json +5 -5
- package/plugins/nx-copy-assets.plugin.d.ts +1 -1
- package/plugins/nx-copy-assets.plugin.d.ts.map +1 -1
- package/plugins/nx-copy-assets.plugin.js +2 -2
- package/plugins/nx-tsconfig-paths.plugin.js +7 -8
- package/src/executors/build/build.impl.js +2 -2
- package/src/generators/configuration/configuration.js +6 -7
- package/src/generators/configuration/lib/convert-non-vite.js +2 -2
- package/src/generators/init/lib/utils.js +13 -13
- package/src/migrations/update-22-2-0/migrate-vitest-to-vitest-package.js +28 -12
- package/src/plugins/plugin.js +3 -5
- package/src/utils/e2e-web-server-info-utils.d.ts.map +1 -1
- package/src/utils/e2e-web-server-info-utils.js +6 -7
- package/src/utils/executor-utils.js +3 -3
- package/src/utils/generator-utils.js +4 -4
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.13",
|
|
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.13",
|
|
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.13",
|
|
38
|
+
"@nx/vitest": "23.0.0-beta.13",
|
|
39
39
|
"picomatch": "4.0.4",
|
|
40
40
|
"tsconfig-paths": "^4.1.2",
|
|
41
41
|
"semver": "^7.6.3",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ajv": "^8.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"nx": "23.0.0-beta.
|
|
46
|
+
"nx": "23.0.0-beta.13"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
import { AssetGlob } from '@nx/js/
|
|
2
|
+
import { AssetGlob } from '@nx/js/internal';
|
|
3
3
|
export declare function nxCopyAssetsPlugin(_assets: (string | AssetGlob)[]): Plugin;
|
|
4
4
|
//# sourceMappingURL=nx-copy-assets.plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-copy-assets.plugin.d.ts","sourceRoot":"","sources":["../../../../packages/vite/plugins/nx-copy-assets.plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAEnD,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"nx-copy-assets.plugin.d.ts","sourceRoot":"","sources":["../../../../packages/vite/plugins/nx-copy-assets.plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAqB,MAAM,iBAAiB,CAAC;AAC/D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CA2C1E"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.nxCopyAssetsPlugin = nxCopyAssetsPlugin;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
function nxCopyAssetsPlugin(_assets) {
|
|
8
8
|
let config;
|
|
9
9
|
let handler;
|
|
@@ -28,7 +28,7 @@ function nxCopyAssetsPlugin(_assets) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
handler = new
|
|
31
|
+
handler = new internal_1.CopyAssetsHandler({
|
|
32
32
|
rootDir: devkit_1.workspaceRoot,
|
|
33
33
|
projectDir: config.root,
|
|
34
34
|
outputDir: config.build.outDir.startsWith(config.root)
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nxViteTsPaths = nxViteTsPaths;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
|
+
const js_1 = require("@nx/js");
|
|
8
7
|
const node_fs_1 = require("node:fs");
|
|
9
8
|
const node_path_1 = require("node:path");
|
|
10
9
|
const tsconfig_paths_1 = require("tsconfig-paths");
|
|
@@ -58,7 +57,7 @@ function nxViteTsPaths(options = {}) {
|
|
|
58
57
|
process.env.NX_TASK_TARGET_TARGET === 'test'
|
|
59
58
|
? 'build'
|
|
60
59
|
: process.env.NX_TASK_TARGET_TARGET;
|
|
61
|
-
const { dependencies } = (0,
|
|
60
|
+
const { dependencies } = (0, internal_1.calculateProjectBuildableDependencies)(undefined, projectGraph, devkit_1.workspaceRoot, process.env.NX_TASK_TARGET_PROJECT, depsBuildTarget, process.env.NX_TASK_TARGET_CONFIGURATION);
|
|
62
61
|
if (process.env.NX_GENERATED_TSCONFIG_PATH) {
|
|
63
62
|
// This is needed for vitest browser mode because it runs two vite dev servers
|
|
64
63
|
// so we want to reuse the same tsconfig file for both servers
|
|
@@ -67,7 +66,7 @@ function nxViteTsPaths(options = {}) {
|
|
|
67
66
|
else {
|
|
68
67
|
// This tsconfig is used via the Vite ts paths plugin.
|
|
69
68
|
// It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).
|
|
70
|
-
foundTsConfigPath = (0,
|
|
69
|
+
foundTsConfigPath = (0, internal_1.createTmpTsConfig)(foundTsConfigPath, devkit_1.workspaceRoot, (0, node_path_1.relative)(devkit_1.workspaceRoot, projectRoot), dependencies, true);
|
|
71
70
|
process.env.NX_GENERATED_TSCONFIG_PATH = foundTsConfigPath;
|
|
72
71
|
}
|
|
73
72
|
if (config.command === 'serve') {
|
|
@@ -85,13 +84,13 @@ function nxViteTsPaths(options = {}) {
|
|
|
85
84
|
throw new Error(`Failed loading tsconfig at ${foundTsConfigPath}`);
|
|
86
85
|
}
|
|
87
86
|
tsConfigPathsEsm = parsed;
|
|
88
|
-
matchTsPathEsm = (0, tsconfig_paths_1.createMatchPath)((0,
|
|
87
|
+
matchTsPathEsm = (0, tsconfig_paths_1.createMatchPath)((0, js_1.resolvePathsBaseUrl)(foundTsConfigPath), parsed.paths, options.mainFields);
|
|
89
88
|
const rootLevelTsConfig = getTsConfig((0, node_path_1.join)(devkit_1.workspaceRoot, 'tsconfig.base.json'));
|
|
90
89
|
const rootLevelParsed = (0, tsconfig_paths_1.loadConfig)(rootLevelTsConfig);
|
|
91
90
|
logIt('fallback parsed tsconfig: ', rootLevelParsed);
|
|
92
91
|
if (rootLevelParsed.resultType === 'success') {
|
|
93
92
|
tsConfigPathsFallback = rootLevelParsed;
|
|
94
|
-
matchTsPathFallback = (0, tsconfig_paths_1.createMatchPath)((0,
|
|
93
|
+
matchTsPathFallback = (0, tsconfig_paths_1.createMatchPath)((0, js_1.resolvePathsBaseUrl)(rootLevelTsConfig), rootLevelParsed.paths, ['main', 'module']);
|
|
95
94
|
}
|
|
96
95
|
},
|
|
97
96
|
resolveId(importPath) {
|
|
@@ -129,7 +128,7 @@ function nxViteTsPaths(options = {}) {
|
|
|
129
128
|
return resolvedFile || null;
|
|
130
129
|
},
|
|
131
130
|
async writeBundle(options) {
|
|
132
|
-
if ((0,
|
|
131
|
+
if ((0, internal_1.isUsingTsSolutionSetup)())
|
|
133
132
|
return;
|
|
134
133
|
const outDir = options.dir || 'dist';
|
|
135
134
|
const src = (0, node_path_1.resolve)(projectRoot, 'package.json');
|
|
@@ -43,7 +43,7 @@ const fs_1 = require("fs");
|
|
|
43
43
|
const path_1 = require("path");
|
|
44
44
|
const executor_utils_1 = require("../../utils/executor-utils");
|
|
45
45
|
const deprecation_1 = require("../../utils/deprecation");
|
|
46
|
-
const
|
|
46
|
+
const internal_2 = require("@nx/js/internal");
|
|
47
47
|
async function* viteBuildExecutor(options, context) {
|
|
48
48
|
(0, deprecation_1.warnViteBuildExecutorDeprecation)();
|
|
49
49
|
process.env.VITE_CJS_IGNORE_WARNING = 'true';
|
|
@@ -76,7 +76,7 @@ async function* viteBuildExecutor(options, context) {
|
|
|
76
76
|
...otherOptions,
|
|
77
77
|
});
|
|
78
78
|
// New TS Solution already has a typecheck target
|
|
79
|
-
if (!options.skipTypeCheck && !(0,
|
|
79
|
+
if (!options.skipTypeCheck && !(0, internal_2.isUsingTsSolutionSetup)()) {
|
|
80
80
|
await (0, executor_utils_1.validateTypes)({
|
|
81
81
|
workspaceRoot: context.root,
|
|
82
82
|
tsconfig: tsConfigForBuild,
|
|
@@ -5,8 +5,7 @@ exports.viteConfigurationGeneratorInternal = viteConfigurationGeneratorInternal;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
10
9
|
const posix_1 = require("node:path/posix");
|
|
11
10
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
12
11
|
const deprecation_1 = require("../../utils/deprecation");
|
|
@@ -24,7 +23,7 @@ async function viteConfigurationGeneratorInternal(tree, schema) {
|
|
|
24
23
|
const tasks = [];
|
|
25
24
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
|
|
26
25
|
const { targets, root: projectRoot } = projectConfig;
|
|
27
|
-
const projectType = (0,
|
|
26
|
+
const projectType = (0, internal_1.getProjectType)(tree, projectConfig.root, schema.projectType ?? projectConfig.projectType);
|
|
28
27
|
schema.includeLib ??= projectType === 'library';
|
|
29
28
|
// Setting default to jsdom since it is the most common use case (React, Web).
|
|
30
29
|
// The @nx/js:lib generator specifically sets this to node to be more generic.
|
|
@@ -133,7 +132,7 @@ async function viteConfigurationGeneratorInternal(tree, schema) {
|
|
|
133
132
|
});
|
|
134
133
|
tasks.push(vitestTask);
|
|
135
134
|
}
|
|
136
|
-
if ((0,
|
|
135
|
+
if ((0, internal_1.isUsingTsSolutionSetup)(tree)) {
|
|
137
136
|
updatePackageJson(tree, schema, projectType);
|
|
138
137
|
}
|
|
139
138
|
if (!schema.skipFormat) {
|
|
@@ -151,10 +150,10 @@ function updatePackageJson(tree, options, projectType) {
|
|
|
151
150
|
}
|
|
152
151
|
else {
|
|
153
152
|
packageJson = {
|
|
154
|
-
name: (0,
|
|
153
|
+
name: (0, internal_1.getImportPath)(tree, options.project),
|
|
155
154
|
version: '0.0.1',
|
|
156
155
|
};
|
|
157
|
-
if ((0,
|
|
156
|
+
if ((0, internal_1.getProjectType)(tree, project.root, projectType) === 'application') {
|
|
158
157
|
packageJson.private = true;
|
|
159
158
|
}
|
|
160
159
|
}
|
|
@@ -173,7 +172,7 @@ function updatePackageJson(tree, options, projectType) {
|
|
|
173
172
|
generateExportsField: true,
|
|
174
173
|
packageJsonPath,
|
|
175
174
|
format: ['esm'],
|
|
176
|
-
developmentConditionName: (0,
|
|
175
|
+
developmentConditionName: (0, internal_1.getDefinedCustomConditionName)(tree),
|
|
177
176
|
});
|
|
178
177
|
}
|
|
179
178
|
(0, devkit_1.writeJson)(tree, packageJsonPath, packageJson);
|
|
@@ -4,14 +4,14 @@ exports.convertNonVite = convertNonVite;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const find_vite_config_1 = require("../../../utils/find-vite-config");
|
|
6
6
|
const generator_utils_1 = require("../../../utils/generator-utils");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
async function convertNonVite(tree, schema, projectRoot, _projectType, targets) {
|
|
9
9
|
// Check if it has vite
|
|
10
10
|
const hasViteConfig = (0, find_vite_config_1.findViteConfig)(tree, projectRoot);
|
|
11
11
|
const hasIndexHtmlAtRoot = tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'index.html'));
|
|
12
12
|
// Check if it has webpack
|
|
13
13
|
const hasWebpackConfig = (0, find_vite_config_1.findWebpackConfig)(tree, projectRoot);
|
|
14
|
-
const projectType = (0,
|
|
14
|
+
const projectType = (0, internal_1.getProjectType)(tree, projectRoot, _projectType);
|
|
15
15
|
if (hasWebpackConfig) {
|
|
16
16
|
if (projectType === 'application') {
|
|
17
17
|
(0, generator_utils_1.moveAndEditIndexHtml)(tree, schema);
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.checkDependenciesInstalled = checkDependenciesInstalled;
|
|
4
4
|
exports.moveToDevDependencies = moveToDevDependencies;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
const semver_1 = require("semver");
|
|
8
|
-
const
|
|
8
|
+
const versions_1 = require("../../../utils/versions");
|
|
9
9
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
10
10
|
function hasIncompatibleInstalledEsbuild(host) {
|
|
11
11
|
const installedEsbuildVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(host, 'esbuild');
|
|
@@ -13,7 +13,7 @@ function hasIncompatibleInstalledEsbuild(host) {
|
|
|
13
13
|
return false;
|
|
14
14
|
}
|
|
15
15
|
try {
|
|
16
|
-
return !(0, semver_1.intersects)(installedEsbuildVersion,
|
|
16
|
+
return !(0, semver_1.intersects)(installedEsbuildVersion, internal_1.esbuildVersion, {
|
|
17
17
|
includePrerelease: true,
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -35,28 +35,28 @@ async function checkDependenciesInstalled(host, schema) {
|
|
|
35
35
|
title: 'Installed esbuild is incompatible with Vite 8. Using Vite 7.',
|
|
36
36
|
bodyLines: [
|
|
37
37
|
`Found esbuild version "${installedEsbuildVersion}" in the workspace root package.json.`,
|
|
38
|
-
`Update esbuild to a range compatible with ${
|
|
38
|
+
`Update esbuild to a range compatible with ${internal_1.esbuildVersion} if you want newly generated Vite projects to use Vite 8 by default.`,
|
|
39
39
|
],
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
const viteVersionToInstall = schema.useViteV5
|
|
43
|
-
?
|
|
43
|
+
? versions_1.viteV5Version
|
|
44
44
|
: schema.useViteV6
|
|
45
|
-
?
|
|
45
|
+
? versions_1.viteV6Version
|
|
46
46
|
: schema.useViteV7 ||
|
|
47
47
|
installedMajor === 7 ||
|
|
48
48
|
useViteV7ForEsbuildCompatibility
|
|
49
|
-
?
|
|
49
|
+
? versions_1.viteV7Version
|
|
50
50
|
: installedMajor === 6
|
|
51
|
-
?
|
|
51
|
+
? versions_1.viteV6Version
|
|
52
52
|
: installedMajor === 5
|
|
53
|
-
?
|
|
54
|
-
:
|
|
53
|
+
? versions_1.viteV5Version
|
|
54
|
+
: versions_1.viteVersion;
|
|
55
55
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
56
|
-
'@nx/vite':
|
|
57
|
-
'@nx/web':
|
|
56
|
+
'@nx/vite': versions_1.nxVersion,
|
|
57
|
+
'@nx/web': versions_1.nxVersion,
|
|
58
58
|
vite: viteVersionToInstall,
|
|
59
|
-
jiti:
|
|
59
|
+
jiti: versions_1.jitiVersion,
|
|
60
60
|
}, undefined, schema.keepExistingVersions);
|
|
61
61
|
}
|
|
62
62
|
function moveToDevDependencies(tree) {
|
|
@@ -119,19 +119,35 @@ function migrateTargetDefaults(tree) {
|
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
let hasChanges = false;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
if (Array.isArray(nxJson.targetDefaults)) {
|
|
123
|
+
for (const entry of nxJson.targetDefaults) {
|
|
124
|
+
// Pattern A: an executor entry for @nx/vite:test
|
|
125
|
+
if (entry.executor === '@nx/vite:test' && entry.target === undefined) {
|
|
126
|
+
entry.executor = '@nx/vitest:test';
|
|
127
|
+
hasChanges = true;
|
|
128
|
+
}
|
|
129
|
+
// Pattern B: a target entry whose executor field references @nx/vite:test
|
|
130
|
+
else if (entry.executor === '@nx/vite:test') {
|
|
131
|
+
entry.executor = '@nx/vitest:test';
|
|
132
|
+
hasChanges = true;
|
|
133
|
+
}
|
|
130
134
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
for (const [targetOrExecutor, targetConfig] of Object.entries(nxJson.targetDefaults)) {
|
|
138
|
+
// Pattern A: Executor-keyed (e.g., "@nx/vite:test": { ... })
|
|
139
|
+
if (targetOrExecutor === '@nx/vite:test') {
|
|
140
|
+
// Move config to new executor key
|
|
141
|
+
nxJson.targetDefaults['@nx/vitest:test'] ??= {};
|
|
142
|
+
Object.assign(nxJson.targetDefaults['@nx/vitest:test'], targetConfig);
|
|
143
|
+
delete nxJson.targetDefaults['@nx/vite:test'];
|
|
144
|
+
hasChanges = true;
|
|
145
|
+
}
|
|
146
|
+
// Pattern B: Target-name-keyed (e.g., "test": { "executor": "@nx/vite:test", ... })
|
|
147
|
+
else if (targetConfig.executor === '@nx/vite:test') {
|
|
148
|
+
targetConfig.executor = '@nx/vitest:test';
|
|
149
|
+
hasChanges = true;
|
|
150
|
+
}
|
|
135
151
|
}
|
|
136
152
|
}
|
|
137
153
|
if (hasChanges) {
|
package/src/plugins/plugin.js
CHANGED
|
@@ -4,9 +4,7 @@ exports.createNodesV2 = exports.createNodes = exports.createDependencies = void
|
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const internal_2 = require("@nx/js/
|
|
8
|
-
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
10
8
|
const node_fs_1 = require("node:fs");
|
|
11
9
|
const node_path_1 = require("node:path");
|
|
12
10
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
@@ -28,7 +26,7 @@ exports.createNodes = [
|
|
|
28
26
|
const normalizedOptions = normalizeOptions(options);
|
|
29
27
|
const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `vite-${optionsHash}.hash`);
|
|
30
28
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
31
|
-
const isUsingTsSolutionSetup = (0,
|
|
29
|
+
const isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
32
30
|
const { roots: projectRoots, configFiles: validConfigFiles } = configFilePaths.reduce((acc, configFile) => {
|
|
33
31
|
const potentialRoot = (0, node_path_1.dirname)(configFile);
|
|
34
32
|
if (checkIfConfigFileShouldBeProject(potentialRoot, context)) {
|
|
@@ -191,7 +189,7 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
|
|
|
191
189
|
];
|
|
192
190
|
}
|
|
193
191
|
}
|
|
194
|
-
(0,
|
|
192
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
195
193
|
return {
|
|
196
194
|
targets,
|
|
197
195
|
metadata,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e-web-server-info-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/e2e-web-server-info-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"e2e-web-server-info-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/e2e-web-server-info-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AAMnD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,CAAC,EAAE,MAAM,EACxB,iBAAiB,CAAC,EAAE,MAAM,8DA+B3B;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,CAAC,EAAE,MAAM,EACxB,iBAAiB,CAAC,EAAE,MAAM,8DAsB3B"}
|
|
@@ -7,13 +7,12 @@ 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
17
|
return (0, internal_1.getE2EWebServerInfo)(tree, projectName, {
|
|
19
18
|
plugin: '@nx/vite/plugin',
|
|
@@ -4,7 +4,7 @@ exports.validateTypes = validateTypes;
|
|
|
4
4
|
exports.createBuildableTsConfig = createBuildableTsConfig;
|
|
5
5
|
exports.loadViteDynamicImport = loadViteDynamicImport;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
const options_utils_1 = require("./options-utils");
|
|
9
9
|
const node_child_process_1 = require("node:child_process");
|
|
10
10
|
const js_1 = require("@nx/js");
|
|
@@ -36,13 +36,13 @@ function createBuildableTsConfig(projectRoot, options, context) {
|
|
|
36
36
|
const tsConfig = options.tsConfig ?? (0, options_utils_1.getProjectTsConfigPath)(projectRoot);
|
|
37
37
|
options['buildLibsFromSource'] ??= true;
|
|
38
38
|
if (!options['buildLibsFromSource']) {
|
|
39
|
-
const { dependencies } = (0,
|
|
39
|
+
const { dependencies } = (0, internal_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName,
|
|
40
40
|
// When using incremental building and the serve target is called
|
|
41
41
|
// we need to get the deps for the 'build' target instead.
|
|
42
42
|
context.targetName === 'serve' ? 'build' : context.targetName, context.configurationName);
|
|
43
43
|
// This tsconfig is used via the Vite ts paths plugin.
|
|
44
44
|
// It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).
|
|
45
|
-
const tmpTsConfigPath = (0,
|
|
45
|
+
const tmpTsConfigPath = (0, internal_1.createTmpTsConfig)(tsConfig, context.root, projectRoot, dependencies);
|
|
46
46
|
process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;
|
|
47
47
|
return tmpTsConfigPath;
|
|
48
48
|
}
|
|
@@ -14,7 +14,7 @@ exports.handleUnsupportedUserProvidedTargets = handleUnsupportedUserProvidedTarg
|
|
|
14
14
|
exports.handleUnknownConfiguration = handleUnknownConfiguration;
|
|
15
15
|
const internal_1 = require("@nx/devkit/internal");
|
|
16
16
|
const devkit_1 = require("@nx/devkit");
|
|
17
|
-
const
|
|
17
|
+
const internal_2 = require("@nx/js/internal");
|
|
18
18
|
const vite_config_edit_utils_1 = require("./vite-config-edit-utils");
|
|
19
19
|
function findExistingJsBuildTargetInProject(targets) {
|
|
20
20
|
const output = {};
|
|
@@ -66,7 +66,7 @@ function findExistingJsBuildTargetInProject(targets) {
|
|
|
66
66
|
function addBuildTarget(tree, options, target) {
|
|
67
67
|
(0, internal_1.addBuildTargetDefaults)(tree, '@nx/vite:build');
|
|
68
68
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
69
|
-
const isTsSolutionSetup = (0,
|
|
69
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
70
70
|
const buildOptions = {
|
|
71
71
|
outputPath: isTsSolutionSetup
|
|
72
72
|
? (0, devkit_1.joinPathFragments)(project.root, 'dist')
|
|
@@ -153,7 +153,7 @@ function addPreviewTarget(tree, options, serveTarget) {
|
|
|
153
153
|
function editTsConfig(tree, options) {
|
|
154
154
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
155
155
|
let tsconfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
|
|
156
|
-
const isTsSolutionSetup = (0,
|
|
156
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
157
157
|
if (isTsSolutionSetup) {
|
|
158
158
|
tsconfigPath = [
|
|
159
159
|
(0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.app.json'),
|
|
@@ -244,7 +244,7 @@ function createOrEditViteConfig(tree, options, onlyVitest, projectAlreadyHasVite
|
|
|
244
244
|
const viteConfigPath = vitestFileName
|
|
245
245
|
? `${projectRoot}/vitest.config.${extension}`
|
|
246
246
|
: `${projectRoot}/vite.config.${extension}`;
|
|
247
|
-
const isTsSolutionSetup = (0,
|
|
247
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
248
248
|
const buildOutDir = isTsSolutionSetup
|
|
249
249
|
? './dist'
|
|
250
250
|
: projectRoot === '.'
|