vite-plus 0.2.8 → 0.3.0
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 +13 -6
- package/binding/index.cjs +57 -54
- package/binding/index.d.cts +100 -3
- package/dist/{agent-CI79DuSy.js → agent-Wqx0MPk0.js} +4 -188
- package/dist/bin.js +298 -278
- package/dist/command-CLJK5jGW.js +2 -0
- package/dist/command-CguLh2KL.js +471 -0
- package/dist/config/bin.js +29 -15
- package/dist/{constants-BppDcRc1.js → constants-Bn-U8o4v.js} +13 -3
- package/dist/create/bin.js +197 -247
- package/dist/{define-config-DPnHe1Mx.js → define-config-GXUdVT-0.js} +3 -3
- package/dist/{define-config-CEm_MtvJ.cjs → define-config-WiVlryJ2.cjs} +2 -2
- 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-CC4DqODz.js} +736 -153
- package/dist/{terminal-CrqqK8WT.js → help-BmKpeOP9.js} +27 -34
- package/dist/hooks/bin.d.ts +1 -0
- package/dist/hooks/bin.js +131 -0
- package/dist/hooks-DFqViZqZ.js +573 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-BU88uu6o.js → json-cULBl7Pi.js} +145 -139
- package/dist/migration/bin.js +67 -21
- package/dist/migration/compat/worker.js +1 -1
- package/dist/{oxlint-plugin-config-BHOzlwMw.js → oxlint-plugin-config-DX5ezKbB.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +5 -4
- package/dist/{package-hV-77cBb.js → package-CBe9EWPY.js} +2 -2
- package/dist/{prompts-DYap08te.js → prompts-DF3yU-eU.js} +136 -512
- package/dist/{report-BS7ULx7A.js → report-ZNR1Mk6h.js} +1 -0
- package/dist/{resolve-vite-config-EWXclqvV.js → resolve-vite-config-ipGb39Jo.js} +2 -9
- package/dist/staged/bin.js +299 -251
- package/dist/terminal-MKGAuy-p.js +39 -0
- package/dist/test/browser/providers/playwright/context.d.ts +1 -1
- package/dist/test/browser/providers/playwright.d.ts +6 -6
- package/dist/test/browser/providers/preview/context.d.ts +1 -1
- package/dist/test/browser/providers/preview.d.ts +4 -4
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -1
- package/dist/test/browser/providers/webdriverio.d.ts +6 -6
- package/dist/test/browser-playwright/context.d.ts +1 -1
- package/dist/test/browser-playwright.d.ts +6 -6
- package/dist/test/browser-preview/context.d.ts +1 -1
- package/dist/test/browser-preview.d.ts +4 -4
- package/dist/test/browser-webdriverio/context.d.ts +1 -1
- package/dist/test/browser-webdriverio.d.ts +6 -6
- package/dist/test/context.d.ts +3 -3
- package/dist/test/locators.d.ts +1 -1
- package/dist/toolchain.d.ts +25 -0
- package/dist/toolchain.js +194 -0
- package/dist/toolchain.json +193 -0
- package/dist/tsconfig-BVHG3DpR.js +2 -0
- package/dist/{tsconfig-CVUKLfL8.js → tsconfig-LD2QhQ0O.js} +5 -4
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +5 -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/env.md +20 -6
- 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 +27 -1
- package/docs/guide/installer-env-vars.md +53 -6
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate-rules.md +9 -0
- package/docs/guide/migrate.md +41 -4
- package/docs/guide/monorepo.md +4 -4
- package/docs/guide/test.md +8 -0
- package/docs/guide/troubleshooting.md +12 -4
- package/docs/guide/upgrade.md +75 -5
- package/package.json +36 -33
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-DT25H9pj.js +0 -3
- package/docs/_data/team.ts +0 -131
- package/docs/package.json +0 -30
- package/docs/pnpm-lock.yaml +0 -4003
- package/docs/pnpm-workspace.yaml +0 -6
- package/docs/public/checkmark.svg +0 -1
- package/docs/public/cta-background.jpg +0 -0
- package/docs/public/favicon.svg +0 -1
- package/docs/public/icon.svg +0 -1
- package/docs/public/logo.svg +0 -1
- package/docs/public/og.jpg +0 -0
- package/docs/vite.config.ts +0 -17
- package/dist/{log-update-CoW8Z4Dl.js → log-update-DHZRyJ2m.js} +1 -1
- package/dist/{tsgolint-path-eMZT-oea.js → tsgolint-path-CbDReEOx.js} +1 -1
|
@@ -1,482 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as accent } from "./terminal-
|
|
3
|
-
import {
|
|
4
|
-
import { a as writeJsonFile, i as readJsonFile } from "./json-
|
|
5
|
-
import {
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
|
|
2
|
+
import { t as accent } from "./terminal-MKGAuy-p.js";
|
|
3
|
+
import { f as VITE_PLUS_VERSION } from "./constants-Bn-U8o4v.js";
|
|
4
|
+
import { a as writeJsonFile, i as readJsonFile } from "./json-cULBl7Pi.js";
|
|
5
|
+
import { n as runCommandSilently } from "./command-CguLh2KL.js";
|
|
6
|
+
import { t as require_dist } from "./dist-BDYZP12R.js";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { downloadPackageManager } from "../binding/index.js";
|
|
8
9
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
9
10
|
import fs from "node:fs";
|
|
10
|
-
import { constants as constants$1 } from "node:os";
|
|
11
11
|
import process$1, { stdin, stdout } from "node:process";
|
|
12
12
|
import * as l from "node:readline";
|
|
13
13
|
import l__default from "node:readline";
|
|
14
14
|
import { ReadStream } from "node:tty";
|
|
15
15
|
import { randomBytes } from "node:crypto";
|
|
16
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
17
|
-
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
18
|
-
module.exports = isexe;
|
|
19
|
-
isexe.sync = sync;
|
|
20
|
-
var fs$3 = __require("fs");
|
|
21
|
-
function checkPathExt(path, options) {
|
|
22
|
-
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
23
|
-
if (!pathext) return true;
|
|
24
|
-
pathext = pathext.split(";");
|
|
25
|
-
if (pathext.indexOf("") !== -1) return true;
|
|
26
|
-
for (var i = 0; i < pathext.length; i++) {
|
|
27
|
-
var p = pathext[i].toLowerCase();
|
|
28
|
-
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
function checkStat(stat, path, options) {
|
|
33
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
34
|
-
return checkPathExt(path, options);
|
|
35
|
-
}
|
|
36
|
-
function isexe(path, options, cb) {
|
|
37
|
-
fs$3.stat(path, function(er, stat) {
|
|
38
|
-
cb(er, er ? false : checkStat(stat, path, options));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function sync(path, options) {
|
|
42
|
-
return checkStat(fs$3.statSync(path), path, options);
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
47
|
-
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
48
|
-
module.exports = isexe;
|
|
49
|
-
isexe.sync = sync;
|
|
50
|
-
var fs$2 = __require("fs");
|
|
51
|
-
function isexe(path, options, cb) {
|
|
52
|
-
fs$2.stat(path, function(er, stat) {
|
|
53
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function sync(path, options) {
|
|
57
|
-
return checkStat(fs$2.statSync(path), options);
|
|
58
|
-
}
|
|
59
|
-
function checkStat(stat, options) {
|
|
60
|
-
return stat.isFile() && checkMode(stat, options);
|
|
61
|
-
}
|
|
62
|
-
function checkMode(stat, options) {
|
|
63
|
-
var mod = stat.mode;
|
|
64
|
-
var uid = stat.uid;
|
|
65
|
-
var gid = stat.gid;
|
|
66
|
-
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
67
|
-
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
68
|
-
var u = parseInt("100", 8);
|
|
69
|
-
var g = parseInt("010", 8);
|
|
70
|
-
var o = parseInt("001", 8);
|
|
71
|
-
var ug = u | g;
|
|
72
|
-
return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
73
|
-
}
|
|
74
|
-
}));
|
|
75
|
-
//#endregion
|
|
76
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
77
|
-
var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
78
|
-
__require("fs");
|
|
79
|
-
var core;
|
|
80
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
|
|
81
|
-
else core = require_mode();
|
|
82
|
-
module.exports = isexe;
|
|
83
|
-
isexe.sync = sync;
|
|
84
|
-
function isexe(path, options, cb) {
|
|
85
|
-
if (typeof options === "function") {
|
|
86
|
-
cb = options;
|
|
87
|
-
options = {};
|
|
88
|
-
}
|
|
89
|
-
if (!cb) {
|
|
90
|
-
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
91
|
-
return new Promise(function(resolve, reject) {
|
|
92
|
-
isexe(path, options || {}, function(er, is) {
|
|
93
|
-
if (er) reject(er);
|
|
94
|
-
else resolve(is);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
core(path, options || {}, function(er, is) {
|
|
99
|
-
if (er) {
|
|
100
|
-
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
101
|
-
er = null;
|
|
102
|
-
is = false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
cb(er, is);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function sync(path, options) {
|
|
109
|
-
try {
|
|
110
|
-
return core.sync(path, options || {});
|
|
111
|
-
} catch (er) {
|
|
112
|
-
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
113
|
-
else throw er;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}));
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
119
|
-
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
120
|
-
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
121
|
-
const path$3 = __require("path");
|
|
122
|
-
const COLON = isWindows ? ";" : ":";
|
|
123
|
-
const isexe = require_isexe();
|
|
124
|
-
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
125
|
-
const getPathInfo = (cmd, opt) => {
|
|
126
|
-
const colon = opt.colon || COLON;
|
|
127
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
128
|
-
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
129
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
130
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
131
|
-
if (isWindows) {
|
|
132
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
pathEnv,
|
|
136
|
-
pathExt,
|
|
137
|
-
pathExtExe
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
const which = (cmd, opt, cb) => {
|
|
141
|
-
if (typeof opt === "function") {
|
|
142
|
-
cb = opt;
|
|
143
|
-
opt = {};
|
|
144
|
-
}
|
|
145
|
-
if (!opt) opt = {};
|
|
146
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
147
|
-
const found = [];
|
|
148
|
-
const step = (i) => new Promise((resolve, reject) => {
|
|
149
|
-
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
150
|
-
const ppRaw = pathEnv[i];
|
|
151
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
152
|
-
const pCmd = path$3.join(pathPart, cmd);
|
|
153
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
154
|
-
resolve(subStep(p, i, 0));
|
|
155
|
-
});
|
|
156
|
-
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
157
|
-
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
158
|
-
const ext = pathExt[ii];
|
|
159
|
-
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
160
|
-
if (!er && is) if (opt.all) found.push(p + ext);
|
|
161
|
-
else return resolve(p + ext);
|
|
162
|
-
return resolve(subStep(p, i, ii + 1));
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
166
|
-
};
|
|
167
|
-
const whichSync = (cmd, opt) => {
|
|
168
|
-
opt = opt || {};
|
|
169
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
170
|
-
const found = [];
|
|
171
|
-
for (let i = 0; i < pathEnv.length; i++) {
|
|
172
|
-
const ppRaw = pathEnv[i];
|
|
173
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
174
|
-
const pCmd = path$3.join(pathPart, cmd);
|
|
175
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
176
|
-
for (let j = 0; j < pathExt.length; j++) {
|
|
177
|
-
const cur = p + pathExt[j];
|
|
178
|
-
try {
|
|
179
|
-
if (isexe.sync(cur, { pathExt: pathExtExe })) if (opt.all) found.push(cur);
|
|
180
|
-
else return cur;
|
|
181
|
-
} catch (ex) {}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (opt.all && found.length) return found;
|
|
185
|
-
if (opt.nothrow) return null;
|
|
186
|
-
throw getNotFoundError(cmd);
|
|
187
|
-
};
|
|
188
|
-
module.exports = which;
|
|
189
|
-
which.sync = whichSync;
|
|
190
|
-
}));
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
193
|
-
var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
194
|
-
const pathKey = (options = {}) => {
|
|
195
|
-
const environment = options.env || process.env;
|
|
196
|
-
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
197
|
-
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
198
|
-
};
|
|
199
|
-
module.exports = pathKey;
|
|
200
|
-
module.exports.default = pathKey;
|
|
201
|
-
}));
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
204
|
-
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
205
|
-
const path$2 = __require("path");
|
|
206
|
-
const which = require_which();
|
|
207
|
-
const getPathKey = require_path_key();
|
|
208
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
209
|
-
const env = parsed.options.env || process.env;
|
|
210
|
-
const cwd = process.cwd();
|
|
211
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
212
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
213
|
-
if (shouldSwitchCwd) try {
|
|
214
|
-
process.chdir(parsed.options.cwd);
|
|
215
|
-
} catch (err) {}
|
|
216
|
-
let resolved;
|
|
217
|
-
try {
|
|
218
|
-
resolved = which.sync(parsed.command, {
|
|
219
|
-
path: env[getPathKey({ env })],
|
|
220
|
-
pathExt: withoutPathExt ? path$2.delimiter : void 0
|
|
221
|
-
});
|
|
222
|
-
} catch (e) {} finally {
|
|
223
|
-
if (shouldSwitchCwd) process.chdir(cwd);
|
|
224
|
-
}
|
|
225
|
-
if (resolved) resolved = path$2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
226
|
-
return resolved;
|
|
227
|
-
}
|
|
228
|
-
function resolveCommand(parsed) {
|
|
229
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
230
|
-
}
|
|
231
|
-
module.exports = resolveCommand;
|
|
232
|
-
}));
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
235
|
-
var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
236
|
-
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
237
|
-
function escapeCommand(arg) {
|
|
238
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
239
|
-
return arg;
|
|
240
|
-
}
|
|
241
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
242
|
-
arg = `${arg}`;
|
|
243
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
244
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
245
|
-
arg = `"${arg}"`;
|
|
246
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
247
|
-
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
248
|
-
return arg;
|
|
249
|
-
}
|
|
250
|
-
module.exports.command = escapeCommand;
|
|
251
|
-
module.exports.argument = escapeArgument;
|
|
252
|
-
}));
|
|
253
|
-
//#endregion
|
|
254
|
-
//#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
255
|
-
var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
256
|
-
module.exports = /^#!(.*)/;
|
|
257
|
-
}));
|
|
258
|
-
//#endregion
|
|
259
|
-
//#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
260
|
-
var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
261
|
-
const shebangRegex = require_shebang_regex();
|
|
262
|
-
module.exports = (string = "") => {
|
|
263
|
-
const match = string.match(shebangRegex);
|
|
264
|
-
if (!match) return null;
|
|
265
|
-
const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
266
|
-
const binary = path.split("/").pop();
|
|
267
|
-
if (binary === "env") return argument;
|
|
268
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
269
|
-
};
|
|
270
|
-
}));
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
273
|
-
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
274
|
-
const fs$1 = __require("fs");
|
|
275
|
-
const shebangCommand = require_shebang_command();
|
|
276
|
-
function readShebang(command) {
|
|
277
|
-
const size = 150;
|
|
278
|
-
const buffer = Buffer.alloc(size);
|
|
279
|
-
let fd;
|
|
280
|
-
try {
|
|
281
|
-
fd = fs$1.openSync(command, "r");
|
|
282
|
-
fs$1.readSync(fd, buffer, 0, size, 0);
|
|
283
|
-
fs$1.closeSync(fd);
|
|
284
|
-
} catch (e) {}
|
|
285
|
-
return shebangCommand(buffer.toString());
|
|
286
|
-
}
|
|
287
|
-
module.exports = readShebang;
|
|
288
|
-
}));
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
291
|
-
var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
292
|
-
const path$1 = __require("path");
|
|
293
|
-
const resolveCommand = require_resolveCommand();
|
|
294
|
-
const escape = require_escape();
|
|
295
|
-
const readShebang = require_readShebang();
|
|
296
|
-
const isWin = process.platform === "win32";
|
|
297
|
-
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
298
|
-
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
299
|
-
function detectShebang(parsed) {
|
|
300
|
-
parsed.file = resolveCommand(parsed);
|
|
301
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
302
|
-
if (shebang) {
|
|
303
|
-
parsed.args.unshift(parsed.file);
|
|
304
|
-
parsed.command = shebang;
|
|
305
|
-
return resolveCommand(parsed);
|
|
306
|
-
}
|
|
307
|
-
return parsed.file;
|
|
308
|
-
}
|
|
309
|
-
function parseNonShell(parsed) {
|
|
310
|
-
if (!isWin) return parsed;
|
|
311
|
-
const commandFile = detectShebang(parsed);
|
|
312
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
313
|
-
if (parsed.options.forceShell || needsShell) {
|
|
314
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
315
|
-
parsed.command = path$1.normalize(parsed.command);
|
|
316
|
-
parsed.command = escape.command(parsed.command);
|
|
317
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
318
|
-
parsed.args = [
|
|
319
|
-
"/d",
|
|
320
|
-
"/s",
|
|
321
|
-
"/c",
|
|
322
|
-
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
323
|
-
];
|
|
324
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
325
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
326
|
-
}
|
|
327
|
-
return parsed;
|
|
328
|
-
}
|
|
329
|
-
function parse(command, args, options) {
|
|
330
|
-
if (args && !Array.isArray(args)) {
|
|
331
|
-
options = args;
|
|
332
|
-
args = null;
|
|
333
|
-
}
|
|
334
|
-
args = args ? args.slice(0) : [];
|
|
335
|
-
options = Object.assign({}, options);
|
|
336
|
-
const parsed = {
|
|
337
|
-
command,
|
|
338
|
-
args,
|
|
339
|
-
options,
|
|
340
|
-
file: void 0,
|
|
341
|
-
original: {
|
|
342
|
-
command,
|
|
343
|
-
args
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
347
|
-
}
|
|
348
|
-
module.exports = parse;
|
|
349
|
-
}));
|
|
350
|
-
//#endregion
|
|
351
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
352
|
-
var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
353
|
-
const isWin = process.platform === "win32";
|
|
354
|
-
function notFoundError(original, syscall) {
|
|
355
|
-
return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
|
|
356
|
-
code: "ENOENT",
|
|
357
|
-
errno: "ENOENT",
|
|
358
|
-
syscall: `${syscall} ${original.command}`,
|
|
359
|
-
path: original.command,
|
|
360
|
-
spawnargs: original.args
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
function hookChildProcess(cp, parsed) {
|
|
364
|
-
if (!isWin) return;
|
|
365
|
-
const originalEmit = cp.emit;
|
|
366
|
-
cp.emit = function(name, arg1) {
|
|
367
|
-
if (name === "exit") {
|
|
368
|
-
const err = verifyENOENT(arg1, parsed);
|
|
369
|
-
if (err) return originalEmit.call(cp, "error", err);
|
|
370
|
-
}
|
|
371
|
-
return originalEmit.apply(cp, arguments);
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
function verifyENOENT(status, parsed) {
|
|
375
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
|
-
function verifyENOENTSync(status, parsed) {
|
|
379
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
module.exports = {
|
|
383
|
-
hookChildProcess,
|
|
384
|
-
verifyENOENT,
|
|
385
|
-
verifyENOENTSync,
|
|
386
|
-
notFoundError
|
|
387
|
-
};
|
|
388
|
-
}));
|
|
389
|
-
//#endregion
|
|
390
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
391
|
-
var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
392
|
-
const cp = __require("child_process");
|
|
393
|
-
const parse = require_parse$1();
|
|
394
|
-
const enoent = require_enoent();
|
|
395
|
-
function spawn(command, args, options) {
|
|
396
|
-
const parsed = parse(command, args, options);
|
|
397
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
398
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
399
|
-
return spawned;
|
|
400
|
-
}
|
|
401
|
-
function spawnSync(command, args, options) {
|
|
402
|
-
const parsed = parse(command, args, options);
|
|
403
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
404
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
405
|
-
return result;
|
|
406
|
-
}
|
|
407
|
-
module.exports = spawn;
|
|
408
|
-
module.exports.spawn = spawn;
|
|
409
|
-
module.exports.sync = spawnSync;
|
|
410
|
-
module.exports._parse = parse;
|
|
411
|
-
module.exports._enoent = enoent;
|
|
412
|
-
}));
|
|
413
|
-
//#endregion
|
|
414
|
-
//#region src/utils/command.ts
|
|
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
|
-
}
|
|
421
|
-
async function runCommandSilently(options) {
|
|
422
|
-
const child = (0, import_cross_spawn.default)(options.command, options.args, {
|
|
423
|
-
stdio: [
|
|
424
|
-
"ignore",
|
|
425
|
-
"pipe",
|
|
426
|
-
"pipe"
|
|
427
|
-
],
|
|
428
|
-
cwd: options.cwd,
|
|
429
|
-
env: options.envs
|
|
430
|
-
});
|
|
431
|
-
return await new Promise((resolve, reject) => {
|
|
432
|
-
const stdout = [];
|
|
433
|
-
const stderr = [];
|
|
434
|
-
let timedOut = false;
|
|
435
|
-
const timer = options.timeoutMs === void 0 ? void 0 : setTimeout(() => {
|
|
436
|
-
timedOut = true;
|
|
437
|
-
child.kill("SIGKILL");
|
|
438
|
-
}, options.timeoutMs);
|
|
439
|
-
timer?.unref();
|
|
440
|
-
child.stdout?.on("data", (data) => {
|
|
441
|
-
stdout.push(data);
|
|
442
|
-
});
|
|
443
|
-
child.stderr?.on("data", (data) => {
|
|
444
|
-
stderr.push(data);
|
|
445
|
-
});
|
|
446
|
-
child.on("close", (code, signal) => {
|
|
447
|
-
clearTimeout(timer);
|
|
448
|
-
if (timedOut) {
|
|
449
|
-
reject(/* @__PURE__ */ new Error(`Command timed out after ${options.timeoutMs}ms: ${options.command}`));
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
resolve({
|
|
453
|
-
exitCode: exitCodeFromClose(code, signal),
|
|
454
|
-
stdout: Buffer.concat(stdout),
|
|
455
|
-
stderr: Buffer.concat(stderr)
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
child.on("error", (err) => {
|
|
459
|
-
clearTimeout(timer);
|
|
460
|
-
reject(err);
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
async function runCommand$1(options) {
|
|
465
|
-
const child = (0, import_cross_spawn.default)(options.command, options.args, {
|
|
466
|
-
stdio: "inherit",
|
|
467
|
-
cwd: options.cwd,
|
|
468
|
-
env: options.envs
|
|
469
|
-
});
|
|
470
|
-
return new Promise((resolve, reject) => {
|
|
471
|
-
child.on("close", (code, signal) => {
|
|
472
|
-
resolve({ exitCode: exitCodeFromClose(code, signal) });
|
|
473
|
-
});
|
|
474
|
-
child.on("error", (err) => {
|
|
475
|
-
reject(err);
|
|
476
|
-
});
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
//#endregion
|
|
480
16
|
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
481
17
|
const getCodePointsLength$1 = (() => {
|
|
482
18
|
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
@@ -1686,7 +1222,7 @@ const limitOptions = (params) => {
|
|
|
1686
1222
|
};
|
|
1687
1223
|
/**
|
|
1688
1224
|
* Render-milestone markers for the PTY snapshot suite
|
|
1689
|
-
* (crates/
|
|
1225
|
+
* (crates/vp_cli_snapshots): invisible window-title updates the runner
|
|
1690
1226
|
* synchronizes on via `expect-milestone` interactions. Emission is gated on
|
|
1691
1227
|
* `VP_EMIT_MILESTONES=1`, which only the runner sets; real terminals and
|
|
1692
1228
|
* piped output never see these markers as content (they only update the
|
|
@@ -2027,8 +1563,10 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
2027
1563
|
const elapsedMs = getElapsedMs();
|
|
2028
1564
|
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
1565
|
_message = msg ?? _message;
|
|
2030
|
-
if (!silent)
|
|
2031
|
-
|
|
1566
|
+
if (!silent) {
|
|
1567
|
+
if (indicator === "timer") output.write(`${step} ${_message} ${formatTimer(elapsedMs)}\n\n`);
|
|
1568
|
+
else output.write(`${step} ${_message}\n\n`);
|
|
1569
|
+
}
|
|
2032
1570
|
if (!preserveElapsed) _elapsedMs = 0;
|
|
2033
1571
|
_prevMessage = void 0;
|
|
2034
1572
|
clearHooks();
|
|
@@ -2323,9 +1861,10 @@ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2323
1861
|
module.exports = class SemVer {
|
|
2324
1862
|
constructor(version, options) {
|
|
2325
1863
|
options = parseOptions(options);
|
|
2326
|
-
if (version instanceof SemVer)
|
|
2327
|
-
|
|
2328
|
-
|
|
1864
|
+
if (version instanceof SemVer) {
|
|
1865
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
1866
|
+
else version = version.version;
|
|
1867
|
+
} else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
2329
1868
|
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
2330
1869
|
debug("SemVer", version, options);
|
|
2331
1870
|
this.options = options;
|
|
@@ -2827,8 +2366,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2827
2366
|
module.exports = class Range {
|
|
2828
2367
|
constructor(range, options) {
|
|
2829
2368
|
options = parseOptions(options);
|
|
2830
|
-
if (range instanceof Range)
|
|
2831
|
-
|
|
2369
|
+
if (range instanceof Range) {
|
|
2370
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
2371
|
+
else return new Range(range.raw, options);
|
|
2372
|
+
}
|
|
2832
2373
|
if (range instanceof Comparator) {
|
|
2833
2374
|
this.raw = range.value;
|
|
2834
2375
|
this.set = [[range]];
|
|
@@ -2998,18 +2539,21 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2998
2539
|
let ret;
|
|
2999
2540
|
if (isX(M)) ret = "";
|
|
3000
2541
|
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
3001
|
-
else if (isX(p))
|
|
3002
|
-
|
|
3003
|
-
|
|
2542
|
+
else if (isX(p)) {
|
|
2543
|
+
if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
2544
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
2545
|
+
} else if (pr) {
|
|
3004
2546
|
debug("replaceCaret pr", pr);
|
|
3005
|
-
if (M === "0")
|
|
3006
|
-
|
|
3007
|
-
|
|
2547
|
+
if (M === "0") {
|
|
2548
|
+
if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
2549
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2550
|
+
} else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
3008
2551
|
} else {
|
|
3009
2552
|
debug("no pr");
|
|
3010
|
-
if (M === "0")
|
|
3011
|
-
|
|
3012
|
-
|
|
2553
|
+
if (M === "0") {
|
|
2554
|
+
if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
2555
|
+
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
2556
|
+
} else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
3013
2557
|
}
|
|
3014
2558
|
debug("caret return", ret);
|
|
3015
2559
|
return ret;
|
|
@@ -3031,9 +2575,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3031
2575
|
const anyX = xp;
|
|
3032
2576
|
if (gtlt === "=" && anyX) gtlt = "";
|
|
3033
2577
|
pr = options.includePrerelease ? "-0" : "";
|
|
3034
|
-
if (xM)
|
|
3035
|
-
|
|
3036
|
-
|
|
2578
|
+
if (xM) {
|
|
2579
|
+
if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
2580
|
+
else ret = "*";
|
|
2581
|
+
} else if (gtlt && anyX) {
|
|
3037
2582
|
if (xm) m = 0;
|
|
3038
2583
|
p = 0;
|
|
3039
2584
|
if (gtlt === ">") {
|
|
@@ -3107,8 +2652,10 @@ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3107
2652
|
}
|
|
3108
2653
|
constructor(comp, options) {
|
|
3109
2654
|
options = parseOptions(options);
|
|
3110
|
-
if (comp instanceof Comparator)
|
|
3111
|
-
|
|
2655
|
+
if (comp instanceof Comparator) {
|
|
2656
|
+
if (comp.loose === !!options.loose) return comp;
|
|
2657
|
+
else comp = comp.value;
|
|
2658
|
+
}
|
|
3112
2659
|
comp = comp.trim().split(/\s+/).join(" ");
|
|
3113
2660
|
debug("comparator", comp, options);
|
|
3114
2661
|
this.options = options;
|
|
@@ -3428,11 +2975,15 @@ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3428
2975
|
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
3429
2976
|
const simpleSubset = (sub, dom, options) => {
|
|
3430
2977
|
if (sub === dom) return true;
|
|
3431
|
-
if (sub.length === 1 && sub[0].semver === ANY)
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
2978
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2979
|
+
if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
2980
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
2981
|
+
else sub = minimumVersion;
|
|
2982
|
+
}
|
|
2983
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2984
|
+
if (options.includePrerelease) return true;
|
|
2985
|
+
else dom = minimumVersion;
|
|
2986
|
+
}
|
|
3436
2987
|
const eqSet = /* @__PURE__ */ new Set();
|
|
3437
2988
|
let gt, lt;
|
|
3438
2989
|
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
@@ -3676,6 +3227,42 @@ function parseBunUntrusted(output) {
|
|
|
3676
3227
|
return match ? match[1] : null;
|
|
3677
3228
|
});
|
|
3678
3229
|
}
|
|
3230
|
+
/**
|
|
3231
|
+
* npm >= 12 skips dependency install scripts that the `allowScripts` allowlist
|
|
3232
|
+
* in package.json does not cover, and reports them on stderr:
|
|
3233
|
+
*
|
|
3234
|
+
* ```
|
|
3235
|
+
* npm warn install-scripts 2 packages had install scripts blocked because they are not covered by allowScripts:
|
|
3236
|
+
* npm warn install-scripts core-js@3.49.0 (postinstall: node -e "try{require('./postinstall')}catch(e){}")
|
|
3237
|
+
* npm warn install-scripts esbuild@0.28.1 (postinstall: node install.js)
|
|
3238
|
+
* ```
|
|
3239
|
+
*
|
|
3240
|
+
* npm 11.16 - 11.x print a similar warning ("install scripts not yet covered by
|
|
3241
|
+
* allowScripts") but still run the scripts, so only the npm 12 "blocked" wording
|
|
3242
|
+
* is parsed.
|
|
3243
|
+
*/
|
|
3244
|
+
const NPM_BLOCKED_SCRIPTS_MARKER = "install scripts blocked because they are not covered by allowScripts";
|
|
3245
|
+
/**
|
|
3246
|
+
* A blocked-package entry line: `npm warn install-scripts <spec> (<lifecycle>:
|
|
3247
|
+
* <command>)`. Anchoring on the lifecycle name keeps the count line ("2 packages
|
|
3248
|
+
* had install scripts blocked ...") and the trailing hint line from matching.
|
|
3249
|
+
*/
|
|
3250
|
+
const NPM_BLOCKED_ENTRY = /^npm warn install-scripts\s+(\S+) \((?:pre|post)?install:/u;
|
|
3251
|
+
/**
|
|
3252
|
+
* Parse the package names npm >= 12 reports as having blocked install scripts
|
|
3253
|
+
* from captured `npm install` / `npm ci` output. Strips version suffixes and
|
|
3254
|
+
* dedupes while preserving first-seen order. Returns `[]` when the warning is
|
|
3255
|
+
* absent (including the npm 11.x advisory variant, where scripts still run).
|
|
3256
|
+
*/
|
|
3257
|
+
function parseNpmBlockedScripts(output) {
|
|
3258
|
+
if (!output) return [];
|
|
3259
|
+
const clean = stripVTControlCharacters(output);
|
|
3260
|
+
if (!clean.includes(NPM_BLOCKED_SCRIPTS_MARKER)) return [];
|
|
3261
|
+
return dedupeNames(clean.split("\n"), (rawLine) => {
|
|
3262
|
+
const match = rawLine.trim().match(NPM_BLOCKED_ENTRY);
|
|
3263
|
+
return match ? stripPackageVersion(match[1]) : null;
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3679
3266
|
const YARN_DISABLED_BUILDS_MARKER = "lists build scripts, but all build scripts have been disabled";
|
|
3680
3267
|
/**
|
|
3681
3268
|
* Yarn (Berry) gates build scripts when `enableScripts` is false: each gated
|
|
@@ -3704,12 +3291,14 @@ function yarnDescriptorName(descriptor) {
|
|
|
3704
3291
|
/**
|
|
3705
3292
|
* Parse the gated build-script package names from an install log, dispatching on
|
|
3706
3293
|
* the package manager: pnpm prints `Ignored build scripts:`, yarn prints
|
|
3707
|
-
* `... build scripts have been disabled
|
|
3708
|
-
*
|
|
3294
|
+
* `... build scripts have been disabled`, npm >= 12 prints `... install scripts
|
|
3295
|
+
* blocked ...`. bun is not parsed here (its blocked packages are queried
|
|
3296
|
+
* separately via `bun pm untrusted`).
|
|
3709
3297
|
*/
|
|
3710
3298
|
function parseInstallGatedBuilds(output, packageManager) {
|
|
3711
3299
|
if (packageManager === PackageManager.pnpm) return parseIgnoredBuilds(output);
|
|
3712
3300
|
if (packageManager === PackageManager.yarn) return parseYarnDisabledBuilds(output);
|
|
3301
|
+
if (packageManager === PackageManager.npm) return parseNpmBlockedScripts(output);
|
|
3713
3302
|
return [];
|
|
3714
3303
|
}
|
|
3715
3304
|
/**
|
|
@@ -3754,14 +3343,15 @@ function pnpmSupportsPositionalApprove(version) {
|
|
|
3754
3343
|
const GATED_BUILD_PACKAGE_MANAGERS = /* @__PURE__ */ new Set([
|
|
3755
3344
|
PackageManager.pnpm,
|
|
3756
3345
|
PackageManager.bun,
|
|
3757
|
-
PackageManager.yarn
|
|
3346
|
+
PackageManager.yarn,
|
|
3347
|
+
PackageManager.npm
|
|
3758
3348
|
]);
|
|
3759
3349
|
/**
|
|
3760
3350
|
* Narrow a package manager's gated builds down to the ones worth surfacing
|
|
3761
3351
|
* during `vp create`: packages the generated project depends on directly.
|
|
3762
3352
|
* Transitive gated builds (e.g. `esbuild` pulled in by Vite) are noise the user
|
|
3763
3353
|
* 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
|
|
3354
|
+
* do not gate build scripts (npm < 12, yarn classic), since there is nothing to
|
|
3765
3355
|
* approve.
|
|
3766
3356
|
*/
|
|
3767
3357
|
function resolveApproveBuildTargets(projectDir, pendingBuilds, packageManager) {
|
|
@@ -3779,15 +3369,15 @@ function resolveApproveBuildTargets(projectDir, pendingBuilds, packageManager) {
|
|
|
3779
3369
|
* Enumerate the packages whose build scripts a package manager gated during the
|
|
3780
3370
|
* install, as raw names (still unfiltered by direct dependency).
|
|
3781
3371
|
*
|
|
3782
|
-
* - pnpm and
|
|
3783
|
-
* there (see {@link parseInstallGatedBuilds}) and passed in via
|
|
3372
|
+
* - pnpm, yarn, and npm >= 12 report them in their install output, so the names
|
|
3373
|
+
* are parsed there (see {@link parseInstallGatedBuilds}) and passed in via
|
|
3784
3374
|
* `pendingBuildsFromInstall`.
|
|
3785
3375
|
* - bun exits 0 and only prints a count, so `bun pm untrusted` is queried here.
|
|
3786
3376
|
*
|
|
3787
3377
|
* Other package managers run build scripts by default and return `[]`.
|
|
3788
3378
|
*/
|
|
3789
3379
|
async function detectGatedBuilds(installCwd, packageManager, pendingBuildsFromInstall) {
|
|
3790
|
-
if (packageManager === PackageManager.pnpm || packageManager === PackageManager.yarn) return pendingBuildsFromInstall ?? [];
|
|
3380
|
+
if (packageManager === PackageManager.pnpm || packageManager === PackageManager.yarn || packageManager === PackageManager.npm) return pendingBuildsFromInstall ?? [];
|
|
3791
3381
|
if (packageManager === PackageManager.bun) {
|
|
3792
3382
|
const { exitCode, stdout, stderr } = await runCommandSilently({
|
|
3793
3383
|
command: process.env.VP_CLI_BIN ?? "vp",
|
|
@@ -3814,16 +3404,17 @@ function printApproveBuildsGuidance(targets, packageManager) {
|
|
|
3814
3404
|
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
3405
|
return;
|
|
3816
3406
|
}
|
|
3817
|
-
const command = packageManager === PackageManager.bun ? `vp pm approve-builds ${targets.join(" ")}` : "vp pm approve-builds";
|
|
3407
|
+
const command = packageManager === PackageManager.bun || packageManager === PackageManager.npm ? `vp pm approve-builds ${targets.join(" ")}` : "vp pm approve-builds";
|
|
3818
3408
|
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
3409
|
}
|
|
3820
3410
|
/**
|
|
3821
3411
|
* 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 `
|
|
3412
|
+
* On failure the approval has still been recorded (pnpm/bun/npm config or
|
|
3413
|
+
* yarn's `dependenciesMeta`), so the retry hint points back at `retryCommand`
|
|
3414
|
+
* (`vp install` unless the package manager needs an explicit rebuild). Returns
|
|
3824
3415
|
* `true` when the command succeeded, `false` when the build exited non-zero.
|
|
3825
3416
|
*/
|
|
3826
|
-
async function runBuildAndReport(args, cwd, packages, interactive, silent, extraEnv) {
|
|
3417
|
+
async function runBuildAndReport(args, cwd, packages, interactive, silent, extraEnv, retryCommand = "vp install") {
|
|
3827
3418
|
const spinner = silent ? getSilentSpinner() : getSpinner(interactive);
|
|
3828
3419
|
spinner.start(`Building ${packages.join(", ")}...`);
|
|
3829
3420
|
const { exitCode, stdout, stderr } = await runCommandSilently({
|
|
@@ -3842,10 +3433,42 @@ async function runBuildAndReport(args, cwd, packages, interactive, silent, extra
|
|
|
3842
3433
|
spinner.stop(`Build failed for ${packages.join(", ")}`);
|
|
3843
3434
|
const output = `${stdout.toString()}\n${stderr.toString()}`.trim();
|
|
3844
3435
|
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(
|
|
3436
|
+
log.warn(`Build scripts failed for ${accent(packages.join(", "))}. They were approved; fix the build toolchain and run ${accent(retryCommand)} to retry.`);
|
|
3846
3437
|
return false;
|
|
3847
3438
|
}
|
|
3848
3439
|
/**
|
|
3440
|
+
* Approve gated install scripts for npm >= 12, then run them. npm's approval
|
|
3441
|
+
* (`npm approve-scripts`, via `vp pm approve-builds`) only records the
|
|
3442
|
+
* `allowScripts` allowlist in package.json: scripts the install already skipped
|
|
3443
|
+
* do not run on approval, and a plain reinstall short-circuits on the
|
|
3444
|
+
* up-to-date tree without running them either. `npm rebuild` is what executes
|
|
3445
|
+
* the newly approved scripts, so approval and rebuild are two steps.
|
|
3446
|
+
*/
|
|
3447
|
+
async function approveNpmScripts(installCwd, packages, interactive, silent) {
|
|
3448
|
+
const approveCommand = `vp pm approve-builds ${packages.join(" ")}`;
|
|
3449
|
+
const { exitCode, stdout, stderr } = await runCommandSilently({
|
|
3450
|
+
command: process.env.VP_CLI_BIN ?? "vp",
|
|
3451
|
+
args: [
|
|
3452
|
+
"pm",
|
|
3453
|
+
"approve-builds",
|
|
3454
|
+
...packages
|
|
3455
|
+
],
|
|
3456
|
+
cwd: installCwd,
|
|
3457
|
+
envs: process.env
|
|
3458
|
+
});
|
|
3459
|
+
if (exitCode !== 0) {
|
|
3460
|
+
const output = `${stdout.toString()}\n${stderr.toString()}`.trim();
|
|
3461
|
+
if (output) log.info(lastLines(output, 20));
|
|
3462
|
+
log.warn(`Approving build scripts failed for ${accent(packages.join(", "))}. Run ${accent(approveCommand)} in the project to retry.`);
|
|
3463
|
+
return false;
|
|
3464
|
+
}
|
|
3465
|
+
return runBuildAndReport([
|
|
3466
|
+
"pm",
|
|
3467
|
+
"rebuild",
|
|
3468
|
+
...packages
|
|
3469
|
+
], installCwd, packages, interactive, silent, void 0, `vp pm rebuild ${packages.join(" ")}`);
|
|
3470
|
+
}
|
|
3471
|
+
/**
|
|
3849
3472
|
* Mark each package as build-allowed in yarn's `dependenciesMeta[<pkg>].built`,
|
|
3850
3473
|
* preserving existing metadata. Guards against a non-object container or
|
|
3851
3474
|
* per-package value so a hand-authored scalar doesn't corrupt package.json.
|
|
@@ -3886,8 +3509,8 @@ async function approveYarnBuilds(installCwd, packages, interactive, silent) {
|
|
|
3886
3509
|
return runBuildAndReport(["install"], installCwd, packages, interactive, silent, { YARN_ENABLE_IMMUTABLE_INSTALLS: "false" });
|
|
3887
3510
|
}
|
|
3888
3511
|
/**
|
|
3889
|
-
* Surface
|
|
3890
|
-
* user act on them:
|
|
3512
|
+
* Surface the package manager's gated build scripts after a `vp create` install
|
|
3513
|
+
* and let the user act on them:
|
|
3891
3514
|
* - `--approve-builds`: approve + build every target, no prompt.
|
|
3892
3515
|
* - interactive: a default-off multiselect so each package is approved
|
|
3893
3516
|
* individually (pnpm gates them for security, so nothing is opt-in by
|
|
@@ -3920,6 +3543,7 @@ async function approveBuilds(options) {
|
|
|
3920
3543
|
return true;
|
|
3921
3544
|
}
|
|
3922
3545
|
if (packageManager === PackageManager.yarn) return approveYarnBuilds(cwd, selected, interactive, silent);
|
|
3546
|
+
if (packageManager === PackageManager.npm) return approveNpmScripts(cwd, selected, interactive, silent);
|
|
3923
3547
|
if (packageManager === PackageManager.pnpm && !pnpmSupportsPositionalApprove(packageManagerVersion)) {
|
|
3924
3548
|
printApproveBuildsGuidance(selected, packageManager);
|
|
3925
3549
|
return !(autoApprove && !interactive);
|
|
@@ -4262,4 +3886,4 @@ function defaultInteractive() {
|
|
|
4262
3886
|
return !process.env.CI && process.stdin.isTTY;
|
|
4263
3887
|
}
|
|
4264
3888
|
//#endregion
|
|
4265
|
-
export { isCancel as A, log as C, spinner as D, select as E,
|
|
3889
|
+
export { isCancel as A, log as C, spinner as D, select as E, 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, 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 };
|