@nx/vite 23.0.0-beta.8 → 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/src/plugins/plugin.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
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;
|
|
37
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
@@ -44,7 +11,6 @@ const node_fs_1 = require("node:fs");
|
|
|
44
11
|
const node_path_1 = require("node:path");
|
|
45
12
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
46
13
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
47
|
-
const plugins_1 = require("nx/src/utils/plugins");
|
|
48
14
|
const executor_utils_1 = require("../utils/executor-utils");
|
|
49
15
|
const picomatch = require("picomatch");
|
|
50
16
|
/**
|
|
@@ -54,9 +20,9 @@ const createDependencies = () => {
|
|
|
54
20
|
return [];
|
|
55
21
|
};
|
|
56
22
|
exports.createDependencies = createDependencies;
|
|
57
|
-
const
|
|
23
|
+
const viteConfigGlob = '**/vite.config.{js,ts,mjs,mts,cjs,cts}';
|
|
58
24
|
exports.createNodes = [
|
|
59
|
-
|
|
25
|
+
viteConfigGlob,
|
|
60
26
|
async (configFilePaths, options, context) => {
|
|
61
27
|
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
62
28
|
const normalizedOptions = normalizeOptions(options);
|
|
@@ -94,10 +60,6 @@ exports.createNodes = [
|
|
|
94
60
|
parts[1] === 'config' &&
|
|
95
61
|
parts.length > 2);
|
|
96
62
|
});
|
|
97
|
-
// results from vitest.config.js will be different from results of vite.config.js
|
|
98
|
-
// but the hash will be the same because it is based on the files under the project root.
|
|
99
|
-
// Adding the config file path to the hash ensures that the final hash value is different
|
|
100
|
-
// for different config files.
|
|
101
63
|
const hash = hashes[idx] + configFile;
|
|
102
64
|
if (!targetsCache.has(hash)) {
|
|
103
65
|
targetsCache.set(hash, await buildViteTargets(configFile, projectRoot, normalizedOptions, tsConfigFiles, hasReactRouterConfig, isUsingTsSolutionSetup, context, pmc, tsconfigChainsByProjectRoot.get(projectRoot) ?? []));
|
|
@@ -149,115 +111,23 @@ async function buildViteTargets(configFilePath, projectRoot, options, tsConfigFi
|
|
|
149
111
|
catch {
|
|
150
112
|
// Plugin not installed or not needed, ignore
|
|
151
113
|
}
|
|
152
|
-
// Workaround for race condition with vitest/node on Node 24+
|
|
153
|
-
// When multiple vitest.config files are processed in parallel, Node can throw:
|
|
154
|
-
// Error [ERR_INTERNAL_ASSERTION]: Cannot require() ES Module vitest/dist/node.js
|
|
155
|
-
// because it is not yet fully loaded.
|
|
156
|
-
// See: https://github.com/nrwl/nx/issues/34028
|
|
157
|
-
try {
|
|
158
|
-
const importVitestNode = () => new Function('return import("vitest/node")')();
|
|
159
|
-
await importVitestNode();
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
// vitest/node not available or not needed, ignore
|
|
163
|
-
}
|
|
164
114
|
const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
|
|
165
115
|
const viteBuildConfig = await resolveConfig({
|
|
166
116
|
configFile: absoluteConfigFilePath,
|
|
167
117
|
mode: 'development',
|
|
168
118
|
root: projectRoot,
|
|
169
119
|
}, 'build');
|
|
170
|
-
|
|
171
|
-
const { buildOutputs,
|
|
120
|
+
const metadata = {};
|
|
121
|
+
const { buildOutputs, isBuildable, hasServeConfig } = getOutputs(viteBuildConfig, projectRoot, context.workspaceRoot);
|
|
172
122
|
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
173
123
|
const targets = {};
|
|
174
|
-
// if file is vitest.config or vite.config has definition for test, create targets for test and/or atomized tests
|
|
175
|
-
if (configFilePath.includes('vitest.config') || hasTest) {
|
|
176
|
-
const isTypecheckEnabled = !!viteBuildConfig?.test?.typecheck
|
|
177
|
-
?.enabled;
|
|
178
|
-
targets[options.testTargetName] = await testTarget(namedInputs, testOutputs, projectRoot, pmc, isTypecheckEnabled, tsconfigInputs);
|
|
179
|
-
if (options.ciTargetName) {
|
|
180
|
-
const groupName = options.ciGroupName ?? (0, plugins_1.deriveGroupNameFromTarget)(options.ciTargetName);
|
|
181
|
-
const targetGroup = [];
|
|
182
|
-
const dependsOn = [];
|
|
183
|
-
metadata = {
|
|
184
|
-
targetGroups: {
|
|
185
|
-
[groupName]: targetGroup,
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
const projectRootRelativeTestPaths = await getTestPathsRelativeToProjectRoot(projectRoot, context.workspaceRoot);
|
|
189
|
-
for (const relativePath of projectRootRelativeTestPaths) {
|
|
190
|
-
if (relativePath.includes('../')) {
|
|
191
|
-
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' +
|
|
192
|
-
`\n\n${JSON.stringify({
|
|
193
|
-
projectRoot,
|
|
194
|
-
relativePath,
|
|
195
|
-
projectRootRelativeTestPaths,
|
|
196
|
-
context,
|
|
197
|
-
}, null, 2)}`);
|
|
198
|
-
}
|
|
199
|
-
const targetName = `${options.ciTargetName}--${relativePath}`;
|
|
200
|
-
dependsOn.push(targetName);
|
|
201
|
-
targets[targetName] = {
|
|
202
|
-
// It does not make sense to run atomized tests in watch mode as they are intended to be run in CI
|
|
203
|
-
command: `vitest run ${relativePath}`,
|
|
204
|
-
cache: targets[options.testTargetName].cache,
|
|
205
|
-
inputs: targets[options.testTargetName].inputs,
|
|
206
|
-
outputs: targets[options.testTargetName].outputs,
|
|
207
|
-
options: {
|
|
208
|
-
cwd: projectRoot,
|
|
209
|
-
env: targets[options.testTargetName].options.env,
|
|
210
|
-
},
|
|
211
|
-
metadata: {
|
|
212
|
-
technologies: ['vitest'],
|
|
213
|
-
description: `Run Vitest Tests in ${relativePath}`,
|
|
214
|
-
help: {
|
|
215
|
-
command: `${pmc.exec} vitest --help`,
|
|
216
|
-
example: {
|
|
217
|
-
options: {
|
|
218
|
-
coverage: true,
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
targetGroup.push(targetName);
|
|
225
|
-
}
|
|
226
|
-
if (targetGroup.length > 0) {
|
|
227
|
-
targets[options.ciTargetName] = {
|
|
228
|
-
executor: 'nx:noop',
|
|
229
|
-
cache: true,
|
|
230
|
-
inputs: targets[options.testTargetName].inputs,
|
|
231
|
-
outputs: targets[options.testTargetName].outputs,
|
|
232
|
-
dependsOn,
|
|
233
|
-
metadata: {
|
|
234
|
-
technologies: ['vitest'],
|
|
235
|
-
description: 'Run Vitest Tests in CI',
|
|
236
|
-
nonAtomizedTarget: options.testTargetName,
|
|
237
|
-
help: {
|
|
238
|
-
command: `${pmc.exec} vitest --help`,
|
|
239
|
-
example: {
|
|
240
|
-
options: {
|
|
241
|
-
coverage: true,
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
};
|
|
247
|
-
targetGroup.unshift(options.ciTargetName);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
124
|
if (hasReactRouterConfig) {
|
|
252
125
|
// If we have a react-router config, we can skip the rest of the targets
|
|
253
126
|
return { targets, metadata: {}, projectType: 'application' };
|
|
254
127
|
}
|
|
255
|
-
// If file is not vitest.config and buildable, create targets for build, serve, preview and serve-static
|
|
256
128
|
const hasRemixPlugin = viteBuildConfig.plugins &&
|
|
257
129
|
viteBuildConfig.plugins.some((p) => p.name === 'remix');
|
|
258
|
-
if (!
|
|
259
|
-
!hasRemixPlugin &&
|
|
260
|
-
isBuildable) {
|
|
130
|
+
if (!hasRemixPlugin && isBuildable) {
|
|
261
131
|
targets[options.buildTargetName] = await buildTarget(options.buildTargetName, namedInputs, buildOutputs, projectRoot, isUsingTsSolutionSetup, pmc);
|
|
262
132
|
// If running in library mode, then there is nothing to serve.
|
|
263
133
|
if (!viteBuildConfig.build?.lib || hasServeConfig) {
|
|
@@ -410,42 +280,6 @@ function previewTarget(projectRoot, buildTargetName, pmc) {
|
|
|
410
280
|
};
|
|
411
281
|
return targetConfig;
|
|
412
282
|
}
|
|
413
|
-
async function testTarget(namedInputs, outputs, projectRoot, pmc, isTypecheckEnabled, tsconfigInputs) {
|
|
414
|
-
const depOutputsGlob = isTypecheckEnabled ? '**/*.{js,d.ts}' : '**/*.js';
|
|
415
|
-
return {
|
|
416
|
-
command: `vitest`,
|
|
417
|
-
options: { cwd: (0, devkit_1.joinPathFragments)(projectRoot) },
|
|
418
|
-
cache: true,
|
|
419
|
-
inputs: [
|
|
420
|
-
...('production' in namedInputs
|
|
421
|
-
? ['default', '^production']
|
|
422
|
-
: ['default', '^default']),
|
|
423
|
-
...tsconfigInputs.map((f) => ({
|
|
424
|
-
json: `{workspaceRoot}/${f}`,
|
|
425
|
-
fields: ['compilerOptions'],
|
|
426
|
-
})),
|
|
427
|
-
{
|
|
428
|
-
externalDependencies: ['vitest'],
|
|
429
|
-
},
|
|
430
|
-
{ env: 'CI' },
|
|
431
|
-
{ dependentTasksOutputFiles: depOutputsGlob, transitive: true },
|
|
432
|
-
],
|
|
433
|
-
outputs,
|
|
434
|
-
metadata: {
|
|
435
|
-
technologies: ['vite'],
|
|
436
|
-
description: `Run Vite tests`,
|
|
437
|
-
help: {
|
|
438
|
-
command: `${pmc.exec} vitest --help`,
|
|
439
|
-
example: {
|
|
440
|
-
options: {
|
|
441
|
-
bail: 1,
|
|
442
|
-
coverage: true,
|
|
443
|
-
},
|
|
444
|
-
},
|
|
445
|
-
},
|
|
446
|
-
},
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
283
|
function serveStaticTarget(options, isUsingTsSolutionSetup) {
|
|
450
284
|
const targetConfig = {
|
|
451
285
|
continuous: true,
|
|
@@ -464,8 +298,8 @@ function getOutputs(viteBuildConfig, projectRoot, workspaceRoot) {
|
|
|
464
298
|
// TODO(jack): Remove this cast when @nx/vite switches to moduleResolution:
|
|
465
299
|
// "nodenext". Vite 8's rolldown types are ESM-only (.d.mts) and not
|
|
466
300
|
// resolvable under moduleResolution: "node", which breaks rolldownOptions
|
|
467
|
-
//
|
|
468
|
-
const { build,
|
|
301
|
+
// on ResolvedConfig.
|
|
302
|
+
const { build, server } = viteBuildConfig;
|
|
469
303
|
const buildOutputPath = normalizeOutputPath(build?.outDir, projectRoot, workspaceRoot, 'dist');
|
|
470
304
|
const isBuildable = Boolean(build?.lib ||
|
|
471
305
|
viteBuildConfig?.builder?.buildApp ||
|
|
@@ -473,11 +307,8 @@ function getOutputs(viteBuildConfig, projectRoot, workspaceRoot) {
|
|
|
473
307
|
build?.rolldownOptions?.input || // Vite >=8
|
|
474
308
|
(0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRoot, projectRoot, 'index.html')));
|
|
475
309
|
const hasServeConfig = Boolean(server?.host || server?.port);
|
|
476
|
-
const reportsDirectoryPath = normalizeOutputPath(test?.coverage?.reportsDirectory, projectRoot, workspaceRoot, 'coverage');
|
|
477
310
|
return {
|
|
478
311
|
buildOutputs: [buildOutputPath],
|
|
479
|
-
testOutputs: [reportsDirectoryPath],
|
|
480
|
-
hasTest: !!test,
|
|
481
312
|
isBuildable,
|
|
482
313
|
hasServeConfig,
|
|
483
314
|
};
|
|
@@ -511,7 +342,6 @@ function normalizeOptions(options) {
|
|
|
511
342
|
options.serveTargetName ??= 'serve';
|
|
512
343
|
options.devTargetName ??= 'dev';
|
|
513
344
|
options.previewTargetName ??= 'preview';
|
|
514
|
-
options.testTargetName ??= 'test';
|
|
515
345
|
options.serveStaticTargetName ??= 'serve-static';
|
|
516
346
|
options.typecheckTargetName ??= 'typecheck';
|
|
517
347
|
return options;
|
|
@@ -602,17 +432,3 @@ function checkIfConfigFileShouldBeProject(projectRoot, context) {
|
|
|
602
432
|
}
|
|
603
433
|
return true;
|
|
604
434
|
}
|
|
605
|
-
async function getTestPathsRelativeToProjectRoot(projectRoot, workspaceRoot) {
|
|
606
|
-
const fullProjectRoot = (0, node_path_1.join)(workspaceRoot, projectRoot);
|
|
607
|
-
const { createVitest } = await Promise.resolve().then(() => __importStar(require('vitest/node')));
|
|
608
|
-
const vitest = await createVitest('test', {
|
|
609
|
-
root: fullProjectRoot,
|
|
610
|
-
dir: fullProjectRoot,
|
|
611
|
-
filesOnly: true,
|
|
612
|
-
watch: false,
|
|
613
|
-
});
|
|
614
|
-
const relevantTestSpecifications = await vitest.getRelevantTestSpecifications();
|
|
615
|
-
return relevantTestSpecifications
|
|
616
|
-
.filter((ts) => projectRoot === '.' ? true : ts.moduleId.startsWith(fullProjectRoot))
|
|
617
|
-
.map((ts) => (0, devkit_1.normalizePath)((0, node_path_1.relative)(projectRoot, ts.moduleId)));
|
|
618
|
-
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
8
|
+
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/deprecation.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uCAAuC,4PACuM,CAAC;AAE5P,eAAO,MAAM,4CAA4C,iQACuM,CAAC;AAEjQ,eAAO,MAAM,gDAAgD,qQACuM,CAAC;AAErQ,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAED,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D;AAED,wBAAgB,wCAAwC,IAAI,IAAI,CAE/D;AAMD,wBAAgB,0BAA0B,IAAI,IAAI,CAIjD"}
|
|
@@ -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
|
+
}
|
|
@@ -3,7 +3,6 @@ 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
8
|
//# sourceMappingURL=ensure-dependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-dependencies.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/ensure-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ensure-dependencies.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/ensure-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAUpB,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,yBAAyB,GAChC,iBAAiB,CA2BnB"}
|
|
@@ -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,4 @@ 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
12
|
//# sourceMappingURL=executor-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/executor-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,YAAY,CAAC;AAUvE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BhB;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,EAC7D,OAAO,EAAE,eAAe,UA4BzB;AAED,wBAAgB,qBAAqB,IACW,OAAO,CAAC,cAAc,MAAM,CAAC,CAAC,CAC7E
|
|
1
|
+
{"version":3,"file":"executor-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/executor-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,YAAY,CAAC;AAUvE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BhB;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,EAC7D,OAAO,EAAE,eAAe,UA4BzB;AAED,wBAAgB,qBAAqB,IACW,OAAO,CAAC,cAAc,MAAM,CAAC,CAAC,CAC7E"}
|
|
@@ -3,7 +3,6 @@ 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
7
|
const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
9
8
|
const options_utils_1 = require("./options-utils");
|
|
@@ -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
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/generator-utils.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"generator-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/generator-utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findExistingJsBuildTargetInProject = findExistingJsBuildTargetInProject;
|
|
4
|
-
exports.addOrChangeTestTarget = addOrChangeTestTarget;
|
|
5
4
|
exports.addBuildTarget = addBuildTarget;
|
|
6
5
|
exports.addServeTarget = addServeTarget;
|
|
7
6
|
exports.addPreviewTarget = addPreviewTarget;
|
|
@@ -64,33 +63,6 @@ function findExistingJsBuildTargetInProject(targets) {
|
|
|
64
63
|
}
|
|
65
64
|
return output;
|
|
66
65
|
}
|
|
67
|
-
function addOrChangeTestTarget(tree, options, hasPlugin) {
|
|
68
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
69
|
-
hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
70
|
-
? p === '@nx/vite/plugin'
|
|
71
|
-
: p.plugin === '@nx/vite/plugin' || hasPlugin);
|
|
72
|
-
if (hasPlugin) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
76
|
-
const target = options.testTarget ?? 'test';
|
|
77
|
-
const reportsDirectory = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(project.root), 'coverage', project.root === '.' ? options.project : project.root);
|
|
78
|
-
const testOptions = {
|
|
79
|
-
reportsDirectory,
|
|
80
|
-
};
|
|
81
|
-
project.targets ??= {};
|
|
82
|
-
if (project.targets[target]) {
|
|
83
|
-
throw new Error(`Target "${target}" already exists in the project.`);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
project.targets[target] = {
|
|
87
|
-
executor: '@nx/vite:test',
|
|
88
|
-
outputs: ['{options.reportsDirectory}'],
|
|
89
|
-
options: testOptions,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
(0, devkit_1.updateProjectConfiguration)(tree, options.project, project);
|
|
93
|
-
}
|
|
94
66
|
function addBuildTarget(tree, options, target) {
|
|
95
67
|
(0, internal_1.addBuildTargetDefaults)(tree, '@nx/vite:build');
|
|
96
68
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/options-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAMhB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"options-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/options-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAMhB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAsBpB;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAcpB;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,OAAO,EAAE,eAAe,GACvB,MAAM,GAAG,SAAS,CAapB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,4BAA4B,EACrC,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyBlC;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,SAAS,CAO9C;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,OAG1E"}
|
|
@@ -25,9 +25,6 @@ function normalizeViteConfigFilePath(contextRoot, projectRoot, configFile) {
|
|
|
25
25
|
if ((0, fs_1.existsSync)((0, devkit_1.joinPathFragments)(contextRoot, projectRoot, `vite.config.${ext}`))) {
|
|
26
26
|
return (0, devkit_1.joinPathFragments)(contextRoot, projectRoot, `vite.config.${ext}`);
|
|
27
27
|
}
|
|
28
|
-
else if ((0, fs_1.existsSync)((0, devkit_1.joinPathFragments)(contextRoot, projectRoot, `vitest.config.${ext}`))) {
|
|
29
|
-
return (0, devkit_1.joinPathFragments)(contextRoot, projectRoot, `vitest.config.${ext}`);
|
|
30
|
-
}
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
function getProjectTsConfigPath(projectRoot) {
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import type { Tree } from 'nx/src/generators/tree';
|
|
2
|
-
type VitestDependenciesVersions = {
|
|
3
|
-
vitest: string;
|
|
4
|
-
vitestCoverageV8: string;
|
|
5
|
-
vitestCoverageIstanbul: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function getVitestDependenciesVersionsToInstall(tree: Tree): Promise<VitestDependenciesVersions>;
|
|
8
|
-
export declare function isVitestV3(tree: Tree): Promise<boolean>;
|
|
9
|
-
export declare function isVitestV2(tree: Tree): Promise<boolean>;
|
|
10
|
-
export declare function getInstalledVitestVersion(tree: Tree): string;
|
|
11
2
|
export declare function getInstalledViteVersion(tree: Tree): string | undefined;
|
|
12
3
|
export declare function getInstalledViteMajorVersion(tree: Tree): 5 | 6 | 7 | 8 | undefined;
|
|
13
|
-
export declare function getInstalledVitestVersionFromGraph(): Promise<string>;
|
|
14
|
-
export {};
|
|
15
4
|
//# sourceMappingURL=version-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/version-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/version-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAetE;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,GACT,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAW3B"}
|
|
@@ -1,62 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVitestDependenciesVersionsToInstall = getVitestDependenciesVersionsToInstall;
|
|
4
|
-
exports.isVitestV3 = isVitestV3;
|
|
5
|
-
exports.isVitestV2 = isVitestV2;
|
|
6
|
-
exports.getInstalledVitestVersion = getInstalledVitestVersion;
|
|
7
3
|
exports.getInstalledViteVersion = getInstalledViteVersion;
|
|
8
4
|
exports.getInstalledViteMajorVersion = getInstalledViteMajorVersion;
|
|
9
|
-
exports.getInstalledVitestVersionFromGraph = getInstalledVitestVersionFromGraph;
|
|
10
5
|
const devkit_1 = require("@nx/devkit");
|
|
11
6
|
const semver_1 = require("semver");
|
|
12
|
-
const versions_1 = require("./versions");
|
|
13
|
-
async function getVitestDependenciesVersionsToInstall(tree) {
|
|
14
|
-
if (await isVitestV3(tree)) {
|
|
15
|
-
return {
|
|
16
|
-
vitest: versions_1.vitestV3Version,
|
|
17
|
-
vitestCoverageV8: versions_1.vitestV3CoverageV8Version,
|
|
18
|
-
vitestCoverageIstanbul: versions_1.vitestV3CoverageIstanbulVersion,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
else if (await isVitestV2(tree)) {
|
|
22
|
-
return {
|
|
23
|
-
vitest: versions_1.vitestV2Version,
|
|
24
|
-
vitestCoverageV8: versions_1.vitestV2CoverageV8Version,
|
|
25
|
-
vitestCoverageIstanbul: versions_1.vitestV2CoverageIstanbulVersion,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// Default to latest (v4)
|
|
30
|
-
return {
|
|
31
|
-
vitest: versions_1.vitestVersion,
|
|
32
|
-
vitestCoverageV8: versions_1.vitestCoverageV8Version,
|
|
33
|
-
vitestCoverageIstanbul: versions_1.vitestCoverageIstanbulVersion,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
async function isVitestV3(tree) {
|
|
38
|
-
let installedVitestVersion = await getInstalledVitestVersionFromGraph();
|
|
39
|
-
if (!installedVitestVersion) {
|
|
40
|
-
installedVitestVersion = getInstalledVitestVersion(tree);
|
|
41
|
-
}
|
|
42
|
-
return (0, semver_1.major)(installedVitestVersion) === 3;
|
|
43
|
-
}
|
|
44
|
-
async function isVitestV2(tree) {
|
|
45
|
-
let installedVitestVersion = await getInstalledVitestVersionFromGraph();
|
|
46
|
-
if (!installedVitestVersion) {
|
|
47
|
-
installedVitestVersion = getInstalledVitestVersion(tree);
|
|
48
|
-
}
|
|
49
|
-
return (0, semver_1.major)(installedVitestVersion) === 2;
|
|
50
|
-
}
|
|
51
|
-
function getInstalledVitestVersion(tree) {
|
|
52
|
-
const installedVitestVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'vitest');
|
|
53
|
-
if (!installedVitestVersion ||
|
|
54
|
-
installedVitestVersion === 'latest' ||
|
|
55
|
-
installedVitestVersion === 'beta') {
|
|
56
|
-
return (0, semver_1.clean)(versions_1.vitestVersion) ?? (0, semver_1.coerce)(versions_1.vitestVersion).version;
|
|
57
|
-
}
|
|
58
|
-
return ((0, semver_1.clean)(installedVitestVersion) ?? (0, semver_1.coerce)(installedVitestVersion).version);
|
|
59
|
-
}
|
|
60
7
|
function getInstalledViteVersion(tree) {
|
|
61
8
|
const installedViteVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'vite');
|
|
62
9
|
if (!installedViteVersion ||
|
|
@@ -77,11 +24,3 @@ function getInstalledViteMajorVersion(tree) {
|
|
|
77
24
|
}
|
|
78
25
|
return installedMajor;
|
|
79
26
|
}
|
|
80
|
-
async function getInstalledVitestVersionFromGraph() {
|
|
81
|
-
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
|
82
|
-
const vitestDep = graph.externalNodes?.['npm:vitest'];
|
|
83
|
-
if (!vitestDep) {
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
return ((0, semver_1.clean)(vitestDep.data.version) ?? (0, semver_1.coerce)(vitestDep.data.version).version);
|
|
87
|
-
}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -3,29 +3,10 @@ export declare const viteVersion = "^8.0.0";
|
|
|
3
3
|
export declare const viteV7Version = "^7.0.0";
|
|
4
4
|
export declare const viteV6Version = "^6.0.0";
|
|
5
5
|
export declare const viteV5Version = "^5.0.0";
|
|
6
|
-
export declare const vitestV4Version = "~4.1.0";
|
|
7
|
-
export declare const vitestV3Version = "^3.0.0";
|
|
8
|
-
export declare const vitestV2Version = "^2.1.8";
|
|
9
|
-
export declare const vitestVersion = "~4.1.0";
|
|
10
|
-
export declare const vitestV1Version = "^1.3.1";
|
|
11
6
|
export declare const vitePluginReactVersion = "^6.0.0";
|
|
12
7
|
export declare const vitePluginReactV4Version = "^4.2.0";
|
|
13
8
|
export declare const vitePluginReactSwcVersion = "^4.3.0";
|
|
14
|
-
export declare const jsdomVersion = "~22.1.0";
|
|
15
9
|
export declare const vitePluginDtsVersion = "~4.5.0";
|
|
16
10
|
export declare const ajvVersion = "^8.0.0";
|
|
17
|
-
export declare const happyDomVersion = "~9.20.3";
|
|
18
|
-
export declare const edgeRuntimeVmVersion = "~3.0.2";
|
|
19
11
|
export declare const jitiVersion = "2.4.2";
|
|
20
|
-
export declare const analogVitestAngular = "~2.1.2";
|
|
21
|
-
export declare const vitestV4CoverageV8Version = "~4.1.0";
|
|
22
|
-
export declare const vitestV3CoverageV8Version = "^3.0.5";
|
|
23
|
-
export declare const vitestV2CoverageV8Version = "^2.1.8";
|
|
24
|
-
export declare const vitestCoverageV8Version = "~4.1.0";
|
|
25
|
-
export declare const vitestV4CoverageIstanbulVersion = "~4.1.0";
|
|
26
|
-
export declare const vitestV3CoverageIstanbulVersion = "^3.0.5";
|
|
27
|
-
export declare const vitestV2CoverageIstanbulVersion = "^2.1.8";
|
|
28
|
-
export declare const vitestCoverageIstanbulVersion = "~4.1.0";
|
|
29
|
-
export declare const vitestV1CoverageV8Version = "^1.0.4";
|
|
30
|
-
export declare const vitestV1CoverageIstanbulVersion = "^1.0.4";
|
|
31
12
|
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,aAAa,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/vite/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAC/C,eAAO,MAAM,wBAAwB,WAAW,CAAC;AACjD,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,WAAW,UAAU,CAAC"}
|