vite-plus 0.1.22 → 0.1.23
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 +119 -52
- package/binding/index.d.cts +3222 -2
- package/dist/agent-aSGY0osq.js +2461 -0
- package/dist/bin.js +6 -5
- package/dist/cli-truncate-CWsmbK3p.js +867 -0
- package/dist/{compat-OlmU9EQz.js → compat-DXZgnEyq.js} +1 -1
- package/dist/config/bin.js +18 -5
- package/dist/{constants-kDaYqyWd.js → constants-DCBWlNrn.js} +7 -2
- package/dist/create/bin.js +135 -64
- package/dist/{define-config-IMCGDS2K.d.ts → define-config-COdn-tsn.d.ts} +7 -5
- 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-Bapm49IR.js +3 -0
- package/dist/{dist-owlRxmBM.js → dist-BgQuvbtq.js} +136 -110
- package/dist/fmt.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/is-fullwidth-code-point-BUNlIICg.js +8 -0
- package/dist/lint.d.ts +1 -1
- package/dist/{log-update-NRrY6krx.js → log-update-lyIiuflf.js} +111 -24
- package/dist/migration/bin.js +71 -30
- package/dist/{oxlint-plugin-config-BkQeR4FR.js → oxlint-plugin-config-B89iKTKN.js} +1 -1
- package/dist/oxlint-plugin.d.ts +2 -4
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/pack.d.ts +1 -1
- package/dist/{package-BoLLED6j.js → package-PmBUZ-ve.js} +2 -2
- package/dist/staged/bin.js +10 -10
- package/dist/strip-ansi-C3wrWz9t.js +853 -0
- package/dist/{agent-BWLe0i9g.js → tsconfig-DlUVXT3J.js} +648 -2089
- package/dist/version.js +5 -5
- package/dist/versions.js +6 -6
- package/dist/{workspace-Bi_9spVt.js → workspace-DElv730L.js} +13 -12
- package/dist/wrap-ansi-CeQuiQ31.js +2 -0
- package/dist/{wrap-ansi-DtUeUCjE.js → wrap-ansi-k7Dn4VtV.js} +1 -1
- package/docs/config/run.md +39 -4
- package/docs/guide/cache.md +10 -1
- package/docs/guide/env.md +3 -0
- package/docs/guide/ide-integration.md +2 -2
- package/docs/guide/install.md +2 -0
- package/docs/guide/run.md +2 -0
- package/docs/guide/troubleshooting.md +5 -2
- package/package.json +18 -18
- package/templates/monorepo/_gitignore +1 -0
- package/dist/cli-truncate-B62YnW2m.js +0 -138
- package/dist/dist-DZfItHAr.js +0 -3
- package/dist/slice-ansi-e4todZeH.js +0 -113
- package/dist/strip-ansi-D-eYYcD2.js +0 -198
- package/dist/tsconfig-BVyzXJ_o.js +0 -517
- package/dist/wrap-ansi-3S3qJ7j8.js +0 -2
- /package/dist/{chunk-q7NCDQ7-.js → chunk-DnnnRqeS.js} +0 -0
- /package/dist/{define-config-GqLoRwH9.cjs → define-config-BR1Y88zz.cjs} +0 -0
- /package/dist/{define-config-CzWdQTt2.js → define-config-BRC7qPNE.js} +0 -0
- /package/dist/{help-DK5wuu34.js → help-YP84FSEz.js} +0 -0
- /package/dist/{lib-DpwyUJWo.js → lib-L3DWSRQp.js} +0 -0
- /package/dist/{main-DhsO6ndq.js → main-DpJl3LoU.js} +0 -0
- /package/dist/{pack-K7H72Cum.d.ts → pack-Ciiho0Tq.d.ts} +0 -0
- /package/dist/{report-CYPv1VK1.js → report-DgSBQUdz.js} +0 -0
- /package/dist/{resolve-vite-config-C5AjksTj.js → resolve-vite-config-TTvhycU1.js} +0 -0
- /package/dist/{terminal-D_Kg-AA6.js → terminal-uTv0ZaMr.js} +0 -0
package/dist/fmt.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_define_config = require("./define-config-
|
|
1
|
+
const require_define_config = require("./define-config-BR1Y88zz.cjs");
|
|
2
2
|
//#region src/index.cts
|
|
3
3
|
const vite = require("@voidzero-dev/vite-plus-core");
|
|
4
4
|
const vitest = require("@voidzero-dev/vite-plus-test/config");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-COdn-tsn.js";
|
|
2
2
|
export * from "@voidzero-dev/vite-plus-test/config";
|
|
3
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
export { defineConfig, lazyPlugins };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-BRC7qPNE.js";
|
|
2
2
|
export * from "@voidzero-dev/vite-plus-test/config";
|
|
3
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
export { defineConfig, lazyPlugins };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { i as isWide, r as isFullWidth } from "./strip-ansi-C3wrWz9t.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/is-fullwidth-code-point@5.1.0/node_modules/is-fullwidth-code-point/index.js
|
|
3
|
+
function isFullwidthCodePoint(codePoint) {
|
|
4
|
+
if (!Number.isInteger(codePoint)) return false;
|
|
5
|
+
return isFullWidth(codePoint) || isWide(codePoint);
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { isFullwidthCodePoint as t };
|
package/dist/lint.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "oxlint";
|
|
1
|
+
export type * from "oxlint";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as stripAnsi } from "./strip-ansi-
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as wrapAnsi } from "./wrap-ansi-
|
|
1
|
+
import { a as ansiStyles, t as stripAnsi } from "./strip-ansi-C3wrWz9t.js";
|
|
2
|
+
import { t as isFullwidthCodePoint } from "./is-fullwidth-code-point-BUNlIICg.js";
|
|
3
|
+
import { t as wrapAnsi } from "./wrap-ansi-k7Dn4VtV.js";
|
|
4
4
|
import process$1 from "node:process";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
//#region ../../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
|
|
@@ -23,34 +23,18 @@ platform === "Android" || globalThis.navigator?.platform === "Android" || global
|
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region ../../node_modules/.pnpm/ansi-escapes@7.2.0/node_modules/ansi-escapes/base.js
|
|
25
25
|
const ESC = "\x1B[";
|
|
26
|
-
|
|
26
|
+
!isBrowser && process$1.env.TERM_PROGRAM;
|
|
27
27
|
const isWindows = !isBrowser && process$1.platform === "win32";
|
|
28
28
|
!isBrowser && (process$1.env.TERM?.startsWith("screen") || process$1.env.TERM?.startsWith("tmux") || process$1.env.TMUX);
|
|
29
29
|
isBrowser || process$1.cwd;
|
|
30
30
|
const cursorUp = (count = 1) => ESC + count + "A";
|
|
31
|
-
ESC + "";
|
|
32
|
-
isTerminalApp || ESC + "";
|
|
33
|
-
isTerminalApp || ESC + "";
|
|
34
|
-
ESC + "";
|
|
35
|
-
ESC + "";
|
|
36
|
-
ESC + "";
|
|
37
|
-
ESC + "";
|
|
38
|
-
ESC + "";
|
|
39
31
|
const eraseLines = (count) => {
|
|
40
32
|
let clear = "";
|
|
41
33
|
for (let i = 0; i < count; i++) clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
42
34
|
if (count) clear += "\x1B[G";
|
|
43
35
|
return clear;
|
|
44
36
|
};
|
|
45
|
-
|
|
46
|
-
ESC + "";
|
|
47
|
-
const eraseLine = ESC + "2K";
|
|
48
|
-
ESC + "";
|
|
49
|
-
ESC + "";
|
|
50
|
-
const eraseScreen = ESC + "2J";
|
|
51
|
-
ESC + "";
|
|
52
|
-
ESC + "";
|
|
53
|
-
`${eraseScreen}${ESC}`;
|
|
37
|
+
const eraseLine = "\x1B[2K";
|
|
54
38
|
const isOldWindows = () => {
|
|
55
39
|
if (isBrowser || !isWindows) return false;
|
|
56
40
|
const parts = os.release().split(".");
|
|
@@ -60,9 +44,7 @@ const isOldWindows = () => {
|
|
|
60
44
|
if (major === 10 && build < 10586) return true;
|
|
61
45
|
return false;
|
|
62
46
|
};
|
|
63
|
-
isOldWindows()
|
|
64
|
-
ESC + "";
|
|
65
|
-
ESC + "";
|
|
47
|
+
isOldWindows();
|
|
66
48
|
//#endregion
|
|
67
49
|
//#region ../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
|
|
68
50
|
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
@@ -355,6 +337,111 @@ cliCursor.toggle = (force, writableStream) => {
|
|
|
355
337
|
else cliCursor.hide(writableStream);
|
|
356
338
|
};
|
|
357
339
|
//#endregion
|
|
340
|
+
//#region ../../node_modules/.pnpm/slice-ansi@7.1.2/node_modules/slice-ansi/index.js
|
|
341
|
+
const ESCAPES = new Set([27, 155]);
|
|
342
|
+
const CODE_POINT_0 = "0".codePointAt(0);
|
|
343
|
+
const CODE_POINT_9 = "9".codePointAt(0);
|
|
344
|
+
const MAX_ANSI_SEQUENCE_LENGTH = 19;
|
|
345
|
+
const endCodesSet = /* @__PURE__ */ new Set();
|
|
346
|
+
const endCodesMap = /* @__PURE__ */ new Map();
|
|
347
|
+
for (const [start, end] of ansiStyles.codes) {
|
|
348
|
+
endCodesSet.add(ansiStyles.color.ansi(end));
|
|
349
|
+
endCodesMap.set(ansiStyles.color.ansi(start), ansiStyles.color.ansi(end));
|
|
350
|
+
}
|
|
351
|
+
function getEndCode(code) {
|
|
352
|
+
if (endCodesSet.has(code)) return code;
|
|
353
|
+
if (endCodesMap.has(code)) return endCodesMap.get(code);
|
|
354
|
+
code = code.slice(2);
|
|
355
|
+
if (code.includes(";")) code = code[0] + "0";
|
|
356
|
+
const returnValue = ansiStyles.codes.get(Number.parseInt(code, 10));
|
|
357
|
+
if (returnValue) return ansiStyles.color.ansi(returnValue);
|
|
358
|
+
return ansiStyles.reset.open;
|
|
359
|
+
}
|
|
360
|
+
function findNumberIndex(string) {
|
|
361
|
+
for (let index = 0; index < string.length; index++) {
|
|
362
|
+
const codePoint = string.codePointAt(index);
|
|
363
|
+
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) return index;
|
|
364
|
+
}
|
|
365
|
+
return -1;
|
|
366
|
+
}
|
|
367
|
+
function parseAnsiCode(string, offset) {
|
|
368
|
+
string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
|
|
369
|
+
const startIndex = findNumberIndex(string);
|
|
370
|
+
if (startIndex !== -1) {
|
|
371
|
+
let endIndex = string.indexOf("m", startIndex);
|
|
372
|
+
if (endIndex === -1) endIndex = string.length;
|
|
373
|
+
return string.slice(0, endIndex + 1);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
377
|
+
const returnValue = [];
|
|
378
|
+
let index = 0;
|
|
379
|
+
let visibleCount = 0;
|
|
380
|
+
while (index < string.length) {
|
|
381
|
+
const codePoint = string.codePointAt(index);
|
|
382
|
+
if (ESCAPES.has(codePoint)) {
|
|
383
|
+
const code = parseAnsiCode(string, index);
|
|
384
|
+
if (code) {
|
|
385
|
+
returnValue.push({
|
|
386
|
+
type: "ansi",
|
|
387
|
+
code,
|
|
388
|
+
endCode: getEndCode(code)
|
|
389
|
+
});
|
|
390
|
+
index += code.length;
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const isFullWidth = isFullwidthCodePoint(codePoint);
|
|
395
|
+
const character = String.fromCodePoint(codePoint);
|
|
396
|
+
returnValue.push({
|
|
397
|
+
type: "character",
|
|
398
|
+
value: character,
|
|
399
|
+
isFullWidth
|
|
400
|
+
});
|
|
401
|
+
index += character.length;
|
|
402
|
+
visibleCount += isFullWidth ? 2 : character.length;
|
|
403
|
+
if (visibleCount >= endCharacter) break;
|
|
404
|
+
}
|
|
405
|
+
return returnValue;
|
|
406
|
+
}
|
|
407
|
+
function reduceAnsiCodes(codes) {
|
|
408
|
+
let returnValue = [];
|
|
409
|
+
for (const code of codes) if (code.code === ansiStyles.reset.open) returnValue = [];
|
|
410
|
+
else if (endCodesSet.has(code.code)) returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
|
|
411
|
+
else {
|
|
412
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
|
|
413
|
+
returnValue.push(code);
|
|
414
|
+
}
|
|
415
|
+
return returnValue;
|
|
416
|
+
}
|
|
417
|
+
function undoAnsiCodes(codes) {
|
|
418
|
+
return reduceAnsiCodes(codes).map(({ endCode }) => endCode).reverse().join("");
|
|
419
|
+
}
|
|
420
|
+
function sliceAnsi(string, start, end) {
|
|
421
|
+
const tokens = tokenize(string, end);
|
|
422
|
+
let activeCodes = [];
|
|
423
|
+
let position = 0;
|
|
424
|
+
let returnValue = "";
|
|
425
|
+
let include = false;
|
|
426
|
+
for (const token of tokens) {
|
|
427
|
+
if (end !== void 0 && position >= end) break;
|
|
428
|
+
if (token.type === "ansi") {
|
|
429
|
+
activeCodes.push(token);
|
|
430
|
+
if (include) returnValue += token.code;
|
|
431
|
+
} else {
|
|
432
|
+
if (!include && position >= start) {
|
|
433
|
+
include = true;
|
|
434
|
+
activeCodes = reduceAnsiCodes(activeCodes);
|
|
435
|
+
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
436
|
+
}
|
|
437
|
+
if (include) returnValue += token.value;
|
|
438
|
+
position += token.isFullWidth ? 2 : token.value.length;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
returnValue += undoAnsiCodes(activeCodes);
|
|
442
|
+
return returnValue;
|
|
443
|
+
}
|
|
444
|
+
//#endregion
|
|
358
445
|
//#region ../../node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js
|
|
359
446
|
const defaultTerminalHeight = 24;
|
|
360
447
|
const getWidth = ({ columns = 80 }) => columns;
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { r as __toESM } from "../chunk-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as lib_default } from "../lib-
|
|
6
|
-
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-
|
|
7
|
-
import { r as
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
1
|
+
import { r as __toESM } from "../chunk-DnnnRqeS.js";
|
|
2
|
+
import { c as isForceOverrideMode } from "../constants-DCBWlNrn.js";
|
|
3
|
+
import { A as q, C as log, D as spinner, E as select, T as outro, c as defaultInteractive, d as promptGitHooks, g as upgradeYarn, h as selectPackageManager, i as hasBaseUrlInTsconfig, l as downloadPackageManager, m as runViteInstall, r as fixBaseUrlInTsconfig, s as cancelAndExit, t as confirmBaseUrlFix, v as PackageManager, x as confirm, y as require_semver } from "../tsconfig-DlUVXT3J.js";
|
|
4
|
+
import { a as printHeader, i as muted, r as log$1, t as accent } from "../terminal-uTv0ZaMr.js";
|
|
5
|
+
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
6
|
+
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-PmBUZ-ve.js";
|
|
7
|
+
import { A as promptEslintMigration, C as injectLintTypeCheckDefaults, D as migrateNodeVersionManagerFile, E as migrateEslintToOxlint, H as displayRelative, I as warnIncompatibleEslintIntegration, L as warnLegacyEslintConfig, M as rewriteMonorepo, O as migratePrettierToOxfmt, P as rewriteStandaloneProject, R as warnPackageLevelEslint, T as mergeViteConfigFiles, _ as detectNodeVersionManagerFile, b as hasFrameworkShim, d as checkVitestVersion, f as confirmEslintMigration, g as detectIncompatibleEslintIntegration, h as detectFramework, i as selectAgentTargetPaths, j as promptPrettierMigration, k as preflightGitHooksSetup, l as addFrameworkShim, m as detectEslintProject, n as detectAgentConflicts, p as confirmPrettierMigration, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, u as checkViteVersion, v as detectPrettierProject, w as installGitHooks, z as warnPackageLevelPrettier } from "../agent-aSGY0osq.js";
|
|
8
|
+
import { n as addMigrationWarning, r as createMigrationReport } from "../report-DgSBQUdz.js";
|
|
9
|
+
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-DElv730L.js";
|
|
10
|
+
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
10
11
|
import path from "node:path";
|
|
11
12
|
import { styleText } from "node:util";
|
|
12
13
|
//#region src/migration/bin.ts
|
|
@@ -41,6 +42,31 @@ async function confirmFrameworkShim(framework, interactive) {
|
|
|
41
42
|
}
|
|
42
43
|
return true;
|
|
43
44
|
}
|
|
45
|
+
async function fixBaseUrlForWorkspace(workspaceInfo, fixBaseUrl, updateProgress, report) {
|
|
46
|
+
if (!fixBaseUrl) return [];
|
|
47
|
+
const fixedProjectPaths = [];
|
|
48
|
+
for (const projectPath of getWorkspaceProjectPaths(workspaceInfo)) {
|
|
49
|
+
if (!hasBaseUrlInTsconfig(projectPath)) continue;
|
|
50
|
+
updateProgress?.(`Fixing tsconfig baseUrl${projectPath === workspaceInfo.rootDir ? "" : ` in ${displayRelative(projectPath, workspaceInfo.rootDir)}`}`);
|
|
51
|
+
const status = await fixBaseUrlInTsconfig(projectPath, {
|
|
52
|
+
confirmed: true,
|
|
53
|
+
silent: true
|
|
54
|
+
});
|
|
55
|
+
if (status === "failed") addMigrationWarning(report, `Failed to remove tsconfig baseUrl in ${displayRelative(projectPath, workspaceInfo.rootDir) || "."}. Run \`vp dlx @andrewbranch/ts5to6 --fixBaseUrl <tsconfig path>\` manually and re-run the migration.`);
|
|
56
|
+
if (status === "fixed") fixedProjectPaths.push(projectPath);
|
|
57
|
+
}
|
|
58
|
+
return fixedProjectPaths;
|
|
59
|
+
}
|
|
60
|
+
function getWorkspaceProjectPaths(workspaceInfo) {
|
|
61
|
+
return [workspaceInfo.rootDir, ...(workspaceInfo.packages ?? []).map((pkg) => path.join(workspaceInfo.rootDir, pkg.path))];
|
|
62
|
+
}
|
|
63
|
+
function hasBaseUrlInWorkspace(workspaceInfo) {
|
|
64
|
+
for (const projectPath of getWorkspaceProjectPaths(workspaceInfo)) {
|
|
65
|
+
if (!hasBaseUrlInTsconfig(projectPath)) continue;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
44
70
|
const helpMessage = renderCliDoc({
|
|
45
71
|
usage: "vp migrate [PATH] [OPTIONS]",
|
|
46
72
|
summary: "Migrate standalone Vite, Vitest, Oxlint, Oxfmt, and Prettier projects to unified Vite+.",
|
|
@@ -176,7 +202,7 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
176
202
|
if (shouldSetupHooks) {
|
|
177
203
|
const reason = preflightGitHooksSetup(rootDir);
|
|
178
204
|
if (reason) {
|
|
179
|
-
log
|
|
205
|
+
log.warn(`⚠ ${reason}`);
|
|
180
206
|
shouldSetupHooks = false;
|
|
181
207
|
}
|
|
182
208
|
}
|
|
@@ -236,14 +262,20 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
236
262
|
editorConflictDecisions.set(conflict.fileName, action);
|
|
237
263
|
} else editorConflictDecisions.set(conflict.fileName, "merge");
|
|
238
264
|
const eslintProject = detectEslintProject(rootDir, packages);
|
|
265
|
+
const incompatibleEslintIntegration = detectIncompatibleEslintIntegration(rootDir, packages);
|
|
239
266
|
let migrateEslint = false;
|
|
240
|
-
if (
|
|
267
|
+
if (incompatibleEslintIntegration) warnIncompatibleEslintIntegration(incompatibleEslintIntegration);
|
|
268
|
+
else if (eslintProject.hasDependency && !eslintProject.configFile && eslintProject.legacyConfigFile) warnLegacyEslintConfig(eslintProject.legacyConfigFile);
|
|
241
269
|
else if (eslintProject.hasDependency && eslintProject.configFile) migrateEslint = await confirmEslintMigration(options.interactive);
|
|
242
270
|
else if (eslintProject.hasDependency) warnPackageLevelEslint();
|
|
243
271
|
const prettierProject = detectPrettierProject(rootDir, packages);
|
|
244
272
|
let migratePrettier = false;
|
|
245
273
|
if (prettierProject.hasDependency && prettierProject.configFile) migratePrettier = await confirmPrettierMigration(options.interactive);
|
|
246
274
|
else if (prettierProject.hasDependency) warnPackageLevelPrettier();
|
|
275
|
+
const fixBaseUrl = hasBaseUrlInWorkspace({
|
|
276
|
+
rootDir,
|
|
277
|
+
packages
|
|
278
|
+
}) ? await confirmBaseUrlFix(options.interactive) : false;
|
|
247
279
|
const nodeVersionDetection = detectNodeVersionManagerFile(rootDir);
|
|
248
280
|
let migrateNodeVersionFile = false;
|
|
249
281
|
if (nodeVersionDetection) migrateNodeVersionFile = await confirmNodeVersionFileMigration(options.interactive, nodeVersionDetection);
|
|
@@ -267,6 +299,7 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
267
299
|
eslintConfigFile: eslintProject.configFile,
|
|
268
300
|
migratePrettier,
|
|
269
301
|
prettierConfigFile: prettierProject.configFile,
|
|
302
|
+
fixBaseUrl,
|
|
270
303
|
migrateNodeVersionFile,
|
|
271
304
|
nodeVersionDetection,
|
|
272
305
|
frameworkShimFrameworks: frameworkShimFrameworks.length > 0 ? frameworkShimFrameworks : void 0
|
|
@@ -282,33 +315,33 @@ function showMigrationSummary(options) {
|
|
|
282
315
|
const { projectRoot, packageManager, packageManagerVersion, installDurationMs, report, updatedExistingVitePlus } = options;
|
|
283
316
|
const projectLabel = displayRelative(projectRoot) || ".";
|
|
284
317
|
const configUpdates = report.createdViteConfigCount + report.mergedConfigCount + report.mergedStagedConfigCount + report.inlinedLintStagedConfigCount + report.removedConfigCount + report.tsdownImportCount;
|
|
285
|
-
log(`${styleText("magenta", "◇")} ${updatedExistingVitePlus ? "Updated" : "Migrated"} ${accent(projectLabel)}${updatedExistingVitePlus ? "" : " to Vite+"}`);
|
|
286
|
-
log(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
|
|
287
|
-
if (installDurationMs > 0) log(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installDurationMs)}`);
|
|
318
|
+
log$1(`${styleText("magenta", "◇")} ${updatedExistingVitePlus ? "Updated" : "Migrated"} ${accent(projectLabel)}${updatedExistingVitePlus ? "" : " to Vite+"}`);
|
|
319
|
+
log$1(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
|
|
320
|
+
if (installDurationMs > 0) log$1(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installDurationMs)}`);
|
|
288
321
|
if (configUpdates > 0 || report.rewrittenImportFileCount > 0) {
|
|
289
322
|
const parts = [];
|
|
290
323
|
if (configUpdates > 0) parts.push(`${configUpdates} ${configUpdates === 1 ? "config update" : "config updates"} applied`);
|
|
291
324
|
if (report.rewrittenImportFileCount > 0) parts.push(`${report.rewrittenImportFileCount} ${report.rewrittenImportFileCount === 1 ? "file had" : "files had"} imports rewritten`);
|
|
292
|
-
log(`${styleText("gray", "•")} ${parts.join(", ")}`);
|
|
325
|
+
log$1(`${styleText("gray", "•")} ${parts.join(", ")}`);
|
|
293
326
|
}
|
|
294
|
-
if (report.eslintMigrated) log(`${styleText("gray", "•")} ESLint rules migrated to Oxlint`);
|
|
295
|
-
if (report.prettierMigrated) log(`${styleText("gray", "•")} Prettier migrated to Oxfmt`);
|
|
296
|
-
if (report.nodeVersionFileMigrated) log(`${styleText("gray", "•")} Node version manager file migrated to .node-version`);
|
|
297
|
-
if (report.gitHooksConfigured) log(`${styleText("gray", "•")} Git hooks configured`);
|
|
298
|
-
if (report.frameworkShimAdded) log(`${styleText("gray", "•")} TypeScript shim added for framework component files`);
|
|
327
|
+
if (report.eslintMigrated) log$1(`${styleText("gray", "•")} ESLint rules migrated to Oxlint`);
|
|
328
|
+
if (report.prettierMigrated) log$1(`${styleText("gray", "•")} Prettier migrated to Oxfmt`);
|
|
329
|
+
if (report.nodeVersionFileMigrated) log$1(`${styleText("gray", "•")} Node version manager file migrated to .node-version`);
|
|
330
|
+
if (report.gitHooksConfigured) log$1(`${styleText("gray", "•")} Git hooks configured`);
|
|
331
|
+
if (report.frameworkShimAdded) log$1(`${styleText("gray", "•")} TypeScript shim added for framework component files`);
|
|
299
332
|
if (report.warnings.length > 0) {
|
|
300
|
-
log(`${styleText("yellow", "!")} Warnings:`);
|
|
301
|
-
for (const warning of report.warnings) log(` - ${warning}`);
|
|
333
|
+
log$1(`${styleText("yellow", "!")} Warnings:`);
|
|
334
|
+
for (const warning of report.warnings) log$1(` - ${warning}`);
|
|
302
335
|
}
|
|
303
336
|
if (report.manualSteps.length > 0) {
|
|
304
|
-
log(`${styleText("blue", "→")} Manual follow-up:`);
|
|
305
|
-
for (const step of report.manualSteps) log(` - ${step}`);
|
|
337
|
+
log$1(`${styleText("blue", "→")} Manual follow-up:`);
|
|
338
|
+
for (const step of report.manualSteps) log$1(` - ${step}`);
|
|
306
339
|
}
|
|
307
340
|
}
|
|
308
341
|
async function checkRolldownCompatibility(rootDir, report) {
|
|
309
342
|
try {
|
|
310
343
|
const { resolveConfig } = await import("../index.js");
|
|
311
|
-
const { checkManualChunksCompat } = await import("../compat-
|
|
344
|
+
const { checkManualChunksCompat } = await import("../compat-DXZgnEyq.js");
|
|
312
345
|
checkManualChunksCompat((await resolveConfig({
|
|
313
346
|
root: rootDir,
|
|
314
347
|
logLevel: "silent",
|
|
@@ -353,11 +386,11 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
353
386
|
await upgradeYarn(workspaceInfo.rootDir, interactive, true);
|
|
354
387
|
} else if (plan.packageManager === PackageManager.pnpm && import_semver.default.satisfies(downloadResult.version, "< 9.5.0")) {
|
|
355
388
|
failMigrationProgress("Migration failed");
|
|
356
|
-
log
|
|
389
|
+
log.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
357
390
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
358
391
|
} else if (plan.packageManager === PackageManager.npm && import_semver.default.satisfies(downloadResult.version, "< 8.3.0")) {
|
|
359
392
|
failMigrationProgress("Migration failed");
|
|
360
|
-
log
|
|
393
|
+
log.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
361
394
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
362
395
|
}
|
|
363
396
|
if (plan.migrateNodeVersionFile && plan.nodeVersionDetection) {
|
|
@@ -380,6 +413,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
380
413
|
updateMigrationProgress("Checking config compatibility");
|
|
381
414
|
await checkRolldownCompatibility(workspaceInfo.rootDir, report);
|
|
382
415
|
if (workspaceInfo.packages) for (const pkg of workspaceInfo.packages) await checkRolldownCompatibility(path.join(workspaceInfo.rootDir, pkg.path), report);
|
|
416
|
+
await fixBaseUrlForWorkspace(workspaceInfo, plan.fixBaseUrl, updateMigrationProgress, report);
|
|
383
417
|
if (plan.migrateEslint) {
|
|
384
418
|
updateMigrationProgress("Migrating ESLint");
|
|
385
419
|
if (!await migrateEslintToOxlint(workspaceInfo.rootDir, interactive, plan.eslintConfigFile, workspaceInfo.packages, {
|
|
@@ -452,7 +486,7 @@ async function main() {
|
|
|
452
486
|
const { projectPath, options } = parseArgs();
|
|
453
487
|
if (options.help) {
|
|
454
488
|
printHeader();
|
|
455
|
-
log(helpMessage);
|
|
489
|
+
log$1(helpMessage);
|
|
456
490
|
return;
|
|
457
491
|
}
|
|
458
492
|
printHeader();
|
|
@@ -480,6 +514,13 @@ async function main() {
|
|
|
480
514
|
migrationProgressStarted = false;
|
|
481
515
|
}
|
|
482
516
|
};
|
|
517
|
+
const fixedBaseUrlProjectPaths = await fixBaseUrlForWorkspace(workspaceInfoOptional, hasBaseUrlInWorkspace(workspaceInfoOptional) ? await confirmBaseUrlFix(options.interactive) : false, updateMigrationProgress, report);
|
|
518
|
+
if (fixedBaseUrlProjectPaths.length > 0) {
|
|
519
|
+
updateMigrationProgress("Updating lint defaults");
|
|
520
|
+
for (const projectPath of fixedBaseUrlProjectPaths) injectLintTypeCheckDefaults(projectPath, true, report);
|
|
521
|
+
didMigrate = true;
|
|
522
|
+
}
|
|
523
|
+
clearMigrationProgress();
|
|
483
524
|
const eslintMigrated = await promptEslintMigration(workspaceInfoOptional.rootDir, options.interactive, workspaceInfoOptional.packages);
|
|
484
525
|
const prettierMigrated = await promptPrettierMigration(workspaceInfoOptional.rootDir, options.interactive, workspaceInfoOptional.packages);
|
|
485
526
|
const nodeVersionDetection = detectNodeVersionManagerFile(workspaceInfoOptional.rootDir);
|
|
@@ -488,7 +529,7 @@ async function main() {
|
|
|
488
529
|
}
|
|
489
530
|
if (eslintMigrated || prettierMigrated) {
|
|
490
531
|
updateMigrationProgress("Rewriting configs");
|
|
491
|
-
mergeViteConfigFiles(workspaceInfoOptional.rootDir, true, report);
|
|
532
|
+
mergeViteConfigFiles(workspaceInfoOptional.rootDir, true, report, workspaceInfoOptional.packages);
|
|
492
533
|
updateMigrationProgress("Installing dependencies");
|
|
493
534
|
let resolvedVersion = workspaceInfoOptional.packageManagerVersion;
|
|
494
535
|
if (workspaceInfoOptional.packageManager && !import_semver.default.valid(import_semver.default.coerce(resolvedVersion) ?? "")) resolvedVersion = (await downloadPackageManager(workspaceInfoOptional.packageManager, resolvedVersion, options.interactive, true)).version;
|
|
@@ -533,7 +574,7 @@ async function main() {
|
|
|
533
574
|
});
|
|
534
575
|
}
|
|
535
576
|
main().catch((err) => {
|
|
536
|
-
log
|
|
577
|
+
log.error(err.message);
|
|
537
578
|
console.error(err);
|
|
538
579
|
process.exit(1);
|
|
539
580
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as VITE_PLUS_NAME } from "./constants-DCBWlNrn.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.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as _$_oxlint_plugins0 from "@oxlint/plugins";
|
|
2
|
-
|
|
3
1
|
//#region src/oxlint-plugin.d.ts
|
|
4
2
|
declare function rewriteVitePlusImportSpecifier(specifier: string): string | null;
|
|
5
|
-
declare const preferVitePlusImportsRule:
|
|
6
|
-
declare const plugin:
|
|
3
|
+
declare const preferVitePlusImportsRule: import("@oxlint/plugins").Rule;
|
|
4
|
+
declare const plugin: import("@oxlint/plugins").Plugin;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { plugin as default, preferVitePlusImportsRule, rewriteVitePlusImportSpecifier };
|
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-B89iKTKN.js";
|
|
2
2
|
import { definePlugin, defineRule } from "@oxlint/plugins";
|
|
3
3
|
//#region src/oxlint-plugin.ts
|
|
4
4
|
function rewriteVitePlusImportSpecifier(specifier) {
|
package/dist/pack-bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as resolveViteConfig } from "./resolve-vite-config-
|
|
2
|
+
import { i as resolveViteConfig } from "./resolve-vite-config-TTvhycU1.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
|
package/dist/pack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./constants-
|
|
2
|
-
import { r as parse } from "./main-
|
|
1
|
+
import "./constants-DCBWlNrn.js";
|
|
2
|
+
import { r as parse } from "./main-DpJl3LoU.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs";
|
package/dist/staged/bin.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "../chunk-
|
|
2
|
-
import { a as printHeader, n as errorMsg, r as log } from "../terminal-
|
|
3
|
-
import { i as resolveViteConfig } from "../resolve-vite-config-
|
|
4
|
-
import { t as lib_default } from "../lib-
|
|
5
|
-
import { t as renderCliDoc } from "../help-
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "../chunk-DnnnRqeS.js";
|
|
2
|
+
import { a as printHeader, n as errorMsg, r as log } from "../terminal-uTv0ZaMr.js";
|
|
3
|
+
import { i as resolveViteConfig } from "../resolve-vite-config-TTvhycU1.js";
|
|
4
|
+
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
5
|
+
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import path, { delimiter, dirname, resolve } from "node:path";
|
|
8
8
|
import { constants } from "node:fs";
|
|
9
9
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
10
|
-
import { pathToFileURL } from "node:url";
|
|
11
10
|
import { cwd } from "node:process";
|
|
12
11
|
import E from "node:readline";
|
|
13
12
|
import nodeTty from "node:tty";
|
|
13
|
+
import { pathToFileURL } from "node:url";
|
|
14
14
|
import { EOL } from "node:os";
|
|
15
15
|
import fsPromises, { constants as constants$1 } from "node:fs/promises";
|
|
16
16
|
import { PassThrough, Writable } from "node:stream";
|
|
@@ -1811,9 +1811,9 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1811
1811
|
this.logger.options.color = this.options.color;
|
|
1812
1812
|
}
|
|
1813
1813
|
async render() {
|
|
1814
|
-
const { createLogUpdate } = await import("../log-update-
|
|
1815
|
-
const { default: truncate } = await import("../cli-truncate-
|
|
1816
|
-
const { default: wrap } = await import("../wrap-ansi-
|
|
1814
|
+
const { createLogUpdate } = await import("../log-update-lyIiuflf.js");
|
|
1815
|
+
const { default: truncate } = await import("../cli-truncate-CWsmbK3p.js");
|
|
1816
|
+
const { default: wrap } = await import("../wrap-ansi-CeQuiQ31.js");
|
|
1817
1817
|
this.updater = createLogUpdate(this.logger.process.stdout);
|
|
1818
1818
|
this.truncate = truncate;
|
|
1819
1819
|
this.wrap = wrap;
|
|
@@ -6179,7 +6179,7 @@ const jsonParse = async (filename) => {
|
|
|
6179
6179
|
const yamlParse = async (filename) => {
|
|
6180
6180
|
const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
|
|
6181
6181
|
try {
|
|
6182
|
-
const [YAML, content] = await Promise.all([import("../dist-
|
|
6182
|
+
const [YAML, content] = await Promise.all([import("../dist-Bapm49IR.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
|
|
6183
6183
|
const yaml = YAML.parse(content);
|
|
6184
6184
|
return isPackageFile ? yaml[CONFIG_NAME] : yaml;
|
|
6185
6185
|
} catch (error) {
|