vite-plus 0.1.24 → 0.2.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/LICENSE +30 -0
- package/README.md +8 -6
- package/bin/oxfmt +5 -2
- package/bin/oxlint +12 -2
- package/binding/index.cjs +84 -67
- package/binding/index.d.cts +155 -4
- package/dist/{agent-Nuk-9l77.js → agent--cKmgD_n.js} +941 -70
- package/dist/bin.js +22 -30
- package/dist/{compat-DXZgnEyq.js → compat-Cql3K40m.js} +1 -1
- package/dist/config/bin.js +30 -14
- package/dist/constants-CrfJQIUX.js +66 -0
- package/dist/create/bin.d.ts +6 -0
- package/dist/create/bin.js +508 -232
- package/dist/define-config-2tfJoXr1.d.ts +305 -0
- package/dist/define-config-BGSjF6Xp.cjs +488 -0
- package/dist/define-config-DJUehepE.js +445 -0
- package/dist/define-config.cjs +8 -1
- package/dist/define-config.d.ts +2 -2
- package/dist/define-config.js +2 -2
- package/dist/dist-DRJUd9bL.js +3 -0
- package/dist/{dist-BgQuvbtq.js → dist-Oxo16Y0q.js} +4 -4
- package/dist/index.cjs +9 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{main-DpJl3LoU.js → json-Dn87fvjk.js} +137 -1
- package/dist/migration/bin.js +292 -76
- package/dist/{oxlint-plugin-config-B89iKTKN.js → oxlint-plugin-config-q8a5PFch.js} +1 -1
- package/dist/oxlint-plugin.js +11 -3
- package/dist/pack-bin.js +44 -15
- package/dist/{package-PmBUZ-ve.js → package-BHirM1_v.js} +3 -138
- package/dist/{report-DgSBQUdz.js → report-BHSkWqRR.js} +2 -0
- package/dist/{resolve-vite-config-TTvhycU1.js → resolve-vite-config-CmdsfQzS.js} +13 -4
- package/dist/staged/bin.js +5 -5
- package/dist/test/_at-vitest-browser/context.d.ts +2 -0
- package/dist/test/_at-vitest-browser.d.ts +2 -0
- package/dist/test/browser/context.d.ts +2 -2
- package/dist/test/browser/context.js +1 -1
- package/dist/test/browser/providers/playwright/context.d.ts +1 -0
- package/dist/test/browser/providers/playwright/context.js +1 -0
- package/dist/test/browser/providers/playwright.d.ts +124 -2
- package/dist/test/browser/providers/playwright.js +1 -1
- package/dist/test/browser/providers/preview/context.d.ts +1 -0
- package/dist/test/browser/providers/preview/context.js +1 -0
- package/dist/test/browser/providers/preview.d.ts +32 -2
- package/dist/test/browser/providers/preview.js +1 -1
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -0
- package/dist/test/browser/providers/webdriverio/context.js +1 -0
- package/dist/test/browser/providers/webdriverio.d.ts +77 -2
- package/dist/test/browser/providers/webdriverio.js +1 -1
- package/dist/test/browser-compat.d.ts +2 -0
- package/dist/test/browser-compat.js +1 -1
- package/dist/test/browser-playwright/context.d.ts +1 -0
- package/dist/test/browser-playwright/context.js +1 -0
- package/dist/test/browser-playwright.d.ts +124 -2
- package/dist/test/browser-playwright.js +1 -1
- package/dist/test/browser-preview/context.d.ts +1 -0
- package/dist/test/browser-preview/context.js +1 -0
- package/dist/test/browser-preview.d.ts +32 -2
- package/dist/test/browser-preview.js +1 -1
- package/dist/test/browser-webdriverio/context.d.ts +1 -0
- package/dist/test/browser-webdriverio/context.js +1 -0
- package/dist/test/browser-webdriverio.d.ts +77 -2
- package/dist/test/browser-webdriverio.js +1 -1
- package/dist/test/browser.d.ts +2 -2
- package/dist/test/browser.js +1 -1
- package/dist/test/client.js +1 -1
- package/dist/test/config.cjs +1 -1
- package/dist/test/config.d.ts +2 -2
- package/dist/test/config.js +1 -1
- package/dist/test/context.d.ts +942 -2
- package/dist/test/context.js +1 -1
- package/dist/test/coverage.d.ts +2 -2
- package/dist/test/coverage.js +1 -1
- package/dist/test/environments.d.ts +2 -2
- package/dist/test/environments.js +1 -1
- package/dist/test/globals.d.ts +2 -2
- package/dist/test/import-meta.d.ts +2 -2
- package/dist/test/importMeta.d.ts +2 -2
- package/dist/test/index.cjs +1 -1
- package/dist/test/index.d.cts +2 -2
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.js +1 -1
- package/dist/test/internal/browser.d.ts +2 -2
- package/dist/test/internal/browser.js +1 -1
- package/dist/test/jsdom.d.ts +2 -2
- package/dist/test/locators.d.ts +294 -0
- package/dist/test/locators.js +1 -1
- package/dist/test/matchers.d.ts +29 -0
- package/dist/test/matchers.js +1 -1
- package/dist/test/node.d.ts +2 -2
- package/dist/test/node.js +1 -1
- package/dist/test/optional-runtime-types.js.d.ts +2 -2
- package/dist/test/optional-types.js.d.ts +2 -2
- package/dist/test/plugins/browser-client.js +1 -1
- package/dist/test/plugins/browser-context.js +1 -1
- package/dist/test/plugins/browser-locators.js +1 -1
- package/dist/test/plugins/browser-playwright.js +1 -1
- package/dist/test/plugins/browser-preview.js +1 -1
- package/dist/test/plugins/browser-webdriverio.js +1 -1
- package/dist/test/plugins/browser.js +1 -1
- package/dist/test/plugins/expect.js +1 -1
- package/dist/test/plugins/mocker-automock.js +1 -1
- package/dist/test/plugins/mocker-browser.js +1 -1
- package/dist/test/plugins/mocker-node.js +1 -1
- package/dist/test/plugins/mocker-redirect.js +1 -1
- package/dist/test/plugins/mocker-register.js +1 -1
- package/dist/test/plugins/mocker-transforms.js +1 -1
- package/dist/test/plugins/mocker.js +1 -1
- package/dist/test/plugins/pretty-format.js +1 -1
- package/dist/test/plugins/runner-types.js +1 -1
- package/dist/test/plugins/runner-utils.js +1 -1
- package/dist/test/plugins/runner.js +1 -1
- package/dist/test/plugins/snapshot-environment.js +1 -1
- package/dist/test/plugins/snapshot-manager.js +1 -1
- package/dist/test/plugins/snapshot.js +1 -1
- package/dist/test/plugins/spy.js +1 -1
- package/dist/test/plugins/utils-constants.js +1 -1
- package/dist/test/plugins/utils-diff.js +1 -1
- package/dist/test/plugins/utils-display.js +1 -1
- package/dist/test/plugins/utils-error.js +1 -1
- package/dist/test/plugins/utils-helpers.js +1 -1
- package/dist/test/plugins/utils-offset.js +1 -1
- package/dist/test/plugins/utils-resolver.js +1 -1
- package/dist/test/plugins/utils-serialize.js +1 -1
- package/dist/test/plugins/utils-source-map-node.js +1 -1
- package/dist/test/plugins/utils-source-map.js +1 -1
- package/dist/test/plugins/utils-timers.js +1 -1
- package/dist/test/plugins/utils.js +1 -1
- package/dist/test/reporters.d.ts +2 -2
- package/dist/test/reporters.js +1 -1
- package/dist/test/runners.d.ts +2 -2
- package/dist/test/runners.js +1 -1
- package/dist/test/runtime.d.ts +2 -2
- package/dist/test/runtime.js +1 -1
- package/dist/test/snapshot.d.ts +2 -2
- package/dist/test/snapshot.js +1 -1
- package/dist/test/suite.d.ts +2 -2
- package/dist/test/suite.js +1 -1
- package/dist/test/utils.js +1 -1
- package/dist/test/worker.d.ts +2 -2
- package/dist/test/worker.js +1 -1
- package/dist/{tsconfig-DFb5BKyT.js → tsconfig-BWQPmGKz.js} +565 -231
- package/dist/tsgolint-path-B-yOos8p.js +32 -0
- package/dist/tsgolint-path.d.ts +8 -0
- package/dist/tsgolint-path.js +2 -0
- package/dist/version.js +3 -3
- package/dist/versions.d.ts +1 -1
- package/dist/versions.js +6 -6
- package/dist/{workspace-NL-m9wgM.js → workspace-D0AVy4fu.js} +11 -9
- package/docs/_data/team.ts +2 -1
- package/docs/config/create.md +36 -1
- package/docs/config/index.md +7 -5
- package/docs/guide/commit-hooks.md +9 -0
- package/docs/guide/create.md +106 -2
- package/docs/guide/env.md +33 -5
- package/docs/guide/index.md +5 -3
- package/docs/guide/install.md +31 -12
- package/docs/guide/migrate.md +13 -3
- package/docs/guide/troubleshooting.md +2 -2
- package/docs/guide/upgrade.md +26 -7
- package/docs/package.json +3 -3
- package/docs/pnpm-lock.yaml +298 -395
- package/package.json +103 -55
- package/templates/generator/bin/index.ts +6 -3
- package/templates/generator/package.json +2 -3
- package/templates/generator/src/template.ts +0 -2
- package/templates/monorepo/package.json +1 -1
- package/dist/constants-DCBWlNrn.js +0 -33
- package/dist/define-config-BR1Y88zz.cjs +0 -84
- package/dist/define-config-BRC7qPNE.js +0 -21
- package/dist/define-config-COdn-tsn.d.ts +0 -177
- package/dist/dist-Bapm49IR.js +0 -3
- package/dist/test/plugins/utils-highlight.js +0 -1
- /package/dist/{chunk-DnnnRqeS.js → rolldown-runtime-DnnnRqeS.js} +0 -0
package/dist/migration/bin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { r as __toESM } from "../
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
4
|
-
import { a as printHeader, i as muted, r as log$1, t as accent } from "../terminal-uTv0ZaMr.js";
|
|
1
|
+
import { r as __toESM } from "../rolldown-runtime-DnnnRqeS.js";
|
|
2
|
+
import { u as isForceOverrideMode } from "../constants-CrfJQIUX.js";
|
|
3
|
+
import { A as select, C as require_semver, D as log, P as R, S as PackageManager, T as confirm, c as cancelAndExit, d as promptGitHooks, g as upgradeYarn, h as selectPackageManager, i as hasBaseUrlInTsconfig, j as spinner, k as outro, l as defaultInteractive, m as runViteInstall, r as fixBaseUrlInTsconfig, t as confirmBaseUrlFix, u as downloadPackageManager } from "../tsconfig-BWQPmGKz.js";
|
|
4
|
+
import { a as printHeader, i as muted, r as log$1, s as warnMsg, t as accent } from "../terminal-uTv0ZaMr.js";
|
|
5
5
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
6
|
-
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-
|
|
7
|
-
import { A as
|
|
8
|
-
import { n as addMigrationWarning, r as createMigrationReport } from "../report-
|
|
9
|
-
import {
|
|
6
|
+
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-BHirM1_v.js";
|
|
7
|
+
import { A as mergeViteConfigFiles, C as ensureVitePlusBootstrap, H as warnLegacyEslintConfig, L as rewriteMonorepo, M as migrateNodeVersionManagerFile, N as migratePrettierToOxfmt, O as injectLintTypeCheckDefaults, P as preflightGitHooksSetup, T as hasFrameworkShim, U as warnPackageLevelEslint, V as warnIncompatibleEslintIntegration, W as warnPackageLevelPrettier, _ as detectLegacyGitHooksMigrationCandidate, b as detectPrettierProject, d as checkVitestVersion, f as confirmEslintMigration, g as detectIncompatibleEslintIntegration, h as detectFramework, i as selectAgentTargetPaths, j as migrateEslintToOxlint, k as installGitHooks, l as addFrameworkShim, m as detectEslintProject, n as detectAgentConflicts, p as confirmPrettierMigration, q as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, u as checkViteVersion, v as detectNodeVersionManagerFile, w as finalizeCoreMigrationForExistingVitePlus, x as detectVitePlusBootstrapPending, y as detectPendingCoreMigration, z as rewriteStandaloneProject } from "../agent--cKmgD_n.js";
|
|
8
|
+
import { n as addMigrationWarning, r as createMigrationReport } from "../report-BHSkWqRR.js";
|
|
9
|
+
import { a as detectEditorConflicts, l as writeEditorConfigs, s as selectEditor, t as detectWorkspace } from "../workspace-D0AVy4fu.js";
|
|
10
10
|
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { styleText } from "node:util";
|
|
@@ -197,8 +197,54 @@ function parseArgs() {
|
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
-
|
|
201
|
-
const
|
|
200
|
+
function getFrameworkShimCandidates(rootDir, packages) {
|
|
201
|
+
const allDetectedFrameworks = new Set(detectFramework(rootDir));
|
|
202
|
+
for (const pkg of packages ?? []) for (const framework of detectFramework(path.join(rootDir, pkg.path))) allDetectedFrameworks.add(framework);
|
|
203
|
+
return [...allDetectedFrameworks].filter((framework) => {
|
|
204
|
+
if (detectFramework(rootDir).includes(framework) && !hasFrameworkShim(rootDir, framework)) return true;
|
|
205
|
+
return (packages ?? []).some((pkg) => {
|
|
206
|
+
const pkgPath = path.join(rootDir, pkg.path);
|
|
207
|
+
return detectFramework(pkgPath).includes(framework) && !hasFrameworkShim(pkgPath, framework);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async function collectFrameworkShimFrameworks(rootDir, options, packages) {
|
|
212
|
+
const frameworkShimFrameworks = [];
|
|
213
|
+
for (const framework of getFrameworkShimCandidates(rootDir, packages)) if (await confirmFrameworkShim(framework, options.interactive)) frameworkShimFrameworks.push(framework);
|
|
214
|
+
return frameworkShimFrameworks.length > 0 ? frameworkShimFrameworks : void 0;
|
|
215
|
+
}
|
|
216
|
+
function addFrameworkShimsForWorkspace(rootDir, frameworks, packages, report, updateMigrationProgress) {
|
|
217
|
+
if (!frameworks) return false;
|
|
218
|
+
let changed = false;
|
|
219
|
+
updateMigrationProgress("Adding TypeScript shim");
|
|
220
|
+
for (const framework of frameworks) {
|
|
221
|
+
if (detectFramework(rootDir).includes(framework) && !hasFrameworkShim(rootDir, framework)) {
|
|
222
|
+
addFrameworkShim(rootDir, framework, report);
|
|
223
|
+
changed = true;
|
|
224
|
+
}
|
|
225
|
+
for (const pkg of packages ?? []) {
|
|
226
|
+
const pkgPath = path.join(rootDir, pkg.path);
|
|
227
|
+
if (detectFramework(pkgPath).includes(framework) && !hasFrameworkShim(pkgPath, framework)) {
|
|
228
|
+
addFrameworkShim(pkgPath, framework, report);
|
|
229
|
+
changed = true;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return changed;
|
|
234
|
+
}
|
|
235
|
+
function hasEnabledOption(value) {
|
|
236
|
+
if (Array.isArray(value)) return value.some((item) => Boolean(item));
|
|
237
|
+
return value !== void 0 && value !== false && value !== "";
|
|
238
|
+
}
|
|
239
|
+
function hasExplicitExistingVitePlusSetupRequest(options) {
|
|
240
|
+
return options.hooks === true || hasEnabledOption(options.agent) || hasEnabledOption(options.editor);
|
|
241
|
+
}
|
|
242
|
+
function hasExistingVitePlusMigrationCandidates(workspaceInfo, options) {
|
|
243
|
+
const eslintProject = detectEslintProject(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
244
|
+
const prettierProject = detectPrettierProject(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
245
|
+
return hasExplicitExistingVitePlusSetupRequest(options) || detectLegacyGitHooksMigrationCandidate(workspaceInfo.rootDir) || hasBaseUrlInWorkspace(workspaceInfo) || eslintProject.hasDependency || prettierProject.hasDependency || detectNodeVersionManagerFile(workspaceInfo.rootDir) !== void 0 || getFrameworkShimCandidates(workspaceInfo.rootDir, workspaceInfo.packages).length > 0;
|
|
246
|
+
}
|
|
247
|
+
async function collectGitHooksDecision(rootDir, packageManager, options) {
|
|
202
248
|
let shouldSetupHooks = await promptGitHooks(options);
|
|
203
249
|
if (shouldSetupHooks) {
|
|
204
250
|
const reason = preflightGitHooksSetup(rootDir, packageManager);
|
|
@@ -207,6 +253,9 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
207
253
|
shouldSetupHooks = false;
|
|
208
254
|
}
|
|
209
255
|
}
|
|
256
|
+
return shouldSetupHooks;
|
|
257
|
+
}
|
|
258
|
+
async function collectAgentInstructionPlan(rootDir, options) {
|
|
210
259
|
const existingAgentTargetPaths = options.agent !== void 0 || !options.interactive ? void 0 : detectExistingAgentTargetPaths(rootDir);
|
|
211
260
|
const selectedAgentTargetPaths = existingAgentTargetPaths !== void 0 ? existingAgentTargetPaths : await selectAgentTargetPaths({
|
|
212
261
|
interactive: options.interactive,
|
|
@@ -235,6 +284,12 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
235
284
|
if (R(action)) cancelAndExit();
|
|
236
285
|
agentConflictDecisions.set(conflict.targetPath, action);
|
|
237
286
|
} else agentConflictDecisions.set(conflict.targetPath, "skip");
|
|
287
|
+
return {
|
|
288
|
+
selectedAgentTargetPaths,
|
|
289
|
+
agentConflictDecisions
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
async function collectEditorConfigPlan(rootDir, options) {
|
|
238
293
|
const selectedEditor = await selectEditor({
|
|
239
294
|
interactive: options.interactive,
|
|
240
295
|
editor: options.editor,
|
|
@@ -262,6 +317,12 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
262
317
|
if (R(action)) cancelAndExit();
|
|
263
318
|
editorConflictDecisions.set(conflict.fileName, action);
|
|
264
319
|
} else editorConflictDecisions.set(conflict.fileName, "merge");
|
|
320
|
+
return {
|
|
321
|
+
selectedEditor,
|
|
322
|
+
editorConflictDecisions
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
async function collectEslintMigrationDecision(rootDir, options, packages) {
|
|
265
326
|
const eslintProject = detectEslintProject(rootDir, packages);
|
|
266
327
|
const incompatibleEslintIntegration = detectIncompatibleEslintIntegration(rootDir, packages);
|
|
267
328
|
let migrateEslint = false;
|
|
@@ -269,6 +330,35 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
269
330
|
else if (eslintProject.hasDependency && !eslintProject.configFile && eslintProject.legacyConfigFile) warnLegacyEslintConfig(eslintProject.legacyConfigFile);
|
|
270
331
|
else if (eslintProject.hasDependency && eslintProject.configFile) migrateEslint = await confirmEslintMigration(options.interactive);
|
|
271
332
|
else if (eslintProject.hasDependency) warnPackageLevelEslint();
|
|
333
|
+
return {
|
|
334
|
+
migrateEslint,
|
|
335
|
+
eslintConfigFile: eslintProject.configFile
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
async function collectMigrationSetupPlan(rootDir, packageManager, options, packages, includeEslint = true) {
|
|
339
|
+
const shouldSetupHooks = await collectGitHooksDecision(rootDir, packageManager, options);
|
|
340
|
+
const agentPlan = await collectAgentInstructionPlan(rootDir, options);
|
|
341
|
+
const editorPlan = await collectEditorConfigPlan(rootDir, options);
|
|
342
|
+
const eslintPlan = includeEslint ? await collectEslintMigrationDecision(rootDir, options, packages) : { migrateEslint: false };
|
|
343
|
+
return {
|
|
344
|
+
shouldSetupHooks,
|
|
345
|
+
...agentPlan,
|
|
346
|
+
...editorPlan,
|
|
347
|
+
...eslintPlan
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function getExistingVitePlusSetupOptions(options, legacyGitHooksMigrationCandidate, useFullMigrationDefaults = false) {
|
|
351
|
+
if (useFullMigrationDefaults) return options;
|
|
352
|
+
return {
|
|
353
|
+
...options,
|
|
354
|
+
hooks: options.hooks ?? (legacyGitHooksMigrationCandidate ? options.interactive ? void 0 : true : false),
|
|
355
|
+
agent: options.agent ?? false,
|
|
356
|
+
editor: options.editor ?? false
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
async function collectMigrationPlan(rootDir, detectedPackageManager, options, packages) {
|
|
360
|
+
const packageManager = detectedPackageManager ?? await selectPackageManager(options.interactive, true);
|
|
361
|
+
const setupPlan = await collectMigrationSetupPlan(rootDir, packageManager, options, packages);
|
|
272
362
|
const prettierProject = detectPrettierProject(rootDir, packages);
|
|
273
363
|
let migratePrettier = false;
|
|
274
364
|
if (prettierProject.hasDependency && prettierProject.configFile) migratePrettier = await confirmPrettierMigration(options.interactive);
|
|
@@ -280,30 +370,16 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, options, pa
|
|
|
280
370
|
const nodeVersionDetection = detectNodeVersionManagerFile(rootDir);
|
|
281
371
|
let migrateNodeVersionFile = false;
|
|
282
372
|
if (nodeVersionDetection) migrateNodeVersionFile = await confirmNodeVersionFileMigration(options.interactive, nodeVersionDetection);
|
|
283
|
-
const
|
|
284
|
-
for (const pkg of packages ?? []) for (const framework of detectFramework(path.join(rootDir, pkg.path))) allDetectedFrameworks.add(framework);
|
|
285
|
-
const frameworkShimFrameworks = [];
|
|
286
|
-
for (const framework of allDetectedFrameworks) if (detectFramework(rootDir).includes(framework) && !hasFrameworkShim(rootDir, framework) || (packages ?? []).some((pkg) => {
|
|
287
|
-
const pkgPath = path.join(rootDir, pkg.path);
|
|
288
|
-
return detectFramework(pkgPath).includes(framework) && !hasFrameworkShim(pkgPath, framework);
|
|
289
|
-
})) {
|
|
290
|
-
if (await confirmFrameworkShim(framework, options.interactive)) frameworkShimFrameworks.push(framework);
|
|
291
|
-
}
|
|
373
|
+
const frameworkShimFrameworks = await collectFrameworkShimFrameworks(rootDir, options, packages);
|
|
292
374
|
return {
|
|
293
375
|
packageManager,
|
|
294
|
-
|
|
295
|
-
selectedAgentTargetPaths,
|
|
296
|
-
agentConflictDecisions,
|
|
297
|
-
selectedEditor,
|
|
298
|
-
editorConflictDecisions,
|
|
299
|
-
migrateEslint,
|
|
300
|
-
eslintConfigFile: eslintProject.configFile,
|
|
376
|
+
...setupPlan,
|
|
301
377
|
migratePrettier,
|
|
302
378
|
prettierConfigFile: prettierProject.configFile,
|
|
303
379
|
fixBaseUrl,
|
|
304
380
|
migrateNodeVersionFile,
|
|
305
381
|
nodeVersionDetection,
|
|
306
|
-
frameworkShimFrameworks
|
|
382
|
+
frameworkShimFrameworks
|
|
307
383
|
};
|
|
308
384
|
}
|
|
309
385
|
function formatDuration(durationMs) {
|
|
@@ -312,13 +388,34 @@ function formatDuration(durationMs) {
|
|
|
312
388
|
if (durationSeconds < 10) return `${durationSeconds.toFixed(1)}s`;
|
|
313
389
|
return `${Math.round(durationSeconds)}s`;
|
|
314
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Reconcile a CommandRunSummary from `runViteInstall` with the migration's
|
|
393
|
+
* duration counter and exit-code state. `runViteInstall` returns
|
|
394
|
+
* `{ status: 'failed', exitCode }` without throwing; treating that as a success
|
|
395
|
+
* (incrementing duration unconditionally) would let the migration claim
|
|
396
|
+
* "Dependencies installed" while node_modules is desynced from the just-mutated
|
|
397
|
+
* package.json. This helper centralizes the right handling: credit duration on
|
|
398
|
+
* success, warn + flip exitCode on failure, stay silent on skip.
|
|
399
|
+
*/
|
|
400
|
+
function handleInstallResult(installSummary, rootDir, report, options) {
|
|
401
|
+
if (installSummary.status === "installed") return installSummary.durationMs;
|
|
402
|
+
if (installSummary.status === "failed") {
|
|
403
|
+
const exitCode = installSummary.exitCode ?? 1;
|
|
404
|
+
const message = `Dependency installation failed (exit code ${exitCode}). Run \`vp install\` manually in ${rootDir} to resync node_modules.`;
|
|
405
|
+
warnMsg(message);
|
|
406
|
+
report.warnings.push(message);
|
|
407
|
+
if (options?.propagateExitCode !== false) process.exitCode = exitCode;
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
410
|
+
return 0;
|
|
411
|
+
}
|
|
315
412
|
function showMigrationSummary(options) {
|
|
316
|
-
const { projectRoot, packageManager, packageManagerVersion, installDurationMs, report, updatedExistingVitePlus } = options;
|
|
413
|
+
const { projectRoot, packageManager, packageManagerVersion, installDurationMs, finalInstallOk, report, updatedExistingVitePlus } = options;
|
|
317
414
|
const projectLabel = displayRelative(projectRoot) || ".";
|
|
318
|
-
const configUpdates = report.createdViteConfigCount + report.mergedConfigCount + report.mergedStagedConfigCount + report.inlinedLintStagedConfigCount + report.removedConfigCount + report.tsdownImportCount;
|
|
415
|
+
const configUpdates = report.createdViteConfigCount + report.mergedConfigCount + report.mergedStagedConfigCount + report.inlinedLintStagedConfigCount + report.removedConfigCount + report.tsdownImportCount + report.wrappedPluginConfigCount;
|
|
319
416
|
log$1(`${styleText("magenta", "◇")} ${updatedExistingVitePlus ? "Updated" : "Migrated"} ${accent(projectLabel)}${updatedExistingVitePlus ? "" : " to Vite+"}`);
|
|
320
417
|
log$1(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
|
|
321
|
-
if (installDurationMs > 0) log$1(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installDurationMs)}`);
|
|
418
|
+
if (finalInstallOk && installDurationMs > 0) log$1(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installDurationMs)}`);
|
|
322
419
|
if (configUpdates > 0 || report.rewrittenImportFileCount > 0) {
|
|
323
420
|
const parts = [];
|
|
324
421
|
if (configUpdates > 0) parts.push(`${configUpdates} ${configUpdates === 1 ? "config update" : "config updates"} applied`);
|
|
@@ -328,8 +425,10 @@ function showMigrationSummary(options) {
|
|
|
328
425
|
if (report.eslintMigrated) log$1(`${styleText("gray", "•")} ESLint rules migrated to Oxlint`);
|
|
329
426
|
if (report.prettierMigrated) log$1(`${styleText("gray", "•")} Prettier migrated to Oxfmt`);
|
|
330
427
|
if (report.nodeVersionFileMigrated) log$1(`${styleText("gray", "•")} Node version manager file migrated to .node-version`);
|
|
428
|
+
if (report.wrappedPluginConfigCount > 0) log$1(`${styleText("gray", "•")} Inline Vite plugins wrapped with lazyPlugins for check/lint/fmt`);
|
|
331
429
|
if (report.gitHooksConfigured) log$1(`${styleText("gray", "•")} Git hooks configured`);
|
|
332
430
|
if (report.frameworkShimAdded) log$1(`${styleText("gray", "•")} TypeScript shim added for framework component files`);
|
|
431
|
+
if (report.packageManagerBootstrapConfigured) log$1(`${styleText("gray", "•")} Package manager settings configured`);
|
|
333
432
|
if (report.warnings.length > 0) {
|
|
334
433
|
log$1(`${styleText("yellow", "!")} Warnings:`);
|
|
335
434
|
for (const warning of report.warnings) log$1(` - ${warning}`);
|
|
@@ -342,7 +441,7 @@ function showMigrationSummary(options) {
|
|
|
342
441
|
async function checkRolldownCompatibility(rootDir, report) {
|
|
343
442
|
try {
|
|
344
443
|
const { resolveConfig } = await import("../index.js");
|
|
345
|
-
const { checkManualChunksCompat } = await import("../compat-
|
|
444
|
+
const { checkManualChunksCompat } = await import("../compat-Cql3K40m.js");
|
|
346
445
|
checkManualChunksCompat((await resolveConfig({
|
|
347
446
|
root: rootDir,
|
|
348
447
|
logLevel: "silent",
|
|
@@ -350,6 +449,24 @@ async function checkRolldownCompatibility(rootDir, report) {
|
|
|
350
449
|
}, "build")).build?.rollupOptions?.output, report);
|
|
351
450
|
} catch {}
|
|
352
451
|
}
|
|
452
|
+
async function downloadSupportedPackageManager(options) {
|
|
453
|
+
const { rootDir, packageManager, packageManagerVersion, interactive, updateMigrationProgress, failMigrationProgress } = options;
|
|
454
|
+
updateMigrationProgress("Preparing migration");
|
|
455
|
+
const downloadResult = await downloadPackageManager(packageManager, packageManagerVersion, interactive, true);
|
|
456
|
+
if (packageManager === PackageManager.yarn && import_semver.default.satisfies(downloadResult.version, ">=4.0.0 <4.10.0")) {
|
|
457
|
+
updateMigrationProgress("Upgrading Yarn");
|
|
458
|
+
await upgradeYarn(rootDir, interactive, true);
|
|
459
|
+
} else if (packageManager === PackageManager.pnpm && import_semver.default.satisfies(downloadResult.version, "< 9.5.0")) {
|
|
460
|
+
failMigrationProgress("Migration failed");
|
|
461
|
+
log.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
462
|
+
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
463
|
+
} else if (packageManager === PackageManager.npm && import_semver.default.satisfies(downloadResult.version, "< 8.3.0")) {
|
|
464
|
+
failMigrationProgress("Migration failed");
|
|
465
|
+
log.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
466
|
+
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
467
|
+
}
|
|
468
|
+
return downloadResult;
|
|
469
|
+
}
|
|
353
470
|
async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
354
471
|
const report = createMigrationReport();
|
|
355
472
|
const migrationProgress = interactive ? spinner({ indicator: "timer" }) : void 0;
|
|
@@ -375,25 +492,19 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
375
492
|
migrationProgressStarted = false;
|
|
376
493
|
}
|
|
377
494
|
};
|
|
378
|
-
|
|
379
|
-
|
|
495
|
+
const downloadResult = await downloadSupportedPackageManager({
|
|
496
|
+
rootDir: workspaceInfoOptional.rootDir,
|
|
497
|
+
packageManager: plan.packageManager,
|
|
498
|
+
packageManagerVersion: workspaceInfoOptional.packageManagerVersion,
|
|
499
|
+
interactive,
|
|
500
|
+
updateMigrationProgress,
|
|
501
|
+
failMigrationProgress
|
|
502
|
+
});
|
|
380
503
|
const workspaceInfo = {
|
|
381
504
|
...workspaceInfoOptional,
|
|
382
505
|
packageManager: plan.packageManager,
|
|
383
506
|
downloadPackageManager: downloadResult
|
|
384
507
|
};
|
|
385
|
-
if (plan.packageManager === PackageManager.yarn && import_semver.default.satisfies(downloadResult.version, ">=4.0.0 <4.10.0")) {
|
|
386
|
-
updateMigrationProgress("Upgrading Yarn");
|
|
387
|
-
await upgradeYarn(workspaceInfo.rootDir, interactive, true);
|
|
388
|
-
} else if (plan.packageManager === PackageManager.pnpm && import_semver.default.satisfies(downloadResult.version, "< 9.5.0")) {
|
|
389
|
-
failMigrationProgress("Migration failed");
|
|
390
|
-
log.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
391
|
-
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
392
|
-
} else if (plan.packageManager === PackageManager.npm && import_semver.default.satisfies(downloadResult.version, "< 8.3.0")) {
|
|
393
|
-
failMigrationProgress("Migration failed");
|
|
394
|
-
log.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
395
|
-
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
396
|
-
}
|
|
397
508
|
if (plan.migrateNodeVersionFile && plan.nodeVersionDetection) {
|
|
398
509
|
updateMigrationProgress("Migrating node version file");
|
|
399
510
|
migrateNodeVersionManagerFile(workspaceInfo.rootDir, plan.nodeVersionDetection, report);
|
|
@@ -459,17 +570,8 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
459
570
|
conflictDecisions: plan.editorConflictDecisions,
|
|
460
571
|
silent: true
|
|
461
572
|
});
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
for (const framework of plan.frameworkShimFrameworks) {
|
|
465
|
-
if (detectFramework(workspaceInfo.rootDir).includes(framework) && !hasFrameworkShim(workspaceInfo.rootDir, framework)) addFrameworkShim(workspaceInfo.rootDir, framework, report);
|
|
466
|
-
for (const pkg of workspaceInfo.packages) {
|
|
467
|
-
const pkgPath = path.join(workspaceInfo.rootDir, pkg.path);
|
|
468
|
-
if (detectFramework(pkgPath).includes(framework) && !hasFrameworkShim(pkgPath, framework)) addFrameworkShim(pkgPath, framework, report);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
const installArgs = plan.packageManager === PackageManager.npm || plan.packageManager === PackageManager.bun ? ["--force"] : void 0;
|
|
573
|
+
addFrameworkShimsForWorkspace(workspaceInfo.rootDir, plan.frameworkShimFrameworks, workspaceInfo.packages, report, updateMigrationProgress);
|
|
574
|
+
const installArgs = plan.packageManager === PackageManager.npm || plan.packageManager === PackageManager.bun ? ["--force"] : ["--no-frozen-lockfile"];
|
|
473
575
|
updateMigrationProgress("Installing dependencies");
|
|
474
576
|
const finalInstallSummary = await runViteInstall(workspaceInfo.rootDir, interactive, installArgs, {
|
|
475
577
|
silent: true,
|
|
@@ -478,7 +580,8 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive) {
|
|
|
478
580
|
});
|
|
479
581
|
clearMigrationProgress();
|
|
480
582
|
return {
|
|
481
|
-
installDurationMs: initialInstallSummary.
|
|
583
|
+
installDurationMs: handleInstallResult(initialInstallSummary, workspaceInfo.rootDir, report, { propagateExitCode: false }) + handleInstallResult(finalInstallSummary, workspaceInfo.rootDir, report),
|
|
584
|
+
finalInstallOk: finalInstallSummary.status === "installed",
|
|
482
585
|
packageManagerVersion: downloadResult.version,
|
|
483
586
|
report
|
|
484
587
|
};
|
|
@@ -493,10 +596,10 @@ async function main() {
|
|
|
493
596
|
printHeader();
|
|
494
597
|
const workspaceInfoOptional = await detectWorkspace(projectPath);
|
|
495
598
|
const resolvedPackageManager = workspaceInfoOptional.packageManager ?? "unknown";
|
|
496
|
-
|
|
497
|
-
if (hasVitePlusDependency(rootPkg) && !isForceOverrideMode()) {
|
|
599
|
+
if (hasVitePlusDependency(readNearestPackageJson(workspaceInfoOptional.rootDir)) && !isForceOverrideMode()) {
|
|
498
600
|
let didMigrate = false;
|
|
499
601
|
let installDurationMs = 0;
|
|
602
|
+
let finalInstallOk = true;
|
|
500
603
|
const report = createMigrationReport();
|
|
501
604
|
const migrationProgress = options.interactive ? spinner({ indicator: "timer" }) : void 0;
|
|
502
605
|
let migrationProgressStarted = false;
|
|
@@ -515,6 +618,60 @@ async function main() {
|
|
|
515
618
|
migrationProgressStarted = false;
|
|
516
619
|
}
|
|
517
620
|
};
|
|
621
|
+
const failMigrationProgress = (message) => {
|
|
622
|
+
if (migrationProgress && migrationProgressStarted) {
|
|
623
|
+
migrationProgress.error(message);
|
|
624
|
+
migrationProgressStarted = false;
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
const pendingCoreMigration = detectPendingCoreMigration(workspaceInfoOptional);
|
|
628
|
+
const legacyGitHooksMigrationCandidate = detectLegacyGitHooksMigrationCandidate(workspaceInfoOptional.rootDir);
|
|
629
|
+
const vitePlusBootstrapPending = detectVitePlusBootstrapPending(workspaceInfoOptional.rootDir, workspaceInfoOptional.packageManager);
|
|
630
|
+
let packageManager = vitePlusBootstrapPending ? workspaceInfoOptional.packageManager ?? await selectPackageManager(options.interactive, true) : workspaceInfoOptional.packageManager;
|
|
631
|
+
let downloadedPackageManager;
|
|
632
|
+
let packageManagerVersion = workspaceInfoOptional.packageManagerVersion;
|
|
633
|
+
const downloadExistingPackageManager = async () => {
|
|
634
|
+
if (!packageManager) return;
|
|
635
|
+
downloadedPackageManager ??= await downloadSupportedPackageManager({
|
|
636
|
+
rootDir: workspaceInfoOptional.rootDir,
|
|
637
|
+
packageManager,
|
|
638
|
+
packageManagerVersion,
|
|
639
|
+
interactive: options.interactive,
|
|
640
|
+
updateMigrationProgress,
|
|
641
|
+
failMigrationProgress
|
|
642
|
+
});
|
|
643
|
+
packageManagerVersion = downloadedPackageManager.version;
|
|
644
|
+
return downloadedPackageManager;
|
|
645
|
+
};
|
|
646
|
+
const ensureExistingPackageManager = async () => {
|
|
647
|
+
packageManager ??= await selectPackageManager(options.interactive, true);
|
|
648
|
+
return downloadExistingPackageManager();
|
|
649
|
+
};
|
|
650
|
+
if (vitePlusBootstrapPending) await ensureExistingPackageManager();
|
|
651
|
+
const coreMigrationResult = finalizeCoreMigrationForExistingVitePlus(workspaceInfoOptional, true, report, pendingCoreMigration);
|
|
652
|
+
if (coreMigrationResult.scripts || coreMigrationResult.tsconfigTypes || coreMigrationResult.imports) didMigrate = true;
|
|
653
|
+
if (!didMigrate && report.warnings.length === 0 && !vitePlusBootstrapPending && !hasExistingVitePlusMigrationCandidates(workspaceInfoOptional, options)) {
|
|
654
|
+
outro(`This project is already using Vite+! ${accent("Happy coding!")}`);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const fullMigrationSummary = vitePlusBootstrapPending || coreMigrationResult.scripts || coreMigrationResult.tsconfigTypes || coreMigrationResult.imports;
|
|
658
|
+
const setupOptions = getExistingVitePlusSetupOptions(options, legacyGitHooksMigrationCandidate, options.interactive && fullMigrationSummary);
|
|
659
|
+
const plan = await collectMigrationSetupPlan(workspaceInfoOptional.rootDir, packageManager, setupOptions, workspaceInfoOptional.packages);
|
|
660
|
+
const frameworkShimFrameworks = await collectFrameworkShimFrameworks(workspaceInfoOptional.rootDir, options, workspaceInfoOptional.packages);
|
|
661
|
+
let needsInstall = false;
|
|
662
|
+
if (vitePlusBootstrapPending) {
|
|
663
|
+
const downloadResult = await ensureExistingPackageManager();
|
|
664
|
+
if (downloadResult && packageManager) {
|
|
665
|
+
updateMigrationProgress("Configuring package manager");
|
|
666
|
+
const bootstrapResult = ensureVitePlusBootstrap({
|
|
667
|
+
...workspaceInfoOptional,
|
|
668
|
+
packageManager,
|
|
669
|
+
downloadPackageManager: downloadResult
|
|
670
|
+
}, report);
|
|
671
|
+
didMigrate = bootstrapResult.changed || didMigrate;
|
|
672
|
+
needsInstall = bootstrapResult.changed || needsInstall;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
518
675
|
const fixedBaseUrlProjectPaths = await fixBaseUrlForWorkspace(workspaceInfoOptional, hasBaseUrlInWorkspace(workspaceInfoOptional) ? await confirmBaseUrlFix(options.interactive) : false, updateMigrationProgress, report);
|
|
519
676
|
if (fixedBaseUrlProjectPaths.length > 0) {
|
|
520
677
|
updateMigrationProgress("Updating lint defaults");
|
|
@@ -522,32 +679,89 @@ async function main() {
|
|
|
522
679
|
didMigrate = true;
|
|
523
680
|
}
|
|
524
681
|
clearMigrationProgress();
|
|
525
|
-
|
|
526
|
-
|
|
682
|
+
let eslintMigrated = false;
|
|
683
|
+
if (plan.migrateEslint) {
|
|
684
|
+
await ensureExistingPackageManager();
|
|
685
|
+
updateMigrationProgress("Migrating ESLint");
|
|
686
|
+
if (!await migrateEslintToOxlint(workspaceInfoOptional.rootDir, options.interactive, plan.eslintConfigFile, workspaceInfoOptional.packages, {
|
|
687
|
+
silent: true,
|
|
688
|
+
report
|
|
689
|
+
})) {
|
|
690
|
+
clearMigrationProgress();
|
|
691
|
+
cancelAndExit("ESLint migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
692
|
+
}
|
|
693
|
+
eslintMigrated = true;
|
|
694
|
+
}
|
|
695
|
+
const prettierProject = detectPrettierProject(workspaceInfoOptional.rootDir, workspaceInfoOptional.packages);
|
|
696
|
+
let prettierMigrated = false;
|
|
697
|
+
if (prettierProject.hasDependency && prettierProject.configFile) {
|
|
698
|
+
if (await confirmPrettierMigration(options.interactive)) {
|
|
699
|
+
await ensureExistingPackageManager();
|
|
700
|
+
updateMigrationProgress("Migrating Prettier");
|
|
701
|
+
if (!await migratePrettierToOxfmt(workspaceInfoOptional.rootDir, options.interactive, prettierProject.configFile, workspaceInfoOptional.packages, {
|
|
702
|
+
silent: true,
|
|
703
|
+
report
|
|
704
|
+
})) {
|
|
705
|
+
clearMigrationProgress();
|
|
706
|
+
cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
707
|
+
}
|
|
708
|
+
prettierMigrated = true;
|
|
709
|
+
}
|
|
710
|
+
} else if (prettierProject.hasDependency) warnPackageLevelPrettier();
|
|
527
711
|
const nodeVersionDetection = detectNodeVersionManagerFile(workspaceInfoOptional.rootDir);
|
|
528
712
|
if (nodeVersionDetection) {
|
|
529
713
|
if (await confirmNodeVersionFileMigration(options.interactive, nodeVersionDetection) && migrateNodeVersionManagerFile(workspaceInfoOptional.rootDir, nodeVersionDetection, report)) didMigrate = true;
|
|
530
714
|
}
|
|
715
|
+
if (addFrameworkShimsForWorkspace(workspaceInfoOptional.rootDir, frameworkShimFrameworks, workspaceInfoOptional.packages, report, updateMigrationProgress)) didMigrate = true;
|
|
531
716
|
if (eslintMigrated || prettierMigrated) {
|
|
532
717
|
updateMigrationProgress("Rewriting configs");
|
|
533
718
|
mergeViteConfigFiles(workspaceInfoOptional.rootDir, true, report, workspaceInfoOptional.packages);
|
|
719
|
+
needsInstall = true;
|
|
720
|
+
didMigrate = true;
|
|
721
|
+
report.eslintMigrated = eslintMigrated;
|
|
722
|
+
report.prettierMigrated = prettierMigrated;
|
|
723
|
+
}
|
|
724
|
+
if (plan.shouldSetupHooks) {
|
|
725
|
+
await ensureExistingPackageManager();
|
|
726
|
+
updateMigrationProgress("Configuring git hooks");
|
|
727
|
+
if (installGitHooks(workspaceInfoOptional.rootDir, true, report, packageManager)) {
|
|
728
|
+
didMigrate = true;
|
|
729
|
+
needsInstall = true;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
if (needsInstall) {
|
|
733
|
+
const resolved = await ensureExistingPackageManager();
|
|
534
734
|
updateMigrationProgress("Installing dependencies");
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
const installSummary = await runViteInstall(workspaceInfoOptional.rootDir, options.interactive, void 0, {
|
|
735
|
+
const resolvedVersion = resolved?.version ?? packageManagerVersion;
|
|
736
|
+
const installSummary = await runViteInstall(workspaceInfoOptional.rootDir, options.interactive, packageManager === PackageManager.npm || packageManager === PackageManager.bun ? ["--force"] : ["--no-frozen-lockfile"], {
|
|
538
737
|
silent: true,
|
|
539
|
-
packageManager
|
|
738
|
+
packageManager,
|
|
540
739
|
packageManagerVersion: resolvedVersion
|
|
541
740
|
});
|
|
542
|
-
|
|
741
|
+
if (installSummary.status === "failed") clearMigrationProgress();
|
|
742
|
+
installDurationMs += handleInstallResult(installSummary, workspaceInfoOptional.rootDir, report);
|
|
743
|
+
}
|
|
744
|
+
if (plan.selectedAgentTargetPaths && plan.selectedAgentTargetPaths.length > 0) {
|
|
745
|
+
updateMigrationProgress("Writing agent instructions");
|
|
746
|
+
await writeAgentInstructions({
|
|
747
|
+
projectRoot: workspaceInfoOptional.rootDir,
|
|
748
|
+
targetPaths: plan.selectedAgentTargetPaths,
|
|
749
|
+
interactive: options.interactive,
|
|
750
|
+
conflictDecisions: plan.agentConflictDecisions,
|
|
751
|
+
silent: true
|
|
752
|
+
});
|
|
543
753
|
didMigrate = true;
|
|
544
|
-
report.eslintMigrated = eslintMigrated;
|
|
545
|
-
report.prettierMigrated = prettierMigrated;
|
|
546
754
|
}
|
|
547
|
-
if (
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
755
|
+
if (plan.selectedEditor) {
|
|
756
|
+
updateMigrationProgress("Writing editor configs");
|
|
757
|
+
await writeEditorConfigs({
|
|
758
|
+
projectRoot: workspaceInfoOptional.rootDir,
|
|
759
|
+
editorId: plan.selectedEditor,
|
|
760
|
+
interactive: options.interactive,
|
|
761
|
+
conflictDecisions: plan.editorConflictDecisions,
|
|
762
|
+
silent: true
|
|
763
|
+
});
|
|
764
|
+
didMigrate = true;
|
|
551
765
|
}
|
|
552
766
|
await checkRolldownCompatibility(workspaceInfoOptional.rootDir, report);
|
|
553
767
|
if (workspaceInfoOptional.packages) for (const pkg of workspaceInfoOptional.packages) await checkRolldownCompatibility(path.join(workspaceInfoOptional.rootDir, pkg.path), report);
|
|
@@ -555,13 +769,14 @@ async function main() {
|
|
|
555
769
|
clearMigrationProgress();
|
|
556
770
|
showMigrationSummary({
|
|
557
771
|
projectRoot: workspaceInfoOptional.rootDir,
|
|
558
|
-
packageManager: resolvedPackageManager,
|
|
559
|
-
packageManagerVersion
|
|
772
|
+
packageManager: packageManager ?? resolvedPackageManager,
|
|
773
|
+
packageManagerVersion,
|
|
560
774
|
installDurationMs,
|
|
775
|
+
finalInstallOk,
|
|
561
776
|
report,
|
|
562
|
-
updatedExistingVitePlus:
|
|
777
|
+
updatedExistingVitePlus: !fullMigrationSummary
|
|
563
778
|
});
|
|
564
|
-
} else outro(`This project is already using Vite+! ${accent(
|
|
779
|
+
} else outro(`This project is already using Vite+! ${accent("Happy coding!")}`);
|
|
565
780
|
return;
|
|
566
781
|
}
|
|
567
782
|
const plan = await collectMigrationPlan(workspaceInfoOptional.rootDir, workspaceInfoOptional.packageManager, options, workspaceInfoOptional.packages);
|
|
@@ -571,6 +786,7 @@ async function main() {
|
|
|
571
786
|
packageManager: plan.packageManager,
|
|
572
787
|
packageManagerVersion: result.packageManagerVersion,
|
|
573
788
|
installDurationMs: result.installDurationMs,
|
|
789
|
+
finalInstallOk: result.finalInstallOk,
|
|
574
790
|
report: result.report
|
|
575
791
|
});
|
|
576
792
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as VITE_PLUS_NAME } from "./constants-CrfJQIUX.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,17 +1,23 @@
|
|
|
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-q8a5PFch.js";
|
|
2
2
|
import { definePlugin, defineRule } from "@oxlint/plugins";
|
|
3
3
|
//#region src/oxlint-plugin.ts
|
|
4
|
+
function isVitestFamilyDeclareModuleSpecifier(specifier) {
|
|
5
|
+
return specifier === "vitest" || specifier.startsWith("vitest/") || specifier === "@vitest/browser" || specifier.startsWith("@vitest/browser/") || specifier.startsWith("@vitest/browser-");
|
|
6
|
+
}
|
|
4
7
|
function rewriteVitePlusImportSpecifier(specifier) {
|
|
5
8
|
if (specifier === "vite") return "vite-plus";
|
|
6
9
|
if (specifier.startsWith("vite/")) return `vite-plus/${specifier.slice(5)}`;
|
|
7
10
|
if (specifier === "vitest/config") return "vite-plus";
|
|
8
11
|
if (specifier === "vitest") return "vite-plus/test";
|
|
12
|
+
if (specifier === "vitest/package.json") return null;
|
|
9
13
|
if (specifier.startsWith("vitest/")) return `vite-plus/test/${specifier.slice(7)}`;
|
|
10
14
|
if (specifier === "@vitest/browser") return "vite-plus/test/browser";
|
|
11
15
|
const browserSubpathRewrites = {
|
|
12
16
|
"@vitest/browser/context": "vite-plus/test/browser/context",
|
|
13
17
|
"@vitest/browser/client": "vite-plus/test/client",
|
|
14
|
-
"@vitest/browser/locators": "vite-plus/test/locators"
|
|
18
|
+
"@vitest/browser/locators": "vite-plus/test/locators",
|
|
19
|
+
"@vitest/browser/matchers": "vite-plus/test/matchers",
|
|
20
|
+
"@vitest/browser/utils": "vite-plus/test/utils"
|
|
15
21
|
};
|
|
16
22
|
if (specifier in browserSubpathRewrites) return browserSubpathRewrites[specifier];
|
|
17
23
|
for (const [prefix, provider] of [
|
|
@@ -78,7 +84,9 @@ const preferVitePlusImportsRule = defineRule({
|
|
|
78
84
|
},
|
|
79
85
|
TSModuleDeclaration(node) {
|
|
80
86
|
if (node.global) return;
|
|
81
|
-
|
|
87
|
+
const id = node.id;
|
|
88
|
+
if (id?.type === "Literal" && typeof id.value === "string" && isVitestFamilyDeclareModuleSpecifier(id.value)) return;
|
|
89
|
+
maybeReportLiteral(context, id);
|
|
82
90
|
}
|
|
83
91
|
};
|
|
84
92
|
}
|