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.
Files changed (85) hide show
  1. package/LICENSE +59 -6
  2. package/README.md +7 -7
  3. package/binding/index.cjs +54 -55
  4. package/binding/index.d.cts +53 -12
  5. package/dist/{agent-CKMI1a8W.js → agent-KeDc6vmg.js} +2 -2
  6. package/dist/bin.js +14 -11
  7. package/dist/command-DaRqSNpP.js +1 -0
  8. package/dist/comparison-CmVirWIW-DUGaiYqF.js +121 -0
  9. package/dist/config/bin.js +4 -4
  10. package/dist/{constants-BqJiMVVU.js → constants-BW3g7VnD.js} +3 -3
  11. package/dist/create/bin.d.ts +2 -1
  12. package/dist/create/bin.js +126 -26
  13. package/dist/{define-config-Cf_5GHmY.d.ts → define-config-Bexdd6RZ.d.ts} +25 -9
  14. package/dist/{define-config-DhEJaYRc.js → define-config-CIlk9scU.js} +111 -6
  15. package/dist/{define-config-C_KGDLUZ.cjs → define-config-Dq_23Eyr.cjs} +89 -3
  16. package/dist/define-config.cjs +1 -1
  17. package/dist/define-config.d.ts +1 -1
  18. package/dist/define-config.js +1 -2
  19. package/dist/{dist-BsAzy8OW.js → dist-Bi7ZEK3c.js} +1 -2
  20. package/dist/dist-CBWGibx8.js +3 -0
  21. package/dist/{dist-DfmT__Aw.js → dist-Cqz8OtiO.js} +24 -21
  22. package/dist/{editor-CHfGUhxP.js → editor-b1XUwt9v.js} +114 -65
  23. package/dist/fmt.js +1 -2
  24. package/dist/hooks/bin.js +1 -1
  25. package/dist/{hooks-C-4gykWR.js → hooks-DhwsWb46.js} +34 -22
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/lint-plugins-dev.js +1 -2
  30. package/dist/lint-plugins.cjs +1 -1
  31. package/dist/lint-plugins.js +1 -2
  32. package/dist/migration/bin.js +63 -57
  33. package/dist/{oxlint-plugin-config-lMMD5fAC.js → oxlint-plugin-config-Dx-ZY2MN.js} +1 -1
  34. package/dist/oxlint-plugin.js +2 -2
  35. package/dist/pack-bin.js +4 -3
  36. package/dist/{package-Cgdlhamw.js → package-BP16iQby.js} +7 -2
  37. package/dist/package-overrides-D1RcXSFl.js +411 -0
  38. package/dist/{prompts-jMH8S4Wp.js → prompts-BGpQtC5z.js} +548 -262
  39. package/dist/resolve-vite-config-CGzlyhGr.js +1 -0
  40. package/dist/{resolve-vite-config-BJYYtfY3.js → resolve-vite-config-x47JetlI.js} +2 -2
  41. package/dist/staged/bin.js +792 -743
  42. package/dist/sync-versions/bin.js +4761 -3373
  43. package/dist/sync-versions/bin.mjs +5304 -5083
  44. package/dist/test/browser/providers/playwright.d.ts +7 -2
  45. package/dist/test/browser-playwright.d.ts +7 -2
  46. package/dist/toolchain.js +12 -12
  47. package/dist/toolchain.json +12 -12
  48. package/dist/tsconfig-C5PnJfW4.js +1 -0
  49. package/dist/{tsconfig-BoYTBNX_.js → tsconfig-D2DzAQ_D.js} +2 -2
  50. package/dist/version.js +2 -2
  51. package/dist/versions.js +7 -7
  52. package/docs/config/run.md +9 -5
  53. package/docs/config/staged.md +1 -1
  54. package/docs/guide/automatic-data-tracking.md +7 -6
  55. package/docs/guide/cache.md +3 -3
  56. package/docs/guide/check.md +7 -7
  57. package/docs/guide/ci.md +3 -4
  58. package/docs/guide/commit-hooks.md +3 -1
  59. package/docs/guide/create.md +14 -4
  60. package/docs/guide/env.md +19 -7
  61. package/docs/guide/github-actions-cache.md +2 -4
  62. package/docs/guide/global-cli.md +36 -10
  63. package/docs/guide/ide-integration.md +4 -2
  64. package/docs/guide/implode.md +2 -0
  65. package/docs/guide/index.md +8 -8
  66. package/docs/guide/local-cli.md +27 -11
  67. package/docs/guide/migrate-rules.md +11 -3
  68. package/docs/guide/migrate.md +11 -11
  69. package/docs/guide/{install.md → package-management.md} +28 -4
  70. package/docs/guide/run.md +10 -8
  71. package/docs/guide/test.md +3 -1
  72. package/docs/guide/troubleshooting.md +9 -7
  73. package/docs/guide/upgrade-project.md +2 -6
  74. package/docs/guide/upgrade.md +6 -0
  75. package/docs/guide/vitest-v5.md +2 -2
  76. package/docs/guide/vpx.md +5 -5
  77. package/package.json +37 -33
  78. package/templates/generator/bin/index.ts +0 -0
  79. package/templates/generator/package.json +2 -2
  80. package/templates/generator/src/template.ts +1 -0
  81. package/dist/command-CLJK5jGW.js +0 -2
  82. package/dist/dist-BWiANxFS.js +0 -8052
  83. package/dist/package-overrides-Dpn4scvN.js +0 -17
  84. package/dist/resolve-vite-config-BPgpYMYp.js +0 -2
  85. package/dist/tsconfig-CmKidmRD.js +0 -2
@@ -1,2 +1 @@
1
- import { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
2
- export { definePlugin, defineRule, eslintCompatPlugin };
1
+ export { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
@@ -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-BqJiMVVU.js";
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 readNearestPackageJson, i as hasVitePlusDependency, n as detectPackageMetadata } from "../package-Cgdlhamw.js";
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 { E as spinner, S as log$1, T as select, b as confirm, c as selectPackageManager, i as promptGitHooks, k as isCancel, l as upgradeYarn, n as defaultInteractive, o as runViteFmt, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, w as outro, y as PackageManager } from "../prompts-jMH8S4Wp.js";
9
- import { n as require_semver, t as require_dist } from "../dist-BWiANxFS.js";
10
- import { i as selectAgentTargetPaths, l as displayRelative, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-CKMI1a8W.js";
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-CHfGUhxP.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-b1XUwt9v.js";
13
13
  import { n as runCommandSilently } from "../command-CguLh2KL.js";
14
- import { a as hasBaseUrlInTsconfig, i as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-BoYTBNX_.js";
15
- import { t as extractOverrideTargetName } from "../package-overrides-Dpn4scvN.js";
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 = import_semver.default.validRange(range);
1080
+ const validRange = normalizeRange(range);
1082
1081
  if (!validRange && !/^[\w.-]+$/.test(range)) return;
1083
1082
  function valid(version) {
1084
- if (typeof version !== "string" || !import_semver.default.valid(version)) return;
1085
- return !validRange || import_semver.default.satisfies(version, range, { includePrerelease: true }) ? version : void 0;
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 (!import_semver.default.validRange(spec)) return;
2373
- const branches = new import_semver.default.Range(spec).set.map((set) => set.map((item) => item.value).join(" "));
2371
+ if (!normalizeRange(spec)) return;
2372
+ const branches = rangeToComparators(spec).map((set) => set.join(" "));
2374
2373
  if (branches.every((branch) => {
2375
- const min = import_semver.default.minVersion(branch);
2376
- return min && import_semver.default.gte(min, MIN_VERSION);
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) => import_semver.default.minVersion(branch) !== null);
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" && import_semver.default.valid(pkg.version) && import_semver.default.gte(pkg.version, MIN_VERSION)) return;
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" && import_semver.default.validRange(resolved)) {
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 && import_semver.default.valid(metadata.version)) {
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" ? import_semver.default.validRange(pin.startsWith(REGISTRY_ALIAS) ? pin.slice(REGISTRY_ALIAS.length) : pin) : null;
2549
- if (pinnedRange && !import_semver.default.intersects(pinnedRange, `>=${MIN_VERSION}`)) {
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" && import_semver.default.validRange(direct) && import_semver.default.validRange(after) && import_semver.default.intersects(direct, after)) {
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 (!import_semver.default.valid(version)) return;
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" ? import_semver.default.valid(runnerVersion) ?? void 0 : void 0;
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 (!import_semver.default.validRange(range) || !import_semver.default.subset(range, "<5.0.0-0", { includePrerelease: true }) && !import_semver.default.subset(range, ">=5.0.0-0", { includePrerelease: true })) return;
2711
- return import_semver.default.minVersion(range)?.version;
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 && import_semver.default.validRange(expectedRange) && !import_semver.default.satisfies(installed.version, expectedRange, { includePrerelease: true })) return;
2717
- if (installed.name === "vitest") return import_semver.default.valid(installed.version) ?? void 0;
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" ? import_semver.default.valid(version) ?? void 0 : void 0;
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 && import_semver.default.validRange(bundled)) {
2726
+ if (bundled && normalizeRange(bundled)) {
2727
2727
  const version = installedSourceVersion(installed.path, "vitest");
2728
- return version && import_semver.default.satisfies(version, bundled, { includePrerelease: true }) ? version : unambiguousRunnerVersion(bundled);
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 || !import_semver.default.validRange(spec) || import_semver.default.satisfies(locked, spec, { includePrerelease: true }))) return locked;
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 || import_semver.default.satisfies(installed, spec, { includePrerelease: true }))) return installed;
2752
+ if (installed && (!spec || legacyAlias || satisfies(installed, spec, { includePrerelease: true }))) return installed;
2753
2753
  if (legacyAlias) return "4.0.0";
2754
- if (spec && import_semver.default.validRange(spec)) return unambiguousRunnerVersion(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 = import_semver.default.validRange(value);
2770
+ const range = normalizeRange(value);
2771
2771
  if (publicContract && range) {
2772
- const minimum = import_semver.default.minVersion(range);
2772
+ const minimum = findMinimumForRange(range);
2773
2773
  if (minimum) {
2774
2774
  const majorRange = `${minimum.major}.x`;
2775
- if (import_semver.default.satisfies(minimum, engines.node) || import_semver.default.subset(majorRange, range) && import_semver.default.intersects(majorRange, engines.node)) return;
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 && !import_semver.default.intersects(range, engines.node)) {
2780
- const current = import_semver.default.minVersion(range);
2781
- const upgrade = current && new import_semver.default.Range(engines.node).set.map((comparators) => import_semver.default.minVersion(comparators.map(({ value }) => value).join(" "))).filter((version) => version !== null).toSorted(import_semver.default.compare).find((version) => import_semver.default.gte(version, current));
2782
- if (upgrade) return upgrade.version;
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 (import_semver.default.subset(range, engines.node) || !publicContract && !/[<>|*]/.test(value)) return;
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 && import_semver.default.major(version) < 5),
2927
- reviewV4: !!version && import_semver.default.major(version) < 5,
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 && import_semver.default.major(version) < 4) findings.push(finding(path.join(directory, "package.json"), "source-version", "Upgrade the original project to Vitest 4 before running this migration.", "block"));
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 && import_semver.default.satisfies(downloadResult.version, ">=4.0.0 <4.10.0")) {
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 && import_semver.default.satisfies(downloadResult.version, "< 9.5.0")) {
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 && import_semver.default.satisfies(downloadResult.version, "< 8.3.0")) {
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 (!await migratePrettierToOxfmt(workspaceInfo.rootDir, interactive, plan.prettierConfigFile, workspaceInfo.packages, {
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, plan.migratePrettier)) await formatMigratedProject(workspaceInfo.rootDir, interactive, report, { excludedPaths: preExistingChangedPaths });
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
- if (!await migratePrettierToOxfmt(workspaceInfoOptional.rootDir, options.interactive, prettierProject.configFile, workspaceInfoOptional.packages, {
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 = true;
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-BqJiMVVU.js";
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`;
@@ -1,5 +1,5 @@
1
- import { v as exports } from "./constants-BqJiMVVU.js";
2
- import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-lMMD5fAC.js";
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-DfmT__Aw.js";
3
- import { o as resolveViteConfig } from "./resolve-vite-config-BJYYtfY3.js";
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-BqJiMVVU.js";
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 { readNearestPackageJson as a, hasVitePlusDependency as i, detectPackageMetadata as n, fetchNpmResource as o, getScopeFromPackageName as r, getNpmRegistry as s, checkNpmPackageExists as t };
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 };