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
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
|
|
2
|
+
import { constants } from "node:os";
|
|
3
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
4
|
+
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
+
module.exports = isexe;
|
|
6
|
+
isexe.sync = sync;
|
|
7
|
+
var fs$2 = __require("fs");
|
|
8
|
+
function checkPathExt(path, options) {
|
|
9
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
10
|
+
if (!pathext) return true;
|
|
11
|
+
pathext = pathext.split(";");
|
|
12
|
+
if (pathext.indexOf("") !== -1) return true;
|
|
13
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
14
|
+
var p = pathext[i].toLowerCase();
|
|
15
|
+
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
function checkStat(stat, path, options) {
|
|
20
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
21
|
+
return checkPathExt(path, options);
|
|
22
|
+
}
|
|
23
|
+
function isexe(path, options, cb) {
|
|
24
|
+
fs$2.stat(path, function(er, stat) {
|
|
25
|
+
cb(er, er ? false : checkStat(stat, path, options));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function sync(path, options) {
|
|
29
|
+
return checkStat(fs$2.statSync(path), path, options);
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
34
|
+
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
35
|
+
module.exports = isexe;
|
|
36
|
+
isexe.sync = sync;
|
|
37
|
+
var fs$1 = __require("fs");
|
|
38
|
+
function isexe(path, options, cb) {
|
|
39
|
+
fs$1.stat(path, function(er, stat) {
|
|
40
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function sync(path, options) {
|
|
44
|
+
return checkStat(fs$1.statSync(path), options);
|
|
45
|
+
}
|
|
46
|
+
function checkStat(stat, options) {
|
|
47
|
+
return stat.isFile() && checkMode(stat, options);
|
|
48
|
+
}
|
|
49
|
+
function checkMode(stat, options) {
|
|
50
|
+
var mod = stat.mode;
|
|
51
|
+
var uid = stat.uid;
|
|
52
|
+
var gid = stat.gid;
|
|
53
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
54
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
55
|
+
var u = parseInt("100", 8);
|
|
56
|
+
var g = parseInt("010", 8);
|
|
57
|
+
var o = parseInt("001", 8);
|
|
58
|
+
var ug = u | g;
|
|
59
|
+
return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
64
|
+
var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
65
|
+
__require("fs");
|
|
66
|
+
var core;
|
|
67
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
|
|
68
|
+
else core = require_mode();
|
|
69
|
+
module.exports = isexe;
|
|
70
|
+
isexe.sync = sync;
|
|
71
|
+
function isexe(path, options, cb) {
|
|
72
|
+
if (typeof options === "function") {
|
|
73
|
+
cb = options;
|
|
74
|
+
options = {};
|
|
75
|
+
}
|
|
76
|
+
if (!cb) {
|
|
77
|
+
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
78
|
+
return new Promise(function(resolve, reject) {
|
|
79
|
+
isexe(path, options || {}, function(er, is) {
|
|
80
|
+
if (er) reject(er);
|
|
81
|
+
else resolve(is);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
core(path, options || {}, function(er, is) {
|
|
86
|
+
if (er) {
|
|
87
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
88
|
+
er = null;
|
|
89
|
+
is = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
cb(er, is);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function sync(path, options) {
|
|
96
|
+
try {
|
|
97
|
+
return core.sync(path, options || {});
|
|
98
|
+
} catch (er) {
|
|
99
|
+
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
100
|
+
else throw er;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
106
|
+
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
107
|
+
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
108
|
+
const path$2 = __require("path");
|
|
109
|
+
const COLON = isWindows ? ";" : ":";
|
|
110
|
+
const isexe = require_isexe();
|
|
111
|
+
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
112
|
+
const getPathInfo = (cmd, opt) => {
|
|
113
|
+
const colon = opt.colon || COLON;
|
|
114
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
115
|
+
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
116
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
117
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
118
|
+
if (isWindows) {
|
|
119
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
pathEnv,
|
|
123
|
+
pathExt,
|
|
124
|
+
pathExtExe
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
const which = (cmd, opt, cb) => {
|
|
128
|
+
if (typeof opt === "function") {
|
|
129
|
+
cb = opt;
|
|
130
|
+
opt = {};
|
|
131
|
+
}
|
|
132
|
+
if (!opt) opt = {};
|
|
133
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
134
|
+
const found = [];
|
|
135
|
+
const step = (i) => new Promise((resolve, reject) => {
|
|
136
|
+
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
137
|
+
const ppRaw = pathEnv[i];
|
|
138
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
139
|
+
const pCmd = path$2.join(pathPart, cmd);
|
|
140
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
141
|
+
resolve(subStep(p, i, 0));
|
|
142
|
+
});
|
|
143
|
+
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
144
|
+
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
145
|
+
const ext = pathExt[ii];
|
|
146
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
147
|
+
if (!er && is) {
|
|
148
|
+
if (opt.all) found.push(p + ext);
|
|
149
|
+
else return resolve(p + ext);
|
|
150
|
+
}
|
|
151
|
+
return resolve(subStep(p, i, ii + 1));
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
155
|
+
};
|
|
156
|
+
const whichSync = (cmd, opt) => {
|
|
157
|
+
opt = opt || {};
|
|
158
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
159
|
+
const found = [];
|
|
160
|
+
for (let i = 0; i < pathEnv.length; i++) {
|
|
161
|
+
const ppRaw = pathEnv[i];
|
|
162
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
163
|
+
const pCmd = path$2.join(pathPart, cmd);
|
|
164
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
165
|
+
for (let j = 0; j < pathExt.length; j++) {
|
|
166
|
+
const cur = p + pathExt[j];
|
|
167
|
+
try {
|
|
168
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
169
|
+
if (opt.all) found.push(cur);
|
|
170
|
+
else return cur;
|
|
171
|
+
}
|
|
172
|
+
} catch (ex) {}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (opt.all && found.length) return found;
|
|
176
|
+
if (opt.nothrow) return null;
|
|
177
|
+
throw getNotFoundError(cmd);
|
|
178
|
+
};
|
|
179
|
+
module.exports = which;
|
|
180
|
+
which.sync = whichSync;
|
|
181
|
+
}));
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
184
|
+
var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
185
|
+
const pathKey = (options = {}) => {
|
|
186
|
+
const environment = options.env || process.env;
|
|
187
|
+
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
188
|
+
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
189
|
+
};
|
|
190
|
+
module.exports = pathKey;
|
|
191
|
+
module.exports.default = pathKey;
|
|
192
|
+
}));
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
195
|
+
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
196
|
+
const path$1 = __require("path");
|
|
197
|
+
const which = require_which();
|
|
198
|
+
const getPathKey = require_path_key();
|
|
199
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
200
|
+
const env = parsed.options.env || process.env;
|
|
201
|
+
const cwd = process.cwd();
|
|
202
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
203
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
204
|
+
if (shouldSwitchCwd) try {
|
|
205
|
+
process.chdir(parsed.options.cwd);
|
|
206
|
+
} catch (err) {}
|
|
207
|
+
let resolved;
|
|
208
|
+
try {
|
|
209
|
+
resolved = which.sync(parsed.command, {
|
|
210
|
+
path: env[getPathKey({ env })],
|
|
211
|
+
pathExt: withoutPathExt ? path$1.delimiter : void 0
|
|
212
|
+
});
|
|
213
|
+
} catch (e) {} finally {
|
|
214
|
+
if (shouldSwitchCwd) process.chdir(cwd);
|
|
215
|
+
}
|
|
216
|
+
if (resolved) resolved = path$1.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
217
|
+
return resolved;
|
|
218
|
+
}
|
|
219
|
+
function resolveCommand(parsed) {
|
|
220
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
221
|
+
}
|
|
222
|
+
module.exports = resolveCommand;
|
|
223
|
+
}));
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
226
|
+
var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
227
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
228
|
+
function escapeCommand(arg) {
|
|
229
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
230
|
+
return arg;
|
|
231
|
+
}
|
|
232
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
233
|
+
arg = `${arg}`;
|
|
234
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
235
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
236
|
+
arg = `"${arg}"`;
|
|
237
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
238
|
+
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
239
|
+
return arg;
|
|
240
|
+
}
|
|
241
|
+
module.exports.command = escapeCommand;
|
|
242
|
+
module.exports.argument = escapeArgument;
|
|
243
|
+
}));
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
246
|
+
var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
247
|
+
module.exports = /^#!(.*)/;
|
|
248
|
+
}));
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
251
|
+
var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
252
|
+
const shebangRegex = require_shebang_regex();
|
|
253
|
+
module.exports = (string = "") => {
|
|
254
|
+
const match = string.match(shebangRegex);
|
|
255
|
+
if (!match) return null;
|
|
256
|
+
const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
257
|
+
const binary = path.split("/").pop();
|
|
258
|
+
if (binary === "env") return argument;
|
|
259
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
260
|
+
};
|
|
261
|
+
}));
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
264
|
+
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
265
|
+
const fs = __require("fs");
|
|
266
|
+
const shebangCommand = require_shebang_command();
|
|
267
|
+
function readShebang(command) {
|
|
268
|
+
const size = 150;
|
|
269
|
+
const buffer = Buffer.alloc(size);
|
|
270
|
+
let fd;
|
|
271
|
+
try {
|
|
272
|
+
fd = fs.openSync(command, "r");
|
|
273
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
274
|
+
fs.closeSync(fd);
|
|
275
|
+
} catch (e) {}
|
|
276
|
+
return shebangCommand(buffer.toString());
|
|
277
|
+
}
|
|
278
|
+
module.exports = readShebang;
|
|
279
|
+
}));
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
282
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
283
|
+
const path = __require("path");
|
|
284
|
+
const resolveCommand = require_resolveCommand();
|
|
285
|
+
const escape = require_escape();
|
|
286
|
+
const readShebang = require_readShebang();
|
|
287
|
+
const isWin = process.platform === "win32";
|
|
288
|
+
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
289
|
+
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
290
|
+
function detectShebang(parsed) {
|
|
291
|
+
parsed.file = resolveCommand(parsed);
|
|
292
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
293
|
+
if (shebang) {
|
|
294
|
+
parsed.args.unshift(parsed.file);
|
|
295
|
+
parsed.command = shebang;
|
|
296
|
+
return resolveCommand(parsed);
|
|
297
|
+
}
|
|
298
|
+
return parsed.file;
|
|
299
|
+
}
|
|
300
|
+
function parseNonShell(parsed) {
|
|
301
|
+
if (!isWin) return parsed;
|
|
302
|
+
const commandFile = detectShebang(parsed);
|
|
303
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
304
|
+
if (parsed.options.forceShell || needsShell) {
|
|
305
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
306
|
+
parsed.command = path.normalize(parsed.command);
|
|
307
|
+
parsed.command = escape.command(parsed.command);
|
|
308
|
+
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
309
|
+
parsed.args = [
|
|
310
|
+
"/d",
|
|
311
|
+
"/s",
|
|
312
|
+
"/c",
|
|
313
|
+
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
314
|
+
];
|
|
315
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
316
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
317
|
+
}
|
|
318
|
+
return parsed;
|
|
319
|
+
}
|
|
320
|
+
function parse(command, args, options) {
|
|
321
|
+
if (args && !Array.isArray(args)) {
|
|
322
|
+
options = args;
|
|
323
|
+
args = null;
|
|
324
|
+
}
|
|
325
|
+
args = args ? args.slice(0) : [];
|
|
326
|
+
options = Object.assign({}, options);
|
|
327
|
+
const parsed = {
|
|
328
|
+
command,
|
|
329
|
+
args,
|
|
330
|
+
options,
|
|
331
|
+
file: void 0,
|
|
332
|
+
original: {
|
|
333
|
+
command,
|
|
334
|
+
args
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
338
|
+
}
|
|
339
|
+
module.exports = parse;
|
|
340
|
+
}));
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
343
|
+
var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
344
|
+
const isWin = process.platform === "win32";
|
|
345
|
+
function notFoundError(original, syscall) {
|
|
346
|
+
return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
|
|
347
|
+
code: "ENOENT",
|
|
348
|
+
errno: "ENOENT",
|
|
349
|
+
syscall: `${syscall} ${original.command}`,
|
|
350
|
+
path: original.command,
|
|
351
|
+
spawnargs: original.args
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function hookChildProcess(cp, parsed) {
|
|
355
|
+
if (!isWin) return;
|
|
356
|
+
const originalEmit = cp.emit;
|
|
357
|
+
cp.emit = function(name, arg1) {
|
|
358
|
+
if (name === "exit") {
|
|
359
|
+
const err = verifyENOENT(arg1, parsed);
|
|
360
|
+
if (err) return originalEmit.call(cp, "error", err);
|
|
361
|
+
}
|
|
362
|
+
return originalEmit.apply(cp, arguments);
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function verifyENOENT(status, parsed) {
|
|
366
|
+
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
function verifyENOENTSync(status, parsed) {
|
|
370
|
+
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
module.exports = {
|
|
374
|
+
hookChildProcess,
|
|
375
|
+
verifyENOENT,
|
|
376
|
+
verifyENOENTSync,
|
|
377
|
+
notFoundError
|
|
378
|
+
};
|
|
379
|
+
}));
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
382
|
+
var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
383
|
+
const cp = __require("child_process");
|
|
384
|
+
const parse = require_parse();
|
|
385
|
+
const enoent = require_enoent();
|
|
386
|
+
function spawn(command, args, options) {
|
|
387
|
+
const parsed = parse(command, args, options);
|
|
388
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
389
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
390
|
+
return spawned;
|
|
391
|
+
}
|
|
392
|
+
function spawnSync(command, args, options) {
|
|
393
|
+
const parsed = parse(command, args, options);
|
|
394
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
395
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
396
|
+
return result;
|
|
397
|
+
}
|
|
398
|
+
module.exports = spawn;
|
|
399
|
+
module.exports.spawn = spawn;
|
|
400
|
+
module.exports.sync = spawnSync;
|
|
401
|
+
module.exports._parse = parse;
|
|
402
|
+
module.exports._enoent = enoent;
|
|
403
|
+
}));
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/utils/command.ts
|
|
406
|
+
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
407
|
+
function exitCodeFromClose(code, signal) {
|
|
408
|
+
if (code !== null) return code;
|
|
409
|
+
const signalNumber = signal && constants.signals[signal];
|
|
410
|
+
return signalNumber ? 128 + signalNumber : 1;
|
|
411
|
+
}
|
|
412
|
+
async function runCommandSilently(options) {
|
|
413
|
+
const child = (0, import_cross_spawn.default)(options.command, options.args, {
|
|
414
|
+
stdio: [
|
|
415
|
+
"ignore",
|
|
416
|
+
"pipe",
|
|
417
|
+
"pipe"
|
|
418
|
+
],
|
|
419
|
+
cwd: options.cwd,
|
|
420
|
+
env: options.envs
|
|
421
|
+
});
|
|
422
|
+
return await new Promise((resolve, reject) => {
|
|
423
|
+
const stdout = [];
|
|
424
|
+
const stderr = [];
|
|
425
|
+
let timedOut = false;
|
|
426
|
+
const timer = options.timeoutMs === void 0 ? void 0 : setTimeout(() => {
|
|
427
|
+
timedOut = true;
|
|
428
|
+
child.kill("SIGKILL");
|
|
429
|
+
}, options.timeoutMs);
|
|
430
|
+
timer?.unref();
|
|
431
|
+
child.stdout?.on("data", (data) => {
|
|
432
|
+
stdout.push(data);
|
|
433
|
+
});
|
|
434
|
+
child.stderr?.on("data", (data) => {
|
|
435
|
+
stderr.push(data);
|
|
436
|
+
});
|
|
437
|
+
child.on("close", (code, signal) => {
|
|
438
|
+
clearTimeout(timer);
|
|
439
|
+
if (timedOut) {
|
|
440
|
+
reject(/* @__PURE__ */ new Error(`Command timed out after ${options.timeoutMs}ms: ${options.command}`));
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
resolve({
|
|
444
|
+
exitCode: exitCodeFromClose(code, signal),
|
|
445
|
+
stdout: Buffer.concat(stdout),
|
|
446
|
+
stderr: Buffer.concat(stderr)
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
child.on("error", (err) => {
|
|
450
|
+
clearTimeout(timer);
|
|
451
|
+
reject(err);
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
async function runCommand(options) {
|
|
456
|
+
const child = (0, import_cross_spawn.default)(options.command, options.args, {
|
|
457
|
+
stdio: "inherit",
|
|
458
|
+
cwd: options.cwd,
|
|
459
|
+
env: options.envs
|
|
460
|
+
});
|
|
461
|
+
return new Promise((resolve, reject) => {
|
|
462
|
+
child.on("close", (code, signal) => {
|
|
463
|
+
resolve({ exitCode: exitCodeFromClose(code, signal) });
|
|
464
|
+
});
|
|
465
|
+
child.on("error", (err) => {
|
|
466
|
+
reject(err);
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
//#endregion
|
|
471
|
+
export { runCommandSilently as n, require_cross_spawn as r, runCommand as t };
|
package/dist/config/bin.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
1
|
+
import { t as renderCliDoc } from "../help-BmKpeOP9.js";
|
|
2
|
+
import { i as log, o as printHeader } from "../terminal-MKGAuy-p.js";
|
|
3
|
+
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-DF3yU-eU.js";
|
|
3
4
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
4
|
-
import {
|
|
5
|
+
import { o as updateExistingAgentInstructions } from "../agent-Wqx0MPk0.js";
|
|
6
|
+
import { c as isHooksUserDisabled, l as resolveHooksLocation, o as install, s as isGitHooksEnvDisabled } from "../hooks-DFqViZqZ.js";
|
|
5
7
|
import { join } from "node:path";
|
|
6
8
|
import { existsSync } from "node:fs";
|
|
7
9
|
//#region src/config/bin.ts
|
|
@@ -25,7 +27,7 @@ async function main() {
|
|
|
25
27
|
rows: [
|
|
26
28
|
{
|
|
27
29
|
label: "--hooks-dir <path>",
|
|
28
|
-
description: "Custom hooks directory (default: .vite-hooks)"
|
|
30
|
+
description: "Custom hooks directory (default: .vite-hooks, or last used in this clone)"
|
|
29
31
|
},
|
|
30
32
|
{
|
|
31
33
|
label: "--no-hooks",
|
|
@@ -59,17 +61,29 @@ async function main() {
|
|
|
59
61
|
const lifecycleEvent = process.env.npm_lifecycle_event;
|
|
60
62
|
const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
|
|
61
63
|
const root = process.cwd();
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
if (!skipHooks && isGitHooksEnvDisabled()) log("skip install (git hooks disabled)");
|
|
65
|
+
else if (!skipHooks) {
|
|
66
|
+
const location = resolveHooksLocation(dir);
|
|
67
|
+
if ("isError" in location) {
|
|
68
|
+
if (location.message) log(location.message);
|
|
69
|
+
if (location.isError) process.exit(1);
|
|
70
|
+
} else {
|
|
71
|
+
const isFirstHooksRun = !existsSync(join(location.baseDir, location.dir, "_", "pre-commit"));
|
|
72
|
+
let shouldSetupHooks = true;
|
|
73
|
+
if (isHooksUserDisabled()) {
|
|
74
|
+
log("skip install (hooks disabled; run `vp hooks enable` to re-enable)");
|
|
75
|
+
shouldSetupHooks = false;
|
|
76
|
+
} else if (interactive && isFirstHooksRun && !dir && !isLifecycleScript) shouldSetupHooks = await promptGitHooks({
|
|
77
|
+
interactive,
|
|
78
|
+
message: "Install the Git hook dispatcher for this project?"
|
|
79
|
+
});
|
|
80
|
+
if (shouldSetupHooks) {
|
|
81
|
+
const { message, isError } = install(dir);
|
|
82
|
+
if (message) {
|
|
83
|
+
log(message);
|
|
84
|
+
if (isError) process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
73
87
|
}
|
|
74
88
|
}
|
|
75
89
|
if (!skipAgent) updateExistingAgentInstructions(root);
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
//#region package.json
|
|
3
|
-
var version = "0.
|
|
3
|
+
var version = "0.3.0";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/utils/constants.ts
|
|
6
6
|
const VITE_PLUS_NAME = "vite-plus";
|
|
7
7
|
const VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
8
|
-
const
|
|
8
|
+
const VITE_CONFIG_FILES = [
|
|
9
|
+
"vite.config.js",
|
|
10
|
+
"vite.config.mjs",
|
|
11
|
+
"vite.config.ts",
|
|
12
|
+
"vite.config.cjs",
|
|
13
|
+
"vite.config.mts",
|
|
14
|
+
"vite.config.cts"
|
|
15
|
+
];
|
|
16
|
+
const VITEST_VERSION = "4.1.11";
|
|
17
|
+
const TSDOWN_MIGRATE_VERSION = "0.23.0-rc.0";
|
|
18
|
+
const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
|
|
9
19
|
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
10
20
|
vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
|
|
11
21
|
vitest: VITEST_VERSION
|
|
@@ -67,4 +77,4 @@ const DEFAULT_ENVS = {
|
|
|
67
77
|
};
|
|
68
78
|
const CONFIG_METADATA_ENV = "VP_RESOLVING_CONFIG_METADATA";
|
|
69
79
|
//#endregion
|
|
70
|
-
export {
|
|
80
|
+
export { version as _, TSDOWN_MIGRATE_VERSION as a, VITEST_VERSION as c, VITE_PLUS_OVERRIDE_PACKAGES as d, VITE_PLUS_VERSION as f, resolveBundled as g, resolve as h, DEFAULT_ENVS as i, VITE_CONFIG_FILES as l, isForceOverrideMode as m, BASEURL_TSCONFIG_WARNING as n, TSDOWN_MIGRATION_SKILL_URL as o, createBaseUrlTsconfigFixArgs as p, CONFIG_METADATA_ENV as r, VITEST_AGE_GATE_EXEMPT_PACKAGES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_NAME as u };
|