vite-plus 1.0.0 → 1.2.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 +59 -6
- package/README.md +7 -7
- package/binding/index.cjs +54 -55
- package/binding/index.d.cts +53 -12
- package/dist/{agent-CKMI1a8W.js → agent-KeDc6vmg.js} +2 -2
- package/dist/bin.js +14 -11
- package/dist/command-DaRqSNpP.js +1 -0
- package/dist/comparison-CmVirWIW-DUGaiYqF.js +121 -0
- package/dist/config/bin.js +4 -4
- package/dist/{constants-BqJiMVVU.js → constants-BW3g7VnD.js} +3 -3
- package/dist/create/bin.d.ts +2 -1
- package/dist/create/bin.js +126 -26
- package/dist/{define-config-Cf_5GHmY.d.ts → define-config-Bexdd6RZ.d.ts} +25 -9
- package/dist/{define-config-DhEJaYRc.js → define-config-CIlk9scU.js} +111 -6
- package/dist/{define-config-C_KGDLUZ.cjs → define-config-Dq_23Eyr.cjs} +89 -3
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -2
- package/dist/{dist-BsAzy8OW.js → dist-Bi7ZEK3c.js} +1 -2
- package/dist/dist-CBWGibx8.js +3 -0
- package/dist/{dist-DfmT__Aw.js → dist-Cqz8OtiO.js} +24 -21
- package/dist/{editor-CHfGUhxP.js → editor-b1XUwt9v.js} +114 -65
- package/dist/fmt.js +1 -2
- package/dist/hooks/bin.js +1 -1
- package/dist/{hooks-C-4gykWR.js → hooks-DhwsWb46.js} +34 -22
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lint-plugins-dev.js +1 -2
- package/dist/lint-plugins.cjs +1 -1
- package/dist/lint-plugins.js +1 -2
- package/dist/migration/bin.js +63 -57
- package/dist/{oxlint-plugin-config-lMMD5fAC.js → oxlint-plugin-config-Dx-ZY2MN.js} +1 -1
- package/dist/oxlint-plugin.js +2 -2
- package/dist/pack-bin.js +4 -3
- package/dist/{package-Cgdlhamw.js → package-BP16iQby.js} +7 -2
- package/dist/package-overrides-D1RcXSFl.js +411 -0
- package/dist/{prompts-jMH8S4Wp.js → prompts-BGpQtC5z.js} +548 -262
- package/dist/resolve-vite-config-CGzlyhGr.js +1 -0
- package/dist/{resolve-vite-config-BJYYtfY3.js → resolve-vite-config-x47JetlI.js} +2 -2
- package/dist/staged/bin.js +792 -743
- package/dist/sync-versions/bin.js +4761 -3373
- package/dist/sync-versions/bin.mjs +5304 -5083
- package/dist/test/browser/providers/playwright.d.ts +7 -2
- package/dist/test/browser-playwright.d.ts +7 -2
- package/dist/toolchain.js +12 -12
- package/dist/toolchain.json +12 -12
- package/dist/tsconfig-C5PnJfW4.js +1 -0
- package/dist/{tsconfig-BoYTBNX_.js → tsconfig-D2DzAQ_D.js} +2 -2
- package/dist/version.js +2 -2
- package/dist/versions.js +7 -7
- package/docs/config/run.md +9 -5
- package/docs/config/staged.md +1 -1
- package/docs/guide/automatic-data-tracking.md +7 -6
- package/docs/guide/cache.md +3 -3
- package/docs/guide/check.md +7 -7
- package/docs/guide/ci.md +3 -4
- package/docs/guide/commit-hooks.md +3 -1
- package/docs/guide/create.md +14 -4
- package/docs/guide/env.md +19 -7
- package/docs/guide/github-actions-cache.md +2 -4
- package/docs/guide/global-cli.md +36 -10
- package/docs/guide/ide-integration.md +4 -2
- package/docs/guide/implode.md +2 -0
- package/docs/guide/index.md +8 -8
- package/docs/guide/local-cli.md +27 -11
- package/docs/guide/migrate-rules.md +11 -3
- package/docs/guide/migrate.md +11 -11
- package/docs/guide/{install.md → package-management.md} +28 -4
- package/docs/guide/run.md +10 -8
- package/docs/guide/test.md +3 -1
- package/docs/guide/troubleshooting.md +9 -7
- package/docs/guide/upgrade-project.md +2 -6
- package/docs/guide/upgrade.md +6 -0
- package/docs/guide/vitest-v5.md +2 -2
- package/docs/guide/vpx.md +5 -5
- package/package.json +37 -33
- package/templates/generator/bin/index.ts +0 -0
- package/templates/generator/package.json +2 -2
- package/templates/generator/src/template.ts +1 -0
- package/dist/command-CLJK5jGW.js +0 -2
- package/dist/dist-BWiANxFS.js +0 -8052
- package/dist/package-overrides-Dpn4scvN.js +0 -17
- package/dist/resolve-vite-config-BPgpYMYp.js +0 -2
- package/dist/tsconfig-CmKidmRD.js +0 -2
package/dist/lint-plugins.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { definePlugin, defineRule, eslintCompatPlugin };
|
|
1
|
+
export { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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-BW3g7VnD.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-BP16iQby.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-BGpQtC5z.js";
|
|
8
|
+
import { _ as isGreaterThanOrEqual, p as compare } from "../comparison-CmVirWIW-DUGaiYqF.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-D1RcXSFl.js";
|
|
10
|
+
import { i as selectAgentTargetPaths, l as displayRelative, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-KeDc6vmg.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-b1XUwt9v.js";
|
|
13
13
|
import { n as runCommandSilently } from "../command-CguLh2KL.js";
|
|
14
|
-
import {
|
|
15
|
-
import { t as
|
|
14
|
+
import { t as require_dist } from "../dist-Bi7ZEK3c.js";
|
|
15
|
+
import { a as hasBaseUrlInTsconfig, i as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-D2DzAQ_D.js";
|
|
16
16
|
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
17
17
|
import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../protocol-D99W10Qi.js";
|
|
18
18
|
import path from "node:path";
|
|
@@ -1056,7 +1056,6 @@ function vitestV5Documentation(code) {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
//#endregion
|
|
1058
1058
|
//#region src/migration/vitest-v5/lockfile.ts
|
|
1059
|
-
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
1060
1059
|
var import_dist = require_dist();
|
|
1061
1060
|
function record$1(value) {
|
|
1062
1061
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -1078,11 +1077,11 @@ function declaredVitest(pkg) {
|
|
|
1078
1077
|
* In particular, never infer a runner from an unrelated transitive package. */
|
|
1079
1078
|
function lockedVitestVersion(root, directory, manager, spec) {
|
|
1080
1079
|
const range = spec.replace(/^npm:vitest@/, "");
|
|
1081
|
-
const validRange =
|
|
1080
|
+
const validRange = normalizeRange(range);
|
|
1082
1081
|
if (!validRange && !/^[\w.-]+$/.test(range)) return;
|
|
1083
1082
|
function valid(version) {
|
|
1084
|
-
if (typeof version !== "string" || !
|
|
1085
|
-
return !validRange ||
|
|
1083
|
+
if (typeof version !== "string" || !normalize$1(version)) return;
|
|
1084
|
+
return !validRange || satisfies(version, range, { includePrerelease: true }) ? version : void 0;
|
|
1086
1085
|
}
|
|
1087
1086
|
const relative = path.relative(root, directory).replaceAll("\\", "/");
|
|
1088
1087
|
const read = (name) => fs.readFileSync(path.join(root, name), "utf8").replace(/^\uFEFF/, "");
|
|
@@ -2369,13 +2368,13 @@ function webdriverioMigrationSpec(spec) {
|
|
|
2369
2368
|
const migrated = webdriverioMigrationSpec(spec.slice(REGISTRY_ALIAS.length));
|
|
2370
2369
|
return migrated === void 0 ? void 0 : `${REGISTRY_ALIAS}${migrated}`;
|
|
2371
2370
|
}
|
|
2372
|
-
if (!
|
|
2373
|
-
const branches =
|
|
2371
|
+
if (!normalizeRange(spec)) return;
|
|
2372
|
+
const branches = rangeToComparators(spec).map((set) => set.join(" "));
|
|
2374
2373
|
if (branches.every((branch) => {
|
|
2375
|
-
const min =
|
|
2376
|
-
return min &&
|
|
2374
|
+
const min = findMinimumForRange(branch);
|
|
2375
|
+
return min && isGreaterThanOrEqual(min, MIN_VERSION);
|
|
2377
2376
|
})) return spec;
|
|
2378
|
-
const narrowed = branches.map((branch) => `${branch} >=${MIN_VERSION}`.trim()).filter((branch) =>
|
|
2377
|
+
const narrowed = branches.map((branch) => `${branch} >=${MIN_VERSION}`.trim()).filter((branch) => findMinimumForRange(branch) !== null);
|
|
2379
2378
|
return narrowed.length ? narrowed.join(" || ") : DEFAULT_SPEC;
|
|
2380
2379
|
}
|
|
2381
2380
|
function object(value) {
|
|
@@ -2470,7 +2469,7 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2470
2469
|
const text = fs.readFileSync(local, "utf8");
|
|
2471
2470
|
inputs.set(local, text);
|
|
2472
2471
|
const pkg = object(parse(text));
|
|
2473
|
-
if (pkg.name === "@vitest/browser-webdriverio" && typeof pkg.version === "string" &&
|
|
2472
|
+
if (pkg.name === "@vitest/browser-webdriverio" && typeof pkg.version === "string" && normalize$1(pkg.version) && isGreaterThanOrEqual(pkg.version, MIN_VERSION)) return;
|
|
2474
2473
|
}
|
|
2475
2474
|
}
|
|
2476
2475
|
block(file, keys.join("."), spec);
|
|
@@ -2511,13 +2510,13 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2511
2510
|
if (!spec) continue;
|
|
2512
2511
|
const entry = spec.startsWith("catalog:") ? catalogEntry(spec, name) : void 0;
|
|
2513
2512
|
const resolved = entry ? get(entry.file, entry.keys) : spec;
|
|
2514
|
-
if (typeof resolved === "string" &&
|
|
2513
|
+
if (typeof resolved === "string" && normalizeRange(resolved)) {
|
|
2515
2514
|
peer = name === "webdriverio" ? spec : resolved;
|
|
2516
2515
|
break;
|
|
2517
2516
|
}
|
|
2518
2517
|
}
|
|
2519
2518
|
const metadata = peer === "*" ? detectPackageMetadata(directory, "webdriverio") : void 0;
|
|
2520
|
-
if (metadata &&
|
|
2519
|
+
if (metadata && normalize$1(metadata.version)) {
|
|
2521
2520
|
const metadataFile = path.join(metadata.path, "package.json");
|
|
2522
2521
|
inputs.set(metadataFile, fs.readFileSync(metadataFile, "utf8"));
|
|
2523
2522
|
peer = `^${metadata.version}`;
|
|
@@ -2545,8 +2544,8 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2545
2544
|
const before = get(file, versionPath);
|
|
2546
2545
|
const catalog = typeof before === "string" && before.startsWith("catalog:") ? catalogEntry(before, WEBDRIVERIO_PROVIDER) : void 0;
|
|
2547
2546
|
const pin = catalog ? get(catalog.file, catalog.keys) : before;
|
|
2548
|
-
const pinnedRange = typeof pin === "string" ?
|
|
2549
|
-
if (pinnedRange && !
|
|
2547
|
+
const pinnedRange = typeof pin === "string" ? normalizeRange(pin.startsWith(REGISTRY_ALIAS) ? pin.slice(REGISTRY_ALIAS.length) : pin) : null;
|
|
2548
|
+
if (pinnedRange && !rangesIntersect(pinnedRange, `>=${MIN_VERSION}`)) {
|
|
2550
2549
|
set(file, versionPath, void 0);
|
|
2551
2550
|
continue;
|
|
2552
2551
|
}
|
|
@@ -2558,7 +2557,7 @@ function migrateWebdriverioDependencies(workspace, sources, inputs) {
|
|
|
2558
2557
|
const direct = get(rootManifest, [field, WEBDRIVERIO_PROVIDER]);
|
|
2559
2558
|
if (typeof direct === "string" && webdriverioMigrationSpec(before) !== before && webdriverioMigrationSpec(direct) === direct) set(file, versionPath, `$${WEBDRIVERIO_PROVIDER}`);
|
|
2560
2559
|
else if (direct === after) continue;
|
|
2561
|
-
else if (typeof direct === "string" &&
|
|
2560
|
+
else if (typeof direct === "string" && normalizeRange(direct) && normalizeRange(after) && rangesIntersect(direct, after)) {
|
|
2562
2561
|
set(rootManifest, [field, WEBDRIVERIO_PROVIDER], after);
|
|
2563
2562
|
set(file, versionPath, `$${WEBDRIVERIO_PROVIDER}`);
|
|
2564
2563
|
} else block(file, versionPath.join("."), after);
|
|
@@ -2692,11 +2691,11 @@ function lockedSourceVersion(directory, root, pkg, manager, expectedRunnerPackag
|
|
|
2692
2691
|
if (name === "vitest" && expectedRunnerPackage && !reference.startsWith(`${expectedRunnerPackage}@`)) return;
|
|
2693
2692
|
if (reference.startsWith(`${LEGACY_RUNNER}@`)) return follow(LEGACY_RUNNER, reference.slice(29), depth + 1);
|
|
2694
2693
|
const version = reference.split("(")[0];
|
|
2695
|
-
if (!
|
|
2694
|
+
if (!normalize$1(version)) return;
|
|
2696
2695
|
if (name === "vitest") return version;
|
|
2697
2696
|
if (name === LEGACY_RUNNER) {
|
|
2698
2697
|
const runnerVersion = record(record(record(lock?.packages)?.[`${name}@${version}`])?.peerDependencies)?.["@vitest/ui"];
|
|
2699
|
-
return typeof runnerVersion === "string" ?
|
|
2698
|
+
return typeof runnerVersion === "string" ? normalize$1(runnerVersion) ?? void 0 : void 0;
|
|
2700
2699
|
}
|
|
2701
2700
|
const dependencies = record(record(record(lock?.snapshots)?.[`${name}@${reference}`])?.dependencies);
|
|
2702
2701
|
return follow("vitest", dependencies?.vitest, depth + 1) ?? follow(LEGACY_RUNNER, dependencies?.[LEGACY_RUNNER], depth + 1);
|
|
@@ -2707,25 +2706,26 @@ function lockedSourceVersion(directory, root, pkg, manager, expectedRunnerPackag
|
|
|
2707
2706
|
}
|
|
2708
2707
|
}
|
|
2709
2708
|
function unambiguousRunnerVersion(range) {
|
|
2710
|
-
if (!
|
|
2711
|
-
|
|
2709
|
+
if (!normalizeRange(range) || !isRangeSubset(range, "<5.0.0-0", { includePrerelease: true }) && !isRangeSubset(range, ">=5.0.0-0", { includePrerelease: true })) return;
|
|
2710
|
+
const minimum = findMinimumForRange(range);
|
|
2711
|
+
return minimum ? normalize$1(minimum) ?? void 0 : void 0;
|
|
2712
2712
|
}
|
|
2713
2713
|
function installedSourceVersion(directory, name, expectedPackage, expectedRange) {
|
|
2714
2714
|
const installed = detectPackageMetadata(directory, name);
|
|
2715
2715
|
if (!installed || expectedPackage && installed.name !== expectedPackage) return;
|
|
2716
|
-
if (expectedRange &&
|
|
2717
|
-
if (installed.name === "vitest") return
|
|
2716
|
+
if (expectedRange && normalizeRange(expectedRange) && !satisfies(installed.version, expectedRange, { includePrerelease: true })) return;
|
|
2717
|
+
if (installed.name === "vitest") return normalize$1(installed.version) ?? void 0;
|
|
2718
2718
|
const pkg = readJson(path.join(installed.path, "package.json"));
|
|
2719
2719
|
if (installed.name === LEGACY_RUNNER) {
|
|
2720
2720
|
const version = record(pkg.peerDependencies)?.["@vitest/ui"];
|
|
2721
|
-
return typeof version === "string" ?
|
|
2721
|
+
return typeof version === "string" ? normalize$1(version) ?? void 0 : void 0;
|
|
2722
2722
|
}
|
|
2723
2723
|
if (installed.name !== "vite-plus") return;
|
|
2724
2724
|
const bundled = dependency(pkg, "vitest");
|
|
2725
2725
|
if (bundled?.startsWith("catalog:")) return installedSourceVersion(installed.path, "vitest");
|
|
2726
|
-
if (bundled &&
|
|
2726
|
+
if (bundled && normalizeRange(bundled)) {
|
|
2727
2727
|
const version = installedSourceVersion(installed.path, "vitest");
|
|
2728
|
-
return version &&
|
|
2728
|
+
return version && satisfies(version, bundled, { includePrerelease: true }) ? version : unambiguousRunnerVersion(bundled);
|
|
2729
2729
|
}
|
|
2730
2730
|
return dependency(pkg, LEGACY_RUNNER) ? installedSourceVersion(installed.path, LEGACY_RUNNER) : void 0;
|
|
2731
2731
|
}
|
|
@@ -2747,11 +2747,11 @@ function sourceVersion(directory, root, pkg, manager) {
|
|
|
2747
2747
|
}
|
|
2748
2748
|
const expectedRunnerPackage = legacyAlias ? LEGACY_RUNNER : void 0;
|
|
2749
2749
|
const locked = lockedSourceVersion(directory, root, pkg, manager, expectedRunnerPackage);
|
|
2750
|
-
if (locked && (!spec || legacyAlias || !
|
|
2750
|
+
if (locked && (!spec || legacyAlias || !normalizeRange(spec) || satisfies(locked, spec, { includePrerelease: true }))) return locked;
|
|
2751
2751
|
const installed = installedSourceVersion(directory, "vitest", expectedRunnerPackage);
|
|
2752
|
-
if (installed && (!spec || legacyAlias ||
|
|
2752
|
+
if (installed && (!spec || legacyAlias || satisfies(installed, spec, { includePrerelease: true }))) return installed;
|
|
2753
2753
|
if (legacyAlias) return "4.0.0";
|
|
2754
|
-
if (spec &&
|
|
2754
|
+
if (spec && normalizeRange(spec)) return unambiguousRunnerVersion(spec);
|
|
2755
2755
|
if (vitePlus) {
|
|
2756
2756
|
const bundled = installedSourceVersion(directory, "vite-plus", "vite-plus", vitePlusRange);
|
|
2757
2757
|
if (bundled) return bundled;
|
|
@@ -2767,21 +2767,21 @@ function checkNodeRange(file, value, label, findings, publicContract = false) {
|
|
|
2767
2767
|
"node",
|
|
2768
2768
|
"stable"
|
|
2769
2769
|
].includes(value)) return;
|
|
2770
|
-
const range =
|
|
2770
|
+
const range = normalizeRange(value);
|
|
2771
2771
|
if (publicContract && range) {
|
|
2772
|
-
const minimum =
|
|
2772
|
+
const minimum = findMinimumForRange(range);
|
|
2773
2773
|
if (minimum) {
|
|
2774
2774
|
const majorRange = `${minimum.major}.x`;
|
|
2775
|
-
if (
|
|
2775
|
+
if (satisfies(minimum, engines.node) || isRangeSubset(majorRange, range) && rangesIntersect(majorRange, engines.node)) return;
|
|
2776
2776
|
}
|
|
2777
2777
|
}
|
|
2778
2778
|
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
|
|
2779
|
+
if (range && !publicContract && !rangesIntersect(range, engines.node)) {
|
|
2780
|
+
const current = findMinimumForRange(range);
|
|
2781
|
+
const upgrade = current && rangeToComparators(engines.node).map((comparators) => findMinimumForRange(comparators.join(" "))).filter((version) => version !== null).toSorted(compare).find((version) => isGreaterThanOrEqual(version, current));
|
|
2782
|
+
if (upgrade) return normalize$1(upgrade) ?? void 0;
|
|
2783
2783
|
} else if (range) {
|
|
2784
|
-
if (
|
|
2784
|
+
if (isRangeSubset(range, engines.node) || !publicContract && !/[<>|*]/.test(value)) return;
|
|
2785
2785
|
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
2786
|
}
|
|
2787
2787
|
findings.push(finding(file, "node-runtime", message));
|
|
@@ -2923,14 +2923,14 @@ function planVitestV5Migration(workspace, originalProjects) {
|
|
|
2923
2923
|
const version = original ? original.sourceVersion : sourceVersion(directory, workspace.rootDir, pkg, workspace.packageManager);
|
|
2924
2924
|
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
2925
|
const options = {
|
|
2926
|
-
preserveV4: original?.options.preserveV4 ?? (!!version &&
|
|
2927
|
-
reviewV4: !!version &&
|
|
2926
|
+
preserveV4: original?.options.preserveV4 ?? (!!version && getMajor(version) < 5),
|
|
2927
|
+
reviewV4: !!version && getMajor(version) < 5,
|
|
2928
2928
|
browser: [...sources.values()].some((source) => BROWSER_SIGNAL.test(source)),
|
|
2929
2929
|
browserPossible,
|
|
2930
2930
|
temporalPolyfill: [...sources.values()].some((source) => /(?:['"]temporal-polyfill\/global['"]|(?:globalThis|global)\.Temporal\s*=|Object\.(?:assign|defineProperty)\(globalThis,\s*(?:\{\s*Temporal|['"]Temporal['"]))/.test(source))
|
|
2931
2931
|
};
|
|
2932
2932
|
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 &&
|
|
2933
|
+
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
2934
|
const project = {
|
|
2935
2935
|
directory,
|
|
2936
2936
|
sourceVersion: version,
|
|
@@ -3726,15 +3726,15 @@ function showMigrationSummary(options) {
|
|
|
3726
3726
|
async function downloadSupportedPackageManager(options) {
|
|
3727
3727
|
const { rootDir, packageManager, packageManagerVersion, interactive, updateMigrationProgress, failMigrationProgress } = options;
|
|
3728
3728
|
updateMigrationProgress("Preparing migration");
|
|
3729
|
-
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, interactive, true);
|
|
3730
|
-
if (packageManager === PackageManager.yarn &&
|
|
3729
|
+
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, interactive, true, rootDir);
|
|
3730
|
+
if (packageManager === PackageManager.yarn && satisfies(downloadResult.version, ">=4.0.0 <4.10.0")) {
|
|
3731
3731
|
updateMigrationProgress("Upgrading Yarn");
|
|
3732
3732
|
await upgradeYarn(rootDir, interactive, true);
|
|
3733
|
-
} else if (packageManager === PackageManager.pnpm &&
|
|
3733
|
+
} else if (packageManager === PackageManager.pnpm && satisfies(downloadResult.version, "< 9.5.0")) {
|
|
3734
3734
|
failMigrationProgress("Migration failed");
|
|
3735
3735
|
log$1.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
3736
3736
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
3737
|
-
} else if (packageManager === PackageManager.npm &&
|
|
3737
|
+
} else if (packageManager === PackageManager.npm && satisfies(downloadResult.version, "< 8.3.0")) {
|
|
3738
3738
|
failMigrationProgress("Migration failed");
|
|
3739
3739
|
log$1.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
3740
3740
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
@@ -3837,10 +3837,10 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, vi
|
|
|
3837
3837
|
}
|
|
3838
3838
|
if (plan.migratePrettier) {
|
|
3839
3839
|
updateMigrationProgress("Migrating Prettier");
|
|
3840
|
-
if (
|
|
3840
|
+
if (await migratePrettierToOxfmt(workspaceInfo.rootDir, interactive, plan.prettierConfigFile, workspaceInfo.packages, {
|
|
3841
3841
|
silent: true,
|
|
3842
3842
|
report
|
|
3843
|
-
})) {
|
|
3843
|
+
}) === "failed") {
|
|
3844
3844
|
failMigrationProgress("Migration failed");
|
|
3845
3845
|
cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
3846
3846
|
}
|
|
@@ -3897,7 +3897,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, vi
|
|
|
3897
3897
|
clearMigrationProgress();
|
|
3898
3898
|
const initialInstallDurationMs = handleInstallResult(initialInstallSummary, workspaceInfo.rootDir, report, { propagateExitCode: false });
|
|
3899
3899
|
const finalInstallDurationMs = handleInstallResult(finalInstallSummary, workspaceInfo.rootDir, report);
|
|
3900
|
-
if (finalInstallSummary.status === "installed" && canFormatWithOxfmt(plan.hasPrettierDependency,
|
|
3900
|
+
if (finalInstallSummary.status === "installed" && canFormatWithOxfmt(plan.hasPrettierDependency, report.prettierMigrated)) await formatMigratedProject(workspaceInfo.rootDir, interactive, report, { excludedPaths: preExistingChangedPaths });
|
|
3901
3901
|
return {
|
|
3902
3902
|
installDurationMs: initialInstallDurationMs + finalInstallDurationMs,
|
|
3903
3903
|
finalInstallOk: finalInstallSummary.status === "installed",
|
|
@@ -3908,6 +3908,10 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, vi
|
|
|
3908
3908
|
async function main() {
|
|
3909
3909
|
const { projectPath, options } = parseArgs();
|
|
3910
3910
|
printHeader();
|
|
3911
|
+
if (!fs.existsSync(path.join(projectPath, "package.json"))) {
|
|
3912
|
+
const target = displayRelative(projectPath) || ".";
|
|
3913
|
+
cancelAndExit(`Cannot migrate ${target}: no package.json found. Run vp migrate from a project root or pass its path explicitly.`, 1);
|
|
3914
|
+
}
|
|
3911
3915
|
const workspaceInfoOptional = await detectWorkspace$1(projectPath);
|
|
3912
3916
|
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
3917
|
const initialChangedPaths = await collectChangedFormatPaths(workspaceInfoOptional.rootDir);
|
|
@@ -3920,6 +3924,7 @@ async function main() {
|
|
|
3920
3924
|
cancelAndExit("Resolve the blocking Vitest v5 findings, then re-run `vp migrate`. No project files were changed.", 1);
|
|
3921
3925
|
}
|
|
3922
3926
|
const rootPkg = readNearestPackageJson(workspaceInfoOptional.rootDir);
|
|
3927
|
+
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
3928
|
if (hasVitePlusDependency(rootPkg) && !isForceOverrideMode()) {
|
|
3924
3929
|
let convertYarnPnp = await confirmYarnNodeModulesMode(workspaceInfoOptional.rootDir, workspaceInfoOptional.packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive);
|
|
3925
3930
|
let didMigrate = vitestV5NeedsMigration(vitestV5Plan);
|
|
@@ -4043,14 +4048,15 @@ async function main() {
|
|
|
4043
4048
|
if (await confirmPrettierMigration(options.interactive)) {
|
|
4044
4049
|
await ensureExistingPackageManager();
|
|
4045
4050
|
updateMigrationProgress("Migrating Prettier");
|
|
4046
|
-
|
|
4051
|
+
const prettierResult = await migratePrettierToOxfmt(workspaceInfoOptional.rootDir, options.interactive, prettierProject.configFile, workspaceInfoOptional.packages, {
|
|
4047
4052
|
silent: true,
|
|
4048
4053
|
report
|
|
4049
|
-
})
|
|
4054
|
+
});
|
|
4055
|
+
if (prettierResult === "failed") {
|
|
4050
4056
|
clearMigrationProgress();
|
|
4051
4057
|
cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
4052
4058
|
}
|
|
4053
|
-
prettierMigrated =
|
|
4059
|
+
prettierMigrated = prettierResult === "migrated";
|
|
4054
4060
|
}
|
|
4055
4061
|
} else if (prettierProject.hasDependency) warnPackageLevelPrettier();
|
|
4056
4062
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as VITE_PLUS_NAME } from "./constants-
|
|
1
|
+
import { u as VITE_PLUS_NAME } from "./constants-BW3g7VnD.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-BW3g7VnD.js";
|
|
2
|
+
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-Dx-ZY2MN.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
|
-
import { t as cac } from "./dist-
|
|
3
|
-
import { o as resolveViteConfig } from "./resolve-vite-config-
|
|
2
|
+
import { t as cac } from "./dist-Cqz8OtiO.js";
|
|
3
|
+
import { o as resolveViteConfig } from "./resolve-vite-config-x47JetlI.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-BW3g7VnD.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 };
|