vite-plus 0.2.7 → 0.2.8
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 +5 -1
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +99 -8
- package/dist/agent-CI79DuSy.js +600 -0
- package/dist/bin.js +1368 -13
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +13 -126
- package/dist/{constants-BsuzPowC.js → constants-BppDcRc1.js} +1 -1
- package/dist/create/bin.js +90 -77
- package/dist/{define-config-DLh9fE95.cjs → define-config-CEm_MtvJ.cjs} +1 -1
- package/dist/{define-config-C2KfLHpC.js → define-config-DPnHe1Mx.js} +2 -2
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- 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-CSQWHI6y.js} +3 -8
- package/dist/dist-DT25H9pj.js +3 -0
- package/dist/{agent-CPwWJ4qf.js → editor-CGWdbLgD.js} +690 -579
- 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-BU88uu6o.js} +2 -6
- package/dist/migration/bin.js +58 -48
- package/dist/{oxlint-plugin-config-Bxgc4cwF.js → oxlint-plugin-config-BHOzlwMw.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-Ds3uThLb.js → package-hV-77cBb.js} +2 -2
- package/dist/{tsconfig-Jia2vgMG.js → prompts-DYap08te.js} +32 -174
- package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-EWXclqvV.js} +1 -1
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +20 -23
- package/dist/{help-YP84FSEz.js → terminal-CrqqK8WT.js} +39 -2
- package/dist/tsconfig-CVUKLfL8.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-eMZT-oea.js} +4 -2
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +5 -5
- package/dist/versions.js +4 -4
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/commit-hooks.md +38 -20
- package/docs/guide/env.md +8 -4
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +2 -0
- package/docs/guide/installer-env-vars.md +3 -3
- package/docs/guide/migrate.md +10 -2
- package/docs/guide/monorepo.md +94 -6
- package/docs/guide/troubleshooting.md +3 -2
- package/package.json +17 -23
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-BbT1lTNc.js +0 -675
- package/dist/terminal-uTv0ZaMr.js +0 -33
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
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-CEm_MtvJ.cjs");
|
|
2
2
|
//#region src/index.cts
|
|
3
3
|
const vite = require("@voidzero-dev/vite-plus-core");
|
|
4
4
|
const { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } = require("vitest/config");
|
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-DPnHe1Mx.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 };
|
|
@@ -535,9 +535,7 @@ function format(documentText, range, options) {
|
|
|
535
535
|
else if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) replaceContent = cachedSpaces[1];
|
|
536
536
|
else if (secondToken !== 5 && secondToken !== 17) hasError = true;
|
|
537
537
|
break;
|
|
538
|
-
case 16:
|
|
539
|
-
hasError = true;
|
|
540
|
-
break;
|
|
538
|
+
case 16: hasError = true;
|
|
541
539
|
}
|
|
542
540
|
if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) replaceContent = newLinesAndIndent();
|
|
543
541
|
}
|
|
@@ -800,9 +798,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
800
798
|
case 2:
|
|
801
799
|
handleError(12);
|
|
802
800
|
break;
|
|
803
|
-
case 6:
|
|
804
|
-
handleError(16);
|
|
805
|
-
break;
|
|
801
|
+
case 6: handleError(16);
|
|
806
802
|
}
|
|
807
803
|
switch (token) {
|
|
808
804
|
case 12:
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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 printHeader, c as renderCliDoc, i as muted, r as log, s as warnMsg, t as accent } from "../terminal-CrqqK8WT.js";
|
|
3
|
+
import { d as isForceOverrideMode, l as VITE_PLUS_VERSION } from "../constants-BppDcRc1.js";
|
|
4
|
+
import { A as isCancel, C as log$1, D as spinner, E as select, M as runCommandSilently, T as outro, c as selectPackageManager, i as promptGitHooks, l as upgradeYarn, n as defaultInteractive, o as runViteFmt, r as downloadPackageManager, s as runViteInstall, t as cancelAndExit, v as PackageManager, x as confirm, y as require_semver } from "../prompts-DYap08te.js";
|
|
5
|
+
import { a as writeJsonFile, i as readJsonFile } from "../json-BU88uu6o.js";
|
|
6
|
+
import { i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-CVUKLfL8.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-hV-77cBb.js";
|
|
9
|
+
import { f as displayRelative, i as selectAgentTargetPaths, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-CI79DuSy.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 { A as addFrameworkShim, B as detectIncompatibleEslintIntegration, C as ensureVitePlusBootstrap, E as detectWorkspace, F as migratePrettierToOxfmt, G as warnPackageLevelEslint, K as checkViteVersion, L as warnPackageLevelPrettier, M as hasFrameworkShim, N as confirmPrettierMigration, P as detectPrettierProject, R as confirmEslintMigration, S as detectVitePlusBootstrapPending, T as detectYarnPnpMode, U as warnIncompatibleEslintIntegration, V as migrateEslintToOxlint, W as warnLegacyEslintConfig, _ as shouldSkipStagedMigrationForHooks, a as writeEditorConfigs, b as mergeViteConfigFiles, c as rewriteStandaloneProject, d as detectNodeVersionManagerFile, f as migrateNodeVersionManagerFile, g as preflightGitHooksSetup, h as installGitHooks, j as detectFramework, l as detectPendingCoreMigration, m as detectLegacyGitHooksMigrationCandidate, o as rewriteMonorepo, q as checkVitestVersion, r as selectEditor, t as detectEditorConflicts, u as finalizeCoreMigrationForExistingVitePlus, w as configureYarnNodeModulesMode, x as collectToolchainVersionChanges, y as injectLintTypeCheckDefaults, z as detectEslintProject } from "../editor-CGWdbLgD.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
14
|
import { styleText } from "node:util";
|
|
15
|
+
import fs, { existsSync } from "node:fs";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
17
|
//#region src/migration/compat/runner.ts
|
|
18
18
|
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
@@ -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
|
}
|
|
@@ -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",
|
|
@@ -724,37 +728,42 @@ function showMigrationSummary(options) {
|
|
|
724
728
|
const { projectRoot, packageManager, packageManagerVersion, installDurationMs, finalInstallOk, report, updatedExistingVitePlus, suggestFullMigration } = options;
|
|
725
729
|
const projectLabel = displayRelative(projectRoot) || ".";
|
|
726
730
|
const configUpdates = report.createdViteConfigCount + report.mergedConfigCount + report.mergedStagedConfigCount + report.inlinedLintStagedConfigCount + report.removedConfigCount + report.tsdownImportCount + report.wrappedPluginConfigCount;
|
|
727
|
-
log
|
|
728
|
-
log
|
|
731
|
+
log(`${styleText("magenta", "◇")} ${updatedExistingVitePlus ? "Updated" : "Migrated"} ${accent(projectLabel)} to Vite+ ${VITE_PLUS_VERSION}`);
|
|
732
|
+
log(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
|
|
729
733
|
if (report.dependencyUpgrades.length > 0) {
|
|
730
734
|
const nameWidth = Math.max(...report.dependencyUpgrades.map((change) => change.name.length));
|
|
731
735
|
const fromWidth = Math.max(...report.dependencyUpgrades.map((change) => (change.from ?? "").length));
|
|
732
|
-
log
|
|
733
|
-
for (const change of report.dependencyUpgrades)
|
|
736
|
+
log(`${styleText("gray", "•")} Dependencies:`);
|
|
737
|
+
for (const change of report.dependencyUpgrades) {
|
|
738
|
+
const name = change.name.padEnd(nameWidth);
|
|
739
|
+
const from = muted((change.from ?? "").padEnd(fromWidth));
|
|
740
|
+
const to = styleText("green", change.to);
|
|
741
|
+
log(` ${name} ${from} → ${to}`);
|
|
742
|
+
}
|
|
734
743
|
}
|
|
735
|
-
if (finalInstallOk && installDurationMs > 0) log
|
|
744
|
+
if (finalInstallOk && installDurationMs > 0) log(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installDurationMs)}`);
|
|
736
745
|
if (configUpdates > 0 || report.rewrittenImportFileCount > 0) {
|
|
737
746
|
const parts = [];
|
|
738
747
|
if (configUpdates > 0) parts.push(`${configUpdates} ${configUpdates === 1 ? "config update" : "config updates"} applied`);
|
|
739
748
|
if (report.rewrittenImportFileCount > 0) parts.push(`${report.rewrittenImportFileCount} ${report.rewrittenImportFileCount === 1 ? "file had" : "files had"} imports rewritten`);
|
|
740
|
-
log
|
|
749
|
+
log(`${styleText("gray", "•")} ${parts.join(", ")}`);
|
|
741
750
|
}
|
|
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
|
|
751
|
+
if (report.preservedUpstreamVitestImportFileCount > 0) log(`${styleText("gray", "•")} Kept upstream \`vitest\` imports in ${report.preservedUpstreamVitestImportFileCount} ${report.preservedUpstreamVitestImportFileCount === 1 ? "file" : "files"} for @nuxt/test-utils compatibility`);
|
|
752
|
+
if (report.eslintMigrated) log(`${styleText("gray", "•")} ESLint rules migrated to Oxlint`);
|
|
753
|
+
if (report.prettierMigrated) log(`${styleText("gray", "•")} Prettier migrated to Oxfmt`);
|
|
754
|
+
if (report.nodeVersionFileMigrated) log(`${styleText("gray", "•")} Node version manager file migrated to .node-version`);
|
|
755
|
+
if (report.wrappedPluginConfigCount > 0) log(`${styleText("gray", "•")} Inline Vite plugins wrapped with lazyPlugins for check/lint/fmt`);
|
|
756
|
+
if (report.gitHooksConfigured) log(`${styleText("gray", "•")} Git hooks configured`);
|
|
757
|
+
if (report.frameworkShimAdded) log(`${styleText("gray", "•")} TypeScript shim added for framework component files`);
|
|
758
|
+
if (report.packageManagerBootstrapConfigured) log(`${styleText("gray", "•")} Package manager settings configured`);
|
|
759
|
+
if (suggestFullMigration) log(FULL_MIGRATION_HINT);
|
|
751
760
|
if (report.warnings.length > 0) {
|
|
752
|
-
log
|
|
753
|
-
for (const warning of report.warnings) log
|
|
761
|
+
log(`${styleText("yellow", "!")} Warnings:`);
|
|
762
|
+
for (const warning of report.warnings) log(` - ${warning}`);
|
|
754
763
|
}
|
|
755
764
|
if (report.manualSteps.length > 0) {
|
|
756
|
-
log
|
|
757
|
-
for (const step of report.manualSteps) log
|
|
765
|
+
log(`${styleText("blue", "→")} Manual follow-up:`);
|
|
766
|
+
for (const step of report.manualSteps) log(` - ${step}`);
|
|
758
767
|
}
|
|
759
768
|
}
|
|
760
769
|
async function downloadSupportedPackageManager(options) {
|
|
@@ -766,11 +775,11 @@ async function downloadSupportedPackageManager(options) {
|
|
|
766
775
|
await upgradeYarn(rootDir, interactive, true);
|
|
767
776
|
} else if (packageManager === PackageManager.pnpm && import_semver.default.satisfies(downloadResult.version, "< 9.5.0")) {
|
|
768
777
|
failMigrationProgress("Migration failed");
|
|
769
|
-
log.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
778
|
+
log$1.error(`✘ pnpm@${downloadResult.version} is not supported by auto migration, please upgrade pnpm to >=9.5.0 first`);
|
|
770
779
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
771
780
|
} else if (packageManager === PackageManager.npm && import_semver.default.satisfies(downloadResult.version, "< 8.3.0")) {
|
|
772
781
|
failMigrationProgress("Migration failed");
|
|
773
|
-
log.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
782
|
+
log$1.error(`✘ npm@${downloadResult.version} is not supported by auto migration, please upgrade npm to >=8.3.0 first`);
|
|
774
783
|
cancelAndExit("Vite+ cannot automatically migrate this project yet.", 1);
|
|
775
784
|
}
|
|
776
785
|
return downloadResult;
|
|
@@ -816,7 +825,7 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
|
|
|
816
825
|
if (plan.convertYarnPnp) {
|
|
817
826
|
updateMigrationProgress("Configuring Yarn node-modules mode");
|
|
818
827
|
report.packageManagerBootstrapConfigured = configureYarnNodeModulesMode(workspaceInfo.rootDir);
|
|
819
|
-
if (report.packageManagerBootstrapConfigured) log.success("✔ Switched Yarn to node-modules mode");
|
|
828
|
+
if (report.packageManagerBootstrapConfigured) log$1.success("✔ Switched Yarn to node-modules mode");
|
|
820
829
|
}
|
|
821
830
|
if (plan.migrateNodeVersionFile && plan.nodeVersionDetection) {
|
|
822
831
|
updateMigrationProgress("Migrating node version file");
|
|
@@ -857,13 +866,13 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
|
|
|
857
866
|
cancelAndExit("Prettier migration failed. Fix the issue and re-run `vp migrate`.", 1);
|
|
858
867
|
}
|
|
859
868
|
}
|
|
860
|
-
const skipStagedMigration =
|
|
869
|
+
const skipStagedMigration = shouldSkipStagedMigrationForHooks(workspaceInfo.rootDir, plan.shouldSetupHooks, plan.packageManager, workspaceInfo.packages);
|
|
861
870
|
updateMigrationProgress("Rewriting configs");
|
|
862
871
|
if (workspaceInfo.isMonorepo) rewriteMonorepo(workspaceInfo, skipStagedMigration, true, report);
|
|
863
872
|
else rewriteStandaloneProject(workspaceInfo.rootDir, workspaceInfo, skipStagedMigration, true, report);
|
|
864
873
|
if (plan.shouldSetupHooks) {
|
|
865
874
|
updateMigrationProgress("Configuring git hooks");
|
|
866
|
-
installGitHooks(workspaceInfo.rootDir, true, report, plan.packageManager);
|
|
875
|
+
installGitHooks(workspaceInfo.rootDir, true, report, plan.packageManager, workspaceInfo.packages);
|
|
867
876
|
}
|
|
868
877
|
updateMigrationProgress("Writing agent instructions");
|
|
869
878
|
await writeAgentInstructions({
|
|
@@ -907,7 +916,7 @@ async function main() {
|
|
|
907
916
|
const { projectPath, options } = parseArgs();
|
|
908
917
|
if (options.help) {
|
|
909
918
|
printHeader();
|
|
910
|
-
log
|
|
919
|
+
log(helpMessage);
|
|
911
920
|
return;
|
|
912
921
|
}
|
|
913
922
|
printHeader();
|
|
@@ -915,7 +924,8 @@ async function main() {
|
|
|
915
924
|
const initialChangedPaths = await collectChangedFormatPaths(workspaceInfoOptional.rootDir);
|
|
916
925
|
const preExistingChangedPaths = initialChangedPaths ? new Set(initialChangedPaths) : void 0;
|
|
917
926
|
const resolvedPackageManager = workspaceInfoOptional.packageManager ?? "unknown";
|
|
918
|
-
|
|
927
|
+
const rootPkg = readNearestPackageJson(workspaceInfoOptional.rootDir);
|
|
928
|
+
if (hasVitePlusDependency(rootPkg) && !isForceOverrideMode()) {
|
|
919
929
|
let convertYarnPnp = await confirmYarnNodeModulesMode(workspaceInfoOptional.rootDir, workspaceInfoOptional.packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive);
|
|
920
930
|
let didMigrate = false;
|
|
921
931
|
let installDurationMs = 0;
|
|
@@ -978,7 +988,7 @@ async function main() {
|
|
|
978
988
|
const fullSetup = options.full === true;
|
|
979
989
|
const skippedSetupCandidates = !fullSetup && !hasExplicitExistingVitePlusSetupRequest(options) && hasExistingVitePlusMigrationCandidates(workspaceInfoOptional, options);
|
|
980
990
|
if (!didMigrate && !convertYarnPnp && report.warnings.length === 0 && !vitePlusBootstrapPending && !(fullSetup ? hasExistingVitePlusMigrationCandidates(workspaceInfoOptional, options) : hasExplicitExistingVitePlusSetupRequest(options))) {
|
|
981
|
-
if (skippedSetupCandidates) log
|
|
991
|
+
if (skippedSetupCandidates) log(FULL_MIGRATION_HINT);
|
|
982
992
|
outro(`This project is already using Vite+! ${accent("Happy coding!")}`);
|
|
983
993
|
return;
|
|
984
994
|
}
|
|
@@ -1053,7 +1063,7 @@ async function main() {
|
|
|
1053
1063
|
if (convertYarnPnp) {
|
|
1054
1064
|
updateMigrationProgress("Configuring Yarn node-modules mode");
|
|
1055
1065
|
if (configureYarnNodeModulesMode(workspaceInfoOptional.rootDir)) {
|
|
1056
|
-
log.success("✔ Switched Yarn to node-modules mode");
|
|
1066
|
+
log$1.success("✔ Switched Yarn to node-modules mode");
|
|
1057
1067
|
report.packageManagerBootstrapConfigured = true;
|
|
1058
1068
|
didMigrate = true;
|
|
1059
1069
|
needsInstall = true;
|
|
@@ -1071,7 +1081,7 @@ async function main() {
|
|
|
1071
1081
|
if (plan.shouldSetupHooks) {
|
|
1072
1082
|
await ensureExistingPackageManager();
|
|
1073
1083
|
updateMigrationProgress("Configuring git hooks");
|
|
1074
|
-
if (installGitHooks(workspaceInfoOptional.rootDir, true, report, packageManager)) {
|
|
1084
|
+
if (installGitHooks(workspaceInfoOptional.rootDir, true, report, packageManager, workspaceInfoOptional.packages)) {
|
|
1075
1085
|
didMigrate = true;
|
|
1076
1086
|
needsInstall = true;
|
|
1077
1087
|
}
|
|
@@ -1135,7 +1145,7 @@ async function main() {
|
|
|
1135
1145
|
});
|
|
1136
1146
|
} else {
|
|
1137
1147
|
clearMigrationProgress();
|
|
1138
|
-
if (skippedSetupCandidates) log
|
|
1148
|
+
if (skippedSetupCandidates) log(FULL_MIGRATION_HINT);
|
|
1139
1149
|
outro(`This project is already using Vite+! ${accent("Happy coding!")}`);
|
|
1140
1150
|
}
|
|
1141
1151
|
return;
|
|
@@ -1152,7 +1162,7 @@ async function main() {
|
|
|
1152
1162
|
});
|
|
1153
1163
|
}
|
|
1154
1164
|
main().catch((err) => {
|
|
1155
|
-
log.error(err.message);
|
|
1165
|
+
log$1.error(err.message);
|
|
1156
1166
|
console.error(err);
|
|
1157
1167
|
process.exit(1);
|
|
1158
1168
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as VITE_PLUS_NAME } from "./constants-
|
|
1
|
+
import { s as VITE_PLUS_NAME } from "./constants-BppDcRc1.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-BHOzlwMw.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-EWXclqvV.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-BppDcRc1.js";
|
|
2
|
+
import { i as readJsonFile } from "./json-BU88uu6o.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as writeJsonFile,
|
|
5
|
-
import { t as require_dist } from "./dist-
|
|
1
|
+
import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
|
|
2
|
+
import { t as accent } from "./terminal-CrqqK8WT.js";
|
|
3
|
+
import { l as VITE_PLUS_VERSION } from "./constants-BppDcRc1.js";
|
|
4
|
+
import { a as writeJsonFile, i as readJsonFile } from "./json-BU88uu6o.js";
|
|
5
|
+
import { t as require_dist } from "./dist-CSQWHI6y.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { downloadPackageManager } from "../binding/index.js";
|
|
8
|
-
import fs from "node:fs";
|
|
9
8
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import { constants as constants$1 } from "node:os";
|
|
10
11
|
import process$1, { stdin, stdout } from "node:process";
|
|
11
12
|
import * as l from "node:readline";
|
|
12
13
|
import l__default from "node:readline";
|
|
@@ -123,7 +124,8 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
123
124
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
124
125
|
const getPathInfo = (cmd, opt) => {
|
|
125
126
|
const colon = opt.colon || COLON;
|
|
126
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
127
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
128
|
+
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
127
129
|
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
128
130
|
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
129
131
|
if (isWindows) {
|
|
@@ -411,6 +413,11 @@ var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
411
413
|
//#endregion
|
|
412
414
|
//#region src/utils/command.ts
|
|
413
415
|
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
416
|
+
function exitCodeFromClose(code, signal) {
|
|
417
|
+
if (code !== null) return code;
|
|
418
|
+
const signalNumber = signal && constants$1.signals[signal];
|
|
419
|
+
return signalNumber ? 128 + signalNumber : 1;
|
|
420
|
+
}
|
|
414
421
|
async function runCommandSilently(options) {
|
|
415
422
|
const child = (0, import_cross_spawn.default)(options.command, options.args, {
|
|
416
423
|
stdio: [
|
|
@@ -436,14 +443,14 @@ async function runCommandSilently(options) {
|
|
|
436
443
|
child.stderr?.on("data", (data) => {
|
|
437
444
|
stderr.push(data);
|
|
438
445
|
});
|
|
439
|
-
child.on("close", (code) => {
|
|
446
|
+
child.on("close", (code, signal) => {
|
|
440
447
|
clearTimeout(timer);
|
|
441
448
|
if (timedOut) {
|
|
442
449
|
reject(/* @__PURE__ */ new Error(`Command timed out after ${options.timeoutMs}ms: ${options.command}`));
|
|
443
450
|
return;
|
|
444
451
|
}
|
|
445
452
|
resolve({
|
|
446
|
-
exitCode: code
|
|
453
|
+
exitCode: exitCodeFromClose(code, signal),
|
|
447
454
|
stdout: Buffer.concat(stdout),
|
|
448
455
|
stderr: Buffer.concat(stderr)
|
|
449
456
|
});
|
|
@@ -461,8 +468,8 @@ async function runCommand$1(options) {
|
|
|
461
468
|
env: options.envs
|
|
462
469
|
});
|
|
463
470
|
return new Promise((resolve, reject) => {
|
|
464
|
-
child.on("close", (code) => {
|
|
465
|
-
resolve({ exitCode: code
|
|
471
|
+
child.on("close", (code, signal) => {
|
|
472
|
+
resolve({ exitCode: exitCodeFromClose(code, signal) });
|
|
466
473
|
});
|
|
467
474
|
child.on("error", (err) => {
|
|
468
475
|
reject(err);
|
|
@@ -1162,9 +1169,7 @@ var a = class extends V {
|
|
|
1162
1169
|
case "right":
|
|
1163
1170
|
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
1164
1171
|
break;
|
|
1165
|
-
case "space":
|
|
1166
|
-
this.toggleValue();
|
|
1167
|
-
break;
|
|
1172
|
+
case "space": this.toggleValue();
|
|
1168
1173
|
}
|
|
1169
1174
|
});
|
|
1170
1175
|
}
|
|
@@ -1189,9 +1194,7 @@ let n$1 = class n extends V {
|
|
|
1189
1194
|
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
1190
1195
|
break;
|
|
1191
1196
|
case "down":
|
|
1192
|
-
case "right":
|
|
1193
|
-
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
1194
|
-
break;
|
|
1197
|
+
case "right": this.cursor = findCursor(this.cursor, 1, this.options);
|
|
1195
1198
|
}
|
|
1196
1199
|
this.changeValue();
|
|
1197
1200
|
});
|
|
@@ -2167,14 +2170,12 @@ const text = (opts) => {
|
|
|
2167
2170
|
//#endregion
|
|
2168
2171
|
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
|
|
2169
2172
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2170
|
-
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
2171
|
-
const MAX_LENGTH = 256;
|
|
2172
|
-
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
2173
2173
|
module.exports = {
|
|
2174
|
-
MAX_LENGTH,
|
|
2174
|
+
MAX_LENGTH: 256,
|
|
2175
2175
|
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
2176
|
-
MAX_SAFE_BUILD_LENGTH:
|
|
2177
|
-
MAX_SAFE_INTEGER
|
|
2176
|
+
MAX_SAFE_BUILD_LENGTH: 250,
|
|
2177
|
+
MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
|
|
2178
|
+
/* istanbul ignore next */ 9007199254740991,
|
|
2178
2179
|
RELEASE_TYPES: [
|
|
2179
2180
|
"major",
|
|
2180
2181
|
"premajor",
|
|
@@ -2184,7 +2185,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2184
2185
|
"prepatch",
|
|
2185
2186
|
"prerelease"
|
|
2186
2187
|
],
|
|
2187
|
-
SEMVER_SPEC_VERSION,
|
|
2188
|
+
SEMVER_SPEC_VERSION: "2.0.0",
|
|
2188
2189
|
FLAG_INCLUDE_PRERELEASE: 1,
|
|
2189
2190
|
FLAG_LOOSE: 2
|
|
2190
2191
|
};
|
|
@@ -2777,9 +2778,7 @@ var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2777
2778
|
version.minor = 0;
|
|
2778
2779
|
version.patch = 0;
|
|
2779
2780
|
break;
|
|
2780
|
-
case "minor":
|
|
2781
|
-
version.patch = 0;
|
|
2782
|
-
break;
|
|
2781
|
+
case "minor": version.patch = 0;
|
|
2783
2782
|
}
|
|
2784
2783
|
return version.format();
|
|
2785
2784
|
};
|
|
@@ -3935,10 +3934,12 @@ async function approveBuilds(options) {
|
|
|
3935
3934
|
//#region src/utils/yaml.ts
|
|
3936
3935
|
var import_dist = require_dist();
|
|
3937
3936
|
function readYamlFile(file) {
|
|
3938
|
-
|
|
3937
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
3938
|
+
return (0, import_dist.parse)(content);
|
|
3939
3939
|
}
|
|
3940
3940
|
function editYamlFile(file, callback) {
|
|
3941
|
-
const
|
|
3941
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
3942
|
+
const doc = (0, import_dist.parseDocument)(content);
|
|
3942
3943
|
callback(doc);
|
|
3943
3944
|
fs.writeFileSync(file, doc.toString({ singleQuote: true }), "utf-8");
|
|
3944
3945
|
}
|
|
@@ -4226,7 +4227,7 @@ async function promptGitHooks(options) {
|
|
|
4226
4227
|
if (options.hooks === true) return true;
|
|
4227
4228
|
if (options.interactive) {
|
|
4228
4229
|
const selected = await confirm({
|
|
4229
|
-
message: "Set up pre-commit hooks to run formatting, linting, and type checking with auto-fixes?",
|
|
4230
|
+
message: options.message ?? "Set up pre-commit hooks to run formatting, linting, and type checking with auto-fixes?",
|
|
4230
4231
|
initialValue: true
|
|
4231
4232
|
});
|
|
4232
4233
|
if (isCancel(selected)) {
|
|
@@ -4261,147 +4262,4 @@ function defaultInteractive() {
|
|
|
4261
4262
|
return !process.env.CI && process.stdin.isTTY;
|
|
4262
4263
|
}
|
|
4263
4264
|
//#endregion
|
|
4264
|
-
|
|
4265
|
-
/**
|
|
4266
|
-
* Check if tsconfig.json has compilerOptions.baseUrl set.
|
|
4267
|
-
* oxlint's TypeScript checker (tsgolint) does not support baseUrl,
|
|
4268
|
-
* so typeAware/typeCheck must be disabled when it is present.
|
|
4269
|
-
*/
|
|
4270
|
-
function hasBaseUrlInTsconfigFile(filePath) {
|
|
4271
|
-
try {
|
|
4272
|
-
return parse(fs.readFileSync(filePath, "utf-8"))?.compilerOptions?.baseUrl != null;
|
|
4273
|
-
} catch {
|
|
4274
|
-
return false;
|
|
4275
|
-
}
|
|
4276
|
-
}
|
|
4277
|
-
const TSCONFIG_FILE_RE = /^tsconfig(\.[\w-]+)?\.json$/i;
|
|
4278
|
-
function findTsconfigFiles(projectPath) {
|
|
4279
|
-
try {
|
|
4280
|
-
return fs.readdirSync(projectPath).filter((name) => TSCONFIG_FILE_RE.test(name)).map((name) => path.join(projectPath, name));
|
|
4281
|
-
} catch {
|
|
4282
|
-
return [];
|
|
4283
|
-
}
|
|
4284
|
-
}
|
|
4285
|
-
function hasBaseUrlInTsconfig(projectPath) {
|
|
4286
|
-
return findTsconfigFiles(projectPath).some((filePath) => hasBaseUrlInTsconfigFile(filePath));
|
|
4287
|
-
}
|
|
4288
|
-
function findTsconfigFilesWithBaseUrl(projectPath) {
|
|
4289
|
-
return findTsconfigFiles(projectPath).filter((filePath) => hasBaseUrlInTsconfigFile(filePath));
|
|
4290
|
-
}
|
|
4291
|
-
async function confirmBaseUrlFix(interactive) {
|
|
4292
|
-
if (!interactive) return true;
|
|
4293
|
-
const command = [BASEURL_TSCONFIG_FIX_PACKAGE, ...createBaseUrlTsconfigFixArgs("<tsconfig path>")].join(" ");
|
|
4294
|
-
const confirmed = await confirm({
|
|
4295
|
-
message: "Your tsconfig contains `baseUrl`, which prevents enabling type-aware linting.\n " + styleText("gray", "`baseUrl` is deprecated in TypeScript 6.0 and removed in TypeScript 7.0.") + `\n Download and run the external \`${BASEURL_TSCONFIG_FIX_PACKAGE}\` fixer now?\n ` + styleText("gray", `Equivalent command: \`vp dlx ${command}\``),
|
|
4296
|
-
initialValue: true
|
|
4297
|
-
});
|
|
4298
|
-
if (isCancel(confirmed)) cancelAndExit();
|
|
4299
|
-
return confirmed;
|
|
4300
|
-
}
|
|
4301
|
-
async function fixBaseUrlInTsconfig(projectPath, options) {
|
|
4302
|
-
const files = findTsconfigFilesWithBaseUrl(projectPath);
|
|
4303
|
-
if (files.length === 0) return "not-needed";
|
|
4304
|
-
if (!(options?.confirmed ?? await confirmBaseUrlFix(options?.interactive ?? false))) {
|
|
4305
|
-
options?.onStatus?.("declined", projectPath);
|
|
4306
|
-
return "declined";
|
|
4307
|
-
}
|
|
4308
|
-
try {
|
|
4309
|
-
for (const filePath of files) {
|
|
4310
|
-
const fixArgs = createBaseUrlTsconfigFixArgs(path.relative(projectPath, filePath) || filePath);
|
|
4311
|
-
if (!options?.silent) log.info(`Running vp dlx ${BASEURL_TSCONFIG_FIX_PACKAGE} ${fixArgs.join(" ")}`);
|
|
4312
|
-
const result = await runCommandSilently({
|
|
4313
|
-
command: process.env.VP_CLI_BIN ?? "vp",
|
|
4314
|
-
args: [
|
|
4315
|
-
"dlx",
|
|
4316
|
-
BASEURL_TSCONFIG_FIX_PACKAGE,
|
|
4317
|
-
...fixArgs
|
|
4318
|
-
],
|
|
4319
|
-
cwd: projectPath,
|
|
4320
|
-
envs: process.env
|
|
4321
|
-
});
|
|
4322
|
-
if (result.exitCode !== 0) {
|
|
4323
|
-
if (!options?.silent) {
|
|
4324
|
-
const output = `${result.stdout.toString()}${result.stderr.toString()}`.trim();
|
|
4325
|
-
if (output) log.warn(output);
|
|
4326
|
-
}
|
|
4327
|
-
options?.onStatus?.("failed", projectPath);
|
|
4328
|
-
return "failed";
|
|
4329
|
-
}
|
|
4330
|
-
}
|
|
4331
|
-
if (hasBaseUrlInTsconfig(projectPath)) {
|
|
4332
|
-
if (!options?.silent) log.warn("tsconfig still contains baseUrl after running the fixer.");
|
|
4333
|
-
options?.onStatus?.("failed", projectPath);
|
|
4334
|
-
return "failed";
|
|
4335
|
-
}
|
|
4336
|
-
} catch (error) {
|
|
4337
|
-
if (!options?.silent && error instanceof Error) log.warn(error.message);
|
|
4338
|
-
options?.onStatus?.("failed", projectPath);
|
|
4339
|
-
return "failed";
|
|
4340
|
-
}
|
|
4341
|
-
options?.onStatus?.("fixed", projectPath);
|
|
4342
|
-
return "fixed";
|
|
4343
|
-
}
|
|
4344
|
-
function removeDeprecatedTsconfigFalseOption(filePath, optionName) {
|
|
4345
|
-
let text;
|
|
4346
|
-
try {
|
|
4347
|
-
text = fs.readFileSync(filePath, "utf-8");
|
|
4348
|
-
} catch {
|
|
4349
|
-
return false;
|
|
4350
|
-
}
|
|
4351
|
-
if (parse(text)?.compilerOptions?.[optionName] !== false) return false;
|
|
4352
|
-
const edits = modify(text, ["compilerOptions", optionName], void 0, {});
|
|
4353
|
-
if (edits.length === 0) return false;
|
|
4354
|
-
const newText = applyEdits(text, edits);
|
|
4355
|
-
fs.writeFileSync(filePath, newText);
|
|
4356
|
-
return true;
|
|
4357
|
-
}
|
|
4358
|
-
const TSCONFIG_TYPE_REPLACEMENTS = { "tsdown/client": "vite-plus/pack/client" };
|
|
4359
|
-
function hasTypesToRewriteInTsconfig(filePath) {
|
|
4360
|
-
let text;
|
|
4361
|
-
try {
|
|
4362
|
-
text = fs.readFileSync(filePath, "utf-8");
|
|
4363
|
-
} catch {
|
|
4364
|
-
return false;
|
|
4365
|
-
}
|
|
4366
|
-
const types = parse(text)?.compilerOptions?.types;
|
|
4367
|
-
return Array.isArray(types) && types.some((t) => typeof t === "string" && t in TSCONFIG_TYPE_REPLACEMENTS);
|
|
4368
|
-
}
|
|
4369
|
-
function hasVitestTypesInTsconfig(filePath) {
|
|
4370
|
-
let text;
|
|
4371
|
-
try {
|
|
4372
|
-
text = fs.readFileSync(filePath, "utf-8");
|
|
4373
|
-
} catch {
|
|
4374
|
-
return false;
|
|
4375
|
-
}
|
|
4376
|
-
const types = parse(text)?.compilerOptions?.types;
|
|
4377
|
-
return Array.isArray(types) && types.some((type) => typeof type === "string" ? type === "vitest" || type.startsWith("vitest/") : false);
|
|
4378
|
-
}
|
|
4379
|
-
function rewriteTypesInTsconfig(filePath) {
|
|
4380
|
-
let text;
|
|
4381
|
-
try {
|
|
4382
|
-
text = fs.readFileSync(filePath, "utf-8");
|
|
4383
|
-
} catch {
|
|
4384
|
-
return false;
|
|
4385
|
-
}
|
|
4386
|
-
const types = parse(text)?.compilerOptions?.types;
|
|
4387
|
-
if (!Array.isArray(types)) return false;
|
|
4388
|
-
const toReplace = types.map((t, i) => typeof t === "string" && t in TSCONFIG_TYPE_REPLACEMENTS ? {
|
|
4389
|
-
i,
|
|
4390
|
-
newVal: TSCONFIG_TYPE_REPLACEMENTS[t]
|
|
4391
|
-
} : null).filter((x) => x !== null);
|
|
4392
|
-
if (toReplace.length === 0) return false;
|
|
4393
|
-
let currentText = text;
|
|
4394
|
-
for (let j = toReplace.length - 1; j >= 0; j--) {
|
|
4395
|
-
const { i, newVal } = toReplace[j];
|
|
4396
|
-
const edits = modify(currentText, [
|
|
4397
|
-
"compilerOptions",
|
|
4398
|
-
"types",
|
|
4399
|
-
i
|
|
4400
|
-
], newVal, {});
|
|
4401
|
-
if (edits.length > 0) currentText = applyEdits(currentText, edits);
|
|
4402
|
-
}
|
|
4403
|
-
fs.writeFileSync(filePath, currentText);
|
|
4404
|
-
return true;
|
|
4405
|
-
}
|
|
4406
|
-
//#endregion
|
|
4407
|
-
export { intro as A, runCommandSilently as B, resolveApproveBuildTargets as C, require_semver as D, PackageManager as E, spinner as F, text as I, require_picocolors as L, multiselect as M, outro as N, cancel as O, select as P, isCancel as R, detectGatedBuilds as S, DependencyType as T, require_cross_spawn as V, upgradeYarn as _, hasTypesToRewriteInTsconfig as a, scalarString as b, rewriteTypesInTsconfig as c, downloadPackageManager$1 as d, promptGitHooks as f, selectPackageManager as g, runViteInstall as h, hasBaseUrlInTsconfig as i, log as j, confirm as k, cancelAndExit as l, runViteFmt as m, findTsconfigFiles as n, hasVitestTypesInTsconfig as o, resolveGitInit as p, fixBaseUrlInTsconfig as r, removeDeprecatedTsconfigFalseOption as s, confirmBaseUrlFix as t, defaultInteractive as u, editYamlFile as v, getSpinner as w, approveBuilds as x, readYamlFile as y, runCommand$1 as z };
|
|
4265
|
+
export { isCancel as A, log as C, spinner as D, select as E, runCommandSilently as M, require_cross_spawn as N, text as O, intro as S, outro as T, DependencyType as _, resolveGitInit as a, cancel as b, selectPackageManager as c, readYamlFile as d, scalarString as f, getSpinner as g, resolveApproveBuildTargets as h, promptGitHooks as i, runCommand$1 as j, require_picocolors as k, upgradeYarn as l, detectGatedBuilds as m, defaultInteractive as n, runViteFmt as o, approveBuilds as p, downloadPackageManager$1 as r, runViteInstall as s, cancelAndExit as t, editYamlFile as u, PackageManager as v, multiselect as w, confirm as x, require_semver as y };
|