vite-plus 0.2.9 → 0.3.1
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/LICENSE +29 -29
- package/README.md +6 -5
- package/binding/index.cjs +63 -55
- package/binding/index.d.cts +218 -14
- package/dist/{agent-DQU8uS6P.js → agent-C5jMYVfB.js} +3 -2
- package/dist/bin.js +101 -60
- package/dist/cli-parse-DHE8NrBU.js +13 -0
- package/dist/client/bundledDevClient.mjs +1 -1
- package/dist/client/client.mjs +1 -1
- package/dist/client/env.mjs +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/command-CLJK5jGW.js +2 -0
- package/dist/command-CguLh2KL.js +471 -0
- package/dist/config/bin.js +85 -55
- package/dist/{constants-CG513DRa.js → constants-0IAVgpox.js} +5 -3
- package/dist/create/bin.d.ts +13 -5
- package/dist/create/bin.js +55 -232
- package/dist/{define-config-DyNLA_f0.cjs → define-config-DIE9de46.cjs} +2 -2
- package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
- package/dist/{define-config-CV4bQG_8.js → define-config-U3_xg7i-.js} +2 -2
- 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-DfmT__Aw.js +619 -0
- package/dist/{editor-g4PosU99.js → editor-B5-lvRaU.js} +619 -88
- package/dist/{terminal-Bz-ps6rJ.js → help-BmKpeOP9.js} +1 -38
- package/dist/hooks/bin.js +9 -113
- package/dist/{hooks-pNCBWtFT.js → hooks-C-4gykWR.js} +5 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/migration/bin.js +76 -146
- package/dist/migration/compat/worker.js +1 -1
- package/dist/module-runner.d.ts +1 -1
- package/dist/module-runner.js +1 -1
- package/dist/{oxlint-plugin-config-BEZ9IUf7.js → oxlint-plugin-config-Drdl67Xp.js} +1 -1
- package/dist/oxlint-plugin.d.ts +2 -2
- package/dist/oxlint-plugin.js +1 -1
- package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
- package/dist/pack-bin.d.ts +2 -3
- package/dist/pack-bin.js +9 -625
- package/dist/pack-client.d.ts +1 -1
- package/dist/pack.d.ts +2 -2
- package/dist/pack.js +1 -1
- package/dist/{package-B4T8RGMG.js → package-BZz2Ij68.js} +2 -2
- package/dist/{prompts-CHz_98bJ.js → prompts-CtzEgFY-.js} +7 -1872
- package/dist/{report-BS7ULx7A.js → report-CK5TnTsr.js} +2 -0
- package/dist/{resolve-vite-config-Dmeyeyj-.js → resolve-vite-config-CGks1xR7.js} +3 -3
- package/dist/resolve-vite-config-Dnmc-lBc.js +2 -0
- package/dist/semver-CaDAb8vV.js +1400 -0
- package/dist/staged/bin.js +82 -187
- package/dist/sync-versions/bin.d.ts +1 -0
- package/dist/sync-versions/bin.js +3884 -0
- package/dist/sync-versions/bin.mjs +13323 -0
- package/dist/terminal-MKGAuy-p.js +39 -0
- package/dist/toolchain.js +11 -11
- package/dist/toolchain.json +11 -11
- package/dist/{tsconfig-7v_BHagU.js → tsconfig-CUggNuJR.js} +5 -4
- package/dist/tsconfig-VAbm4ZzJ.js +2 -0
- package/dist/tsgolint-path.d.ts +3 -4
- package/dist/types/customEvent.d.ts +1 -1
- package/dist/types/hmrPayload.d.ts +1 -1
- package/dist/types/hot.d.ts +1 -1
- package/dist/types/import-meta.d.ts +1 -1
- package/dist/types/importGlob.d.ts +1 -1
- package/dist/types/importMeta.d.ts +1 -1
- package/dist/types/metadata.d.ts +1 -1
- package/dist/version.d.ts +2 -3
- package/dist/version.js +4 -3
- package/dist/versions.js +6 -6
- package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
- package/docs/guide/check.md +1 -0
- package/docs/guide/ci.md +42 -2
- package/docs/guide/env.md +136 -50
- package/docs/guide/ide-integration.md +14 -2
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +5 -2
- package/docs/guide/installer-env-vars.md +51 -5
- package/docs/guide/migrate-rules.md +66 -2
- package/docs/guide/migrate.md +5 -5
- package/docs/guide/test.md +8 -0
- package/docs/guide/upgrade.md +48 -1
- package/package.json +34 -37
- package/dist/lib-L3DWSRQp.js +0 -75
- 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 -13
- 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 -20
- package/dist/{json-qlK6UH0r.js → json-cULBl7Pi.js} +107 -107
package/dist/staged/bin.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
|
-
import { i as log,
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
2
|
+
import { i as log, n as errorMsg, o as printHeader } from "../terminal-MKGAuy-p.js";
|
|
3
|
+
import { o as resolveViteConfig } from "../resolve-vite-config-CGks1xR7.js";
|
|
4
|
+
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.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
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
+
import { parseStagedArgs } from "../../binding/index.js";
|
|
8
9
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
9
10
|
import { closeSync, constants, openSync, readSync, statSync } from "node:fs";
|
|
10
11
|
import { EOL } from "node:os";
|
|
@@ -117,7 +118,7 @@ const createDebug = (name) => {
|
|
|
117
118
|
};
|
|
118
119
|
};
|
|
119
120
|
//#endregion
|
|
120
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.3.
|
|
121
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
|
|
121
122
|
const isPathLikePattern = /^path$/i;
|
|
122
123
|
const defaultEnvPathInfo = {
|
|
123
124
|
key: "PATH",
|
|
@@ -138,7 +139,7 @@ function getPathFromEnv(env) {
|
|
|
138
139
|
function addNodeBinToPath(cwd, path) {
|
|
139
140
|
const parts = path.value.split(delimiter);
|
|
140
141
|
const nodeBinPaths = [];
|
|
141
|
-
let currentPath = cwd;
|
|
142
|
+
let currentPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd, { windows: false });
|
|
142
143
|
let lastPath;
|
|
143
144
|
do {
|
|
144
145
|
nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
|
|
@@ -264,7 +265,8 @@ function resolveCommand(command, options) {
|
|
|
264
265
|
let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
|
|
265
266
|
if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
|
|
266
267
|
for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
|
|
267
|
-
const
|
|
268
|
+
const unquoted = path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path;
|
|
269
|
+
const dest = resolve(cwd$3, unquoted, command);
|
|
268
270
|
for (const ext of extensions) {
|
|
269
271
|
const destWithExt = dest + ext;
|
|
270
272
|
try {
|
|
@@ -406,12 +408,12 @@ var ExecProcess = class {
|
|
|
406
408
|
_streamOut;
|
|
407
409
|
_streamErr;
|
|
408
410
|
spawn() {
|
|
409
|
-
const cwd$1 = cwd();
|
|
410
411
|
const options = this._options;
|
|
411
412
|
const nodeOptions = {
|
|
412
413
|
...defaultNodeOptions,
|
|
413
414
|
...options.nodeOptions
|
|
414
415
|
};
|
|
416
|
+
const cwd$1 = nodeOptions?.cwd ?? cwd();
|
|
415
417
|
const signals = [];
|
|
416
418
|
this._resetState();
|
|
417
419
|
if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
@@ -1794,9 +1796,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1794
1796
|
case ListrLogLevels.SKIPPED:
|
|
1795
1797
|
data = task.message.skip;
|
|
1796
1798
|
break;
|
|
1797
|
-
case ListrLogLevels.FAILED:
|
|
1798
|
-
data = task.message.error;
|
|
1799
|
-
break;
|
|
1799
|
+
case ListrLogLevels.FAILED: data = task.message.error;
|
|
1800
1800
|
}
|
|
1801
1801
|
if (task.hasTitle() && source === ListrLogLevels.FAILED && data === task.title || typeof data !== "string") return [];
|
|
1802
1802
|
if (source === ListrLogLevels.OUTPUT) data = cleanseAnsi(data);
|
|
@@ -2966,7 +2966,7 @@ const chunkFiles = ({ files, baseDir, maxArgLength = null, relative = false }) =
|
|
|
2966
2966
|
return chunkArray(normalizedFiles, chunkCount);
|
|
2967
2967
|
};
|
|
2968
2968
|
//#endregion
|
|
2969
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
2969
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js
|
|
2970
2970
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2971
2971
|
const WIN_SLASH = "\\\\/";
|
|
2972
2972
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
@@ -3135,7 +3135,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3135
3135
|
};
|
|
3136
3136
|
}));
|
|
3137
3137
|
//#endregion
|
|
3138
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3138
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
|
|
3139
3139
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3140
3140
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
3141
3141
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -3183,7 +3183,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3183
3183
|
};
|
|
3184
3184
|
}));
|
|
3185
3185
|
//#endregion
|
|
3186
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3186
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
|
|
3187
3187
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3188
3188
|
const utils = require_utils();
|
|
3189
3189
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
@@ -3212,7 +3212,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3212
3212
|
const scan = (input, options) => {
|
|
3213
3213
|
const opts = options || {};
|
|
3214
3214
|
const length = input.length - 1;
|
|
3215
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
3215
|
+
const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
|
|
3216
3216
|
const slashes = [];
|
|
3217
3217
|
const tokens = [];
|
|
3218
3218
|
const parts = [];
|
|
@@ -3315,14 +3315,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3315
3315
|
finished = true;
|
|
3316
3316
|
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
3317
3317
|
if (scanToEnd === true) {
|
|
3318
|
+
let parens = 0;
|
|
3318
3319
|
while (eos() !== true && (code = advance())) {
|
|
3319
3320
|
if (code === CHAR_BACKWARD_SLASH) {
|
|
3320
3321
|
backslashes = token.backslashes = true;
|
|
3321
|
-
|
|
3322
|
+
advance();
|
|
3322
3323
|
continue;
|
|
3323
3324
|
}
|
|
3324
|
-
if (code ===
|
|
3325
|
-
|
|
3325
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
3326
|
+
parens++;
|
|
3327
|
+
continue;
|
|
3328
|
+
}
|
|
3329
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
3326
3330
|
finished = true;
|
|
3327
3331
|
break;
|
|
3328
3332
|
}
|
|
@@ -3370,13 +3374,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3370
3374
|
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
3371
3375
|
isGlob = token.isGlob = true;
|
|
3372
3376
|
if (scanToEnd === true) {
|
|
3377
|
+
let parens = 1;
|
|
3373
3378
|
while (eos() !== true && (code = advance())) {
|
|
3374
|
-
if (code ===
|
|
3379
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
3375
3380
|
backslashes = token.backslashes = true;
|
|
3376
|
-
|
|
3381
|
+
advance();
|
|
3377
3382
|
continue;
|
|
3378
3383
|
}
|
|
3379
|
-
if (code ===
|
|
3384
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
3385
|
+
parens++;
|
|
3386
|
+
continue;
|
|
3387
|
+
}
|
|
3388
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
3380
3389
|
finished = true;
|
|
3381
3390
|
break;
|
|
3382
3391
|
}
|
|
@@ -3439,7 +3448,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3439
3448
|
if (opts.parts === true || opts.tokens === true) {
|
|
3440
3449
|
let prevIndex;
|
|
3441
3450
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3442
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
3451
|
+
const n = prevIndex !== void 0 ? prevIndex + 1 : start;
|
|
3443
3452
|
const i = slashes[idx];
|
|
3444
3453
|
const value = input.slice(n, i);
|
|
3445
3454
|
if (opts.tokens) {
|
|
@@ -3450,18 +3459,19 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3450
3459
|
depth(tokens[idx]);
|
|
3451
3460
|
state.maxDepth += tokens[idx].depth;
|
|
3452
3461
|
}
|
|
3453
|
-
if (
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3457
|
-
const value = input.slice(prevIndex + 1);
|
|
3458
|
-
parts.push(value);
|
|
3459
|
-
if (opts.tokens) {
|
|
3460
|
-
tokens[tokens.length - 1].value = value;
|
|
3461
|
-
depth(tokens[tokens.length - 1]);
|
|
3462
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
3462
|
+
if (i >= start) {
|
|
3463
|
+
parts.push(value);
|
|
3464
|
+
prevIndex = i;
|
|
3463
3465
|
}
|
|
3464
3466
|
}
|
|
3467
|
+
const n = prevIndex !== void 0 ? prevIndex + 1 : start;
|
|
3468
|
+
const value = input.slice(n);
|
|
3469
|
+
parts.push(value);
|
|
3470
|
+
if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
|
|
3471
|
+
tokens[tokens.length - 1].value = value;
|
|
3472
|
+
depth(tokens[tokens.length - 1]);
|
|
3473
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
3474
|
+
}
|
|
3465
3475
|
state.slashes = slashes;
|
|
3466
3476
|
state.parts = parts;
|
|
3467
3477
|
}
|
|
@@ -3470,7 +3480,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3470
3480
|
module.exports = scan;
|
|
3471
3481
|
}));
|
|
3472
3482
|
//#endregion
|
|
3473
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3483
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
|
|
3474
3484
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3475
3485
|
const constants = require_constants();
|
|
3476
3486
|
const utils = require_utils();
|
|
@@ -4372,6 +4382,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4372
4382
|
rest = rest.slice(3);
|
|
4373
4383
|
consume("/**", 3);
|
|
4374
4384
|
}
|
|
4385
|
+
const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
|
|
4375
4386
|
if (prior.type === "bos" && eos()) {
|
|
4376
4387
|
prev.type = "globstar";
|
|
4377
4388
|
prev.value += value;
|
|
@@ -4381,7 +4392,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4381
4392
|
consume(value);
|
|
4382
4393
|
continue;
|
|
4383
4394
|
}
|
|
4384
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar &&
|
|
4395
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
|
|
4385
4396
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
4386
4397
|
prior.output = `(?:${prior.output}`;
|
|
4387
4398
|
prev.type = "globstar";
|
|
@@ -4546,7 +4557,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4546
4557
|
module.exports = parse;
|
|
4547
4558
|
}));
|
|
4548
4559
|
//#endregion
|
|
4549
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
4560
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
|
|
4550
4561
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4551
4562
|
const scan = require_scan();
|
|
4552
4563
|
const parse = require_parse();
|
|
@@ -6642,159 +6653,43 @@ const lintStaged = async ({ allowEmpty = false, color = SUPPORTS_COLOR, concurre
|
|
|
6642
6653
|
};
|
|
6643
6654
|
//#endregion
|
|
6644
6655
|
//#region src/staged/bin.ts
|
|
6645
|
-
const args =
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
string: [
|
|
6669
|
-
"concurrent",
|
|
6670
|
-
"cwd",
|
|
6671
|
-
"diff",
|
|
6672
|
-
"diff-filter"
|
|
6673
|
-
]
|
|
6674
|
-
});
|
|
6675
|
-
if (args.help) {
|
|
6676
|
-
const helpMessage = renderCliDoc({
|
|
6677
|
-
usage: "vp staged [options]",
|
|
6678
|
-
summary: "Run linters on staged files using staged config from vite.config.ts.",
|
|
6679
|
-
documentationUrl: "https://viteplus.dev/guide/commit-hooks",
|
|
6680
|
-
sections: [{
|
|
6681
|
-
title: "Options",
|
|
6682
|
-
rows: [
|
|
6683
|
-
{
|
|
6684
|
-
label: "--allow-empty",
|
|
6685
|
-
description: "Allow empty commits when tasks revert all staged changes"
|
|
6686
|
-
},
|
|
6687
|
-
{
|
|
6688
|
-
label: "-p, --concurrent <number|boolean>",
|
|
6689
|
-
description: "Number of tasks to run concurrently, or false for serial"
|
|
6690
|
-
},
|
|
6691
|
-
{
|
|
6692
|
-
label: "--continue-on-error",
|
|
6693
|
-
description: "Run all tasks to completion even if one fails"
|
|
6694
|
-
},
|
|
6695
|
-
{
|
|
6696
|
-
label: "--cwd <path>",
|
|
6697
|
-
description: "Working directory to run all tasks in"
|
|
6698
|
-
},
|
|
6699
|
-
{
|
|
6700
|
-
label: "-d, --debug",
|
|
6701
|
-
description: "Enable debug output"
|
|
6702
|
-
},
|
|
6703
|
-
{
|
|
6704
|
-
label: "--diff <string>",
|
|
6705
|
-
description: "Override the default --staged flag of git diff"
|
|
6706
|
-
},
|
|
6707
|
-
{
|
|
6708
|
-
label: "--diff-filter <string>",
|
|
6709
|
-
description: "Override the default --diff-filter=ACMR flag of git diff"
|
|
6710
|
-
},
|
|
6711
|
-
{
|
|
6712
|
-
label: "--fail-on-changes",
|
|
6713
|
-
description: "Fail with exit code 1 when tasks modify tracked files"
|
|
6714
|
-
},
|
|
6715
|
-
{
|
|
6716
|
-
label: "--hide-partially-staged",
|
|
6717
|
-
description: "Hide unstaged changes from partially staged files"
|
|
6718
|
-
},
|
|
6719
|
-
{
|
|
6720
|
-
label: "--hide-unstaged",
|
|
6721
|
-
description: "Hide all unstaged changes before running tasks"
|
|
6722
|
-
},
|
|
6723
|
-
{
|
|
6724
|
-
label: "--no-stash",
|
|
6725
|
-
description: "Disable the backup stash"
|
|
6726
|
-
},
|
|
6727
|
-
{
|
|
6728
|
-
label: "-q, --quiet",
|
|
6729
|
-
description: "Disable console output"
|
|
6730
|
-
},
|
|
6731
|
-
{
|
|
6732
|
-
label: "-r, --relative",
|
|
6733
|
-
description: "Pass filepaths relative to cwd to tasks"
|
|
6734
|
-
},
|
|
6735
|
-
{
|
|
6736
|
-
label: "--revert",
|
|
6737
|
-
description: "Revert to original state in case of errors"
|
|
6738
|
-
},
|
|
6739
|
-
{
|
|
6740
|
-
label: "-v, --verbose",
|
|
6741
|
-
description: "Show task output even when tasks succeed"
|
|
6742
|
-
},
|
|
6743
|
-
{
|
|
6744
|
-
label: "-h, --help",
|
|
6745
|
-
description: "Show this help message"
|
|
6746
|
-
}
|
|
6747
|
-
]
|
|
6748
|
-
}]
|
|
6749
|
-
});
|
|
6656
|
+
const args = unwrapCliParseOutcome(parseStagedArgs(process.argv.slice(3)));
|
|
6657
|
+
const options = {};
|
|
6658
|
+
if (args.allowEmpty != null) options.allowEmpty = args.allowEmpty;
|
|
6659
|
+
if (args.debug != null) options.debug = args.debug;
|
|
6660
|
+
if (args.continueOnError != null) options.continueOnError = args.continueOnError;
|
|
6661
|
+
if (args.failOnChanges != null) options.failOnChanges = args.failOnChanges;
|
|
6662
|
+
if (args.hidePartiallyStaged != null) options.hidePartiallyStaged = args.hidePartiallyStaged;
|
|
6663
|
+
if (args.hideUnstaged != null) options.hideUnstaged = args.hideUnstaged;
|
|
6664
|
+
if (args.quiet != null) options.quiet = args.quiet;
|
|
6665
|
+
if (args.relative != null) options.relative = args.relative;
|
|
6666
|
+
if (args.revert != null) options.revert = args.revert;
|
|
6667
|
+
if (args.stash != null) options.stash = args.stash;
|
|
6668
|
+
if (args.verbose != null) options.verbose = args.verbose;
|
|
6669
|
+
let stagedConfig;
|
|
6670
|
+
try {
|
|
6671
|
+
stagedConfig = (await resolveViteConfig(args.cwd ?? process.cwd())).staged;
|
|
6672
|
+
} catch (err) {
|
|
6673
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
6674
|
+
log(`Failed to load vite.config: ${message}`);
|
|
6675
|
+
process.exit(1);
|
|
6676
|
+
}
|
|
6677
|
+
if (stagedConfig) options.config = stagedConfig;
|
|
6678
|
+
else {
|
|
6750
6679
|
printHeader();
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
if (args["hide-partially-staged"] != null) options.hidePartiallyStaged = args["hide-partially-staged"];
|
|
6759
|
-
if (args["hide-unstaged"] != null) options.hideUnstaged = args["hide-unstaged"];
|
|
6760
|
-
if (args.quiet != null) options.quiet = args.quiet;
|
|
6761
|
-
if (args.relative != null) options.relative = args.relative;
|
|
6762
|
-
if (args.revert != null) options.revert = args.revert;
|
|
6763
|
-
if (args.stash != null) options.stash = args.stash;
|
|
6764
|
-
if (args.verbose != null) options.verbose = args.verbose;
|
|
6765
|
-
let stagedConfig;
|
|
6766
|
-
try {
|
|
6767
|
-
stagedConfig = (await resolveViteConfig(args.cwd ?? process.cwd())).staged;
|
|
6768
|
-
} catch (err) {
|
|
6769
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
6770
|
-
log(`Failed to load vite.config: ${message}`);
|
|
6771
|
-
process.exit(1);
|
|
6772
|
-
}
|
|
6773
|
-
if (stagedConfig) options.config = stagedConfig;
|
|
6774
|
-
else {
|
|
6775
|
-
printHeader();
|
|
6776
|
-
errorMsg("No \"staged\" config found in vite.config.ts. Please add a staged config:");
|
|
6777
|
-
log("");
|
|
6778
|
-
log(" // vite.config.ts");
|
|
6779
|
-
log(" export default defineConfig({");
|
|
6780
|
-
log(" staged: { '*': 'vp check --fix' },");
|
|
6781
|
-
log(" });");
|
|
6782
|
-
process.exit(1);
|
|
6783
|
-
}
|
|
6784
|
-
if (args.cwd != null) options.cwd = args.cwd;
|
|
6785
|
-
if (args.diff != null) options.diff = args.diff;
|
|
6786
|
-
if (args["diff-filter"] != null) options.diffFilter = args["diff-filter"];
|
|
6787
|
-
if (args.concurrent != null) {
|
|
6788
|
-
const val = args.concurrent;
|
|
6789
|
-
if (val === "true") options.concurrent = true;
|
|
6790
|
-
else if (val === "false") options.concurrent = false;
|
|
6791
|
-
else {
|
|
6792
|
-
const num = Number(val);
|
|
6793
|
-
options.concurrent = Number.isNaN(num) || val === "" ? true : num;
|
|
6794
|
-
}
|
|
6795
|
-
}
|
|
6796
|
-
const success = await lintStaged(options);
|
|
6797
|
-
process.exit(success ? 0 : 1);
|
|
6680
|
+
errorMsg("No \"staged\" config found in vite.config.ts. Please add a staged config:");
|
|
6681
|
+
log("");
|
|
6682
|
+
log(" // vite.config.ts");
|
|
6683
|
+
log(" export default defineConfig({");
|
|
6684
|
+
log(" staged: { '*': 'vp check --fix' },");
|
|
6685
|
+
log(" });");
|
|
6686
|
+
process.exit(1);
|
|
6798
6687
|
}
|
|
6688
|
+
if (args.cwd != null) options.cwd = args.cwd;
|
|
6689
|
+
if (args.diff != null) options.diff = args.diff;
|
|
6690
|
+
if (args.diffFilter != null) options.diffFilter = args.diffFilter;
|
|
6691
|
+
if (args.concurrent != null) options.concurrent = args.concurrent;
|
|
6692
|
+
const success = await lintStaged(options);
|
|
6693
|
+
process.exit(success ? 0 : 1);
|
|
6799
6694
|
//#endregion
|
|
6800
6695
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|