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
package/dist/staged/bin.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as renderCliDoc } from "../help-BmKpeOP9.js";
|
|
3
|
+
import { i as log, n as errorMsg, o as printHeader } from "../terminal-MKGAuy-p.js";
|
|
4
|
+
import { a as resolveViteConfig } from "../resolve-vite-config-ipGb39Jo.js";
|
|
4
5
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
5
6
|
import { createRequire } from "node:module";
|
|
6
7
|
import path, { basename, delimiter, dirname, normalize, resolve } from "node:path";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
7
9
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
8
10
|
import { closeSync, constants, openSync, readSync, statSync } from "node:fs";
|
|
9
|
-
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";
|
|
15
16
|
import fsPromises, { constants as constants$2 } from "node:fs/promises";
|
|
16
17
|
import { PassThrough, Writable } from "node:stream";
|
|
17
18
|
import { exec, spawn } from "node:child_process";
|
|
@@ -117,201 +118,212 @@ const createDebug = (name) => {
|
|
|
117
118
|
};
|
|
118
119
|
};
|
|
119
120
|
//#endregion
|
|
120
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.
|
|
121
|
-
const
|
|
122
|
-
const
|
|
121
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
|
|
122
|
+
const isPathLikePattern = /^path$/i;
|
|
123
|
+
const defaultEnvPathInfo = {
|
|
123
124
|
key: "PATH",
|
|
124
125
|
value: ""
|
|
125
126
|
};
|
|
126
|
-
function
|
|
127
|
-
for (const
|
|
128
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
127
|
+
function getPathFromEnv(env) {
|
|
128
|
+
for (const key in env) {
|
|
129
|
+
if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
|
|
130
|
+
const value = env[key];
|
|
131
|
+
if (!value) return defaultEnvPathInfo;
|
|
131
132
|
return {
|
|
132
|
-
key
|
|
133
|
-
value
|
|
133
|
+
key,
|
|
134
|
+
value
|
|
134
135
|
};
|
|
135
136
|
}
|
|
136
|
-
return
|
|
137
|
+
return defaultEnvPathInfo;
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
let
|
|
142
|
-
let
|
|
139
|
+
function addNodeBinToPath(cwd, path) {
|
|
140
|
+
const parts = path.value.split(delimiter);
|
|
141
|
+
const nodeBinPaths = [];
|
|
142
|
+
let currentPath = cwd;
|
|
143
|
+
let lastPath;
|
|
143
144
|
do {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} while (
|
|
148
|
-
|
|
149
|
-
const
|
|
145
|
+
nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
|
|
146
|
+
lastPath = currentPath;
|
|
147
|
+
currentPath = dirname(currentPath);
|
|
148
|
+
} while (currentPath !== lastPath);
|
|
149
|
+
nodeBinPaths.push(dirname(process.execPath));
|
|
150
|
+
const newPath = nodeBinPaths.concat(parts).join(delimiter);
|
|
150
151
|
return {
|
|
151
|
-
key:
|
|
152
|
-
value:
|
|
152
|
+
key: path.key,
|
|
153
|
+
value: newPath
|
|
153
154
|
};
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
156
|
+
function computeEnv(cwd, env, nodePath = true) {
|
|
157
|
+
const envWithDefault = {
|
|
157
158
|
...process.env,
|
|
158
|
-
...
|
|
159
|
+
...env
|
|
159
160
|
};
|
|
160
|
-
if (!
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
return
|
|
161
|
+
if (!nodePath) return envWithDefault;
|
|
162
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
163
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
164
|
+
return envWithDefault;
|
|
164
165
|
}
|
|
165
|
-
const
|
|
166
|
-
let
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
if (--
|
|
166
|
+
const combineStreams = (streams) => {
|
|
167
|
+
let streamCount = streams.length;
|
|
168
|
+
const combined = new PassThrough();
|
|
169
|
+
const maybeEmitEnd = () => {
|
|
170
|
+
if (--streamCount === 0) combined.end();
|
|
170
171
|
};
|
|
171
|
-
for (const
|
|
172
|
-
return
|
|
172
|
+
for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
|
|
173
|
+
return combined;
|
|
173
174
|
};
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const
|
|
175
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
176
|
+
const shebangRegExp = /^#!\s*(.+)/;
|
|
177
|
+
const isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
|
|
178
|
+
const isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
179
|
+
const isWindows$1 = process.platform === "win32";
|
|
180
|
+
const defaultPathExt = [
|
|
180
181
|
".EXE",
|
|
181
182
|
".CMD",
|
|
182
183
|
".BAT",
|
|
183
184
|
".COM"
|
|
184
185
|
];
|
|
186
|
+
const noPathExt = [""];
|
|
185
187
|
/**
|
|
186
188
|
* Normalizes the command and arguments to work cross-platform.
|
|
187
189
|
* On Windows, this basically handles things like shebangs, calling
|
|
188
190
|
* `node_modules/.bin` commands, and escaping meta characters.
|
|
189
191
|
* On other platforms, it just returns the command and arguments as-is.
|
|
190
192
|
*/
|
|
191
|
-
function
|
|
192
|
-
if (
|
|
193
|
-
command
|
|
194
|
-
args
|
|
195
|
-
options
|
|
193
|
+
function normalizeSpawnCommand(command, args = [], options = {}) {
|
|
194
|
+
if (options.shell === true || !isWindows$1) return {
|
|
195
|
+
command,
|
|
196
|
+
args,
|
|
197
|
+
options
|
|
196
198
|
};
|
|
197
|
-
let
|
|
198
|
-
let
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
let
|
|
199
|
+
let file = resolveCommand(command, options);
|
|
200
|
+
let shebang = null;
|
|
201
|
+
if (file !== null) {
|
|
202
|
+
const size = 150;
|
|
203
|
+
const buffer = Buffer.alloc(size);
|
|
204
|
+
let fd = null;
|
|
203
205
|
try {
|
|
204
|
-
|
|
205
|
-
readSync(
|
|
206
|
+
fd = openSync(file, "r");
|
|
207
|
+
readSync(fd, buffer, 0, size, 0);
|
|
206
208
|
} catch {} finally {
|
|
207
|
-
if (
|
|
209
|
+
if (fd !== null) closeSync(fd);
|
|
208
210
|
}
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
|
|
211
|
+
const match = buffer.toString().match(shebangRegExp);
|
|
212
|
+
if (match !== null) {
|
|
213
|
+
const line = match[1].trim();
|
|
214
|
+
const separatorIndex = line.indexOf(" ");
|
|
215
|
+
const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
|
|
216
|
+
const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
|
|
217
|
+
const binary = basename(path);
|
|
218
|
+
shebang = binary === "env" ? argument || null : binary;
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
if (
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
return
|
|
221
|
+
if (shebang !== null && file !== null) {
|
|
222
|
+
args = [file, ...args];
|
|
223
|
+
command = shebang;
|
|
224
|
+
file = resolveCommand(command, options);
|
|
225
|
+
}
|
|
226
|
+
if (file === null || !isWindowsExecutableRegExp.test(file)) {
|
|
227
|
+
const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
|
|
228
|
+
command = normalize(command);
|
|
229
|
+
command = command.replace(metaCharsRegExp, "^$1");
|
|
230
|
+
args = args.map((arg) => {
|
|
231
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
232
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
233
|
+
arg = `"${arg}"`;
|
|
234
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
235
|
+
if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
236
|
+
return arg;
|
|
235
237
|
});
|
|
236
|
-
|
|
238
|
+
args = [
|
|
237
239
|
"/d",
|
|
238
240
|
"/s",
|
|
239
241
|
"/c",
|
|
240
|
-
`"${[
|
|
242
|
+
`"${[command, ...args].join(" ")}"`
|
|
241
243
|
];
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
...
|
|
244
|
+
command = options.env?.comspec ?? "cmd.exe";
|
|
245
|
+
options = {
|
|
246
|
+
...options,
|
|
245
247
|
windowsVerbatimArguments: true
|
|
246
248
|
};
|
|
247
249
|
}
|
|
248
250
|
return {
|
|
249
|
-
command
|
|
250
|
-
args
|
|
251
|
-
options
|
|
251
|
+
command,
|
|
252
|
+
args,
|
|
253
|
+
options
|
|
252
254
|
};
|
|
253
255
|
}
|
|
254
256
|
/**
|
|
255
257
|
* Resolves the command to an absolute path if possible.
|
|
256
258
|
* Handles things like traversing PATH and adding extensions from PATHEXT
|
|
257
259
|
*/
|
|
258
|
-
function
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
if (
|
|
265
|
-
for (const
|
|
266
|
-
const
|
|
267
|
-
for (const
|
|
268
|
-
const
|
|
260
|
+
function resolveCommand(command, options) {
|
|
261
|
+
const cwd$3 = (options.cwd ?? cwd()).toString();
|
|
262
|
+
const env = options.env ?? process.env;
|
|
263
|
+
const PATH = getPathFromEnv(env).value;
|
|
264
|
+
const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
|
|
265
|
+
let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
|
|
266
|
+
if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
|
|
267
|
+
for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
|
|
268
|
+
const dest = resolve(cwd$3, path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path, command);
|
|
269
|
+
for (const ext of extensions) {
|
|
270
|
+
const destWithExt = dest + ext;
|
|
269
271
|
try {
|
|
270
|
-
if (statSync(
|
|
272
|
+
if (statSync(destWithExt).isFile()) return destWithExt;
|
|
271
273
|
} catch {}
|
|
272
274
|
}
|
|
273
275
|
}
|
|
274
276
|
return null;
|
|
275
277
|
}
|
|
276
|
-
var
|
|
278
|
+
var NonZeroExitError = class extends Error {
|
|
277
279
|
result;
|
|
278
280
|
output;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
281
|
+
exitCode;
|
|
282
|
+
get signalCode() {
|
|
283
|
+
return this.result.signalCode;
|
|
284
|
+
}
|
|
285
|
+
constructor(result, output, command, args) {
|
|
286
|
+
let target = "The process";
|
|
287
|
+
if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
|
|
288
|
+
const exitCode = result.exitCode ?? 1;
|
|
289
|
+
super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
|
|
290
|
+
this.result = result;
|
|
291
|
+
this.output = output;
|
|
292
|
+
this.exitCode = exitCode;
|
|
293
|
+
Object.defineProperty(this, "result", {
|
|
294
|
+
enumerable: false,
|
|
295
|
+
writable: false,
|
|
296
|
+
configurable: false
|
|
297
|
+
});
|
|
286
298
|
}
|
|
287
299
|
};
|
|
288
|
-
const
|
|
300
|
+
const defaultOptions = {
|
|
289
301
|
timeout: void 0,
|
|
290
302
|
persist: false
|
|
291
303
|
};
|
|
292
|
-
const
|
|
293
|
-
function
|
|
294
|
-
const
|
|
295
|
-
for (const
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
return
|
|
304
|
+
const defaultNodeOptions = { windowsHide: true };
|
|
305
|
+
function combineSignals(signals) {
|
|
306
|
+
const controller = new AbortController();
|
|
307
|
+
for (const signal of signals) {
|
|
308
|
+
if (signal.aborted) {
|
|
309
|
+
controller.abort();
|
|
310
|
+
return signal;
|
|
299
311
|
}
|
|
300
|
-
const
|
|
301
|
-
|
|
312
|
+
const onAbort = () => {
|
|
313
|
+
controller.abort(signal.reason);
|
|
302
314
|
};
|
|
303
|
-
|
|
315
|
+
signal.addEventListener("abort", onAbort, { signal: controller.signal });
|
|
304
316
|
}
|
|
305
|
-
return
|
|
317
|
+
return controller.signal;
|
|
306
318
|
}
|
|
307
|
-
async function
|
|
308
|
-
let
|
|
319
|
+
async function readStream(stream) {
|
|
320
|
+
let output = "";
|
|
309
321
|
try {
|
|
310
|
-
for await (const
|
|
322
|
+
for await (const chunk of stream) output += chunk.toString();
|
|
311
323
|
} catch {}
|
|
312
|
-
return
|
|
324
|
+
return output;
|
|
313
325
|
}
|
|
314
|
-
var
|
|
326
|
+
var ExecProcess = class {
|
|
315
327
|
_process;
|
|
316
328
|
_aborted = false;
|
|
317
329
|
_options;
|
|
@@ -329,19 +341,22 @@ var I = class {
|
|
|
329
341
|
get exitCode() {
|
|
330
342
|
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
331
343
|
}
|
|
332
|
-
|
|
344
|
+
get signalCode() {
|
|
345
|
+
return this._process?.signalCode ?? null;
|
|
346
|
+
}
|
|
347
|
+
constructor(command, args, options) {
|
|
333
348
|
this._options = {
|
|
334
|
-
...
|
|
335
|
-
...
|
|
349
|
+
...defaultOptions,
|
|
350
|
+
...options
|
|
336
351
|
};
|
|
337
|
-
this._command =
|
|
338
|
-
this._args =
|
|
339
|
-
this._processClosed = new Promise((
|
|
340
|
-
this._resolveClose =
|
|
352
|
+
this._command = command;
|
|
353
|
+
this._args = args ?? [];
|
|
354
|
+
this._processClosed = new Promise((resolve) => {
|
|
355
|
+
this._resolveClose = resolve;
|
|
341
356
|
});
|
|
342
357
|
}
|
|
343
|
-
kill(
|
|
344
|
-
return this._process?.kill(
|
|
358
|
+
kill(signal) {
|
|
359
|
+
return this._process?.kill(signal) === true;
|
|
345
360
|
}
|
|
346
361
|
get aborted() {
|
|
347
362
|
return this._aborted;
|
|
@@ -349,99 +364,99 @@ var I = class {
|
|
|
349
364
|
get killed() {
|
|
350
365
|
return this._process?.killed === true;
|
|
351
366
|
}
|
|
352
|
-
pipe(
|
|
353
|
-
return
|
|
354
|
-
...
|
|
367
|
+
pipe(command, args, options) {
|
|
368
|
+
return exec$1(command, args, {
|
|
369
|
+
...options,
|
|
355
370
|
stdin: this
|
|
356
371
|
});
|
|
357
372
|
}
|
|
358
373
|
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
|
|
374
|
+
const proc = this._process;
|
|
375
|
+
if (!proc) return;
|
|
376
|
+
const streams = [];
|
|
377
|
+
if (this._streamErr) streams.push(this._streamErr);
|
|
378
|
+
if (this._streamOut) streams.push(this._streamOut);
|
|
379
|
+
const streamCombined = combineStreams(streams);
|
|
380
|
+
const rl = l__default.createInterface({ input: streamCombined });
|
|
381
|
+
for await (const chunk of rl) yield chunk.toString();
|
|
367
382
|
await this._processClosed;
|
|
368
|
-
|
|
383
|
+
proc.removeAllListeners();
|
|
369
384
|
if (this._thrownError) throw this._thrownError;
|
|
370
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
385
|
+
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
386
|
}
|
|
372
387
|
async _waitForOutput() {
|
|
373
|
-
const
|
|
374
|
-
if (!
|
|
375
|
-
const [
|
|
388
|
+
const proc = this._process;
|
|
389
|
+
if (!proc) throw new Error("No process was started");
|
|
390
|
+
const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
|
|
376
391
|
await this._processClosed;
|
|
377
|
-
const { stdin
|
|
378
|
-
if (
|
|
379
|
-
|
|
392
|
+
const { stdin } = this._options;
|
|
393
|
+
if (stdin && typeof stdin !== "string") await stdin;
|
|
394
|
+
proc.removeAllListeners();
|
|
380
395
|
if (this._thrownError) throw this._thrownError;
|
|
381
|
-
const
|
|
382
|
-
stderr
|
|
383
|
-
stdout
|
|
396
|
+
const result = {
|
|
397
|
+
stderr,
|
|
398
|
+
stdout,
|
|
384
399
|
exitCode: this.exitCode
|
|
385
400
|
};
|
|
386
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
387
|
-
return
|
|
401
|
+
if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
|
|
402
|
+
return result;
|
|
388
403
|
}
|
|
389
|
-
then(
|
|
390
|
-
return this._waitForOutput().then(
|
|
404
|
+
then(onfulfilled, onrejected) {
|
|
405
|
+
return this._waitForOutput().then(onfulfilled, onrejected);
|
|
391
406
|
}
|
|
392
407
|
_streamOut;
|
|
393
408
|
_streamErr;
|
|
394
409
|
spawn() {
|
|
395
|
-
const
|
|
396
|
-
const
|
|
397
|
-
const
|
|
398
|
-
...
|
|
399
|
-
...
|
|
410
|
+
const cwd$1 = cwd();
|
|
411
|
+
const options = this._options;
|
|
412
|
+
const nodeOptions = {
|
|
413
|
+
...defaultNodeOptions,
|
|
414
|
+
...options.nodeOptions
|
|
400
415
|
};
|
|
401
|
-
const
|
|
416
|
+
const signals = [];
|
|
402
417
|
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
|
|
418
|
+
if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
419
|
+
if (options.signal !== void 0) signals.push(options.signal);
|
|
420
|
+
if (options.persist === true) nodeOptions.detached = true;
|
|
421
|
+
if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
|
|
422
|
+
nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
|
|
423
|
+
const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
|
|
424
|
+
const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
|
|
425
|
+
if (handle.stderr) this._streamErr = handle.stderr;
|
|
426
|
+
if (handle.stdout) this._streamOut = handle.stdout;
|
|
427
|
+
this._process = handle;
|
|
428
|
+
handle.once("error", this._onError);
|
|
429
|
+
handle.once("close", this._onClose);
|
|
430
|
+
if (handle.stdin) {
|
|
431
|
+
const { stdin } = options;
|
|
432
|
+
if (typeof stdin === "string") handle.stdin.end(stdin);
|
|
433
|
+
else stdin?.process?.stdout?.pipe(handle.stdin);
|
|
419
434
|
}
|
|
420
435
|
}
|
|
421
436
|
_resetState() {
|
|
422
437
|
this._aborted = false;
|
|
423
|
-
this._processClosed = new Promise((
|
|
424
|
-
this._resolveClose =
|
|
438
|
+
this._processClosed = new Promise((resolve) => {
|
|
439
|
+
this._resolveClose = resolve;
|
|
425
440
|
});
|
|
426
441
|
this._thrownError = void 0;
|
|
427
442
|
}
|
|
428
|
-
_onError = (
|
|
429
|
-
if (
|
|
443
|
+
_onError = (err) => {
|
|
444
|
+
if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
|
|
430
445
|
this._aborted = true;
|
|
431
446
|
return;
|
|
432
447
|
}
|
|
433
|
-
this._thrownError =
|
|
448
|
+
this._thrownError = err;
|
|
434
449
|
};
|
|
435
450
|
_onClose = () => {
|
|
436
451
|
if (this._resolveClose) this._resolveClose();
|
|
437
452
|
};
|
|
438
453
|
};
|
|
439
|
-
const
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
return
|
|
454
|
+
const x = (command, args, userOptions) => {
|
|
455
|
+
const proc = new ExecProcess(command, args, userOptions);
|
|
456
|
+
proc.spawn();
|
|
457
|
+
return proc;
|
|
443
458
|
};
|
|
444
|
-
const
|
|
459
|
+
const exec$1 = x;
|
|
445
460
|
//#endregion
|
|
446
461
|
//#region ../../node_modules/.pnpm/lint-staged@16.4.0/node_modules/lint-staged/lib/execGit.js
|
|
447
462
|
const debugLog$15 = createDebug("lint-staged:execGit");
|
|
@@ -456,7 +471,7 @@ const NO_SUBMODULE_RECURSE = ["-c", "submodule.recurse=false"];
|
|
|
456
471
|
/** @type {(cmd: string[], options?: { cwd?: string }) => Promise<string>} */
|
|
457
472
|
const execGit = async (cmd, options) => {
|
|
458
473
|
debugLog$15("Running git command:", cmd);
|
|
459
|
-
const result =
|
|
474
|
+
const result = exec$1("git", [...NO_SUBMODULE_RECURSE, ...cmd], { nodeOptions: {
|
|
460
475
|
cwd: options?.cwd,
|
|
461
476
|
stdio: ["ignore"]
|
|
462
477
|
} });
|
|
@@ -1544,7 +1559,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1544
1559
|
this.logger.options.color = this.options.color;
|
|
1545
1560
|
}
|
|
1546
1561
|
async render() {
|
|
1547
|
-
const { createLogUpdate } = await import("../log-update-
|
|
1562
|
+
const { createLogUpdate } = await import("../log-update-DHZRyJ2m.js");
|
|
1548
1563
|
const { default: truncate } = await import("../cli-truncate-Bg3RDXpi.js");
|
|
1549
1564
|
const { default: wrap } = await import("../wrap-ansi-DUi52C6W.js");
|
|
1550
1565
|
this.updater = createLogUpdate(this.logger.process.stdout);
|
|
@@ -3886,10 +3901,12 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3886
3901
|
}
|
|
3887
3902
|
return esc ? m : `\\${m}`;
|
|
3888
3903
|
});
|
|
3889
|
-
if (backslashes === true)
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3904
|
+
if (backslashes === true) {
|
|
3905
|
+
if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
3906
|
+
else output = output.replace(/\\+/g, (m) => {
|
|
3907
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
3908
|
+
});
|
|
3909
|
+
}
|
|
3893
3910
|
if (output === input && opts.contains === true) {
|
|
3894
3911
|
state.output = input;
|
|
3895
3912
|
return state;
|
|
@@ -4660,8 +4677,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4660
4677
|
output = format ? format(input) : input;
|
|
4661
4678
|
match = output === glob;
|
|
4662
4679
|
}
|
|
4663
|
-
if (match === false || opts.capture === true)
|
|
4664
|
-
|
|
4680
|
+
if (match === false || opts.capture === true) {
|
|
4681
|
+
if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
|
|
4682
|
+
else match = regex.exec(output);
|
|
4683
|
+
}
|
|
4665
4684
|
return {
|
|
4666
4685
|
isMatch: Boolean(match),
|
|
4667
4686
|
match,
|
|
@@ -5101,7 +5120,7 @@ const getSpawnedTask = ({ abortController, color, command, continueOnError = fal
|
|
|
5101
5120
|
debugLog$12("Tinyexec options:", tinyExecOptions);
|
|
5102
5121
|
/** @param {ReturnType<typeof getInitialState>} ctx context */
|
|
5103
5122
|
return async (ctx = getInitialState()) => {
|
|
5104
|
-
const result =
|
|
5123
|
+
const result = exec$1(cmd, isFn ? args : args.concat(files), tinyExecOptions);
|
|
5105
5124
|
const taskFailed = () => result.exitCode > 0 || result.process?.signalCode;
|
|
5106
5125
|
/** @type {keyof typeof Signal | undefined} */
|
|
5107
5126
|
let signal;
|
|
@@ -5942,7 +5961,7 @@ const jsonParse = async (filename) => {
|
|
|
5942
5961
|
const yamlParse = async (filename) => {
|
|
5943
5962
|
const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
|
|
5944
5963
|
try {
|
|
5945
|
-
const [YAML, content] = await Promise.all([import("../dist-
|
|
5964
|
+
const [YAML, content] = await Promise.all([import("../dist-Dqv1-Clg.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
|
|
5946
5965
|
const yaml = YAML.parse(content);
|
|
5947
5966
|
return isPackageFile ? yaml[CONFIG_NAME] : yaml;
|
|
5948
5967
|
} catch (error) {
|
|
@@ -6623,37 +6642,66 @@ const lintStaged = async ({ allowEmpty = false, color = SUPPORTS_COLOR, concurre
|
|
|
6623
6642
|
}
|
|
6624
6643
|
};
|
|
6625
6644
|
//#endregion
|
|
6645
|
+
//#region src/staged/args.ts
|
|
6646
|
+
function parseStagedArgs(argv) {
|
|
6647
|
+
return lib_default(argv, {
|
|
6648
|
+
alias: {
|
|
6649
|
+
h: "help",
|
|
6650
|
+
p: "concurrent",
|
|
6651
|
+
d: "debug",
|
|
6652
|
+
q: "quiet",
|
|
6653
|
+
r: "relative",
|
|
6654
|
+
v: "verbose"
|
|
6655
|
+
},
|
|
6656
|
+
boolean: [
|
|
6657
|
+
"help",
|
|
6658
|
+
"allow-empty",
|
|
6659
|
+
"debug",
|
|
6660
|
+
"continue-on-error",
|
|
6661
|
+
"fail-on-changes",
|
|
6662
|
+
"hide-partially-staged",
|
|
6663
|
+
"hide-unstaged",
|
|
6664
|
+
"quiet",
|
|
6665
|
+
"relative",
|
|
6666
|
+
"revert",
|
|
6667
|
+
"stash",
|
|
6668
|
+
"verbose"
|
|
6669
|
+
],
|
|
6670
|
+
string: [
|
|
6671
|
+
"concurrent",
|
|
6672
|
+
"cwd",
|
|
6673
|
+
"diff",
|
|
6674
|
+
"diff-filter"
|
|
6675
|
+
]
|
|
6676
|
+
});
|
|
6677
|
+
}
|
|
6678
|
+
function normalizeStagedArgs(args) {
|
|
6679
|
+
return {
|
|
6680
|
+
concurrent: normalizeConcurrent(args.concurrent),
|
|
6681
|
+
cwd: normalizeStringOption(args.cwd, "cwd", "path"),
|
|
6682
|
+
diff: normalizeStringOption(args.diff, "diff", "string"),
|
|
6683
|
+
diffFilter: normalizeStringOption(args["diff-filter"], "diff-filter", "string")
|
|
6684
|
+
};
|
|
6685
|
+
}
|
|
6686
|
+
function normalizeConcurrent(value) {
|
|
6687
|
+
if (value == null) return;
|
|
6688
|
+
if (value === true || value === false) return value;
|
|
6689
|
+
if (value === "") return true;
|
|
6690
|
+
if (value === "true") return true;
|
|
6691
|
+
if (value === "false") return false;
|
|
6692
|
+
const number = Number(value);
|
|
6693
|
+
if (Number.isFinite(number) && number > 0) return number;
|
|
6694
|
+
throw new Error("Option \"--concurrent\" must be true, false, or a number greater than 0.");
|
|
6695
|
+
}
|
|
6696
|
+
function normalizeStringOption(value, option, valueName) {
|
|
6697
|
+
if (value == null) return;
|
|
6698
|
+
if (value === false) throw new Error(`Option "--no-${option}" is not supported. Use "--${option} <${valueName}>".`);
|
|
6699
|
+
if (typeof value !== "string" || value === "") throw new Error(`Option "--${option}" requires a value.`);
|
|
6700
|
+
return value;
|
|
6701
|
+
}
|
|
6702
|
+
//#endregion
|
|
6626
6703
|
//#region src/staged/bin.ts
|
|
6627
|
-
const args =
|
|
6628
|
-
alias: {
|
|
6629
|
-
h: "help",
|
|
6630
|
-
p: "concurrent",
|
|
6631
|
-
d: "debug",
|
|
6632
|
-
q: "quiet",
|
|
6633
|
-
r: "relative",
|
|
6634
|
-
v: "verbose"
|
|
6635
|
-
},
|
|
6636
|
-
boolean: [
|
|
6637
|
-
"help",
|
|
6638
|
-
"allow-empty",
|
|
6639
|
-
"debug",
|
|
6640
|
-
"continue-on-error",
|
|
6641
|
-
"fail-on-changes",
|
|
6642
|
-
"hide-partially-staged",
|
|
6643
|
-
"hide-unstaged",
|
|
6644
|
-
"quiet",
|
|
6645
|
-
"relative",
|
|
6646
|
-
"revert",
|
|
6647
|
-
"stash",
|
|
6648
|
-
"verbose"
|
|
6649
|
-
],
|
|
6650
|
-
string: [
|
|
6651
|
-
"concurrent",
|
|
6652
|
-
"cwd",
|
|
6653
|
-
"diff",
|
|
6654
|
-
"diff-filter"
|
|
6655
|
-
]
|
|
6656
|
-
});
|
|
6704
|
+
const args = parseStagedArgs(process.argv.slice(3));
|
|
6657
6705
|
if (args.help) {
|
|
6658
6706
|
const helpMessage = renderCliDoc({
|
|
6659
6707
|
usage: "vp staged [options]",
|
|
@@ -6732,6 +6780,14 @@ if (args.help) {
|
|
|
6732
6780
|
printHeader();
|
|
6733
6781
|
log(helpMessage);
|
|
6734
6782
|
} else {
|
|
6783
|
+
let normalizedArgs;
|
|
6784
|
+
try {
|
|
6785
|
+
normalizedArgs = normalizeStagedArgs(args);
|
|
6786
|
+
} catch (err) {
|
|
6787
|
+
printHeader();
|
|
6788
|
+
errorMsg(err instanceof Error ? err.message : String(err));
|
|
6789
|
+
process.exit(1);
|
|
6790
|
+
}
|
|
6735
6791
|
const options = {};
|
|
6736
6792
|
if (args["allow-empty"] != null) options.allowEmpty = args["allow-empty"];
|
|
6737
6793
|
if (args.debug != null) options.debug = args.debug;
|
|
@@ -6746,7 +6802,7 @@ if (args.help) {
|
|
|
6746
6802
|
if (args.verbose != null) options.verbose = args.verbose;
|
|
6747
6803
|
let stagedConfig;
|
|
6748
6804
|
try {
|
|
6749
|
-
stagedConfig = (await resolveViteConfig(
|
|
6805
|
+
stagedConfig = (await resolveViteConfig(normalizedArgs.cwd ?? process.cwd())).staged;
|
|
6750
6806
|
} catch (err) {
|
|
6751
6807
|
const message = err instanceof Error ? err.message : String(err);
|
|
6752
6808
|
log(`Failed to load vite.config: ${message}`);
|
|
@@ -6763,18 +6819,10 @@ if (args.help) {
|
|
|
6763
6819
|
log(" });");
|
|
6764
6820
|
process.exit(1);
|
|
6765
6821
|
}
|
|
6766
|
-
if (
|
|
6767
|
-
if (
|
|
6768
|
-
if (
|
|
6769
|
-
if (
|
|
6770
|
-
const val = args.concurrent;
|
|
6771
|
-
if (val === "true") options.concurrent = true;
|
|
6772
|
-
else if (val === "false") options.concurrent = false;
|
|
6773
|
-
else {
|
|
6774
|
-
const num = Number(val);
|
|
6775
|
-
options.concurrent = Number.isNaN(num) || val === "" ? true : num;
|
|
6776
|
-
}
|
|
6777
|
-
}
|
|
6822
|
+
if (normalizedArgs.cwd != null) options.cwd = normalizedArgs.cwd;
|
|
6823
|
+
if (normalizedArgs.diff != null) options.diff = normalizedArgs.diff;
|
|
6824
|
+
if (normalizedArgs.diffFilter != null) options.diffFilter = normalizedArgs.diffFilter;
|
|
6825
|
+
if (normalizedArgs.concurrent != null) options.concurrent = normalizedArgs.concurrent;
|
|
6778
6826
|
const success = await lintStaged(options);
|
|
6779
6827
|
process.exit(success ? 0 : 1);
|
|
6780
6828
|
}
|