vite-plus 1.3.0 → 1.4.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 +4 -0
- package/LICENSE +1 -878
- package/README.md +1 -1
- package/bin/vpx +9 -0
- package/binding/index.cjs +59 -54
- package/binding/index.d.cts +128 -2
- package/dist/{agent-97KmGCyL.js → agent-D8oxxhVR.js} +5 -7
- package/dist/bin.js +25 -32
- package/dist/{cli-parse-DHE8NrBU.js → cli-parse-aeUeFDlC.js} +2 -3
- package/dist/command-TjS_6y9O.js +1 -0
- package/dist/{command-CdMBoZFD.js → command-rY79K5NI.js} +28 -30
- package/dist/{comparison-CmVirWIW-DUGaiYqF.js → comparison-CmVirWIW-UlEf2maz.js} +1 -2
- package/dist/config/bin.js +8 -10
- package/dist/{constants-DR55DpRm.js → constants-DRUnJ_Dz.js} +3 -5
- package/dist/create/bin.d.ts +4 -8
- package/dist/create/bin.js +46 -65
- package/dist/{define-config-CvE5pHqB.js → define-config-ChwJcu5e.js} +6 -9
- package/dist/{define-config-BxDc_9BK.cjs → define-config-Cv2P6NT2.cjs} +7 -12
- package/dist/{define-config-Bexdd6RZ.d.ts → define-config-rPhYIFSn.d.ts} +1 -11
- 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-DIpm7mot.js → dist-Bs0SObNC.js} +73 -145
- package/dist/{dist-Cqz8OtiO.js → dist-CdkMvIiQ.js} +11 -5
- package/dist/dist-zDZV5eEc.js +3 -0
- package/dist/{documentation-DqcZSthV.js → documentation-cv_y0Auv.js} +1 -2
- package/dist/{editor-CtJGQP7C.js → editor-ClL78D8u.js} +1490 -4209
- package/dist/{help-BmKpeOP9.js → help-B03t_iQ4.js} +1 -2
- package/dist/hooks/bin.js +4 -5
- package/dist/{hooks-DhwsWb46.js → hooks-xRcJPc-O.js} +5 -4
- package/dist/index.cjs +2 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-JP24qHUF.js → json-kl84kDyH.js} +9 -18
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +719 -184
- package/dist/migration/compat/worker.js +4 -6
- package/dist/{oxlint-plugin-config-BIzrO2y2.js → oxlint-plugin-config-BVpqYdcC.js} +3 -4
- package/dist/oxlint-plugin.d.ts +0 -2
- package/dist/oxlint-plugin.js +6 -7
- package/dist/{pack-BK38MLVZ.d.ts → pack-ARPFMefW.d.ts} +0 -2
- package/dist/pack-bin.d.ts +1 -3
- package/dist/pack-bin.js +3 -4
- package/dist/pack.d.ts +1 -1
- package/dist/{package-CQDXTm6j.js → package-DzsomcUD.js} +10 -95
- package/dist/{package-overrides-D1RcXSFl.js → package-overrides-Ci8GXouY.js} +5 -8
- package/dist/picomatch-DEUoj81q.js +1916 -0
- package/dist/{prompts-1xNz_ne0.js → prompts-GL1vj0wk.js} +30 -50
- package/dist/{protocol-D99W10Qi.js → protocol-CkNmY-Mr.js} +1 -2
- package/dist/{report-NhQk8VHb.js → report-DLHO30yZ.js} +2 -2
- package/dist/{resolve-vite-config-BVr1SUNg.js → resolve-vite-config-Dn5896A4.js} +9 -25
- package/dist/resolve-vite-config-QO6cC0SP.js +1 -0
- package/dist/{rolldown-runtime-kJ_i4yPo.js → rolldown-runtime-DegdyBIC.js} +1 -2
- package/dist/script-esm-hooks.d.ts +8 -0
- package/dist/script-esm-hooks.js +24 -0
- package/dist/script-hooks-9Fof5UMY.js +176 -0
- package/dist/script-preload.cjs +468 -0
- package/dist/script-register.d.ts +1 -0
- package/dist/script-register.js +22 -0
- package/dist/script-watch.d.ts +1 -0
- package/dist/script-watch.js +1908 -0
- package/dist/staged/bin.js +53 -2011
- package/dist/sync-versions/bin.js +26 -48
- package/dist/sync-versions/bin.mjs +109 -217
- package/dist/{terminal-MKGAuy-p.js → terminal-BcuPUy-j.js} +1 -2
- package/dist/toolchain.js +35 -9
- package/dist/toolchain.json +35 -9
- package/dist/{tsconfig-zWgHiQ3X.js → tsconfig-Do6MAG_f.js} +1 -1
- package/dist/{tsconfig-BZu7kl-x.js → tsconfig-LE_mAwe_.js} +8 -10
- package/dist/version.d.ts +1 -3
- package/dist/version.js +5 -6
- package/dist/versions.js +4 -4
- package/dist/{vitest-ecosystem-BU0AqZq-.js → vitest-ecosystem-BeEYz-qF.js} +1 -2
- package/dist/{vitest-v5-entry-points-DthU1e_O.js → vitest-v5-entry-points-NyJsFeux.js} +1 -2
- package/dist/vpx-bin.d.ts +1 -0
- package/dist/vpx-bin.js +232 -0
- package/dist/vpx-script-EXgV5QOf.js +434 -0
- package/docs/config/run.md +4 -0
- package/docs/guide/check.md +1 -0
- package/docs/guide/ci.md +13 -3
- package/docs/guide/env.md +11 -4
- package/docs/guide/global-cli.md +52 -0
- package/docs/guide/migrate-rules.md +48 -5
- package/docs/guide/migrate.md +5 -5
- package/docs/guide/package-management.md +1 -1
- package/docs/guide/vpx.md +170 -9
- package/package.json +20 -17
- package/dist/command-DVTILtS-.js +0 -1
- package/dist/dist-Dhu07wmN.js +0 -3
- package/dist/resolve-vite-config-7WDtXO4G.js +0 -1
package/dist/staged/bin.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { r as __toESM
|
|
2
|
-
import { i as log, n as errorMsg, o as printHeader } from "../terminal-
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import { r as __toESM } from "../rolldown-runtime-DegdyBIC.js";
|
|
2
|
+
import { i as log, n as errorMsg, o as printHeader } from "../terminal-BcuPUy-j.js";
|
|
3
|
+
import { a as resolveViteConfig } from "../resolve-vite-config-Dn5896A4.js";
|
|
4
|
+
import { t as require_picomatch } from "../picomatch-DEUoj81q.js";
|
|
5
|
+
import { t as unwrapCliParseOutcome } from "../cli-parse-aeUeFDlC.js";
|
|
5
6
|
import { createRequire } from "node:module";
|
|
6
7
|
import path, { basename, delimiter, dirname, normalize, resolve } from "node:path";
|
|
7
8
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -11,11 +12,11 @@ import { closeSync, constants, openSync, readSync, statSync } from "node:fs";
|
|
|
11
12
|
import { cwd } from "node:process";
|
|
12
13
|
import l__default from "node:readline";
|
|
13
14
|
import crypto from "node:crypto";
|
|
14
|
-
import fsPromises, { constants as constants$1 } from "node:fs/promises";
|
|
15
|
-
import { PassThrough } from "node:stream";
|
|
16
15
|
import { exec, spawn } from "node:child_process";
|
|
16
|
+
import fsPromises, { constants as constants$1 } from "node:fs/promises";
|
|
17
17
|
import { pipeline } from "node:stream/promises";
|
|
18
|
-
|
|
18
|
+
import { PassThrough } from "node:stream";
|
|
19
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/assertGitVersion.js
|
|
19
20
|
/** @see {@link https://github.com/git/git/blob/master/Documentation/RelNotes/2.32.0.adoc} */
|
|
20
21
|
const MIN_GIT_VERSION = "2.32.0";
|
|
21
22
|
const GIT_VERSION_REGEXP = /git version\s+(\d+\.\d+\.\d+)/i;
|
|
@@ -60,8 +61,7 @@ const assertGitVersion = (gitVersionOutput) => {
|
|
|
60
61
|
return false;
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/colors.js
|
|
64
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/colors.js
|
|
65
65
|
let COLORS_ENABLED = false;
|
|
66
66
|
/** Node.js util checks for FORCE_COLOR/NO_COLOR and whether TTY supports ANSI colors */
|
|
67
67
|
const supportsColors = (stream = process.stdout) => util.styleText("red", "test", { stream }) !== "test";
|
|
@@ -80,8 +80,7 @@ const yellow = styleText$1("yellow");
|
|
|
80
80
|
const blue = styleText$1("blue");
|
|
81
81
|
const dim = styleText$1("dim");
|
|
82
82
|
const bold = styleText$1("bold");
|
|
83
|
-
|
|
84
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/debug.js
|
|
83
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/debug.js
|
|
85
84
|
const format$1 = (...args) => formatWithOptions({ colors: COLORS_ENABLED }, ...args);
|
|
86
85
|
let activeLogger;
|
|
87
86
|
const enableDebug = (logger = console) => {
|
|
@@ -98,8 +97,7 @@ const createDebug = (name) => {
|
|
|
98
97
|
activeLogger.debug(dim(name + ": ") + format$1(...args) + dim(` +${ms}ms`));
|
|
99
98
|
};
|
|
100
99
|
};
|
|
101
|
-
|
|
102
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
|
|
100
|
+
// ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
|
|
103
101
|
const isPathLikePattern = /^path$/i;
|
|
104
102
|
const defaultEnvPathInfo = {
|
|
105
103
|
key: "PATH",
|
|
@@ -439,8 +437,7 @@ const x = (command, args, userOptions) => {
|
|
|
439
437
|
return proc;
|
|
440
438
|
};
|
|
441
439
|
const exec$1 = x;
|
|
442
|
-
|
|
443
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/execGit.js
|
|
440
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/execGit.js
|
|
444
441
|
const debugLog$17 = createDebug("lint-staged:execGit");
|
|
445
442
|
/**
|
|
446
443
|
* Explicitly never recurse commands into submodules, overriding local/global configuration.
|
|
@@ -463,8 +460,7 @@ const execGit = async (cmd, options) => {
|
|
|
463
460
|
if (options?.trim === false) return result.stdout;
|
|
464
461
|
return result.stdout.trimEnd();
|
|
465
462
|
};
|
|
466
|
-
|
|
467
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/figures.js
|
|
463
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/figures.js
|
|
468
464
|
const wip = () => blue("⋯");
|
|
469
465
|
const done = () => green("✔");
|
|
470
466
|
const info = () => blue("→");
|
|
@@ -474,8 +470,7 @@ const cancelled = () => dim("↓");
|
|
|
474
470
|
const parallelGroupStart = () => dim("┌");
|
|
475
471
|
const parallelGroupMiddle = () => dim("│");
|
|
476
472
|
const parallelGroupStop = () => dim("└");
|
|
477
|
-
|
|
478
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/messages.js
|
|
473
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/messages.js
|
|
479
474
|
const configurationError = (opt, helpMsg, value) => `${red(`${error()} Validation Error:`)}
|
|
480
475
|
|
|
481
476
|
Invalid value for '${bold(opt)}': ${bold(inspect(value))}
|
|
@@ -529,8 +524,7 @@ const unstagedChangesBackupStashLocation = () => "Unstaged changes have been kep
|
|
|
529
524
|
const minGitVersionRequired = (expected) => red(`${error()} lint-staged requires at least Git version ${bold(expected)}.
|
|
530
525
|
|
|
531
526
|
Please update Git: https://git-scm.com/downloads`);
|
|
532
|
-
|
|
533
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getMaxArgLength.js
|
|
527
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getMaxArgLength.js
|
|
534
528
|
/**
|
|
535
529
|
* Get the maximum length of a command-line argument string based on current platform
|
|
536
530
|
*
|
|
@@ -545,8 +539,7 @@ const getMaxArgLength = (platform = process.platform) => {
|
|
|
545
539
|
default: return 131072;
|
|
546
540
|
}
|
|
547
541
|
};
|
|
548
|
-
|
|
549
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/parseOptions.js
|
|
542
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/parseOptions.js
|
|
550
543
|
const debugLog$16 = createDebug("lint-staged:parseOptions");
|
|
551
544
|
/** @param {import('./index').Options} [options] */
|
|
552
545
|
const parseOptions = ({ all, allowEmpty, color, concurrent, config: configObject, configPath, continueOnError, cwd, debug, diff, diffFilter, failOnChanges, hideAll, hidePartiallyStaged, hideUnstaged, maxArgLength, quiet, relative, revert, stash, verbose } = {}) => {
|
|
@@ -600,8 +593,7 @@ const parseOptions = ({ all, allowEmpty, color, concurrent, config: configObject
|
|
|
600
593
|
debugLog$16("Parsed options: %o", options);
|
|
601
594
|
return options;
|
|
602
595
|
};
|
|
603
|
-
|
|
604
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/printTaskOutput.js
|
|
596
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/printTaskOutput.js
|
|
605
597
|
/**
|
|
606
598
|
* Handle logging of task `ctx.output` to the specified `logger`
|
|
607
599
|
* @param {Object} ctx - The context
|
|
@@ -612,1926 +604,8 @@ const printTaskOutput = (ctx = {}, logger) => {
|
|
|
612
604
|
const log = ctx.errors?.size > 0 ? logger.error : logger.log;
|
|
613
605
|
for (const line of ctx.output) log(line);
|
|
614
606
|
};
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
618
|
-
const WIN_SLASH = "\\\\/";
|
|
619
|
-
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
620
|
-
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
621
|
-
/**
|
|
622
|
-
* Posix glob regex
|
|
623
|
-
*/
|
|
624
|
-
const DOT_LITERAL = "\\.";
|
|
625
|
-
const PLUS_LITERAL = "\\+";
|
|
626
|
-
const QMARK_LITERAL = "\\?";
|
|
627
|
-
const SLASH_LITERAL = "\\/";
|
|
628
|
-
const ONE_CHAR = "(?=.)";
|
|
629
|
-
const QMARK = "[^/]";
|
|
630
|
-
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
631
|
-
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
632
|
-
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
633
|
-
const POSIX_CHARS = {
|
|
634
|
-
DOT_LITERAL,
|
|
635
|
-
PLUS_LITERAL,
|
|
636
|
-
QMARK_LITERAL,
|
|
637
|
-
SLASH_LITERAL,
|
|
638
|
-
ONE_CHAR,
|
|
639
|
-
QMARK,
|
|
640
|
-
END_ANCHOR,
|
|
641
|
-
DOTS_SLASH,
|
|
642
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
643
|
-
NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
|
|
644
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
|
|
645
|
-
NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
|
|
646
|
-
QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
|
|
647
|
-
STAR: `${QMARK}*?`,
|
|
648
|
-
START_ANCHOR,
|
|
649
|
-
SEP: "/"
|
|
650
|
-
};
|
|
651
|
-
/**
|
|
652
|
-
* Windows glob regex
|
|
653
|
-
*/
|
|
654
|
-
const WINDOWS_CHARS = {
|
|
655
|
-
...POSIX_CHARS,
|
|
656
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
657
|
-
QMARK: WIN_NO_SLASH,
|
|
658
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
659
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
660
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
661
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
662
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
663
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
664
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
665
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
666
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
667
|
-
SEP: "\\"
|
|
668
|
-
};
|
|
669
|
-
module.exports = {
|
|
670
|
-
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
671
|
-
MAX_LENGTH: 65536,
|
|
672
|
-
POSIX_REGEX_SOURCE: {
|
|
673
|
-
__proto__: null,
|
|
674
|
-
alnum: "a-zA-Z0-9",
|
|
675
|
-
alpha: "a-zA-Z",
|
|
676
|
-
ascii: "\\x00-\\x7F",
|
|
677
|
-
blank: " \\t",
|
|
678
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
679
|
-
digit: "0-9",
|
|
680
|
-
graph: "\\x21-\\x7E",
|
|
681
|
-
lower: "a-z",
|
|
682
|
-
print: "\\x20-\\x7E ",
|
|
683
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
684
|
-
space: " \\t\\r\\n\\v\\f",
|
|
685
|
-
upper: "A-Z",
|
|
686
|
-
word: "A-Za-z0-9_",
|
|
687
|
-
xdigit: "A-Fa-f0-9"
|
|
688
|
-
},
|
|
689
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
690
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
691
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
692
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
693
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
694
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
695
|
-
REPLACEMENTS: {
|
|
696
|
-
__proto__: null,
|
|
697
|
-
"***": "*",
|
|
698
|
-
"**/**": "**",
|
|
699
|
-
"**/**/**": "**"
|
|
700
|
-
},
|
|
701
|
-
CHAR_0: 48,
|
|
702
|
-
CHAR_9: 57,
|
|
703
|
-
CHAR_UPPERCASE_A: 65,
|
|
704
|
-
CHAR_LOWERCASE_A: 97,
|
|
705
|
-
CHAR_UPPERCASE_Z: 90,
|
|
706
|
-
CHAR_LOWERCASE_Z: 122,
|
|
707
|
-
CHAR_LEFT_PARENTHESES: 40,
|
|
708
|
-
CHAR_RIGHT_PARENTHESES: 41,
|
|
709
|
-
CHAR_ASTERISK: 42,
|
|
710
|
-
CHAR_AMPERSAND: 38,
|
|
711
|
-
CHAR_AT: 64,
|
|
712
|
-
CHAR_BACKWARD_SLASH: 92,
|
|
713
|
-
CHAR_CARRIAGE_RETURN: 13,
|
|
714
|
-
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
715
|
-
CHAR_COLON: 58,
|
|
716
|
-
CHAR_COMMA: 44,
|
|
717
|
-
CHAR_DOT: 46,
|
|
718
|
-
CHAR_DOUBLE_QUOTE: 34,
|
|
719
|
-
CHAR_EQUAL: 61,
|
|
720
|
-
CHAR_EXCLAMATION_MARK: 33,
|
|
721
|
-
CHAR_FORM_FEED: 12,
|
|
722
|
-
CHAR_FORWARD_SLASH: 47,
|
|
723
|
-
CHAR_GRAVE_ACCENT: 96,
|
|
724
|
-
CHAR_HASH: 35,
|
|
725
|
-
CHAR_HYPHEN_MINUS: 45,
|
|
726
|
-
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
727
|
-
CHAR_LEFT_CURLY_BRACE: 123,
|
|
728
|
-
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
729
|
-
CHAR_LINE_FEED: 10,
|
|
730
|
-
CHAR_NO_BREAK_SPACE: 160,
|
|
731
|
-
CHAR_PERCENT: 37,
|
|
732
|
-
CHAR_PLUS: 43,
|
|
733
|
-
CHAR_QUESTION_MARK: 63,
|
|
734
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
735
|
-
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
736
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
737
|
-
CHAR_SEMICOLON: 59,
|
|
738
|
-
CHAR_SINGLE_QUOTE: 39,
|
|
739
|
-
CHAR_SPACE: 32,
|
|
740
|
-
CHAR_TAB: 9,
|
|
741
|
-
CHAR_UNDERSCORE: 95,
|
|
742
|
-
CHAR_VERTICAL_LINE: 124,
|
|
743
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
744
|
-
/**
|
|
745
|
-
* Create EXTGLOB_CHARS
|
|
746
|
-
*/
|
|
747
|
-
extglobChars(chars) {
|
|
748
|
-
return {
|
|
749
|
-
"!": {
|
|
750
|
-
type: "negate",
|
|
751
|
-
open: "(?:(?!(?:",
|
|
752
|
-
close: `))${chars.STAR})`
|
|
753
|
-
},
|
|
754
|
-
"?": {
|
|
755
|
-
type: "qmark",
|
|
756
|
-
open: "(?:",
|
|
757
|
-
close: ")?"
|
|
758
|
-
},
|
|
759
|
-
"+": {
|
|
760
|
-
type: "plus",
|
|
761
|
-
open: "(?:",
|
|
762
|
-
close: ")+"
|
|
763
|
-
},
|
|
764
|
-
"*": {
|
|
765
|
-
type: "star",
|
|
766
|
-
open: "(?:",
|
|
767
|
-
close: ")*"
|
|
768
|
-
},
|
|
769
|
-
"@": {
|
|
770
|
-
type: "at",
|
|
771
|
-
open: "(?:",
|
|
772
|
-
close: ")"
|
|
773
|
-
}
|
|
774
|
-
};
|
|
775
|
-
},
|
|
776
|
-
/**
|
|
777
|
-
* Create GLOB_CHARS
|
|
778
|
-
*/
|
|
779
|
-
globChars(win32) {
|
|
780
|
-
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
}));
|
|
784
|
-
//#endregion
|
|
785
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
|
|
786
|
-
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
787
|
-
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
788
|
-
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
789
|
-
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
790
|
-
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
791
|
-
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
792
|
-
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
793
|
-
exports.isWindows = () => {
|
|
794
|
-
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
795
|
-
const platform = navigator.platform.toLowerCase();
|
|
796
|
-
return platform === "win32" || platform === "windows";
|
|
797
|
-
}
|
|
798
|
-
if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
|
|
799
|
-
return false;
|
|
800
|
-
};
|
|
801
|
-
exports.removeBackslashes = (str) => {
|
|
802
|
-
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
803
|
-
return match === "\\" ? "" : match;
|
|
804
|
-
});
|
|
805
|
-
};
|
|
806
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
807
|
-
const idx = input.lastIndexOf(char, lastIdx);
|
|
808
|
-
if (idx === -1) return input;
|
|
809
|
-
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
810
|
-
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
811
|
-
};
|
|
812
|
-
exports.removePrefix = (input, state = {}) => {
|
|
813
|
-
let output = input;
|
|
814
|
-
if (output.startsWith("./")) {
|
|
815
|
-
output = output.slice(2);
|
|
816
|
-
state.prefix = "./";
|
|
817
|
-
}
|
|
818
|
-
return output;
|
|
819
|
-
};
|
|
820
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
821
|
-
let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
|
|
822
|
-
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
823
|
-
return output;
|
|
824
|
-
};
|
|
825
|
-
exports.basename = (path, { windows } = {}) => {
|
|
826
|
-
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
827
|
-
const last = segs[segs.length - 1];
|
|
828
|
-
if (last === "") return segs[segs.length - 2];
|
|
829
|
-
return last;
|
|
830
|
-
};
|
|
831
|
-
}));
|
|
832
|
-
//#endregion
|
|
833
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
|
|
834
|
-
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
835
|
-
const utils = require_utils();
|
|
836
|
-
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();
|
|
837
|
-
const isPathSeparator = (code) => {
|
|
838
|
-
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
839
|
-
};
|
|
840
|
-
const depth = (token) => {
|
|
841
|
-
if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
|
|
842
|
-
};
|
|
843
|
-
/**
|
|
844
|
-
* Quickly scans a glob pattern and returns an object with a handful of
|
|
845
|
-
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
846
|
-
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
847
|
-
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
848
|
-
*
|
|
849
|
-
* ```js
|
|
850
|
-
* const pm = require('picomatch');
|
|
851
|
-
* console.log(pm.scan('foo/bar/*.js'));
|
|
852
|
-
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
853
|
-
* ```
|
|
854
|
-
* @param {String} `str`
|
|
855
|
-
* @param {Object} `options`
|
|
856
|
-
* @return {Object} Returns an object with tokens and regex source string.
|
|
857
|
-
* @api public
|
|
858
|
-
*/
|
|
859
|
-
const scan = (input, options) => {
|
|
860
|
-
const opts = options || {};
|
|
861
|
-
const length = input.length - 1;
|
|
862
|
-
const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
|
|
863
|
-
const slashes = [];
|
|
864
|
-
const tokens = [];
|
|
865
|
-
const parts = [];
|
|
866
|
-
let str = input;
|
|
867
|
-
let index = -1;
|
|
868
|
-
let start = 0;
|
|
869
|
-
let lastIndex = 0;
|
|
870
|
-
let isBrace = false;
|
|
871
|
-
let isBracket = false;
|
|
872
|
-
let isGlob = false;
|
|
873
|
-
let isExtglob = false;
|
|
874
|
-
let isGlobstar = false;
|
|
875
|
-
let braceEscaped = false;
|
|
876
|
-
let backslashes = false;
|
|
877
|
-
let negated = false;
|
|
878
|
-
let negatedExtglob = false;
|
|
879
|
-
let finished = false;
|
|
880
|
-
let braces = 0;
|
|
881
|
-
let prev;
|
|
882
|
-
let code;
|
|
883
|
-
let token = {
|
|
884
|
-
value: "",
|
|
885
|
-
depth: 0,
|
|
886
|
-
isGlob: false
|
|
887
|
-
};
|
|
888
|
-
const eos = () => index >= length;
|
|
889
|
-
const peek = () => str.charCodeAt(index + 1);
|
|
890
|
-
const advance = () => {
|
|
891
|
-
prev = code;
|
|
892
|
-
return str.charCodeAt(++index);
|
|
893
|
-
};
|
|
894
|
-
while (index < length) {
|
|
895
|
-
code = advance();
|
|
896
|
-
let next;
|
|
897
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
898
|
-
backslashes = token.backslashes = true;
|
|
899
|
-
code = advance();
|
|
900
|
-
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
901
|
-
continue;
|
|
902
|
-
}
|
|
903
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
904
|
-
braces++;
|
|
905
|
-
while (eos() !== true && (code = advance())) {
|
|
906
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
907
|
-
backslashes = token.backslashes = true;
|
|
908
|
-
advance();
|
|
909
|
-
continue;
|
|
910
|
-
}
|
|
911
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
912
|
-
braces++;
|
|
913
|
-
continue;
|
|
914
|
-
}
|
|
915
|
-
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
916
|
-
isBrace = token.isBrace = true;
|
|
917
|
-
isGlob = token.isGlob = true;
|
|
918
|
-
finished = true;
|
|
919
|
-
if (scanToEnd === true) continue;
|
|
920
|
-
break;
|
|
921
|
-
}
|
|
922
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
923
|
-
isBrace = token.isBrace = true;
|
|
924
|
-
isGlob = token.isGlob = true;
|
|
925
|
-
finished = true;
|
|
926
|
-
if (scanToEnd === true) continue;
|
|
927
|
-
break;
|
|
928
|
-
}
|
|
929
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
930
|
-
braces--;
|
|
931
|
-
if (braces === 0) {
|
|
932
|
-
braceEscaped = false;
|
|
933
|
-
isBrace = token.isBrace = true;
|
|
934
|
-
finished = true;
|
|
935
|
-
break;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
if (scanToEnd === true) continue;
|
|
940
|
-
break;
|
|
941
|
-
}
|
|
942
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
943
|
-
slashes.push(index);
|
|
944
|
-
tokens.push(token);
|
|
945
|
-
token = {
|
|
946
|
-
value: "",
|
|
947
|
-
depth: 0,
|
|
948
|
-
isGlob: false
|
|
949
|
-
};
|
|
950
|
-
if (finished === true) continue;
|
|
951
|
-
if (prev === CHAR_DOT && index === start + 1) {
|
|
952
|
-
start += 2;
|
|
953
|
-
continue;
|
|
954
|
-
}
|
|
955
|
-
lastIndex = index + 1;
|
|
956
|
-
continue;
|
|
957
|
-
}
|
|
958
|
-
if (opts.noext !== true) {
|
|
959
|
-
if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
960
|
-
isGlob = token.isGlob = true;
|
|
961
|
-
isExtglob = token.isExtglob = true;
|
|
962
|
-
finished = true;
|
|
963
|
-
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
964
|
-
if (scanToEnd === true) {
|
|
965
|
-
let parens = 0;
|
|
966
|
-
while (eos() !== true && (code = advance())) {
|
|
967
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
968
|
-
backslashes = token.backslashes = true;
|
|
969
|
-
advance();
|
|
970
|
-
continue;
|
|
971
|
-
}
|
|
972
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
973
|
-
parens++;
|
|
974
|
-
continue;
|
|
975
|
-
}
|
|
976
|
-
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
977
|
-
finished = true;
|
|
978
|
-
break;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
continue;
|
|
982
|
-
}
|
|
983
|
-
break;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
if (code === CHAR_ASTERISK) {
|
|
987
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
988
|
-
isGlob = token.isGlob = true;
|
|
989
|
-
finished = true;
|
|
990
|
-
if (scanToEnd === true) continue;
|
|
991
|
-
break;
|
|
992
|
-
}
|
|
993
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
994
|
-
isGlob = token.isGlob = true;
|
|
995
|
-
finished = true;
|
|
996
|
-
if (scanToEnd === true) continue;
|
|
997
|
-
break;
|
|
998
|
-
}
|
|
999
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1000
|
-
while (eos() !== true && (next = advance())) {
|
|
1001
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
1002
|
-
backslashes = token.backslashes = true;
|
|
1003
|
-
advance();
|
|
1004
|
-
continue;
|
|
1005
|
-
}
|
|
1006
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1007
|
-
isBracket = token.isBracket = true;
|
|
1008
|
-
isGlob = token.isGlob = true;
|
|
1009
|
-
finished = true;
|
|
1010
|
-
break;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
if (scanToEnd === true) continue;
|
|
1014
|
-
break;
|
|
1015
|
-
}
|
|
1016
|
-
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1017
|
-
negated = token.negated = true;
|
|
1018
|
-
start++;
|
|
1019
|
-
continue;
|
|
1020
|
-
}
|
|
1021
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1022
|
-
isGlob = token.isGlob = true;
|
|
1023
|
-
if (scanToEnd === true) {
|
|
1024
|
-
let parens = 1;
|
|
1025
|
-
while (eos() !== true && (code = advance())) {
|
|
1026
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1027
|
-
backslashes = token.backslashes = true;
|
|
1028
|
-
advance();
|
|
1029
|
-
continue;
|
|
1030
|
-
}
|
|
1031
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1032
|
-
parens++;
|
|
1033
|
-
continue;
|
|
1034
|
-
}
|
|
1035
|
-
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
1036
|
-
finished = true;
|
|
1037
|
-
break;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
continue;
|
|
1041
|
-
}
|
|
1042
|
-
break;
|
|
1043
|
-
}
|
|
1044
|
-
if (isGlob === true) {
|
|
1045
|
-
finished = true;
|
|
1046
|
-
if (scanToEnd === true) continue;
|
|
1047
|
-
break;
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
if (opts.noext === true) {
|
|
1051
|
-
isExtglob = false;
|
|
1052
|
-
isGlob = false;
|
|
1053
|
-
}
|
|
1054
|
-
let base = str;
|
|
1055
|
-
let prefix = "";
|
|
1056
|
-
let glob = "";
|
|
1057
|
-
if (start > 0) {
|
|
1058
|
-
prefix = str.slice(0, start);
|
|
1059
|
-
str = str.slice(start);
|
|
1060
|
-
lastIndex -= start;
|
|
1061
|
-
}
|
|
1062
|
-
if (base && isGlob === true && lastIndex > 0) {
|
|
1063
|
-
base = str.slice(0, lastIndex);
|
|
1064
|
-
glob = str.slice(lastIndex);
|
|
1065
|
-
} else if (isGlob === true) {
|
|
1066
|
-
base = "";
|
|
1067
|
-
glob = str;
|
|
1068
|
-
} else base = str;
|
|
1069
|
-
if (base && base !== "" && base !== "/" && base !== str) {
|
|
1070
|
-
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
1071
|
-
}
|
|
1072
|
-
if (opts.unescape === true) {
|
|
1073
|
-
if (glob) glob = utils.removeBackslashes(glob);
|
|
1074
|
-
if (base && backslashes === true) base = utils.removeBackslashes(base);
|
|
1075
|
-
}
|
|
1076
|
-
const state = {
|
|
1077
|
-
prefix,
|
|
1078
|
-
input,
|
|
1079
|
-
start,
|
|
1080
|
-
base,
|
|
1081
|
-
glob,
|
|
1082
|
-
isBrace,
|
|
1083
|
-
isBracket,
|
|
1084
|
-
isGlob,
|
|
1085
|
-
isExtglob,
|
|
1086
|
-
isGlobstar,
|
|
1087
|
-
negated,
|
|
1088
|
-
negatedExtglob
|
|
1089
|
-
};
|
|
1090
|
-
if (opts.tokens === true) {
|
|
1091
|
-
state.maxDepth = 0;
|
|
1092
|
-
if (!isPathSeparator(code)) tokens.push(token);
|
|
1093
|
-
state.tokens = tokens;
|
|
1094
|
-
}
|
|
1095
|
-
if (opts.parts === true || opts.tokens === true) {
|
|
1096
|
-
let prevIndex;
|
|
1097
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1098
|
-
const n = prevIndex !== void 0 ? prevIndex + 1 : start;
|
|
1099
|
-
const i = slashes[idx];
|
|
1100
|
-
const value = input.slice(n, i);
|
|
1101
|
-
if (opts.tokens) {
|
|
1102
|
-
if (idx === 0 && start !== 0) {
|
|
1103
|
-
tokens[idx].isPrefix = true;
|
|
1104
|
-
tokens[idx].value = prefix;
|
|
1105
|
-
} else tokens[idx].value = value;
|
|
1106
|
-
depth(tokens[idx]);
|
|
1107
|
-
state.maxDepth += tokens[idx].depth;
|
|
1108
|
-
}
|
|
1109
|
-
if (i >= start) {
|
|
1110
|
-
parts.push(value);
|
|
1111
|
-
prevIndex = i;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
const n = prevIndex !== void 0 ? prevIndex + 1 : start;
|
|
1115
|
-
const value = input.slice(n);
|
|
1116
|
-
parts.push(value);
|
|
1117
|
-
if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
|
|
1118
|
-
tokens[tokens.length - 1].value = value;
|
|
1119
|
-
depth(tokens[tokens.length - 1]);
|
|
1120
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1121
|
-
}
|
|
1122
|
-
state.slashes = slashes;
|
|
1123
|
-
state.parts = parts;
|
|
1124
|
-
}
|
|
1125
|
-
return state;
|
|
1126
|
-
};
|
|
1127
|
-
module.exports = scan;
|
|
1128
|
-
}));
|
|
1129
|
-
//#endregion
|
|
1130
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
|
|
1131
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1132
|
-
const constants = require_constants();
|
|
1133
|
-
const utils = require_utils();
|
|
1134
|
-
/**
|
|
1135
|
-
* Constants
|
|
1136
|
-
*/
|
|
1137
|
-
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
|
|
1138
|
-
/**
|
|
1139
|
-
* Helpers
|
|
1140
|
-
*/
|
|
1141
|
-
const expandRange = (args, options) => {
|
|
1142
|
-
if (typeof options.expandRange === "function") return options.expandRange(...args, options);
|
|
1143
|
-
args.sort();
|
|
1144
|
-
const value = `[${args.join("-")}]`;
|
|
1145
|
-
try {
|
|
1146
|
-
new RegExp(value);
|
|
1147
|
-
} catch (ex) {
|
|
1148
|
-
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
1149
|
-
}
|
|
1150
|
-
return value;
|
|
1151
|
-
};
|
|
1152
|
-
/**
|
|
1153
|
-
* Create the message for a syntax error
|
|
1154
|
-
*/
|
|
1155
|
-
const syntaxError = (type, char) => {
|
|
1156
|
-
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1157
|
-
};
|
|
1158
|
-
const splitTopLevel = (input) => {
|
|
1159
|
-
const parts = [];
|
|
1160
|
-
let bracket = 0;
|
|
1161
|
-
let paren = 0;
|
|
1162
|
-
let quote = 0;
|
|
1163
|
-
let value = "";
|
|
1164
|
-
let escaped = false;
|
|
1165
|
-
for (const ch of input) {
|
|
1166
|
-
if (escaped === true) {
|
|
1167
|
-
value += ch;
|
|
1168
|
-
escaped = false;
|
|
1169
|
-
continue;
|
|
1170
|
-
}
|
|
1171
|
-
if (ch === "\\") {
|
|
1172
|
-
value += ch;
|
|
1173
|
-
escaped = true;
|
|
1174
|
-
continue;
|
|
1175
|
-
}
|
|
1176
|
-
if (ch === "\"") {
|
|
1177
|
-
quote = quote === 1 ? 0 : 1;
|
|
1178
|
-
value += ch;
|
|
1179
|
-
continue;
|
|
1180
|
-
}
|
|
1181
|
-
if (quote === 0) {
|
|
1182
|
-
if (ch === "[") bracket++;
|
|
1183
|
-
else if (ch === "]" && bracket > 0) bracket--;
|
|
1184
|
-
else if (bracket === 0) {
|
|
1185
|
-
if (ch === "(") paren++;
|
|
1186
|
-
else if (ch === ")" && paren > 0) paren--;
|
|
1187
|
-
else if (ch === "|" && paren === 0) {
|
|
1188
|
-
parts.push(value);
|
|
1189
|
-
value = "";
|
|
1190
|
-
continue;
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
value += ch;
|
|
1195
|
-
}
|
|
1196
|
-
parts.push(value);
|
|
1197
|
-
return parts;
|
|
1198
|
-
};
|
|
1199
|
-
const isPlainBranch = (branch) => {
|
|
1200
|
-
let escaped = false;
|
|
1201
|
-
for (const ch of branch) {
|
|
1202
|
-
if (escaped === true) {
|
|
1203
|
-
escaped = false;
|
|
1204
|
-
continue;
|
|
1205
|
-
}
|
|
1206
|
-
if (ch === "\\") {
|
|
1207
|
-
escaped = true;
|
|
1208
|
-
continue;
|
|
1209
|
-
}
|
|
1210
|
-
if (/[?*+@!()[\]{}]/.test(ch)) return false;
|
|
1211
|
-
}
|
|
1212
|
-
return true;
|
|
1213
|
-
};
|
|
1214
|
-
const normalizeSimpleBranch = (branch) => {
|
|
1215
|
-
let value = branch.trim();
|
|
1216
|
-
let changed = true;
|
|
1217
|
-
while (changed === true) {
|
|
1218
|
-
changed = false;
|
|
1219
|
-
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
1220
|
-
value = value.slice(2, -1);
|
|
1221
|
-
changed = true;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
if (!isPlainBranch(value)) return;
|
|
1225
|
-
return value.replace(/\\(.)/g, "$1");
|
|
1226
|
-
};
|
|
1227
|
-
const hasRepeatedCharPrefixOverlap = (branches) => {
|
|
1228
|
-
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
1229
|
-
for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
|
|
1230
|
-
const a = values[i];
|
|
1231
|
-
const b = values[j];
|
|
1232
|
-
const char = a[0];
|
|
1233
|
-
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
|
|
1234
|
-
if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
|
|
1235
|
-
}
|
|
1236
|
-
return false;
|
|
1237
|
-
};
|
|
1238
|
-
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
1239
|
-
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
|
|
1240
|
-
let bracket = 0;
|
|
1241
|
-
let paren = 0;
|
|
1242
|
-
let quote = 0;
|
|
1243
|
-
let escaped = false;
|
|
1244
|
-
for (let i = 1; i < pattern.length; i++) {
|
|
1245
|
-
const ch = pattern[i];
|
|
1246
|
-
if (escaped === true) {
|
|
1247
|
-
escaped = false;
|
|
1248
|
-
continue;
|
|
1249
|
-
}
|
|
1250
|
-
if (ch === "\\") {
|
|
1251
|
-
escaped = true;
|
|
1252
|
-
continue;
|
|
1253
|
-
}
|
|
1254
|
-
if (ch === "\"") {
|
|
1255
|
-
quote = quote === 1 ? 0 : 1;
|
|
1256
|
-
continue;
|
|
1257
|
-
}
|
|
1258
|
-
if (quote === 1) continue;
|
|
1259
|
-
if (ch === "[") {
|
|
1260
|
-
bracket++;
|
|
1261
|
-
continue;
|
|
1262
|
-
}
|
|
1263
|
-
if (ch === "]" && bracket > 0) {
|
|
1264
|
-
bracket--;
|
|
1265
|
-
continue;
|
|
1266
|
-
}
|
|
1267
|
-
if (bracket > 0) continue;
|
|
1268
|
-
if (ch === "(") {
|
|
1269
|
-
paren++;
|
|
1270
|
-
continue;
|
|
1271
|
-
}
|
|
1272
|
-
if (ch === ")") {
|
|
1273
|
-
paren--;
|
|
1274
|
-
if (paren === 0) {
|
|
1275
|
-
if (requireEnd === true && i !== pattern.length - 1) return;
|
|
1276
|
-
return {
|
|
1277
|
-
type: pattern[0],
|
|
1278
|
-
body: pattern.slice(2, i),
|
|
1279
|
-
end: i
|
|
1280
|
-
};
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
};
|
|
1285
|
-
const buildCharClassStar = (chars) => {
|
|
1286
|
-
return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
|
|
1287
|
-
};
|
|
1288
|
-
const getStarExtglobSequenceChars = (pattern) => {
|
|
1289
|
-
let index = 0;
|
|
1290
|
-
const chars = [];
|
|
1291
|
-
while (index < pattern.length) {
|
|
1292
|
-
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
1293
|
-
if (!match || match.type !== "*") return;
|
|
1294
|
-
const branches = splitTopLevel(match.body).map((branch) => branch.trim());
|
|
1295
|
-
if (branches.length !== 1) return;
|
|
1296
|
-
const branch = normalizeSimpleBranch(branches[0]);
|
|
1297
|
-
if (!branch || branch.length !== 1) return;
|
|
1298
|
-
chars.push(branch);
|
|
1299
|
-
index += match.end + 1;
|
|
1300
|
-
}
|
|
1301
|
-
if (chars.length < 1) return;
|
|
1302
|
-
return chars;
|
|
1303
|
-
};
|
|
1304
|
-
const repeatedExtglobRecursion = (pattern) => {
|
|
1305
|
-
let depth = 0;
|
|
1306
|
-
let value = pattern.trim();
|
|
1307
|
-
let match = parseRepeatedExtglob(value);
|
|
1308
|
-
while (match) {
|
|
1309
|
-
depth++;
|
|
1310
|
-
value = match.body.trim();
|
|
1311
|
-
match = parseRepeatedExtglob(value);
|
|
1312
|
-
}
|
|
1313
|
-
return depth;
|
|
1314
|
-
};
|
|
1315
|
-
const analyzeRepeatedExtglob = (body, options) => {
|
|
1316
|
-
if (options.maxExtglobRecursion === false) return { risky: false };
|
|
1317
|
-
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
1318
|
-
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
1319
|
-
if (branches.length > 1) {
|
|
1320
|
-
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
|
|
1321
|
-
}
|
|
1322
|
-
const safeChars = [];
|
|
1323
|
-
let sawStarSequence = false;
|
|
1324
|
-
let combinable = true;
|
|
1325
|
-
for (const branch of branches) {
|
|
1326
|
-
const chars = getStarExtglobSequenceChars(branch);
|
|
1327
|
-
if (chars) {
|
|
1328
|
-
sawStarSequence = true;
|
|
1329
|
-
safeChars.push(...chars);
|
|
1330
|
-
continue;
|
|
1331
|
-
}
|
|
1332
|
-
const literal = normalizeSimpleBranch(branch);
|
|
1333
|
-
if (literal && literal.length === 1) {
|
|
1334
|
-
safeChars.push(literal);
|
|
1335
|
-
continue;
|
|
1336
|
-
}
|
|
1337
|
-
combinable = false;
|
|
1338
|
-
if (repeatedExtglobRecursion(branch) > max) return { risky: true };
|
|
1339
|
-
}
|
|
1340
|
-
if (sawStarSequence) return combinable ? {
|
|
1341
|
-
risky: true,
|
|
1342
|
-
safeOutput: buildCharClassStar([...new Set(safeChars)])
|
|
1343
|
-
} : { risky: true };
|
|
1344
|
-
return { risky: false };
|
|
1345
|
-
};
|
|
1346
|
-
/**
|
|
1347
|
-
* Parse the given input string.
|
|
1348
|
-
* @param {String} input
|
|
1349
|
-
* @param {Object} options
|
|
1350
|
-
* @return {Object}
|
|
1351
|
-
*/
|
|
1352
|
-
const parse = (input, options) => {
|
|
1353
|
-
if (typeof input !== "string") throw new TypeError("Expected a string");
|
|
1354
|
-
input = REPLACEMENTS[input] || input;
|
|
1355
|
-
const opts = { ...options };
|
|
1356
|
-
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1357
|
-
let len = input.length;
|
|
1358
|
-
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1359
|
-
const bos = {
|
|
1360
|
-
type: "bos",
|
|
1361
|
-
value: "",
|
|
1362
|
-
output: opts.prepend || ""
|
|
1363
|
-
};
|
|
1364
|
-
const tokens = [bos];
|
|
1365
|
-
const capture = opts.capture ? "" : "?:";
|
|
1366
|
-
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
1367
|
-
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
1368
|
-
const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
|
|
1369
|
-
const globstar = (opts) => {
|
|
1370
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1371
|
-
};
|
|
1372
|
-
const nodot = opts.dot ? "" : NO_DOT;
|
|
1373
|
-
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
1374
|
-
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
1375
|
-
if (opts.capture) star = `(${star})`;
|
|
1376
|
-
if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
|
|
1377
|
-
const state = {
|
|
1378
|
-
input,
|
|
1379
|
-
index: -1,
|
|
1380
|
-
start: 0,
|
|
1381
|
-
dot: opts.dot === true,
|
|
1382
|
-
consumed: "",
|
|
1383
|
-
output: "",
|
|
1384
|
-
prefix: "",
|
|
1385
|
-
backtrack: false,
|
|
1386
|
-
negated: false,
|
|
1387
|
-
brackets: 0,
|
|
1388
|
-
braces: 0,
|
|
1389
|
-
parens: 0,
|
|
1390
|
-
quotes: 0,
|
|
1391
|
-
globstar: false,
|
|
1392
|
-
tokens
|
|
1393
|
-
};
|
|
1394
|
-
input = utils.removePrefix(input, state);
|
|
1395
|
-
len = input.length;
|
|
1396
|
-
const extglobs = [];
|
|
1397
|
-
const braces = [];
|
|
1398
|
-
const stack = [];
|
|
1399
|
-
let prev = bos;
|
|
1400
|
-
let value;
|
|
1401
|
-
/**
|
|
1402
|
-
* Tokenizing helpers
|
|
1403
|
-
*/
|
|
1404
|
-
const eos = () => state.index === len - 1;
|
|
1405
|
-
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
1406
|
-
const advance = state.advance = () => input[++state.index] || "";
|
|
1407
|
-
const remaining = () => input.slice(state.index + 1);
|
|
1408
|
-
const consume = (value = "", num = 0) => {
|
|
1409
|
-
state.consumed += value;
|
|
1410
|
-
state.index += num;
|
|
1411
|
-
};
|
|
1412
|
-
const append = (token) => {
|
|
1413
|
-
state.output += token.output != null ? token.output : token.value;
|
|
1414
|
-
consume(token.value);
|
|
1415
|
-
};
|
|
1416
|
-
const negate = () => {
|
|
1417
|
-
let count = 1;
|
|
1418
|
-
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
1419
|
-
advance();
|
|
1420
|
-
state.start++;
|
|
1421
|
-
count++;
|
|
1422
|
-
}
|
|
1423
|
-
if (count % 2 === 0) return false;
|
|
1424
|
-
state.negated = true;
|
|
1425
|
-
state.start++;
|
|
1426
|
-
return true;
|
|
1427
|
-
};
|
|
1428
|
-
const increment = (type) => {
|
|
1429
|
-
state[type]++;
|
|
1430
|
-
stack.push(type);
|
|
1431
|
-
};
|
|
1432
|
-
const decrement = (type) => {
|
|
1433
|
-
state[type]--;
|
|
1434
|
-
stack.pop();
|
|
1435
|
-
};
|
|
1436
|
-
/**
|
|
1437
|
-
* Push tokens onto the tokens array. This helper speeds up
|
|
1438
|
-
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
1439
|
-
* and 2) helping us avoid creating extra tokens when consecutive
|
|
1440
|
-
* characters are plain text. This improves performance and simplifies
|
|
1441
|
-
* lookbehinds.
|
|
1442
|
-
*/
|
|
1443
|
-
const push = (tok) => {
|
|
1444
|
-
if (prev.type === "globstar") {
|
|
1445
|
-
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
1446
|
-
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
1447
|
-
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
1448
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
1449
|
-
prev.type = "star";
|
|
1450
|
-
prev.value = "*";
|
|
1451
|
-
prev.output = star;
|
|
1452
|
-
state.output += prev.output;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
|
|
1456
|
-
if (tok.value || tok.output) append(tok);
|
|
1457
|
-
if (prev && prev.type === "text" && tok.type === "text") {
|
|
1458
|
-
prev.output = (prev.output || prev.value) + tok.value;
|
|
1459
|
-
prev.value += tok.value;
|
|
1460
|
-
return;
|
|
1461
|
-
}
|
|
1462
|
-
tok.prev = prev;
|
|
1463
|
-
tokens.push(tok);
|
|
1464
|
-
prev = tok;
|
|
1465
|
-
};
|
|
1466
|
-
const extglobOpen = (type, value) => {
|
|
1467
|
-
const token = {
|
|
1468
|
-
...EXTGLOB_CHARS[value],
|
|
1469
|
-
conditions: 1,
|
|
1470
|
-
inner: ""
|
|
1471
|
-
};
|
|
1472
|
-
token.prev = prev;
|
|
1473
|
-
token.parens = state.parens;
|
|
1474
|
-
token.output = state.output;
|
|
1475
|
-
token.startIndex = state.index;
|
|
1476
|
-
token.tokensIndex = tokens.length;
|
|
1477
|
-
const output = (opts.capture ? "(" : "") + token.open;
|
|
1478
|
-
increment("parens");
|
|
1479
|
-
push({
|
|
1480
|
-
type,
|
|
1481
|
-
value,
|
|
1482
|
-
output: state.output ? "" : ONE_CHAR
|
|
1483
|
-
});
|
|
1484
|
-
push({
|
|
1485
|
-
type: "paren",
|
|
1486
|
-
extglob: true,
|
|
1487
|
-
value: advance(),
|
|
1488
|
-
output
|
|
1489
|
-
});
|
|
1490
|
-
extglobs.push(token);
|
|
1491
|
-
};
|
|
1492
|
-
const extglobClose = (token) => {
|
|
1493
|
-
const literal = input.slice(token.startIndex, state.index + 1);
|
|
1494
|
-
const body = input.slice(token.startIndex + 2, state.index);
|
|
1495
|
-
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
1496
|
-
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
1497
|
-
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
1498
|
-
const open = tokens[token.tokensIndex];
|
|
1499
|
-
open.type = "text";
|
|
1500
|
-
open.value = literal;
|
|
1501
|
-
open.output = safeOutput || utils.escapeRegex(literal);
|
|
1502
|
-
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
1503
|
-
tokens[i].value = "";
|
|
1504
|
-
tokens[i].output = "";
|
|
1505
|
-
delete tokens[i].suffix;
|
|
1506
|
-
}
|
|
1507
|
-
state.output = token.output + open.output;
|
|
1508
|
-
state.backtrack = true;
|
|
1509
|
-
push({
|
|
1510
|
-
type: "paren",
|
|
1511
|
-
extglob: true,
|
|
1512
|
-
value,
|
|
1513
|
-
output: ""
|
|
1514
|
-
});
|
|
1515
|
-
decrement("parens");
|
|
1516
|
-
return;
|
|
1517
|
-
}
|
|
1518
|
-
let output = token.close + (opts.capture ? ")" : "");
|
|
1519
|
-
let rest;
|
|
1520
|
-
if (token.type === "negate") {
|
|
1521
|
-
let extglobStar = star;
|
|
1522
|
-
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
|
|
1523
|
-
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
1524
|
-
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse(rest, {
|
|
1525
|
-
...options,
|
|
1526
|
-
fastpaths: false
|
|
1527
|
-
}).output})${extglobStar})`;
|
|
1528
|
-
if (token.prev.type === "bos") state.negatedExtglob = true;
|
|
1529
|
-
}
|
|
1530
|
-
push({
|
|
1531
|
-
type: "paren",
|
|
1532
|
-
extglob: true,
|
|
1533
|
-
value,
|
|
1534
|
-
output
|
|
1535
|
-
});
|
|
1536
|
-
decrement("parens");
|
|
1537
|
-
};
|
|
1538
|
-
/**
|
|
1539
|
-
* Fast paths
|
|
1540
|
-
*/
|
|
1541
|
-
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
1542
|
-
let backslashes = false;
|
|
1543
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
1544
|
-
if (first === "\\") {
|
|
1545
|
-
backslashes = true;
|
|
1546
|
-
return m;
|
|
1547
|
-
}
|
|
1548
|
-
if (first === "?") {
|
|
1549
|
-
if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
1550
|
-
if (index === 0) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
1551
|
-
return QMARK.repeat(chars.length);
|
|
1552
|
-
}
|
|
1553
|
-
if (first === ".") return DOT_LITERAL.repeat(chars.length);
|
|
1554
|
-
if (first === "*") {
|
|
1555
|
-
if (esc) return esc + first + (rest ? star : "");
|
|
1556
|
-
return star;
|
|
1557
|
-
}
|
|
1558
|
-
return esc ? m : `\\${m}`;
|
|
1559
|
-
});
|
|
1560
|
-
if (backslashes === true) {
|
|
1561
|
-
if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
1562
|
-
else output = output.replace(/\\+/g, (m) => {
|
|
1563
|
-
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
1564
|
-
});
|
|
1565
|
-
}
|
|
1566
|
-
if (output === input && opts.contains === true) {
|
|
1567
|
-
state.output = input;
|
|
1568
|
-
return state;
|
|
1569
|
-
}
|
|
1570
|
-
state.output = utils.wrapOutput(output, state, options);
|
|
1571
|
-
return state;
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* Tokenize input until we reach end-of-string
|
|
1575
|
-
*/
|
|
1576
|
-
while (!eos()) {
|
|
1577
|
-
value = advance();
|
|
1578
|
-
if (value === "\0") continue;
|
|
1579
|
-
/**
|
|
1580
|
-
* Escaped characters
|
|
1581
|
-
*/
|
|
1582
|
-
if (value === "\\") {
|
|
1583
|
-
const next = peek();
|
|
1584
|
-
if (next === "/" && opts.bash !== true) continue;
|
|
1585
|
-
if (next === "." || next === ";") continue;
|
|
1586
|
-
if (!next) {
|
|
1587
|
-
value += "\\";
|
|
1588
|
-
push({
|
|
1589
|
-
type: "text",
|
|
1590
|
-
value
|
|
1591
|
-
});
|
|
1592
|
-
continue;
|
|
1593
|
-
}
|
|
1594
|
-
const match = /^\\+/.exec(remaining());
|
|
1595
|
-
let slashes = 0;
|
|
1596
|
-
if (match && match[0].length > 2) {
|
|
1597
|
-
slashes = match[0].length;
|
|
1598
|
-
state.index += slashes;
|
|
1599
|
-
if (slashes % 2 !== 0) value += "\\";
|
|
1600
|
-
}
|
|
1601
|
-
if (opts.unescape === true) value = advance();
|
|
1602
|
-
else value += advance();
|
|
1603
|
-
if (state.brackets === 0) {
|
|
1604
|
-
push({
|
|
1605
|
-
type: "text",
|
|
1606
|
-
value
|
|
1607
|
-
});
|
|
1608
|
-
continue;
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
/**
|
|
1612
|
-
* If we're inside a regex character class, continue
|
|
1613
|
-
* until we reach the closing bracket.
|
|
1614
|
-
*/
|
|
1615
|
-
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
1616
|
-
if (opts.posix !== false && value === ":") {
|
|
1617
|
-
const inner = prev.value.slice(1);
|
|
1618
|
-
if (inner.includes("[")) {
|
|
1619
|
-
prev.posix = true;
|
|
1620
|
-
if (inner.includes(":")) {
|
|
1621
|
-
const idx = prev.value.lastIndexOf("[");
|
|
1622
|
-
const pre = prev.value.slice(0, idx);
|
|
1623
|
-
const rest = prev.value.slice(idx + 2);
|
|
1624
|
-
const posix = POSIX_REGEX_SOURCE[rest];
|
|
1625
|
-
if (posix) {
|
|
1626
|
-
prev.value = pre + posix;
|
|
1627
|
-
state.backtrack = true;
|
|
1628
|
-
advance();
|
|
1629
|
-
if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
|
|
1630
|
-
continue;
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
|
|
1636
|
-
if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
|
|
1637
|
-
if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
|
|
1638
|
-
prev.value += value;
|
|
1639
|
-
append({ value });
|
|
1640
|
-
continue;
|
|
1641
|
-
}
|
|
1642
|
-
/**
|
|
1643
|
-
* If we're inside a quoted string, continue
|
|
1644
|
-
* until we reach the closing double quote.
|
|
1645
|
-
*/
|
|
1646
|
-
if (state.quotes === 1 && value !== "\"") {
|
|
1647
|
-
value = utils.escapeRegex(value);
|
|
1648
|
-
prev.value += value;
|
|
1649
|
-
append({ value });
|
|
1650
|
-
continue;
|
|
1651
|
-
}
|
|
1652
|
-
/**
|
|
1653
|
-
* Double quotes
|
|
1654
|
-
*/
|
|
1655
|
-
if (value === "\"") {
|
|
1656
|
-
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
1657
|
-
if (opts.keepQuotes === true) push({
|
|
1658
|
-
type: "text",
|
|
1659
|
-
value
|
|
1660
|
-
});
|
|
1661
|
-
continue;
|
|
1662
|
-
}
|
|
1663
|
-
/**
|
|
1664
|
-
* Parentheses
|
|
1665
|
-
*/
|
|
1666
|
-
if (value === "(") {
|
|
1667
|
-
increment("parens");
|
|
1668
|
-
push({
|
|
1669
|
-
type: "paren",
|
|
1670
|
-
value
|
|
1671
|
-
});
|
|
1672
|
-
continue;
|
|
1673
|
-
}
|
|
1674
|
-
if (value === ")") {
|
|
1675
|
-
if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
|
|
1676
|
-
const extglob = extglobs[extglobs.length - 1];
|
|
1677
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
|
1678
|
-
extglobClose(extglobs.pop());
|
|
1679
|
-
continue;
|
|
1680
|
-
}
|
|
1681
|
-
push({
|
|
1682
|
-
type: "paren",
|
|
1683
|
-
value,
|
|
1684
|
-
output: state.parens ? ")" : "\\)"
|
|
1685
|
-
});
|
|
1686
|
-
decrement("parens");
|
|
1687
|
-
continue;
|
|
1688
|
-
}
|
|
1689
|
-
/**
|
|
1690
|
-
* Square brackets
|
|
1691
|
-
*/
|
|
1692
|
-
if (value === "[") {
|
|
1693
|
-
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
1694
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
1695
|
-
value = `\\${value}`;
|
|
1696
|
-
} else increment("brackets");
|
|
1697
|
-
push({
|
|
1698
|
-
type: "bracket",
|
|
1699
|
-
value
|
|
1700
|
-
});
|
|
1701
|
-
continue;
|
|
1702
|
-
}
|
|
1703
|
-
if (value === "]") {
|
|
1704
|
-
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
1705
|
-
push({
|
|
1706
|
-
type: "text",
|
|
1707
|
-
value,
|
|
1708
|
-
output: `\\${value}`
|
|
1709
|
-
});
|
|
1710
|
-
continue;
|
|
1711
|
-
}
|
|
1712
|
-
if (state.brackets === 0) {
|
|
1713
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
|
|
1714
|
-
push({
|
|
1715
|
-
type: "text",
|
|
1716
|
-
value,
|
|
1717
|
-
output: `\\${value}`
|
|
1718
|
-
});
|
|
1719
|
-
continue;
|
|
1720
|
-
}
|
|
1721
|
-
decrement("brackets");
|
|
1722
|
-
const prevValue = prev.value.slice(1);
|
|
1723
|
-
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
|
|
1724
|
-
prev.value += value;
|
|
1725
|
-
append({ value });
|
|
1726
|
-
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) continue;
|
|
1727
|
-
const escaped = utils.escapeRegex(prev.value);
|
|
1728
|
-
state.output = state.output.slice(0, -prev.value.length);
|
|
1729
|
-
if (opts.literalBrackets === true) {
|
|
1730
|
-
state.output += escaped;
|
|
1731
|
-
prev.value = escaped;
|
|
1732
|
-
continue;
|
|
1733
|
-
}
|
|
1734
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
1735
|
-
state.output += prev.value;
|
|
1736
|
-
continue;
|
|
1737
|
-
}
|
|
1738
|
-
/**
|
|
1739
|
-
* Braces
|
|
1740
|
-
*/
|
|
1741
|
-
if (value === "{" && opts.nobrace !== true) {
|
|
1742
|
-
increment("braces");
|
|
1743
|
-
const open = {
|
|
1744
|
-
type: "brace",
|
|
1745
|
-
value,
|
|
1746
|
-
output: "(",
|
|
1747
|
-
outputIndex: state.output.length,
|
|
1748
|
-
tokensIndex: state.tokens.length
|
|
1749
|
-
};
|
|
1750
|
-
braces.push(open);
|
|
1751
|
-
push(open);
|
|
1752
|
-
continue;
|
|
1753
|
-
}
|
|
1754
|
-
if (value === "}") {
|
|
1755
|
-
const brace = braces[braces.length - 1];
|
|
1756
|
-
if (opts.nobrace === true || !brace) {
|
|
1757
|
-
push({
|
|
1758
|
-
type: "text",
|
|
1759
|
-
value,
|
|
1760
|
-
output: value
|
|
1761
|
-
});
|
|
1762
|
-
continue;
|
|
1763
|
-
}
|
|
1764
|
-
let output = ")";
|
|
1765
|
-
if (brace.dots === true) {
|
|
1766
|
-
const arr = tokens.slice();
|
|
1767
|
-
const range = [];
|
|
1768
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
1769
|
-
tokens.pop();
|
|
1770
|
-
if (arr[i].type === "brace") break;
|
|
1771
|
-
if (arr[i].type !== "dots") range.unshift(arr[i].value);
|
|
1772
|
-
}
|
|
1773
|
-
output = expandRange(range, opts);
|
|
1774
|
-
state.backtrack = true;
|
|
1775
|
-
}
|
|
1776
|
-
if (brace.comma !== true && brace.dots !== true) {
|
|
1777
|
-
const out = state.output.slice(0, brace.outputIndex);
|
|
1778
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1779
|
-
brace.value = brace.output = "\\{";
|
|
1780
|
-
value = output = "\\}";
|
|
1781
|
-
state.output = out;
|
|
1782
|
-
for (const t of toks) state.output += t.output || t.value;
|
|
1783
|
-
}
|
|
1784
|
-
push({
|
|
1785
|
-
type: "brace",
|
|
1786
|
-
value,
|
|
1787
|
-
output
|
|
1788
|
-
});
|
|
1789
|
-
decrement("braces");
|
|
1790
|
-
braces.pop();
|
|
1791
|
-
continue;
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* Pipes
|
|
1795
|
-
*/
|
|
1796
|
-
if (value === "|") {
|
|
1797
|
-
if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
|
|
1798
|
-
push({
|
|
1799
|
-
type: "text",
|
|
1800
|
-
value
|
|
1801
|
-
});
|
|
1802
|
-
continue;
|
|
1803
|
-
}
|
|
1804
|
-
/**
|
|
1805
|
-
* Commas
|
|
1806
|
-
*/
|
|
1807
|
-
if (value === ",") {
|
|
1808
|
-
let output = value;
|
|
1809
|
-
const brace = braces[braces.length - 1];
|
|
1810
|
-
if (brace && stack[stack.length - 1] === "braces") {
|
|
1811
|
-
brace.comma = true;
|
|
1812
|
-
output = "|";
|
|
1813
|
-
}
|
|
1814
|
-
push({
|
|
1815
|
-
type: "comma",
|
|
1816
|
-
value,
|
|
1817
|
-
output
|
|
1818
|
-
});
|
|
1819
|
-
continue;
|
|
1820
|
-
}
|
|
1821
|
-
/**
|
|
1822
|
-
* Slashes
|
|
1823
|
-
*/
|
|
1824
|
-
if (value === "/") {
|
|
1825
|
-
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
1826
|
-
state.start = state.index + 1;
|
|
1827
|
-
state.consumed = "";
|
|
1828
|
-
state.output = "";
|
|
1829
|
-
tokens.pop();
|
|
1830
|
-
prev = bos;
|
|
1831
|
-
continue;
|
|
1832
|
-
}
|
|
1833
|
-
push({
|
|
1834
|
-
type: "slash",
|
|
1835
|
-
value,
|
|
1836
|
-
output: SLASH_LITERAL
|
|
1837
|
-
});
|
|
1838
|
-
continue;
|
|
1839
|
-
}
|
|
1840
|
-
/**
|
|
1841
|
-
* Dots
|
|
1842
|
-
*/
|
|
1843
|
-
if (value === ".") {
|
|
1844
|
-
if (state.braces > 0 && prev.type === "dot") {
|
|
1845
|
-
if (prev.value === ".") prev.output = DOT_LITERAL;
|
|
1846
|
-
const brace = braces[braces.length - 1];
|
|
1847
|
-
prev.type = "dots";
|
|
1848
|
-
prev.output += value;
|
|
1849
|
-
prev.value += value;
|
|
1850
|
-
brace.dots = true;
|
|
1851
|
-
continue;
|
|
1852
|
-
}
|
|
1853
|
-
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
1854
|
-
push({
|
|
1855
|
-
type: "text",
|
|
1856
|
-
value,
|
|
1857
|
-
output: DOT_LITERAL
|
|
1858
|
-
});
|
|
1859
|
-
continue;
|
|
1860
|
-
}
|
|
1861
|
-
push({
|
|
1862
|
-
type: "dot",
|
|
1863
|
-
value,
|
|
1864
|
-
output: DOT_LITERAL
|
|
1865
|
-
});
|
|
1866
|
-
continue;
|
|
1867
|
-
}
|
|
1868
|
-
/**
|
|
1869
|
-
* Question marks
|
|
1870
|
-
*/
|
|
1871
|
-
if (value === "?") {
|
|
1872
|
-
if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1873
|
-
extglobOpen("qmark", value);
|
|
1874
|
-
continue;
|
|
1875
|
-
}
|
|
1876
|
-
if (prev && prev.type === "paren") {
|
|
1877
|
-
const next = peek();
|
|
1878
|
-
let output = value;
|
|
1879
|
-
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
|
|
1880
|
-
push({
|
|
1881
|
-
type: "text",
|
|
1882
|
-
value,
|
|
1883
|
-
output
|
|
1884
|
-
});
|
|
1885
|
-
continue;
|
|
1886
|
-
}
|
|
1887
|
-
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
1888
|
-
push({
|
|
1889
|
-
type: "qmark",
|
|
1890
|
-
value,
|
|
1891
|
-
output: QMARK_NO_DOT
|
|
1892
|
-
});
|
|
1893
|
-
continue;
|
|
1894
|
-
}
|
|
1895
|
-
push({
|
|
1896
|
-
type: "qmark",
|
|
1897
|
-
value,
|
|
1898
|
-
output: QMARK
|
|
1899
|
-
});
|
|
1900
|
-
continue;
|
|
1901
|
-
}
|
|
1902
|
-
/**
|
|
1903
|
-
* Exclamation
|
|
1904
|
-
*/
|
|
1905
|
-
if (value === "!") {
|
|
1906
|
-
if (opts.noextglob !== true && peek() === "(") {
|
|
1907
|
-
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
1908
|
-
extglobOpen("negate", value);
|
|
1909
|
-
continue;
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
if (opts.nonegate !== true && state.index === 0) {
|
|
1913
|
-
negate();
|
|
1914
|
-
continue;
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
/**
|
|
1918
|
-
* Plus
|
|
1919
|
-
*/
|
|
1920
|
-
if (value === "+") {
|
|
1921
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1922
|
-
extglobOpen("plus", value);
|
|
1923
|
-
continue;
|
|
1924
|
-
}
|
|
1925
|
-
if (prev && prev.value === "(" || opts.regex === false) {
|
|
1926
|
-
push({
|
|
1927
|
-
type: "plus",
|
|
1928
|
-
value,
|
|
1929
|
-
output: PLUS_LITERAL
|
|
1930
|
-
});
|
|
1931
|
-
continue;
|
|
1932
|
-
}
|
|
1933
|
-
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
1934
|
-
push({
|
|
1935
|
-
type: "plus",
|
|
1936
|
-
value
|
|
1937
|
-
});
|
|
1938
|
-
continue;
|
|
1939
|
-
}
|
|
1940
|
-
push({
|
|
1941
|
-
type: "plus",
|
|
1942
|
-
value: PLUS_LITERAL
|
|
1943
|
-
});
|
|
1944
|
-
continue;
|
|
1945
|
-
}
|
|
1946
|
-
/**
|
|
1947
|
-
* Plain text
|
|
1948
|
-
*/
|
|
1949
|
-
if (value === "@") {
|
|
1950
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1951
|
-
push({
|
|
1952
|
-
type: "at",
|
|
1953
|
-
extglob: true,
|
|
1954
|
-
value,
|
|
1955
|
-
output: ""
|
|
1956
|
-
});
|
|
1957
|
-
continue;
|
|
1958
|
-
}
|
|
1959
|
-
push({
|
|
1960
|
-
type: "text",
|
|
1961
|
-
value
|
|
1962
|
-
});
|
|
1963
|
-
continue;
|
|
1964
|
-
}
|
|
1965
|
-
/**
|
|
1966
|
-
* Plain text
|
|
1967
|
-
*/
|
|
1968
|
-
if (value !== "*") {
|
|
1969
|
-
if (value === "$" || value === "^") value = `\\${value}`;
|
|
1970
|
-
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1971
|
-
if (match) {
|
|
1972
|
-
value += match[0];
|
|
1973
|
-
state.index += match[0].length;
|
|
1974
|
-
}
|
|
1975
|
-
push({
|
|
1976
|
-
type: "text",
|
|
1977
|
-
value
|
|
1978
|
-
});
|
|
1979
|
-
continue;
|
|
1980
|
-
}
|
|
1981
|
-
/**
|
|
1982
|
-
* Stars
|
|
1983
|
-
*/
|
|
1984
|
-
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
1985
|
-
prev.type = "star";
|
|
1986
|
-
prev.star = true;
|
|
1987
|
-
prev.value += value;
|
|
1988
|
-
prev.output = star;
|
|
1989
|
-
state.backtrack = true;
|
|
1990
|
-
state.globstar = true;
|
|
1991
|
-
consume(value);
|
|
1992
|
-
continue;
|
|
1993
|
-
}
|
|
1994
|
-
let rest = remaining();
|
|
1995
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
1996
|
-
extglobOpen("star", value);
|
|
1997
|
-
continue;
|
|
1998
|
-
}
|
|
1999
|
-
if (prev.type === "star") {
|
|
2000
|
-
if (opts.noglobstar === true) {
|
|
2001
|
-
consume(value);
|
|
2002
|
-
continue;
|
|
2003
|
-
}
|
|
2004
|
-
const prior = prev.prev;
|
|
2005
|
-
const before = prior.prev;
|
|
2006
|
-
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
2007
|
-
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
2008
|
-
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
2009
|
-
push({
|
|
2010
|
-
type: "star",
|
|
2011
|
-
value,
|
|
2012
|
-
output: ""
|
|
2013
|
-
});
|
|
2014
|
-
continue;
|
|
2015
|
-
}
|
|
2016
|
-
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
2017
|
-
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
2018
|
-
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
2019
|
-
push({
|
|
2020
|
-
type: "star",
|
|
2021
|
-
value,
|
|
2022
|
-
output: ""
|
|
2023
|
-
});
|
|
2024
|
-
continue;
|
|
2025
|
-
}
|
|
2026
|
-
while (rest.slice(0, 3) === "/**") {
|
|
2027
|
-
const after = input[state.index + 4];
|
|
2028
|
-
if (after && after !== "/") break;
|
|
2029
|
-
rest = rest.slice(3);
|
|
2030
|
-
consume("/**", 3);
|
|
2031
|
-
}
|
|
2032
|
-
const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
|
|
2033
|
-
if (prior.type === "bos" && eos()) {
|
|
2034
|
-
prev.type = "globstar";
|
|
2035
|
-
prev.value += value;
|
|
2036
|
-
prev.output = globstar(opts);
|
|
2037
|
-
state.output = prev.output;
|
|
2038
|
-
state.globstar = true;
|
|
2039
|
-
consume(value);
|
|
2040
|
-
continue;
|
|
2041
|
-
}
|
|
2042
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
|
|
2043
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2044
|
-
prior.output = `(?:${prior.output}`;
|
|
2045
|
-
prev.type = "globstar";
|
|
2046
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
2047
|
-
prev.value += value;
|
|
2048
|
-
state.globstar = true;
|
|
2049
|
-
state.output += prior.output + prev.output;
|
|
2050
|
-
consume(value);
|
|
2051
|
-
continue;
|
|
2052
|
-
}
|
|
2053
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
2054
|
-
const end = rest[1] !== void 0 ? "|$" : "";
|
|
2055
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2056
|
-
prior.output = `(?:${prior.output}`;
|
|
2057
|
-
prev.type = "globstar";
|
|
2058
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
2059
|
-
prev.value += value;
|
|
2060
|
-
state.output += prior.output + prev.output;
|
|
2061
|
-
state.globstar = true;
|
|
2062
|
-
consume(value + advance());
|
|
2063
|
-
push({
|
|
2064
|
-
type: "slash",
|
|
2065
|
-
value: "/",
|
|
2066
|
-
output: ""
|
|
2067
|
-
});
|
|
2068
|
-
continue;
|
|
2069
|
-
}
|
|
2070
|
-
if (prior.type === "bos" && rest[0] === "/") {
|
|
2071
|
-
prev.type = "globstar";
|
|
2072
|
-
prev.value += value;
|
|
2073
|
-
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
2074
|
-
state.output = prev.output;
|
|
2075
|
-
state.globstar = true;
|
|
2076
|
-
consume(value + advance());
|
|
2077
|
-
push({
|
|
2078
|
-
type: "slash",
|
|
2079
|
-
value: "/",
|
|
2080
|
-
output: ""
|
|
2081
|
-
});
|
|
2082
|
-
continue;
|
|
2083
|
-
}
|
|
2084
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
2085
|
-
prev.type = "globstar";
|
|
2086
|
-
prev.output = globstar(opts);
|
|
2087
|
-
prev.value += value;
|
|
2088
|
-
state.output += prev.output;
|
|
2089
|
-
state.globstar = true;
|
|
2090
|
-
consume(value);
|
|
2091
|
-
continue;
|
|
2092
|
-
}
|
|
2093
|
-
const token = {
|
|
2094
|
-
type: "star",
|
|
2095
|
-
value,
|
|
2096
|
-
output: star
|
|
2097
|
-
};
|
|
2098
|
-
if (opts.bash === true) {
|
|
2099
|
-
token.output = ".*?";
|
|
2100
|
-
if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
|
|
2101
|
-
push(token);
|
|
2102
|
-
continue;
|
|
2103
|
-
}
|
|
2104
|
-
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
2105
|
-
token.output = value;
|
|
2106
|
-
push(token);
|
|
2107
|
-
continue;
|
|
2108
|
-
}
|
|
2109
|
-
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
2110
|
-
if (prev.type === "dot") {
|
|
2111
|
-
state.output += NO_DOT_SLASH;
|
|
2112
|
-
prev.output += NO_DOT_SLASH;
|
|
2113
|
-
} else if (opts.dot === true) {
|
|
2114
|
-
state.output += NO_DOTS_SLASH;
|
|
2115
|
-
prev.output += NO_DOTS_SLASH;
|
|
2116
|
-
} else {
|
|
2117
|
-
state.output += nodot;
|
|
2118
|
-
prev.output += nodot;
|
|
2119
|
-
}
|
|
2120
|
-
if (peek() !== "*") {
|
|
2121
|
-
state.output += ONE_CHAR;
|
|
2122
|
-
prev.output += ONE_CHAR;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
push(token);
|
|
2126
|
-
}
|
|
2127
|
-
while (state.brackets > 0) {
|
|
2128
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
2129
|
-
state.output = utils.escapeLast(state.output, "[");
|
|
2130
|
-
decrement("brackets");
|
|
2131
|
-
}
|
|
2132
|
-
while (state.parens > 0) {
|
|
2133
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
2134
|
-
state.output = utils.escapeLast(state.output, "(");
|
|
2135
|
-
decrement("parens");
|
|
2136
|
-
}
|
|
2137
|
-
while (state.braces > 0) {
|
|
2138
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
2139
|
-
state.output = utils.escapeLast(state.output, "{");
|
|
2140
|
-
decrement("braces");
|
|
2141
|
-
}
|
|
2142
|
-
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
|
|
2143
|
-
type: "maybe_slash",
|
|
2144
|
-
value: "",
|
|
2145
|
-
output: `${SLASH_LITERAL}?`
|
|
2146
|
-
});
|
|
2147
|
-
if (state.backtrack === true) {
|
|
2148
|
-
state.output = "";
|
|
2149
|
-
for (const token of state.tokens) {
|
|
2150
|
-
state.output += token.output != null ? token.output : token.value;
|
|
2151
|
-
if (token.suffix) state.output += token.suffix;
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
return state;
|
|
2155
|
-
};
|
|
2156
|
-
/**
|
|
2157
|
-
* Fast paths for creating regular expressions for common glob patterns.
|
|
2158
|
-
* This can significantly speed up processing and has very little downside
|
|
2159
|
-
* impact when none of the fast paths match.
|
|
2160
|
-
*/
|
|
2161
|
-
parse.fastpaths = (input, options) => {
|
|
2162
|
-
const opts = { ...options };
|
|
2163
|
-
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2164
|
-
const len = input.length;
|
|
2165
|
-
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
2166
|
-
input = REPLACEMENTS[input] || input;
|
|
2167
|
-
const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
|
|
2168
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
2169
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
2170
|
-
const capture = opts.capture ? "" : "?:";
|
|
2171
|
-
const state = {
|
|
2172
|
-
negated: false,
|
|
2173
|
-
prefix: ""
|
|
2174
|
-
};
|
|
2175
|
-
let star = opts.bash === true ? ".*?" : STAR;
|
|
2176
|
-
if (opts.capture) star = `(${star})`;
|
|
2177
|
-
const globstar = (opts) => {
|
|
2178
|
-
if (opts.noglobstar === true) return star;
|
|
2179
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
2180
|
-
};
|
|
2181
|
-
const create = (str) => {
|
|
2182
|
-
switch (str) {
|
|
2183
|
-
case "*": return `${nodot}${ONE_CHAR}${star}`;
|
|
2184
|
-
case ".*": return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2185
|
-
case "*.*": return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2186
|
-
case "*/*": return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
2187
|
-
case "**": return nodot + globstar(opts);
|
|
2188
|
-
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
2189
|
-
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2190
|
-
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2191
|
-
default: {
|
|
2192
|
-
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
2193
|
-
if (!match) return;
|
|
2194
|
-
const source = create(match[1]);
|
|
2195
|
-
if (!source) return;
|
|
2196
|
-
return source + DOT_LITERAL + match[2];
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
};
|
|
2200
|
-
let source = create(utils.removePrefix(input, state));
|
|
2201
|
-
if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL}?`;
|
|
2202
|
-
return source;
|
|
2203
|
-
};
|
|
2204
|
-
module.exports = parse;
|
|
2205
|
-
}));
|
|
2206
|
-
//#endregion
|
|
2207
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
|
|
2208
|
-
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2209
|
-
const scan = require_scan();
|
|
2210
|
-
const parse = require_parse();
|
|
2211
|
-
const utils = require_utils();
|
|
2212
|
-
const constants = require_constants();
|
|
2213
|
-
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
2214
|
-
/**
|
|
2215
|
-
* Creates a matcher function from one or more glob patterns. The
|
|
2216
|
-
* returned function takes a string to match as its first argument,
|
|
2217
|
-
* and returns true if the string is a match. The returned matcher
|
|
2218
|
-
* function also takes a boolean as the second argument that, when true,
|
|
2219
|
-
* returns an object with additional information.
|
|
2220
|
-
*
|
|
2221
|
-
* ```js
|
|
2222
|
-
* const picomatch = require('picomatch');
|
|
2223
|
-
* // picomatch(glob[, options]);
|
|
2224
|
-
*
|
|
2225
|
-
* const isMatch = picomatch('*.!(*a)');
|
|
2226
|
-
* console.log(isMatch('a.a')); //=> false
|
|
2227
|
-
* console.log(isMatch('a.b')); //=> true
|
|
2228
|
-
*
|
|
2229
|
-
* // For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.
|
|
2230
|
-
* const picomatch = require('picomatch/posix');
|
|
2231
|
-
* // the same API, defaulting to posix paths
|
|
2232
|
-
* const isMatch = picomatch('a/*');
|
|
2233
|
-
* console.log(isMatch('a\\b')); //=> false
|
|
2234
|
-
* console.log(isMatch('a/b')); //=> true
|
|
2235
|
-
*
|
|
2236
|
-
* // you can still configure the matcher function to accept windows paths
|
|
2237
|
-
* const isMatch = picomatch('a/*', { options: windows });
|
|
2238
|
-
* console.log(isMatch('a\\b')); //=> true
|
|
2239
|
-
* console.log(isMatch('a/b')); //=> true
|
|
2240
|
-
* ```
|
|
2241
|
-
* @name picomatch
|
|
2242
|
-
* @param {String|Array} `globs` One or more glob patterns.
|
|
2243
|
-
* @param {Object=} `options`
|
|
2244
|
-
* @return {Function=} Returns a matcher function.
|
|
2245
|
-
* @api public
|
|
2246
|
-
*/
|
|
2247
|
-
const picomatch = (glob, options, returnState = false) => {
|
|
2248
|
-
if (Array.isArray(glob)) {
|
|
2249
|
-
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
2250
|
-
const arrayMatcher = (str) => {
|
|
2251
|
-
for (const isMatch of fns) {
|
|
2252
|
-
const state = isMatch(str);
|
|
2253
|
-
if (state) return state;
|
|
2254
|
-
}
|
|
2255
|
-
return false;
|
|
2256
|
-
};
|
|
2257
|
-
return arrayMatcher;
|
|
2258
|
-
}
|
|
2259
|
-
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
2260
|
-
if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
|
|
2261
|
-
const opts = options || {};
|
|
2262
|
-
const posix = opts.windows;
|
|
2263
|
-
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
2264
|
-
const state = regex.state;
|
|
2265
|
-
delete regex.state;
|
|
2266
|
-
let isIgnored = () => false;
|
|
2267
|
-
if (opts.ignore) {
|
|
2268
|
-
const ignoreOpts = {
|
|
2269
|
-
...options,
|
|
2270
|
-
ignore: null,
|
|
2271
|
-
onMatch: null,
|
|
2272
|
-
onResult: null
|
|
2273
|
-
};
|
|
2274
|
-
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
2275
|
-
}
|
|
2276
|
-
const matcher = (input, returnObject = false) => {
|
|
2277
|
-
const { isMatch, match, output } = picomatch.test(input, regex, options, {
|
|
2278
|
-
glob,
|
|
2279
|
-
posix
|
|
2280
|
-
});
|
|
2281
|
-
const result = {
|
|
2282
|
-
glob,
|
|
2283
|
-
state,
|
|
2284
|
-
regex,
|
|
2285
|
-
posix,
|
|
2286
|
-
input,
|
|
2287
|
-
output,
|
|
2288
|
-
match,
|
|
2289
|
-
isMatch
|
|
2290
|
-
};
|
|
2291
|
-
if (typeof opts.onResult === "function") opts.onResult(result);
|
|
2292
|
-
if (isMatch === false) {
|
|
2293
|
-
result.isMatch = false;
|
|
2294
|
-
return returnObject ? result : false;
|
|
2295
|
-
}
|
|
2296
|
-
if (isIgnored(input)) {
|
|
2297
|
-
if (typeof opts.onIgnore === "function") opts.onIgnore(result);
|
|
2298
|
-
result.isMatch = false;
|
|
2299
|
-
return returnObject ? result : false;
|
|
2300
|
-
}
|
|
2301
|
-
if (typeof opts.onMatch === "function") opts.onMatch(result);
|
|
2302
|
-
return returnObject ? result : true;
|
|
2303
|
-
};
|
|
2304
|
-
if (returnState) matcher.state = state;
|
|
2305
|
-
return matcher;
|
|
2306
|
-
};
|
|
2307
|
-
/**
|
|
2308
|
-
* Test `input` with the given `regex`. This is used by the main
|
|
2309
|
-
* `picomatch()` function to test the input string.
|
|
2310
|
-
*
|
|
2311
|
-
* ```js
|
|
2312
|
-
* const picomatch = require('picomatch');
|
|
2313
|
-
* // picomatch.test(input, regex[, options]);
|
|
2314
|
-
*
|
|
2315
|
-
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
2316
|
-
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
2317
|
-
* ```
|
|
2318
|
-
* @param {String} `input` String to test.
|
|
2319
|
-
* @param {RegExp} `regex`
|
|
2320
|
-
* @return {Object} Returns an object with matching info.
|
|
2321
|
-
* @api public
|
|
2322
|
-
*/
|
|
2323
|
-
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
2324
|
-
if (typeof input !== "string") throw new TypeError("Expected input to be a string");
|
|
2325
|
-
if (input === "") return {
|
|
2326
|
-
isMatch: false,
|
|
2327
|
-
output: ""
|
|
2328
|
-
};
|
|
2329
|
-
const opts = options || {};
|
|
2330
|
-
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
2331
|
-
let match = input === glob;
|
|
2332
|
-
let output = match && format ? format(input) : input;
|
|
2333
|
-
if (match === false) {
|
|
2334
|
-
output = format ? format(input) : input;
|
|
2335
|
-
match = output === glob;
|
|
2336
|
-
}
|
|
2337
|
-
if (match === false || opts.capture === true) {
|
|
2338
|
-
if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
|
|
2339
|
-
else match = regex.exec(output);
|
|
2340
|
-
}
|
|
2341
|
-
return {
|
|
2342
|
-
isMatch: Boolean(match),
|
|
2343
|
-
match,
|
|
2344
|
-
output
|
|
2345
|
-
};
|
|
2346
|
-
};
|
|
2347
|
-
/**
|
|
2348
|
-
* Match the basename of a filepath.
|
|
2349
|
-
*
|
|
2350
|
-
* ```js
|
|
2351
|
-
* const picomatch = require('picomatch');
|
|
2352
|
-
* // picomatch.matchBase(input, glob[, options]);
|
|
2353
|
-
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
2354
|
-
* ```
|
|
2355
|
-
* @param {String} `input` String to test.
|
|
2356
|
-
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
2357
|
-
* @return {Boolean}
|
|
2358
|
-
* @api public
|
|
2359
|
-
*/
|
|
2360
|
-
picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
|
|
2361
|
-
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input, { windows: posix }));
|
|
2362
|
-
};
|
|
2363
|
-
/**
|
|
2364
|
-
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
2365
|
-
*
|
|
2366
|
-
* ```js
|
|
2367
|
-
* const picomatch = require('picomatch');
|
|
2368
|
-
* // picomatch.isMatch(string, patterns[, options]);
|
|
2369
|
-
*
|
|
2370
|
-
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
2371
|
-
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
2372
|
-
* ```
|
|
2373
|
-
* @param {String|Array} str The string to test.
|
|
2374
|
-
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
2375
|
-
* @param {Object} [options] See available [options](#options).
|
|
2376
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
|
2377
|
-
* @api public
|
|
2378
|
-
*/
|
|
2379
|
-
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
2380
|
-
/**
|
|
2381
|
-
* Parse a glob pattern to create the source string for a regular
|
|
2382
|
-
* expression.
|
|
2383
|
-
*
|
|
2384
|
-
* ```js
|
|
2385
|
-
* const picomatch = require('picomatch');
|
|
2386
|
-
* const result = picomatch.parse(pattern[, options]);
|
|
2387
|
-
* ```
|
|
2388
|
-
* @param {String} `pattern`
|
|
2389
|
-
* @param {Object} `options`
|
|
2390
|
-
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
2391
|
-
* @api public
|
|
2392
|
-
*/
|
|
2393
|
-
picomatch.parse = (pattern, options) => {
|
|
2394
|
-
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
2395
|
-
return parse(pattern, {
|
|
2396
|
-
...options,
|
|
2397
|
-
fastpaths: false
|
|
2398
|
-
});
|
|
2399
|
-
};
|
|
2400
|
-
/**
|
|
2401
|
-
* Scan a glob pattern to separate the pattern into segments.
|
|
2402
|
-
*
|
|
2403
|
-
* ```js
|
|
2404
|
-
* const picomatch = require('picomatch');
|
|
2405
|
-
* // picomatch.scan(input[, options]);
|
|
2406
|
-
*
|
|
2407
|
-
* const result = picomatch.scan('!./foo/*.js');
|
|
2408
|
-
* console.log(result);
|
|
2409
|
-
* { prefix: '!./',
|
|
2410
|
-
* input: '!./foo/*.js',
|
|
2411
|
-
* start: 3,
|
|
2412
|
-
* base: 'foo',
|
|
2413
|
-
* glob: '*.js',
|
|
2414
|
-
* isBrace: false,
|
|
2415
|
-
* isBracket: false,
|
|
2416
|
-
* isGlob: true,
|
|
2417
|
-
* isExtglob: false,
|
|
2418
|
-
* isGlobstar: false,
|
|
2419
|
-
* negated: true }
|
|
2420
|
-
* ```
|
|
2421
|
-
* @param {String} `input` Glob pattern to scan.
|
|
2422
|
-
* @param {Object} `options`
|
|
2423
|
-
* @return {Object} Returns an object with
|
|
2424
|
-
* @api public
|
|
2425
|
-
*/
|
|
2426
|
-
picomatch.scan = (input, options) => scan(input, options);
|
|
2427
|
-
/**
|
|
2428
|
-
* Compile a regular expression from the `state` object returned by the
|
|
2429
|
-
* [parse()](#parse) method.
|
|
2430
|
-
*
|
|
2431
|
-
* ```js
|
|
2432
|
-
* const picomatch = require('picomatch');
|
|
2433
|
-
* const state = picomatch.parse('*.js');
|
|
2434
|
-
* // picomatch.compileRe(state[, options]);
|
|
2435
|
-
*
|
|
2436
|
-
* console.log(picomatch.compileRe(state));
|
|
2437
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2438
|
-
* ```
|
|
2439
|
-
* @param {Object} `state`
|
|
2440
|
-
* @param {Object} `options`
|
|
2441
|
-
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
2442
|
-
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
2443
|
-
* @return {RegExp}
|
|
2444
|
-
* @api public
|
|
2445
|
-
*/
|
|
2446
|
-
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
2447
|
-
if (returnOutput === true) return state.output;
|
|
2448
|
-
const opts = options || {};
|
|
2449
|
-
const prepend = opts.contains ? "" : "^";
|
|
2450
|
-
const append = opts.contains ? "" : "$";
|
|
2451
|
-
let source = `${prepend}(?:${state.output})${append}`;
|
|
2452
|
-
if (state && state.negated === true) source = `^(?!${source}).*$`;
|
|
2453
|
-
const regex = picomatch.toRegex(source, options);
|
|
2454
|
-
if (returnState === true) regex.state = state;
|
|
2455
|
-
return regex;
|
|
2456
|
-
};
|
|
2457
|
-
/**
|
|
2458
|
-
* Create a regular expression from a parsed glob pattern.
|
|
2459
|
-
*
|
|
2460
|
-
* ```js
|
|
2461
|
-
* const picomatch = require('picomatch');
|
|
2462
|
-
* // picomatch.makeRe(state[, options]);
|
|
2463
|
-
*
|
|
2464
|
-
* const result = picomatch.makeRe('*.js');
|
|
2465
|
-
* console.log(result);
|
|
2466
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2467
|
-
* ```
|
|
2468
|
-
* @param {String} `state` The object returned from the `.parse` method.
|
|
2469
|
-
* @param {Object} `options`
|
|
2470
|
-
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
2471
|
-
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
2472
|
-
* @return {RegExp} Returns a regex created from the given pattern.
|
|
2473
|
-
* @api public
|
|
2474
|
-
*/
|
|
2475
|
-
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
2476
|
-
if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
|
|
2477
|
-
let parsed = {
|
|
2478
|
-
negated: false,
|
|
2479
|
-
fastpaths: true
|
|
2480
|
-
};
|
|
2481
|
-
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
|
|
2482
|
-
if (!parsed.output) parsed = parse(input, options);
|
|
2483
|
-
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
2484
|
-
};
|
|
2485
|
-
/**
|
|
2486
|
-
* Create a regular expression from the given regex source string.
|
|
2487
|
-
*
|
|
2488
|
-
* ```js
|
|
2489
|
-
* const picomatch = require('picomatch');
|
|
2490
|
-
* // picomatch.toRegex(source[, options]);
|
|
2491
|
-
*
|
|
2492
|
-
* const { output } = picomatch.parse('*.js');
|
|
2493
|
-
* console.log(picomatch.toRegex(output));
|
|
2494
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2495
|
-
* ```
|
|
2496
|
-
* @param {String} `source` Regular expression source string.
|
|
2497
|
-
* @param {Object} `options`
|
|
2498
|
-
* @return {RegExp}
|
|
2499
|
-
* @api public
|
|
2500
|
-
*/
|
|
2501
|
-
picomatch.toRegex = (source, options) => {
|
|
2502
|
-
try {
|
|
2503
|
-
const opts = options || {};
|
|
2504
|
-
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
2505
|
-
} catch (err) {
|
|
2506
|
-
if (options && options.debug === true) throw err;
|
|
2507
|
-
return /$^/;
|
|
2508
|
-
}
|
|
2509
|
-
};
|
|
2510
|
-
/**
|
|
2511
|
-
* Picomatch constants.
|
|
2512
|
-
* @return {Object}
|
|
2513
|
-
*/
|
|
2514
|
-
picomatch.constants = constants;
|
|
2515
|
-
/**
|
|
2516
|
-
* Expose "picomatch"
|
|
2517
|
-
*/
|
|
2518
|
-
module.exports = picomatch;
|
|
2519
|
-
}));
|
|
2520
|
-
//#endregion
|
|
2521
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/matchFiles.js
|
|
2522
|
-
var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2523
|
-
const pico = require_picomatch$1();
|
|
2524
|
-
const utils = require_utils();
|
|
2525
|
-
function picomatch(glob, options, returnState = false) {
|
|
2526
|
-
if (options && (options.windows === null || options.windows === void 0)) options = {
|
|
2527
|
-
...options,
|
|
2528
|
-
windows: utils.isWindows()
|
|
2529
|
-
};
|
|
2530
|
-
return pico(glob, options, returnState);
|
|
2531
|
-
}
|
|
2532
|
-
Object.assign(picomatch, pico);
|
|
2533
|
-
module.exports = picomatch;
|
|
2534
|
-
})))(), 1);
|
|
607
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/matchFiles.js
|
|
608
|
+
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
2535
609
|
/**
|
|
2536
610
|
* Match list of files against a pattern.
|
|
2537
611
|
*
|
|
@@ -2548,8 +622,7 @@ const matchFiles = (files, pattern, cwd = process.cwd()) => {
|
|
|
2548
622
|
});
|
|
2549
623
|
return files.filter((file) => isMatch(file.filepath));
|
|
2550
624
|
};
|
|
2551
|
-
|
|
2552
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/normalizePath.js
|
|
625
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/normalizePath.js
|
|
2553
626
|
/**
|
|
2554
627
|
* Reimplementation of "normalize-path"
|
|
2555
628
|
* @see https://github.com/jonschlinkert/normalize-path/blob/52c3a95ebebc2d98c1ad7606cbafa7e658656899/index.js
|
|
@@ -2586,8 +659,7 @@ const normalizePath = (input) => {
|
|
|
2586
659
|
if (normalized.endsWith(path.posix.sep)) normalized = normalized.slice(0, -1);
|
|
2587
660
|
return normalized;
|
|
2588
661
|
};
|
|
2589
|
-
|
|
2590
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/generateTasks.js
|
|
662
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/generateTasks.js
|
|
2591
663
|
const debugLog$15 = createDebug("lint-staged:generateTasks");
|
|
2592
664
|
/**
|
|
2593
665
|
* Generates all task commands, and filelist
|
|
@@ -2623,8 +695,7 @@ const generateTasks = ({ config, cwd = process.cwd(), files, relative = false })
|
|
|
2623
695
|
return task;
|
|
2624
696
|
});
|
|
2625
697
|
};
|
|
2626
|
-
|
|
2627
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getAbortController.js
|
|
698
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getAbortController.js
|
|
2628
699
|
const Signal = {
|
|
2629
700
|
SIGINT: "SIGINT",
|
|
2630
701
|
SIGKILL: "SIGKILL"
|
|
@@ -2640,8 +711,7 @@ const getAbortController = (nodeProcess = process) => {
|
|
|
2640
711
|
});
|
|
2641
712
|
return abortController;
|
|
2642
713
|
};
|
|
2643
|
-
|
|
2644
|
-
//#region ../../node_modules/.pnpm/string-argv@0.3.2/node_modules/string-argv/index.js
|
|
714
|
+
// ../../node_modules/.pnpm/string-argv@0.3.2/node_modules/string-argv/index.js
|
|
2645
715
|
function parseArgsStringToArgv(value, env, file) {
|
|
2646
716
|
var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi;
|
|
2647
717
|
var myString = value;
|
|
@@ -2663,8 +733,7 @@ function firstString() {
|
|
|
2663
733
|
if (typeof arg === "string") return arg;
|
|
2664
734
|
}
|
|
2665
735
|
}
|
|
2666
|
-
|
|
2667
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/killSubprocesses.js
|
|
736
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/killSubprocesses.js
|
|
2668
737
|
const execAsync = promisify(exec);
|
|
2669
738
|
/**
|
|
2670
739
|
* End process by pid, forcefully, including child processes
|
|
@@ -2696,8 +765,7 @@ const killSubProcesses = async (pid, isWin32 = process.platform === "win32") =>
|
|
|
2696
765
|
else await killUnixSubprocesses(pid);
|
|
2697
766
|
} catch {}
|
|
2698
767
|
};
|
|
2699
|
-
|
|
2700
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/symbols.js
|
|
768
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/symbols.js
|
|
2701
769
|
const ApplyEmptyCommitError = Symbol("ApplyEmptyCommitError");
|
|
2702
770
|
const ConfigNotFoundError = /* @__PURE__ */ new Error("Configuration could not be found");
|
|
2703
771
|
const ConfigFormatError = /* @__PURE__ */ new Error("Configuration should be an object or a function");
|
|
@@ -2713,8 +781,7 @@ const RestoreOriginalStateError = Symbol("RestoreOriginalStateError");
|
|
|
2713
781
|
const RestoreUnstagedChangesError = Symbol("RestoreUnstagedChangesError");
|
|
2714
782
|
const TaskError = Symbol("TaskError");
|
|
2715
783
|
const FailOnChangesError = Symbol("FailOnChangesError");
|
|
2716
|
-
|
|
2717
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/state.js
|
|
784
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/state.js
|
|
2718
785
|
const getInitialState = ({ failOnChanges = false, hideAll = false, hideUnstaged = false, hidePartiallyStaged = !(hideAll || hideUnstaged), quiet = false, revert = true } = {}) => {
|
|
2719
786
|
const initialState = {
|
|
2720
787
|
backupHash: void 0,
|
|
@@ -2763,8 +830,7 @@ const cleanupSkipped = (ctx) => {
|
|
|
2763
830
|
if (restoreOriginalStateSkipped(ctx)) return gitError();
|
|
2764
831
|
if (ctx.errors.has(RestoreOriginalStateError)) return gitError();
|
|
2765
832
|
};
|
|
2766
|
-
|
|
2767
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getSpawnedTask.js
|
|
833
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getSpawnedTask.js
|
|
2768
834
|
const debugLog$14 = createDebug("lint-staged:getSpawnedTask");
|
|
2769
835
|
/**
|
|
2770
836
|
* Handle task console output.
|
|
@@ -2860,8 +926,7 @@ const getSpawnedTask = ({ abortController, command, continueOnError = false, cwd
|
|
|
2860
926
|
if (verbose) handleTaskOutput(command, output, ctx, signal);
|
|
2861
927
|
};
|
|
2862
928
|
};
|
|
2863
|
-
|
|
2864
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getFunctionTask.js
|
|
929
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getFunctionTask.js
|
|
2865
930
|
const debugLog$13 = createDebug("lint-staged:getFunctionTasks");
|
|
2866
931
|
/**
|
|
2867
932
|
* @typedef {{ title: string; task: Function }} FunctionTask
|
|
@@ -2906,8 +971,7 @@ const getFunctionTask = async ({ abortController, command, continueOnError, file
|
|
|
2906
971
|
task
|
|
2907
972
|
}];
|
|
2908
973
|
};
|
|
2909
|
-
|
|
2910
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/parseGitZOutput.js
|
|
974
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/parseGitZOutput.js
|
|
2911
975
|
const GIT_Z_REGEXP = /\u0000$/;
|
|
2912
976
|
/**
|
|
2913
977
|
* Return array of strings split from the output of `git <something> -z`.
|
|
@@ -2918,8 +982,7 @@ const GIT_Z_REGEXP = /\u0000$/;
|
|
|
2918
982
|
* @returns {string[]} parsed input
|
|
2919
983
|
*/
|
|
2920
984
|
const parseGitZOutput = (input) => input ? input.replace(GIT_Z_REGEXP, "").split("\0") : [];
|
|
2921
|
-
|
|
2922
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getIntentToAddFiles.js
|
|
985
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getIntentToAddFiles.js
|
|
2923
986
|
const debugLog$12 = createDebug("lint-staged:getIntentToAddFiles");
|
|
2924
987
|
const getIntentToAddFiles = async ({ cwd }) => {
|
|
2925
988
|
const [stagedWithIta, stagedWithoutIta] = await Promise.all([execGit([
|
|
@@ -2940,8 +1003,7 @@ const getIntentToAddFiles = async ({ cwd }) => {
|
|
|
2940
1003
|
debugLog$12(`Detected ${intentToAdd.length} files staged with "--intent-to-add":`, intentToAdd);
|
|
2941
1004
|
return intentToAdd;
|
|
2942
1005
|
};
|
|
2943
|
-
|
|
2944
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/validateBraces.js
|
|
1006
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/validateBraces.js
|
|
2945
1007
|
/**
|
|
2946
1008
|
* A correctly-formed brace expansion must contain unquoted opening and closing braces,
|
|
2947
1009
|
* and at least one unquoted comma or a valid sequence expression.
|
|
@@ -3024,8 +1086,7 @@ const validateBraces = (pattern, logger) => {
|
|
|
3024
1086
|
if (fixedPattern !== pattern) logger.warn(incorrectBraces(pattern, fixedPattern));
|
|
3025
1087
|
return fixedPattern;
|
|
3026
1088
|
};
|
|
3027
|
-
|
|
3028
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/validateConfig.js
|
|
1089
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/validateConfig.js
|
|
3029
1090
|
/** @typedef {import('./index').Logger} Logger */
|
|
3030
1091
|
const debugLog$11 = createDebug("lint-staged:validateConfig");
|
|
3031
1092
|
/**
|
|
@@ -3095,8 +1156,7 @@ const validateConfig = (config, configPath, logger) => {
|
|
|
3095
1156
|
throw error;
|
|
3096
1157
|
}
|
|
3097
1158
|
};
|
|
3098
|
-
|
|
3099
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getSpawnedTasks.js
|
|
1159
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getSpawnedTasks.js
|
|
3100
1160
|
const debugLog$10 = createDebug("lint-staged:getSpawnedTasks");
|
|
3101
1161
|
/**
|
|
3102
1162
|
* @param {import('./config.js').SequentialTasks} commands
|
|
@@ -3172,8 +1232,7 @@ const getSpawnedTasks = async ({ abortController, commands, continueOnError, cwd
|
|
|
3172
1232
|
});
|
|
3173
1233
|
return prepared.map((command) => Array.isArray(command) ? command.map(createTask) : createTask(command));
|
|
3174
1234
|
};
|
|
3175
|
-
|
|
3176
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/file.js
|
|
1235
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/file.js
|
|
3177
1236
|
const debugLog$9 = createDebug("lint-staged:file");
|
|
3178
1237
|
/**
|
|
3179
1238
|
* Ensure directory exists, creating it if not.
|
|
@@ -3224,8 +1283,7 @@ const writeFile = async (filename, buffer) => {
|
|
|
3224
1283
|
debugLog$9("Writing file `%s`", filename);
|
|
3225
1284
|
await fsPromises.writeFile(filename, buffer);
|
|
3226
1285
|
};
|
|
3227
|
-
|
|
3228
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getDiffCommand.js
|
|
1286
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getDiffCommand.js
|
|
3229
1287
|
/** @type {(diff?: string, diffFilter?: string) => string[]} */
|
|
3230
1288
|
const getDiffCommand = (diff, diffFilter) => {
|
|
3231
1289
|
/**
|
|
@@ -3241,8 +1299,7 @@ const getDiffCommand = (diff, diffFilter) => {
|
|
|
3241
1299
|
...diffArgs
|
|
3242
1300
|
];
|
|
3243
1301
|
};
|
|
3244
|
-
|
|
3245
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getStagedFiles.js
|
|
1302
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/getStagedFiles.js
|
|
3246
1303
|
/**
|
|
3247
1304
|
* @typedef {'A'|'C'|'D'|'M'|'R'|'T'|'U'|'X'} FileSatus
|
|
3248
1305
|
* @typedef { { filepath: string; status: FileSatus }} StagedFile
|
|
@@ -3348,8 +1405,7 @@ const getStagedFiles = async ({ all, cwd, gitConfigDir, diff, diffFilter }) => {
|
|
|
3348
1405
|
return null;
|
|
3349
1406
|
}
|
|
3350
1407
|
};
|
|
3351
|
-
|
|
3352
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/runParallelTasks.js
|
|
1408
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/runParallelTasks.js
|
|
3353
1409
|
const debugLog$8 = createDebug("lint-staged:runParallelTasks");
|
|
3354
1410
|
/** @param {Number | boolean} options.concurrent Boolean value for whether to run concurrently */
|
|
3355
1411
|
const parseConcurrency = (concurrent) => {
|
|
@@ -3434,8 +1490,7 @@ const runParallelTasks = async (ctx, tasks, { abortController, concurrent = true
|
|
|
3434
1490
|
debugLog$8("Done running workers");
|
|
3435
1491
|
logger?.log("");
|
|
3436
1492
|
};
|
|
3437
|
-
|
|
3438
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/gitWorkflow.js
|
|
1493
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/gitWorkflow.js
|
|
3439
1494
|
const debugLog$7 = createDebug("lint-staged:GitWorkflow");
|
|
3440
1495
|
const MERGE_HEAD = "MERGE_HEAD";
|
|
3441
1496
|
const MERGE_MODE = "MERGE_MODE";
|
|
@@ -3908,8 +1963,7 @@ var GitWorkflow = class {
|
|
|
3908
1963
|
}
|
|
3909
1964
|
}
|
|
3910
1965
|
};
|
|
3911
|
-
|
|
3912
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/groupFilesByConfig.js
|
|
1966
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/groupFilesByConfig.js
|
|
3913
1967
|
const debugLog$6 = createDebug("lint-staged:groupFilesByConfig");
|
|
3914
1968
|
/**
|
|
3915
1969
|
* @typedef {import('./getStagedFiles.js').StagedFile} StagedFile
|
|
@@ -3975,8 +2029,7 @@ const groupFilesByConfig = async ({ configs, files, singleConfigMode }) => {
|
|
|
3975
2029
|
}
|
|
3976
2030
|
return filesByConfig;
|
|
3977
2031
|
};
|
|
3978
|
-
|
|
3979
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/resolveGitRepo.js
|
|
2032
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/resolveGitRepo.js
|
|
3980
2033
|
const debugLog$5 = createDebug("lint-staged:resolveGitRepo");
|
|
3981
2034
|
/**
|
|
3982
2035
|
* Relative path up to the repo top-level directory
|
|
@@ -4034,8 +2087,7 @@ const resolveGitRepo = async (cwd = process.cwd()) => {
|
|
|
4034
2087
|
};
|
|
4035
2088
|
}
|
|
4036
2089
|
};
|
|
4037
|
-
|
|
4038
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/configFiles.js
|
|
2090
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/configFiles.js
|
|
4039
2091
|
const CONFIG_NAME = "lint-staged";
|
|
4040
2092
|
const PACKAGE_JSON_FILE = "package.json";
|
|
4041
2093
|
const PACKAGE_YAML_FILES = ["package.yaml", "package.yml"];
|
|
@@ -4063,22 +2115,20 @@ const CONFIG_FILE_NAMES = [
|
|
|
4063
2115
|
"lint-staged.config.cjs",
|
|
4064
2116
|
"lint-staged.config.cts"
|
|
4065
2117
|
];
|
|
4066
|
-
|
|
4067
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/resolveConfig.js
|
|
2118
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/resolveConfig.js
|
|
4068
2119
|
/**
|
|
4069
2120
|
* require() does not exist for ESM, so we must create it to use require.resolve().
|
|
4070
2121
|
* @see https://nodejs.org/api/module.html#modulecreaterequirefilename
|
|
4071
2122
|
*/
|
|
4072
|
-
const require
|
|
2123
|
+
const require = createRequire(import.meta.url);
|
|
4073
2124
|
function resolveConfig(configPath) {
|
|
4074
2125
|
try {
|
|
4075
|
-
return require
|
|
2126
|
+
return require.resolve(configPath);
|
|
4076
2127
|
} catch {
|
|
4077
2128
|
return configPath;
|
|
4078
2129
|
}
|
|
4079
2130
|
}
|
|
4080
|
-
|
|
4081
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/loadConfig.js
|
|
2131
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/loadConfig.js
|
|
4082
2132
|
/** @typedef {import('./index').Logger} Logger */
|
|
4083
2133
|
const debugLog$4 = createDebug("lint-staged:loadConfig");
|
|
4084
2134
|
const readFile = async (filename) => fsPromises.readFile(path.resolve(filename), "utf-8");
|
|
@@ -4099,7 +2149,7 @@ const jsonParse = async (filename) => {
|
|
|
4099
2149
|
const yamlParse = async (filename) => {
|
|
4100
2150
|
const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
|
|
4101
2151
|
try {
|
|
4102
|
-
const [YAML, content] = await Promise.all([import("../dist-
|
|
2152
|
+
const [YAML, content] = await Promise.all([import("../dist-zDZV5eEc.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
|
|
4103
2153
|
const yaml = YAML.parse(content);
|
|
4104
2154
|
return isPackageFile ? yaml[CONFIG_NAME] : yaml;
|
|
4105
2155
|
} catch (error) {
|
|
@@ -4158,8 +2208,7 @@ const loadConfig = async (configPath, logger) => {
|
|
|
4158
2208
|
return {};
|
|
4159
2209
|
}
|
|
4160
2210
|
};
|
|
4161
|
-
|
|
4162
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/searchConfigs.js
|
|
2211
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/searchConfigs.js
|
|
4163
2212
|
const debugLog$3 = createDebug("lint-staged:searchConfigs");
|
|
4164
2213
|
const CONFIG_PATHSPEC = CONFIG_FILE_NAMES.map((f) => `:(glob)**/${f}`);
|
|
4165
2214
|
const numberOfLevels = (file) => file.split("/").length;
|
|
@@ -4272,8 +2321,7 @@ const searchConfigs = async ({ configObject, configPath, cwd = process.cwd(), to
|
|
|
4272
2321
|
debugLog$3("Found %d config files", Object.keys(foundConfigs).length);
|
|
4273
2322
|
return foundConfigs;
|
|
4274
2323
|
};
|
|
4275
|
-
|
|
4276
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/runAll.js
|
|
2324
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/runAll.js
|
|
4277
2325
|
/** @typedef {import('./index').Logger} Logger */
|
|
4278
2326
|
const debugLog$2 = createDebug("lint-staged:runAll");
|
|
4279
2327
|
/**
|
|
@@ -4478,8 +2526,7 @@ const runAll = async ({ all, allowEmpty, concurrent, configObject, configPath, c
|
|
|
4478
2526
|
if (ctx.errors.size > 0) throw createError(ctx);
|
|
4479
2527
|
return ctx;
|
|
4480
2528
|
};
|
|
4481
|
-
|
|
4482
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/validateOptions.js
|
|
2529
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/validateOptions.js
|
|
4483
2530
|
const debugLog$1 = createDebug("lint-staged:validateOptions");
|
|
4484
2531
|
/** @type {(value: number) => boolean} */
|
|
4485
2532
|
const isValidIntegerValue = (value) => Number.isInteger(value) || value === Infinity;
|
|
@@ -4511,11 +2558,9 @@ const validateOptions = async (options = {}, logger) => {
|
|
|
4511
2558
|
}
|
|
4512
2559
|
debugLog$1("Validated options: %o", options);
|
|
4513
2560
|
};
|
|
4514
|
-
|
|
4515
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/version.js
|
|
2561
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/version.js
|
|
4516
2562
|
const getVersion = async () => "17.6.0";
|
|
4517
|
-
|
|
4518
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/index.js
|
|
2563
|
+
// ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/index.js
|
|
4519
2564
|
const debugLog = createDebug("lint-staged");
|
|
4520
2565
|
/**
|
|
4521
2566
|
* @typedef {(...any) => void} LogFunction
|
|
@@ -4588,8 +2633,7 @@ const lintStaged = async (options = {}, logger = console) => {
|
|
|
4588
2633
|
throw runAllError;
|
|
4589
2634
|
}
|
|
4590
2635
|
};
|
|
4591
|
-
|
|
4592
|
-
//#region src/staged/logger.ts
|
|
2636
|
+
// src/staged/logger.ts
|
|
4593
2637
|
const workflowSuccessMessages = /* @__PURE__ */ new Set([
|
|
4594
2638
|
"✔ Done preparing lint-staged!",
|
|
4595
2639
|
"✔ Done running tasks for staged files!",
|
|
@@ -4616,8 +2660,7 @@ function createStagedLogger(logger = {
|
|
|
4616
2660
|
}
|
|
4617
2661
|
};
|
|
4618
2662
|
}
|
|
4619
|
-
|
|
4620
|
-
//#region src/staged/bin.ts
|
|
2663
|
+
// src/staged/bin.ts
|
|
4621
2664
|
const args = unwrapCliParseOutcome(parseStagedArgs(process.argv.slice(3)));
|
|
4622
2665
|
const options = {};
|
|
4623
2666
|
if (args.allowEmpty != null) options.allowEmpty = args.allowEmpty;
|
|
@@ -4656,5 +2699,4 @@ if (args.diffFilter != null) options.diffFilter = args.diffFilter;
|
|
|
4656
2699
|
if (args.concurrent != null) options.concurrent = args.concurrent;
|
|
4657
2700
|
const success = await lintStaged(options, options.debug || options.quiet ? void 0 : createStagedLogger());
|
|
4658
2701
|
process.exit(success ? 0 : 1);
|
|
4659
|
-
//#endregion
|
|
4660
2702
|
export {};
|