vite-plus 0.1.14-alpha.3 → 0.1.14

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.
@@ -7,7 +7,7 @@ import path from "node:path";
7
7
  import { stripVTControlCharacters, styleText } from "node:util";
8
8
  import process$1, { stdin, stdout } from "node:process";
9
9
  import * as k from "node:readline";
10
- import c from "node:readline";
10
+ import ot from "node:readline";
11
11
  import { ReadStream } from "node:tty";
12
12
  import color from "picocolors";
13
13
  import fs from "node:fs";
@@ -359,7 +359,7 @@ var B = class {
359
359
  this.state = "cancel", this.close();
360
360
  }, { once: !0 });
361
361
  }
362
- this.rl = c.createInterface({
362
+ this.rl = ot.createInterface({
363
363
  input: this.input,
364
364
  tabSize: 2,
365
365
  prompt: "",
@@ -3998,13 +3998,22 @@ function rewriteAllImports(projectPath, silent = false, report) {
3998
3998
  /**
3999
3999
  * Check if the project has an unsupported husky version (<9.0.0).
4000
4000
  * Uses `semver.coerce` to handle ranges like `^8.0.0` → `8.0.0`.
4001
- * Accepts pre-loaded deps to avoid re-reading package.json when called
4002
- * from contexts that already parsed it.
4001
+ * When the specifier is not coercible (e.g. `"latest"`), falls back to
4002
+ * the installed version in node_modules via `detectPackageMetadata`.
4003
+ * Returns a reason string if hooks migration should be skipped, or null
4004
+ * if husky is absent or compatible.
4003
4005
  */
4004
- function checkUnsupportedHuskyVersion(deps, prodDeps) {
4006
+ function checkUnsupportedHuskyVersion(projectPath, deps, prodDeps) {
4005
4007
  const huskyVersion = deps?.husky ?? prodDeps?.husky;
4006
- if (!huskyVersion) return false;
4007
- return import_semver.default.satisfies(import_semver.default.coerce(huskyVersion) ?? "0.0.0", "<9.0.0");
4008
+ if (!huskyVersion) return null;
4009
+ let coerced = import_semver.default.coerce(huskyVersion);
4010
+ if (coerced == null) {
4011
+ const installed = detectPackageMetadata(projectPath, "husky");
4012
+ if (installed) coerced = import_semver.default.coerce(installed.version);
4013
+ if (coerced == null) return `Could not determine husky version from "${huskyVersion}" — please specify a semver-compatible version (e.g., "^9.0.0") and re-run migration.`;
4014
+ }
4015
+ if (import_semver.default.satisfies(coerced, "<9.0.0")) return "Detected husky <9.0.0 — please upgrade to husky v9+ first, then re-run migration.";
4016
+ return null;
4008
4017
  }
4009
4018
  const OTHER_HOOK_TOOLS = [
4010
4019
  "simple-git-hooks",
@@ -4082,7 +4091,8 @@ function preflightGitHooksSetup(projectPath) {
4082
4091
  const deps = pkgContent.devDependencies;
4083
4092
  const prodDeps = pkgContent.dependencies;
4084
4093
  for (const tool of OTHER_HOOK_TOOLS) if (deps?.[tool] || prodDeps?.[tool] || pkgContent[tool]) return `Detected ${tool} — skipping git hooks setup. Please configure git hooks manually.`;
4085
- if (checkUnsupportedHuskyVersion(deps, prodDeps)) return "Detected husky <9.0.0 — please upgrade to husky v9+ first, then re-run migration.";
4094
+ const huskyReason = checkUnsupportedHuskyVersion(projectPath, deps, prodDeps);
4095
+ if (huskyReason) return huskyReason;
4086
4096
  if (hasUnsupportedLintStagedConfig(projectPath)) return "Unsupported lint-staged config format — skipping git hooks setup. Please configure git hooks manually.";
4087
4097
  return null;
4088
4098
  }
@@ -1,4 +1,4 @@
1
- import { S as defaultInteractive, i as updateExistingAgentInstructions, u as ensurePreCommitHook, w as promptGitHooks } from "./agent-DTz-Dh1r.js";
1
+ import { S as defaultInteractive, i as updateExistingAgentInstructions, u as ensurePreCommitHook, w as promptGitHooks } from "./agent-CYJwIPT1.js";
2
2
  import { t as lib_default } from "./lib-DxappLRQ.js";
3
3
  import { i as log, t as renderCliDoc } from "./help-HviKaKAU.js";
4
4
  import { join } from "node:path";
@@ -1,9 +1,9 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-BoAXSpZd.js";
2
- import { A as templatesDir, B as select, C as downloadPackageManager$1, D as selectPackageManager, E as runViteInstall, F as confirm, H as text, I as intro, L as log, M as PackageManager, P as cancel, R as multiselect, S as defaultInteractive, T as runViteFmt, U as Ct, V as spinner, _ as rewriteMonorepoProject, a as writeAgentInstructions, d as installGitHooks, g as rewriteMonorepo, j as DependencyType, k as displayRelative, n as detectExistingAgentTargetPaths, r as selectAgentTargetPaths, v as rewriteStandaloneProject, w as promptGitHooks } from "./agent-DTz-Dh1r.js";
2
+ import { A as templatesDir, B as select, C as downloadPackageManager$1, D as selectPackageManager, E as runViteInstall, F as confirm, H as text, I as intro, L as log, M as PackageManager, P as cancel, R as multiselect, S as defaultInteractive, T as runViteFmt, U as Ct, V as spinner, _ as rewriteMonorepoProject, a as writeAgentInstructions, d as installGitHooks, g as rewriteMonorepo, j as DependencyType, k as displayRelative, n as detectExistingAgentTargetPaths, r as selectAgentTargetPaths, v as rewriteStandaloneProject, w as promptGitHooks } from "./agent-CYJwIPT1.js";
3
3
  import { t as lib_default } from "./lib-DxappLRQ.js";
4
4
  import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "./package-Y1UTfJnZ.js";
5
5
  import { a as muted, i as log$1, n as accent, o as success, t as renderCliDoc } from "./help-HviKaKAU.js";
6
- import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-BlrOxcHM.js";
6
+ import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-CRwqPC_4.js";
7
7
  import path from "node:path";
8
8
  import { styleText } from "node:util";
9
9
  import color from "picocolors";
@@ -1,10 +1,10 @@
1
1
  import { r as __toESM } from "./chunk-BoAXSpZd.js";
2
- import { B as select, C as downloadPackageManager$1, D as selectPackageManager, E as runViteInstall, F as confirm, L as log, M as PackageManager, N as require_semver, O as upgradeYarn, S as defaultInteractive, U as Ct, V as spinner, a as writeAgentInstructions, c as detectEslintProject, d as installGitHooks, f as mergeViteConfigFiles, g as rewriteMonorepo, h as preflightGitHooksSetup, k as displayRelative, l as detectPrettierProject, m as migratePrettierToOxfmt, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as migrateEslintToOxlint, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, v as rewriteStandaloneProject, w as promptGitHooks, x as cancelAndExit, z as outro } from "./agent-DTz-Dh1r.js";
2
+ import { B as select, C as downloadPackageManager$1, D as selectPackageManager, E as runViteInstall, F as confirm, L as log, M as PackageManager, N as require_semver, O as upgradeYarn, S as defaultInteractive, U as Ct, V as spinner, a as writeAgentInstructions, c as detectEslintProject, d as installGitHooks, f as mergeViteConfigFiles, g as rewriteMonorepo, h as preflightGitHooksSetup, k as displayRelative, l as detectPrettierProject, m as migratePrettierToOxfmt, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as migrateEslintToOxlint, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, v as rewriteStandaloneProject, w as promptGitHooks, x as cancelAndExit, z as outro } from "./agent-CYJwIPT1.js";
3
3
  import { t as lib_default } from "./lib-DxappLRQ.js";
4
4
  import { a as readNearestPackageJson, i as hasVitePlusDependency, m as isForceOverrideMode } from "./package-Y1UTfJnZ.js";
5
5
  import { a as muted, i as log$1, n as accent, t as renderCliDoc } from "./help-HviKaKAU.js";
6
6
  import { r as createMigrationReport } from "./report-C7xbSNED.js";
7
- import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-BlrOxcHM.js";
7
+ import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-CRwqPC_4.js";
8
8
  import path from "node:path";
9
9
  import { styleText } from "node:util";
10
10
  import { vitePlusHeader } from "../../binding/index.js";
@@ -4,7 +4,7 @@ import { i as log, r as errorMsg, t as renderCliDoc } from "./help-HviKaKAU.js";
4
4
  import path, { delimiter, dirname, normalize, resolve } from "node:path";
5
5
  import { formatWithOptions, inspect, promisify } from "node:util";
6
6
  import { cwd } from "node:process";
7
- import c from "node:readline";
7
+ import ot from "node:readline";
8
8
  import nodeTty from "node:tty";
9
9
  import fs, { constants } from "node:fs";
10
10
  import { vitePlusHeader } from "../../binding/index.js";
@@ -637,7 +637,7 @@ var L = class {
637
637
  if (this._streamErr) t.push(this._streamErr);
638
638
  if (this._streamOut) t.push(this._streamOut);
639
639
  const n = g(t);
640
- const r = c.createInterface({ input: n });
640
+ const r = ot.createInterface({ input: n });
641
641
  for await (const e of r) yield e.toString();
642
642
  await this._processClosed;
643
643
  e.removeAllListeners();
@@ -1,4 +1,4 @@
1
- import { B as select, L as log, M as PackageManager, U as Ct, b as readYamlFile, y as editYamlFile } from "./agent-DTz-Dh1r.js";
1
+ import { B as select, L as log, M as PackageManager, U as Ct, b as readYamlFile, y as editYamlFile } from "./agent-CYJwIPT1.js";
2
2
  import { g as YAMLSeq, y as Scalar } from "./browser-09BZLUYM.js";
3
3
  import { c as readJsonFile, l as writeJsonFile, o as editJsonFile, r as getScopeFromPackageName } from "./package-Y1UTfJnZ.js";
4
4
  import path, { posix, win32 } from "node:path";
@@ -1149,15 +1149,30 @@ function rewriteAllImports(projectPath, silent = false, report) {
1149
1149
  /**
1150
1150
  * Check if the project has an unsupported husky version (<9.0.0).
1151
1151
  * Uses `semver.coerce` to handle ranges like `^8.0.0` → `8.0.0`.
1152
- * Accepts pre-loaded deps to avoid re-reading package.json when called
1153
- * from contexts that already parsed it.
1152
+ * When the specifier is not coercible (e.g. `"latest"`), falls back to
1153
+ * the installed version in node_modules via `detectPackageMetadata`.
1154
+ * Returns a reason string if hooks migration should be skipped, or null
1155
+ * if husky is absent or compatible.
1154
1156
  */
1155
- function checkUnsupportedHuskyVersion(deps, prodDeps) {
1157
+ function checkUnsupportedHuskyVersion(projectPath, deps, prodDeps) {
1156
1158
  const huskyVersion = deps?.husky ?? prodDeps?.husky;
1157
1159
  if (!huskyVersion) {
1158
- return false;
1160
+ return null;
1161
+ }
1162
+ let coerced = semver.coerce(huskyVersion);
1163
+ if (coerced == null) {
1164
+ const installed = detectPackageMetadata(projectPath, 'husky');
1165
+ if (installed) {
1166
+ coerced = semver.coerce(installed.version);
1167
+ }
1168
+ if (coerced == null) {
1169
+ return `Could not determine husky version from "${huskyVersion}" — please specify a semver-compatible version (e.g., "^9.0.0") and re-run migration.`;
1170
+ }
1159
1171
  }
1160
- return semver.satisfies(semver.coerce(huskyVersion) ?? '0.0.0', '<9.0.0');
1172
+ if (semver.satisfies(coerced, '<9.0.0')) {
1173
+ return 'Detected husky <9.0.0 — please upgrade to husky v9+ first, then re-run migration.';
1174
+ }
1175
+ return null;
1161
1176
  }
1162
1177
  const OTHER_HOOK_TOOLS = ['simple-git-hooks', 'lefthook', 'yorkie'];
1163
1178
  // Packages replaced by vite-plus built-in commands and should be removed from devDependencies
@@ -1256,8 +1271,9 @@ export function preflightGitHooksSetup(projectPath) {
1256
1271
  return `Detected ${tool} — skipping git hooks setup. Please configure git hooks manually.`;
1257
1272
  }
1258
1273
  }
1259
- if (checkUnsupportedHuskyVersion(deps, prodDeps)) {
1260
- return 'Detected husky <9.0.0 — please upgrade to husky v9+ first, then re-run migration.';
1274
+ const huskyReason = checkUnsupportedHuskyVersion(projectPath, deps, prodDeps);
1275
+ if (huskyReason) {
1276
+ return huskyReason;
1261
1277
  }
1262
1278
  if (hasUnsupportedLintStagedConfig(projectPath)) {
1263
1279
  return 'Unsupported lint-staged config format — skipping git hooks setup. Please configure git hooks manually.';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.1.14-alpha.3",
3
+ "version": "0.1.14",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -317,8 +317,8 @@
317
317
  "oxlint": "=1.57.0",
318
318
  "oxlint-tsgolint": "=0.17.3",
319
319
  "picocolors": "^1.1.1",
320
- "@voidzero-dev/vite-plus-core": "0.1.14-alpha.3",
321
- "@voidzero-dev/vite-plus-test": "0.1.14-alpha.3"
320
+ "@voidzero-dev/vite-plus-core": "0.1.14",
321
+ "@voidzero-dev/vite-plus-test": "0.1.14"
322
322
  },
323
323
  "devDependencies": {
324
324
  "@napi-rs/cli": "^3.4.1",
@@ -341,8 +341,8 @@
341
341
  "validate-npm-package-name": "^7.0.2",
342
342
  "yaml": "^2.8.1",
343
343
  "@voidzero-dev/vite-plus-prompts": "0.0.0",
344
- "rolldown": "1.0.0-rc.11",
345
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.14-alpha.3"
344
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.14",
345
+ "rolldown": "1.0.0-rc.11"
346
346
  },
347
347
  "napi": {
348
348
  "binaryName": "vite-plus",
@@ -362,14 +362,14 @@
362
362
  "node": "^20.19.0 || >=22.12.0"
363
363
  },
364
364
  "optionalDependencies": {
365
- "@voidzero-dev/vite-plus-darwin-arm64": "0.1.14-alpha.3",
366
- "@voidzero-dev/vite-plus-darwin-x64": "0.1.14-alpha.3",
367
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.14-alpha.3",
368
- "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.14-alpha.3",
369
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.14-alpha.3",
370
- "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.14-alpha.3",
371
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.14-alpha.3",
372
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.14-alpha.3"
365
+ "@voidzero-dev/vite-plus-darwin-arm64": "0.1.14",
366
+ "@voidzero-dev/vite-plus-darwin-x64": "0.1.14",
367
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.14",
368
+ "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.14",
369
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.14",
370
+ "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.14",
371
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.14",
372
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.14"
373
373
  },
374
374
  "scripts": {
375
375
  "build": "oxnode -C dev ./build.ts",