vite-plus 0.2.7 → 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/LICENSE +5 -1
- package/README.md +9 -3
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +106 -11
- package/dist/agent-DQU8uS6P.js +416 -0
- package/dist/bin.js +1388 -23
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +32 -133
- package/dist/{constants-BsuzPowC.js → constants-CG513DRa.js} +10 -2
- package/dist/create/bin.js +255 -268
- package/dist/{define-config-C2KfLHpC.js → define-config-CV4bQG_8.js} +3 -3
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- package/dist/{define-config-DLh9fE95.cjs → define-config-DyNLA_f0.cjs} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CKz3vcoG.js → dist-BDYZP12R.js} +196 -157
- package/dist/dist-Dqv1-Clg.js +3 -0
- package/dist/{agent-CPwWJ4qf.js → editor-g4PosU99.js} +819 -628
- 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.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-DiRs8ceZ.js → json-qlK6UH0r.js} +40 -38
- package/dist/migration/bin.js +65 -58
- package/dist/{oxlint-plugin-config-Bxgc4cwF.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-Ds3uThLb.js → package-B4T8RGMG.js} +2 -2
- package/dist/{tsconfig-Jia2vgMG.js → prompts-CHz_98bJ.js} +169 -219
- package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-Dmeyeyj-.js} +2 -9
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +241 -226
- package/dist/terminal-Bz-ps6rJ.js +128 -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-7v_BHagU.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-CbDReEOx.js} +5 -3
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +6 -6
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +6 -6
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/ci.md +37 -4
- package/docs/guide/commit-hooks.md +112 -21
- package/docs/guide/create.md +7 -4
- package/docs/guide/env.md +8 -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 +4 -2
- package/docs/guide/install.md +27 -0
- package/docs/guide/installer-env-vars.md +14 -3
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate.md +49 -4
- package/docs/guide/monorepo.md +98 -10
- package/docs/guide/troubleshooting.md +12 -3
- 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 +21 -23
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-BbT1lTNc.js +0 -675
- package/dist/help-YP84FSEz.js +0 -61
- package/dist/terminal-uTv0ZaMr.js +0 -33
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
package/dist/staged/bin.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { a as resolveViteConfig } from "../resolve-vite-config-
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
|
+
import { i as log, l as renderCliDoc, n as errorMsg, o as printHeader } from "../terminal-Bz-ps6rJ.js";
|
|
3
|
+
import { a as resolveViteConfig } from "../resolve-vite-config-Dmeyeyj-.js";
|
|
4
4
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
5
|
-
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
6
5
|
import { createRequire } from "node:module";
|
|
7
6
|
import path, { basename, delimiter, dirname, normalize, resolve } from "node:path";
|
|
8
|
-
import {
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
9
8
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
9
|
+
import { closeSync, constants, openSync, readSync, statSync } from "node:fs";
|
|
10
|
+
import { EOL } from "node:os";
|
|
10
11
|
import { cwd } from "node:process";
|
|
11
12
|
import l__default from "node:readline";
|
|
12
13
|
import nodeTty from "node:tty";
|
|
13
14
|
import crypto from "node:crypto";
|
|
14
|
-
import {
|
|
15
|
-
import { EOL } from "node:os";
|
|
16
|
-
import fsPromises, { constants as constants$1 } from "node:fs/promises";
|
|
15
|
+
import fsPromises, { constants as constants$2 } from "node:fs/promises";
|
|
17
16
|
import { PassThrough, Writable } from "node:stream";
|
|
18
17
|
import { exec, spawn } from "node:child_process";
|
|
19
18
|
import { pipeline } from "node:stream/promises";
|
|
@@ -118,201 +117,212 @@ const createDebug = (name) => {
|
|
|
118
117
|
};
|
|
119
118
|
};
|
|
120
119
|
//#endregion
|
|
121
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.
|
|
122
|
-
const
|
|
123
|
-
const
|
|
120
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
|
|
121
|
+
const isPathLikePattern = /^path$/i;
|
|
122
|
+
const defaultEnvPathInfo = {
|
|
124
123
|
key: "PATH",
|
|
125
124
|
value: ""
|
|
126
125
|
};
|
|
127
|
-
function
|
|
128
|
-
for (const
|
|
129
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
130
|
-
const
|
|
131
|
-
if (!
|
|
126
|
+
function getPathFromEnv(env) {
|
|
127
|
+
for (const key in env) {
|
|
128
|
+
if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
|
|
129
|
+
const value = env[key];
|
|
130
|
+
if (!value) return defaultEnvPathInfo;
|
|
132
131
|
return {
|
|
133
|
-
key
|
|
134
|
-
value
|
|
132
|
+
key,
|
|
133
|
+
value
|
|
135
134
|
};
|
|
136
135
|
}
|
|
137
|
-
return
|
|
136
|
+
return defaultEnvPathInfo;
|
|
138
137
|
}
|
|
139
|
-
function
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
let
|
|
143
|
-
let
|
|
138
|
+
function addNodeBinToPath(cwd, path) {
|
|
139
|
+
const parts = path.value.split(delimiter);
|
|
140
|
+
const nodeBinPaths = [];
|
|
141
|
+
let currentPath = cwd;
|
|
142
|
+
let lastPath;
|
|
144
143
|
do {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} while (
|
|
149
|
-
|
|
150
|
-
const
|
|
144
|
+
nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
|
|
145
|
+
lastPath = currentPath;
|
|
146
|
+
currentPath = dirname(currentPath);
|
|
147
|
+
} while (currentPath !== lastPath);
|
|
148
|
+
nodeBinPaths.push(dirname(process.execPath));
|
|
149
|
+
const newPath = nodeBinPaths.concat(parts).join(delimiter);
|
|
151
150
|
return {
|
|
152
|
-
key:
|
|
153
|
-
value:
|
|
151
|
+
key: path.key,
|
|
152
|
+
value: newPath
|
|
154
153
|
};
|
|
155
154
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
155
|
+
function computeEnv(cwd, env, nodePath = true) {
|
|
156
|
+
const envWithDefault = {
|
|
158
157
|
...process.env,
|
|
159
|
-
...
|
|
158
|
+
...env
|
|
160
159
|
};
|
|
161
|
-
if (!
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
return
|
|
160
|
+
if (!nodePath) return envWithDefault;
|
|
161
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
162
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
163
|
+
return envWithDefault;
|
|
165
164
|
}
|
|
166
|
-
const
|
|
167
|
-
let
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
if (--
|
|
165
|
+
const combineStreams = (streams) => {
|
|
166
|
+
let streamCount = streams.length;
|
|
167
|
+
const combined = new PassThrough();
|
|
168
|
+
const maybeEmitEnd = () => {
|
|
169
|
+
if (--streamCount === 0) combined.end();
|
|
171
170
|
};
|
|
172
|
-
for (const
|
|
173
|
-
return
|
|
171
|
+
for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
|
|
172
|
+
return combined;
|
|
174
173
|
};
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
const
|
|
174
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
175
|
+
const shebangRegExp = /^#!\s*(.+)/;
|
|
176
|
+
const isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
|
|
177
|
+
const isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
178
|
+
const isWindows$1 = process.platform === "win32";
|
|
179
|
+
const defaultPathExt = [
|
|
181
180
|
".EXE",
|
|
182
181
|
".CMD",
|
|
183
182
|
".BAT",
|
|
184
183
|
".COM"
|
|
185
184
|
];
|
|
185
|
+
const noPathExt = [""];
|
|
186
186
|
/**
|
|
187
187
|
* Normalizes the command and arguments to work cross-platform.
|
|
188
188
|
* On Windows, this basically handles things like shebangs, calling
|
|
189
189
|
* `node_modules/.bin` commands, and escaping meta characters.
|
|
190
190
|
* On other platforms, it just returns the command and arguments as-is.
|
|
191
191
|
*/
|
|
192
|
-
function
|
|
193
|
-
if (
|
|
194
|
-
command
|
|
195
|
-
args
|
|
196
|
-
options
|
|
192
|
+
function normalizeSpawnCommand(command, args = [], options = {}) {
|
|
193
|
+
if (options.shell === true || !isWindows$1) return {
|
|
194
|
+
command,
|
|
195
|
+
args,
|
|
196
|
+
options
|
|
197
197
|
};
|
|
198
|
-
let
|
|
199
|
-
let
|
|
200
|
-
if (
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
let
|
|
198
|
+
let file = resolveCommand(command, options);
|
|
199
|
+
let shebang = null;
|
|
200
|
+
if (file !== null) {
|
|
201
|
+
const size = 150;
|
|
202
|
+
const buffer = Buffer.alloc(size);
|
|
203
|
+
let fd = null;
|
|
204
204
|
try {
|
|
205
|
-
|
|
206
|
-
readSync(
|
|
205
|
+
fd = openSync(file, "r");
|
|
206
|
+
readSync(fd, buffer, 0, size, 0);
|
|
207
207
|
} catch {} finally {
|
|
208
|
-
if (
|
|
208
|
+
if (fd !== null) closeSync(fd);
|
|
209
209
|
}
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
const
|
|
217
|
-
|
|
210
|
+
const match = buffer.toString().match(shebangRegExp);
|
|
211
|
+
if (match !== null) {
|
|
212
|
+
const line = match[1].trim();
|
|
213
|
+
const separatorIndex = line.indexOf(" ");
|
|
214
|
+
const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
|
|
215
|
+
const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
|
|
216
|
+
const binary = basename(path);
|
|
217
|
+
shebang = binary === "env" ? argument || null : binary;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
if (
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (
|
|
235
|
-
return
|
|
220
|
+
if (shebang !== null && file !== null) {
|
|
221
|
+
args = [file, ...args];
|
|
222
|
+
command = shebang;
|
|
223
|
+
file = resolveCommand(command, options);
|
|
224
|
+
}
|
|
225
|
+
if (file === null || !isWindowsExecutableRegExp.test(file)) {
|
|
226
|
+
const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
|
|
227
|
+
command = normalize(command);
|
|
228
|
+
command = command.replace(metaCharsRegExp, "^$1");
|
|
229
|
+
args = args.map((arg) => {
|
|
230
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
231
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
232
|
+
arg = `"${arg}"`;
|
|
233
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
234
|
+
if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
235
|
+
return arg;
|
|
236
236
|
});
|
|
237
|
-
|
|
237
|
+
args = [
|
|
238
238
|
"/d",
|
|
239
239
|
"/s",
|
|
240
240
|
"/c",
|
|
241
|
-
`"${[
|
|
241
|
+
`"${[command, ...args].join(" ")}"`
|
|
242
242
|
];
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
...
|
|
243
|
+
command = options.env?.comspec ?? "cmd.exe";
|
|
244
|
+
options = {
|
|
245
|
+
...options,
|
|
246
246
|
windowsVerbatimArguments: true
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
return {
|
|
250
|
-
command
|
|
251
|
-
args
|
|
252
|
-
options
|
|
250
|
+
command,
|
|
251
|
+
args,
|
|
252
|
+
options
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
256
|
* Resolves the command to an absolute path if possible.
|
|
257
257
|
* Handles things like traversing PATH and adding extensions from PATHEXT
|
|
258
258
|
*/
|
|
259
|
-
function
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
if (
|
|
266
|
-
for (const
|
|
267
|
-
const
|
|
268
|
-
for (const
|
|
269
|
-
const
|
|
259
|
+
function resolveCommand(command, options) {
|
|
260
|
+
const cwd$3 = (options.cwd ?? cwd()).toString();
|
|
261
|
+
const env = options.env ?? process.env;
|
|
262
|
+
const PATH = getPathFromEnv(env).value;
|
|
263
|
+
const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
|
|
264
|
+
let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
|
|
265
|
+
if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
|
|
266
|
+
for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
|
|
267
|
+
const dest = resolve(cwd$3, path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path, command);
|
|
268
|
+
for (const ext of extensions) {
|
|
269
|
+
const destWithExt = dest + ext;
|
|
270
270
|
try {
|
|
271
|
-
if (statSync(
|
|
271
|
+
if (statSync(destWithExt).isFile()) return destWithExt;
|
|
272
272
|
} catch {}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
return null;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
277
|
+
var NonZeroExitError = class extends Error {
|
|
278
278
|
result;
|
|
279
279
|
output;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
280
|
+
exitCode;
|
|
281
|
+
get signalCode() {
|
|
282
|
+
return this.result.signalCode;
|
|
283
|
+
}
|
|
284
|
+
constructor(result, output, command, args) {
|
|
285
|
+
let target = "The process";
|
|
286
|
+
if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
|
|
287
|
+
const exitCode = result.exitCode ?? 1;
|
|
288
|
+
super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
|
|
289
|
+
this.result = result;
|
|
290
|
+
this.output = output;
|
|
291
|
+
this.exitCode = exitCode;
|
|
292
|
+
Object.defineProperty(this, "result", {
|
|
293
|
+
enumerable: false,
|
|
294
|
+
writable: false,
|
|
295
|
+
configurable: false
|
|
296
|
+
});
|
|
287
297
|
}
|
|
288
298
|
};
|
|
289
|
-
const
|
|
299
|
+
const defaultOptions = {
|
|
290
300
|
timeout: void 0,
|
|
291
301
|
persist: false
|
|
292
302
|
};
|
|
293
|
-
const
|
|
294
|
-
function
|
|
295
|
-
const
|
|
296
|
-
for (const
|
|
297
|
-
if (
|
|
298
|
-
|
|
299
|
-
return
|
|
303
|
+
const defaultNodeOptions = { windowsHide: true };
|
|
304
|
+
function combineSignals(signals) {
|
|
305
|
+
const controller = new AbortController();
|
|
306
|
+
for (const signal of signals) {
|
|
307
|
+
if (signal.aborted) {
|
|
308
|
+
controller.abort();
|
|
309
|
+
return signal;
|
|
300
310
|
}
|
|
301
|
-
const
|
|
302
|
-
|
|
311
|
+
const onAbort = () => {
|
|
312
|
+
controller.abort(signal.reason);
|
|
303
313
|
};
|
|
304
|
-
|
|
314
|
+
signal.addEventListener("abort", onAbort, { signal: controller.signal });
|
|
305
315
|
}
|
|
306
|
-
return
|
|
316
|
+
return controller.signal;
|
|
307
317
|
}
|
|
308
|
-
async function
|
|
309
|
-
let
|
|
318
|
+
async function readStream(stream) {
|
|
319
|
+
let output = "";
|
|
310
320
|
try {
|
|
311
|
-
for await (const
|
|
321
|
+
for await (const chunk of stream) output += chunk.toString();
|
|
312
322
|
} catch {}
|
|
313
|
-
return
|
|
323
|
+
return output;
|
|
314
324
|
}
|
|
315
|
-
var
|
|
325
|
+
var ExecProcess = class {
|
|
316
326
|
_process;
|
|
317
327
|
_aborted = false;
|
|
318
328
|
_options;
|
|
@@ -330,19 +340,22 @@ var I = class {
|
|
|
330
340
|
get exitCode() {
|
|
331
341
|
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
332
342
|
}
|
|
333
|
-
|
|
343
|
+
get signalCode() {
|
|
344
|
+
return this._process?.signalCode ?? null;
|
|
345
|
+
}
|
|
346
|
+
constructor(command, args, options) {
|
|
334
347
|
this._options = {
|
|
335
|
-
...
|
|
336
|
-
...
|
|
348
|
+
...defaultOptions,
|
|
349
|
+
...options
|
|
337
350
|
};
|
|
338
|
-
this._command =
|
|
339
|
-
this._args =
|
|
340
|
-
this._processClosed = new Promise((
|
|
341
|
-
this._resolveClose =
|
|
351
|
+
this._command = command;
|
|
352
|
+
this._args = args ?? [];
|
|
353
|
+
this._processClosed = new Promise((resolve) => {
|
|
354
|
+
this._resolveClose = resolve;
|
|
342
355
|
});
|
|
343
356
|
}
|
|
344
|
-
kill(
|
|
345
|
-
return this._process?.kill(
|
|
357
|
+
kill(signal) {
|
|
358
|
+
return this._process?.kill(signal) === true;
|
|
346
359
|
}
|
|
347
360
|
get aborted() {
|
|
348
361
|
return this._aborted;
|
|
@@ -350,99 +363,99 @@ var I = class {
|
|
|
350
363
|
get killed() {
|
|
351
364
|
return this._process?.killed === true;
|
|
352
365
|
}
|
|
353
|
-
pipe(
|
|
354
|
-
return
|
|
355
|
-
...
|
|
366
|
+
pipe(command, args, options) {
|
|
367
|
+
return exec$1(command, args, {
|
|
368
|
+
...options,
|
|
356
369
|
stdin: this
|
|
357
370
|
});
|
|
358
371
|
}
|
|
359
372
|
async *[Symbol.asyncIterator]() {
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
362
|
-
const
|
|
363
|
-
if (this._streamErr)
|
|
364
|
-
if (this._streamOut)
|
|
365
|
-
const
|
|
366
|
-
const
|
|
367
|
-
for await (const
|
|
373
|
+
const proc = this._process;
|
|
374
|
+
if (!proc) return;
|
|
375
|
+
const streams = [];
|
|
376
|
+
if (this._streamErr) streams.push(this._streamErr);
|
|
377
|
+
if (this._streamOut) streams.push(this._streamOut);
|
|
378
|
+
const streamCombined = combineStreams(streams);
|
|
379
|
+
const rl = l__default.createInterface({ input: streamCombined });
|
|
380
|
+
for await (const chunk of rl) yield chunk.toString();
|
|
368
381
|
await this._processClosed;
|
|
369
|
-
|
|
382
|
+
proc.removeAllListeners();
|
|
370
383
|
if (this._thrownError) throw this._thrownError;
|
|
371
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
384
|
+
if (this._options?.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, void 0, this._command, this._args);
|
|
372
385
|
}
|
|
373
386
|
async _waitForOutput() {
|
|
374
|
-
const
|
|
375
|
-
if (!
|
|
376
|
-
const [
|
|
387
|
+
const proc = this._process;
|
|
388
|
+
if (!proc) throw new Error("No process was started");
|
|
389
|
+
const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
|
|
377
390
|
await this._processClosed;
|
|
378
|
-
const { stdin
|
|
379
|
-
if (
|
|
380
|
-
|
|
391
|
+
const { stdin } = this._options;
|
|
392
|
+
if (stdin && typeof stdin !== "string") await stdin;
|
|
393
|
+
proc.removeAllListeners();
|
|
381
394
|
if (this._thrownError) throw this._thrownError;
|
|
382
|
-
const
|
|
383
|
-
stderr
|
|
384
|
-
stdout
|
|
395
|
+
const result = {
|
|
396
|
+
stderr,
|
|
397
|
+
stdout,
|
|
385
398
|
exitCode: this.exitCode
|
|
386
399
|
};
|
|
387
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
388
|
-
return
|
|
400
|
+
if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
|
|
401
|
+
return result;
|
|
389
402
|
}
|
|
390
|
-
then(
|
|
391
|
-
return this._waitForOutput().then(
|
|
403
|
+
then(onfulfilled, onrejected) {
|
|
404
|
+
return this._waitForOutput().then(onfulfilled, onrejected);
|
|
392
405
|
}
|
|
393
406
|
_streamOut;
|
|
394
407
|
_streamErr;
|
|
395
408
|
spawn() {
|
|
396
|
-
const
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
...
|
|
400
|
-
...
|
|
409
|
+
const cwd$1 = cwd();
|
|
410
|
+
const options = this._options;
|
|
411
|
+
const nodeOptions = {
|
|
412
|
+
...defaultNodeOptions,
|
|
413
|
+
...options.nodeOptions
|
|
401
414
|
};
|
|
402
|
-
const
|
|
415
|
+
const signals = [];
|
|
403
416
|
this._resetState();
|
|
404
|
-
if (
|
|
405
|
-
if (
|
|
406
|
-
if (
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
const
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
if (
|
|
413
|
-
this._process =
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (
|
|
417
|
-
const { stdin
|
|
418
|
-
if (typeof
|
|
419
|
-
else
|
|
417
|
+
if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
418
|
+
if (options.signal !== void 0) signals.push(options.signal);
|
|
419
|
+
if (options.persist === true) nodeOptions.detached = true;
|
|
420
|
+
if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
|
|
421
|
+
nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
|
|
422
|
+
const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
|
|
423
|
+
const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
|
|
424
|
+
if (handle.stderr) this._streamErr = handle.stderr;
|
|
425
|
+
if (handle.stdout) this._streamOut = handle.stdout;
|
|
426
|
+
this._process = handle;
|
|
427
|
+
handle.once("error", this._onError);
|
|
428
|
+
handle.once("close", this._onClose);
|
|
429
|
+
if (handle.stdin) {
|
|
430
|
+
const { stdin } = options;
|
|
431
|
+
if (typeof stdin === "string") handle.stdin.end(stdin);
|
|
432
|
+
else stdin?.process?.stdout?.pipe(handle.stdin);
|
|
420
433
|
}
|
|
421
434
|
}
|
|
422
435
|
_resetState() {
|
|
423
436
|
this._aborted = false;
|
|
424
|
-
this._processClosed = new Promise((
|
|
425
|
-
this._resolveClose =
|
|
437
|
+
this._processClosed = new Promise((resolve) => {
|
|
438
|
+
this._resolveClose = resolve;
|
|
426
439
|
});
|
|
427
440
|
this._thrownError = void 0;
|
|
428
441
|
}
|
|
429
|
-
_onError = (
|
|
430
|
-
if (
|
|
442
|
+
_onError = (err) => {
|
|
443
|
+
if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
|
|
431
444
|
this._aborted = true;
|
|
432
445
|
return;
|
|
433
446
|
}
|
|
434
|
-
this._thrownError =
|
|
447
|
+
this._thrownError = err;
|
|
435
448
|
};
|
|
436
449
|
_onClose = () => {
|
|
437
450
|
if (this._resolveClose) this._resolveClose();
|
|
438
451
|
};
|
|
439
452
|
};
|
|
440
|
-
const
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
return
|
|
453
|
+
const x = (command, args, userOptions) => {
|
|
454
|
+
const proc = new ExecProcess(command, args, userOptions);
|
|
455
|
+
proc.spawn();
|
|
456
|
+
return proc;
|
|
444
457
|
};
|
|
445
|
-
const
|
|
458
|
+
const exec$1 = x;
|
|
446
459
|
//#endregion
|
|
447
460
|
//#region ../../node_modules/.pnpm/lint-staged@16.4.0/node_modules/lint-staged/lib/execGit.js
|
|
448
461
|
const debugLog$15 = createDebug("lint-staged:execGit");
|
|
@@ -457,7 +470,7 @@ const NO_SUBMODULE_RECURSE = ["-c", "submodule.recurse=false"];
|
|
|
457
470
|
/** @type {(cmd: string[], options?: { cwd?: string }) => Promise<string>} */
|
|
458
471
|
const execGit = async (cmd, options) => {
|
|
459
472
|
debugLog$15("Running git command:", cmd);
|
|
460
|
-
const result =
|
|
473
|
+
const result = exec$1("git", [...NO_SUBMODULE_RECURSE, ...cmd], { nodeOptions: {
|
|
461
474
|
cwd: options?.cwd,
|
|
462
475
|
stdio: ["ignore"]
|
|
463
476
|
} });
|
|
@@ -1545,8 +1558,8 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1545
1558
|
this.logger.options.color = this.options.color;
|
|
1546
1559
|
}
|
|
1547
1560
|
async render() {
|
|
1548
|
-
const { createLogUpdate } = await import("../log-update-
|
|
1549
|
-
const { default: truncate } = await import("../cli-truncate-
|
|
1561
|
+
const { createLogUpdate } = await import("../log-update-CoW8Z4Dl.js");
|
|
1562
|
+
const { default: truncate } = await import("../cli-truncate-Bg3RDXpi.js");
|
|
1550
1563
|
const { default: wrap } = await import("../wrap-ansi-DUi52C6W.js");
|
|
1551
1564
|
this.updater = createLogUpdate(this.logger.process.stdout);
|
|
1552
1565
|
this.truncate = truncate;
|
|
@@ -1753,9 +1766,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1753
1766
|
});
|
|
1754
1767
|
task.on(ListrTaskEventType.STATE, (state) => {
|
|
1755
1768
|
switch (state) {
|
|
1756
|
-
case ListrTaskState.RETRY || ListrTaskState.ROLLING_BACK:
|
|
1757
|
-
this.buffer.bottom.delete(task.id);
|
|
1758
|
-
break;
|
|
1769
|
+
case ListrTaskState.RETRY || ListrTaskState.ROLLING_BACK: this.buffer.bottom.delete(task.id);
|
|
1759
1770
|
}
|
|
1760
1771
|
});
|
|
1761
1772
|
} else if (this.shouldOutputToOutputBar(task) && !this.buffer.output.has(task.id)) {
|
|
@@ -1765,9 +1776,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1765
1776
|
});
|
|
1766
1777
|
task.on(ListrTaskEventType.STATE, (state) => {
|
|
1767
1778
|
switch (state) {
|
|
1768
|
-
case ListrTaskState.RETRY || ListrTaskState.ROLLING_BACK:
|
|
1769
|
-
this.buffer.output.delete(task.id);
|
|
1770
|
-
break;
|
|
1779
|
+
case ListrTaskState.RETRY || ListrTaskState.ROLLING_BACK: this.buffer.output.delete(task.id);
|
|
1771
1780
|
}
|
|
1772
1781
|
});
|
|
1773
1782
|
}
|
|
@@ -3012,7 +3021,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3012
3021
|
};
|
|
3013
3022
|
module.exports = {
|
|
3014
3023
|
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
3015
|
-
MAX_LENGTH:
|
|
3024
|
+
MAX_LENGTH: 65536,
|
|
3016
3025
|
POSIX_REGEX_SOURCE: {
|
|
3017
3026
|
__proto__: null,
|
|
3018
3027
|
alnum: "a-zA-Z0-9",
|
|
@@ -3891,10 +3900,12 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3891
3900
|
}
|
|
3892
3901
|
return esc ? m : `\\${m}`;
|
|
3893
3902
|
});
|
|
3894
|
-
if (backslashes === true)
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3903
|
+
if (backslashes === true) {
|
|
3904
|
+
if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
3905
|
+
else output = output.replace(/\\+/g, (m) => {
|
|
3906
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3898
3909
|
if (output === input && opts.contains === true) {
|
|
3899
3910
|
state.output = input;
|
|
3900
3911
|
return state;
|
|
@@ -4665,8 +4676,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4665
4676
|
output = format ? format(input) : input;
|
|
4666
4677
|
match = output === glob;
|
|
4667
4678
|
}
|
|
4668
|
-
if (match === false || opts.capture === true)
|
|
4669
|
-
|
|
4679
|
+
if (match === false || opts.capture === true) {
|
|
4680
|
+
if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
|
|
4681
|
+
else match = regex.exec(output);
|
|
4682
|
+
}
|
|
4670
4683
|
return {
|
|
4671
4684
|
isMatch: Boolean(match),
|
|
4672
4685
|
match,
|
|
@@ -4898,13 +4911,14 @@ const generateTasks = ({ config, cwd = process.cwd(), files, relative = false })
|
|
|
4898
4911
|
}));
|
|
4899
4912
|
return Object.entries(config).map(([pattern, commands]) => {
|
|
4900
4913
|
const isParentDirPattern = pattern.startsWith("../");
|
|
4914
|
+
const includedFiles = relativeFiles.filter((file) => {
|
|
4915
|
+
if (isParentDirPattern) return true;
|
|
4916
|
+
return !file.filepath.startsWith("..") && !path.isAbsolute(file.filepath);
|
|
4917
|
+
});
|
|
4901
4918
|
const task = {
|
|
4902
4919
|
pattern,
|
|
4903
4920
|
commands,
|
|
4904
|
-
fileList: matchFiles(
|
|
4905
|
-
if (isParentDirPattern) return true;
|
|
4906
|
-
return !file.filepath.startsWith("..") && !path.isAbsolute(file.filepath);
|
|
4907
|
-
}), pattern, cwd).map((file) => ({
|
|
4921
|
+
fileList: matchFiles(includedFiles, pattern, cwd).map((file) => ({
|
|
4908
4922
|
filepath: normalizePath(relative ? file.filepath : path.resolve(cwd, file.filepath)),
|
|
4909
4923
|
status: file.status
|
|
4910
4924
|
}))
|
|
@@ -5105,7 +5119,7 @@ const getSpawnedTask = ({ abortController, color, command, continueOnError = fal
|
|
|
5105
5119
|
debugLog$12("Tinyexec options:", tinyExecOptions);
|
|
5106
5120
|
/** @param {ReturnType<typeof getInitialState>} ctx context */
|
|
5107
5121
|
return async (ctx = getInitialState()) => {
|
|
5108
|
-
const result =
|
|
5122
|
+
const result = exec$1(cmd, isFn ? args : args.concat(files), tinyExecOptions);
|
|
5109
5123
|
const taskFailed = () => result.exitCode > 0 || result.process?.signalCode;
|
|
5110
5124
|
/** @type {keyof typeof Signal | undefined} */
|
|
5111
5125
|
let signal;
|
|
@@ -5946,7 +5960,7 @@ const jsonParse = async (filename) => {
|
|
|
5946
5960
|
const yamlParse = async (filename) => {
|
|
5947
5961
|
const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
|
|
5948
5962
|
try {
|
|
5949
|
-
const [YAML, content] = await Promise.all([import("../dist-
|
|
5963
|
+
const [YAML, content] = await Promise.all([import("../dist-Dqv1-Clg.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
|
|
5950
5964
|
const yaml = YAML.parse(content);
|
|
5951
5965
|
return isPackageFile ? yaml[CONFIG_NAME] : yaml;
|
|
5952
5966
|
} catch (error) {
|
|
@@ -6206,7 +6220,7 @@ const listConfigFilesFromFs = async ({ cwd }) => {
|
|
|
6206
6220
|
debugLog$3("Listing possible configs from filesystem starting from \"%s\"...", cwd);
|
|
6207
6221
|
const possibleConfigFiles = (await Promise.allSettled(CONFIG_FILE_NAMES.map(async (f) => {
|
|
6208
6222
|
const filepath = path.join(cwd, f);
|
|
6209
|
-
await fsPromises.access(filepath, constants$
|
|
6223
|
+
await fsPromises.access(filepath, constants$2.F_OK);
|
|
6210
6224
|
return filepath;
|
|
6211
6225
|
}))).flatMap((r) => r.status === "fulfilled" ? [normalizePath(r.value)] : []);
|
|
6212
6226
|
if (possibleConfigFiles.length > 0) {
|
|
@@ -6752,7 +6766,8 @@ if (args.help) {
|
|
|
6752
6766
|
try {
|
|
6753
6767
|
stagedConfig = (await resolveViteConfig(args.cwd ?? process.cwd())).staged;
|
|
6754
6768
|
} catch (err) {
|
|
6755
|
-
|
|
6769
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
6770
|
+
log(`Failed to load vite.config: ${message}`);
|
|
6756
6771
|
process.exit(1);
|
|
6757
6772
|
}
|
|
6758
6773
|
if (stagedConfig) options.config = stagedConfig;
|