vite-plus 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -0
- package/README.md +9 -3
- package/binding/index.cjs +54 -54
- package/binding/index.d.cts +7 -3
- package/dist/{agent-CI79DuSy.js → agent-DQU8uS6P.js} +4 -188
- package/dist/bin.js +288 -278
- package/dist/config/bin.js +27 -15
- package/dist/{constants-BppDcRc1.js → constants-CG513DRa.js} +10 -2
- package/dist/create/bin.js +178 -204
- package/dist/{define-config-DPnHe1Mx.js → define-config-CV4bQG_8.js} +3 -3
- package/dist/{define-config-CEm_MtvJ.cjs → define-config-DyNLA_f0.cjs} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CSQWHI6y.js → dist-BDYZP12R.js} +193 -149
- package/dist/dist-Dqv1-Clg.js +3 -0
- package/dist/{editor-CGWdbLgD.js → editor-g4PosU99.js} +188 -108
- package/dist/hooks/bin.d.ts +1 -0
- package/dist/hooks/bin.js +130 -0
- package/dist/hooks-pNCBWtFT.js +570 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-BU88uu6o.js → json-qlK6UH0r.js} +38 -32
- package/dist/migration/bin.js +15 -18
- package/dist/{oxlint-plugin-config-BHOzlwMw.js → oxlint-plugin-config-BEZ9IUf7.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-hV-77cBb.js → package-B4T8RGMG.js} +2 -2
- package/dist/{prompts-DYap08te.js → prompts-CHz_98bJ.js} +142 -50
- package/dist/{resolve-vite-config-EWXclqvV.js → resolve-vite-config-Dmeyeyj-.js} +2 -9
- package/dist/staged/bin.js +224 -206
- package/dist/{terminal-CrqqK8WT.js → terminal-Bz-ps6rJ.js} +33 -3
- package/dist/test/browser/providers/playwright/context.d.ts +1 -1
- package/dist/test/browser/providers/playwright.d.ts +6 -6
- package/dist/test/browser/providers/preview/context.d.ts +1 -1
- package/dist/test/browser/providers/preview.d.ts +4 -4
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -1
- package/dist/test/browser/providers/webdriverio.d.ts +6 -6
- package/dist/test/browser-playwright/context.d.ts +1 -1
- package/dist/test/browser-playwright.d.ts +6 -6
- package/dist/test/browser-preview/context.d.ts +1 -1
- package/dist/test/browser-preview.d.ts +4 -4
- package/dist/test/browser-webdriverio/context.d.ts +1 -1
- package/dist/test/browser-webdriverio.d.ts +6 -6
- package/dist/test/context.d.ts +3 -3
- package/dist/test/locators.d.ts +1 -1
- package/dist/toolchain.d.ts +25 -0
- package/dist/toolchain.js +194 -0
- package/dist/toolchain.json +193 -0
- package/dist/{tsconfig-CVUKLfL8.js → tsconfig-7v_BHagU.js} +3 -3
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +4 -4
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +6 -6
- package/docs/guide/ci.md +37 -4
- package/docs/guide/commit-hooks.md +87 -14
- package/docs/guide/create.md +7 -4
- package/docs/guide/fmt.md +2 -2
- package/docs/guide/github-actions-cache.md +5 -1
- package/docs/guide/ide-integration.md +61 -2
- package/docs/guide/index.md +3 -1
- package/docs/guide/install.md +25 -0
- package/docs/guide/installer-env-vars.md +12 -1
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate.md +39 -2
- package/docs/guide/monorepo.md +4 -4
- package/docs/guide/troubleshooting.md +12 -4
- package/docs/guide/upgrade.md +27 -4
- package/docs/package.json +1 -1
- package/docs/pnpm-workspace.yaml +7 -0
- package/docs/vite.config.ts +3 -0
- package/package.json +18 -14
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-DT25H9pj.js +0 -3
- package/dist/{tsgolint-path-eMZT-oea.js → tsgolint-path-CbDReEOx.js} +1 -1
package/dist/migration/bin.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { r as __toESM } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
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,
|
|
5
|
-
import { a as writeJsonFile, i as readJsonFile } from "../json-
|
|
6
|
-
import { i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-
|
|
2
|
+
import { a as muted, c as warnMsg, i as log, l as renderCliDoc, o as printHeader, r as formatDuration, t as accent } from "../terminal-Bz-ps6rJ.js";
|
|
3
|
+
import { f as isForceOverrideMode, u as VITE_PLUS_VERSION } from "../constants-CG513DRa.js";
|
|
4
|
+
import { A as isCancel, C as log$1, D as spinner, E as select, M as runCommandSilently, T as outro, b as require_semver, c as selectPackageManager, i as promptGitHooks, l as upgradeYarn, n as defaultInteractive, o as runViteFmt, r as downloadPackageManager, s as runViteInstall, t as cancelAndExit, x as confirm, y as PackageManager } from "../prompts-CHz_98bJ.js";
|
|
5
|
+
import { a as writeJsonFile, i as readJsonFile } from "../json-qlK6UH0r.js";
|
|
6
|
+
import { i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig, t as confirmBaseUrlFix } from "../tsconfig-7v_BHagU.js";
|
|
7
7
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
8
|
-
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-
|
|
9
|
-
import {
|
|
8
|
+
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-B4T8RGMG.js";
|
|
9
|
+
import { i as selectAgentTargetPaths, l as displayRelative, n as detectAgentConflicts, r as detectExistingAgentTargetPaths, s as writeAgentInstructions } from "../agent-DQU8uS6P.js";
|
|
10
10
|
import { n as addMigrationWarning, r as createMigrationReport } from "../report-BS7ULx7A.js";
|
|
11
|
-
import {
|
|
11
|
+
import { B as warnPackageLevelPrettier, C as mergeViteConfigFiles, D as configureYarnNodeModulesMode, E as ensureVitePlusBootstrap, F as hasFrameworkShim, H as detectEslintProject, I as confirmPrettierMigration, J as warnPackageLevelEslint, K as warnIncompatibleEslintIntegration, L as detectPrettierProject, N as addFrameworkShim, O as detectYarnPnpMode, P as detectFramework, R as migratePrettierToOxfmt, S as injectLintTypeCheckDefaults, T as detectVitePlusBootstrapPending, U as detectIncompatibleEslintIntegration, V as confirmEslintMigration, W as migrateEslintToOxlint, X as checkVitestVersion, Y as checkViteVersion, _ as preflightGitHooksSetup, d as finalizeCoreMigrationForExistingVitePlus, f as detectNodeVersionManagerFile, g as installGitHooks, h as detectLegacyGitHooksMigrationCandidate, i as selectEditor, k as detectWorkspace, l as rewriteStandaloneProject, o as writeEditorConfigs, p as migrateNodeVersionManagerFile, q as warnLegacyEslintConfig, r as isJsonLikeFile, s as rewriteMonorepo, t as detectEditorConflicts, u as detectPendingCoreMigration, v as shouldSkipStagedMigrationForHooks, w as collectToolchainVersionChanges } from "../editor-g4PosU99.js";
|
|
12
12
|
import { t as ROLLDOWN_COMPAT_RESULT_PREFIX } from "../protocol-D99W10Qi.js";
|
|
13
13
|
import path from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
14
15
|
import { styleText } from "node:util";
|
|
15
16
|
import fs, { existsSync } from "node:fs";
|
|
16
|
-
import { fileURLToPath } from "node:url";
|
|
17
17
|
//#region src/migration/compat/runner.ts
|
|
18
18
|
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
19
19
|
/**
|
|
@@ -362,7 +362,7 @@ async function collectEditorConfigPlan(rootDir, options) {
|
|
|
362
362
|
});
|
|
363
363
|
if (isCancel(action)) cancelAndExit();
|
|
364
364
|
editorConflictDecisions.set(conflict.fileName, action);
|
|
365
|
-
} else editorConflictDecisions.set(conflict.fileName, "merge");
|
|
365
|
+
} else editorConflictDecisions.set(conflict.fileName, isJsonLikeFile(conflict.fileName) ? "merge" : "skip");
|
|
366
366
|
return {
|
|
367
367
|
selectedEditor,
|
|
368
368
|
editorConflictDecisions
|
|
@@ -696,12 +696,6 @@ async function collectMigrationPlan(rootDir, detectedPackageManager, detectedPac
|
|
|
696
696
|
frameworkShimFrameworks
|
|
697
697
|
};
|
|
698
698
|
}
|
|
699
|
-
function formatDuration(durationMs) {
|
|
700
|
-
if (durationMs < 1e3) return `${Math.max(1, durationMs)}ms`;
|
|
701
|
-
const durationSeconds = durationMs / 1e3;
|
|
702
|
-
if (durationSeconds < 10) return `${durationSeconds.toFixed(1)}s`;
|
|
703
|
-
return `${Math.round(durationSeconds)}s`;
|
|
704
|
-
}
|
|
705
699
|
/**
|
|
706
700
|
* Reconcile a CommandRunSummary from `runViteInstall` with the migration's
|
|
707
701
|
* duration counter and exit-code state. `runViteInstall` returns
|
|
@@ -888,7 +882,8 @@ async function executeMigrationPlan(workspaceInfoOptional, plan, interactive, pr
|
|
|
888
882
|
editorId: plan.selectedEditor,
|
|
889
883
|
interactive,
|
|
890
884
|
conflictDecisions: plan.editorConflictDecisions,
|
|
891
|
-
silent: true
|
|
885
|
+
silent: true,
|
|
886
|
+
packageManager: plan.packageManager
|
|
892
887
|
});
|
|
893
888
|
addFrameworkShimsForWorkspace(workspaceInfo.rootDir, plan.frameworkShimFrameworks, workspaceInfo.packages, report, updateMigrationProgress);
|
|
894
889
|
const installArgs = plan.packageManager === PackageManager.npm || plan.packageManager === PackageManager.bun ? ["--force"] : ["--no-frozen-lockfile"];
|
|
@@ -921,6 +916,7 @@ async function main() {
|
|
|
921
916
|
}
|
|
922
917
|
printHeader();
|
|
923
918
|
const workspaceInfoOptional = await detectWorkspace(projectPath);
|
|
919
|
+
if (workspaceInfoOptional.isMonorepo && path.resolve(projectPath) !== path.resolve(workspaceInfoOptional.rootDir)) cancelAndExit(`Vite+ cannot migrate a workspace member. Run \`vp migrate\` from the workspace root at ${workspaceInfoOptional.rootDir}.`, 1);
|
|
924
920
|
const initialChangedPaths = await collectChangedFormatPaths(workspaceInfoOptional.rootDir);
|
|
925
921
|
const preExistingChangedPaths = initialChangedPaths ? new Set(initialChangedPaths) : void 0;
|
|
926
922
|
const resolvedPackageManager = workspaceInfoOptional.packageManager ?? "unknown";
|
|
@@ -1122,7 +1118,8 @@ async function main() {
|
|
|
1122
1118
|
editorId: plan.selectedEditor,
|
|
1123
1119
|
interactive: options.interactive,
|
|
1124
1120
|
conflictDecisions: plan.editorConflictDecisions,
|
|
1125
|
-
silent: true
|
|
1121
|
+
silent: true,
|
|
1122
|
+
packageManager
|
|
1126
1123
|
});
|
|
1127
1124
|
didMigrate = true;
|
|
1128
1125
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as VITE_PLUS_NAME } from "./constants-CG513DRa.js";
|
|
2
2
|
//#region src/oxlint-plugin-config.ts
|
|
3
3
|
const VITE_PLUS_OXLINT_PLUGIN_NAME = VITE_PLUS_NAME;
|
|
4
4
|
const VITE_PLUS_OXLINT_PLUGIN_SPECIFIER = `${VITE_PLUS_NAME}/oxlint-plugin`;
|
package/dist/oxlint-plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-
|
|
1
|
+
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-BEZ9IUf7.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { definePlugin, defineRule } from "@oxlint/plugins";
|
package/dist/pack-bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as resolveViteConfig } from "./resolve-vite-config-
|
|
2
|
+
import { a as resolveViteConfig } from "./resolve-vite-config-Dmeyeyj-.js";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { buildWithConfigs, enableDebug, globalLogger, resolveUserConfig } from "@voidzero-dev/vite-plus-core/pack";
|
|
5
5
|
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./constants-
|
|
2
|
-
import { i as readJsonFile } from "./json-
|
|
1
|
+
import "./constants-CG513DRa.js";
|
|
2
|
+
import { i as readJsonFile } from "./json-qlK6UH0r.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
|
|
2
|
-
import { t as accent } from "./terminal-
|
|
3
|
-
import {
|
|
4
|
-
import { a as writeJsonFile, i as readJsonFile } from "./json-
|
|
5
|
-
import { t as require_dist } from "./dist-
|
|
2
|
+
import { t as accent } from "./terminal-Bz-ps6rJ.js";
|
|
3
|
+
import { u as VITE_PLUS_VERSION } from "./constants-CG513DRa.js";
|
|
4
|
+
import { a as writeJsonFile, i as readJsonFile } from "./json-qlK6UH0r.js";
|
|
5
|
+
import { t as require_dist } from "./dist-BDYZP12R.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { downloadPackageManager } from "../binding/index.js";
|
|
8
8
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
@@ -157,8 +157,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
157
157
|
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
158
158
|
const ext = pathExt[ii];
|
|
159
159
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
160
|
-
if (!er && is)
|
|
161
|
-
|
|
160
|
+
if (!er && is) {
|
|
161
|
+
if (opt.all) found.push(p + ext);
|
|
162
|
+
else return resolve(p + ext);
|
|
163
|
+
}
|
|
162
164
|
return resolve(subStep(p, i, ii + 1));
|
|
163
165
|
});
|
|
164
166
|
});
|
|
@@ -176,8 +178,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
176
178
|
for (let j = 0; j < pathExt.length; j++) {
|
|
177
179
|
const cur = p + pathExt[j];
|
|
178
180
|
try {
|
|
179
|
-
if (isexe.sync(cur, { pathExt: pathExtExe }))
|
|
180
|
-
|
|
181
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
182
|
+
if (opt.all) found.push(cur);
|
|
183
|
+
else return cur;
|
|
184
|
+
}
|
|
181
185
|
} catch (ex) {}
|
|
182
186
|
}
|
|
183
187
|
}
|
|
@@ -1686,7 +1690,7 @@ const limitOptions = (params) => {
|
|
|
1686
1690
|
};
|
|
1687
1691
|
/**
|
|
1688
1692
|
* Render-milestone markers for the PTY snapshot suite
|
|
1689
|
-
* (crates/
|
|
1693
|
+
* (crates/vp_cli_snapshots): invisible window-title updates the runner
|
|
1690
1694
|
* synchronizes on via `expect-milestone` interactions. Emission is gated on
|
|
1691
1695
|
* `VP_EMIT_MILESTONES=1`, which only the runner sets; real terminals and
|
|
1692
1696
|
* piped output never see these markers as content (they only update the
|
|
@@ -2027,8 +2031,10 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
2027
2031
|
const elapsedMs = getElapsedMs();
|
|
2028
2032
|
const step = code === 0 ? completeColor(S_STEP_SUBMIT) : code === 1 ? import_picocolors.default.red(S_STEP_CANCEL) : import_picocolors.default.red(S_STEP_ERROR);
|
|
2029
2033
|
_message = msg ?? _message;
|
|
2030
|
-
if (!silent)
|
|
2031
|
-
|
|
2034
|
+
if (!silent) {
|
|
2035
|
+
if (indicator === "timer") output.write(`${step} ${_message} ${formatTimer(elapsedMs)}\n\n`);
|
|
2036
|
+
else output.write(`${step} ${_message}\n\n`);
|
|
2037
|
+
}
|
|
2032
2038
|
if (!preserveElapsed) _elapsedMs = 0;
|
|
2033
2039
|
_prevMessage = void 0;
|
|
2034
2040
|
clearHooks();
|
|
@@ -2323,9 +2329,10 @@ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2323
2329
|
module.exports = class SemVer {
|
|
2324
2330
|
constructor(version, options) {
|
|
2325
2331
|
options = parseOptions(options);
|
|
2326
|
-
if (version instanceof SemVer)
|
|
2327
|
-
|
|
2328
|
-
|
|
2332
|
+
if (version instanceof SemVer) {
|
|
2333
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
2334
|
+
else version = version.version;
|
|
2335
|
+
} else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
2329
2336
|
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
2330
2337
|
debug("SemVer", version, options);
|
|
2331
2338
|
this.options = options;
|
|
@@ -2827,8 +2834,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2827
2834
|
module.exports = class Range {
|
|
2828
2835
|
constructor(range, options) {
|
|
2829
2836
|
options = parseOptions(options);
|
|
2830
|
-
if (range instanceof Range)
|
|
2831
|
-
|
|
2837
|
+
if (range instanceof Range) {
|
|
2838
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
2839
|
+
else return new Range(range.raw, options);
|
|
2840
|
+
}
|
|
2832
2841
|
if (range instanceof Comparator) {
|
|
2833
2842
|
this.raw = range.value;
|
|
2834
2843
|
this.set = [[range]];
|
|
@@ -2998,18 +3007,21 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2998
3007
|
let ret;
|
|
2999
3008
|
if (isX(M)) ret = "";
|
|
3000
3009
|
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
3001
|
-
else if (isX(p))
|
|
3002
|
-
|
|
3003
|
-
|
|
3010
|
+
else if (isX(p)) {
|
|
3011
|
+
if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
3012
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
3013
|
+
} else if (pr) {
|
|
3004
3014
|
debug("replaceCaret pr", pr);
|
|
3005
|
-
if (M === "0")
|
|
3006
|
-
|
|
3007
|
-
|
|
3015
|
+
if (M === "0") {
|
|
3016
|
+
if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
3017
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
3018
|
+
} else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
3008
3019
|
} else {
|
|
3009
3020
|
debug("no pr");
|
|
3010
|
-
if (M === "0")
|
|
3011
|
-
|
|
3012
|
-
|
|
3021
|
+
if (M === "0") {
|
|
3022
|
+
if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
3023
|
+
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
3024
|
+
} else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
3013
3025
|
}
|
|
3014
3026
|
debug("caret return", ret);
|
|
3015
3027
|
return ret;
|
|
@@ -3031,9 +3043,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3031
3043
|
const anyX = xp;
|
|
3032
3044
|
if (gtlt === "=" && anyX) gtlt = "";
|
|
3033
3045
|
pr = options.includePrerelease ? "-0" : "";
|
|
3034
|
-
if (xM)
|
|
3035
|
-
|
|
3036
|
-
|
|
3046
|
+
if (xM) {
|
|
3047
|
+
if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
3048
|
+
else ret = "*";
|
|
3049
|
+
} else if (gtlt && anyX) {
|
|
3037
3050
|
if (xm) m = 0;
|
|
3038
3051
|
p = 0;
|
|
3039
3052
|
if (gtlt === ">") {
|
|
@@ -3107,8 +3120,10 @@ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3107
3120
|
}
|
|
3108
3121
|
constructor(comp, options) {
|
|
3109
3122
|
options = parseOptions(options);
|
|
3110
|
-
if (comp instanceof Comparator)
|
|
3111
|
-
|
|
3123
|
+
if (comp instanceof Comparator) {
|
|
3124
|
+
if (comp.loose === !!options.loose) return comp;
|
|
3125
|
+
else comp = comp.value;
|
|
3126
|
+
}
|
|
3112
3127
|
comp = comp.trim().split(/\s+/).join(" ");
|
|
3113
3128
|
debug("comparator", comp, options);
|
|
3114
3129
|
this.options = options;
|
|
@@ -3428,11 +3443,15 @@ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3428
3443
|
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
3429
3444
|
const simpleSubset = (sub, dom, options) => {
|
|
3430
3445
|
if (sub === dom) return true;
|
|
3431
|
-
if (sub.length === 1 && sub[0].semver === ANY)
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3446
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
3447
|
+
if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
3448
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
3449
|
+
else sub = minimumVersion;
|
|
3450
|
+
}
|
|
3451
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
3452
|
+
if (options.includePrerelease) return true;
|
|
3453
|
+
else dom = minimumVersion;
|
|
3454
|
+
}
|
|
3436
3455
|
const eqSet = /* @__PURE__ */ new Set();
|
|
3437
3456
|
let gt, lt;
|
|
3438
3457
|
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
@@ -3676,6 +3695,42 @@ function parseBunUntrusted(output) {
|
|
|
3676
3695
|
return match ? match[1] : null;
|
|
3677
3696
|
});
|
|
3678
3697
|
}
|
|
3698
|
+
/**
|
|
3699
|
+
* npm >= 12 skips dependency install scripts that the `allowScripts` allowlist
|
|
3700
|
+
* in package.json does not cover, and reports them on stderr:
|
|
3701
|
+
*
|
|
3702
|
+
* ```
|
|
3703
|
+
* npm warn install-scripts 2 packages had install scripts blocked because they are not covered by allowScripts:
|
|
3704
|
+
* npm warn install-scripts core-js@3.49.0 (postinstall: node -e "try{require('./postinstall')}catch(e){}")
|
|
3705
|
+
* npm warn install-scripts esbuild@0.28.1 (postinstall: node install.js)
|
|
3706
|
+
* ```
|
|
3707
|
+
*
|
|
3708
|
+
* npm 11.16 - 11.x print a similar warning ("install scripts not yet covered by
|
|
3709
|
+
* allowScripts") but still run the scripts, so only the npm 12 "blocked" wording
|
|
3710
|
+
* is parsed.
|
|
3711
|
+
*/
|
|
3712
|
+
const NPM_BLOCKED_SCRIPTS_MARKER = "install scripts blocked because they are not covered by allowScripts";
|
|
3713
|
+
/**
|
|
3714
|
+
* A blocked-package entry line: `npm warn install-scripts <spec> (<lifecycle>:
|
|
3715
|
+
* <command>)`. Anchoring on the lifecycle name keeps the count line ("2 packages
|
|
3716
|
+
* had install scripts blocked ...") and the trailing hint line from matching.
|
|
3717
|
+
*/
|
|
3718
|
+
const NPM_BLOCKED_ENTRY = /^npm warn install-scripts\s+(\S+) \((?:pre|post)?install:/u;
|
|
3719
|
+
/**
|
|
3720
|
+
* Parse the package names npm >= 12 reports as having blocked install scripts
|
|
3721
|
+
* from captured `npm install` / `npm ci` output. Strips version suffixes and
|
|
3722
|
+
* dedupes while preserving first-seen order. Returns `[]` when the warning is
|
|
3723
|
+
* absent (including the npm 11.x advisory variant, where scripts still run).
|
|
3724
|
+
*/
|
|
3725
|
+
function parseNpmBlockedScripts(output) {
|
|
3726
|
+
if (!output) return [];
|
|
3727
|
+
const clean = stripVTControlCharacters(output);
|
|
3728
|
+
if (!clean.includes(NPM_BLOCKED_SCRIPTS_MARKER)) return [];
|
|
3729
|
+
return dedupeNames(clean.split("\n"), (rawLine) => {
|
|
3730
|
+
const match = rawLine.trim().match(NPM_BLOCKED_ENTRY);
|
|
3731
|
+
return match ? stripPackageVersion(match[1]) : null;
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3679
3734
|
const YARN_DISABLED_BUILDS_MARKER = "lists build scripts, but all build scripts have been disabled";
|
|
3680
3735
|
/**
|
|
3681
3736
|
* Yarn (Berry) gates build scripts when `enableScripts` is false: each gated
|
|
@@ -3704,12 +3759,14 @@ function yarnDescriptorName(descriptor) {
|
|
|
3704
3759
|
/**
|
|
3705
3760
|
* Parse the gated build-script package names from an install log, dispatching on
|
|
3706
3761
|
* the package manager: pnpm prints `Ignored build scripts:`, yarn prints
|
|
3707
|
-
* `... build scripts have been disabled
|
|
3708
|
-
*
|
|
3762
|
+
* `... build scripts have been disabled`, npm >= 12 prints `... install scripts
|
|
3763
|
+
* blocked ...`. bun is not parsed here (its blocked packages are queried
|
|
3764
|
+
* separately via `bun pm untrusted`).
|
|
3709
3765
|
*/
|
|
3710
3766
|
function parseInstallGatedBuilds(output, packageManager) {
|
|
3711
3767
|
if (packageManager === PackageManager.pnpm) return parseIgnoredBuilds(output);
|
|
3712
3768
|
if (packageManager === PackageManager.yarn) return parseYarnDisabledBuilds(output);
|
|
3769
|
+
if (packageManager === PackageManager.npm) return parseNpmBlockedScripts(output);
|
|
3713
3770
|
return [];
|
|
3714
3771
|
}
|
|
3715
3772
|
/**
|
|
@@ -3754,14 +3811,15 @@ function pnpmSupportsPositionalApprove(version) {
|
|
|
3754
3811
|
const GATED_BUILD_PACKAGE_MANAGERS = /* @__PURE__ */ new Set([
|
|
3755
3812
|
PackageManager.pnpm,
|
|
3756
3813
|
PackageManager.bun,
|
|
3757
|
-
PackageManager.yarn
|
|
3814
|
+
PackageManager.yarn,
|
|
3815
|
+
PackageManager.npm
|
|
3758
3816
|
]);
|
|
3759
3817
|
/**
|
|
3760
3818
|
* Narrow a package manager's gated builds down to the ones worth surfacing
|
|
3761
3819
|
* during `vp create`: packages the generated project depends on directly.
|
|
3762
3820
|
* Transitive gated builds (e.g. `esbuild` pulled in by Vite) are noise the user
|
|
3763
3821
|
* did not choose, so they are dropped. Returns `[]` for package managers that
|
|
3764
|
-
* do not gate build scripts (npm, yarn classic), since there is nothing to
|
|
3822
|
+
* do not gate build scripts (npm < 12, yarn classic), since there is nothing to
|
|
3765
3823
|
* approve.
|
|
3766
3824
|
*/
|
|
3767
3825
|
function resolveApproveBuildTargets(projectDir, pendingBuilds, packageManager) {
|
|
@@ -3779,15 +3837,15 @@ function resolveApproveBuildTargets(projectDir, pendingBuilds, packageManager) {
|
|
|
3779
3837
|
* Enumerate the packages whose build scripts a package manager gated during the
|
|
3780
3838
|
* install, as raw names (still unfiltered by direct dependency).
|
|
3781
3839
|
*
|
|
3782
|
-
* - pnpm and
|
|
3783
|
-
* there (see {@link parseInstallGatedBuilds}) and passed in via
|
|
3840
|
+
* - pnpm, yarn, and npm >= 12 report them in their install output, so the names
|
|
3841
|
+
* are parsed there (see {@link parseInstallGatedBuilds}) and passed in via
|
|
3784
3842
|
* `pendingBuildsFromInstall`.
|
|
3785
3843
|
* - bun exits 0 and only prints a count, so `bun pm untrusted` is queried here.
|
|
3786
3844
|
*
|
|
3787
3845
|
* Other package managers run build scripts by default and return `[]`.
|
|
3788
3846
|
*/
|
|
3789
3847
|
async function detectGatedBuilds(installCwd, packageManager, pendingBuildsFromInstall) {
|
|
3790
|
-
if (packageManager === PackageManager.pnpm || packageManager === PackageManager.yarn) return pendingBuildsFromInstall ?? [];
|
|
3848
|
+
if (packageManager === PackageManager.pnpm || packageManager === PackageManager.yarn || packageManager === PackageManager.npm) return pendingBuildsFromInstall ?? [];
|
|
3791
3849
|
if (packageManager === PackageManager.bun) {
|
|
3792
3850
|
const { exitCode, stdout, stderr } = await runCommandSilently({
|
|
3793
3851
|
command: process.env.VP_CLI_BIN ?? "vp",
|
|
@@ -3814,16 +3872,17 @@ function printApproveBuildsGuidance(targets, packageManager) {
|
|
|
3814
3872
|
log.info(`These dependencies may not work until built. Enable them in the workspace root package.json (${accent("dependenciesMeta.<pkg>.built: true")}) and reinstall, or re-create with ${accent("--approve-builds")}.`);
|
|
3815
3873
|
return;
|
|
3816
3874
|
}
|
|
3817
|
-
const command = packageManager === PackageManager.bun ? `vp pm approve-builds ${targets.join(" ")}` : "vp pm approve-builds";
|
|
3875
|
+
const command = packageManager === PackageManager.bun || packageManager === PackageManager.npm ? `vp pm approve-builds ${targets.join(" ")}` : "vp pm approve-builds";
|
|
3818
3876
|
log.info(`These dependencies may not work until built. Run ${accent(command)} in the project to approve them, or re-create with ${accent("--approve-builds")}.`);
|
|
3819
3877
|
}
|
|
3820
3878
|
/**
|
|
3821
3879
|
* Run a `vp` build/approval command and report the outcome through a spinner.
|
|
3822
|
-
* On failure the approval has still been recorded (pnpm/bun config or
|
|
3823
|
-
* `dependenciesMeta`), so the retry hint points back at `
|
|
3880
|
+
* On failure the approval has still been recorded (pnpm/bun/npm config or
|
|
3881
|
+
* yarn's `dependenciesMeta`), so the retry hint points back at `retryCommand`
|
|
3882
|
+
* (`vp install` unless the package manager needs an explicit rebuild). Returns
|
|
3824
3883
|
* `true` when the command succeeded, `false` when the build exited non-zero.
|
|
3825
3884
|
*/
|
|
3826
|
-
async function runBuildAndReport(args, cwd, packages, interactive, silent, extraEnv) {
|
|
3885
|
+
async function runBuildAndReport(args, cwd, packages, interactive, silent, extraEnv, retryCommand = "vp install") {
|
|
3827
3886
|
const spinner = silent ? getSilentSpinner() : getSpinner(interactive);
|
|
3828
3887
|
spinner.start(`Building ${packages.join(", ")}...`);
|
|
3829
3888
|
const { exitCode, stdout, stderr } = await runCommandSilently({
|
|
@@ -3842,10 +3901,42 @@ async function runBuildAndReport(args, cwd, packages, interactive, silent, extra
|
|
|
3842
3901
|
spinner.stop(`Build failed for ${packages.join(", ")}`);
|
|
3843
3902
|
const output = `${stdout.toString()}\n${stderr.toString()}`.trim();
|
|
3844
3903
|
if (output) log.info(lastLines(output, 20));
|
|
3845
|
-
log.warn(`Build scripts failed for ${accent(packages.join(", "))}. They were approved; fix the build toolchain and run ${accent(
|
|
3904
|
+
log.warn(`Build scripts failed for ${accent(packages.join(", "))}. They were approved; fix the build toolchain and run ${accent(retryCommand)} to retry.`);
|
|
3846
3905
|
return false;
|
|
3847
3906
|
}
|
|
3848
3907
|
/**
|
|
3908
|
+
* Approve gated install scripts for npm >= 12, then run them. npm's approval
|
|
3909
|
+
* (`npm approve-scripts`, via `vp pm approve-builds`) only records the
|
|
3910
|
+
* `allowScripts` allowlist in package.json: scripts the install already skipped
|
|
3911
|
+
* do not run on approval, and a plain reinstall short-circuits on the
|
|
3912
|
+
* up-to-date tree without running them either. `npm rebuild` is what executes
|
|
3913
|
+
* the newly approved scripts, so approval and rebuild are two steps.
|
|
3914
|
+
*/
|
|
3915
|
+
async function approveNpmScripts(installCwd, packages, interactive, silent) {
|
|
3916
|
+
const approveCommand = `vp pm approve-builds ${packages.join(" ")}`;
|
|
3917
|
+
const { exitCode, stdout, stderr } = await runCommandSilently({
|
|
3918
|
+
command: process.env.VP_CLI_BIN ?? "vp",
|
|
3919
|
+
args: [
|
|
3920
|
+
"pm",
|
|
3921
|
+
"approve-builds",
|
|
3922
|
+
...packages
|
|
3923
|
+
],
|
|
3924
|
+
cwd: installCwd,
|
|
3925
|
+
envs: process.env
|
|
3926
|
+
});
|
|
3927
|
+
if (exitCode !== 0) {
|
|
3928
|
+
const output = `${stdout.toString()}\n${stderr.toString()}`.trim();
|
|
3929
|
+
if (output) log.info(lastLines(output, 20));
|
|
3930
|
+
log.warn(`Approving build scripts failed for ${accent(packages.join(", "))}. Run ${accent(approveCommand)} in the project to retry.`);
|
|
3931
|
+
return false;
|
|
3932
|
+
}
|
|
3933
|
+
return runBuildAndReport([
|
|
3934
|
+
"pm",
|
|
3935
|
+
"rebuild",
|
|
3936
|
+
...packages
|
|
3937
|
+
], installCwd, packages, interactive, silent, void 0, `vp pm rebuild ${packages.join(" ")}`);
|
|
3938
|
+
}
|
|
3939
|
+
/**
|
|
3849
3940
|
* Mark each package as build-allowed in yarn's `dependenciesMeta[<pkg>].built`,
|
|
3850
3941
|
* preserving existing metadata. Guards against a non-object container or
|
|
3851
3942
|
* per-package value so a hand-authored scalar doesn't corrupt package.json.
|
|
@@ -3886,8 +3977,8 @@ async function approveYarnBuilds(installCwd, packages, interactive, silent) {
|
|
|
3886
3977
|
return runBuildAndReport(["install"], installCwd, packages, interactive, silent, { YARN_ENABLE_IMMUTABLE_INSTALLS: "false" });
|
|
3887
3978
|
}
|
|
3888
3979
|
/**
|
|
3889
|
-
* Surface
|
|
3890
|
-
* user act on them:
|
|
3980
|
+
* Surface the package manager's gated build scripts after a `vp create` install
|
|
3981
|
+
* and let the user act on them:
|
|
3891
3982
|
* - `--approve-builds`: approve + build every target, no prompt.
|
|
3892
3983
|
* - interactive: a default-off multiselect so each package is approved
|
|
3893
3984
|
* individually (pnpm gates them for security, so nothing is opt-in by
|
|
@@ -3920,6 +4011,7 @@ async function approveBuilds(options) {
|
|
|
3920
4011
|
return true;
|
|
3921
4012
|
}
|
|
3922
4013
|
if (packageManager === PackageManager.yarn) return approveYarnBuilds(cwd, selected, interactive, silent);
|
|
4014
|
+
if (packageManager === PackageManager.npm) return approveNpmScripts(cwd, selected, interactive, silent);
|
|
3923
4015
|
if (packageManager === PackageManager.pnpm && !pnpmSupportsPositionalApprove(packageManagerVersion)) {
|
|
3924
4016
|
printApproveBuildsGuidance(selected, packageManager);
|
|
3925
4017
|
return !(autoApprove && !interactive);
|
|
@@ -4262,4 +4354,4 @@ function defaultInteractive() {
|
|
|
4262
4354
|
return !process.env.CI && process.stdin.isTTY;
|
|
4263
4355
|
}
|
|
4264
4356
|
//#endregion
|
|
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,
|
|
4357
|
+
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, getSpinner as _, resolveGitInit as a, require_semver as b, selectPackageManager as c, readYamlFile as d, scalarString as f, getSilentSpinner 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, DependencyType as v, multiselect as w, confirm as x, PackageManager as y };
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as VITE_CONFIG_FILES } from "./constants-CG513DRa.js";
|
|
2
|
+
import { u as withConfigMetadataResolution } from "./define-config-CV4bQG_8.js";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import fs from "node:fs";
|
|
4
5
|
//#region src/resolve-vite-config.ts
|
|
5
|
-
const VITE_CONFIG_FILES = [
|
|
6
|
-
"vite.config.js",
|
|
7
|
-
"vite.config.mjs",
|
|
8
|
-
"vite.config.ts",
|
|
9
|
-
"vite.config.cjs",
|
|
10
|
-
"vite.config.mts",
|
|
11
|
-
"vite.config.cts"
|
|
12
|
-
];
|
|
13
6
|
/**
|
|
14
7
|
* Find a vite config file by walking up from `startDir` to `stopDir`.
|
|
15
8
|
* Returns the absolute path of the first config file found, or undefined.
|