dicom-curate 0.20.2 → 0.22.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/dist/esm/index.js +1543 -0
- package/dist/esm/scanDirectoryWorker.js +26 -4
- package/dist/types/scanDirectoryWorker.d.ts +3 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/umd/dicom-curate.umd.js +2173 -5
- package/dist/umd/dicom-curate.umd.js.map +1 -1
- package/dist/umd/dicom-curate.umd.min.js +9 -9
- package/dist/umd/dicom-curate.umd.min.js.map +1 -1
- package/package.json +4 -1
package/dist/esm/index.js
CHANGED
|
@@ -67496,6 +67496,1540 @@ var require_acorn_globals = __commonJS({
|
|
|
67496
67496
|
}
|
|
67497
67497
|
});
|
|
67498
67498
|
|
|
67499
|
+
// node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
|
|
67500
|
+
var require_constants = __commonJS({
|
|
67501
|
+
"node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js"(exports, module) {
|
|
67502
|
+
"use strict";
|
|
67503
|
+
var WIN_SLASH = "\\\\/";
|
|
67504
|
+
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
67505
|
+
var DOT_LITERAL = "\\.";
|
|
67506
|
+
var PLUS_LITERAL = "\\+";
|
|
67507
|
+
var QMARK_LITERAL = "\\?";
|
|
67508
|
+
var SLASH_LITERAL = "\\/";
|
|
67509
|
+
var ONE_CHAR = "(?=.)";
|
|
67510
|
+
var QMARK = "[^/]";
|
|
67511
|
+
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
67512
|
+
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
67513
|
+
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
67514
|
+
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
67515
|
+
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
67516
|
+
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
67517
|
+
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
67518
|
+
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
67519
|
+
var STAR = `${QMARK}*?`;
|
|
67520
|
+
var SEP = "/";
|
|
67521
|
+
var POSIX_CHARS = {
|
|
67522
|
+
DOT_LITERAL,
|
|
67523
|
+
PLUS_LITERAL,
|
|
67524
|
+
QMARK_LITERAL,
|
|
67525
|
+
SLASH_LITERAL,
|
|
67526
|
+
ONE_CHAR,
|
|
67527
|
+
QMARK,
|
|
67528
|
+
END_ANCHOR,
|
|
67529
|
+
DOTS_SLASH,
|
|
67530
|
+
NO_DOT,
|
|
67531
|
+
NO_DOTS,
|
|
67532
|
+
NO_DOT_SLASH,
|
|
67533
|
+
NO_DOTS_SLASH,
|
|
67534
|
+
QMARK_NO_DOT,
|
|
67535
|
+
STAR,
|
|
67536
|
+
START_ANCHOR,
|
|
67537
|
+
SEP
|
|
67538
|
+
};
|
|
67539
|
+
var WINDOWS_CHARS = {
|
|
67540
|
+
...POSIX_CHARS,
|
|
67541
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
67542
|
+
QMARK: WIN_NO_SLASH,
|
|
67543
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
67544
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
67545
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
67546
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
67547
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
67548
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
67549
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
67550
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
67551
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
67552
|
+
SEP: "\\"
|
|
67553
|
+
};
|
|
67554
|
+
var POSIX_REGEX_SOURCE = {
|
|
67555
|
+
alnum: "a-zA-Z0-9",
|
|
67556
|
+
alpha: "a-zA-Z",
|
|
67557
|
+
ascii: "\\x00-\\x7F",
|
|
67558
|
+
blank: " \\t",
|
|
67559
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
67560
|
+
digit: "0-9",
|
|
67561
|
+
graph: "\\x21-\\x7E",
|
|
67562
|
+
lower: "a-z",
|
|
67563
|
+
print: "\\x20-\\x7E ",
|
|
67564
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
67565
|
+
space: " \\t\\r\\n\\v\\f",
|
|
67566
|
+
upper: "A-Z",
|
|
67567
|
+
word: "A-Za-z0-9_",
|
|
67568
|
+
xdigit: "A-Fa-f0-9"
|
|
67569
|
+
};
|
|
67570
|
+
module.exports = {
|
|
67571
|
+
MAX_LENGTH: 1024 * 64,
|
|
67572
|
+
POSIX_REGEX_SOURCE,
|
|
67573
|
+
// regular expressions
|
|
67574
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
67575
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
67576
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
67577
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
67578
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
67579
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
67580
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
67581
|
+
REPLACEMENTS: {
|
|
67582
|
+
__proto__: null,
|
|
67583
|
+
"***": "*",
|
|
67584
|
+
"**/**": "**",
|
|
67585
|
+
"**/**/**": "**"
|
|
67586
|
+
},
|
|
67587
|
+
// Digits
|
|
67588
|
+
CHAR_0: 48,
|
|
67589
|
+
/* 0 */
|
|
67590
|
+
CHAR_9: 57,
|
|
67591
|
+
/* 9 */
|
|
67592
|
+
// Alphabet chars.
|
|
67593
|
+
CHAR_UPPERCASE_A: 65,
|
|
67594
|
+
/* A */
|
|
67595
|
+
CHAR_LOWERCASE_A: 97,
|
|
67596
|
+
/* a */
|
|
67597
|
+
CHAR_UPPERCASE_Z: 90,
|
|
67598
|
+
/* Z */
|
|
67599
|
+
CHAR_LOWERCASE_Z: 122,
|
|
67600
|
+
/* z */
|
|
67601
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
67602
|
+
/* ( */
|
|
67603
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
67604
|
+
/* ) */
|
|
67605
|
+
CHAR_ASTERISK: 42,
|
|
67606
|
+
/* * */
|
|
67607
|
+
// Non-alphabetic chars.
|
|
67608
|
+
CHAR_AMPERSAND: 38,
|
|
67609
|
+
/* & */
|
|
67610
|
+
CHAR_AT: 64,
|
|
67611
|
+
/* @ */
|
|
67612
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
67613
|
+
/* \ */
|
|
67614
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
67615
|
+
/* \r */
|
|
67616
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
67617
|
+
/* ^ */
|
|
67618
|
+
CHAR_COLON: 58,
|
|
67619
|
+
/* : */
|
|
67620
|
+
CHAR_COMMA: 44,
|
|
67621
|
+
/* , */
|
|
67622
|
+
CHAR_DOT: 46,
|
|
67623
|
+
/* . */
|
|
67624
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
67625
|
+
/* " */
|
|
67626
|
+
CHAR_EQUAL: 61,
|
|
67627
|
+
/* = */
|
|
67628
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
67629
|
+
/* ! */
|
|
67630
|
+
CHAR_FORM_FEED: 12,
|
|
67631
|
+
/* \f */
|
|
67632
|
+
CHAR_FORWARD_SLASH: 47,
|
|
67633
|
+
/* / */
|
|
67634
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
67635
|
+
/* ` */
|
|
67636
|
+
CHAR_HASH: 35,
|
|
67637
|
+
/* # */
|
|
67638
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
67639
|
+
/* - */
|
|
67640
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
67641
|
+
/* < */
|
|
67642
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
67643
|
+
/* { */
|
|
67644
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
67645
|
+
/* [ */
|
|
67646
|
+
CHAR_LINE_FEED: 10,
|
|
67647
|
+
/* \n */
|
|
67648
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
67649
|
+
/* \u00A0 */
|
|
67650
|
+
CHAR_PERCENT: 37,
|
|
67651
|
+
/* % */
|
|
67652
|
+
CHAR_PLUS: 43,
|
|
67653
|
+
/* + */
|
|
67654
|
+
CHAR_QUESTION_MARK: 63,
|
|
67655
|
+
/* ? */
|
|
67656
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
67657
|
+
/* > */
|
|
67658
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
67659
|
+
/* } */
|
|
67660
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
67661
|
+
/* ] */
|
|
67662
|
+
CHAR_SEMICOLON: 59,
|
|
67663
|
+
/* ; */
|
|
67664
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
67665
|
+
/* ' */
|
|
67666
|
+
CHAR_SPACE: 32,
|
|
67667
|
+
/* */
|
|
67668
|
+
CHAR_TAB: 9,
|
|
67669
|
+
/* \t */
|
|
67670
|
+
CHAR_UNDERSCORE: 95,
|
|
67671
|
+
/* _ */
|
|
67672
|
+
CHAR_VERTICAL_LINE: 124,
|
|
67673
|
+
/* | */
|
|
67674
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
67675
|
+
/* \uFEFF */
|
|
67676
|
+
/**
|
|
67677
|
+
* Create EXTGLOB_CHARS
|
|
67678
|
+
*/
|
|
67679
|
+
extglobChars(chars) {
|
|
67680
|
+
return {
|
|
67681
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
67682
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
67683
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
67684
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
67685
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
67686
|
+
};
|
|
67687
|
+
},
|
|
67688
|
+
/**
|
|
67689
|
+
* Create GLOB_CHARS
|
|
67690
|
+
*/
|
|
67691
|
+
globChars(win32) {
|
|
67692
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
67693
|
+
}
|
|
67694
|
+
};
|
|
67695
|
+
}
|
|
67696
|
+
});
|
|
67697
|
+
|
|
67698
|
+
// node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
|
|
67699
|
+
var require_utils = __commonJS({
|
|
67700
|
+
"node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js"(exports) {
|
|
67701
|
+
"use strict";
|
|
67702
|
+
var {
|
|
67703
|
+
REGEX_BACKSLASH,
|
|
67704
|
+
REGEX_REMOVE_BACKSLASH,
|
|
67705
|
+
REGEX_SPECIAL_CHARS,
|
|
67706
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
67707
|
+
} = require_constants();
|
|
67708
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
67709
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
67710
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
67711
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
67712
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
67713
|
+
exports.isWindows = () => {
|
|
67714
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
67715
|
+
const platform = navigator.platform.toLowerCase();
|
|
67716
|
+
return platform === "win32" || platform === "windows";
|
|
67717
|
+
}
|
|
67718
|
+
if (typeof process !== "undefined" && process.platform) {
|
|
67719
|
+
return process.platform === "win32";
|
|
67720
|
+
}
|
|
67721
|
+
return false;
|
|
67722
|
+
};
|
|
67723
|
+
exports.removeBackslashes = (str) => {
|
|
67724
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
67725
|
+
return match === "\\" ? "" : match;
|
|
67726
|
+
});
|
|
67727
|
+
};
|
|
67728
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
67729
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
67730
|
+
if (idx === -1)
|
|
67731
|
+
return input;
|
|
67732
|
+
if (input[idx - 1] === "\\")
|
|
67733
|
+
return exports.escapeLast(input, char, idx - 1);
|
|
67734
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
67735
|
+
};
|
|
67736
|
+
exports.removePrefix = (input, state2 = {}) => {
|
|
67737
|
+
let output = input;
|
|
67738
|
+
if (output.startsWith("./")) {
|
|
67739
|
+
output = output.slice(2);
|
|
67740
|
+
state2.prefix = "./";
|
|
67741
|
+
}
|
|
67742
|
+
return output;
|
|
67743
|
+
};
|
|
67744
|
+
exports.wrapOutput = (input, state2 = {}, options = {}) => {
|
|
67745
|
+
const prepend = options.contains ? "" : "^";
|
|
67746
|
+
const append = options.contains ? "" : "$";
|
|
67747
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
67748
|
+
if (state2.negated === true) {
|
|
67749
|
+
output = `(?:^(?!${output}).*$)`;
|
|
67750
|
+
}
|
|
67751
|
+
return output;
|
|
67752
|
+
};
|
|
67753
|
+
exports.basename = (path, { windows } = {}) => {
|
|
67754
|
+
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
67755
|
+
const last = segs[segs.length - 1];
|
|
67756
|
+
if (last === "") {
|
|
67757
|
+
return segs[segs.length - 2];
|
|
67758
|
+
}
|
|
67759
|
+
return last;
|
|
67760
|
+
};
|
|
67761
|
+
}
|
|
67762
|
+
});
|
|
67763
|
+
|
|
67764
|
+
// node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
|
|
67765
|
+
var require_scan = __commonJS({
|
|
67766
|
+
"node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js"(exports, module) {
|
|
67767
|
+
"use strict";
|
|
67768
|
+
var utils = require_utils();
|
|
67769
|
+
var {
|
|
67770
|
+
CHAR_ASTERISK,
|
|
67771
|
+
/* * */
|
|
67772
|
+
CHAR_AT,
|
|
67773
|
+
/* @ */
|
|
67774
|
+
CHAR_BACKWARD_SLASH,
|
|
67775
|
+
/* \ */
|
|
67776
|
+
CHAR_COMMA,
|
|
67777
|
+
/* , */
|
|
67778
|
+
CHAR_DOT,
|
|
67779
|
+
/* . */
|
|
67780
|
+
CHAR_EXCLAMATION_MARK,
|
|
67781
|
+
/* ! */
|
|
67782
|
+
CHAR_FORWARD_SLASH,
|
|
67783
|
+
/* / */
|
|
67784
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
67785
|
+
/* { */
|
|
67786
|
+
CHAR_LEFT_PARENTHESES,
|
|
67787
|
+
/* ( */
|
|
67788
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
67789
|
+
/* [ */
|
|
67790
|
+
CHAR_PLUS,
|
|
67791
|
+
/* + */
|
|
67792
|
+
CHAR_QUESTION_MARK,
|
|
67793
|
+
/* ? */
|
|
67794
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
67795
|
+
/* } */
|
|
67796
|
+
CHAR_RIGHT_PARENTHESES,
|
|
67797
|
+
/* ) */
|
|
67798
|
+
CHAR_RIGHT_SQUARE_BRACKET
|
|
67799
|
+
/* ] */
|
|
67800
|
+
} = require_constants();
|
|
67801
|
+
var isPathSeparator = (code) => {
|
|
67802
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
67803
|
+
};
|
|
67804
|
+
var depth = (token) => {
|
|
67805
|
+
if (token.isPrefix !== true) {
|
|
67806
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
67807
|
+
}
|
|
67808
|
+
};
|
|
67809
|
+
var scan = (input, options) => {
|
|
67810
|
+
const opts = options || {};
|
|
67811
|
+
const length = input.length - 1;
|
|
67812
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
67813
|
+
const slashes = [];
|
|
67814
|
+
const tokens = [];
|
|
67815
|
+
const parts = [];
|
|
67816
|
+
let str = input;
|
|
67817
|
+
let index = -1;
|
|
67818
|
+
let start = 0;
|
|
67819
|
+
let lastIndex = 0;
|
|
67820
|
+
let isBrace = false;
|
|
67821
|
+
let isBracket = false;
|
|
67822
|
+
let isGlob = false;
|
|
67823
|
+
let isExtglob = false;
|
|
67824
|
+
let isGlobstar = false;
|
|
67825
|
+
let braceEscaped = false;
|
|
67826
|
+
let backslashes = false;
|
|
67827
|
+
let negated = false;
|
|
67828
|
+
let negatedExtglob = false;
|
|
67829
|
+
let finished = false;
|
|
67830
|
+
let braces = 0;
|
|
67831
|
+
let prev;
|
|
67832
|
+
let code;
|
|
67833
|
+
let token = { value: "", depth: 0, isGlob: false };
|
|
67834
|
+
const eos = () => index >= length;
|
|
67835
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
67836
|
+
const advance2 = () => {
|
|
67837
|
+
prev = code;
|
|
67838
|
+
return str.charCodeAt(++index);
|
|
67839
|
+
};
|
|
67840
|
+
while (index < length) {
|
|
67841
|
+
code = advance2();
|
|
67842
|
+
let next;
|
|
67843
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
67844
|
+
backslashes = token.backslashes = true;
|
|
67845
|
+
code = advance2();
|
|
67846
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
67847
|
+
braceEscaped = true;
|
|
67848
|
+
}
|
|
67849
|
+
continue;
|
|
67850
|
+
}
|
|
67851
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
67852
|
+
braces++;
|
|
67853
|
+
while (eos() !== true && (code = advance2())) {
|
|
67854
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
67855
|
+
backslashes = token.backslashes = true;
|
|
67856
|
+
advance2();
|
|
67857
|
+
continue;
|
|
67858
|
+
}
|
|
67859
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
67860
|
+
braces++;
|
|
67861
|
+
continue;
|
|
67862
|
+
}
|
|
67863
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance2()) === CHAR_DOT) {
|
|
67864
|
+
isBrace = token.isBrace = true;
|
|
67865
|
+
isGlob = token.isGlob = true;
|
|
67866
|
+
finished = true;
|
|
67867
|
+
if (scanToEnd === true) {
|
|
67868
|
+
continue;
|
|
67869
|
+
}
|
|
67870
|
+
break;
|
|
67871
|
+
}
|
|
67872
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
67873
|
+
isBrace = token.isBrace = true;
|
|
67874
|
+
isGlob = token.isGlob = true;
|
|
67875
|
+
finished = true;
|
|
67876
|
+
if (scanToEnd === true) {
|
|
67877
|
+
continue;
|
|
67878
|
+
}
|
|
67879
|
+
break;
|
|
67880
|
+
}
|
|
67881
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
67882
|
+
braces--;
|
|
67883
|
+
if (braces === 0) {
|
|
67884
|
+
braceEscaped = false;
|
|
67885
|
+
isBrace = token.isBrace = true;
|
|
67886
|
+
finished = true;
|
|
67887
|
+
break;
|
|
67888
|
+
}
|
|
67889
|
+
}
|
|
67890
|
+
}
|
|
67891
|
+
if (scanToEnd === true) {
|
|
67892
|
+
continue;
|
|
67893
|
+
}
|
|
67894
|
+
break;
|
|
67895
|
+
}
|
|
67896
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
67897
|
+
slashes.push(index);
|
|
67898
|
+
tokens.push(token);
|
|
67899
|
+
token = { value: "", depth: 0, isGlob: false };
|
|
67900
|
+
if (finished === true)
|
|
67901
|
+
continue;
|
|
67902
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
67903
|
+
start += 2;
|
|
67904
|
+
continue;
|
|
67905
|
+
}
|
|
67906
|
+
lastIndex = index + 1;
|
|
67907
|
+
continue;
|
|
67908
|
+
}
|
|
67909
|
+
if (opts.noext !== true) {
|
|
67910
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
67911
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
67912
|
+
isGlob = token.isGlob = true;
|
|
67913
|
+
isExtglob = token.isExtglob = true;
|
|
67914
|
+
finished = true;
|
|
67915
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
67916
|
+
negatedExtglob = true;
|
|
67917
|
+
}
|
|
67918
|
+
if (scanToEnd === true) {
|
|
67919
|
+
while (eos() !== true && (code = advance2())) {
|
|
67920
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
67921
|
+
backslashes = token.backslashes = true;
|
|
67922
|
+
code = advance2();
|
|
67923
|
+
continue;
|
|
67924
|
+
}
|
|
67925
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
67926
|
+
isGlob = token.isGlob = true;
|
|
67927
|
+
finished = true;
|
|
67928
|
+
break;
|
|
67929
|
+
}
|
|
67930
|
+
}
|
|
67931
|
+
continue;
|
|
67932
|
+
}
|
|
67933
|
+
break;
|
|
67934
|
+
}
|
|
67935
|
+
}
|
|
67936
|
+
if (code === CHAR_ASTERISK) {
|
|
67937
|
+
if (prev === CHAR_ASTERISK)
|
|
67938
|
+
isGlobstar = token.isGlobstar = true;
|
|
67939
|
+
isGlob = token.isGlob = true;
|
|
67940
|
+
finished = true;
|
|
67941
|
+
if (scanToEnd === true) {
|
|
67942
|
+
continue;
|
|
67943
|
+
}
|
|
67944
|
+
break;
|
|
67945
|
+
}
|
|
67946
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
67947
|
+
isGlob = token.isGlob = true;
|
|
67948
|
+
finished = true;
|
|
67949
|
+
if (scanToEnd === true) {
|
|
67950
|
+
continue;
|
|
67951
|
+
}
|
|
67952
|
+
break;
|
|
67953
|
+
}
|
|
67954
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
67955
|
+
while (eos() !== true && (next = advance2())) {
|
|
67956
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
67957
|
+
backslashes = token.backslashes = true;
|
|
67958
|
+
advance2();
|
|
67959
|
+
continue;
|
|
67960
|
+
}
|
|
67961
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
67962
|
+
isBracket = token.isBracket = true;
|
|
67963
|
+
isGlob = token.isGlob = true;
|
|
67964
|
+
finished = true;
|
|
67965
|
+
break;
|
|
67966
|
+
}
|
|
67967
|
+
}
|
|
67968
|
+
if (scanToEnd === true) {
|
|
67969
|
+
continue;
|
|
67970
|
+
}
|
|
67971
|
+
break;
|
|
67972
|
+
}
|
|
67973
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
67974
|
+
negated = token.negated = true;
|
|
67975
|
+
start++;
|
|
67976
|
+
continue;
|
|
67977
|
+
}
|
|
67978
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
67979
|
+
isGlob = token.isGlob = true;
|
|
67980
|
+
if (scanToEnd === true) {
|
|
67981
|
+
while (eos() !== true && (code = advance2())) {
|
|
67982
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
67983
|
+
backslashes = token.backslashes = true;
|
|
67984
|
+
code = advance2();
|
|
67985
|
+
continue;
|
|
67986
|
+
}
|
|
67987
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
67988
|
+
finished = true;
|
|
67989
|
+
break;
|
|
67990
|
+
}
|
|
67991
|
+
}
|
|
67992
|
+
continue;
|
|
67993
|
+
}
|
|
67994
|
+
break;
|
|
67995
|
+
}
|
|
67996
|
+
if (isGlob === true) {
|
|
67997
|
+
finished = true;
|
|
67998
|
+
if (scanToEnd === true) {
|
|
67999
|
+
continue;
|
|
68000
|
+
}
|
|
68001
|
+
break;
|
|
68002
|
+
}
|
|
68003
|
+
}
|
|
68004
|
+
if (opts.noext === true) {
|
|
68005
|
+
isExtglob = false;
|
|
68006
|
+
isGlob = false;
|
|
68007
|
+
}
|
|
68008
|
+
let base = str;
|
|
68009
|
+
let prefix = "";
|
|
68010
|
+
let glob = "";
|
|
68011
|
+
if (start > 0) {
|
|
68012
|
+
prefix = str.slice(0, start);
|
|
68013
|
+
str = str.slice(start);
|
|
68014
|
+
lastIndex -= start;
|
|
68015
|
+
}
|
|
68016
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
68017
|
+
base = str.slice(0, lastIndex);
|
|
68018
|
+
glob = str.slice(lastIndex);
|
|
68019
|
+
} else if (isGlob === true) {
|
|
68020
|
+
base = "";
|
|
68021
|
+
glob = str;
|
|
68022
|
+
} else {
|
|
68023
|
+
base = str;
|
|
68024
|
+
}
|
|
68025
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
68026
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
68027
|
+
base = base.slice(0, -1);
|
|
68028
|
+
}
|
|
68029
|
+
}
|
|
68030
|
+
if (opts.unescape === true) {
|
|
68031
|
+
if (glob)
|
|
68032
|
+
glob = utils.removeBackslashes(glob);
|
|
68033
|
+
if (base && backslashes === true) {
|
|
68034
|
+
base = utils.removeBackslashes(base);
|
|
68035
|
+
}
|
|
68036
|
+
}
|
|
68037
|
+
const state2 = {
|
|
68038
|
+
prefix,
|
|
68039
|
+
input,
|
|
68040
|
+
start,
|
|
68041
|
+
base,
|
|
68042
|
+
glob,
|
|
68043
|
+
isBrace,
|
|
68044
|
+
isBracket,
|
|
68045
|
+
isGlob,
|
|
68046
|
+
isExtglob,
|
|
68047
|
+
isGlobstar,
|
|
68048
|
+
negated,
|
|
68049
|
+
negatedExtglob
|
|
68050
|
+
};
|
|
68051
|
+
if (opts.tokens === true) {
|
|
68052
|
+
state2.maxDepth = 0;
|
|
68053
|
+
if (!isPathSeparator(code)) {
|
|
68054
|
+
tokens.push(token);
|
|
68055
|
+
}
|
|
68056
|
+
state2.tokens = tokens;
|
|
68057
|
+
}
|
|
68058
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
68059
|
+
let prevIndex;
|
|
68060
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
68061
|
+
const n4 = prevIndex ? prevIndex + 1 : start;
|
|
68062
|
+
const i4 = slashes[idx];
|
|
68063
|
+
const value = input.slice(n4, i4);
|
|
68064
|
+
if (opts.tokens) {
|
|
68065
|
+
if (idx === 0 && start !== 0) {
|
|
68066
|
+
tokens[idx].isPrefix = true;
|
|
68067
|
+
tokens[idx].value = prefix;
|
|
68068
|
+
} else {
|
|
68069
|
+
tokens[idx].value = value;
|
|
68070
|
+
}
|
|
68071
|
+
depth(tokens[idx]);
|
|
68072
|
+
state2.maxDepth += tokens[idx].depth;
|
|
68073
|
+
}
|
|
68074
|
+
if (idx !== 0 || value !== "") {
|
|
68075
|
+
parts.push(value);
|
|
68076
|
+
}
|
|
68077
|
+
prevIndex = i4;
|
|
68078
|
+
}
|
|
68079
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
68080
|
+
const value = input.slice(prevIndex + 1);
|
|
68081
|
+
parts.push(value);
|
|
68082
|
+
if (opts.tokens) {
|
|
68083
|
+
tokens[tokens.length - 1].value = value;
|
|
68084
|
+
depth(tokens[tokens.length - 1]);
|
|
68085
|
+
state2.maxDepth += tokens[tokens.length - 1].depth;
|
|
68086
|
+
}
|
|
68087
|
+
}
|
|
68088
|
+
state2.slashes = slashes;
|
|
68089
|
+
state2.parts = parts;
|
|
68090
|
+
}
|
|
68091
|
+
return state2;
|
|
68092
|
+
};
|
|
68093
|
+
module.exports = scan;
|
|
68094
|
+
}
|
|
68095
|
+
});
|
|
68096
|
+
|
|
68097
|
+
// node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
|
|
68098
|
+
var require_parse = __commonJS({
|
|
68099
|
+
"node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
68100
|
+
"use strict";
|
|
68101
|
+
var constants = require_constants();
|
|
68102
|
+
var utils = require_utils();
|
|
68103
|
+
var {
|
|
68104
|
+
MAX_LENGTH,
|
|
68105
|
+
POSIX_REGEX_SOURCE,
|
|
68106
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
68107
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
68108
|
+
REPLACEMENTS
|
|
68109
|
+
} = constants;
|
|
68110
|
+
var expandRange = (args, options) => {
|
|
68111
|
+
if (typeof options.expandRange === "function") {
|
|
68112
|
+
return options.expandRange(...args, options);
|
|
68113
|
+
}
|
|
68114
|
+
args.sort();
|
|
68115
|
+
const value = `[${args.join("-")}]`;
|
|
68116
|
+
try {
|
|
68117
|
+
new RegExp(value);
|
|
68118
|
+
} catch (ex) {
|
|
68119
|
+
return args.map((v4) => utils.escapeRegex(v4)).join("..");
|
|
68120
|
+
}
|
|
68121
|
+
return value;
|
|
68122
|
+
};
|
|
68123
|
+
var syntaxError = (type, char) => {
|
|
68124
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
68125
|
+
};
|
|
68126
|
+
var parse6 = (input, options) => {
|
|
68127
|
+
if (typeof input !== "string") {
|
|
68128
|
+
throw new TypeError("Expected a string");
|
|
68129
|
+
}
|
|
68130
|
+
input = REPLACEMENTS[input] || input;
|
|
68131
|
+
const opts = { ...options };
|
|
68132
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
68133
|
+
let len = input.length;
|
|
68134
|
+
if (len > max) {
|
|
68135
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
68136
|
+
}
|
|
68137
|
+
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
68138
|
+
const tokens = [bos];
|
|
68139
|
+
const capture = opts.capture ? "" : "?:";
|
|
68140
|
+
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
68141
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
68142
|
+
const {
|
|
68143
|
+
DOT_LITERAL,
|
|
68144
|
+
PLUS_LITERAL,
|
|
68145
|
+
SLASH_LITERAL,
|
|
68146
|
+
ONE_CHAR,
|
|
68147
|
+
DOTS_SLASH,
|
|
68148
|
+
NO_DOT,
|
|
68149
|
+
NO_DOT_SLASH,
|
|
68150
|
+
NO_DOTS_SLASH,
|
|
68151
|
+
QMARK,
|
|
68152
|
+
QMARK_NO_DOT,
|
|
68153
|
+
STAR,
|
|
68154
|
+
START_ANCHOR
|
|
68155
|
+
} = PLATFORM_CHARS;
|
|
68156
|
+
const globstar = (opts2) => {
|
|
68157
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
68158
|
+
};
|
|
68159
|
+
const nodot = opts.dot ? "" : NO_DOT;
|
|
68160
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
68161
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
68162
|
+
if (opts.capture) {
|
|
68163
|
+
star = `(${star})`;
|
|
68164
|
+
}
|
|
68165
|
+
if (typeof opts.noext === "boolean") {
|
|
68166
|
+
opts.noextglob = opts.noext;
|
|
68167
|
+
}
|
|
68168
|
+
const state2 = {
|
|
68169
|
+
input,
|
|
68170
|
+
index: -1,
|
|
68171
|
+
start: 0,
|
|
68172
|
+
dot: opts.dot === true,
|
|
68173
|
+
consumed: "",
|
|
68174
|
+
output: "",
|
|
68175
|
+
prefix: "",
|
|
68176
|
+
backtrack: false,
|
|
68177
|
+
negated: false,
|
|
68178
|
+
brackets: 0,
|
|
68179
|
+
braces: 0,
|
|
68180
|
+
parens: 0,
|
|
68181
|
+
quotes: 0,
|
|
68182
|
+
globstar: false,
|
|
68183
|
+
tokens
|
|
68184
|
+
};
|
|
68185
|
+
input = utils.removePrefix(input, state2);
|
|
68186
|
+
len = input.length;
|
|
68187
|
+
const extglobs = [];
|
|
68188
|
+
const braces = [];
|
|
68189
|
+
const stack = [];
|
|
68190
|
+
let prev = bos;
|
|
68191
|
+
let value;
|
|
68192
|
+
const eos = () => state2.index === len - 1;
|
|
68193
|
+
const peek = state2.peek = (n4 = 1) => input[state2.index + n4];
|
|
68194
|
+
const advance2 = state2.advance = () => input[++state2.index] || "";
|
|
68195
|
+
const remaining = () => input.slice(state2.index + 1);
|
|
68196
|
+
const consume = (value2 = "", num = 0) => {
|
|
68197
|
+
state2.consumed += value2;
|
|
68198
|
+
state2.index += num;
|
|
68199
|
+
};
|
|
68200
|
+
const append = (token) => {
|
|
68201
|
+
state2.output += token.output != null ? token.output : token.value;
|
|
68202
|
+
consume(token.value);
|
|
68203
|
+
};
|
|
68204
|
+
const negate = () => {
|
|
68205
|
+
let count = 1;
|
|
68206
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
68207
|
+
advance2();
|
|
68208
|
+
state2.start++;
|
|
68209
|
+
count++;
|
|
68210
|
+
}
|
|
68211
|
+
if (count % 2 === 0) {
|
|
68212
|
+
return false;
|
|
68213
|
+
}
|
|
68214
|
+
state2.negated = true;
|
|
68215
|
+
state2.start++;
|
|
68216
|
+
return true;
|
|
68217
|
+
};
|
|
68218
|
+
const increment = (type) => {
|
|
68219
|
+
state2[type]++;
|
|
68220
|
+
stack.push(type);
|
|
68221
|
+
};
|
|
68222
|
+
const decrement = (type) => {
|
|
68223
|
+
state2[type]--;
|
|
68224
|
+
stack.pop();
|
|
68225
|
+
};
|
|
68226
|
+
const push = (tok) => {
|
|
68227
|
+
if (prev.type === "globstar") {
|
|
68228
|
+
const isBrace = state2.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
68229
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
68230
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
68231
|
+
state2.output = state2.output.slice(0, -prev.output.length);
|
|
68232
|
+
prev.type = "star";
|
|
68233
|
+
prev.value = "*";
|
|
68234
|
+
prev.output = star;
|
|
68235
|
+
state2.output += prev.output;
|
|
68236
|
+
}
|
|
68237
|
+
}
|
|
68238
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
68239
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
68240
|
+
}
|
|
68241
|
+
if (tok.value || tok.output)
|
|
68242
|
+
append(tok);
|
|
68243
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
68244
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
68245
|
+
prev.value += tok.value;
|
|
68246
|
+
return;
|
|
68247
|
+
}
|
|
68248
|
+
tok.prev = prev;
|
|
68249
|
+
tokens.push(tok);
|
|
68250
|
+
prev = tok;
|
|
68251
|
+
};
|
|
68252
|
+
const extglobOpen = (type, value2) => {
|
|
68253
|
+
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
|
68254
|
+
token.prev = prev;
|
|
68255
|
+
token.parens = state2.parens;
|
|
68256
|
+
token.output = state2.output;
|
|
68257
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
68258
|
+
increment("parens");
|
|
68259
|
+
push({ type, value: value2, output: state2.output ? "" : ONE_CHAR });
|
|
68260
|
+
push({ type: "paren", extglob: true, value: advance2(), output });
|
|
68261
|
+
extglobs.push(token);
|
|
68262
|
+
};
|
|
68263
|
+
const extglobClose = (token) => {
|
|
68264
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
68265
|
+
let rest;
|
|
68266
|
+
if (token.type === "negate") {
|
|
68267
|
+
let extglobStar = star;
|
|
68268
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
68269
|
+
extglobStar = globstar(opts);
|
|
68270
|
+
}
|
|
68271
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
68272
|
+
output = token.close = `)$))${extglobStar}`;
|
|
68273
|
+
}
|
|
68274
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
68275
|
+
const expression = parse6(rest, { ...options, fastpaths: false }).output;
|
|
68276
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
68277
|
+
}
|
|
68278
|
+
if (token.prev.type === "bos") {
|
|
68279
|
+
state2.negatedExtglob = true;
|
|
68280
|
+
}
|
|
68281
|
+
}
|
|
68282
|
+
push({ type: "paren", extglob: true, value, output });
|
|
68283
|
+
decrement("parens");
|
|
68284
|
+
};
|
|
68285
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
68286
|
+
let backslashes = false;
|
|
68287
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m4, esc, chars, first, rest, index) => {
|
|
68288
|
+
if (first === "\\") {
|
|
68289
|
+
backslashes = true;
|
|
68290
|
+
return m4;
|
|
68291
|
+
}
|
|
68292
|
+
if (first === "?") {
|
|
68293
|
+
if (esc) {
|
|
68294
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
68295
|
+
}
|
|
68296
|
+
if (index === 0) {
|
|
68297
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
68298
|
+
}
|
|
68299
|
+
return QMARK.repeat(chars.length);
|
|
68300
|
+
}
|
|
68301
|
+
if (first === ".") {
|
|
68302
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
68303
|
+
}
|
|
68304
|
+
if (first === "*") {
|
|
68305
|
+
if (esc) {
|
|
68306
|
+
return esc + first + (rest ? star : "");
|
|
68307
|
+
}
|
|
68308
|
+
return star;
|
|
68309
|
+
}
|
|
68310
|
+
return esc ? m4 : `\\${m4}`;
|
|
68311
|
+
});
|
|
68312
|
+
if (backslashes === true) {
|
|
68313
|
+
if (opts.unescape === true) {
|
|
68314
|
+
output = output.replace(/\\/g, "");
|
|
68315
|
+
} else {
|
|
68316
|
+
output = output.replace(/\\+/g, (m4) => {
|
|
68317
|
+
return m4.length % 2 === 0 ? "\\\\" : m4 ? "\\" : "";
|
|
68318
|
+
});
|
|
68319
|
+
}
|
|
68320
|
+
}
|
|
68321
|
+
if (output === input && opts.contains === true) {
|
|
68322
|
+
state2.output = input;
|
|
68323
|
+
return state2;
|
|
68324
|
+
}
|
|
68325
|
+
state2.output = utils.wrapOutput(output, state2, options);
|
|
68326
|
+
return state2;
|
|
68327
|
+
}
|
|
68328
|
+
while (!eos()) {
|
|
68329
|
+
value = advance2();
|
|
68330
|
+
if (value === "\0") {
|
|
68331
|
+
continue;
|
|
68332
|
+
}
|
|
68333
|
+
if (value === "\\") {
|
|
68334
|
+
const next = peek();
|
|
68335
|
+
if (next === "/" && opts.bash !== true) {
|
|
68336
|
+
continue;
|
|
68337
|
+
}
|
|
68338
|
+
if (next === "." || next === ";") {
|
|
68339
|
+
continue;
|
|
68340
|
+
}
|
|
68341
|
+
if (!next) {
|
|
68342
|
+
value += "\\";
|
|
68343
|
+
push({ type: "text", value });
|
|
68344
|
+
continue;
|
|
68345
|
+
}
|
|
68346
|
+
const match = /^\\+/.exec(remaining());
|
|
68347
|
+
let slashes = 0;
|
|
68348
|
+
if (match && match[0].length > 2) {
|
|
68349
|
+
slashes = match[0].length;
|
|
68350
|
+
state2.index += slashes;
|
|
68351
|
+
if (slashes % 2 !== 0) {
|
|
68352
|
+
value += "\\";
|
|
68353
|
+
}
|
|
68354
|
+
}
|
|
68355
|
+
if (opts.unescape === true) {
|
|
68356
|
+
value = advance2();
|
|
68357
|
+
} else {
|
|
68358
|
+
value += advance2();
|
|
68359
|
+
}
|
|
68360
|
+
if (state2.brackets === 0) {
|
|
68361
|
+
push({ type: "text", value });
|
|
68362
|
+
continue;
|
|
68363
|
+
}
|
|
68364
|
+
}
|
|
68365
|
+
if (state2.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
68366
|
+
if (opts.posix !== false && value === ":") {
|
|
68367
|
+
const inner = prev.value.slice(1);
|
|
68368
|
+
if (inner.includes("[")) {
|
|
68369
|
+
prev.posix = true;
|
|
68370
|
+
if (inner.includes(":")) {
|
|
68371
|
+
const idx = prev.value.lastIndexOf("[");
|
|
68372
|
+
const pre = prev.value.slice(0, idx);
|
|
68373
|
+
const rest2 = prev.value.slice(idx + 2);
|
|
68374
|
+
const posix = POSIX_REGEX_SOURCE[rest2];
|
|
68375
|
+
if (posix) {
|
|
68376
|
+
prev.value = pre + posix;
|
|
68377
|
+
state2.backtrack = true;
|
|
68378
|
+
advance2();
|
|
68379
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
68380
|
+
bos.output = ONE_CHAR;
|
|
68381
|
+
}
|
|
68382
|
+
continue;
|
|
68383
|
+
}
|
|
68384
|
+
}
|
|
68385
|
+
}
|
|
68386
|
+
}
|
|
68387
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
68388
|
+
value = `\\${value}`;
|
|
68389
|
+
}
|
|
68390
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
68391
|
+
value = `\\${value}`;
|
|
68392
|
+
}
|
|
68393
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
68394
|
+
value = "^";
|
|
68395
|
+
}
|
|
68396
|
+
prev.value += value;
|
|
68397
|
+
append({ value });
|
|
68398
|
+
continue;
|
|
68399
|
+
}
|
|
68400
|
+
if (state2.quotes === 1 && value !== '"') {
|
|
68401
|
+
value = utils.escapeRegex(value);
|
|
68402
|
+
prev.value += value;
|
|
68403
|
+
append({ value });
|
|
68404
|
+
continue;
|
|
68405
|
+
}
|
|
68406
|
+
if (value === '"') {
|
|
68407
|
+
state2.quotes = state2.quotes === 1 ? 0 : 1;
|
|
68408
|
+
if (opts.keepQuotes === true) {
|
|
68409
|
+
push({ type: "text", value });
|
|
68410
|
+
}
|
|
68411
|
+
continue;
|
|
68412
|
+
}
|
|
68413
|
+
if (value === "(") {
|
|
68414
|
+
increment("parens");
|
|
68415
|
+
push({ type: "paren", value });
|
|
68416
|
+
continue;
|
|
68417
|
+
}
|
|
68418
|
+
if (value === ")") {
|
|
68419
|
+
if (state2.parens === 0 && opts.strictBrackets === true) {
|
|
68420
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
68421
|
+
}
|
|
68422
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
68423
|
+
if (extglob && state2.parens === extglob.parens + 1) {
|
|
68424
|
+
extglobClose(extglobs.pop());
|
|
68425
|
+
continue;
|
|
68426
|
+
}
|
|
68427
|
+
push({ type: "paren", value, output: state2.parens ? ")" : "\\)" });
|
|
68428
|
+
decrement("parens");
|
|
68429
|
+
continue;
|
|
68430
|
+
}
|
|
68431
|
+
if (value === "[") {
|
|
68432
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
68433
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
68434
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
68435
|
+
}
|
|
68436
|
+
value = `\\${value}`;
|
|
68437
|
+
} else {
|
|
68438
|
+
increment("brackets");
|
|
68439
|
+
}
|
|
68440
|
+
push({ type: "bracket", value });
|
|
68441
|
+
continue;
|
|
68442
|
+
}
|
|
68443
|
+
if (value === "]") {
|
|
68444
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
68445
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
68446
|
+
continue;
|
|
68447
|
+
}
|
|
68448
|
+
if (state2.brackets === 0) {
|
|
68449
|
+
if (opts.strictBrackets === true) {
|
|
68450
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
68451
|
+
}
|
|
68452
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
68453
|
+
continue;
|
|
68454
|
+
}
|
|
68455
|
+
decrement("brackets");
|
|
68456
|
+
const prevValue = prev.value.slice(1);
|
|
68457
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
68458
|
+
value = `/${value}`;
|
|
68459
|
+
}
|
|
68460
|
+
prev.value += value;
|
|
68461
|
+
append({ value });
|
|
68462
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
68463
|
+
continue;
|
|
68464
|
+
}
|
|
68465
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
68466
|
+
state2.output = state2.output.slice(0, -prev.value.length);
|
|
68467
|
+
if (opts.literalBrackets === true) {
|
|
68468
|
+
state2.output += escaped;
|
|
68469
|
+
prev.value = escaped;
|
|
68470
|
+
continue;
|
|
68471
|
+
}
|
|
68472
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
68473
|
+
state2.output += prev.value;
|
|
68474
|
+
continue;
|
|
68475
|
+
}
|
|
68476
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
68477
|
+
increment("braces");
|
|
68478
|
+
const open = {
|
|
68479
|
+
type: "brace",
|
|
68480
|
+
value,
|
|
68481
|
+
output: "(",
|
|
68482
|
+
outputIndex: state2.output.length,
|
|
68483
|
+
tokensIndex: state2.tokens.length
|
|
68484
|
+
};
|
|
68485
|
+
braces.push(open);
|
|
68486
|
+
push(open);
|
|
68487
|
+
continue;
|
|
68488
|
+
}
|
|
68489
|
+
if (value === "}") {
|
|
68490
|
+
const brace = braces[braces.length - 1];
|
|
68491
|
+
if (opts.nobrace === true || !brace) {
|
|
68492
|
+
push({ type: "text", value, output: value });
|
|
68493
|
+
continue;
|
|
68494
|
+
}
|
|
68495
|
+
let output = ")";
|
|
68496
|
+
if (brace.dots === true) {
|
|
68497
|
+
const arr = tokens.slice();
|
|
68498
|
+
const range2 = [];
|
|
68499
|
+
for (let i4 = arr.length - 1; i4 >= 0; i4--) {
|
|
68500
|
+
tokens.pop();
|
|
68501
|
+
if (arr[i4].type === "brace") {
|
|
68502
|
+
break;
|
|
68503
|
+
}
|
|
68504
|
+
if (arr[i4].type !== "dots") {
|
|
68505
|
+
range2.unshift(arr[i4].value);
|
|
68506
|
+
}
|
|
68507
|
+
}
|
|
68508
|
+
output = expandRange(range2, opts);
|
|
68509
|
+
state2.backtrack = true;
|
|
68510
|
+
}
|
|
68511
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
68512
|
+
const out = state2.output.slice(0, brace.outputIndex);
|
|
68513
|
+
const toks = state2.tokens.slice(brace.tokensIndex);
|
|
68514
|
+
brace.value = brace.output = "\\{";
|
|
68515
|
+
value = output = "\\}";
|
|
68516
|
+
state2.output = out;
|
|
68517
|
+
for (const t4 of toks) {
|
|
68518
|
+
state2.output += t4.output || t4.value;
|
|
68519
|
+
}
|
|
68520
|
+
}
|
|
68521
|
+
push({ type: "brace", value, output });
|
|
68522
|
+
decrement("braces");
|
|
68523
|
+
braces.pop();
|
|
68524
|
+
continue;
|
|
68525
|
+
}
|
|
68526
|
+
if (value === "|") {
|
|
68527
|
+
if (extglobs.length > 0) {
|
|
68528
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
68529
|
+
}
|
|
68530
|
+
push({ type: "text", value });
|
|
68531
|
+
continue;
|
|
68532
|
+
}
|
|
68533
|
+
if (value === ",") {
|
|
68534
|
+
let output = value;
|
|
68535
|
+
const brace = braces[braces.length - 1];
|
|
68536
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
68537
|
+
brace.comma = true;
|
|
68538
|
+
output = "|";
|
|
68539
|
+
}
|
|
68540
|
+
push({ type: "comma", value, output });
|
|
68541
|
+
continue;
|
|
68542
|
+
}
|
|
68543
|
+
if (value === "/") {
|
|
68544
|
+
if (prev.type === "dot" && state2.index === state2.start + 1) {
|
|
68545
|
+
state2.start = state2.index + 1;
|
|
68546
|
+
state2.consumed = "";
|
|
68547
|
+
state2.output = "";
|
|
68548
|
+
tokens.pop();
|
|
68549
|
+
prev = bos;
|
|
68550
|
+
continue;
|
|
68551
|
+
}
|
|
68552
|
+
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
68553
|
+
continue;
|
|
68554
|
+
}
|
|
68555
|
+
if (value === ".") {
|
|
68556
|
+
if (state2.braces > 0 && prev.type === "dot") {
|
|
68557
|
+
if (prev.value === ".")
|
|
68558
|
+
prev.output = DOT_LITERAL;
|
|
68559
|
+
const brace = braces[braces.length - 1];
|
|
68560
|
+
prev.type = "dots";
|
|
68561
|
+
prev.output += value;
|
|
68562
|
+
prev.value += value;
|
|
68563
|
+
brace.dots = true;
|
|
68564
|
+
continue;
|
|
68565
|
+
}
|
|
68566
|
+
if (state2.braces + state2.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
68567
|
+
push({ type: "text", value, output: DOT_LITERAL });
|
|
68568
|
+
continue;
|
|
68569
|
+
}
|
|
68570
|
+
push({ type: "dot", value, output: DOT_LITERAL });
|
|
68571
|
+
continue;
|
|
68572
|
+
}
|
|
68573
|
+
if (value === "?") {
|
|
68574
|
+
const isGroup = prev && prev.value === "(";
|
|
68575
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
68576
|
+
extglobOpen("qmark", value);
|
|
68577
|
+
continue;
|
|
68578
|
+
}
|
|
68579
|
+
if (prev && prev.type === "paren") {
|
|
68580
|
+
const next = peek();
|
|
68581
|
+
let output = value;
|
|
68582
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
68583
|
+
output = `\\${value}`;
|
|
68584
|
+
}
|
|
68585
|
+
push({ type: "text", value, output });
|
|
68586
|
+
continue;
|
|
68587
|
+
}
|
|
68588
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
68589
|
+
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
68590
|
+
continue;
|
|
68591
|
+
}
|
|
68592
|
+
push({ type: "qmark", value, output: QMARK });
|
|
68593
|
+
continue;
|
|
68594
|
+
}
|
|
68595
|
+
if (value === "!") {
|
|
68596
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
68597
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
68598
|
+
extglobOpen("negate", value);
|
|
68599
|
+
continue;
|
|
68600
|
+
}
|
|
68601
|
+
}
|
|
68602
|
+
if (opts.nonegate !== true && state2.index === 0) {
|
|
68603
|
+
negate();
|
|
68604
|
+
continue;
|
|
68605
|
+
}
|
|
68606
|
+
}
|
|
68607
|
+
if (value === "+") {
|
|
68608
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
68609
|
+
extglobOpen("plus", value);
|
|
68610
|
+
continue;
|
|
68611
|
+
}
|
|
68612
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
68613
|
+
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
68614
|
+
continue;
|
|
68615
|
+
}
|
|
68616
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state2.parens > 0) {
|
|
68617
|
+
push({ type: "plus", value });
|
|
68618
|
+
continue;
|
|
68619
|
+
}
|
|
68620
|
+
push({ type: "plus", value: PLUS_LITERAL });
|
|
68621
|
+
continue;
|
|
68622
|
+
}
|
|
68623
|
+
if (value === "@") {
|
|
68624
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
68625
|
+
push({ type: "at", extglob: true, value, output: "" });
|
|
68626
|
+
continue;
|
|
68627
|
+
}
|
|
68628
|
+
push({ type: "text", value });
|
|
68629
|
+
continue;
|
|
68630
|
+
}
|
|
68631
|
+
if (value !== "*") {
|
|
68632
|
+
if (value === "$" || value === "^") {
|
|
68633
|
+
value = `\\${value}`;
|
|
68634
|
+
}
|
|
68635
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
68636
|
+
if (match) {
|
|
68637
|
+
value += match[0];
|
|
68638
|
+
state2.index += match[0].length;
|
|
68639
|
+
}
|
|
68640
|
+
push({ type: "text", value });
|
|
68641
|
+
continue;
|
|
68642
|
+
}
|
|
68643
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
68644
|
+
prev.type = "star";
|
|
68645
|
+
prev.star = true;
|
|
68646
|
+
prev.value += value;
|
|
68647
|
+
prev.output = star;
|
|
68648
|
+
state2.backtrack = true;
|
|
68649
|
+
state2.globstar = true;
|
|
68650
|
+
consume(value);
|
|
68651
|
+
continue;
|
|
68652
|
+
}
|
|
68653
|
+
let rest = remaining();
|
|
68654
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
68655
|
+
extglobOpen("star", value);
|
|
68656
|
+
continue;
|
|
68657
|
+
}
|
|
68658
|
+
if (prev.type === "star") {
|
|
68659
|
+
if (opts.noglobstar === true) {
|
|
68660
|
+
consume(value);
|
|
68661
|
+
continue;
|
|
68662
|
+
}
|
|
68663
|
+
const prior = prev.prev;
|
|
68664
|
+
const before = prior.prev;
|
|
68665
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
68666
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
68667
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
68668
|
+
push({ type: "star", value, output: "" });
|
|
68669
|
+
continue;
|
|
68670
|
+
}
|
|
68671
|
+
const isBrace = state2.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
68672
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
68673
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
68674
|
+
push({ type: "star", value, output: "" });
|
|
68675
|
+
continue;
|
|
68676
|
+
}
|
|
68677
|
+
while (rest.slice(0, 3) === "/**") {
|
|
68678
|
+
const after = input[state2.index + 4];
|
|
68679
|
+
if (after && after !== "/") {
|
|
68680
|
+
break;
|
|
68681
|
+
}
|
|
68682
|
+
rest = rest.slice(3);
|
|
68683
|
+
consume("/**", 3);
|
|
68684
|
+
}
|
|
68685
|
+
if (prior.type === "bos" && eos()) {
|
|
68686
|
+
prev.type = "globstar";
|
|
68687
|
+
prev.value += value;
|
|
68688
|
+
prev.output = globstar(opts);
|
|
68689
|
+
state2.output = prev.output;
|
|
68690
|
+
state2.globstar = true;
|
|
68691
|
+
consume(value);
|
|
68692
|
+
continue;
|
|
68693
|
+
}
|
|
68694
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
68695
|
+
state2.output = state2.output.slice(0, -(prior.output + prev.output).length);
|
|
68696
|
+
prior.output = `(?:${prior.output}`;
|
|
68697
|
+
prev.type = "globstar";
|
|
68698
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
68699
|
+
prev.value += value;
|
|
68700
|
+
state2.globstar = true;
|
|
68701
|
+
state2.output += prior.output + prev.output;
|
|
68702
|
+
consume(value);
|
|
68703
|
+
continue;
|
|
68704
|
+
}
|
|
68705
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
68706
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
68707
|
+
state2.output = state2.output.slice(0, -(prior.output + prev.output).length);
|
|
68708
|
+
prior.output = `(?:${prior.output}`;
|
|
68709
|
+
prev.type = "globstar";
|
|
68710
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
68711
|
+
prev.value += value;
|
|
68712
|
+
state2.output += prior.output + prev.output;
|
|
68713
|
+
state2.globstar = true;
|
|
68714
|
+
consume(value + advance2());
|
|
68715
|
+
push({ type: "slash", value: "/", output: "" });
|
|
68716
|
+
continue;
|
|
68717
|
+
}
|
|
68718
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
68719
|
+
prev.type = "globstar";
|
|
68720
|
+
prev.value += value;
|
|
68721
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
68722
|
+
state2.output = prev.output;
|
|
68723
|
+
state2.globstar = true;
|
|
68724
|
+
consume(value + advance2());
|
|
68725
|
+
push({ type: "slash", value: "/", output: "" });
|
|
68726
|
+
continue;
|
|
68727
|
+
}
|
|
68728
|
+
state2.output = state2.output.slice(0, -prev.output.length);
|
|
68729
|
+
prev.type = "globstar";
|
|
68730
|
+
prev.output = globstar(opts);
|
|
68731
|
+
prev.value += value;
|
|
68732
|
+
state2.output += prev.output;
|
|
68733
|
+
state2.globstar = true;
|
|
68734
|
+
consume(value);
|
|
68735
|
+
continue;
|
|
68736
|
+
}
|
|
68737
|
+
const token = { type: "star", value, output: star };
|
|
68738
|
+
if (opts.bash === true) {
|
|
68739
|
+
token.output = ".*?";
|
|
68740
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
68741
|
+
token.output = nodot + token.output;
|
|
68742
|
+
}
|
|
68743
|
+
push(token);
|
|
68744
|
+
continue;
|
|
68745
|
+
}
|
|
68746
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
68747
|
+
token.output = value;
|
|
68748
|
+
push(token);
|
|
68749
|
+
continue;
|
|
68750
|
+
}
|
|
68751
|
+
if (state2.index === state2.start || prev.type === "slash" || prev.type === "dot") {
|
|
68752
|
+
if (prev.type === "dot") {
|
|
68753
|
+
state2.output += NO_DOT_SLASH;
|
|
68754
|
+
prev.output += NO_DOT_SLASH;
|
|
68755
|
+
} else if (opts.dot === true) {
|
|
68756
|
+
state2.output += NO_DOTS_SLASH;
|
|
68757
|
+
prev.output += NO_DOTS_SLASH;
|
|
68758
|
+
} else {
|
|
68759
|
+
state2.output += nodot;
|
|
68760
|
+
prev.output += nodot;
|
|
68761
|
+
}
|
|
68762
|
+
if (peek() !== "*") {
|
|
68763
|
+
state2.output += ONE_CHAR;
|
|
68764
|
+
prev.output += ONE_CHAR;
|
|
68765
|
+
}
|
|
68766
|
+
}
|
|
68767
|
+
push(token);
|
|
68768
|
+
}
|
|
68769
|
+
while (state2.brackets > 0) {
|
|
68770
|
+
if (opts.strictBrackets === true)
|
|
68771
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
68772
|
+
state2.output = utils.escapeLast(state2.output, "[");
|
|
68773
|
+
decrement("brackets");
|
|
68774
|
+
}
|
|
68775
|
+
while (state2.parens > 0) {
|
|
68776
|
+
if (opts.strictBrackets === true)
|
|
68777
|
+
throw new SyntaxError(syntaxError("closing", ")"));
|
|
68778
|
+
state2.output = utils.escapeLast(state2.output, "(");
|
|
68779
|
+
decrement("parens");
|
|
68780
|
+
}
|
|
68781
|
+
while (state2.braces > 0) {
|
|
68782
|
+
if (opts.strictBrackets === true)
|
|
68783
|
+
throw new SyntaxError(syntaxError("closing", "}"));
|
|
68784
|
+
state2.output = utils.escapeLast(state2.output, "{");
|
|
68785
|
+
decrement("braces");
|
|
68786
|
+
}
|
|
68787
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
68788
|
+
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
68789
|
+
}
|
|
68790
|
+
if (state2.backtrack === true) {
|
|
68791
|
+
state2.output = "";
|
|
68792
|
+
for (const token of state2.tokens) {
|
|
68793
|
+
state2.output += token.output != null ? token.output : token.value;
|
|
68794
|
+
if (token.suffix) {
|
|
68795
|
+
state2.output += token.suffix;
|
|
68796
|
+
}
|
|
68797
|
+
}
|
|
68798
|
+
}
|
|
68799
|
+
return state2;
|
|
68800
|
+
};
|
|
68801
|
+
parse6.fastpaths = (input, options) => {
|
|
68802
|
+
const opts = { ...options };
|
|
68803
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
68804
|
+
const len = input.length;
|
|
68805
|
+
if (len > max) {
|
|
68806
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
68807
|
+
}
|
|
68808
|
+
input = REPLACEMENTS[input] || input;
|
|
68809
|
+
const {
|
|
68810
|
+
DOT_LITERAL,
|
|
68811
|
+
SLASH_LITERAL,
|
|
68812
|
+
ONE_CHAR,
|
|
68813
|
+
DOTS_SLASH,
|
|
68814
|
+
NO_DOT,
|
|
68815
|
+
NO_DOTS,
|
|
68816
|
+
NO_DOTS_SLASH,
|
|
68817
|
+
STAR,
|
|
68818
|
+
START_ANCHOR
|
|
68819
|
+
} = constants.globChars(opts.windows);
|
|
68820
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
68821
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
68822
|
+
const capture = opts.capture ? "" : "?:";
|
|
68823
|
+
const state2 = { negated: false, prefix: "" };
|
|
68824
|
+
let star = opts.bash === true ? ".*?" : STAR;
|
|
68825
|
+
if (opts.capture) {
|
|
68826
|
+
star = `(${star})`;
|
|
68827
|
+
}
|
|
68828
|
+
const globstar = (opts2) => {
|
|
68829
|
+
if (opts2.noglobstar === true)
|
|
68830
|
+
return star;
|
|
68831
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
68832
|
+
};
|
|
68833
|
+
const create = (str) => {
|
|
68834
|
+
switch (str) {
|
|
68835
|
+
case "*":
|
|
68836
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
68837
|
+
case ".*":
|
|
68838
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
68839
|
+
case "*.*":
|
|
68840
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
68841
|
+
case "*/*":
|
|
68842
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
68843
|
+
case "**":
|
|
68844
|
+
return nodot + globstar(opts);
|
|
68845
|
+
case "**/*":
|
|
68846
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
68847
|
+
case "**/*.*":
|
|
68848
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
68849
|
+
case "**/.*":
|
|
68850
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
68851
|
+
default: {
|
|
68852
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
68853
|
+
if (!match)
|
|
68854
|
+
return;
|
|
68855
|
+
const source2 = create(match[1]);
|
|
68856
|
+
if (!source2)
|
|
68857
|
+
return;
|
|
68858
|
+
return source2 + DOT_LITERAL + match[2];
|
|
68859
|
+
}
|
|
68860
|
+
}
|
|
68861
|
+
};
|
|
68862
|
+
const output = utils.removePrefix(input, state2);
|
|
68863
|
+
let source = create(output);
|
|
68864
|
+
if (source && opts.strictSlashes !== true) {
|
|
68865
|
+
source += `${SLASH_LITERAL}?`;
|
|
68866
|
+
}
|
|
68867
|
+
return source;
|
|
68868
|
+
};
|
|
68869
|
+
module.exports = parse6;
|
|
68870
|
+
}
|
|
68871
|
+
});
|
|
68872
|
+
|
|
68873
|
+
// node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
|
|
68874
|
+
var require_picomatch = __commonJS({
|
|
68875
|
+
"node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
68876
|
+
"use strict";
|
|
68877
|
+
var scan = require_scan();
|
|
68878
|
+
var parse6 = require_parse();
|
|
68879
|
+
var utils = require_utils();
|
|
68880
|
+
var constants = require_constants();
|
|
68881
|
+
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
68882
|
+
var picomatch2 = (glob, options, returnState = false) => {
|
|
68883
|
+
if (Array.isArray(glob)) {
|
|
68884
|
+
const fns = glob.map((input) => picomatch2(input, options, returnState));
|
|
68885
|
+
const arrayMatcher = (str) => {
|
|
68886
|
+
for (const isMatch of fns) {
|
|
68887
|
+
const state3 = isMatch(str);
|
|
68888
|
+
if (state3)
|
|
68889
|
+
return state3;
|
|
68890
|
+
}
|
|
68891
|
+
return false;
|
|
68892
|
+
};
|
|
68893
|
+
return arrayMatcher;
|
|
68894
|
+
}
|
|
68895
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
68896
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
68897
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
68898
|
+
}
|
|
68899
|
+
const opts = options || {};
|
|
68900
|
+
const posix = opts.windows;
|
|
68901
|
+
const regex = isState ? picomatch2.compileRe(glob, options) : picomatch2.makeRe(glob, options, false, true);
|
|
68902
|
+
const state2 = regex.state;
|
|
68903
|
+
delete regex.state;
|
|
68904
|
+
let isIgnored = () => false;
|
|
68905
|
+
if (opts.ignore) {
|
|
68906
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
68907
|
+
isIgnored = picomatch2(opts.ignore, ignoreOpts, returnState);
|
|
68908
|
+
}
|
|
68909
|
+
const matcher = (input, returnObject = false) => {
|
|
68910
|
+
const { isMatch, match, output } = picomatch2.test(input, regex, options, { glob, posix });
|
|
68911
|
+
const result = { glob, state: state2, regex, posix, input, output, match, isMatch };
|
|
68912
|
+
if (typeof opts.onResult === "function") {
|
|
68913
|
+
opts.onResult(result);
|
|
68914
|
+
}
|
|
68915
|
+
if (isMatch === false) {
|
|
68916
|
+
result.isMatch = false;
|
|
68917
|
+
return returnObject ? result : false;
|
|
68918
|
+
}
|
|
68919
|
+
if (isIgnored(input)) {
|
|
68920
|
+
if (typeof opts.onIgnore === "function") {
|
|
68921
|
+
opts.onIgnore(result);
|
|
68922
|
+
}
|
|
68923
|
+
result.isMatch = false;
|
|
68924
|
+
return returnObject ? result : false;
|
|
68925
|
+
}
|
|
68926
|
+
if (typeof opts.onMatch === "function") {
|
|
68927
|
+
opts.onMatch(result);
|
|
68928
|
+
}
|
|
68929
|
+
return returnObject ? result : true;
|
|
68930
|
+
};
|
|
68931
|
+
if (returnState) {
|
|
68932
|
+
matcher.state = state2;
|
|
68933
|
+
}
|
|
68934
|
+
return matcher;
|
|
68935
|
+
};
|
|
68936
|
+
picomatch2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
68937
|
+
if (typeof input !== "string") {
|
|
68938
|
+
throw new TypeError("Expected input to be a string");
|
|
68939
|
+
}
|
|
68940
|
+
if (input === "") {
|
|
68941
|
+
return { isMatch: false, output: "" };
|
|
68942
|
+
}
|
|
68943
|
+
const opts = options || {};
|
|
68944
|
+
const format2 = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
68945
|
+
let match = input === glob;
|
|
68946
|
+
let output = match && format2 ? format2(input) : input;
|
|
68947
|
+
if (match === false) {
|
|
68948
|
+
output = format2 ? format2(input) : input;
|
|
68949
|
+
match = output === glob;
|
|
68950
|
+
}
|
|
68951
|
+
if (match === false || opts.capture === true) {
|
|
68952
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
68953
|
+
match = picomatch2.matchBase(input, regex, options, posix);
|
|
68954
|
+
} else {
|
|
68955
|
+
match = regex.exec(output);
|
|
68956
|
+
}
|
|
68957
|
+
}
|
|
68958
|
+
return { isMatch: Boolean(match), match, output };
|
|
68959
|
+
};
|
|
68960
|
+
picomatch2.matchBase = (input, glob, options) => {
|
|
68961
|
+
const regex = glob instanceof RegExp ? glob : picomatch2.makeRe(glob, options);
|
|
68962
|
+
return regex.test(utils.basename(input));
|
|
68963
|
+
};
|
|
68964
|
+
picomatch2.isMatch = (str, patterns, options) => picomatch2(patterns, options)(str);
|
|
68965
|
+
picomatch2.parse = (pattern2, options) => {
|
|
68966
|
+
if (Array.isArray(pattern2))
|
|
68967
|
+
return pattern2.map((p4) => picomatch2.parse(p4, options));
|
|
68968
|
+
return parse6(pattern2, { ...options, fastpaths: false });
|
|
68969
|
+
};
|
|
68970
|
+
picomatch2.scan = (input, options) => scan(input, options);
|
|
68971
|
+
picomatch2.compileRe = (state2, options, returnOutput = false, returnState = false) => {
|
|
68972
|
+
if (returnOutput === true) {
|
|
68973
|
+
return state2.output;
|
|
68974
|
+
}
|
|
68975
|
+
const opts = options || {};
|
|
68976
|
+
const prepend = opts.contains ? "" : "^";
|
|
68977
|
+
const append = opts.contains ? "" : "$";
|
|
68978
|
+
let source = `${prepend}(?:${state2.output})${append}`;
|
|
68979
|
+
if (state2 && state2.negated === true) {
|
|
68980
|
+
source = `^(?!${source}).*$`;
|
|
68981
|
+
}
|
|
68982
|
+
const regex = picomatch2.toRegex(source, options);
|
|
68983
|
+
if (returnState === true) {
|
|
68984
|
+
regex.state = state2;
|
|
68985
|
+
}
|
|
68986
|
+
return regex;
|
|
68987
|
+
};
|
|
68988
|
+
picomatch2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
68989
|
+
if (!input || typeof input !== "string") {
|
|
68990
|
+
throw new TypeError("Expected a non-empty string");
|
|
68991
|
+
}
|
|
68992
|
+
let parsed = { negated: false, fastpaths: true };
|
|
68993
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
68994
|
+
parsed.output = parse6.fastpaths(input, options);
|
|
68995
|
+
}
|
|
68996
|
+
if (!parsed.output) {
|
|
68997
|
+
parsed = parse6(input, options);
|
|
68998
|
+
}
|
|
68999
|
+
return picomatch2.compileRe(parsed, options, returnOutput, returnState);
|
|
69000
|
+
};
|
|
69001
|
+
picomatch2.toRegex = (source, options) => {
|
|
69002
|
+
try {
|
|
69003
|
+
const opts = options || {};
|
|
69004
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
69005
|
+
} catch (err) {
|
|
69006
|
+
if (options && options.debug === true)
|
|
69007
|
+
throw err;
|
|
69008
|
+
return /$^/;
|
|
69009
|
+
}
|
|
69010
|
+
};
|
|
69011
|
+
picomatch2.constants = constants;
|
|
69012
|
+
module.exports = picomatch2;
|
|
69013
|
+
}
|
|
69014
|
+
});
|
|
69015
|
+
|
|
69016
|
+
// node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js
|
|
69017
|
+
var require_picomatch2 = __commonJS({
|
|
69018
|
+
"node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js"(exports, module) {
|
|
69019
|
+
"use strict";
|
|
69020
|
+
var pico = require_picomatch();
|
|
69021
|
+
var utils = require_utils();
|
|
69022
|
+
function picomatch2(glob, options, returnState = false) {
|
|
69023
|
+
if (options && (options.windows === null || options.windows === void 0)) {
|
|
69024
|
+
options = { ...options, windows: utils.isWindows() };
|
|
69025
|
+
}
|
|
69026
|
+
return pico(glob, options, returnState);
|
|
69027
|
+
}
|
|
69028
|
+
Object.assign(picomatch2, pico);
|
|
69029
|
+
module.exports = picomatch2;
|
|
69030
|
+
}
|
|
69031
|
+
});
|
|
69032
|
+
|
|
67499
69033
|
// src/csvMapping.ts
|
|
67500
69034
|
function csvTextToRows(csvText) {
|
|
67501
69035
|
const lines = csvText.trim().split(/\r\n|\r|\n/);
|
|
@@ -85740,6 +87274,9 @@ function serializeMappingOptions(mappingOptions) {
|
|
|
85740
87274
|
return { ...rest, curationSpecStr };
|
|
85741
87275
|
}
|
|
85742
87276
|
|
|
87277
|
+
// src/index.ts
|
|
87278
|
+
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
87279
|
+
|
|
85743
87280
|
// src/worker.ts
|
|
85744
87281
|
var wt = null;
|
|
85745
87282
|
async function initializeNodeWorker() {
|
|
@@ -86104,11 +87641,15 @@ async function curateMany(organizeOptions, onProgress) {
|
|
|
86104
87641
|
const fileListWorker = await initializeFileListWorker();
|
|
86105
87642
|
const curationSpec = composeSpecs(organizeOptions.curationSpec());
|
|
86106
87643
|
const specExcludedFiletypes = curationSpec.excludedFiletypes;
|
|
87644
|
+
const excludedPathRegexes = organizeOptions.excludedPathGlobs?.map(
|
|
87645
|
+
(glob) => import_picomatch.default.makeRe(glob).source
|
|
87646
|
+
);
|
|
86107
87647
|
if (organizeOptions.inputType === "directory") {
|
|
86108
87648
|
fileListWorker.postMessage({
|
|
86109
87649
|
request: "scan",
|
|
86110
87650
|
directoryHandle: organizeOptions.inputDirectory,
|
|
86111
87651
|
excludedFiletypes: specExcludedFiletypes,
|
|
87652
|
+
excludedPathRegexes,
|
|
86112
87653
|
fileInfoIndex: organizeOptions.fileInfoIndex
|
|
86113
87654
|
});
|
|
86114
87655
|
} else if (organizeOptions.inputType === "s3") {
|
|
@@ -86116,6 +87657,7 @@ async function curateMany(organizeOptions, onProgress) {
|
|
|
86116
87657
|
request: "scan",
|
|
86117
87658
|
bucketOptions: organizeOptions.inputS3Bucket,
|
|
86118
87659
|
excludedFiletypes: specExcludedFiletypes,
|
|
87660
|
+
excludedPathRegexes,
|
|
86119
87661
|
fileInfoIndex: organizeOptions.fileInfoIndex
|
|
86120
87662
|
});
|
|
86121
87663
|
} else {
|
|
@@ -86123,6 +87665,7 @@ async function curateMany(organizeOptions, onProgress) {
|
|
|
86123
87665
|
request: "scan",
|
|
86124
87666
|
path: organizeOptions.inputDirectory,
|
|
86125
87667
|
excludedFiletypes: specExcludedFiletypes,
|
|
87668
|
+
excludedPathRegexes,
|
|
86126
87669
|
fileInfoIndex: organizeOptions.fileInfoIndex
|
|
86127
87670
|
});
|
|
86128
87671
|
}
|