vite-plus 0.3.0 → 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.
Files changed (80) hide show
  1. package/LICENSE +29 -29
  2. package/README.md +2 -2
  3. package/binding/index.cjs +60 -55
  4. package/binding/index.d.cts +125 -14
  5. package/dist/{agent-Wqx0MPk0.js → agent-C5jMYVfB.js} +3 -2
  6. package/dist/bin.js +89 -58
  7. package/dist/cli-parse-DHE8NrBU.js +13 -0
  8. package/dist/client/bundledDevClient.mjs +1 -1
  9. package/dist/client/client.mjs +1 -1
  10. package/dist/client/env.mjs +1 -1
  11. package/dist/client.d.ts +1 -1
  12. package/dist/config/bin.js +83 -55
  13. package/dist/{constants-Bn-U8o4v.js → constants-0IAVgpox.js} +3 -3
  14. package/dist/create/bin.d.ts +13 -5
  15. package/dist/create/bin.js +37 -190
  16. package/dist/{define-config-WiVlryJ2.cjs → define-config-DIE9de46.cjs} +1 -1
  17. package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
  18. package/dist/{define-config-GXUdVT-0.js → define-config-U3_xg7i-.js} +2 -2
  19. package/dist/define-config.cjs +1 -1
  20. package/dist/define-config.d.ts +1 -1
  21. package/dist/define-config.js +1 -1
  22. package/dist/dist-DfmT__Aw.js +619 -0
  23. package/dist/{editor-CC4DqODz.js → editor-B5-lvRaU.js} +68 -40
  24. package/dist/hooks/bin.js +9 -114
  25. package/dist/{hooks-DFqViZqZ.js → hooks-C-4gykWR.js} +1 -1
  26. package/dist/index.cjs +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +2 -2
  29. package/dist/internal.d.ts +1 -1
  30. package/dist/internal.js +1 -1
  31. package/dist/migration/bin.js +24 -143
  32. package/dist/migration/compat/worker.js +1 -1
  33. package/dist/module-runner.d.ts +1 -1
  34. package/dist/module-runner.js +1 -1
  35. package/dist/{oxlint-plugin-config-DX5ezKbB.js → oxlint-plugin-config-Drdl67Xp.js} +1 -1
  36. package/dist/oxlint-plugin.d.ts +2 -2
  37. package/dist/oxlint-plugin.js +1 -1
  38. package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
  39. package/dist/pack-bin.d.ts +2 -3
  40. package/dist/pack-bin.js +5 -622
  41. package/dist/pack-client.d.ts +1 -1
  42. package/dist/pack.d.ts +2 -2
  43. package/dist/pack.js +1 -1
  44. package/dist/{package-CBe9EWPY.js → package-BZz2Ij68.js} +1 -1
  45. package/dist/{prompts-DF3yU-eU.js → prompts-CtzEgFY-.js} +3 -1400
  46. package/dist/{report-ZNR1Mk6h.js → report-CK5TnTsr.js} +1 -0
  47. package/dist/{resolve-vite-config-ipGb39Jo.js → resolve-vite-config-CGks1xR7.js} +3 -3
  48. package/dist/resolve-vite-config-Dnmc-lBc.js +2 -0
  49. package/dist/semver-CaDAb8vV.js +1400 -0
  50. package/dist/staged/bin.js +83 -218
  51. package/dist/sync-versions/bin.d.ts +1 -0
  52. package/dist/sync-versions/bin.js +3884 -0
  53. package/dist/sync-versions/bin.mjs +13323 -0
  54. package/dist/toolchain.js +9 -9
  55. package/dist/toolchain.json +9 -9
  56. package/dist/{tsconfig-LD2QhQ0O.js → tsconfig-CUggNuJR.js} +2 -2
  57. package/dist/{tsconfig-BVHG3DpR.js → tsconfig-VAbm4ZzJ.js} +1 -1
  58. package/dist/tsgolint-path.d.ts +3 -4
  59. package/dist/types/customEvent.d.ts +1 -1
  60. package/dist/types/hmrPayload.d.ts +1 -1
  61. package/dist/types/hot.d.ts +1 -1
  62. package/dist/types/import-meta.d.ts +1 -1
  63. package/dist/types/importGlob.d.ts +1 -1
  64. package/dist/types/importMeta.d.ts +1 -1
  65. package/dist/types/metadata.d.ts +1 -1
  66. package/dist/version.d.ts +2 -3
  67. package/dist/version.js +2 -2
  68. package/dist/versions.js +4 -4
  69. package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
  70. package/docs/guide/check.md +1 -0
  71. package/docs/guide/ci.md +42 -2
  72. package/docs/guide/env.md +124 -52
  73. package/docs/guide/ide-integration.md +14 -2
  74. package/docs/guide/index.md +1 -1
  75. package/docs/guide/install.md +3 -1
  76. package/docs/guide/installer-env-vars.md +10 -0
  77. package/docs/guide/migrate-rules.md +57 -2
  78. package/package.json +17 -19
  79. package/dist/lib-L3DWSRQp.js +0 -75
  80. package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
@@ -1,18 +1,18 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
2
- import { t as renderCliDoc } from "../help-BmKpeOP9.js";
3
2
  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";
5
- import { t as lib_default } from "../lib-L3DWSRQp.js";
3
+ import { o as resolveViteConfig } from "../resolve-vite-config-CGks1xR7.js";
4
+ import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
6
5
  import { createRequire } from "node:module";
7
6
  import path, { basename, delimiter, dirname, normalize, resolve } from "node:path";
8
- import { pathToFileURL } from "node:url";
7
+ import { fileURLToPath, pathToFileURL } from "node:url";
8
+ import { parseStagedArgs } from "../../binding/index.js";
9
9
  import { formatWithOptions, inspect, promisify } from "node:util";
10
10
  import { closeSync, constants, openSync, readSync, statSync } from "node:fs";
11
+ import { EOL } from "node:os";
11
12
  import { cwd } from "node:process";
12
13
  import l__default from "node:readline";
13
14
  import nodeTty from "node:tty";
14
15
  import crypto from "node:crypto";
15
- import { EOL } from "node:os";
16
16
  import fsPromises, { constants as constants$2 } from "node:fs/promises";
17
17
  import { PassThrough, Writable } from "node:stream";
18
18
  import { exec, spawn } from "node:child_process";
@@ -118,7 +118,7 @@ const createDebug = (name) => {
118
118
  };
119
119
  };
120
120
  //#endregion
121
- //#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
121
+ //#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
122
122
  const isPathLikePattern = /^path$/i;
123
123
  const defaultEnvPathInfo = {
124
124
  key: "PATH",
@@ -139,7 +139,7 @@ function getPathFromEnv(env) {
139
139
  function addNodeBinToPath(cwd, path) {
140
140
  const parts = path.value.split(delimiter);
141
141
  const nodeBinPaths = [];
142
- let currentPath = cwd;
142
+ let currentPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd, { windows: false });
143
143
  let lastPath;
144
144
  do {
145
145
  nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
@@ -265,7 +265,8 @@ function resolveCommand(command, options) {
265
265
  let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
266
266
  if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
267
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);
268
+ const unquoted = path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path;
269
+ const dest = resolve(cwd$3, unquoted, command);
269
270
  for (const ext of extensions) {
270
271
  const destWithExt = dest + ext;
271
272
  try {
@@ -407,12 +408,12 @@ var ExecProcess = class {
407
408
  _streamOut;
408
409
  _streamErr;
409
410
  spawn() {
410
- const cwd$1 = cwd();
411
411
  const options = this._options;
412
412
  const nodeOptions = {
413
413
  ...defaultNodeOptions,
414
414
  ...options.nodeOptions
415
415
  };
416
+ const cwd$1 = nodeOptions?.cwd ?? cwd();
416
417
  const signals = [];
417
418
  this._resetState();
418
419
  if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
@@ -1559,7 +1560,7 @@ var DefaultRenderer = class DefaultRenderer {
1559
1560
  this.logger.options.color = this.options.color;
1560
1561
  }
1561
1562
  async render() {
1562
- const { createLogUpdate } = await import("../log-update-DHZRyJ2m.js");
1563
+ const { createLogUpdate } = await import("../log-update-CoW8Z4Dl.js");
1563
1564
  const { default: truncate } = await import("../cli-truncate-Bg3RDXpi.js");
1564
1565
  const { default: wrap } = await import("../wrap-ansi-DUi52C6W.js");
1565
1566
  this.updater = createLogUpdate(this.logger.process.stdout);
@@ -1795,9 +1796,7 @@ var DefaultRenderer = class DefaultRenderer {
1795
1796
  case ListrLogLevels.SKIPPED:
1796
1797
  data = task.message.skip;
1797
1798
  break;
1798
- case ListrLogLevels.FAILED:
1799
- data = task.message.error;
1800
- break;
1799
+ case ListrLogLevels.FAILED: data = task.message.error;
1801
1800
  }
1802
1801
  if (task.hasTitle() && source === ListrLogLevels.FAILED && data === task.title || typeof data !== "string") return [];
1803
1802
  if (source === ListrLogLevels.OUTPUT) data = cleanseAnsi(data);
@@ -2967,7 +2966,7 @@ const chunkFiles = ({ files, baseDir, maxArgLength = null, relative = false }) =
2967
2966
  return chunkArray(normalizedFiles, chunkCount);
2968
2967
  };
2969
2968
  //#endregion
2970
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/constants.js
2969
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js
2971
2970
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2972
2971
  const WIN_SLASH = "\\\\/";
2973
2972
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
@@ -3136,7 +3135,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3136
3135
  };
3137
3136
  }));
3138
3137
  //#endregion
3139
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/utils.js
3138
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
3140
3139
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
3141
3140
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
3142
3141
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -3184,7 +3183,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
3184
3183
  };
3185
3184
  }));
3186
3185
  //#endregion
3187
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/scan.js
3186
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
3188
3187
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3189
3188
  const utils = require_utils();
3190
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();
@@ -3213,7 +3212,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3213
3212
  const scan = (input, options) => {
3214
3213
  const opts = options || {};
3215
3214
  const length = input.length - 1;
3216
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
3215
+ const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
3217
3216
  const slashes = [];
3218
3217
  const tokens = [];
3219
3218
  const parts = [];
@@ -3316,14 +3315,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3316
3315
  finished = true;
3317
3316
  if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
3318
3317
  if (scanToEnd === true) {
3318
+ let parens = 0;
3319
3319
  while (eos() !== true && (code = advance())) {
3320
3320
  if (code === CHAR_BACKWARD_SLASH) {
3321
3321
  backslashes = token.backslashes = true;
3322
- code = advance();
3322
+ advance();
3323
+ continue;
3324
+ }
3325
+ if (code === CHAR_LEFT_PARENTHESES) {
3326
+ parens++;
3323
3327
  continue;
3324
3328
  }
3325
- if (code === CHAR_RIGHT_PARENTHESES) {
3326
- isGlob = token.isGlob = true;
3329
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
3327
3330
  finished = true;
3328
3331
  break;
3329
3332
  }
@@ -3371,13 +3374,18 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3371
3374
  if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
3372
3375
  isGlob = token.isGlob = true;
3373
3376
  if (scanToEnd === true) {
3377
+ let parens = 1;
3374
3378
  while (eos() !== true && (code = advance())) {
3375
- if (code === CHAR_LEFT_PARENTHESES) {
3379
+ if (code === CHAR_BACKWARD_SLASH) {
3376
3380
  backslashes = token.backslashes = true;
3377
- code = advance();
3381
+ advance();
3382
+ continue;
3383
+ }
3384
+ if (code === CHAR_LEFT_PARENTHESES) {
3385
+ parens++;
3378
3386
  continue;
3379
3387
  }
3380
- if (code === CHAR_RIGHT_PARENTHESES) {
3388
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
3381
3389
  finished = true;
3382
3390
  break;
3383
3391
  }
@@ -3440,7 +3448,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3440
3448
  if (opts.parts === true || opts.tokens === true) {
3441
3449
  let prevIndex;
3442
3450
  for (let idx = 0; idx < slashes.length; idx++) {
3443
- const n = prevIndex ? prevIndex + 1 : start;
3451
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
3444
3452
  const i = slashes[idx];
3445
3453
  const value = input.slice(n, i);
3446
3454
  if (opts.tokens) {
@@ -3451,18 +3459,19 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3451
3459
  depth(tokens[idx]);
3452
3460
  state.maxDepth += tokens[idx].depth;
3453
3461
  }
3454
- if (idx !== 0 || value !== "") parts.push(value);
3455
- prevIndex = i;
3456
- }
3457
- if (prevIndex && prevIndex + 1 < input.length) {
3458
- const value = input.slice(prevIndex + 1);
3459
- parts.push(value);
3460
- if (opts.tokens) {
3461
- tokens[tokens.length - 1].value = value;
3462
- depth(tokens[tokens.length - 1]);
3463
- state.maxDepth += tokens[tokens.length - 1].depth;
3462
+ if (i >= start) {
3463
+ parts.push(value);
3464
+ prevIndex = i;
3464
3465
  }
3465
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
+ }
3466
3475
  state.slashes = slashes;
3467
3476
  state.parts = parts;
3468
3477
  }
@@ -3471,7 +3480,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3471
3480
  module.exports = scan;
3472
3481
  }));
3473
3482
  //#endregion
3474
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/parse.js
3483
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
3475
3484
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3476
3485
  const constants = require_constants();
3477
3486
  const utils = require_utils();
@@ -4373,6 +4382,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4373
4382
  rest = rest.slice(3);
4374
4383
  consume("/**", 3);
4375
4384
  }
4385
+ const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
4376
4386
  if (prior.type === "bos" && eos()) {
4377
4387
  prev.type = "globstar";
4378
4388
  prev.value += value;
@@ -4382,7 +4392,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4382
4392
  consume(value);
4383
4393
  continue;
4384
4394
  }
4385
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
4395
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
4386
4396
  state.output = state.output.slice(0, -(prior.output + prev.output).length);
4387
4397
  prior.output = `(?:${prior.output}`;
4388
4398
  prev.type = "globstar";
@@ -4547,7 +4557,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4547
4557
  module.exports = parse;
4548
4558
  }));
4549
4559
  //#endregion
4550
- //#region ../../node_modules/.pnpm/picomatch@4.0.5/node_modules/picomatch/lib/picomatch.js
4560
+ //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
4551
4561
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4552
4562
  const scan = require_scan();
4553
4563
  const parse = require_parse();
@@ -6642,189 +6652,44 @@ const lintStaged = async ({ allowEmpty = false, color = SUPPORTS_COLOR, concurre
6642
6652
  }
6643
6653
  };
6644
6654
  //#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
6703
6655
  //#region src/staged/bin.ts
6704
- const args = parseStagedArgs(process.argv.slice(3));
6705
- if (args.help) {
6706
- const helpMessage = renderCliDoc({
6707
- usage: "vp staged [options]",
6708
- summary: "Run linters on staged files using staged config from vite.config.ts.",
6709
- documentationUrl: "https://viteplus.dev/guide/commit-hooks",
6710
- sections: [{
6711
- title: "Options",
6712
- rows: [
6713
- {
6714
- label: "--allow-empty",
6715
- description: "Allow empty commits when tasks revert all staged changes"
6716
- },
6717
- {
6718
- label: "-p, --concurrent <number|boolean>",
6719
- description: "Number of tasks to run concurrently, or false for serial"
6720
- },
6721
- {
6722
- label: "--continue-on-error",
6723
- description: "Run all tasks to completion even if one fails"
6724
- },
6725
- {
6726
- label: "--cwd <path>",
6727
- description: "Working directory to run all tasks in"
6728
- },
6729
- {
6730
- label: "-d, --debug",
6731
- description: "Enable debug output"
6732
- },
6733
- {
6734
- label: "--diff <string>",
6735
- description: "Override the default --staged flag of git diff"
6736
- },
6737
- {
6738
- label: "--diff-filter <string>",
6739
- description: "Override the default --diff-filter=ACMR flag of git diff"
6740
- },
6741
- {
6742
- label: "--fail-on-changes",
6743
- description: "Fail with exit code 1 when tasks modify tracked files"
6744
- },
6745
- {
6746
- label: "--hide-partially-staged",
6747
- description: "Hide unstaged changes from partially staged files"
6748
- },
6749
- {
6750
- label: "--hide-unstaged",
6751
- description: "Hide all unstaged changes before running tasks"
6752
- },
6753
- {
6754
- label: "--no-stash",
6755
- description: "Disable the backup stash"
6756
- },
6757
- {
6758
- label: "-q, --quiet",
6759
- description: "Disable console output"
6760
- },
6761
- {
6762
- label: "-r, --relative",
6763
- description: "Pass filepaths relative to cwd to tasks"
6764
- },
6765
- {
6766
- label: "--revert",
6767
- description: "Revert to original state in case of errors"
6768
- },
6769
- {
6770
- label: "-v, --verbose",
6771
- description: "Show task output even when tasks succeed"
6772
- },
6773
- {
6774
- label: "-h, --help",
6775
- description: "Show this help message"
6776
- }
6777
- ]
6778
- }]
6779
- });
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 {
6780
6679
  printHeader();
6781
- log(helpMessage);
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
- }
6791
- const options = {};
6792
- if (args["allow-empty"] != null) options.allowEmpty = args["allow-empty"];
6793
- if (args.debug != null) options.debug = args.debug;
6794
- if (args["continue-on-error"] != null) options.continueOnError = args["continue-on-error"];
6795
- if (args["fail-on-changes"] != null) options.failOnChanges = args["fail-on-changes"];
6796
- if (args["hide-partially-staged"] != null) options.hidePartiallyStaged = args["hide-partially-staged"];
6797
- if (args["hide-unstaged"] != null) options.hideUnstaged = args["hide-unstaged"];
6798
- if (args.quiet != null) options.quiet = args.quiet;
6799
- if (args.relative != null) options.relative = args.relative;
6800
- if (args.revert != null) options.revert = args.revert;
6801
- if (args.stash != null) options.stash = args.stash;
6802
- if (args.verbose != null) options.verbose = args.verbose;
6803
- let stagedConfig;
6804
- try {
6805
- stagedConfig = (await resolveViteConfig(normalizedArgs.cwd ?? process.cwd())).staged;
6806
- } catch (err) {
6807
- const message = err instanceof Error ? err.message : String(err);
6808
- log(`Failed to load vite.config: ${message}`);
6809
- process.exit(1);
6810
- }
6811
- if (stagedConfig) options.config = stagedConfig;
6812
- else {
6813
- printHeader();
6814
- errorMsg("No \"staged\" config found in vite.config.ts. Please add a staged config:");
6815
- log("");
6816
- log(" // vite.config.ts");
6817
- log(" export default defineConfig({");
6818
- log(" staged: { '*': 'vp check --fix' },");
6819
- log(" });");
6820
- process.exit(1);
6821
- }
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;
6826
- const success = await lintStaged(options);
6827
- 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);
6828
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);
6829
6694
  //#endregion
6830
6695
  export {};
@@ -0,0 +1 @@
1
+ export {}