vite-plus 0.2.7 → 0.2.9
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/AGENTS.md +7 -0
- package/LICENSE +5 -1
- package/README.md +9 -3
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +106 -11
- package/dist/agent-DQU8uS6P.js +416 -0
- package/dist/bin.js +1388 -23
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +32 -133
- package/dist/{constants-BsuzPowC.js → constants-CG513DRa.js} +10 -2
- package/dist/create/bin.js +255 -268
- package/dist/{define-config-C2KfLHpC.js → define-config-CV4bQG_8.js} +3 -3
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- package/dist/{define-config-DLh9fE95.cjs → define-config-DyNLA_f0.cjs} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CKz3vcoG.js → dist-BDYZP12R.js} +196 -157
- package/dist/dist-Dqv1-Clg.js +3 -0
- package/dist/{agent-CPwWJ4qf.js → editor-g4PosU99.js} +819 -628
- package/dist/hooks/bin.d.ts +1 -0
- package/dist/hooks/bin.js +130 -0
- package/dist/hooks-pNCBWtFT.js +570 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-DiRs8ceZ.js → json-qlK6UH0r.js} +40 -38
- package/dist/migration/bin.js +65 -58
- package/dist/{oxlint-plugin-config-Bxgc4cwF.js → oxlint-plugin-config-BEZ9IUf7.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-Ds3uThLb.js → package-B4T8RGMG.js} +2 -2
- package/dist/{tsconfig-Jia2vgMG.js → prompts-CHz_98bJ.js} +169 -219
- package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-Dmeyeyj-.js} +2 -9
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +241 -226
- package/dist/terminal-Bz-ps6rJ.js +128 -0
- package/dist/test/browser/providers/playwright/context.d.ts +1 -1
- package/dist/test/browser/providers/playwright.d.ts +6 -6
- package/dist/test/browser/providers/preview/context.d.ts +1 -1
- package/dist/test/browser/providers/preview.d.ts +4 -4
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -1
- package/dist/test/browser/providers/webdriverio.d.ts +6 -6
- package/dist/test/browser-playwright/context.d.ts +1 -1
- package/dist/test/browser-playwright.d.ts +6 -6
- package/dist/test/browser-preview/context.d.ts +1 -1
- package/dist/test/browser-preview.d.ts +4 -4
- package/dist/test/browser-webdriverio/context.d.ts +1 -1
- package/dist/test/browser-webdriverio.d.ts +6 -6
- package/dist/test/context.d.ts +3 -3
- package/dist/test/locators.d.ts +1 -1
- package/dist/toolchain.d.ts +25 -0
- package/dist/toolchain.js +194 -0
- package/dist/toolchain.json +193 -0
- package/dist/tsconfig-7v_BHagU.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-CbDReEOx.js} +5 -3
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +6 -6
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +6 -6
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/ci.md +37 -4
- package/docs/guide/commit-hooks.md +112 -21
- package/docs/guide/create.md +7 -4
- package/docs/guide/env.md +8 -4
- package/docs/guide/fmt.md +2 -2
- package/docs/guide/github-actions-cache.md +5 -1
- package/docs/guide/ide-integration.md +61 -2
- package/docs/guide/index.md +4 -2
- package/docs/guide/install.md +27 -0
- package/docs/guide/installer-env-vars.md +14 -3
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate.md +49 -4
- package/docs/guide/monorepo.md +98 -10
- package/docs/guide/troubleshooting.md +12 -3
- package/docs/guide/upgrade.md +27 -4
- package/docs/package.json +1 -1
- package/docs/pnpm-workspace.yaml +7 -0
- package/docs/vite.config.ts +3 -0
- package/package.json +21 -23
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-BbT1lTNc.js +0 -675
- package/dist/help-YP84FSEz.js +0 -61
- package/dist/terminal-uTv0ZaMr.js +0 -33
- 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-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-DWoAkNdp.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
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
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-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-CV4bQG_8.js";
|
|
2
2
|
import { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } from "vitest/config";
|
|
3
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
export { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, lazyPlugins };
|
|
@@ -114,11 +114,13 @@ function createScanner(text, ignoreTrivia = false) {
|
|
|
114
114
|
start = pos;
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
|
-
if (ch >= 0 && ch <= 31)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
if (ch >= 0 && ch <= 31) {
|
|
118
|
+
if (isLineBreak(ch)) {
|
|
119
|
+
result += text.substring(start, pos);
|
|
120
|
+
scanError = 2;
|
|
121
|
+
break;
|
|
122
|
+
} else scanError = 6;
|
|
123
|
+
}
|
|
122
124
|
pos++;
|
|
123
125
|
}
|
|
124
126
|
return result;
|
|
@@ -535,14 +537,14 @@ function format(documentText, range, options) {
|
|
|
535
537
|
else if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) replaceContent = cachedSpaces[1];
|
|
536
538
|
else if (secondToken !== 5 && secondToken !== 17) hasError = true;
|
|
537
539
|
break;
|
|
538
|
-
case 16:
|
|
539
|
-
hasError = true;
|
|
540
|
-
break;
|
|
540
|
+
case 16: hasError = true;
|
|
541
541
|
}
|
|
542
542
|
if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) replaceContent = newLinesAndIndent();
|
|
543
543
|
}
|
|
544
|
-
if (secondToken === 17)
|
|
545
|
-
|
|
544
|
+
if (secondToken === 17) {
|
|
545
|
+
if (options.keepLines && numberLineBreaks > 0) replaceContent = newLinesAndIndent();
|
|
546
|
+
else replaceContent = options.insertFinalNewline ? eol : "";
|
|
547
|
+
}
|
|
546
548
|
const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
547
549
|
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
548
550
|
firstToken = secondToken;
|
|
@@ -800,9 +802,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
800
802
|
case 2:
|
|
801
803
|
handleError(12);
|
|
802
804
|
break;
|
|
803
|
-
case 6:
|
|
804
|
-
handleError(16);
|
|
805
|
-
break;
|
|
805
|
+
case 6: handleError(16);
|
|
806
806
|
}
|
|
807
807
|
switch (token) {
|
|
808
808
|
case 12:
|
|
@@ -968,9 +968,10 @@ function setProperty(text, originalPath, value, options) {
|
|
|
968
968
|
while (path.length > 0) {
|
|
969
969
|
lastSegment = path.pop();
|
|
970
970
|
parent = findNodeAtLocation(root, path);
|
|
971
|
-
if (parent === void 0 && value !== void 0)
|
|
972
|
-
|
|
973
|
-
|
|
971
|
+
if (parent === void 0 && value !== void 0) {
|
|
972
|
+
if (typeof lastSegment === "string") value = { [lastSegment]: value };
|
|
973
|
+
else value = [value];
|
|
974
|
+
} else break;
|
|
974
975
|
}
|
|
975
976
|
if (!parent) {
|
|
976
977
|
if (value === void 0) throw new Error("Can not delete in empty document");
|
|
@@ -981,29 +982,30 @@ function setProperty(text, originalPath, value, options) {
|
|
|
981
982
|
}, options);
|
|
982
983
|
} else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
|
|
983
984
|
const existing = findNodeAtLocation(parent, [lastSegment]);
|
|
984
|
-
if (existing !== void 0)
|
|
985
|
-
if (
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
985
|
+
if (existing !== void 0) {
|
|
986
|
+
if (value === void 0) {
|
|
987
|
+
if (!existing.parent) throw new Error("Malformed AST");
|
|
988
|
+
const propertyIndex = parent.children.indexOf(existing.parent);
|
|
989
|
+
let removeBegin;
|
|
990
|
+
let removeEnd = existing.parent.offset + existing.parent.length;
|
|
991
|
+
if (propertyIndex > 0) {
|
|
992
|
+
let previous = parent.children[propertyIndex - 1];
|
|
993
|
+
removeBegin = previous.offset + previous.length;
|
|
994
|
+
} else {
|
|
995
|
+
removeBegin = parent.offset + 1;
|
|
996
|
+
if (parent.children.length > 1) removeEnd = parent.children[1].offset;
|
|
997
|
+
}
|
|
998
|
+
return withFormatting(text, {
|
|
999
|
+
offset: removeBegin,
|
|
1000
|
+
length: removeEnd - removeBegin,
|
|
1001
|
+
content: ""
|
|
1002
|
+
}, options);
|
|
1003
|
+
} else return withFormatting(text, {
|
|
1004
|
+
offset: existing.offset,
|
|
1005
|
+
length: existing.length,
|
|
1006
|
+
content: JSON.stringify(value)
|
|
1000
1007
|
}, options);
|
|
1001
|
-
} else
|
|
1002
|
-
offset: existing.offset,
|
|
1003
|
-
length: existing.length,
|
|
1004
|
-
content: JSON.stringify(value)
|
|
1005
|
-
}, options);
|
|
1006
|
-
else {
|
|
1008
|
+
} else {
|
|
1007
1009
|
if (value === void 0) return [];
|
|
1008
1010
|
const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
|
|
1009
1011
|
const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { r as __toESM } from "../rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as writeJsonFile, i as readJsonFile } from "../json-
|
|
1
|
+
import { r as __toESM } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
|
+
import { a as muted, c as warnMsg, i as log, l as renderCliDoc, o as printHeader, r as formatDuration, t as accent } from "../terminal-Bz-ps6rJ.js";
|
|
3
|
+
import { f as isForceOverrideMode, u as VITE_PLUS_VERSION } from "../constants-CG513DRa.js";
|
|
4
|
+
import { A as isCancel, C as log$1, D as spinner, E as select, M as runCommandSilently, 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-CHz_98bJ.js";
|
|
5
|
+
import { a as writeJsonFile, i as readJsonFile } from "../json-qlK6UH0r.js";
|
|
6
|
+
import { i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-7v_BHagU.js";
|
|
6
7
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
7
|
-
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-
|
|
8
|
-
import {
|
|
8
|
+
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-B4T8RGMG.js";
|
|
9
|
+
import { i as selectAgentTargetPaths, l as displayRelative, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-DQU8uS6P.js";
|
|
9
10
|
import { n as addMigrationWarning, r as createMigrationReport } from "../report-BS7ULx7A.js";
|
|
10
|
-
import {
|
|
11
|
-
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
11
|
+
import { B as warnPackageLevelPrettier, C as mergeViteConfigFiles, D as configureYarnNodeModulesMode, E as ensureVitePlusBootstrap, F as hasFrameworkShim, H as detectEslintProject, I as confirmPrettierMigration, J as warnPackageLevelEslint, K as warnIncompatibleEslintIntegration, L as detectPrettierProject, N as addFrameworkShim, O as detectYarnPnpMode, P as detectFramework, R as migratePrettierToOxfmt, S as injectLintTypeCheckDefaults, T as detectVitePlusBootstrapPending, U as detectIncompatibleEslintIntegration, V as confirmEslintMigration, W as migrateEslintToOxlint, X as checkVitestVersion, Y as checkViteVersion, _ as preflightGitHooksSetup, d as finalizeCoreMigrationForExistingVitePlus, f as detectNodeVersionManagerFile, g as installGitHooks, h as detectLegacyGitHooksMigrationCandidate, i as selectEditor, k as detectWorkspace, l as rewriteStandaloneProject, o as writeEditorConfigs, p as migrateNodeVersionManagerFile, q as warnLegacyEslintConfig, r as isJsonLikeFile, s as rewriteMonorepo, t as detectEditorConflicts, u as detectPendingCoreMigration, v as shouldSkipStagedMigrationForHooks, w as collectToolchainVersionChanges } from "../editor-g4PosU99.js";
|
|
12
12
|
import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../protocol-D99W10Qi.js";
|
|
13
13
|
import path from "node:path";
|
|
14
|
-
import fs, { existsSync } from "node:fs";
|
|
15
|
-
import { styleText } from "node:util";
|
|
16
14
|
import { fileURLToPath } from "node:url";
|
|
15
|
+
import { styleText } from "node:util";
|
|
16
|
+
import fs, { existsSync } from "node:fs";
|
|
17
17
|
//#region src/migration/compat/runner.ts
|
|
18
18
|
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
19
19
|
/**
|
|
@@ -290,12 +290,12 @@ function prepareNpmViteAliasReinstall(rootDir, projectPaths = [rootDir]) {
|
|
|
290
290
|
}
|
|
291
291
|
//#endregion
|
|
292
292
|
//#region src/migration/setup-plan.ts
|
|
293
|
-
async function collectGitHooksDecision(rootDir, packageManager, options) {
|
|
293
|
+
async function collectGitHooksDecision(rootDir, packageManager, options, packages = []) {
|
|
294
294
|
let shouldSetupHooks = await promptGitHooks(options);
|
|
295
295
|
if (shouldSetupHooks) {
|
|
296
|
-
const reason = preflightGitHooksSetup(rootDir, packageManager);
|
|
296
|
+
const reason = preflightGitHooksSetup(rootDir, packageManager, packages);
|
|
297
297
|
if (reason) {
|
|
298
|
-
log.warn(`⚠ ${reason}`);
|
|
298
|
+
log$1.warn(`⚠ ${reason}`);
|
|
299
299
|
shouldSetupHooks = false;
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -362,7 +362,7 @@ async function collectEditorConfigPlan(rootDir, options) {
|
|
|
362
362
|
});
|
|
363
363
|
if (isCancel(action)) cancelAndExit();
|
|
364
364
|
editorConflictDecisions.set(conflict.fileName, action);
|
|
365
|
-
} else editorConflictDecisions.set(conflict.fileName, "merge");
|
|
365
|
+
} else editorConflictDecisions.set(conflict.fileName, isJsonLikeFile(conflict.fileName) ? "merge" : "skip");
|
|
366
366
|
return {
|
|
367
367
|
selectedEditor,
|
|
368
368
|
editorConflictDecisions
|
|
@@ -382,7 +382,7 @@ async function collectEslintMigrationDecision(rootDir, options, packages) {
|
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
async function collectMigrationSetupPlan(rootDir, packageManager, options, packages, includeEslint = true) {
|
|
385
|
-
const shouldSetupHooks = await collectGitHooksDecision(rootDir, packageManager, options);
|
|
385
|
+
const shouldSetupHooks = await collectGitHooksDecision(rootDir, packageManager, options, packages);
|
|
386
386
|
const agentPlan = await collectAgentInstructionPlan(rootDir, options);
|
|
387
387
|
const editorPlan = await collectEditorConfigPlan(rootDir, options);
|
|
388
388
|
const eslintPlan = includeEslint ? await collectEslintMigrationDecision(rootDir, options, packages) : { migrateEslint: false };
|
|
@@ -429,7 +429,7 @@ async function confirmYarnNodeModulesMode(rootDir, packageManager, packageManage
|
|
|
429
429
|
if (packageManager !== PackageManager.yarn) return false;
|
|
430
430
|
const pnp = detectYarnPnpMode(rootDir, packageManagerVersion);
|
|
431
431
|
if (!pnp) return false;
|
|
432
|
-
log.warn(`⚠ Vite+ does not currently support Yarn Plug'n'Play (PnP).`);
|
|
432
|
+
log$1.warn(`⚠ Vite+ does not currently support Yarn Plug'n'Play (PnP).`);
|
|
433
433
|
if (pnp.source === "environment") cancelAndExit("YARN_NODE_LINKER=pnp overrides project configuration. Set it to node-modules or unset it, then re-run `vp migrate`.", 1);
|
|
434
434
|
if (interactive) {
|
|
435
435
|
const confirmed = await confirm({
|
|
@@ -451,7 +451,10 @@ async function fixBaseUrlForWorkspace(workspaceInfo, fixBaseUrl, updateProgress,
|
|
|
451
451
|
confirmed: true,
|
|
452
452
|
silent: true
|
|
453
453
|
});
|
|
454
|
-
if (status === "failed")
|
|
454
|
+
if (status === "failed") {
|
|
455
|
+
const projectLabel = displayRelative(projectPath, workspaceInfo.rootDir) || ".";
|
|
456
|
+
addMigrationWarning(report, `Failed to remove tsconfig baseUrl in ${projectLabel}. Run \`vp dlx @andrewbranch/ts5to6 --fixBaseUrl <tsconfig path>\` manually and re-run the migration.`);
|
|
457
|
+
}
|
|
455
458
|
if (status === "fixed") fixedProjectPaths.push(projectPath);
|
|
456
459
|
}
|
|
457
460
|
return fixedProjectPaths;
|
|
@@ -581,7 +584,8 @@ const helpMessage = renderCliDoc({
|
|
|
581
584
|
]
|
|
582
585
|
});
|
|
583
586
|
function parseArgs() {
|
|
584
|
-
const
|
|
587
|
+
const args = process.argv.slice(3);
|
|
588
|
+
const parsed = lib_default(args, {
|
|
585
589
|
alias: { h: "help" },
|
|
586
590
|
boolean: [
|
|
587
591
|
"help",
|
|
@@ -692,12 +696,6 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, detectedPac
|
|
|
692
696
|
frameworkShimFrameworks
|
|
693
697
|
};
|
|
694
698
|
}
|
|
695
|
-
function formatDuration(durationMs) {
|
|
696
|
-
if (durationMs < 1e3) return `${Math.max(1, durationMs)}ms`;
|
|
697
|
-
const durationSeconds = durationMs / 1e3;
|
|
698
|
-
if (durationSeconds < 10) return `${durationSeconds.toFixed(1)}s`;
|
|
699
|
-
return `${Math.round(durationSeconds)}s`;
|
|
700
|
-
}
|
|
701
699
|
/**
|
|
702
700
|
* Reconcile a CommandRunSummary from `runViteInstall` with the migration's
|
|
703
701
|
* duration counter and exit-code state. `runViteInstall` returns
|
|
@@ -724,37 +722,42 @@ function showMigrationSummary(options) {
|
|
|
724
722
|
const { projectRoot, packageManager, packageManagerVersion, installDurationMs, finalInstallOk, report, updatedExistingVitePlus, suggestFullMigration } = options;
|
|
725
723
|
const projectLabel = displayRelative(projectRoot) || ".";
|
|
726
724
|
const configUpdates = report.createdViteConfigCount + report.mergedConfigCount + report.mergedStagedConfigCount + report.inlinedLintStagedConfigCount + report.removedConfigCount + report.tsdownImportCount + report.wrappedPluginConfigCount;
|
|
727
|
-
log
|
|
728
|
-
log
|
|
725
|
+
log(`${styleText("magenta", "◇")} ${updatedExistingVitePlus ? "Updated" : "Migrated"} ${accent(projectLabel)} to Vite+ ${VITE_PLUS_VERSION}`);
|
|
726
|
+
log(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
|
|
729
727
|
if (report.dependencyUpgrades.length > 0) {
|
|
730
728
|
const nameWidth = Math.max(...report.dependencyUpgrades.map((change) => change.name.length));
|
|
731
729
|
const fromWidth = Math.max(...report.dependencyUpgrades.map((change) => (change.from ?? "").length));
|
|
732
|
-
log
|
|
733
|
-
for (const change of report.dependencyUpgrades)
|
|
730
|
+
log(`${styleText("gray", "•")} Dependencies:`);
|
|
731
|
+
for (const change of report.dependencyUpgrades) {
|
|
732
|
+
const name = change.name.padEnd(nameWidth);
|
|
733
|
+
const from = muted((change.from ?? "").padEnd(fromWidth));
|
|
734
|
+
const to = styleText("green", change.to);
|
|
735
|
+
log(` ${name} ${from} → ${to}`);
|
|
736
|
+
}
|
|
734
737
|
}
|
|
735
|
-
if (finalInstallOk && installDurationMs > 0) log
|
|
738
|
+
if (finalInstallOk && installDurationMs > 0) log(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installDurationMs)}`);
|
|
736
739
|
if (configUpdates > 0 || report.rewrittenImportFileCount > 0) {
|
|
737
740
|
const parts = [];
|
|
738
741
|
if (configUpdates > 0) parts.push(`${configUpdates} ${configUpdates === 1 ? "config update" : "config updates"} applied`);
|
|
739
742
|
if (report.rewrittenImportFileCount > 0) parts.push(`${report.rewrittenImportFileCount} ${report.rewrittenImportFileCount === 1 ? "file had" : "files had"} imports rewritten`);
|
|
740
|
-
log
|
|
743
|
+
log(`${styleText("gray", "•")} ${parts.join(", ")}`);
|
|
741
744
|
}
|
|
742
|
-
if (report.preservedUpstreamVitestImportFileCount > 0) log
|
|
743
|
-
if (report.eslintMigrated) log
|
|
744
|
-
if (report.prettierMigrated) log
|
|
745
|
-
if (report.nodeVersionFileMigrated) log
|
|
746
|
-
if (report.wrappedPluginConfigCount > 0) log
|
|
747
|
-
if (report.gitHooksConfigured) log
|
|
748
|
-
if (report.frameworkShimAdded) log
|
|
749
|
-
if (report.packageManagerBootstrapConfigured) log
|
|
750
|
-
if (suggestFullMigration) log
|
|
745
|
+
if (report.preservedUpstreamVitestImportFileCount > 0) log(`${styleText("gray", "•")} Kept upstream \`vitest\` imports in ${report.preservedUpstreamVitestImportFileCount} ${report.preservedUpstreamVitestImportFileCount === 1 ? "file" : "files"} for @nuxt/test-utils compatibility`);
|
|
746
|
+
if (report.eslintMigrated) log(`${styleText("gray", "•")} ESLint rules migrated to Oxlint`);
|
|
747
|
+
if (report.prettierMigrated) log(`${styleText("gray", "•")} Prettier migrated to Oxfmt`);
|
|
748
|
+
if (report.nodeVersionFileMigrated) log(`${styleText("gray", "•")} Node version manager file migrated to .node-version`);
|
|
749
|
+
if (report.wrappedPluginConfigCount > 0) log(`${styleText("gray", "•")} Inline Vite plugins wrapped with lazyPlugins for check/lint/fmt`);
|
|
750
|
+
if (report.gitHooksConfigured) log(`${styleText("gray", "•")} Git hooks configured`);
|
|
751
|
+
if (report.frameworkShimAdded) log(`${styleText("gray", "•")} TypeScript shim added for framework component files`);
|
|
752
|
+
if (report.packageManagerBootstrapConfigured) log(`${styleText("gray", "•")} Package manager settings configured`);
|
|
753
|
+
if (suggestFullMigration) log(FULL_MIGRATION_HINT);
|
|
751
754
|
if (report.warnings.length > 0) {
|
|
752
|
-
log
|
|
753
|
-
for (const warning of report.warnings) log
|
|
755
|
+
log(`${styleText("yellow", "!")} Warnings:`);
|
|
756
|
+
for (const warning of report.warnings) log(` - ${warning}`);
|
|
754
757
|
}
|
|
755
758
|
if (report.manualSteps.length > 0) {
|
|
756
|
-
log
|
|
757
|
-
for (const step of report.manualSteps) log
|
|
759
|
+
log(`${styleText("blue", "→")} Manual follow-up:`);
|
|
760
|
+
for (const step of report.manualSteps) log(` - ${step}`);
|
|
758
761
|
}
|
|
759
762
|
}
|
|
760
763
|
async function downloadSupportedPackageManager(options) {
|
|
@@ -766,11 +769,11 @@ async function downloadSupportedPackageManager(options) {
|
|
|
766
769
|
await upgradeYarn(rootDir, interactive, true);
|
|
767
770
|
} else if (packageManager === PackageManager.pnpm && import_semver.default.satisfies(downloadResult.version, "< 9.5.0")) {
|
|
768
771
|
failMigrationProgress("Migration failed");
|
|
769
|
-
log.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
772
|
+
log$1.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
770
773
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
771
774
|
} else if (packageManager === PackageManager.npm && import_semver.default.satisfies(downloadResult.version, "< 8.3.0")) {
|
|
772
775
|
failMigrationProgress("Migration failed");
|
|
773
|
-
log.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
776
|
+
log$1.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
774
777
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
775
778
|
}
|
|
776
779
|
return downloadResult;
|
|
@@ -816,7 +819,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
|
|
|
816
819
|
if (plan.convertYarnPnp) {
|
|
817
820
|
updateMigrationProgress("Configuring Yarn node-modules mode");
|
|
818
821
|
report.packageManagerBootstrapConfigured = configureYarnNodeModulesMode(workspaceInfo.rootDir);
|
|
819
|
-
if (report.packageManagerBootstrapConfigured) log.success("✔ Switched Yarn to node-modules mode");
|
|
822
|
+
if (report.packageManagerBootstrapConfigured) log$1.success("✔ Switched Yarn to node-modules mode");
|
|
820
823
|
}
|
|
821
824
|
if (plan.migrateNodeVersionFile && plan.nodeVersionDetection) {
|
|
822
825
|
updateMigrationProgress("Migrating node version file");
|
|
@@ -857,13 +860,13 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
|
|
|
857
860
|
cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
858
861
|
}
|
|
859
862
|
}
|
|
860
|
-
const skipStagedMigration =
|
|
863
|
+
const skipStagedMigration = shouldSkipStagedMigrationForHooks(workspaceInfo.rootDir, plan.shouldSetupHooks, plan.packageManager, workspaceInfo.packages);
|
|
861
864
|
updateMigrationProgress("Rewriting configs");
|
|
862
865
|
if (workspaceInfo.isMonorepo) rewriteMonorepo(workspaceInfo, skipStagedMigration, true, report);
|
|
863
866
|
else rewriteStandaloneProject(workspaceInfo.rootDir, workspaceInfo, skipStagedMigration, true, report);
|
|
864
867
|
if (plan.shouldSetupHooks) {
|
|
865
868
|
updateMigrationProgress("Configuring git hooks");
|
|
866
|
-
installGitHooks(workspaceInfo.rootDir, true, report, plan.packageManager);
|
|
869
|
+
installGitHooks(workspaceInfo.rootDir, true, report, plan.packageManager, workspaceInfo.packages);
|
|
867
870
|
}
|
|
868
871
|
updateMigrationProgress("Writing agent instructions");
|
|
869
872
|
await writeAgentInstructions({
|
|
@@ -879,7 +882,8 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
|
|
|
879
882
|
editorId: plan.selectedEditor,
|
|
880
883
|
interactive,
|
|
881
884
|
conflictDecisions: plan.editorConflictDecisions,
|
|
882
|
-
silent: true
|
|
885
|
+
silent: true,
|
|
886
|
+
packageManager: plan.packageManager
|
|
883
887
|
});
|
|
884
888
|
addFrameworkShimsForWorkspace(workspaceInfo.rootDir, plan.frameworkShimFrameworks, workspaceInfo.packages, report, updateMigrationProgress);
|
|
885
889
|
const installArgs = plan.packageManager === PackageManager.npm || plan.packageManager === PackageManager.bun ? ["--force"] : ["--no-frozen-lockfile"];
|
|
@@ -907,15 +911,17 @@ async function main() {
|
|
|
907
911
|
const { projectPath, options } = parseArgs();
|
|
908
912
|
if (options.help) {
|
|
909
913
|
printHeader();
|
|
910
|
-
log
|
|
914
|
+
log(helpMessage);
|
|
911
915
|
return;
|
|
912
916
|
}
|
|
913
917
|
printHeader();
|
|
914
918
|
const workspaceInfoOptional = await detectWorkspace(projectPath);
|
|
919
|
+
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);
|
|
915
920
|
const initialChangedPaths = await collectChangedFormatPaths(workspaceInfoOptional.rootDir);
|
|
916
921
|
const preExistingChangedPaths = initialChangedPaths ? new Set(initialChangedPaths) : void 0;
|
|
917
922
|
const resolvedPackageManager = workspaceInfoOptional.packageManager ?? "unknown";
|
|
918
|
-
|
|
923
|
+
const rootPkg = readNearestPackageJson(workspaceInfoOptional.rootDir);
|
|
924
|
+
if (hasVitePlusDependency(rootPkg) && !isForceOverrideMode()) {
|
|
919
925
|
let convertYarnPnp = await confirmYarnNodeModulesMode(workspaceInfoOptional.rootDir, workspaceInfoOptional.packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive);
|
|
920
926
|
let didMigrate = false;
|
|
921
927
|
let installDurationMs = 0;
|
|
@@ -978,7 +984,7 @@ async function main() {
|
|
|
978
984
|
const fullSetup = options.full === true;
|
|
979
985
|
const skippedSetupCandidates = !fullSetup && !hasExplicitExistingVitePlusSetupRequest(options) && hasExistingVitePlusMigrationCandidates(workspaceInfoOptional, options);
|
|
980
986
|
if (!didMigrate && !convertYarnPnp && report.warnings.length === 0 && !vitePlusBootstrapPending && !(fullSetup ? hasExistingVitePlusMigrationCandidates(workspaceInfoOptional, options) : hasExplicitExistingVitePlusSetupRequest(options))) {
|
|
981
|
-
if (skippedSetupCandidates) log
|
|
987
|
+
if (skippedSetupCandidates) log(FULL_MIGRATION_HINT);
|
|
982
988
|
outro(`This project is already using Vite+! ${accent("Happy coding!")}`);
|
|
983
989
|
return;
|
|
984
990
|
}
|
|
@@ -1053,7 +1059,7 @@ async function main() {
|
|
|
1053
1059
|
if (convertYarnPnp) {
|
|
1054
1060
|
updateMigrationProgress("Configuring Yarn node-modules mode");
|
|
1055
1061
|
if (configureYarnNodeModulesMode(workspaceInfoOptional.rootDir)) {
|
|
1056
|
-
log.success("✔ Switched Yarn to node-modules mode");
|
|
1062
|
+
log$1.success("✔ Switched Yarn to node-modules mode");
|
|
1057
1063
|
report.packageManagerBootstrapConfigured = true;
|
|
1058
1064
|
didMigrate = true;
|
|
1059
1065
|
needsInstall = true;
|
|
@@ -1071,7 +1077,7 @@ async function main() {
|
|
|
1071
1077
|
if (plan.shouldSetupHooks) {
|
|
1072
1078
|
await ensureExistingPackageManager();
|
|
1073
1079
|
updateMigrationProgress("Configuring git hooks");
|
|
1074
|
-
if (installGitHooks(workspaceInfoOptional.rootDir, true, report, packageManager)) {
|
|
1080
|
+
if (installGitHooks(workspaceInfoOptional.rootDir, true, report, packageManager, workspaceInfoOptional.packages)) {
|
|
1075
1081
|
didMigrate = true;
|
|
1076
1082
|
needsInstall = true;
|
|
1077
1083
|
}
|
|
@@ -1112,7 +1118,8 @@ async function main() {
|
|
|
1112
1118
|
editorId: plan.selectedEditor,
|
|
1113
1119
|
interactive: options.interactive,
|
|
1114
1120
|
conflictDecisions: plan.editorConflictDecisions,
|
|
1115
|
-
silent: true
|
|
1121
|
+
silent: true,
|
|
1122
|
+
packageManager
|
|
1116
1123
|
});
|
|
1117
1124
|
didMigrate = true;
|
|
1118
1125
|
}
|
|
@@ -1135,7 +1142,7 @@ async function main() {
|
|
|
1135
1142
|
});
|
|
1136
1143
|
} else {
|
|
1137
1144
|
clearMigrationProgress();
|
|
1138
|
-
if (skippedSetupCandidates) log
|
|
1145
|
+
if (skippedSetupCandidates) log(FULL_MIGRATION_HINT);
|
|
1139
1146
|
outro(`This project is already using Vite+! ${accent("Happy coding!")}`);
|
|
1140
1147
|
}
|
|
1141
1148
|
return;
|
|
@@ -1152,7 +1159,7 @@ async function main() {
|
|
|
1152
1159
|
});
|
|
1153
1160
|
}
|
|
1154
1161
|
main().catch((err) => {
|
|
1155
|
-
log.error(err.message);
|
|
1162
|
+
log$1.error(err.message);
|
|
1156
1163
|
console.error(err);
|
|
1157
1164
|
process.exit(1);
|
|
1158
1165
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as VITE_PLUS_NAME } from "./constants-CG513DRa.js";
|
|
2
2
|
//#region src/oxlint-plugin-config.ts
|
|
3
3
|
const VITE_PLUS_OXLINT_PLUGIN_NAME = VITE_PLUS_NAME;
|
|
4
4
|
const VITE_PLUS_OXLINT_PLUGIN_SPECIFIER = `${VITE_PLUS_NAME}/oxlint-plugin`;
|
package/dist/oxlint-plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-
|
|
1
|
+
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-BEZ9IUf7.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { definePlugin, defineRule } from "@oxlint/plugins";
|
package/dist/pack-bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as resolveViteConfig } from "./resolve-vite-config-
|
|
2
|
+
import { a as resolveViteConfig } from "./resolve-vite-config-Dmeyeyj-.js";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { buildWithConfigs, enableDebug, globalLogger, resolveUserConfig } from "@voidzero-dev/vite-plus-core/pack";
|
|
5
5
|
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./constants-
|
|
2
|
-
import { i as readJsonFile } from "./json-
|
|
1
|
+
import "./constants-CG513DRa.js";
|
|
2
|
+
import { i as readJsonFile } from "./json-qlK6UH0r.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs";
|