vite-plus 0.3.0 → 0.3.2

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 (95) hide show
  1. package/LICENSE +29 -29
  2. package/README.md +3 -3
  3. package/bin/vp +1 -1
  4. package/binding/index.cjs +60 -56
  5. package/binding/index.d.cts +137 -14
  6. package/dist/{agent-Wqx0MPk0.js → agent-C59HKB4Y.js} +3 -2
  7. package/dist/bin.js +90 -58
  8. package/dist/cli-parse-DHE8NrBU.js +13 -0
  9. package/dist/client/bundledDevClient.mjs +1 -1
  10. package/dist/client/client.mjs +1 -1
  11. package/dist/client/env.mjs +1 -1
  12. package/dist/client.d.ts +1 -1
  13. package/dist/config/bin.js +83 -55
  14. package/dist/{constants-Bn-U8o4v.js → constants-IhOditRA.js} +3 -3
  15. package/dist/create/bin.d.ts +13 -5
  16. package/dist/create/bin.js +50 -193
  17. package/dist/{define-config-GXUdVT-0.js → define-config-DAaCa0U_.js} +2 -2
  18. package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
  19. package/dist/{define-config-WiVlryJ2.cjs → define-config-DpAPETDf.cjs} +1 -1
  20. package/dist/define-config.cjs +1 -1
  21. package/dist/define-config.d.ts +1 -1
  22. package/dist/define-config.js +1 -1
  23. package/dist/dist-DfmT__Aw.js +619 -0
  24. package/dist/{editor-CC4DqODz.js → editor-QOIGtmH4.js} +205 -70
  25. package/dist/hooks/bin.js +9 -114
  26. package/dist/{hooks-DFqViZqZ.js → hooks-C-4gykWR.js} +1 -1
  27. package/dist/index.cjs +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +2 -2
  30. package/dist/internal.d.ts +1 -1
  31. package/dist/internal.js +1 -1
  32. package/dist/lint-plugins-dev.d.ts +3 -0
  33. package/dist/lint-plugins-dev.js +2 -0
  34. package/dist/lint-plugins.cjs +21 -0
  35. package/dist/lint-plugins.d.ts +3 -0
  36. package/dist/lint-plugins.js +2 -0
  37. package/dist/migration/bin.js +25 -144
  38. package/dist/migration/compat/worker.js +1 -1
  39. package/dist/module-runner.d.ts +1 -1
  40. package/dist/module-runner.js +1 -1
  41. package/dist/{oxlint-plugin-config-DX5ezKbB.js → oxlint-plugin-config-BU42tr8y.js} +1 -1
  42. package/dist/oxlint-plugin.d.ts +2 -2
  43. package/dist/oxlint-plugin.js +93 -32
  44. package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
  45. package/dist/pack-bin.d.ts +2 -3
  46. package/dist/pack-bin.js +5 -622
  47. package/dist/pack-client.d.ts +1 -1
  48. package/dist/pack.d.ts +2 -2
  49. package/dist/pack.js +1 -1
  50. package/dist/{package-CBe9EWPY.js → package-BB-Jh_z3.js} +1 -1
  51. package/dist/{prompts-DF3yU-eU.js → prompts-CujFOJXu.js} +3 -1400
  52. package/dist/{report-ZNR1Mk6h.js → report-CK5TnTsr.js} +1 -0
  53. package/dist/resolve-vite-config-6Nox70uP.js +2 -0
  54. package/dist/{resolve-vite-config-ipGb39Jo.js → resolve-vite-config-CHHjsjKJ.js} +3 -3
  55. package/dist/semver-CaDAb8vV.js +1400 -0
  56. package/dist/staged/bin.js +83 -218
  57. package/dist/sync-versions/bin.d.ts +1 -0
  58. package/dist/sync-versions/bin.js +3884 -0
  59. package/dist/sync-versions/bin.mjs +13323 -0
  60. package/dist/toolchain.js +10 -10
  61. package/dist/toolchain.json +10 -10
  62. package/dist/{tsconfig-LD2QhQ0O.js → tsconfig-DCtWfQPA.js} +2 -2
  63. package/dist/{tsconfig-BVHG3DpR.js → tsconfig-MXktI3SX.js} +1 -1
  64. package/dist/tsgolint-path.d.ts +3 -4
  65. package/dist/types/customEvent.d.ts +1 -1
  66. package/dist/types/hmrPayload.d.ts +1 -1
  67. package/dist/types/hot.d.ts +1 -1
  68. package/dist/types/import-meta.d.ts +1 -1
  69. package/dist/types/importGlob.d.ts +1 -1
  70. package/dist/types/importMeta.d.ts +1 -1
  71. package/dist/types/metadata.d.ts +1 -1
  72. package/dist/version.d.ts +2 -3
  73. package/dist/version.js +2 -2
  74. package/dist/versions.js +5 -5
  75. package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
  76. package/docs/config/fmt.md +4 -2
  77. package/docs/config/lint.md +4 -2
  78. package/docs/guide/check.md +1 -0
  79. package/docs/guide/ci.md +42 -2
  80. package/docs/guide/env.md +148 -52
  81. package/docs/guide/fmt.md +3 -1
  82. package/docs/guide/ide-integration.md +14 -2
  83. package/docs/guide/index.md +1 -1
  84. package/docs/guide/install.md +4 -1
  85. package/docs/guide/installer-env-vars.md +45 -1
  86. package/docs/guide/lint.md +58 -1
  87. package/docs/guide/migrate-rules.md +95 -2
  88. package/docs/guide/migrate.md +1 -1
  89. package/docs/guide/monorepo.md +2 -0
  90. package/docs/guide/troubleshooting.md +14 -0
  91. package/package.json +27 -20
  92. package/templates/generator/README.md +14 -0
  93. package/templates/generator/bin/index.ts +54 -5
  94. package/dist/lib-L3DWSRQp.js +0 -75
  95. package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-DWoAkNdp.js";
1
+ import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-DPNEJxPz.js";
2
2
  import { TestProjectConfiguration, TestProjectInlineConfiguration, TestTagDefinition, TestUserConfig, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, ViteUserConfig, ViteUserConfigExport, ViteUserConfigFn, ViteUserConfigFnObject, ViteUserConfigFnPromise, WatcherTriggerPattern, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } from "vitest/config";
3
- export * from "@voidzero-dev/vite-plus-core";
3
+ export * from "vite";
4
4
  export { type TestProjectConfiguration, type TestProjectInlineConfiguration, type TestTagDefinition, type TestUserConfig, type UserProjectConfigExport, type UserProjectConfigFn, type UserWorkspaceConfig, type ViteUserConfig, type ViteUserConfigExport, type ViteUserConfigFn, type ViteUserConfigFnObject, type ViteUserConfigFnPromise, type WatcherTriggerPattern, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, lazyPlugins };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-GXUdVT-0.js";
1
+ import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-DAaCa0U_.js";
2
2
  import { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } from "vitest/config";
3
- export * from "@voidzero-dev/vite-plus-core";
3
+ export * from "vite";
4
4
  export { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, lazyPlugins };
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-core/internal';
1
+ export * from 'vite/internal';
package/dist/internal.js CHANGED
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-core/internal';
1
+ export * from 'vite/internal';
@@ -0,0 +1,3 @@
1
+ import { RuleTester } from "oxlint/plugins-dev";
2
+ export type * from "oxlint/plugins-dev";
3
+ export { RuleTester };
@@ -0,0 +1,2 @@
1
+ import { RuleTester } from "oxlint/plugins-dev";
2
+ export { RuleTester };
@@ -0,0 +1,21 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("./define-config-DpAPETDf.cjs");
3
+ let _oxlint_plugins = require("@oxlint/plugins");
4
+ Object.defineProperty(exports, "definePlugin", {
5
+ enumerable: true,
6
+ get: function() {
7
+ return _oxlint_plugins.definePlugin;
8
+ }
9
+ });
10
+ Object.defineProperty(exports, "defineRule", {
11
+ enumerable: true,
12
+ get: function() {
13
+ return _oxlint_plugins.defineRule;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "eslintCompatPlugin", {
17
+ enumerable: true,
18
+ get: function() {
19
+ return _oxlint_plugins.eslintCompatPlugin;
20
+ }
21
+ });
@@ -0,0 +1,3 @@
1
+ import { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
2
+ export type * from "@oxlint/plugins";
3
+ export { definePlugin, defineRule, eslintCompatPlugin };
@@ -0,0 +1,2 @@
1
+ import { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
2
+ export { definePlugin, defineRule, eslintCompatPlugin };
@@ -1,19 +1,20 @@
1
1
  import { r as __toESM } from "../rolldown-runtime-CMFfr-1z.js";
2
- import { t as renderCliDoc } from "../help-BmKpeOP9.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 { f as VITE_PLUS_VERSION, m as isForceOverrideMode } from "../constants-Bn-U8o4v.js";
5
- import { A as isCancel, C as log$1, D as spinner, E as select, T as outro, b as require_semver, c as selectPackageManager, i as promptGitHooks, l as upgradeYarn, n as defaultInteractive, o as runViteFmt, r as downloadPackageManager, s as runViteInstall, t as cancelAndExit, x as confirm, y as PackageManager } from "../prompts-DF3yU-eU.js";
6
- import { t as lib_default } from "../lib-L3DWSRQp.js";
3
+ import { a as SETUP_VP_VERSION, f as VITE_PLUS_VERSION, m as isForceOverrideMode } from "../constants-IhOditRA.js";
7
4
  import { a as writeJsonFile, i as readJsonFile } from "../json-cULBl7Pi.js";
8
- import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-CBe9EWPY.js";
9
- import { i as selectAgentTargetPaths, l as displayRelative, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-Wqx0MPk0.js";
10
- import { n as addMigrationWarning, r as createMigrationReport } from "../report-ZNR1Mk6h.js";
11
- import { $ as warnLegacyEslintConfig, A as detectWorkspace, C as mergeTsdownConfigFile, D as ensureVitePlusBootstrap, E as detectVitePlusBootstrapPending, F as detectFramework, H as confirmPrettierMigration, I as hasFrameworkShim, J as detectEslintProject, K as warnPackageLevelPrettier, L as confirmTsupMigration, O as configureYarnNodeModulesMode, P as addFrameworkShim, Q as warnIncompatibleEslintIntegration, R as detectTsupProject, S as injectLintTypeCheckDefaults, T as collectToolchainVersionChanges, U as detectPrettierProject, V as warnMissingTsupConfig, W as migratePrettierToOxfmt, X as migrateEslintToOxlint, Y as detectIncompatibleEslintIntegration, _ as preflightGitHooksSetup, d as finalizeCoreMigrationForExistingVitePlus, et as warnPackageLevelEslint, f as detectNodeVersionManagerFile, g as installGitHooks, h as detectLegacyGitHooksMigrationCandidate, i as selectEditor, k as detectYarnPnpMode, l as rewriteStandaloneProject, nt as checkVitestVersion, o as writeEditorConfigs, p as migrateNodeVersionManagerFile, q as confirmEslintMigration, r as isJsonLikeFile, s as rewriteMonorepo, t as detectEditorConflicts, tt as checkViteVersion, u as detectPendingCoreMigration, v as shouldSkipStagedMigrationForHooks, w as mergeViteConfigFiles, z as migrateTsupToTsdown } from "../editor-CC4DqODz.js";
5
+ import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-BB-Jh_z3.js";
6
+ 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-CujFOJXu.js";
7
+ import { t as require_semver } from "../semver-CaDAb8vV.js";
8
+ import { i as selectAgentTargetPaths, l as displayRelative, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-C59HKB4Y.js";
9
+ import { n as addMigrationWarning, r as createMigrationReport } from "../report-CK5TnTsr.js";
10
+ import { $ as warnIncompatibleEslintIntegration, A as detectYarnPnpMode, B as migrateTsupToTsdown, C as injectLintTypeCheckDefaults, D as detectVitePlusBootstrapPending, E as collectToolchainVersionChanges, F as addFrameworkShim, G as migratePrettierToOxfmt, H as warnMissingTsupConfig, I as detectFramework, J as confirmEslintMigration, L as hasFrameworkShim, O as ensureVitePlusBootstrap, R as confirmTsupMigration, T as mergeViteConfigFiles, U as confirmPrettierMigration, W as detectPrettierProject, X as detectIncompatibleEslintIntegration, Y as detectEslintProject, Z as migrateEslintToOxlint, _ as installGitHooks, d as finalizeCoreMigrationForExistingVitePlus, et as warnLegacyEslintConfig, f as detectNodeVersionManagerFile, g as detectLegacyGitHooksMigrationCandidate, i as selectEditor, j as detectWorkspace$1, k as configureYarnNodeModulesMode, l as rewriteStandaloneProject, m as migrateSetupVpVersion, nt as checkViteVersion, o as writeEditorConfigs, p as migrateNodeVersionManagerFile, q as warnPackageLevelPrettier, r as isJsonLikeFile, rt as checkVitestVersion, s as rewriteMonorepo, t as detectEditorConflicts, tt as warnPackageLevelEslint, u as detectPendingCoreMigration, v as preflightGitHooksSetup, w as mergeTsdownConfigFile, y as shouldSkipStagedMigrationForHooks, z as detectTsupProject } from "../editor-QOIGtmH4.js";
12
11
  import { n as runCommandSilently } from "../command-CguLh2KL.js";
13
- import { a as hasBaseUrlInTsconfig, i as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-LD2QhQ0O.js";
12
+ import { a as hasBaseUrlInTsconfig, i as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-DCtWfQPA.js";
13
+ import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
14
14
  import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../protocol-D99W10Qi.js";
15
15
  import path from "node:path";
16
16
  import { fileURLToPath } from "node:url";
17
+ import { parseMigrateArgs } from "../../binding/index.js";
17
18
  import { styleText } from "node:util";
18
19
  import fs, { existsSync } from "node:fs";
19
20
  //#region src/migration/compat/runner.ts
@@ -486,136 +487,12 @@ async function checkWorkspaceRolldownCompatibility(workspaceInfo, report, update
486
487
  await checkRolldownCompatibility(projectPath, report);
487
488
  }
488
489
  }
489
- const helpMessage = renderCliDoc({
490
- usage: "vp migrate [PATH] [OPTIONS]",
491
- summary: "Migrate standalone Vite, Vitest, Oxlint, Oxfmt, and Prettier projects to unified Vite+.",
492
- documentationUrl: "https://viteplus.dev/guide/migrate",
493
- sections: [
494
- {
495
- title: "Arguments",
496
- rows: [{
497
- label: "PATH",
498
- description: "Target directory to migrate (default: current directory)"
499
- }]
500
- },
501
- {
502
- title: "Options",
503
- rows: [
504
- {
505
- label: "--agent NAME",
506
- description: "Write coding agent instructions to AGENTS.md, CLAUDE.md, etc."
507
- },
508
- {
509
- label: "--no-agent",
510
- description: "Skip writing coding agent instructions"
511
- },
512
- {
513
- label: "--editor NAME",
514
- description: "Write editor config files into the project."
515
- },
516
- {
517
- label: "--no-editor",
518
- description: "Skip writing editor config files"
519
- },
520
- {
521
- label: "--hooks",
522
- description: "Set up pre-commit hooks (default in non-interactive mode)"
523
- },
524
- {
525
- label: "--no-hooks",
526
- description: "Skip pre-commit hooks setup"
527
- },
528
- {
529
- label: "--full",
530
- description: "Existing Vite+ projects: also run the full setup (hooks, editor, agent files, ESLint/Prettier migration, framework shims, tsconfig baseUrl, .node-version). Without it, `vp migrate` only upgrades the toolchain version."
531
- },
532
- {
533
- label: "--no-interactive",
534
- description: "Run in non-interactive mode (skip prompts and use defaults)"
535
- },
536
- {
537
- label: "-h, --help",
538
- description: "Show this help message"
539
- }
540
- ]
541
- },
542
- {
543
- title: "Examples",
544
- lines: [
545
- ` ${muted("# Migrate current package")}`,
546
- ` ${accent("vp migrate")}`,
547
- "",
548
- ` ${muted("# Migrate specific directory")}`,
549
- ` ${accent("vp migrate my-app")}`,
550
- "",
551
- ` ${muted("# Non-interactive mode")}`,
552
- ` ${accent("vp migrate --no-interactive")}`
553
- ]
554
- },
555
- {
556
- title: "Migration Prompt",
557
- lines: [
558
- " Give this to a coding agent when you want it to drive the migration:",
559
- "",
560
- " Migrate this project to Vite+.",
561
- " Vite+ replaces the current split tooling around runtime management, package",
562
- " management, dev/build/test commands, linting, formatting, and packaging.",
563
- " Run `vp help` and `vp help migrate` before making changes.",
564
- ` Use ${accent("vp migrate --no-interactive")} in the workspace root.`,
565
- " Make sure the project is using Vite 8+ and Vitest 4.1+ before migrating.",
566
- "",
567
- " After the migration:",
568
- " - Confirm `vite` imports were rewritten to `vite-plus` where needed",
569
- " - Confirm `vitest` imports were rewritten to `vite-plus/test` where needed",
570
- " - On pnpm, keep the `vite` / `vitest` entries that `vp migrate` aliased to",
571
- " the Vite+ packages so the workspace override stays effective; with other",
572
- " package managers you can remove them once those rewrites are confirmed",
573
- " - Move remaining tool-specific config into the appropriate blocks in",
574
- " `vite.config.ts`",
575
- "",
576
- " Command mapping:",
577
- " - `vp run <script>` is the equivalent of `pnpm run <script>`",
578
- " - `vp dev` and `vp test` always run the built-ins; `vp run dev` and",
579
- " `vp run test` run the `dev` and `test` scripts from `package.json`",
580
- " - `vp install`, `vp add`, and `vp remove` delegate through the package",
581
- " manager declared by `packageManager`",
582
- " - `vp dev`, `vp build`, `vp preview`, `vp lint`, `vp fmt`, `vp check`,",
583
- " and `vp pack` replace the corresponding standalone tools",
584
- " - Prefer `vp check` for validation loops",
585
- "",
586
- " Finally, verify the migration by running:",
587
- ` - ${accent("vp install")}`,
588
- ` - ${accent("vp check")}`,
589
- ` - ${accent("vp test")}`,
590
- ` - ${accent("vp build")}`,
591
- "",
592
- " Summarize the migration at the end and report any manual follow-up still",
593
- " required."
594
- ]
595
- }
596
- ]
597
- });
598
490
  function parseArgs() {
599
- const args = process.argv.slice(3);
600
- const parsed = lib_default(args, {
601
- alias: { h: "help" },
602
- boolean: [
603
- "help",
604
- "interactive",
605
- "hooks",
606
- "full"
607
- ],
608
- default: { interactive: defaultInteractive() }
609
- });
610
- const interactive = parsed.interactive;
611
- let projectPath = parsed._[0];
612
- if (projectPath) projectPath = path.resolve(process.cwd(), projectPath);
613
- else projectPath = process.cwd();
491
+ const parsed = unwrapCliParseOutcome(parseMigrateArgs(process.argv.slice(3)));
614
492
  return {
615
- projectPath,
493
+ projectPath: parsed.path ? path.resolve(process.cwd(), parsed.path) : process.cwd(),
616
494
  options: {
617
- interactive,
618
- help: parsed.help,
495
+ interactive: parsed.interactive ?? defaultInteractive(),
619
496
  agent: parsed.agent,
620
497
  editor: parsed.editor,
621
498
  hooks: parsed.hooks,
@@ -763,6 +640,11 @@ function showMigrationSummary(options) {
763
640
  if (report.prettierMigrated) log(`${styleText("gray", "•")} Prettier migrated to Oxfmt`);
764
641
  if (report.tsupMigrated) log(`${styleText("gray", "•")} tsup config migrated to tsdown (\`vp pack\`)`);
765
642
  if (report.nodeVersionFileMigrated) log(`${styleText("gray", "•")} Node version manager file migrated to .node-version`);
643
+ const setupVpFileCount = report.setupVpVersionUpdatedFileCount;
644
+ if (setupVpFileCount > 0) {
645
+ const fileLabel = setupVpFileCount === 1 ? "file" : "files";
646
+ log(`${styleText("gray", "•")} setup-vp updated to ${SETUP_VP_VERSION} in ${setupVpFileCount} GitHub Actions ${fileLabel}`);
647
+ }
766
648
  if (report.wrappedPluginConfigCount > 0) log(`${styleText("gray", "•")} Inline Vite plugins wrapped with lazyPlugins for check/lint/fmt`);
767
649
  if (report.gitHooksConfigured) log(`${styleText("gray", "•")} Git hooks configured`);
768
650
  if (report.frameworkShimAdded) log(`${styleText("gray", "•")} TypeScript shim added for framework component files`);
@@ -780,7 +662,7 @@ function showMigrationSummary(options) {
780
662
  async function downloadSupportedPackageManager(options) {
781
663
  const { rootDir, packageManager, packageManagerVersion, interactive, updateMigrationProgress, failMigrationProgress } = options;
782
664
  updateMigrationProgress("Preparing migration");
783
- const downloadResult = await downloadPackageManager(packageManager, packageManagerVersion, interactive, true);
665
+ const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, interactive, true);
784
666
  if (packageManager === PackageManager.yarn && import_semver.default.satisfies(downloadResult.version, ">=4.0.0 <4.10.0")) {
785
667
  updateMigrationProgress("Upgrading Yarn");
786
668
  await upgradeYarn(rootDir, interactive, true);
@@ -842,6 +724,8 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
842
724
  updateMigrationProgress("Migrating node version file");
843
725
  migrateNodeVersionManagerFile(workspaceInfo.rootDir, plan.nodeVersionDetection, report);
844
726
  }
727
+ updateMigrationProgress("Updating setup-vp workflows");
728
+ migrateSetupVpVersion(workspaceInfo.rootDir, report);
845
729
  updateMigrationProgress("Installing dependencies");
846
730
  const initialInstallSummary = await runViteInstall(workspaceInfo.rootDir, interactive, void 0, {
847
731
  silent: true,
@@ -936,13 +820,8 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
936
820
  }
937
821
  async function main() {
938
822
  const { projectPath, options } = parseArgs();
939
- if (options.help) {
940
- printHeader();
941
- log(helpMessage);
942
- return;
943
- }
944
823
  printHeader();
945
- const workspaceInfoOptional = await detectWorkspace(projectPath);
824
+ const workspaceInfoOptional = await detectWorkspace$1(projectPath);
946
825
  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);
947
826
  const initialChangedPaths = await collectChangedFormatPaths(workspaceInfoOptional.rootDir);
948
827
  const preExistingChangedPaths = initialChangedPaths ? new Set(initialChangedPaths) : void 0;
@@ -978,6 +857,8 @@ async function main() {
978
857
  migrationProgressStarted = false;
979
858
  }
980
859
  };
860
+ updateMigrationProgress("Updating setup-vp workflows");
861
+ if (migrateSetupVpVersion(workspaceInfoOptional.rootDir, report).length > 0) didMigrate = true;
981
862
  const pendingCoreMigration = detectPendingCoreMigration(workspaceInfoOptional);
982
863
  const vitePlusBootstrapPending = detectVitePlusBootstrapPending(workspaceInfoOptional.rootDir, workspaceInfoOptional.packageManager, workspaceInfoOptional.packages, workspaceInfoOptional.packageManagerVersion);
983
864
  let packageManager = vitePlusBootstrapPending ? workspaceInfoOptional.packageManager ?? await selectPackageManager(options.interactive, true) : workspaceInfoOptional.packageManager;
@@ -1006,7 +887,7 @@ async function main() {
1006
887
  report.dependencyUpgrades = await collectToolchainVersionChanges(workspaceInfoOptional.rootDir);
1007
888
  updateMigrationProgress("Rewriting toolchain imports across the workspace");
1008
889
  const coreMigrationResult = finalizeCoreMigrationForExistingVitePlus(workspaceInfoOptional, true, report, pendingCoreMigration);
1009
- if (coreMigrationResult.scripts || coreMigrationResult.tsconfigTypes || coreMigrationResult.imports) didMigrate = true;
890
+ if (coreMigrationResult.scripts || coreMigrationResult.tsconfigTypes || coreMigrationResult.imports || coreMigrationResult.tsdownConfig) didMigrate = true;
1010
891
  clearMigrationProgress();
1011
892
  const fullSetup = options.full === true;
1012
893
  const skippedSetupCandidates = !fullSetup && !hasExplicitExistingVitePlusSetupRequest(options) && hasExistingVitePlusMigrationCandidates(workspaceInfoOptional, options);
@@ -1,4 +1,4 @@
1
- import { n as addMigrationWarning, r as createMigrationReport } from "../../report-ZNR1Mk6h.js";
1
+ import { n as addMigrationWarning, r as createMigrationReport } from "../../report-CK5TnTsr.js";
2
2
  import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../../protocol-D99W10Qi.js";
3
3
  import { writeSync } from "node:fs";
4
4
  //#region src/migration/compat/manual-chunks.ts
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-core/module-runner';
1
+ export * from 'vite/module-runner';
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-core/module-runner';
1
+ export * from 'vite/module-runner';
@@ -1,4 +1,4 @@
1
- import { u as VITE_PLUS_NAME } from "./constants-Bn-U8o4v.js";
1
+ import { u as VITE_PLUS_NAME } from "./constants-IhOditRA.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,6 +1,6 @@
1
1
  //#region src/oxlint-plugin.d.ts
2
2
  declare function rewriteVitePlusImportSpecifier(specifier: string): string | null;
3
- declare const preferVitePlusImportsRule: import("@oxlint/plugins").Rule;
3
+ export declare const preferVitePlusImportsRule: import("@oxlint/plugins").Rule;
4
4
  declare const plugin: import("@oxlint/plugins").Plugin;
5
5
  //#endregion
6
- export { plugin as default, preferVitePlusImportsRule, rewriteVitePlusImportSpecifier };
6
+ export { plugin as default, rewriteVitePlusImportSpecifier };
@@ -1,4 +1,4 @@
1
- import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-DX5ezKbB.js";
1
+ import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-BU42tr8y.js";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs";
4
4
  import { definePlugin, defineRule } from "@oxlint/plugins";
@@ -23,12 +23,33 @@ function isVitestFamilyDeclareModuleSpecifier(specifier) {
23
23
  return specifier === "vitest" || specifier.startsWith("vitest/") || specifier === "@vitest/browser" || specifier.startsWith("@vitest/browser/") || specifier.startsWith("@vitest/browser-");
24
24
  }
25
25
  const VITE_CONFIG_FILE_BASENAMES = new Set(vite_config_entry_basenames_default);
26
+ function isOxlintFamilyDeclareModuleSpecifier(specifier) {
27
+ return specifier === OXLINT_PACKAGE || specifier.startsWith(`${OXLINT_PACKAGE}/`) || specifier === OXLINT_PLUGINS_PACKAGE;
28
+ }
26
29
  function isViteSpecifier(specifier) {
27
30
  return specifier === "vite" || specifier.startsWith("vite/");
28
31
  }
29
32
  function isViteConfigFile(filename) {
30
33
  return VITE_CONFIG_FILE_BASENAMES.has(path.basename(filename));
31
34
  }
35
+ const OXLINT_PACKAGE = "oxlint";
36
+ const OXLINT_PLUGINS_PACKAGE = "@oxlint/plugins";
37
+ const OXLINT_PLUGINS_DEV_SUBPATH = "oxlint/plugins-dev";
38
+ const VITE_PLUS_LINT_PLUGINS = "vite-plus/lint/plugins";
39
+ const VITE_PLUS_LINT_PLUGINS_DEV = "vite-plus/lint/plugins-dev";
40
+ const OXLINT_CONFIG_SURFACE_EXPORTS = /* @__PURE__ */ new Set([
41
+ "defineConfig",
42
+ "AllowWarnDeny",
43
+ "DummyRule",
44
+ "DummyRuleMap",
45
+ "ExternalPluginEntry",
46
+ "ExternalPluginsConfig",
47
+ "OxlintConfig",
48
+ "OxlintEnv",
49
+ "OxlintGlobals",
50
+ "OxlintOverride",
51
+ "RuleCategories"
52
+ ]);
32
53
  function rewriteVitePlusImportSpecifier(specifier) {
33
54
  if (specifier === "vite") return "vite-plus";
34
55
  if (specifier.startsWith("vite/")) return `vite-plus/${specifier.slice(5)}`;
@@ -54,17 +75,26 @@ function rewriteVitePlusImportSpecifier(specifier) {
54
75
  if (specifier === `${prefix}/context`) return "vite-plus/test/browser/context";
55
76
  if (specifier === `${prefix}/provider`) return `vite-plus/test/browser/providers/${provider}`;
56
77
  }
78
+ if (specifier === OXLINT_PLUGINS_PACKAGE) return VITE_PLUS_LINT_PLUGINS;
79
+ if (specifier === OXLINT_PLUGINS_DEV_SUBPATH) return VITE_PLUS_LINT_PLUGINS_DEV;
57
80
  return null;
58
81
  }
82
+ function moduleBindingName(node) {
83
+ return node.type === "Identifier" ? node.name : node.value;
84
+ }
85
+ function importsOxlintPluginApi(node) {
86
+ return node.specifiers.length > 0 && node.specifiers.every((specifier) => specifier.type === "ImportSpecifier" && !OXLINT_CONFIG_SURFACE_EXPORTS.has(moduleBindingName(specifier.imported)));
87
+ }
59
88
  function quoteSpecifier(literal, replacement) {
60
89
  const quote = literal.raw?.startsWith("'") ? "'" : "\"";
61
90
  return `${quote}${replacement}${quote}`;
62
91
  }
63
92
  const nuxtTestUtilsPackageCache = /* @__PURE__ */ new Map();
93
+ const oxlintOwnerPackageCache = /* @__PURE__ */ new Map();
64
94
  function isUpstreamVitestSpecifier(specifier) {
65
95
  return specifier === "vitest" || specifier.startsWith("vitest/");
66
96
  }
67
- function nearestPackageUsesNuxtTestUtils(filename) {
97
+ function nearestPackageMatches(filename, cache, matchesPackage) {
68
98
  if (!path.isAbsolute(filename)) return false;
69
99
  let directory = path.dirname(filename);
70
100
  while (true) {
@@ -74,34 +104,34 @@ function nearestPackageUsesNuxtTestUtils(filename) {
74
104
  try {
75
105
  mtimeMs = fs.statSync(packageJsonPath).mtimeMs;
76
106
  } catch {}
77
- const cached = mtimeMs === void 0 ? void 0 : nuxtTestUtilsPackageCache.get(packageJsonPath);
78
- if (cached !== void 0 && cached.mtimeMs === mtimeMs) return cached.usesNuxtTestUtils;
79
- let usesNuxtTestUtils = false;
107
+ const cached = mtimeMs === void 0 ? void 0 : cache.get(packageJsonPath);
108
+ if (cached !== void 0 && cached.mtimeMs === mtimeMs) return cached.matches;
109
+ let matches = false;
80
110
  try {
81
- const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
82
- usesNuxtTestUtils = [
83
- pkg.dependencies,
84
- pkg.devDependencies,
85
- pkg.optionalDependencies
86
- ].some((dependencies) => dependencies?.["@nuxt/test-utils"] !== void 0);
111
+ matches = matchesPackage(JSON.parse(fs.readFileSync(packageJsonPath, "utf8")));
87
112
  } catch {}
88
- if (mtimeMs !== void 0) nuxtTestUtilsPackageCache.set(packageJsonPath, {
113
+ if (mtimeMs !== void 0) cache.set(packageJsonPath, {
89
114
  mtimeMs,
90
- usesNuxtTestUtils
115
+ matches
91
116
  });
92
- return usesNuxtTestUtils;
117
+ return matches;
93
118
  }
94
119
  const parent = path.dirname(directory);
95
120
  if (parent === directory) return false;
96
121
  directory = parent;
97
122
  }
98
123
  }
99
- function maybeReportLiteral(context, literal, preserveUpstreamVitest = false, fileIsViteConfig = false) {
100
- if (!literal || literal.type !== "Literal" || typeof literal.value !== "string") return;
101
- if (preserveUpstreamVitest && isUpstreamVitestSpecifier(literal.value)) return;
102
- if (!fileIsViteConfig && isViteSpecifier(literal.value)) return;
103
- const replacement = rewriteVitePlusImportSpecifier(literal.value);
104
- if (!replacement) return;
124
+ function nearestPackageUsesNuxtTestUtils(filename) {
125
+ return nearestPackageMatches(filename, nuxtTestUtilsPackageCache, (pkg) => [
126
+ pkg.dependencies,
127
+ pkg.devDependencies,
128
+ pkg.optionalDependencies
129
+ ].some((dependencies) => dependencies?.["@nuxt/test-utils"] !== void 0));
130
+ }
131
+ function nearestPackageOwnsOxlintApi(filename) {
132
+ return nearestPackageMatches(filename, oxlintOwnerPackageCache, (pkg) => pkg.optionalDependencies?.[OXLINT_PLUGINS_PACKAGE] !== void 0 || [pkg.dependencies, pkg.peerDependencies].some((dependencies) => dependencies?.[OXLINT_PACKAGE] !== void 0 || dependencies?.[OXLINT_PLUGINS_PACKAGE] !== void 0));
133
+ }
134
+ function reportSpecifier(context, literal, replacement) {
105
135
  context.report({
106
136
  node: literal,
107
137
  messageId: "preferVitePlusImports",
@@ -114,6 +144,30 @@ function maybeReportLiteral(context, literal, preserveUpstreamVitest = false, fi
114
144
  }
115
145
  });
116
146
  }
147
+ function isOxlintApiSpecifier(specifier) {
148
+ return specifier === OXLINT_PLUGINS_PACKAGE || specifier === OXLINT_PLUGINS_DEV_SUBPATH;
149
+ }
150
+ function maybeReportLiteral(context, literal, { preserveUpstreamVitest, fileIsViteConfig, ownsOxlintApi }) {
151
+ if (!literal || literal.type !== "Literal" || typeof literal.value !== "string") return;
152
+ if (preserveUpstreamVitest && isUpstreamVitestSpecifier(literal.value)) return;
153
+ if (!fileIsViteConfig && isViteSpecifier(literal.value)) return;
154
+ const replacement = rewriteVitePlusImportSpecifier(literal.value);
155
+ if (!replacement) return;
156
+ if (ownsOxlintApi && isOxlintApiSpecifier(literal.value)) return;
157
+ reportSpecifier(context, literal, replacement);
158
+ }
159
+ function reportLegacyOxlintPluginApiExport(context, node, ownsOxlintApi) {
160
+ const literal = node.source;
161
+ if (!literal || literal.value !== OXLINT_PACKAGE || ownsOxlintApi) return;
162
+ if (node.specifiers.length === 0) return;
163
+ if (!node.specifiers.every((specifier) => !OXLINT_CONFIG_SURFACE_EXPORTS.has(moduleBindingName(specifier.local)))) return;
164
+ reportSpecifier(context, literal, VITE_PLUS_LINT_PLUGINS);
165
+ }
166
+ function reportLegacyOxlintPluginApiImport(context, node, ownsOxlintApi) {
167
+ const literal = node.source;
168
+ if (literal.value !== OXLINT_PACKAGE || ownsOxlintApi || !importsOxlintPluginApi(node)) return;
169
+ reportSpecifier(context, literal, VITE_PLUS_LINT_PLUGINS);
170
+ }
117
171
  const preferVitePlusImportsRule = defineRule({
118
172
  meta: {
119
173
  type: "problem",
@@ -126,36 +180,43 @@ const preferVitePlusImportsRule = defineRule({
126
180
  messages: { preferVitePlusImports: "Use '{{to}}' instead of '{{from}}' in Vite+ projects." }
127
181
  },
128
182
  createOnce(context) {
129
- let preserveUpstreamVitest = false;
130
- let fileIsViteConfig = false;
183
+ const options = {
184
+ preserveUpstreamVitest: false,
185
+ fileIsViteConfig: false,
186
+ ownsOxlintApi: false
187
+ };
131
188
  return {
132
189
  Program() {
133
- preserveUpstreamVitest = nearestPackageUsesNuxtTestUtils(context.filename);
134
- fileIsViteConfig = isViteConfigFile(context.filename);
190
+ options.preserveUpstreamVitest = nearestPackageUsesNuxtTestUtils(context.filename);
191
+ options.fileIsViteConfig = isViteConfigFile(context.filename);
192
+ options.ownsOxlintApi = nearestPackageOwnsOxlintApi(context.filename);
135
193
  },
136
194
  ImportDeclaration(node) {
137
- maybeReportLiteral(context, node.source, preserveUpstreamVitest, fileIsViteConfig);
195
+ maybeReportLiteral(context, node.source, options);
196
+ reportLegacyOxlintPluginApiImport(context, node, options.ownsOxlintApi);
138
197
  },
139
198
  ExportAllDeclaration(node) {
140
- maybeReportLiteral(context, node.source, preserveUpstreamVitest, fileIsViteConfig);
199
+ maybeReportLiteral(context, node.source, options);
141
200
  },
142
201
  ExportNamedDeclaration(node) {
143
- maybeReportLiteral(context, node.source, preserveUpstreamVitest, fileIsViteConfig);
202
+ maybeReportLiteral(context, node.source, options);
203
+ reportLegacyOxlintPluginApiExport(context, node, options.ownsOxlintApi);
144
204
  },
145
205
  ImportExpression(node) {
146
- maybeReportLiteral(context, node.source, preserveUpstreamVitest, fileIsViteConfig);
206
+ maybeReportLiteral(context, node.source, options);
147
207
  },
148
208
  TSImportType(node) {
149
- maybeReportLiteral(context, node.source, preserveUpstreamVitest, fileIsViteConfig);
209
+ maybeReportLiteral(context, node.source, options);
150
210
  },
151
211
  TSExternalModuleReference(node) {
152
- maybeReportLiteral(context, node.expression, preserveUpstreamVitest, fileIsViteConfig);
212
+ if (node.expression.type === "Literal" && typeof node.expression.value === "string" && isOxlintApiSpecifier(node.expression.value)) return;
213
+ maybeReportLiteral(context, node.expression, options);
153
214
  },
154
215
  TSModuleDeclaration(node) {
155
216
  if (node.global) return;
156
217
  const id = node.id;
157
- if (id?.type === "Literal" && typeof id.value === "string" && isVitestFamilyDeclareModuleSpecifier(id.value)) return;
158
- maybeReportLiteral(context, id, preserveUpstreamVitest, fileIsViteConfig);
218
+ if (id?.type === "Literal" && typeof id.value === "string" && (isVitestFamilyDeclareModuleSpecifier(id.value) || isOxlintFamilyDeclareModuleSpecifier(id.value))) return;
219
+ maybeReportLiteral(context, id, options);
159
220
  }
160
221
  };
161
222
  }
@@ -1,4 +1,4 @@
1
- import { UserConfig } from "@voidzero-dev/vite-plus-core/pack";
1
+ import { UserConfig } from "vite/pack";
2
2
  //#region src/pack.d.ts
3
3
  interface PackUserConfig extends UserConfig {
4
4
  /**
@@ -1,4 +1,3 @@
1
1
  //#region src/pack-bin.d.ts
2
- declare function runCLI(): Promise<void>;
3
- //#endregion
4
- export { runCLI };
2
+ export declare function runCLI(): Promise<void>;
3
+ //#endregion