vite-plus 0.1.20-alpha.0 → 0.1.20-alpha.1
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/binding/index.cjs +1 -0
- package/binding/index.d.cts +8 -0
- package/dist/{agent-iabUQh_f.js → agent-Dz7r-vyX.js} +60 -2
- package/dist/bin.js +1 -1
- package/dist/config/bin.js +3 -4
- package/dist/create/bin.js +26 -8
- package/dist/migration/bin.js +7 -66
- package/dist/staged/bin.js +3 -4
- package/dist/{terminal-P9aw9Fib.js → terminal-CxTMfsxZ.js} +12 -1
- package/dist/version.js +2 -4
- package/dist/{workspace-oCv-zJ1i.js → workspace-DE_pac71.js} +1 -1
- package/package.json +13 -13
package/binding/index.cjs
CHANGED
|
@@ -775,4 +775,5 @@ module.exports.rewritePrettier = nativeBinding.rewritePrettier;
|
|
|
775
775
|
module.exports.rewriteScripts = nativeBinding.rewriteScripts;
|
|
776
776
|
module.exports.run = nativeBinding.run;
|
|
777
777
|
module.exports.runCommand = nativeBinding.runCommand;
|
|
778
|
+
module.exports.shouldPrintVitePlusHeader = nativeBinding.shouldPrintVitePlusHeader;
|
|
778
779
|
module.exports.vitePlusHeader = nativeBinding.vitePlusHeader;
|
package/binding/index.d.cts
CHANGED
|
@@ -369,5 +369,13 @@ export interface RunCommandResult {
|
|
|
369
369
|
pathAccesses: Record<string, PathAccess>;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Whether the Vite+ banner should be emitted in the current environment.
|
|
374
|
+
*
|
|
375
|
+
* Mirrors `vite_shared::header::should_print_header` so both CLIs apply
|
|
376
|
+
* the same TTY + git-hook gating without duplicating the rules in JS.
|
|
377
|
+
*/
|
|
378
|
+
export declare function shouldPrintVitePlusHeader(): boolean;
|
|
379
|
+
|
|
372
380
|
/** Render the Vite+ header using the Rust implementation. */
|
|
373
381
|
export declare function vitePlusHeader(): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
|
|
2
2
|
import { c as VITE_PLUS_VERSION, i as BASEURL_TSCONFIG_WARNING, l as isForceOverrideMode, o as VITE_PLUS_NAME, s as VITE_PLUS_OVERRIDE_PACKAGES } from "./main-A6UrSTYb.js";
|
|
3
3
|
import { a as require_cross_spawn, i as runCommandSilently, n as hasBaseUrlInTsconfig, r as removeDeprecatedTsconfigFalseOption, t as findTsconfigFiles } from "./tsconfig-DQTf06oN.js";
|
|
4
|
-
import { t as accent } from "./terminal-
|
|
4
|
+
import { t as accent } from "./terminal-CxTMfsxZ.js";
|
|
5
5
|
import { t as require_dist } from "./dist-Dkzst9fl.js";
|
|
6
6
|
import { c as readJsonFile, n as detectPackageMetadata, o as editJsonFile, s as isJsonFile } from "./package-D_LD1iiI.js";
|
|
7
7
|
import { n as addMigrationWarning, t as addManualStep } from "./report-DbrfjWiP.js";
|
|
@@ -4752,6 +4752,64 @@ function migrateNodeVersionManagerFile(projectPath, detection, report) {
|
|
|
4752
4752
|
} else if (detection.voltaPresent) log.info("You can now remove the \"volta\" field from package.json manually.");
|
|
4753
4753
|
return true;
|
|
4754
4754
|
}
|
|
4755
|
+
function warnPackageLevelEslint() {
|
|
4756
|
+
log.warn("ESLint detected in workspace packages but no root config found. Package-level ESLint must be migrated manually.");
|
|
4757
|
+
}
|
|
4758
|
+
function warnLegacyEslintConfig(legacyConfigFile) {
|
|
4759
|
+
log.warn(`Legacy ESLint configuration detected (${legacyConfigFile}). Automatic migration to Oxlint requires ESLint v9+ with flat config format (eslint.config.*). Please upgrade to ESLint v9 first: https://eslint.org/docs/latest/use/migrate-to-9.0.0`);
|
|
4760
|
+
}
|
|
4761
|
+
async function confirmEslintMigration(interactive) {
|
|
4762
|
+
if (interactive) {
|
|
4763
|
+
const confirmed = await confirm({
|
|
4764
|
+
message: "Migrate ESLint rules to Oxlint using @oxlint/migrate?\n " + styleText("gray", "Oxlint is Vite+'s built-in linter — significantly faster than ESLint with compatible rule support. @oxlint/migrate converts your existing rules automatically."),
|
|
4765
|
+
initialValue: true
|
|
4766
|
+
});
|
|
4767
|
+
if (q(confirmed)) cancelAndExit();
|
|
4768
|
+
return confirmed;
|
|
4769
|
+
}
|
|
4770
|
+
return true;
|
|
4771
|
+
}
|
|
4772
|
+
async function promptEslintMigration(projectPath, interactive, packages) {
|
|
4773
|
+
const eslintProject = detectEslintProject(projectPath, packages);
|
|
4774
|
+
if (eslintProject.hasDependency && !eslintProject.configFile && eslintProject.legacyConfigFile) {
|
|
4775
|
+
warnLegacyEslintConfig(eslintProject.legacyConfigFile);
|
|
4776
|
+
return false;
|
|
4777
|
+
}
|
|
4778
|
+
if (!eslintProject.hasDependency) return false;
|
|
4779
|
+
if (!eslintProject.configFile) {
|
|
4780
|
+
warnPackageLevelEslint();
|
|
4781
|
+
return false;
|
|
4782
|
+
}
|
|
4783
|
+
if (!await confirmEslintMigration(interactive)) return false;
|
|
4784
|
+
if (!await migrateEslintToOxlint(projectPath, interactive, eslintProject.configFile, packages)) cancelAndExit("ESLint migration failed.", 1);
|
|
4785
|
+
return true;
|
|
4786
|
+
}
|
|
4787
|
+
function warnPackageLevelPrettier() {
|
|
4788
|
+
log.warn("Prettier detected in workspace packages but no root config found. Package-level Prettier must be migrated manually.");
|
|
4789
|
+
}
|
|
4790
|
+
async function confirmPrettierMigration(interactive) {
|
|
4791
|
+
if (interactive) {
|
|
4792
|
+
const confirmed = await confirm({
|
|
4793
|
+
message: "Migrate Prettier to Oxfmt?\n " + styleText("gray", "Oxfmt is Vite+'s built-in formatter that replaces Prettier with faster performance. Your configuration will be converted automatically."),
|
|
4794
|
+
initialValue: true
|
|
4795
|
+
});
|
|
4796
|
+
if (q(confirmed)) cancelAndExit();
|
|
4797
|
+
return confirmed;
|
|
4798
|
+
}
|
|
4799
|
+
log.info("Prettier configuration detected. Auto-migrating to Oxfmt...");
|
|
4800
|
+
return true;
|
|
4801
|
+
}
|
|
4802
|
+
async function promptPrettierMigration(projectPath, interactive, packages) {
|
|
4803
|
+
const prettierProject = detectPrettierProject(projectPath, packages);
|
|
4804
|
+
if (!prettierProject.hasDependency) return false;
|
|
4805
|
+
if (!prettierProject.configFile) {
|
|
4806
|
+
warnPackageLevelPrettier();
|
|
4807
|
+
return false;
|
|
4808
|
+
}
|
|
4809
|
+
if (!await confirmPrettierMigration(interactive)) return false;
|
|
4810
|
+
if (!await migratePrettierToOxfmt(projectPath, interactive, prettierProject.configFile, packages)) cancelAndExit("Prettier migration failed.", 1);
|
|
4811
|
+
return true;
|
|
4812
|
+
}
|
|
4755
4813
|
//#endregion
|
|
4756
4814
|
//#region src/utils/agent.ts
|
|
4757
4815
|
const AGENTS = [
|
|
@@ -5061,4 +5119,4 @@ function getMarkedRange(content, startMarker, endMarker) {
|
|
|
5061
5119
|
};
|
|
5062
5120
|
}
|
|
5063
5121
|
//#endregion
|
|
5064
|
-
export {
|
|
5122
|
+
export { outro as $, warnLegacyEslintConfig as A, runViteInstall as B, preflightGitHooksSetup as C, rewriteMonorepoProject as D, rewriteMonorepo as E, cancelAndExit as F, DependencyType as G, upgradeYarn as H, defaultInteractive as I, cancel as J, PackageManager as K, downloadPackageManager$1 as L, warnPackageLevelPrettier as M, editYamlFile as N, rewriteStandaloneProject as O, readYamlFile as P, multiselect as Q, promptGitHooks as R, migratePrettierToOxfmt as S, promptPrettierMigration as T, displayRelative as U, selectPackageManager as V, templatesDir as W, intro as X, confirm as Y, log as Z, hasStagedConfigInViteConfig as _, writeAgentInstructions as a, migrateEslintToOxlint as b, checkVitestVersion as c, detectEslintProject as d, select as et, detectFramework as f, hasFrameworkShim as g, ensurePreCommitHook as h, updateExistingAgentInstructions as i, q as it, warnPackageLevelEslint as j, setPackageManager as k, confirmEslintMigration as l, detectPrettierProject as m, detectExistingAgentTargetPaths as n, text as nt, addFrameworkShim as o, detectNodeVersionManagerFile as p, require_semver as q, selectAgentTargetPaths as r, require_picocolors as rt, checkViteVersion as s, detectAgentConflicts as t, spinner as tt, confirmPrettierMigration as u, installGitHooks as v, promptEslintMigration as w, migrateNodeVersionManagerFile as x, mergeViteConfigFiles as y, runViteFmt as z };
|
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as DEFAULT_ENVS, i as BASEURL_TSCONFIG_WARNING, o as VITE_PLUS_NAME, u as resolve$1 } from "./main-A6UrSTYb.js";
|
|
2
2
|
import { i as runCommandSilently, n as hasBaseUrlInTsconfig } from "./tsconfig-DQTf06oN.js";
|
|
3
|
-
import { n as errorMsg,
|
|
3
|
+
import { n as errorMsg, r as log, s as warnMsg, t as accent } from "./terminal-CxTMfsxZ.js";
|
|
4
4
|
import { t as resolveUniversalViteConfig } from "./resolve-vite-config-B_w1u1j4.js";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import { mergeJsonConfig, run } from "../binding/index.js";
|
package/dist/config/bin.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { r as log } from "../terminal-
|
|
2
|
-
import {
|
|
1
|
+
import { a as printHeader, r as log } from "../terminal-CxTMfsxZ.js";
|
|
2
|
+
import { I as defaultInteractive, R as promptGitHooks, _ as hasStagedConfigInViteConfig, h as ensurePreCommitHook, i as updateExistingAgentInstructions } from "../agent-Dz7r-vyX.js";
|
|
3
3
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
4
4
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
-
import { vitePlusHeader } from "../../binding/index.js";
|
|
7
6
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
8
7
|
import { spawnSync } from "node:child_process";
|
|
9
8
|
//#region src/config/hooks.ts
|
|
@@ -135,7 +134,7 @@ async function main() {
|
|
|
135
134
|
}]
|
|
136
135
|
}]
|
|
137
136
|
});
|
|
138
|
-
|
|
137
|
+
printHeader();
|
|
139
138
|
log(helpMessage);
|
|
140
139
|
return;
|
|
141
140
|
}
|
package/dist/create/bin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
2
|
import { a as require_cross_spawn } from "../tsconfig-DQTf06oN.js";
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
3
|
+
import { a as printHeader, i as muted, o as success, r as log, t as accent } from "../terminal-CxTMfsxZ.js";
|
|
4
|
+
import { B as runViteInstall, D as rewriteMonorepoProject, E as rewriteMonorepo, G as DependencyType, I as defaultInteractive, J as cancel, K as PackageManager, L as downloadPackageManager$1, O as rewriteStandaloneProject, Q as multiselect, R as promptGitHooks, T as promptPrettierMigration, U as displayRelative, V as selectPackageManager, W as templatesDir, X as intro, Y as confirm, Z as log$1, a as writeAgentInstructions, d as detectEslintProject, et as select, f as detectFramework, g as hasFrameworkShim, it as q, k as setPackageManager, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as text, o as addFrameworkShim, r as selectAgentTargetPaths, rt as require_picocolors, tt as spinner, v as installGitHooks, w as promptEslintMigration, z as runViteFmt } from "../agent-Dz7r-vyX.js";
|
|
5
5
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
6
6
|
import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "../package-D_LD1iiI.js";
|
|
7
|
-
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-
|
|
7
|
+
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-DE_pac71.js";
|
|
8
8
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { runCommand, vitePlusHeader } from "../../binding/index.js";
|
|
@@ -3915,7 +3915,7 @@ async function main() {
|
|
|
3915
3915
|
const { templateName, options, templateArgs } = parseArgs();
|
|
3916
3916
|
let compactOutput = !options.verbose;
|
|
3917
3917
|
if (options.help) {
|
|
3918
|
-
|
|
3918
|
+
printHeader();
|
|
3919
3919
|
log(helpMessage);
|
|
3920
3920
|
return;
|
|
3921
3921
|
}
|
|
@@ -4236,12 +4236,25 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4236
4236
|
extraVsCodeSettings: { "npm.scriptRunner": "vp" }
|
|
4237
4237
|
});
|
|
4238
4238
|
resumeCreateProgress();
|
|
4239
|
+
const shouldMigrateLintFmtTools = detectEslintProject(fullPath).hasDependency || detectPrettierProject(fullPath).hasDependency;
|
|
4239
4240
|
let installSummary;
|
|
4241
|
+
const installAndMigrate = async (installCwd) => {
|
|
4242
|
+
setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
|
|
4243
|
+
if (workspaceInfo.packageManager === PackageManager.yarn) {
|
|
4244
|
+
const yarnrcPath = path.join(fullPath, ".yarnrc.yml");
|
|
4245
|
+
if (!fs.existsSync(yarnrcPath)) fs.writeFileSync(yarnrcPath, "nodeLinker: node-modules\n");
|
|
4246
|
+
}
|
|
4247
|
+
updateCreateProgress("Installing dependencies");
|
|
4248
|
+
installSummary = await runViteInstall(installCwd, options.interactive, installArgs, { silent: compactOutput });
|
|
4249
|
+
if (installSummary.status !== "installed") return;
|
|
4250
|
+
updateCreateProgress("Migrating lint and format tools");
|
|
4251
|
+
pauseCreateProgress();
|
|
4252
|
+
await promptEslintMigration(fullPath, false);
|
|
4253
|
+
await promptPrettierMigration(fullPath, false);
|
|
4254
|
+
resumeCreateProgress();
|
|
4255
|
+
};
|
|
4240
4256
|
if (isMonorepo) {
|
|
4241
4257
|
if (!compactOutput) log$1.step("Monorepo integration...");
|
|
4242
|
-
updateCreateProgress("Integrating into monorepo");
|
|
4243
|
-
rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, void 0, compactOutput);
|
|
4244
|
-
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
4245
4258
|
if (workspaceInfo.packages.length > 0) {
|
|
4246
4259
|
if (options.interactive) {
|
|
4247
4260
|
pauseCreateProgress();
|
|
@@ -4274,11 +4287,16 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4274
4287
|
}
|
|
4275
4288
|
}
|
|
4276
4289
|
updateWorkspaceConfig(projectDir, workspaceInfo);
|
|
4290
|
+
if (shouldMigrateLintFmtTools) await installAndMigrate(workspaceInfo.rootDir);
|
|
4291
|
+
updateCreateProgress("Integrating into monorepo");
|
|
4292
|
+
rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, void 0, compactOutput);
|
|
4293
|
+
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
4277
4294
|
updateCreateProgress("Installing dependencies");
|
|
4278
4295
|
installSummary = await runViteInstall(workspaceInfo.rootDir, options.interactive, installArgs, { silent: compactOutput });
|
|
4279
4296
|
updateCreateProgress("Formatting code");
|
|
4280
4297
|
await runViteFmt(workspaceInfo.rootDir, options.interactive, [projectDir], { silent: compactOutput });
|
|
4281
4298
|
} else {
|
|
4299
|
+
if (shouldMigrateLintFmtTools) await installAndMigrate(fullPath);
|
|
4282
4300
|
updateCreateProgress("Applying Vite+ project setup");
|
|
4283
4301
|
rewriteStandaloneProject(fullPath, workspaceInfo, void 0, compactOutput);
|
|
4284
4302
|
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
@@ -4299,7 +4317,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4299
4317
|
});
|
|
4300
4318
|
}
|
|
4301
4319
|
async function showAvailableTemplates() {
|
|
4302
|
-
|
|
4320
|
+
printHeader();
|
|
4303
4321
|
log(listTemplatesMessage);
|
|
4304
4322
|
}
|
|
4305
4323
|
main().catch((err) => {
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,75 +1,16 @@
|
|
|
1
1
|
import { r as __toESM } from "../chunk-q7NCDQ7-.js";
|
|
2
2
|
import { l as isForceOverrideMode } from "../main-A6UrSTYb.js";
|
|
3
|
-
import { i as muted, r as log, t as accent } from "../terminal-
|
|
4
|
-
import { A as
|
|
3
|
+
import { a as printHeader, i as muted, r as log, t as accent } from "../terminal-CxTMfsxZ.js";
|
|
4
|
+
import { $ as outro, A as warnLegacyEslintConfig, B as runViteInstall, C as preflightGitHooksSetup, E as rewriteMonorepo, F as cancelAndExit, H as upgradeYarn, I as defaultInteractive, K as PackageManager, L as downloadPackageManager, M as warnPackageLevelPrettier, O as rewriteStandaloneProject, R as promptGitHooks, S as migratePrettierToOxfmt, T as promptPrettierMigration, U as displayRelative, V as selectPackageManager, Y as confirm, Z as log$1, a as writeAgentInstructions, b as migrateEslintToOxlint, c as checkVitestVersion, d as detectEslintProject, et as select, f as detectFramework, g as hasFrameworkShim, it as q, j as warnPackageLevelEslint, l as confirmEslintMigration, m as detectPrettierProject, n as detectExistingAgentTargetPaths, o as addFrameworkShim, p as detectNodeVersionManagerFile, q as require_semver, r as selectAgentTargetPaths, s as checkViteVersion, t as detectAgentConflicts, tt as spinner, u as confirmPrettierMigration, v as installGitHooks, w as promptEslintMigration, x as migrateNodeVersionManagerFile, y as mergeViteConfigFiles } from "../agent-Dz7r-vyX.js";
|
|
5
5
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
6
6
|
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-D_LD1iiI.js";
|
|
7
7
|
import { r as createMigrationReport } from "../report-DbrfjWiP.js";
|
|
8
|
-
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace
|
|
8
|
+
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-DE_pac71.js";
|
|
9
9
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import { vitePlusHeader } from "../../binding/index.js";
|
|
12
11
|
import { styleText } from "node:util";
|
|
13
12
|
//#region src/migration/bin.ts
|
|
14
13
|
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
15
|
-
function warnPackageLevelEslint() {
|
|
16
|
-
log$1.warn("ESLint detected in workspace packages but no root config found. Package-level ESLint must be migrated manually.");
|
|
17
|
-
}
|
|
18
|
-
function warnLegacyEslintConfig(legacyConfigFile) {
|
|
19
|
-
log$1.warn(`Legacy ESLint configuration detected (${legacyConfigFile}). Automatic migration to Oxlint requires ESLint v9+ with flat config format (eslint.config.*). Please upgrade to ESLint v9 first: https://eslint.org/docs/latest/use/migrate-to-9.0.0`);
|
|
20
|
-
}
|
|
21
|
-
async function confirmEslintMigration(interactive) {
|
|
22
|
-
if (interactive) {
|
|
23
|
-
const confirmed = await confirm({
|
|
24
|
-
message: "Migrate ESLint rules to Oxlint using @oxlint/migrate?\n " + styleText("gray", "Oxlint is Vite+'s built-in linter — significantly faster than ESLint with compatible rule support. @oxlint/migrate converts your existing rules automatically."),
|
|
25
|
-
initialValue: true
|
|
26
|
-
});
|
|
27
|
-
if (q(confirmed)) cancelAndExit();
|
|
28
|
-
return confirmed;
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
async function promptEslintMigration(projectPath, interactive, packages) {
|
|
33
|
-
const eslintProject = detectEslintProject(projectPath, packages);
|
|
34
|
-
if (eslintProject.hasDependency && !eslintProject.configFile && eslintProject.legacyConfigFile) {
|
|
35
|
-
warnLegacyEslintConfig(eslintProject.legacyConfigFile);
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
if (!eslintProject.hasDependency) return false;
|
|
39
|
-
if (!eslintProject.configFile) {
|
|
40
|
-
warnPackageLevelEslint();
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
if (!await confirmEslintMigration(interactive)) return false;
|
|
44
|
-
if (!await migrateEslintToOxlint(projectPath, interactive, eslintProject.configFile, packages)) cancelAndExit("ESLint migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
function warnPackageLevelPrettier() {
|
|
48
|
-
log$1.warn("Prettier detected in workspace packages but no root config found. Package-level Prettier must be migrated manually.");
|
|
49
|
-
}
|
|
50
|
-
async function confirmPrettierMigration(interactive) {
|
|
51
|
-
if (interactive) {
|
|
52
|
-
const confirmed = await confirm({
|
|
53
|
-
message: "Migrate Prettier to Oxfmt?\n " + styleText("gray", "Oxfmt is Vite+'s built-in formatter that replaces Prettier with faster performance. Your configuration will be converted automatically."),
|
|
54
|
-
initialValue: true
|
|
55
|
-
});
|
|
56
|
-
if (q(confirmed)) cancelAndExit();
|
|
57
|
-
return confirmed;
|
|
58
|
-
}
|
|
59
|
-
log$1.info("Prettier configuration detected. Auto-migrating to Oxfmt...");
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
async function promptPrettierMigration(projectPath, interactive, packages) {
|
|
63
|
-
const prettierProject = detectPrettierProject(projectPath, packages);
|
|
64
|
-
if (!prettierProject.hasDependency) return false;
|
|
65
|
-
if (!prettierProject.configFile) {
|
|
66
|
-
warnPackageLevelPrettier();
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
if (!await confirmPrettierMigration(interactive)) return false;
|
|
70
|
-
if (!await migratePrettierToOxfmt(projectPath, interactive, prettierProject.configFile, packages)) cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
14
|
async function confirmNodeVersionFileMigration(interactive, detection) {
|
|
74
15
|
const message = {
|
|
75
16
|
"package.json": "Migrate Volta node version (package.json) to .node-version?",
|
|
@@ -401,7 +342,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
401
342
|
}
|
|
402
343
|
};
|
|
403
344
|
updateMigrationProgress("Preparing migration");
|
|
404
|
-
const downloadResult = await downloadPackageManager
|
|
345
|
+
const downloadResult = await downloadPackageManager(plan.packageManager, workspaceInfoOptional.packageManagerVersion, interactive, true);
|
|
405
346
|
const workspaceInfo = {
|
|
406
347
|
...workspaceInfoOptional,
|
|
407
348
|
packageManager: plan.packageManager,
|
|
@@ -502,12 +443,12 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
502
443
|
async function main() {
|
|
503
444
|
const { projectPath, options } = parseArgs();
|
|
504
445
|
if (options.help) {
|
|
505
|
-
|
|
446
|
+
printHeader();
|
|
506
447
|
log(helpMessage);
|
|
507
448
|
return;
|
|
508
449
|
}
|
|
509
|
-
|
|
510
|
-
const workspaceInfoOptional = await detectWorkspace
|
|
450
|
+
printHeader();
|
|
451
|
+
const workspaceInfoOptional = await detectWorkspace(projectPath);
|
|
511
452
|
const resolvedPackageManager = workspaceInfoOptional.packageManager ?? "unknown";
|
|
512
453
|
const rootPkg = readNearestPackageJson(workspaceInfoOptional.rootDir);
|
|
513
454
|
if (hasVitePlusDependency(rootPkg) && !isForceOverrideMode()) {
|
package/dist/staged/bin.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
|
-
import { n as errorMsg, r as log } from "../terminal-
|
|
2
|
+
import { a as printHeader, n as errorMsg, r as log } from "../terminal-CxTMfsxZ.js";
|
|
3
3
|
import { n as resolveViteConfig } from "../resolve-vite-config-B_w1u1j4.js";
|
|
4
4
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
5
5
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import path, { delimiter, dirname, normalize, resolve } from "node:path";
|
|
8
|
-
import { vitePlusHeader } from "../../binding/index.js";
|
|
9
8
|
import { constants } from "node:fs";
|
|
10
9
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
11
10
|
import { pathToFileURL } from "node:url";
|
|
@@ -6969,7 +6968,7 @@ if (args.help) {
|
|
|
6969
6968
|
]
|
|
6970
6969
|
}]
|
|
6971
6970
|
});
|
|
6972
|
-
|
|
6971
|
+
printHeader();
|
|
6973
6972
|
log(helpMessage);
|
|
6974
6973
|
} else {
|
|
6975
6974
|
const options = {};
|
|
@@ -6993,7 +6992,7 @@ if (args.help) {
|
|
|
6993
6992
|
}
|
|
6994
6993
|
if (stagedConfig) options.config = stagedConfig;
|
|
6995
6994
|
else {
|
|
6996
|
-
|
|
6995
|
+
printHeader();
|
|
6997
6996
|
errorMsg("No \"staged\" config found in vite.config.ts. Please add a staged config:");
|
|
6998
6997
|
log("");
|
|
6999
6998
|
log(" // vite.config.ts");
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
import { shouldPrintVitePlusHeader, vitePlusHeader } from "../binding/index.js";
|
|
1
2
|
import { styleText } from "node:util";
|
|
2
3
|
//#region src/utils/terminal.ts
|
|
3
4
|
function log(message) {
|
|
4
5
|
console.log(message);
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Emit the Vite+ banner (header line + trailing blank line) to stdout.
|
|
9
|
+
* Gating (non-TTY, git hooks) lives in `shouldPrintVitePlusHeader` on the
|
|
10
|
+
* Rust side so both CLIs stay in sync.
|
|
11
|
+
*/
|
|
12
|
+
function printHeader() {
|
|
13
|
+
if (!shouldPrintVitePlusHeader()) return;
|
|
14
|
+
log(vitePlusHeader());
|
|
15
|
+
log("");
|
|
16
|
+
}
|
|
6
17
|
function accent(text) {
|
|
7
18
|
return styleText("blue", text);
|
|
8
19
|
}
|
|
@@ -19,4 +30,4 @@ function errorMsg(msg) {
|
|
|
19
30
|
console.error(styleText(["red", "bold"], "error:"), msg);
|
|
20
31
|
}
|
|
21
32
|
//#endregion
|
|
22
|
-
export {
|
|
33
|
+
export { printHeader as a, muted as i, errorMsg as n, success as o, log as r, warnMsg as s, accent as t };
|
package/dist/version.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "./main-A6UrSTYb.js";
|
|
2
|
-
import { r as log, t as accent } from "./terminal-
|
|
2
|
+
import { a as printHeader, r as log, t as accent } from "./terminal-CxTMfsxZ.js";
|
|
3
3
|
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-D_LD1iiI.js";
|
|
4
4
|
import { t as renderCliDoc } from "./help-BtkjXtRM.js";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { vitePlusHeader } from "../binding/index.js";
|
|
7
6
|
import fs from "node:fs";
|
|
8
7
|
//#region package.json
|
|
9
8
|
var version = "0.0.0";
|
|
@@ -62,8 +61,7 @@ async function printVersion(cwd) {
|
|
|
62
61
|
const localMetadata = getLocalMetadata(cwd);
|
|
63
62
|
const localVersion = localMetadata?.version ?? null;
|
|
64
63
|
const vpVersion = globalVersion ?? cliVersion ?? localVersion ?? "unknown";
|
|
65
|
-
|
|
66
|
-
log("");
|
|
64
|
+
printHeader();
|
|
67
65
|
log(`vp v${vpVersion}\n`);
|
|
68
66
|
const sections = [{
|
|
69
67
|
title: "Local vite-plus",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as PackageManager, N as editYamlFile, P as readYamlFile, Q as multiselect, Z as log, et as select, it as q } from "./agent-Dz7r-vyX.js";
|
|
2
2
|
import { t as require_dist } from "./dist-Dkzst9fl.js";
|
|
3
3
|
import { c as readJsonFile, l as writeJsonFile, o as editJsonFile, r as getScopeFromPackageName } from "./package-D_LD1iiI.js";
|
|
4
4
|
import path, { posix, win32 } from "node:path";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plus",
|
|
3
|
-
"version": "0.1.20-alpha.
|
|
3
|
+
"version": "0.1.20-alpha.1",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -322,8 +322,8 @@
|
|
|
322
322
|
"oxfmt": "=0.46.0",
|
|
323
323
|
"oxlint": "=1.61.0",
|
|
324
324
|
"oxlint-tsgolint": "=0.21.1",
|
|
325
|
-
"@voidzero-dev/vite-plus-
|
|
326
|
-
"@voidzero-dev/vite-plus-
|
|
325
|
+
"@voidzero-dev/vite-plus-core": "0.1.20-alpha.1",
|
|
326
|
+
"@voidzero-dev/vite-plus-test": "0.1.20-alpha.1"
|
|
327
327
|
},
|
|
328
328
|
"devDependencies": {
|
|
329
329
|
"@napi-rs/cli": "^3.6.1",
|
|
@@ -348,8 +348,8 @@
|
|
|
348
348
|
"validate-npm-package-name": "^7.0.2",
|
|
349
349
|
"yaml": "^2.8.1",
|
|
350
350
|
"@voidzero-dev/vite-plus-tools": "0.0.0",
|
|
351
|
-
"
|
|
352
|
-
"
|
|
351
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20-alpha.1",
|
|
352
|
+
"@voidzero-dev/vite-plus-prompts": "0.0.0"
|
|
353
353
|
},
|
|
354
354
|
"napi": {
|
|
355
355
|
"binaryName": "vite-plus",
|
|
@@ -369,14 +369,14 @@
|
|
|
369
369
|
"node": "^20.19.0 || >=22.12.0"
|
|
370
370
|
},
|
|
371
371
|
"optionalDependencies": {
|
|
372
|
-
"@voidzero-dev/vite-plus-darwin-arm64": "0.1.20-alpha.
|
|
373
|
-
"@voidzero-dev/vite-plus-darwin-x64": "0.1.20-alpha.
|
|
374
|
-
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.20-alpha.
|
|
375
|
-
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.20-alpha.
|
|
376
|
-
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.20-alpha.
|
|
377
|
-
"@voidzero-dev/vite-plus-linux-x64-musl": "0.1.20-alpha.
|
|
378
|
-
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.20-alpha.
|
|
379
|
-
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.20-alpha.
|
|
372
|
+
"@voidzero-dev/vite-plus-darwin-arm64": "0.1.20-alpha.1",
|
|
373
|
+
"@voidzero-dev/vite-plus-darwin-x64": "0.1.20-alpha.1",
|
|
374
|
+
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.20-alpha.1",
|
|
375
|
+
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.20-alpha.1",
|
|
376
|
+
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.20-alpha.1",
|
|
377
|
+
"@voidzero-dev/vite-plus-linux-x64-musl": "0.1.20-alpha.1",
|
|
378
|
+
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.20-alpha.1",
|
|
379
|
+
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.20-alpha.1"
|
|
380
380
|
},
|
|
381
381
|
"scripts": {
|
|
382
382
|
"build": "oxnode -C dev ./build.ts",
|