vite-plus 1.0.0 → 1.1.0
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/LICENSE +30 -5
- package/README.md +7 -7
- package/binding/index.cjs +54 -55
- package/binding/index.d.cts +50 -12
- package/dist/{agent-CKMI1a8W.js → agent-eISuMXJb.js} +2 -2
- package/dist/bin.js +9 -6
- package/dist/config/bin.js +3 -3
- package/dist/{constants-BqJiMVVU.js → constants-CCQkpaxK.js} +2 -2
- package/dist/create/bin.js +42 -10
- package/dist/{define-config-C_KGDLUZ.cjs → define-config-CREUiMmM.cjs} +2 -2
- package/dist/{define-config-Cf_5GHmY.d.ts → define-config-CeW9DETl.d.ts} +24 -8
- package/dist/{define-config-DhEJaYRc.js → define-config-Ro6PS4dP.js} +2 -2
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-BWiANxFS.js → dist-DUsqQuw8.js} +117 -1395
- package/dist/{editor-CHfGUhxP.js → editor-B8tkz7nL.js} +94 -52
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +54 -50
- package/dist/{oxlint-plugin-config-lMMD5fAC.js → oxlint-plugin-config-CbG58Kzr.js} +1 -1
- package/dist/oxlint-plugin.js +2 -2
- package/dist/pack-bin.js +3 -2
- package/dist/{package-Cgdlhamw.js → package-BS84eWrW.js} +7 -2
- package/dist/package-overrides-CpoQngt3.js +411 -0
- package/dist/{prompts-jMH8S4Wp.js → prompts-ByOzbMBG.js} +537 -252
- package/dist/{resolve-vite-config-BJYYtfY3.js → resolve-vite-config-Be237LWp.js} +2 -2
- package/dist/{resolve-vite-config-BPgpYMYp.js → resolve-vite-config-CofpYgnY.js} +1 -1
- package/dist/staged/bin.js +791 -742
- package/dist/sync-versions/bin.js +4 -6
- package/dist/sync-versions/bin.mjs +247 -1419
- package/dist/toolchain.js +9 -9
- package/dist/toolchain.json +9 -9
- package/dist/{tsconfig-CmKidmRD.js → tsconfig-3ONY2k2K.js} +1 -1
- package/dist/{tsconfig-BoYTBNX_.js → tsconfig-DzZ-nrx2.js} +2 -2
- package/dist/version.js +2 -2
- package/dist/versions.js +5 -5
- package/docs/guide/ci.md +3 -4
- package/docs/guide/env.md +10 -5
- package/docs/guide/github-actions-cache.md +1 -3
- package/docs/guide/ide-integration.md +3 -1
- package/docs/guide/implode.md +2 -0
- package/docs/guide/install.md +3 -0
- package/docs/guide/local-cli.md +7 -7
- package/docs/guide/migrate-rules.md +8 -0
- package/docs/guide/migrate.md +7 -7
- package/docs/guide/test.md +1 -1
- package/docs/guide/troubleshooting.md +2 -2
- package/docs/guide/upgrade-project.md +1 -1
- package/docs/guide/vitest-v5.md +2 -2
- package/docs/guide/vpx.md +2 -2
- package/package.json +31 -28
- package/dist/package-overrides-Dpn4scvN.js +0 -17
package/dist/migration/bin.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { r as __toESM } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
1
|
import { t as documentationUrl$1 } from "../documentation-DqcZSthV.js";
|
|
3
2
|
import { a as muted, c as warnMsg, i as log, o as printHeader, r as formatDuration, t as accent } from "../terminal-MKGAuy-p.js";
|
|
4
|
-
import { _ as engines, a as SETUP_VP_VERSION, d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, m as isForceOverrideMode } from "../constants-
|
|
3
|
+
import { _ as engines, a as SETUP_VP_VERSION, d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, m as isForceOverrideMode } from "../constants-CCQkpaxK.js";
|
|
5
4
|
import { a as writeJsonFile, c as modify, i as readJsonFile, l as parse, o as applyEdits, s as findNodeAtLocation, u as parseTree } from "../json-JP24qHUF.js";
|
|
6
|
-
import { a as
|
|
5
|
+
import { a as hasVitePlusDependency, i as hasPackageManagerDeclaration, n as detectPackageMetadata, o as readNearestPackageJson } from "../package-BS84eWrW.js";
|
|
7
6
|
import { t as vitest_v5_entry_points_default } from "../vitest-v5-entry-points-DthU1e_O.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { C as confirm, D as outro, M as isCancel, O as select, S as normalize$1, T as log$1, c as selectPackageManager, i as promptGitHooks, k as spinner, l as upgradeYarn, n as defaultInteractive, o as runViteFmt, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, x as getMajor, y as PackageManager } from "../prompts-ByOzbMBG.js";
|
|
8
|
+
import { m as compare, t as require_dist, v as isGreaterThanOrEqual } from "../dist-DUsqQuw8.js";
|
|
9
|
+
import { a as rangeToComparators, i as normalizeRange, n as findMinimumForRange, o as rangesIntersect, r as isRangeSubset, s as satisfies, t as extractOverrideTargetName } from "../package-overrides-CpoQngt3.js";
|
|
10
|
+
import { i as selectAgentTargetPaths, l as displayRelative, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-eISuMXJb.js";
|
|
11
11
|
import { n as addMigrationWarning, r as createMigrationReport } from "../report-NhQk8VHb.js";
|
|
12
|
-
import { $ as confirmEslintMigration, A as createCatalogDependencyResolver, B as addFrameworkShim, C as mergeViteConfigFiles, D as usesWebdriverioProvider, E as ensureVitePlusBootstrap, G as migrateTsupToTsdown, H as hasFrameworkShim, I as minimatch, J as confirmPrettierMigration, L as findGitRoot, M as detectWorkspace$1, O as configureYarnNodeModulesMode, Q as warnPackageLevelPrettier, S as mergeTsdownConfigFile, T as detectVitePlusBootstrapPending, U as confirmTsupMigration, V as detectFramework, W as detectTsupProject, X as migratePrettierToOxfmt, Y as detectPrettierProject, _ as installGitHooks, at as warnLegacyEslintConfig, ct as checkViteVersion, d as finalizeCoreMigrationForExistingVitePlus, et as detectEslintProject, f as detectNodeVersionManagerFile, g as detectLegacyGitHooksMigrationCandidate, i as selectEditor, it as warnIncompatibleEslintIntegration, k as detectYarnPnpMode, l as rewriteStandaloneProject, lt as checkVitestVersion, m as migrateSetupVpVersion, nt as migrateEslintToOxlint, o as writeEditorConfigs, ot as warnPackageLevelEslint, p as migrateNodeVersionManagerFile, q as warnMissingTsupConfig, r as isJsonLikeFile, s as rewriteMonorepo, st as WEBDRIVERIO_PROVIDER, t as detectEditorConflicts, tt as detectIncompatibleEslintIntegration, u as detectPendingCoreMigration, v as preflightGitHooksSetup, w as collectToolchainVersionChanges, x as injectLintTypeCheckDefaults, y as shouldSkipStagedMigrationForHooks, z as extractOverrideParentSegments } from "../editor-
|
|
12
|
+
import { $ as confirmEslintMigration, A as createCatalogDependencyResolver, B as addFrameworkShim, C as mergeViteConfigFiles, D as usesWebdriverioProvider, E as ensureVitePlusBootstrap, G as migrateTsupToTsdown, H as hasFrameworkShim, I as minimatch, J as confirmPrettierMigration, L as findGitRoot, M as detectWorkspace$1, O as configureYarnNodeModulesMode, Q as warnPackageLevelPrettier, S as mergeTsdownConfigFile, T as detectVitePlusBootstrapPending, U as confirmTsupMigration, V as detectFramework, W as detectTsupProject, X as migratePrettierToOxfmt, Y as detectPrettierProject, _ as installGitHooks, at as warnLegacyEslintConfig, ct as checkViteVersion, d as finalizeCoreMigrationForExistingVitePlus, et as detectEslintProject, f as detectNodeVersionManagerFile, g as detectLegacyGitHooksMigrationCandidate, i as selectEditor, it as warnIncompatibleEslintIntegration, k as detectYarnPnpMode, l as rewriteStandaloneProject, lt as checkVitestVersion, m as migrateSetupVpVersion, nt as migrateEslintToOxlint, o as writeEditorConfigs, ot as warnPackageLevelEslint, p as migrateNodeVersionManagerFile, q as warnMissingTsupConfig, r as isJsonLikeFile, s as rewriteMonorepo, st as WEBDRIVERIO_PROVIDER, t as detectEditorConflicts, tt as detectIncompatibleEslintIntegration, u as detectPendingCoreMigration, v as preflightGitHooksSetup, w as collectToolchainVersionChanges, x as injectLintTypeCheckDefaults, y as shouldSkipStagedMigrationForHooks, z as extractOverrideParentSegments } from "../editor-B8tkz7nL.js";
|
|
13
13
|
import { n as runCommandSilently } from "../command-CguLh2KL.js";
|
|
14
|
-
import { a as hasBaseUrlInTsconfig, i as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-
|
|
15
|
-
import { t as extractOverrideTargetName } from "../package-overrides-Dpn4scvN.js";
|
|
14
|
+
import { a as hasBaseUrlInTsconfig, i as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-DzZ-nrx2.js";
|
|
16
15
|
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
17
16
|
import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../protocol-D99W10Qi.js";
|
|
18
17
|
import path from "node:path";
|
|
@@ -1056,7 +1055,6 @@ function vitestV5Documentation(code) {
|
|
|
1056
1055
|
}
|
|
1057
1056
|
//#endregion
|
|
1058
1057
|
//#region src/migration/vitest-v5/lockfile.ts
|
|
1059
|
-
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
1060
1058
|
var import_dist = require_dist();
|
|
1061
1059
|
function record$1(value) {
|
|
1062
1060
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -1078,11 +1076,11 @@ function declaredVitest(pkg) {
|
|
|
1078
1076
|
* In particular, never infer a runner from an unrelated transitive package. */
|
|
1079
1077
|
function lockedVitestVersion(root, directory, manager, spec) {
|
|
1080
1078
|
const range = spec.replace(/^npm:vitest@/, "");
|
|
1081
|
-
const validRange =
|
|
1079
|
+
const validRange = normalizeRange(range);
|
|
1082
1080
|
if (!validRange && !/^[\w.-]+$/.test(range)) return;
|
|
1083
1081
|
function valid(version) {
|
|
1084
|
-
if (typeof version !== "string" || !
|
|
1085
|
-
return !validRange ||
|
|
1082
|
+
if (typeof version !== "string" || !normalize$1(version)) return;
|
|
1083
|
+
return !validRange || satisfies(version, range, { includePrerelease: true }) ? version : void 0;
|
|
1086
1084
|
}
|
|
1087
1085
|
const relative = path.relative(root, directory).replaceAll("\\", "/");
|
|
1088
1086
|
const read = (name) => fs.readFileSync(path.join(root, name), "utf8").replace(/^\uFEFF/, "");
|
|
@@ -2369,13 +2367,13 @@ function webdriverioMigrationSpec(spec) {
|
|
|
2369
2367
|
const migrated = webdriverioMigrationSpec(spec.slice(REGISTRY_ALIAS.length));
|
|
2370
2368
|
return migrated === void 0 ? void 0 : `${REGISTRY_ALIAS}${migrated}`;
|
|
2371
2369
|
}
|
|
2372
|
-
if (!
|
|
2373
|
-
const branches =
|
|
2370
|
+
if (!normalizeRange(spec)) return;
|
|
2371
|
+
const branches = rangeToComparators(spec).map((set) => set.join(" "));
|
|
2374
2372
|
if (branches.every((branch) => {
|
|
2375
|
-
const min =
|
|
2376
|
-
return min &&
|
|
2373
|
+
const min = findMinimumForRange(branch);
|
|
2374
|
+
return min && isGreaterThanOrEqual(min, MIN_VERSION);
|
|
2377
2375
|
})) return spec;
|
|
2378
|
-
const narrowed = branches.map((branch) => `${branch} >=${MIN_VERSION}`.trim()).filter((branch) =>
|
|
2376
|
+
const narrowed = branches.map((branch) => `${branch} >=${MIN_VERSION}`.trim()).filter((branch) => findMinimumForRange(branch) !== null);
|
|
2379
2377
|
return narrowed.length ? narrowed.join(" || ") : DEFAULT_SPEC;
|
|
2380
2378
|
}
|
|
2381
2379
|
function object(value) {
|
|
@@ -2470,7 +2468,7 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2470
2468
|
const text = fs.readFileSync(local, "utf8");
|
|
2471
2469
|
inputs.set(local, text);
|
|
2472
2470
|
const pkg = object(parse(text));
|
|
2473
|
-
if (pkg.name === "@vitest/browser-webdriverio" && typeof pkg.version === "string" &&
|
|
2471
|
+
if (pkg.name === "@vitest/browser-webdriverio" && typeof pkg.version === "string" && normalize$1(pkg.version) && isGreaterThanOrEqual(pkg.version, MIN_VERSION)) return;
|
|
2474
2472
|
}
|
|
2475
2473
|
}
|
|
2476
2474
|
block(file, keys.join("."), spec);
|
|
@@ -2511,13 +2509,13 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2511
2509
|
if (!spec) continue;
|
|
2512
2510
|
const entry = spec.startsWith("catalog:") ? catalogEntry(spec, name) : void 0;
|
|
2513
2511
|
const resolved = entry ? get(entry.file, entry.keys) : spec;
|
|
2514
|
-
if (typeof resolved === "string" &&
|
|
2512
|
+
if (typeof resolved === "string" && normalizeRange(resolved)) {
|
|
2515
2513
|
peer = name === "webdriverio" ? spec : resolved;
|
|
2516
2514
|
break;
|
|
2517
2515
|
}
|
|
2518
2516
|
}
|
|
2519
2517
|
const metadata = peer === "*" ? detectPackageMetadata(directory, "webdriverio") : void 0;
|
|
2520
|
-
if (metadata &&
|
|
2518
|
+
if (metadata && normalize$1(metadata.version)) {
|
|
2521
2519
|
const metadataFile = path.join(metadata.path, "package.json");
|
|
2522
2520
|
inputs.set(metadataFile, fs.readFileSync(metadataFile, "utf8"));
|
|
2523
2521
|
peer = `^${metadata.version}`;
|
|
@@ -2545,8 +2543,8 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2545
2543
|
const before = get(file, versionPath);
|
|
2546
2544
|
const catalog = typeof before === "string" && before.startsWith("catalog:") ? catalogEntry(before, WEBDRIVERIO_PROVIDER) : void 0;
|
|
2547
2545
|
const pin = catalog ? get(catalog.file, catalog.keys) : before;
|
|
2548
|
-
const pinnedRange = typeof pin === "string" ?
|
|
2549
|
-
if (pinnedRange && !
|
|
2546
|
+
const pinnedRange = typeof pin === "string" ? normalizeRange(pin.startsWith(REGISTRY_ALIAS) ? pin.slice(REGISTRY_ALIAS.length) : pin) : null;
|
|
2547
|
+
if (pinnedRange && !rangesIntersect(pinnedRange, `>=${MIN_VERSION}`)) {
|
|
2550
2548
|
set(file, versionPath, void 0);
|
|
2551
2549
|
continue;
|
|
2552
2550
|
}
|
|
@@ -2558,7 +2556,7 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2558
2556
|
const direct = get(rootManifest, [field, WEBDRIVERIO_PROVIDER]);
|
|
2559
2557
|
if (typeof direct === "string" && webdriverioMigrationSpec(before) !== before && webdriverioMigrationSpec(direct) === direct) set(file, versionPath, `$${WEBDRIVERIO_PROVIDER}`);
|
|
2560
2558
|
else if (direct === after) continue;
|
|
2561
|
-
else if (typeof direct === "string" &&
|
|
2559
|
+
else if (typeof direct === "string" && normalizeRange(direct) && normalizeRange(after) && rangesIntersect(direct, after)) {
|
|
2562
2560
|
set(rootManifest, [field, WEBDRIVERIO_PROVIDER], after);
|
|
2563
2561
|
set(file, versionPath, `$${WEBDRIVERIO_PROVIDER}`);
|
|
2564
2562
|
} else block(file, versionPath.join("."), after);
|
|
@@ -2692,11 +2690,11 @@ function lockedSourceVersion(directory, root, pkg, manager, expectedRunnerPackag
|
|
|
2692
2690
|
if (name === "vitest" && expectedRunnerPackage && !reference.startsWith(`${expectedRunnerPackage}@`)) return;
|
|
2693
2691
|
if (reference.startsWith(`${LEGACY_RUNNER}@`)) return follow(LEGACY_RUNNER, reference.slice(29), depth + 1);
|
|
2694
2692
|
const version = reference.split("(")[0];
|
|
2695
|
-
if (!
|
|
2693
|
+
if (!normalize$1(version)) return;
|
|
2696
2694
|
if (name === "vitest") return version;
|
|
2697
2695
|
if (name === LEGACY_RUNNER) {
|
|
2698
2696
|
const runnerVersion = record(record(record(lock?.packages)?.[`${name}@${version}`])?.peerDependencies)?.["@vitest/ui"];
|
|
2699
|
-
return typeof runnerVersion === "string" ?
|
|
2697
|
+
return typeof runnerVersion === "string" ? normalize$1(runnerVersion) ?? void 0 : void 0;
|
|
2700
2698
|
}
|
|
2701
2699
|
const dependencies = record(record(record(lock?.snapshots)?.[`${name}@${reference}`])?.dependencies);
|
|
2702
2700
|
return follow("vitest", dependencies?.vitest, depth + 1) ?? follow(LEGACY_RUNNER, dependencies?.[LEGACY_RUNNER], depth + 1);
|
|
@@ -2707,25 +2705,26 @@ function lockedSourceVersion(directory, root, pkg, manager, expectedRunnerPackag
|
|
|
2707
2705
|
}
|
|
2708
2706
|
}
|
|
2709
2707
|
function unambiguousRunnerVersion(range) {
|
|
2710
|
-
if (!
|
|
2711
|
-
|
|
2708
|
+
if (!normalizeRange(range) || !isRangeSubset(range, "<5.0.0-0", { includePrerelease: true }) && !isRangeSubset(range, ">=5.0.0-0", { includePrerelease: true })) return;
|
|
2709
|
+
const minimum = findMinimumForRange(range);
|
|
2710
|
+
return minimum ? normalize$1(minimum) ?? void 0 : void 0;
|
|
2712
2711
|
}
|
|
2713
2712
|
function installedSourceVersion(directory, name, expectedPackage, expectedRange) {
|
|
2714
2713
|
const installed = detectPackageMetadata(directory, name);
|
|
2715
2714
|
if (!installed || expectedPackage && installed.name !== expectedPackage) return;
|
|
2716
|
-
if (expectedRange &&
|
|
2717
|
-
if (installed.name === "vitest") return
|
|
2715
|
+
if (expectedRange && normalizeRange(expectedRange) && !satisfies(installed.version, expectedRange, { includePrerelease: true })) return;
|
|
2716
|
+
if (installed.name === "vitest") return normalize$1(installed.version) ?? void 0;
|
|
2718
2717
|
const pkg = readJson(path.join(installed.path, "package.json"));
|
|
2719
2718
|
if (installed.name === LEGACY_RUNNER) {
|
|
2720
2719
|
const version = record(pkg.peerDependencies)?.["@vitest/ui"];
|
|
2721
|
-
return typeof version === "string" ?
|
|
2720
|
+
return typeof version === "string" ? normalize$1(version) ?? void 0 : void 0;
|
|
2722
2721
|
}
|
|
2723
2722
|
if (installed.name !== "vite-plus") return;
|
|
2724
2723
|
const bundled = dependency(pkg, "vitest");
|
|
2725
2724
|
if (bundled?.startsWith("catalog:")) return installedSourceVersion(installed.path, "vitest");
|
|
2726
|
-
if (bundled &&
|
|
2725
|
+
if (bundled && normalizeRange(bundled)) {
|
|
2727
2726
|
const version = installedSourceVersion(installed.path, "vitest");
|
|
2728
|
-
return version &&
|
|
2727
|
+
return version && satisfies(version, bundled, { includePrerelease: true }) ? version : unambiguousRunnerVersion(bundled);
|
|
2729
2728
|
}
|
|
2730
2729
|
return dependency(pkg, LEGACY_RUNNER) ? installedSourceVersion(installed.path, LEGACY_RUNNER) : void 0;
|
|
2731
2730
|
}
|
|
@@ -2747,11 +2746,11 @@ function sourceVersion(directory, root, pkg, manager) {
|
|
|
2747
2746
|
}
|
|
2748
2747
|
const expectedRunnerPackage = legacyAlias ? LEGACY_RUNNER : void 0;
|
|
2749
2748
|
const locked = lockedSourceVersion(directory, root, pkg, manager, expectedRunnerPackage);
|
|
2750
|
-
if (locked && (!spec || legacyAlias || !
|
|
2749
|
+
if (locked && (!spec || legacyAlias || !normalizeRange(spec) || satisfies(locked, spec, { includePrerelease: true }))) return locked;
|
|
2751
2750
|
const installed = installedSourceVersion(directory, "vitest", expectedRunnerPackage);
|
|
2752
|
-
if (installed && (!spec || legacyAlias ||
|
|
2751
|
+
if (installed && (!spec || legacyAlias || satisfies(installed, spec, { includePrerelease: true }))) return installed;
|
|
2753
2752
|
if (legacyAlias) return "4.0.0";
|
|
2754
|
-
if (spec &&
|
|
2753
|
+
if (spec && normalizeRange(spec)) return unambiguousRunnerVersion(spec);
|
|
2755
2754
|
if (vitePlus) {
|
|
2756
2755
|
const bundled = installedSourceVersion(directory, "vite-plus", "vite-plus", vitePlusRange);
|
|
2757
2756
|
if (bundled) return bundled;
|
|
@@ -2767,21 +2766,21 @@ function checkNodeRange(file, value, label, findings, publicContract = false) {
|
|
|
2767
2766
|
"node",
|
|
2768
2767
|
"stable"
|
|
2769
2768
|
].includes(value)) return;
|
|
2770
|
-
const range =
|
|
2769
|
+
const range = normalizeRange(value);
|
|
2771
2770
|
if (publicContract && range) {
|
|
2772
|
-
const minimum =
|
|
2771
|
+
const minimum = findMinimumForRange(range);
|
|
2773
2772
|
if (minimum) {
|
|
2774
2773
|
const majorRange = `${minimum.major}.x`;
|
|
2775
|
-
if (
|
|
2774
|
+
if (satisfies(minimum, engines.node) || isRangeSubset(majorRange, range) && rangesIntersect(majorRange, engines.node)) return;
|
|
2776
2775
|
}
|
|
2777
2776
|
}
|
|
2778
2777
|
let message = `Resolve ${label} (${value}) and select Node ${engines.node}.`;
|
|
2779
|
-
if (range && !publicContract && !
|
|
2780
|
-
const current =
|
|
2781
|
-
const upgrade = current &&
|
|
2782
|
-
if (upgrade) return upgrade
|
|
2778
|
+
if (range && !publicContract && !rangesIntersect(range, engines.node)) {
|
|
2779
|
+
const current = findMinimumForRange(range);
|
|
2780
|
+
const upgrade = current && rangeToComparators(engines.node).map((comparators) => findMinimumForRange(comparators.join(" "))).filter((version) => version !== null).toSorted(compare).find((version) => isGreaterThanOrEqual(version, current));
|
|
2781
|
+
if (upgrade) return normalize$1(upgrade) ?? void 0;
|
|
2783
2782
|
} else if (range) {
|
|
2784
|
-
if (
|
|
2783
|
+
if (isRangeSubset(range, engines.node) || !publicContract && !/[<>|*]/.test(value)) return;
|
|
2785
2784
|
message = `${label} (${value}) includes unsupported test runtimes. Pin the test/CI runtime to Node ${engines.node}; keep the library's public engine contract separate.`;
|
|
2786
2785
|
}
|
|
2787
2786
|
findings.push(finding(file, "node-runtime", message));
|
|
@@ -2923,14 +2922,14 @@ function planVitestV5Migration(workspace, originalProjects) {
|
|
|
2923
2922
|
const version = original ? original.sourceVersion : sourceVersion(directory, workspace.rootDir, pkg, workspace.packageManager);
|
|
2924
2923
|
const active = original?.active ?? (!!dependency(pkg, "vitest") || Object.values(record(pkg.scripts) ?? {}).some((command) => typeof command === "string" && VITEST_COMMAND.test(command)) || [...sources].some(([file, source]) => CODE_FILE.test(file) && hasVitestV5SourceUsage(file, source) || configFiles.has(file) && /\btest\s*:/.test(source)));
|
|
2925
2924
|
const options = {
|
|
2926
|
-
preserveV4: original?.options.preserveV4 ?? (!!version &&
|
|
2927
|
-
reviewV4: !!version &&
|
|
2925
|
+
preserveV4: original?.options.preserveV4 ?? (!!version && getMajor(version) < 5),
|
|
2926
|
+
reviewV4: !!version && getMajor(version) < 5,
|
|
2928
2927
|
browser: [...sources.values()].some((source) => BROWSER_SIGNAL.test(source)),
|
|
2929
2928
|
browserPossible,
|
|
2930
2929
|
temporalPolyfill: [...sources.values()].some((source) => /(?:['"]temporal-polyfill\/global['"]|(?:globalThis|global)\.Temporal\s*=|Object\.(?:assign|defineProperty)\(globalThis,\s*(?:\{\s*Temporal|['"]Temporal['"]))/.test(source))
|
|
2931
2930
|
};
|
|
2932
2931
|
if (active && !version) findings.push(finding(path.join(directory, "package.json"), "source-version", "Cannot determine the original Vitest version. Install the original lockfile, then re-run migration so v4 defaults are not applied to a v5 project.", "block"));
|
|
2933
|
-
if (active && version &&
|
|
2932
|
+
if (active && version && getMajor(version) < 4) findings.push(finding(path.join(directory, "package.json"), "source-version", "Upgrade the original project to Vitest 4 before running this migration.", "block"));
|
|
2934
2933
|
const project = {
|
|
2935
2934
|
directory,
|
|
2936
2935
|
sourceVersion: version,
|
|
@@ -3727,14 +3726,14 @@ async function downloadSupportedPackageManager(options) {
|
|
|
3727
3726
|
const { rootDir, packageManager, packageManagerVersion, interactive, updateMigrationProgress, failMigrationProgress } = options;
|
|
3728
3727
|
updateMigrationProgress("Preparing migration");
|
|
3729
3728
|
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, interactive, true);
|
|
3730
|
-
if (packageManager === PackageManager.yarn &&
|
|
3729
|
+
if (packageManager === PackageManager.yarn && satisfies(downloadResult.version, ">=4.0.0 <4.10.0")) {
|
|
3731
3730
|
updateMigrationProgress("Upgrading Yarn");
|
|
3732
3731
|
await upgradeYarn(rootDir, interactive, true);
|
|
3733
|
-
} else if (packageManager === PackageManager.pnpm &&
|
|
3732
|
+
} else if (packageManager === PackageManager.pnpm && satisfies(downloadResult.version, "< 9.5.0")) {
|
|
3734
3733
|
failMigrationProgress("Migration failed");
|
|
3735
3734
|
log$1.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
3736
3735
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
3737
|
-
} else if (packageManager === PackageManager.npm &&
|
|
3736
|
+
} else if (packageManager === PackageManager.npm && satisfies(downloadResult.version, "< 8.3.0")) {
|
|
3738
3737
|
failMigrationProgress("Migration failed");
|
|
3739
3738
|
log$1.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
3740
3739
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
@@ -3908,6 +3907,10 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, vi
|
|
|
3908
3907
|
async function main() {
|
|
3909
3908
|
const { projectPath, options } = parseArgs();
|
|
3910
3909
|
printHeader();
|
|
3910
|
+
if (!fs.existsSync(path.join(projectPath, "package.json"))) {
|
|
3911
|
+
const target = displayRelative(projectPath) || ".";
|
|
3912
|
+
cancelAndExit(`Cannot migrate ${target}: no package.json found. Run vp migrate from a project root or pass its path explicitly.`, 1);
|
|
3913
|
+
}
|
|
3911
3914
|
const workspaceInfoOptional = await detectWorkspace$1(projectPath);
|
|
3912
3915
|
if (workspaceInfoOptional.isMonorepo && path.resolve(projectPath) !== path.resolve(workspaceInfoOptional.rootDir)) cancelAndExit(`Vite+ cannot migrate a workspace member. Run \`vp migrate\` from the workspace root at ${workspaceInfoOptional.rootDir}.`, 1);
|
|
3913
3916
|
const initialChangedPaths = await collectChangedFormatPaths(workspaceInfoOptional.rootDir);
|
|
@@ -3920,6 +3923,7 @@ async function main() {
|
|
|
3920
3923
|
cancelAndExit("Resolve the blocking Vitest v5 findings, then re-run `vp migrate`. No project files were changed.", 1);
|
|
3921
3924
|
}
|
|
3922
3925
|
const rootPkg = readNearestPackageJson(workspaceInfoOptional.rootDir);
|
|
3926
|
+
if (workspaceInfoOptional.packageManager && !hasPackageManagerDeclaration(rootPkg)) log$1.warn(`No package manager is declared in package.json; using ${workspaceInfoOptional.packageManager} for this migration without adding a pin. Run \`vp env pin\` to declare it explicitly.`);
|
|
3923
3927
|
if (hasVitePlusDependency(rootPkg) && !isForceOverrideMode()) {
|
|
3924
3928
|
let convertYarnPnp = await confirmYarnNodeModulesMode(workspaceInfoOptional.rootDir, workspaceInfoOptional.packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive);
|
|
3925
3929
|
let didMigrate = vitestV5NeedsMigration(vitestV5Plan);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as VITE_PLUS_NAME } from "./constants-
|
|
1
|
+
import { u as VITE_PLUS_NAME } from "./constants-CCQkpaxK.js";
|
|
2
2
|
//#region src/oxlint-plugin-config.ts
|
|
3
3
|
const VITE_PLUS_OXLINT_PLUGIN_NAME = VITE_PLUS_NAME;
|
|
4
4
|
const VITE_PLUS_OXLINT_PLUGIN_SPECIFIER = `${VITE_PLUS_NAME}/oxlint-plugin`;
|
package/dist/oxlint-plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as exports } from "./constants-
|
|
2
|
-
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-
|
|
1
|
+
import { v as exports } from "./constants-CCQkpaxK.js";
|
|
2
|
+
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-CbG58Kzr.js";
|
|
3
3
|
import { t as vitest_v5_entry_points_default } from "./vitest-v5-entry-points-DthU1e_O.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs";
|
package/dist/pack-bin.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as cac } from "./dist-DfmT__Aw.js";
|
|
3
|
-
import { o as resolveViteConfig } from "./resolve-vite-config-
|
|
3
|
+
import { o as resolveViteConfig } from "./resolve-vite-config-Be237LWp.js";
|
|
4
4
|
import module from "node:module";
|
|
5
|
+
import path from "node:path";
|
|
5
6
|
import { buildWithConfigs, enableDebug, globalLogger, resolveUserConfig } from "vite/pack";
|
|
6
7
|
//#region src/pack-bin.ts
|
|
7
8
|
const RE_DTS = /\.d\.[cm]?ts$/;
|
|
@@ -69,7 +70,7 @@ cli.command("[...files]", "Bundle files", {
|
|
|
69
70
|
async function runBuild() {
|
|
70
71
|
const viteConfig = flags.config === false ? void 0 : await resolveViteConfig(process.cwd(), { traverseUp: true });
|
|
71
72
|
const configDeps = /* @__PURE__ */ new Set();
|
|
72
|
-
if (viteConfig?.configFile) configDeps.add(viteConfig.configFile);
|
|
73
|
+
if (viteConfig?.configFile) configDeps.add(path.normalize(viteConfig.configFile));
|
|
73
74
|
const configs = [];
|
|
74
75
|
const packConfigs = Array.isArray(viteConfig?.pack) ? viteConfig.pack : [viteConfig?.pack ?? {}];
|
|
75
76
|
for (const packConfig of packConfigs) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./constants-
|
|
1
|
+
import "./constants-CCQkpaxK.js";
|
|
2
2
|
import { i as readJsonFile } from "./json-JP24qHUF.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
@@ -220,6 +220,11 @@ function readNearestPackageJson(currentDir) {
|
|
|
220
220
|
function hasVitePlusDependency(pkg) {
|
|
221
221
|
return Boolean(pkg?.dependencies?.["vite-plus"] || pkg?.devDependencies?.["vite-plus"]);
|
|
222
222
|
}
|
|
223
|
+
function hasPackageManagerDeclaration(pkg) {
|
|
224
|
+
if (!pkg) return false;
|
|
225
|
+
if (Object.hasOwn(pkg, "packageManager")) return true;
|
|
226
|
+
return typeof pkg.devEngines === "object" && pkg.devEngines !== null && !Array.isArray(pkg.devEngines) && Object.hasOwn(pkg.devEngines, "packageManager");
|
|
227
|
+
}
|
|
223
228
|
/**
|
|
224
229
|
* Check if an npm package exists on its resolved registry.
|
|
225
230
|
* Returns true if the package exists or if the check could not be performed (network error, timeout).
|
|
@@ -239,4 +244,4 @@ async function checkNpmPackageExists(packageName) {
|
|
|
239
244
|
}
|
|
240
245
|
}
|
|
241
246
|
//#endregion
|
|
242
|
-
export {
|
|
247
|
+
export { hasVitePlusDependency as a, getNpmRegistry as c, hasPackageManagerDeclaration as i, detectPackageMetadata as n, readNearestPackageJson as o, getScopeFromPackageName as r, fetchNpmResource as s, checkNpmPackageExists as t };
|