vite-plus 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -0
- package/README.md +9 -3
- package/binding/index.cjs +54 -54
- package/binding/index.d.cts +7 -3
- package/dist/{agent-CI79DuSy.js → agent-DQU8uS6P.js} +4 -188
- package/dist/bin.js +288 -278
- package/dist/config/bin.js +27 -15
- package/dist/{constants-BppDcRc1.js → constants-CG513DRa.js} +10 -2
- package/dist/create/bin.js +178 -204
- package/dist/{define-config-DPnHe1Mx.js → define-config-CV4bQG_8.js} +3 -3
- package/dist/{define-config-CEm_MtvJ.cjs → define-config-DyNLA_f0.cjs} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CSQWHI6y.js → dist-BDYZP12R.js} +193 -149
- package/dist/dist-Dqv1-Clg.js +3 -0
- package/dist/{editor-CGWdbLgD.js → editor-g4PosU99.js} +188 -108
- package/dist/hooks/bin.d.ts +1 -0
- package/dist/hooks/bin.js +130 -0
- package/dist/hooks-pNCBWtFT.js +570 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-BU88uu6o.js → json-qlK6UH0r.js} +38 -32
- package/dist/migration/bin.js +15 -18
- package/dist/{oxlint-plugin-config-BHOzlwMw.js → oxlint-plugin-config-BEZ9IUf7.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-hV-77cBb.js → package-B4T8RGMG.js} +2 -2
- package/dist/{prompts-DYap08te.js → prompts-CHz_98bJ.js} +142 -50
- package/dist/{resolve-vite-config-EWXclqvV.js → resolve-vite-config-Dmeyeyj-.js} +2 -9
- package/dist/staged/bin.js +224 -206
- package/dist/{terminal-CrqqK8WT.js → terminal-Bz-ps6rJ.js} +33 -3
- package/dist/test/browser/providers/playwright/context.d.ts +1 -1
- package/dist/test/browser/providers/playwright.d.ts +6 -6
- package/dist/test/browser/providers/preview/context.d.ts +1 -1
- package/dist/test/browser/providers/preview.d.ts +4 -4
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -1
- package/dist/test/browser/providers/webdriverio.d.ts +6 -6
- package/dist/test/browser-playwright/context.d.ts +1 -1
- package/dist/test/browser-playwright.d.ts +6 -6
- package/dist/test/browser-preview/context.d.ts +1 -1
- package/dist/test/browser-preview.d.ts +4 -4
- package/dist/test/browser-webdriverio/context.d.ts +1 -1
- package/dist/test/browser-webdriverio.d.ts +6 -6
- package/dist/test/context.d.ts +3 -3
- package/dist/test/locators.d.ts +1 -1
- package/dist/toolchain.d.ts +25 -0
- package/dist/toolchain.js +194 -0
- package/dist/toolchain.json +193 -0
- package/dist/{tsconfig-CVUKLfL8.js → tsconfig-7v_BHagU.js} +3 -3
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +4 -4
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +6 -6
- package/docs/guide/ci.md +37 -4
- package/docs/guide/commit-hooks.md +87 -14
- package/docs/guide/create.md +7 -4
- package/docs/guide/fmt.md +2 -2
- package/docs/guide/github-actions-cache.md +5 -1
- package/docs/guide/ide-integration.md +61 -2
- package/docs/guide/index.md +3 -1
- package/docs/guide/install.md +25 -0
- package/docs/guide/installer-env-vars.md +12 -1
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate.md +39 -2
- package/docs/guide/monorepo.md +4 -4
- package/docs/guide/troubleshooting.md +12 -4
- package/docs/guide/upgrade.md +27 -4
- package/docs/package.json +1 -1
- package/docs/pnpm-workspace.yaml +7 -0
- package/docs/vite.config.ts +3 -0
- package/package.json +18 -14
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-DT25H9pj.js +0 -3
- package/dist/{tsgolint-path-eMZT-oea.js → tsgolint-path-CbDReEOx.js} +1 -1
package/dist/staged/bin.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as resolveViteConfig } from "../resolve-vite-config-
|
|
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
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import path, { basename, delimiter, dirname, normalize, resolve } from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
7
8
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
8
9
|
import { closeSync, constants, openSync, readSync, statSync } from "node:fs";
|
|
9
10
|
import { EOL } from "node:os";
|
|
@@ -11,7 +12,6 @@ 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 { pathToFileURL } from "node:url";
|
|
15
15
|
import fsPromises, { constants as constants$2 } from "node:fs/promises";
|
|
16
16
|
import { PassThrough, Writable } from "node:stream";
|
|
17
17
|
import { exec, spawn } from "node:child_process";
|
|
@@ -117,201 +117,212 @@ const createDebug = (name) => {
|
|
|
117
117
|
};
|
|
118
118
|
};
|
|
119
119
|
//#endregion
|
|
120
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.
|
|
121
|
-
const
|
|
122
|
-
const
|
|
120
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
|
|
121
|
+
const isPathLikePattern = /^path$/i;
|
|
122
|
+
const defaultEnvPathInfo = {
|
|
123
123
|
key: "PATH",
|
|
124
124
|
value: ""
|
|
125
125
|
};
|
|
126
|
-
function
|
|
127
|
-
for (const
|
|
128
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
129
|
-
const
|
|
130
|
-
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;
|
|
131
131
|
return {
|
|
132
|
-
key
|
|
133
|
-
value
|
|
132
|
+
key,
|
|
133
|
+
value
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
return
|
|
136
|
+
return defaultEnvPathInfo;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
let
|
|
142
|
-
let
|
|
138
|
+
function addNodeBinToPath(cwd, path) {
|
|
139
|
+
const parts = path.value.split(delimiter);
|
|
140
|
+
const nodeBinPaths = [];
|
|
141
|
+
let currentPath = cwd;
|
|
142
|
+
let lastPath;
|
|
143
143
|
do {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} while (
|
|
148
|
-
|
|
149
|
-
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);
|
|
150
150
|
return {
|
|
151
|
-
key:
|
|
152
|
-
value:
|
|
151
|
+
key: path.key,
|
|
152
|
+
value: newPath
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
155
|
+
function computeEnv(cwd, env, nodePath = true) {
|
|
156
|
+
const envWithDefault = {
|
|
157
157
|
...process.env,
|
|
158
|
-
...
|
|
158
|
+
...env
|
|
159
159
|
};
|
|
160
|
-
if (!
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
return
|
|
160
|
+
if (!nodePath) return envWithDefault;
|
|
161
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
162
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
163
|
+
return envWithDefault;
|
|
164
164
|
}
|
|
165
|
-
const
|
|
166
|
-
let
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
if (--
|
|
165
|
+
const combineStreams = (streams) => {
|
|
166
|
+
let streamCount = streams.length;
|
|
167
|
+
const combined = new PassThrough();
|
|
168
|
+
const maybeEmitEnd = () => {
|
|
169
|
+
if (--streamCount === 0) combined.end();
|
|
170
170
|
};
|
|
171
|
-
for (const
|
|
172
|
-
return
|
|
171
|
+
for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
|
|
172
|
+
return combined;
|
|
173
173
|
};
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
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 = [
|
|
180
180
|
".EXE",
|
|
181
181
|
".CMD",
|
|
182
182
|
".BAT",
|
|
183
183
|
".COM"
|
|
184
184
|
];
|
|
185
|
+
const noPathExt = [""];
|
|
185
186
|
/**
|
|
186
187
|
* Normalizes the command and arguments to work cross-platform.
|
|
187
188
|
* On Windows, this basically handles things like shebangs, calling
|
|
188
189
|
* `node_modules/.bin` commands, and escaping meta characters.
|
|
189
190
|
* On other platforms, it just returns the command and arguments as-is.
|
|
190
191
|
*/
|
|
191
|
-
function
|
|
192
|
-
if (
|
|
193
|
-
command
|
|
194
|
-
args
|
|
195
|
-
options
|
|
192
|
+
function normalizeSpawnCommand(command, args = [], options = {}) {
|
|
193
|
+
if (options.shell === true || !isWindows$1) return {
|
|
194
|
+
command,
|
|
195
|
+
args,
|
|
196
|
+
options
|
|
196
197
|
};
|
|
197
|
-
let
|
|
198
|
-
let
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
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;
|
|
203
204
|
try {
|
|
204
|
-
|
|
205
|
-
readSync(
|
|
205
|
+
fd = openSync(file, "r");
|
|
206
|
+
readSync(fd, buffer, 0, size, 0);
|
|
206
207
|
} catch {} finally {
|
|
207
|
-
if (
|
|
208
|
+
if (fd !== null) closeSync(fd);
|
|
208
209
|
}
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
|
|
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;
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
if (
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
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;
|
|
235
236
|
});
|
|
236
|
-
|
|
237
|
+
args = [
|
|
237
238
|
"/d",
|
|
238
239
|
"/s",
|
|
239
240
|
"/c",
|
|
240
|
-
`"${[
|
|
241
|
+
`"${[command, ...args].join(" ")}"`
|
|
241
242
|
];
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
...
|
|
243
|
+
command = options.env?.comspec ?? "cmd.exe";
|
|
244
|
+
options = {
|
|
245
|
+
...options,
|
|
245
246
|
windowsVerbatimArguments: true
|
|
246
247
|
};
|
|
247
248
|
}
|
|
248
249
|
return {
|
|
249
|
-
command
|
|
250
|
-
args
|
|
251
|
-
options
|
|
250
|
+
command,
|
|
251
|
+
args,
|
|
252
|
+
options
|
|
252
253
|
};
|
|
253
254
|
}
|
|
254
255
|
/**
|
|
255
256
|
* Resolves the command to an absolute path if possible.
|
|
256
257
|
* Handles things like traversing PATH and adding extensions from PATHEXT
|
|
257
258
|
*/
|
|
258
|
-
function
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
if (
|
|
265
|
-
for (const
|
|
266
|
-
const
|
|
267
|
-
for (const
|
|
268
|
-
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;
|
|
269
270
|
try {
|
|
270
|
-
if (statSync(
|
|
271
|
+
if (statSync(destWithExt).isFile()) return destWithExt;
|
|
271
272
|
} catch {}
|
|
272
273
|
}
|
|
273
274
|
}
|
|
274
275
|
return null;
|
|
275
276
|
}
|
|
276
|
-
var
|
|
277
|
+
var NonZeroExitError = class extends Error {
|
|
277
278
|
result;
|
|
278
279
|
output;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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
|
+
});
|
|
286
297
|
}
|
|
287
298
|
};
|
|
288
|
-
const
|
|
299
|
+
const defaultOptions = {
|
|
289
300
|
timeout: void 0,
|
|
290
301
|
persist: false
|
|
291
302
|
};
|
|
292
|
-
const
|
|
293
|
-
function
|
|
294
|
-
const
|
|
295
|
-
for (const
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
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;
|
|
299
310
|
}
|
|
300
|
-
const
|
|
301
|
-
|
|
311
|
+
const onAbort = () => {
|
|
312
|
+
controller.abort(signal.reason);
|
|
302
313
|
};
|
|
303
|
-
|
|
314
|
+
signal.addEventListener("abort", onAbort, { signal: controller.signal });
|
|
304
315
|
}
|
|
305
|
-
return
|
|
316
|
+
return controller.signal;
|
|
306
317
|
}
|
|
307
|
-
async function
|
|
308
|
-
let
|
|
318
|
+
async function readStream(stream) {
|
|
319
|
+
let output = "";
|
|
309
320
|
try {
|
|
310
|
-
for await (const
|
|
321
|
+
for await (const chunk of stream) output += chunk.toString();
|
|
311
322
|
} catch {}
|
|
312
|
-
return
|
|
323
|
+
return output;
|
|
313
324
|
}
|
|
314
|
-
var
|
|
325
|
+
var ExecProcess = class {
|
|
315
326
|
_process;
|
|
316
327
|
_aborted = false;
|
|
317
328
|
_options;
|
|
@@ -329,19 +340,22 @@ var I = class {
|
|
|
329
340
|
get exitCode() {
|
|
330
341
|
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
331
342
|
}
|
|
332
|
-
|
|
343
|
+
get signalCode() {
|
|
344
|
+
return this._process?.signalCode ?? null;
|
|
345
|
+
}
|
|
346
|
+
constructor(command, args, options) {
|
|
333
347
|
this._options = {
|
|
334
|
-
...
|
|
335
|
-
...
|
|
348
|
+
...defaultOptions,
|
|
349
|
+
...options
|
|
336
350
|
};
|
|
337
|
-
this._command =
|
|
338
|
-
this._args =
|
|
339
|
-
this._processClosed = new Promise((
|
|
340
|
-
this._resolveClose =
|
|
351
|
+
this._command = command;
|
|
352
|
+
this._args = args ?? [];
|
|
353
|
+
this._processClosed = new Promise((resolve) => {
|
|
354
|
+
this._resolveClose = resolve;
|
|
341
355
|
});
|
|
342
356
|
}
|
|
343
|
-
kill(
|
|
344
|
-
return this._process?.kill(
|
|
357
|
+
kill(signal) {
|
|
358
|
+
return this._process?.kill(signal) === true;
|
|
345
359
|
}
|
|
346
360
|
get aborted() {
|
|
347
361
|
return this._aborted;
|
|
@@ -349,99 +363,99 @@ var I = class {
|
|
|
349
363
|
get killed() {
|
|
350
364
|
return this._process?.killed === true;
|
|
351
365
|
}
|
|
352
|
-
pipe(
|
|
353
|
-
return
|
|
354
|
-
...
|
|
366
|
+
pipe(command, args, options) {
|
|
367
|
+
return exec$1(command, args, {
|
|
368
|
+
...options,
|
|
355
369
|
stdin: this
|
|
356
370
|
});
|
|
357
371
|
}
|
|
358
372
|
async *[Symbol.asyncIterator]() {
|
|
359
|
-
const
|
|
360
|
-
if (!
|
|
361
|
-
const
|
|
362
|
-
if (this._streamErr)
|
|
363
|
-
if (this._streamOut)
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
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();
|
|
367
381
|
await this._processClosed;
|
|
368
|
-
|
|
382
|
+
proc.removeAllListeners();
|
|
369
383
|
if (this._thrownError) throw this._thrownError;
|
|
370
|
-
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);
|
|
371
385
|
}
|
|
372
386
|
async _waitForOutput() {
|
|
373
|
-
const
|
|
374
|
-
if (!
|
|
375
|
-
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) : ""]);
|
|
376
390
|
await this._processClosed;
|
|
377
|
-
const { stdin
|
|
378
|
-
if (
|
|
379
|
-
|
|
391
|
+
const { stdin } = this._options;
|
|
392
|
+
if (stdin && typeof stdin !== "string") await stdin;
|
|
393
|
+
proc.removeAllListeners();
|
|
380
394
|
if (this._thrownError) throw this._thrownError;
|
|
381
|
-
const
|
|
382
|
-
stderr
|
|
383
|
-
stdout
|
|
395
|
+
const result = {
|
|
396
|
+
stderr,
|
|
397
|
+
stdout,
|
|
384
398
|
exitCode: this.exitCode
|
|
385
399
|
};
|
|
386
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
387
|
-
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;
|
|
388
402
|
}
|
|
389
|
-
then(
|
|
390
|
-
return this._waitForOutput().then(
|
|
403
|
+
then(onfulfilled, onrejected) {
|
|
404
|
+
return this._waitForOutput().then(onfulfilled, onrejected);
|
|
391
405
|
}
|
|
392
406
|
_streamOut;
|
|
393
407
|
_streamErr;
|
|
394
408
|
spawn() {
|
|
395
|
-
const
|
|
396
|
-
const
|
|
397
|
-
const
|
|
398
|
-
...
|
|
399
|
-
...
|
|
409
|
+
const cwd$1 = cwd();
|
|
410
|
+
const options = this._options;
|
|
411
|
+
const nodeOptions = {
|
|
412
|
+
...defaultNodeOptions,
|
|
413
|
+
...options.nodeOptions
|
|
400
414
|
};
|
|
401
|
-
const
|
|
415
|
+
const signals = [];
|
|
402
416
|
this._resetState();
|
|
403
|
-
if (
|
|
404
|
-
if (
|
|
405
|
-
if (
|
|
406
|
-
if (
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
const
|
|
410
|
-
if (
|
|
411
|
-
if (
|
|
412
|
-
this._process =
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if (
|
|
416
|
-
const { stdin
|
|
417
|
-
if (typeof
|
|
418
|
-
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);
|
|
419
433
|
}
|
|
420
434
|
}
|
|
421
435
|
_resetState() {
|
|
422
436
|
this._aborted = false;
|
|
423
|
-
this._processClosed = new Promise((
|
|
424
|
-
this._resolveClose =
|
|
437
|
+
this._processClosed = new Promise((resolve) => {
|
|
438
|
+
this._resolveClose = resolve;
|
|
425
439
|
});
|
|
426
440
|
this._thrownError = void 0;
|
|
427
441
|
}
|
|
428
|
-
_onError = (
|
|
429
|
-
if (
|
|
442
|
+
_onError = (err) => {
|
|
443
|
+
if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
|
|
430
444
|
this._aborted = true;
|
|
431
445
|
return;
|
|
432
446
|
}
|
|
433
|
-
this._thrownError =
|
|
447
|
+
this._thrownError = err;
|
|
434
448
|
};
|
|
435
449
|
_onClose = () => {
|
|
436
450
|
if (this._resolveClose) this._resolveClose();
|
|
437
451
|
};
|
|
438
452
|
};
|
|
439
|
-
const
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
return
|
|
453
|
+
const x = (command, args, userOptions) => {
|
|
454
|
+
const proc = new ExecProcess(command, args, userOptions);
|
|
455
|
+
proc.spawn();
|
|
456
|
+
return proc;
|
|
443
457
|
};
|
|
444
|
-
const
|
|
458
|
+
const exec$1 = x;
|
|
445
459
|
//#endregion
|
|
446
460
|
//#region ../../node_modules/.pnpm/lint-staged@16.4.0/node_modules/lint-staged/lib/execGit.js
|
|
447
461
|
const debugLog$15 = createDebug("lint-staged:execGit");
|
|
@@ -456,7 +470,7 @@ const NO_SUBMODULE_RECURSE = ["-c", "submodule.recurse=false"];
|
|
|
456
470
|
/** @type {(cmd: string[], options?: { cwd?: string }) => Promise<string>} */
|
|
457
471
|
const execGit = async (cmd, options) => {
|
|
458
472
|
debugLog$15("Running git command:", cmd);
|
|
459
|
-
const result =
|
|
473
|
+
const result = exec$1("git", [...NO_SUBMODULE_RECURSE, ...cmd], { nodeOptions: {
|
|
460
474
|
cwd: options?.cwd,
|
|
461
475
|
stdio: ["ignore"]
|
|
462
476
|
} });
|
|
@@ -3886,10 +3900,12 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3886
3900
|
}
|
|
3887
3901
|
return esc ? m : `\\${m}`;
|
|
3888
3902
|
});
|
|
3889
|
-
if (backslashes === true)
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
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
|
+
}
|
|
3893
3909
|
if (output === input && opts.contains === true) {
|
|
3894
3910
|
state.output = input;
|
|
3895
3911
|
return state;
|
|
@@ -4660,8 +4676,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4660
4676
|
output = format ? format(input) : input;
|
|
4661
4677
|
match = output === glob;
|
|
4662
4678
|
}
|
|
4663
|
-
if (match === false || opts.capture === true)
|
|
4664
|
-
|
|
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
|
+
}
|
|
4665
4683
|
return {
|
|
4666
4684
|
isMatch: Boolean(match),
|
|
4667
4685
|
match,
|
|
@@ -5101,7 +5119,7 @@ const getSpawnedTask = ({ abortController, color, command, continueOnError = fal
|
|
|
5101
5119
|
debugLog$12("Tinyexec options:", tinyExecOptions);
|
|
5102
5120
|
/** @param {ReturnType<typeof getInitialState>} ctx context */
|
|
5103
5121
|
return async (ctx = getInitialState()) => {
|
|
5104
|
-
const result =
|
|
5122
|
+
const result = exec$1(cmd, isFn ? args : args.concat(files), tinyExecOptions);
|
|
5105
5123
|
const taskFailed = () => result.exitCode > 0 || result.process?.signalCode;
|
|
5106
5124
|
/** @type {keyof typeof Signal | undefined} */
|
|
5107
5125
|
let signal;
|
|
@@ -5942,7 +5960,7 @@ const jsonParse = async (filename) => {
|
|
|
5942
5960
|
const yamlParse = async (filename) => {
|
|
5943
5961
|
const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
|
|
5944
5962
|
try {
|
|
5945
|
-
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)]);
|
|
5946
5964
|
const yaml = YAML.parse(content);
|
|
5947
5965
|
return isPackageFile ? yaml[CONFIG_NAME] : yaml;
|
|
5948
5966
|
} catch (error) {
|