headlamp 0.1.2 → 0.1.4
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/cli.cjs +4308 -2890
- package/dist/cli.cjs.map +4 -4
- package/dist/index.js +1575 -150
- package/dist/index.js.map +4 -4
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -4,10 +4,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
7
13
|
var __esm = (fn, res) => function __init() {
|
|
8
14
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
15
|
};
|
|
10
|
-
var __commonJS = (cb, mod) => function
|
|
16
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
11
17
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
18
|
};
|
|
13
19
|
var __export = (target, all) => {
|
|
@@ -845,6 +851,1516 @@ var init_fast_related = __esm({
|
|
|
845
851
|
}
|
|
846
852
|
});
|
|
847
853
|
|
|
854
|
+
// node_modules/picomatch/lib/constants.js
|
|
855
|
+
var require_constants = __commonJS({
|
|
856
|
+
"node_modules/picomatch/lib/constants.js"(exports, module) {
|
|
857
|
+
"use strict";
|
|
858
|
+
var path10 = __require("path");
|
|
859
|
+
var WIN_SLASH = "\\\\/";
|
|
860
|
+
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
861
|
+
var DOT_LITERAL = "\\.";
|
|
862
|
+
var PLUS_LITERAL = "\\+";
|
|
863
|
+
var QMARK_LITERAL = "\\?";
|
|
864
|
+
var SLASH_LITERAL = "\\/";
|
|
865
|
+
var ONE_CHAR = "(?=.)";
|
|
866
|
+
var QMARK = "[^/]";
|
|
867
|
+
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
868
|
+
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
869
|
+
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
870
|
+
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
871
|
+
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
872
|
+
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
873
|
+
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
874
|
+
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
875
|
+
var STAR = `${QMARK}*?`;
|
|
876
|
+
var POSIX_CHARS = {
|
|
877
|
+
DOT_LITERAL,
|
|
878
|
+
PLUS_LITERAL,
|
|
879
|
+
QMARK_LITERAL,
|
|
880
|
+
SLASH_LITERAL,
|
|
881
|
+
ONE_CHAR,
|
|
882
|
+
QMARK,
|
|
883
|
+
END_ANCHOR,
|
|
884
|
+
DOTS_SLASH,
|
|
885
|
+
NO_DOT,
|
|
886
|
+
NO_DOTS,
|
|
887
|
+
NO_DOT_SLASH,
|
|
888
|
+
NO_DOTS_SLASH,
|
|
889
|
+
QMARK_NO_DOT,
|
|
890
|
+
STAR,
|
|
891
|
+
START_ANCHOR
|
|
892
|
+
};
|
|
893
|
+
var WINDOWS_CHARS = {
|
|
894
|
+
...POSIX_CHARS,
|
|
895
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
896
|
+
QMARK: WIN_NO_SLASH,
|
|
897
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
898
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
899
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
900
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
901
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
902
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
903
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
904
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
905
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
906
|
+
};
|
|
907
|
+
var POSIX_REGEX_SOURCE = {
|
|
908
|
+
alnum: "a-zA-Z0-9",
|
|
909
|
+
alpha: "a-zA-Z",
|
|
910
|
+
ascii: "\\x00-\\x7F",
|
|
911
|
+
blank: " \\t",
|
|
912
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
913
|
+
digit: "0-9",
|
|
914
|
+
graph: "\\x21-\\x7E",
|
|
915
|
+
lower: "a-z",
|
|
916
|
+
print: "\\x20-\\x7E ",
|
|
917
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
918
|
+
space: " \\t\\r\\n\\v\\f",
|
|
919
|
+
upper: "A-Z",
|
|
920
|
+
word: "A-Za-z0-9_",
|
|
921
|
+
xdigit: "A-Fa-f0-9"
|
|
922
|
+
};
|
|
923
|
+
module.exports = {
|
|
924
|
+
MAX_LENGTH: 1024 * 64,
|
|
925
|
+
POSIX_REGEX_SOURCE,
|
|
926
|
+
// regular expressions
|
|
927
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
928
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
929
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
930
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
931
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
932
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
933
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
934
|
+
REPLACEMENTS: {
|
|
935
|
+
"***": "*",
|
|
936
|
+
"**/**": "**",
|
|
937
|
+
"**/**/**": "**"
|
|
938
|
+
},
|
|
939
|
+
// Digits
|
|
940
|
+
CHAR_0: 48,
|
|
941
|
+
/* 0 */
|
|
942
|
+
CHAR_9: 57,
|
|
943
|
+
/* 9 */
|
|
944
|
+
// Alphabet chars.
|
|
945
|
+
CHAR_UPPERCASE_A: 65,
|
|
946
|
+
/* A */
|
|
947
|
+
CHAR_LOWERCASE_A: 97,
|
|
948
|
+
/* a */
|
|
949
|
+
CHAR_UPPERCASE_Z: 90,
|
|
950
|
+
/* Z */
|
|
951
|
+
CHAR_LOWERCASE_Z: 122,
|
|
952
|
+
/* z */
|
|
953
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
954
|
+
/* ( */
|
|
955
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
956
|
+
/* ) */
|
|
957
|
+
CHAR_ASTERISK: 42,
|
|
958
|
+
/* * */
|
|
959
|
+
// Non-alphabetic chars.
|
|
960
|
+
CHAR_AMPERSAND: 38,
|
|
961
|
+
/* & */
|
|
962
|
+
CHAR_AT: 64,
|
|
963
|
+
/* @ */
|
|
964
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
965
|
+
/* \ */
|
|
966
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
967
|
+
/* \r */
|
|
968
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
969
|
+
/* ^ */
|
|
970
|
+
CHAR_COLON: 58,
|
|
971
|
+
/* : */
|
|
972
|
+
CHAR_COMMA: 44,
|
|
973
|
+
/* , */
|
|
974
|
+
CHAR_DOT: 46,
|
|
975
|
+
/* . */
|
|
976
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
977
|
+
/* " */
|
|
978
|
+
CHAR_EQUAL: 61,
|
|
979
|
+
/* = */
|
|
980
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
981
|
+
/* ! */
|
|
982
|
+
CHAR_FORM_FEED: 12,
|
|
983
|
+
/* \f */
|
|
984
|
+
CHAR_FORWARD_SLASH: 47,
|
|
985
|
+
/* / */
|
|
986
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
987
|
+
/* ` */
|
|
988
|
+
CHAR_HASH: 35,
|
|
989
|
+
/* # */
|
|
990
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
991
|
+
/* - */
|
|
992
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
993
|
+
/* < */
|
|
994
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
995
|
+
/* { */
|
|
996
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
997
|
+
/* [ */
|
|
998
|
+
CHAR_LINE_FEED: 10,
|
|
999
|
+
/* \n */
|
|
1000
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
1001
|
+
/* \u00A0 */
|
|
1002
|
+
CHAR_PERCENT: 37,
|
|
1003
|
+
/* % */
|
|
1004
|
+
CHAR_PLUS: 43,
|
|
1005
|
+
/* + */
|
|
1006
|
+
CHAR_QUESTION_MARK: 63,
|
|
1007
|
+
/* ? */
|
|
1008
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
1009
|
+
/* > */
|
|
1010
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
1011
|
+
/* } */
|
|
1012
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
1013
|
+
/* ] */
|
|
1014
|
+
CHAR_SEMICOLON: 59,
|
|
1015
|
+
/* ; */
|
|
1016
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
1017
|
+
/* ' */
|
|
1018
|
+
CHAR_SPACE: 32,
|
|
1019
|
+
/* */
|
|
1020
|
+
CHAR_TAB: 9,
|
|
1021
|
+
/* \t */
|
|
1022
|
+
CHAR_UNDERSCORE: 95,
|
|
1023
|
+
/* _ */
|
|
1024
|
+
CHAR_VERTICAL_LINE: 124,
|
|
1025
|
+
/* | */
|
|
1026
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1027
|
+
/* \uFEFF */
|
|
1028
|
+
SEP: path10.sep,
|
|
1029
|
+
/**
|
|
1030
|
+
* Create EXTGLOB_CHARS
|
|
1031
|
+
*/
|
|
1032
|
+
extglobChars(chars) {
|
|
1033
|
+
return {
|
|
1034
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
1035
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
1036
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
1037
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
1038
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
1039
|
+
};
|
|
1040
|
+
},
|
|
1041
|
+
/**
|
|
1042
|
+
* Create GLOB_CHARS
|
|
1043
|
+
*/
|
|
1044
|
+
globChars(win32) {
|
|
1045
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
// node_modules/picomatch/lib/utils.js
|
|
1052
|
+
var require_utils = __commonJS({
|
|
1053
|
+
"node_modules/picomatch/lib/utils.js"(exports) {
|
|
1054
|
+
"use strict";
|
|
1055
|
+
var path10 = __require("path");
|
|
1056
|
+
var win32 = process.platform === "win32";
|
|
1057
|
+
var {
|
|
1058
|
+
REGEX_BACKSLASH,
|
|
1059
|
+
REGEX_REMOVE_BACKSLASH,
|
|
1060
|
+
REGEX_SPECIAL_CHARS,
|
|
1061
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
1062
|
+
} = require_constants();
|
|
1063
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
1064
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
1065
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
1066
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
1067
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
1068
|
+
exports.removeBackslashes = (str) => {
|
|
1069
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
1070
|
+
return match === "\\" ? "" : match;
|
|
1071
|
+
});
|
|
1072
|
+
};
|
|
1073
|
+
exports.supportsLookbehinds = () => {
|
|
1074
|
+
const segs = process.version.slice(1).split(".").map(Number);
|
|
1075
|
+
if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
|
|
1076
|
+
return true;
|
|
1077
|
+
}
|
|
1078
|
+
return false;
|
|
1079
|
+
};
|
|
1080
|
+
exports.isWindows = (options) => {
|
|
1081
|
+
if (options && typeof options.windows === "boolean") {
|
|
1082
|
+
return options.windows;
|
|
1083
|
+
}
|
|
1084
|
+
return win32 === true || path10.sep === "\\";
|
|
1085
|
+
};
|
|
1086
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
1087
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
1088
|
+
if (idx === -1) return input;
|
|
1089
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
1090
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
1091
|
+
};
|
|
1092
|
+
exports.removePrefix = (input, state = {}) => {
|
|
1093
|
+
let output = input;
|
|
1094
|
+
if (output.startsWith("./")) {
|
|
1095
|
+
output = output.slice(2);
|
|
1096
|
+
state.prefix = "./";
|
|
1097
|
+
}
|
|
1098
|
+
return output;
|
|
1099
|
+
};
|
|
1100
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
1101
|
+
const prepend = options.contains ? "" : "^";
|
|
1102
|
+
const append = options.contains ? "" : "$";
|
|
1103
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
1104
|
+
if (state.negated === true) {
|
|
1105
|
+
output = `(?:^(?!${output}).*$)`;
|
|
1106
|
+
}
|
|
1107
|
+
return output;
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
// node_modules/picomatch/lib/scan.js
|
|
1113
|
+
var require_scan = __commonJS({
|
|
1114
|
+
"node_modules/picomatch/lib/scan.js"(exports, module) {
|
|
1115
|
+
"use strict";
|
|
1116
|
+
var utils = require_utils();
|
|
1117
|
+
var {
|
|
1118
|
+
CHAR_ASTERISK,
|
|
1119
|
+
/* * */
|
|
1120
|
+
CHAR_AT,
|
|
1121
|
+
/* @ */
|
|
1122
|
+
CHAR_BACKWARD_SLASH,
|
|
1123
|
+
/* \ */
|
|
1124
|
+
CHAR_COMMA,
|
|
1125
|
+
/* , */
|
|
1126
|
+
CHAR_DOT,
|
|
1127
|
+
/* . */
|
|
1128
|
+
CHAR_EXCLAMATION_MARK,
|
|
1129
|
+
/* ! */
|
|
1130
|
+
CHAR_FORWARD_SLASH,
|
|
1131
|
+
/* / */
|
|
1132
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
1133
|
+
/* { */
|
|
1134
|
+
CHAR_LEFT_PARENTHESES,
|
|
1135
|
+
/* ( */
|
|
1136
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
1137
|
+
/* [ */
|
|
1138
|
+
CHAR_PLUS,
|
|
1139
|
+
/* + */
|
|
1140
|
+
CHAR_QUESTION_MARK,
|
|
1141
|
+
/* ? */
|
|
1142
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
1143
|
+
/* } */
|
|
1144
|
+
CHAR_RIGHT_PARENTHESES,
|
|
1145
|
+
/* ) */
|
|
1146
|
+
CHAR_RIGHT_SQUARE_BRACKET
|
|
1147
|
+
/* ] */
|
|
1148
|
+
} = require_constants();
|
|
1149
|
+
var isPathSeparator = (code) => {
|
|
1150
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
1151
|
+
};
|
|
1152
|
+
var depth = (token) => {
|
|
1153
|
+
if (token.isPrefix !== true) {
|
|
1154
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
var scan = (input, options) => {
|
|
1158
|
+
const opts = options || {};
|
|
1159
|
+
const length = input.length - 1;
|
|
1160
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
1161
|
+
const slashes = [];
|
|
1162
|
+
const tokens = [];
|
|
1163
|
+
const parts = [];
|
|
1164
|
+
let str = input;
|
|
1165
|
+
let index = -1;
|
|
1166
|
+
let start = 0;
|
|
1167
|
+
let lastIndex = 0;
|
|
1168
|
+
let isBrace = false;
|
|
1169
|
+
let isBracket = false;
|
|
1170
|
+
let isGlob = false;
|
|
1171
|
+
let isExtglob = false;
|
|
1172
|
+
let isGlobstar = false;
|
|
1173
|
+
let braceEscaped = false;
|
|
1174
|
+
let backslashes = false;
|
|
1175
|
+
let negated = false;
|
|
1176
|
+
let negatedExtglob = false;
|
|
1177
|
+
let finished = false;
|
|
1178
|
+
let braces = 0;
|
|
1179
|
+
let prev;
|
|
1180
|
+
let code;
|
|
1181
|
+
let token = { value: "", depth: 0, isGlob: false };
|
|
1182
|
+
const eos = () => index >= length;
|
|
1183
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
1184
|
+
const advance = () => {
|
|
1185
|
+
prev = code;
|
|
1186
|
+
return str.charCodeAt(++index);
|
|
1187
|
+
};
|
|
1188
|
+
while (index < length) {
|
|
1189
|
+
code = advance();
|
|
1190
|
+
let next;
|
|
1191
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1192
|
+
backslashes = token.backslashes = true;
|
|
1193
|
+
code = advance();
|
|
1194
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1195
|
+
braceEscaped = true;
|
|
1196
|
+
}
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1200
|
+
braces++;
|
|
1201
|
+
while (eos() !== true && (code = advance())) {
|
|
1202
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1203
|
+
backslashes = token.backslashes = true;
|
|
1204
|
+
advance();
|
|
1205
|
+
continue;
|
|
1206
|
+
}
|
|
1207
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1208
|
+
braces++;
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
1212
|
+
isBrace = token.isBrace = true;
|
|
1213
|
+
isGlob = token.isGlob = true;
|
|
1214
|
+
finished = true;
|
|
1215
|
+
if (scanToEnd === true) {
|
|
1216
|
+
continue;
|
|
1217
|
+
}
|
|
1218
|
+
break;
|
|
1219
|
+
}
|
|
1220
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
1221
|
+
isBrace = token.isBrace = true;
|
|
1222
|
+
isGlob = token.isGlob = true;
|
|
1223
|
+
finished = true;
|
|
1224
|
+
if (scanToEnd === true) {
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1230
|
+
braces--;
|
|
1231
|
+
if (braces === 0) {
|
|
1232
|
+
braceEscaped = false;
|
|
1233
|
+
isBrace = token.isBrace = true;
|
|
1234
|
+
finished = true;
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (scanToEnd === true) {
|
|
1240
|
+
continue;
|
|
1241
|
+
}
|
|
1242
|
+
break;
|
|
1243
|
+
}
|
|
1244
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
1245
|
+
slashes.push(index);
|
|
1246
|
+
tokens.push(token);
|
|
1247
|
+
token = { value: "", depth: 0, isGlob: false };
|
|
1248
|
+
if (finished === true) continue;
|
|
1249
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
1250
|
+
start += 2;
|
|
1251
|
+
continue;
|
|
1252
|
+
}
|
|
1253
|
+
lastIndex = index + 1;
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
if (opts.noext !== true) {
|
|
1257
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
1258
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1259
|
+
isGlob = token.isGlob = true;
|
|
1260
|
+
isExtglob = token.isExtglob = true;
|
|
1261
|
+
finished = true;
|
|
1262
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1263
|
+
negatedExtglob = true;
|
|
1264
|
+
}
|
|
1265
|
+
if (scanToEnd === true) {
|
|
1266
|
+
while (eos() !== true && (code = advance())) {
|
|
1267
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1268
|
+
backslashes = token.backslashes = true;
|
|
1269
|
+
code = advance();
|
|
1270
|
+
continue;
|
|
1271
|
+
}
|
|
1272
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1273
|
+
isGlob = token.isGlob = true;
|
|
1274
|
+
finished = true;
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
if (code === CHAR_ASTERISK) {
|
|
1284
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
1285
|
+
isGlob = token.isGlob = true;
|
|
1286
|
+
finished = true;
|
|
1287
|
+
if (scanToEnd === true) {
|
|
1288
|
+
continue;
|
|
1289
|
+
}
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
1293
|
+
isGlob = token.isGlob = true;
|
|
1294
|
+
finished = true;
|
|
1295
|
+
if (scanToEnd === true) {
|
|
1296
|
+
continue;
|
|
1297
|
+
}
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1301
|
+
while (eos() !== true && (next = advance())) {
|
|
1302
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
1303
|
+
backslashes = token.backslashes = true;
|
|
1304
|
+
advance();
|
|
1305
|
+
continue;
|
|
1306
|
+
}
|
|
1307
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1308
|
+
isBracket = token.isBracket = true;
|
|
1309
|
+
isGlob = token.isGlob = true;
|
|
1310
|
+
finished = true;
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
if (scanToEnd === true) {
|
|
1315
|
+
continue;
|
|
1316
|
+
}
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1320
|
+
negated = token.negated = true;
|
|
1321
|
+
start++;
|
|
1322
|
+
continue;
|
|
1323
|
+
}
|
|
1324
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1325
|
+
isGlob = token.isGlob = true;
|
|
1326
|
+
if (scanToEnd === true) {
|
|
1327
|
+
while (eos() !== true && (code = advance())) {
|
|
1328
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1329
|
+
backslashes = token.backslashes = true;
|
|
1330
|
+
code = advance();
|
|
1331
|
+
continue;
|
|
1332
|
+
}
|
|
1333
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1334
|
+
finished = true;
|
|
1335
|
+
break;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
continue;
|
|
1339
|
+
}
|
|
1340
|
+
break;
|
|
1341
|
+
}
|
|
1342
|
+
if (isGlob === true) {
|
|
1343
|
+
finished = true;
|
|
1344
|
+
if (scanToEnd === true) {
|
|
1345
|
+
continue;
|
|
1346
|
+
}
|
|
1347
|
+
break;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
if (opts.noext === true) {
|
|
1351
|
+
isExtglob = false;
|
|
1352
|
+
isGlob = false;
|
|
1353
|
+
}
|
|
1354
|
+
let base = str;
|
|
1355
|
+
let prefix = "";
|
|
1356
|
+
let glob = "";
|
|
1357
|
+
if (start > 0) {
|
|
1358
|
+
prefix = str.slice(0, start);
|
|
1359
|
+
str = str.slice(start);
|
|
1360
|
+
lastIndex -= start;
|
|
1361
|
+
}
|
|
1362
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
1363
|
+
base = str.slice(0, lastIndex);
|
|
1364
|
+
glob = str.slice(lastIndex);
|
|
1365
|
+
} else if (isGlob === true) {
|
|
1366
|
+
base = "";
|
|
1367
|
+
glob = str;
|
|
1368
|
+
} else {
|
|
1369
|
+
base = str;
|
|
1370
|
+
}
|
|
1371
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
1372
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
1373
|
+
base = base.slice(0, -1);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
if (opts.unescape === true) {
|
|
1377
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
1378
|
+
if (base && backslashes === true) {
|
|
1379
|
+
base = utils.removeBackslashes(base);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
const state = {
|
|
1383
|
+
prefix,
|
|
1384
|
+
input,
|
|
1385
|
+
start,
|
|
1386
|
+
base,
|
|
1387
|
+
glob,
|
|
1388
|
+
isBrace,
|
|
1389
|
+
isBracket,
|
|
1390
|
+
isGlob,
|
|
1391
|
+
isExtglob,
|
|
1392
|
+
isGlobstar,
|
|
1393
|
+
negated,
|
|
1394
|
+
negatedExtglob
|
|
1395
|
+
};
|
|
1396
|
+
if (opts.tokens === true) {
|
|
1397
|
+
state.maxDepth = 0;
|
|
1398
|
+
if (!isPathSeparator(code)) {
|
|
1399
|
+
tokens.push(token);
|
|
1400
|
+
}
|
|
1401
|
+
state.tokens = tokens;
|
|
1402
|
+
}
|
|
1403
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
1404
|
+
let prevIndex;
|
|
1405
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1406
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
1407
|
+
const i = slashes[idx];
|
|
1408
|
+
const value = input.slice(n, i);
|
|
1409
|
+
if (opts.tokens) {
|
|
1410
|
+
if (idx === 0 && start !== 0) {
|
|
1411
|
+
tokens[idx].isPrefix = true;
|
|
1412
|
+
tokens[idx].value = prefix;
|
|
1413
|
+
} else {
|
|
1414
|
+
tokens[idx].value = value;
|
|
1415
|
+
}
|
|
1416
|
+
depth(tokens[idx]);
|
|
1417
|
+
state.maxDepth += tokens[idx].depth;
|
|
1418
|
+
}
|
|
1419
|
+
if (idx !== 0 || value !== "") {
|
|
1420
|
+
parts.push(value);
|
|
1421
|
+
}
|
|
1422
|
+
prevIndex = i;
|
|
1423
|
+
}
|
|
1424
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1425
|
+
const value = input.slice(prevIndex + 1);
|
|
1426
|
+
parts.push(value);
|
|
1427
|
+
if (opts.tokens) {
|
|
1428
|
+
tokens[tokens.length - 1].value = value;
|
|
1429
|
+
depth(tokens[tokens.length - 1]);
|
|
1430
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
state.slashes = slashes;
|
|
1434
|
+
state.parts = parts;
|
|
1435
|
+
}
|
|
1436
|
+
return state;
|
|
1437
|
+
};
|
|
1438
|
+
module.exports = scan;
|
|
1439
|
+
}
|
|
1440
|
+
});
|
|
1441
|
+
|
|
1442
|
+
// node_modules/picomatch/lib/parse.js
|
|
1443
|
+
var require_parse = __commonJS({
|
|
1444
|
+
"node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
1445
|
+
"use strict";
|
|
1446
|
+
var constants = require_constants();
|
|
1447
|
+
var utils = require_utils();
|
|
1448
|
+
var {
|
|
1449
|
+
MAX_LENGTH,
|
|
1450
|
+
POSIX_REGEX_SOURCE,
|
|
1451
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
1452
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
1453
|
+
REPLACEMENTS
|
|
1454
|
+
} = constants;
|
|
1455
|
+
var expandRange = (args, options) => {
|
|
1456
|
+
if (typeof options.expandRange === "function") {
|
|
1457
|
+
return options.expandRange(...args, options);
|
|
1458
|
+
}
|
|
1459
|
+
args.sort();
|
|
1460
|
+
const value = `[${args.join("-")}]`;
|
|
1461
|
+
try {
|
|
1462
|
+
new RegExp(value);
|
|
1463
|
+
} catch (ex) {
|
|
1464
|
+
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
1465
|
+
}
|
|
1466
|
+
return value;
|
|
1467
|
+
};
|
|
1468
|
+
var syntaxError = (type, char) => {
|
|
1469
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1470
|
+
};
|
|
1471
|
+
var parse = (input, options) => {
|
|
1472
|
+
if (typeof input !== "string") {
|
|
1473
|
+
throw new TypeError("Expected a string");
|
|
1474
|
+
}
|
|
1475
|
+
input = REPLACEMENTS[input] || input;
|
|
1476
|
+
const opts = { ...options };
|
|
1477
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1478
|
+
let len = input.length;
|
|
1479
|
+
if (len > max) {
|
|
1480
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1481
|
+
}
|
|
1482
|
+
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
1483
|
+
const tokens = [bos];
|
|
1484
|
+
const capture = opts.capture ? "" : "?:";
|
|
1485
|
+
const win32 = utils.isWindows(options);
|
|
1486
|
+
const PLATFORM_CHARS = constants.globChars(win32);
|
|
1487
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
1488
|
+
const {
|
|
1489
|
+
DOT_LITERAL,
|
|
1490
|
+
PLUS_LITERAL,
|
|
1491
|
+
SLASH_LITERAL,
|
|
1492
|
+
ONE_CHAR,
|
|
1493
|
+
DOTS_SLASH,
|
|
1494
|
+
NO_DOT,
|
|
1495
|
+
NO_DOT_SLASH,
|
|
1496
|
+
NO_DOTS_SLASH,
|
|
1497
|
+
QMARK,
|
|
1498
|
+
QMARK_NO_DOT,
|
|
1499
|
+
STAR,
|
|
1500
|
+
START_ANCHOR
|
|
1501
|
+
} = PLATFORM_CHARS;
|
|
1502
|
+
const globstar = (opts2) => {
|
|
1503
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1504
|
+
};
|
|
1505
|
+
const nodot = opts.dot ? "" : NO_DOT;
|
|
1506
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
1507
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
1508
|
+
if (opts.capture) {
|
|
1509
|
+
star = `(${star})`;
|
|
1510
|
+
}
|
|
1511
|
+
if (typeof opts.noext === "boolean") {
|
|
1512
|
+
opts.noextglob = opts.noext;
|
|
1513
|
+
}
|
|
1514
|
+
const state = {
|
|
1515
|
+
input,
|
|
1516
|
+
index: -1,
|
|
1517
|
+
start: 0,
|
|
1518
|
+
dot: opts.dot === true,
|
|
1519
|
+
consumed: "",
|
|
1520
|
+
output: "",
|
|
1521
|
+
prefix: "",
|
|
1522
|
+
backtrack: false,
|
|
1523
|
+
negated: false,
|
|
1524
|
+
brackets: 0,
|
|
1525
|
+
braces: 0,
|
|
1526
|
+
parens: 0,
|
|
1527
|
+
quotes: 0,
|
|
1528
|
+
globstar: false,
|
|
1529
|
+
tokens
|
|
1530
|
+
};
|
|
1531
|
+
input = utils.removePrefix(input, state);
|
|
1532
|
+
len = input.length;
|
|
1533
|
+
const extglobs = [];
|
|
1534
|
+
const braces = [];
|
|
1535
|
+
const stack = [];
|
|
1536
|
+
let prev = bos;
|
|
1537
|
+
let value;
|
|
1538
|
+
const eos = () => state.index === len - 1;
|
|
1539
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
1540
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
1541
|
+
const remaining = () => input.slice(state.index + 1);
|
|
1542
|
+
const consume = (value2 = "", num = 0) => {
|
|
1543
|
+
state.consumed += value2;
|
|
1544
|
+
state.index += num;
|
|
1545
|
+
};
|
|
1546
|
+
const append = (token) => {
|
|
1547
|
+
state.output += token.output != null ? token.output : token.value;
|
|
1548
|
+
consume(token.value);
|
|
1549
|
+
};
|
|
1550
|
+
const negate = () => {
|
|
1551
|
+
let count = 1;
|
|
1552
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
1553
|
+
advance();
|
|
1554
|
+
state.start++;
|
|
1555
|
+
count++;
|
|
1556
|
+
}
|
|
1557
|
+
if (count % 2 === 0) {
|
|
1558
|
+
return false;
|
|
1559
|
+
}
|
|
1560
|
+
state.negated = true;
|
|
1561
|
+
state.start++;
|
|
1562
|
+
return true;
|
|
1563
|
+
};
|
|
1564
|
+
const increment = (type) => {
|
|
1565
|
+
state[type]++;
|
|
1566
|
+
stack.push(type);
|
|
1567
|
+
};
|
|
1568
|
+
const decrement = (type) => {
|
|
1569
|
+
state[type]--;
|
|
1570
|
+
stack.pop();
|
|
1571
|
+
};
|
|
1572
|
+
const push = (tok) => {
|
|
1573
|
+
if (prev.type === "globstar") {
|
|
1574
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
1575
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
1576
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
1577
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
1578
|
+
prev.type = "star";
|
|
1579
|
+
prev.value = "*";
|
|
1580
|
+
prev.output = star;
|
|
1581
|
+
state.output += prev.output;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
1585
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
1586
|
+
}
|
|
1587
|
+
if (tok.value || tok.output) append(tok);
|
|
1588
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
1589
|
+
prev.value += tok.value;
|
|
1590
|
+
prev.output = (prev.output || "") + tok.value;
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
tok.prev = prev;
|
|
1594
|
+
tokens.push(tok);
|
|
1595
|
+
prev = tok;
|
|
1596
|
+
};
|
|
1597
|
+
const extglobOpen = (type, value2) => {
|
|
1598
|
+
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
|
1599
|
+
token.prev = prev;
|
|
1600
|
+
token.parens = state.parens;
|
|
1601
|
+
token.output = state.output;
|
|
1602
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
1603
|
+
increment("parens");
|
|
1604
|
+
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
1605
|
+
push({ type: "paren", extglob: true, value: advance(), output });
|
|
1606
|
+
extglobs.push(token);
|
|
1607
|
+
};
|
|
1608
|
+
const extglobClose = (token) => {
|
|
1609
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
1610
|
+
let rest;
|
|
1611
|
+
if (token.type === "negate") {
|
|
1612
|
+
let extglobStar = star;
|
|
1613
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
1614
|
+
extglobStar = globstar(opts);
|
|
1615
|
+
}
|
|
1616
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
1617
|
+
output = token.close = `)$))${extglobStar}`;
|
|
1618
|
+
}
|
|
1619
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
1620
|
+
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
|
1621
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
1622
|
+
}
|
|
1623
|
+
if (token.prev.type === "bos") {
|
|
1624
|
+
state.negatedExtglob = true;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
push({ type: "paren", extglob: true, value, output });
|
|
1628
|
+
decrement("parens");
|
|
1629
|
+
};
|
|
1630
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
1631
|
+
let backslashes = false;
|
|
1632
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
1633
|
+
if (first === "\\") {
|
|
1634
|
+
backslashes = true;
|
|
1635
|
+
return m;
|
|
1636
|
+
}
|
|
1637
|
+
if (first === "?") {
|
|
1638
|
+
if (esc) {
|
|
1639
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
1640
|
+
}
|
|
1641
|
+
if (index === 0) {
|
|
1642
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
1643
|
+
}
|
|
1644
|
+
return QMARK.repeat(chars.length);
|
|
1645
|
+
}
|
|
1646
|
+
if (first === ".") {
|
|
1647
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
1648
|
+
}
|
|
1649
|
+
if (first === "*") {
|
|
1650
|
+
if (esc) {
|
|
1651
|
+
return esc + first + (rest ? star : "");
|
|
1652
|
+
}
|
|
1653
|
+
return star;
|
|
1654
|
+
}
|
|
1655
|
+
return esc ? m : `\\${m}`;
|
|
1656
|
+
});
|
|
1657
|
+
if (backslashes === true) {
|
|
1658
|
+
if (opts.unescape === true) {
|
|
1659
|
+
output = output.replace(/\\/g, "");
|
|
1660
|
+
} else {
|
|
1661
|
+
output = output.replace(/\\+/g, (m) => {
|
|
1662
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
if (output === input && opts.contains === true) {
|
|
1667
|
+
state.output = input;
|
|
1668
|
+
return state;
|
|
1669
|
+
}
|
|
1670
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
1671
|
+
return state;
|
|
1672
|
+
}
|
|
1673
|
+
while (!eos()) {
|
|
1674
|
+
value = advance();
|
|
1675
|
+
if (value === "\0") {
|
|
1676
|
+
continue;
|
|
1677
|
+
}
|
|
1678
|
+
if (value === "\\") {
|
|
1679
|
+
const next = peek();
|
|
1680
|
+
if (next === "/" && opts.bash !== true) {
|
|
1681
|
+
continue;
|
|
1682
|
+
}
|
|
1683
|
+
if (next === "." || next === ";") {
|
|
1684
|
+
continue;
|
|
1685
|
+
}
|
|
1686
|
+
if (!next) {
|
|
1687
|
+
value += "\\";
|
|
1688
|
+
push({ type: "text", value });
|
|
1689
|
+
continue;
|
|
1690
|
+
}
|
|
1691
|
+
const match = /^\\+/.exec(remaining());
|
|
1692
|
+
let slashes = 0;
|
|
1693
|
+
if (match && match[0].length > 2) {
|
|
1694
|
+
slashes = match[0].length;
|
|
1695
|
+
state.index += slashes;
|
|
1696
|
+
if (slashes % 2 !== 0) {
|
|
1697
|
+
value += "\\";
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
if (opts.unescape === true) {
|
|
1701
|
+
value = advance();
|
|
1702
|
+
} else {
|
|
1703
|
+
value += advance();
|
|
1704
|
+
}
|
|
1705
|
+
if (state.brackets === 0) {
|
|
1706
|
+
push({ type: "text", value });
|
|
1707
|
+
continue;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
1711
|
+
if (opts.posix !== false && value === ":") {
|
|
1712
|
+
const inner = prev.value.slice(1);
|
|
1713
|
+
if (inner.includes("[")) {
|
|
1714
|
+
prev.posix = true;
|
|
1715
|
+
if (inner.includes(":")) {
|
|
1716
|
+
const idx = prev.value.lastIndexOf("[");
|
|
1717
|
+
const pre = prev.value.slice(0, idx);
|
|
1718
|
+
const rest2 = prev.value.slice(idx + 2);
|
|
1719
|
+
const posix = POSIX_REGEX_SOURCE[rest2];
|
|
1720
|
+
if (posix) {
|
|
1721
|
+
prev.value = pre + posix;
|
|
1722
|
+
state.backtrack = true;
|
|
1723
|
+
advance();
|
|
1724
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
1725
|
+
bos.output = ONE_CHAR;
|
|
1726
|
+
}
|
|
1727
|
+
continue;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
1733
|
+
value = `\\${value}`;
|
|
1734
|
+
}
|
|
1735
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
1736
|
+
value = `\\${value}`;
|
|
1737
|
+
}
|
|
1738
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
1739
|
+
value = "^";
|
|
1740
|
+
}
|
|
1741
|
+
prev.value += value;
|
|
1742
|
+
append({ value });
|
|
1743
|
+
continue;
|
|
1744
|
+
}
|
|
1745
|
+
if (state.quotes === 1 && value !== '"') {
|
|
1746
|
+
value = utils.escapeRegex(value);
|
|
1747
|
+
prev.value += value;
|
|
1748
|
+
append({ value });
|
|
1749
|
+
continue;
|
|
1750
|
+
}
|
|
1751
|
+
if (value === '"') {
|
|
1752
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
1753
|
+
if (opts.keepQuotes === true) {
|
|
1754
|
+
push({ type: "text", value });
|
|
1755
|
+
}
|
|
1756
|
+
continue;
|
|
1757
|
+
}
|
|
1758
|
+
if (value === "(") {
|
|
1759
|
+
increment("parens");
|
|
1760
|
+
push({ type: "paren", value });
|
|
1761
|
+
continue;
|
|
1762
|
+
}
|
|
1763
|
+
if (value === ")") {
|
|
1764
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
1765
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
1766
|
+
}
|
|
1767
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
1768
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
1769
|
+
extglobClose(extglobs.pop());
|
|
1770
|
+
continue;
|
|
1771
|
+
}
|
|
1772
|
+
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
1773
|
+
decrement("parens");
|
|
1774
|
+
continue;
|
|
1775
|
+
}
|
|
1776
|
+
if (value === "[") {
|
|
1777
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
1778
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
1779
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
1780
|
+
}
|
|
1781
|
+
value = `\\${value}`;
|
|
1782
|
+
} else {
|
|
1783
|
+
increment("brackets");
|
|
1784
|
+
}
|
|
1785
|
+
push({ type: "bracket", value });
|
|
1786
|
+
continue;
|
|
1787
|
+
}
|
|
1788
|
+
if (value === "]") {
|
|
1789
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
1790
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
1791
|
+
continue;
|
|
1792
|
+
}
|
|
1793
|
+
if (state.brackets === 0) {
|
|
1794
|
+
if (opts.strictBrackets === true) {
|
|
1795
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
1796
|
+
}
|
|
1797
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
decrement("brackets");
|
|
1801
|
+
const prevValue = prev.value.slice(1);
|
|
1802
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
1803
|
+
value = `/${value}`;
|
|
1804
|
+
}
|
|
1805
|
+
prev.value += value;
|
|
1806
|
+
append({ value });
|
|
1807
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
1808
|
+
continue;
|
|
1809
|
+
}
|
|
1810
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
1811
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
1812
|
+
if (opts.literalBrackets === true) {
|
|
1813
|
+
state.output += escaped;
|
|
1814
|
+
prev.value = escaped;
|
|
1815
|
+
continue;
|
|
1816
|
+
}
|
|
1817
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
1818
|
+
state.output += prev.value;
|
|
1819
|
+
continue;
|
|
1820
|
+
}
|
|
1821
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
1822
|
+
increment("braces");
|
|
1823
|
+
const open = {
|
|
1824
|
+
type: "brace",
|
|
1825
|
+
value,
|
|
1826
|
+
output: "(",
|
|
1827
|
+
outputIndex: state.output.length,
|
|
1828
|
+
tokensIndex: state.tokens.length
|
|
1829
|
+
};
|
|
1830
|
+
braces.push(open);
|
|
1831
|
+
push(open);
|
|
1832
|
+
continue;
|
|
1833
|
+
}
|
|
1834
|
+
if (value === "}") {
|
|
1835
|
+
const brace = braces[braces.length - 1];
|
|
1836
|
+
if (opts.nobrace === true || !brace) {
|
|
1837
|
+
push({ type: "text", value, output: value });
|
|
1838
|
+
continue;
|
|
1839
|
+
}
|
|
1840
|
+
let output = ")";
|
|
1841
|
+
if (brace.dots === true) {
|
|
1842
|
+
const arr = tokens.slice();
|
|
1843
|
+
const range = [];
|
|
1844
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
1845
|
+
tokens.pop();
|
|
1846
|
+
if (arr[i].type === "brace") {
|
|
1847
|
+
break;
|
|
1848
|
+
}
|
|
1849
|
+
if (arr[i].type !== "dots") {
|
|
1850
|
+
range.unshift(arr[i].value);
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
output = expandRange(range, opts);
|
|
1854
|
+
state.backtrack = true;
|
|
1855
|
+
}
|
|
1856
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
1857
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
1858
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1859
|
+
brace.value = brace.output = "\\{";
|
|
1860
|
+
value = output = "\\}";
|
|
1861
|
+
state.output = out;
|
|
1862
|
+
for (const t of toks) {
|
|
1863
|
+
state.output += t.output || t.value;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
push({ type: "brace", value, output });
|
|
1867
|
+
decrement("braces");
|
|
1868
|
+
braces.pop();
|
|
1869
|
+
continue;
|
|
1870
|
+
}
|
|
1871
|
+
if (value === "|") {
|
|
1872
|
+
if (extglobs.length > 0) {
|
|
1873
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
1874
|
+
}
|
|
1875
|
+
push({ type: "text", value });
|
|
1876
|
+
continue;
|
|
1877
|
+
}
|
|
1878
|
+
if (value === ",") {
|
|
1879
|
+
let output = value;
|
|
1880
|
+
const brace = braces[braces.length - 1];
|
|
1881
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
1882
|
+
brace.comma = true;
|
|
1883
|
+
output = "|";
|
|
1884
|
+
}
|
|
1885
|
+
push({ type: "comma", value, output });
|
|
1886
|
+
continue;
|
|
1887
|
+
}
|
|
1888
|
+
if (value === "/") {
|
|
1889
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
1890
|
+
state.start = state.index + 1;
|
|
1891
|
+
state.consumed = "";
|
|
1892
|
+
state.output = "";
|
|
1893
|
+
tokens.pop();
|
|
1894
|
+
prev = bos;
|
|
1895
|
+
continue;
|
|
1896
|
+
}
|
|
1897
|
+
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
1898
|
+
continue;
|
|
1899
|
+
}
|
|
1900
|
+
if (value === ".") {
|
|
1901
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
1902
|
+
if (prev.value === ".") prev.output = DOT_LITERAL;
|
|
1903
|
+
const brace = braces[braces.length - 1];
|
|
1904
|
+
prev.type = "dots";
|
|
1905
|
+
prev.output += value;
|
|
1906
|
+
prev.value += value;
|
|
1907
|
+
brace.dots = true;
|
|
1908
|
+
continue;
|
|
1909
|
+
}
|
|
1910
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
1911
|
+
push({ type: "text", value, output: DOT_LITERAL });
|
|
1912
|
+
continue;
|
|
1913
|
+
}
|
|
1914
|
+
push({ type: "dot", value, output: DOT_LITERAL });
|
|
1915
|
+
continue;
|
|
1916
|
+
}
|
|
1917
|
+
if (value === "?") {
|
|
1918
|
+
const isGroup = prev && prev.value === "(";
|
|
1919
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1920
|
+
extglobOpen("qmark", value);
|
|
1921
|
+
continue;
|
|
1922
|
+
}
|
|
1923
|
+
if (prev && prev.type === "paren") {
|
|
1924
|
+
const next = peek();
|
|
1925
|
+
let output = value;
|
|
1926
|
+
if (next === "<" && !utils.supportsLookbehinds()) {
|
|
1927
|
+
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
1928
|
+
}
|
|
1929
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
1930
|
+
output = `\\${value}`;
|
|
1931
|
+
}
|
|
1932
|
+
push({ type: "text", value, output });
|
|
1933
|
+
continue;
|
|
1934
|
+
}
|
|
1935
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
1936
|
+
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
1937
|
+
continue;
|
|
1938
|
+
}
|
|
1939
|
+
push({ type: "qmark", value, output: QMARK });
|
|
1940
|
+
continue;
|
|
1941
|
+
}
|
|
1942
|
+
if (value === "!") {
|
|
1943
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
1944
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
1945
|
+
extglobOpen("negate", value);
|
|
1946
|
+
continue;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
1950
|
+
negate();
|
|
1951
|
+
continue;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
if (value === "+") {
|
|
1955
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1956
|
+
extglobOpen("plus", value);
|
|
1957
|
+
continue;
|
|
1958
|
+
}
|
|
1959
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
1960
|
+
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
1961
|
+
continue;
|
|
1962
|
+
}
|
|
1963
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
1964
|
+
push({ type: "plus", value });
|
|
1965
|
+
continue;
|
|
1966
|
+
}
|
|
1967
|
+
push({ type: "plus", value: PLUS_LITERAL });
|
|
1968
|
+
continue;
|
|
1969
|
+
}
|
|
1970
|
+
if (value === "@") {
|
|
1971
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1972
|
+
push({ type: "at", extglob: true, value, output: "" });
|
|
1973
|
+
continue;
|
|
1974
|
+
}
|
|
1975
|
+
push({ type: "text", value });
|
|
1976
|
+
continue;
|
|
1977
|
+
}
|
|
1978
|
+
if (value !== "*") {
|
|
1979
|
+
if (value === "$" || value === "^") {
|
|
1980
|
+
value = `\\${value}`;
|
|
1981
|
+
}
|
|
1982
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1983
|
+
if (match) {
|
|
1984
|
+
value += match[0];
|
|
1985
|
+
state.index += match[0].length;
|
|
1986
|
+
}
|
|
1987
|
+
push({ type: "text", value });
|
|
1988
|
+
continue;
|
|
1989
|
+
}
|
|
1990
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
1991
|
+
prev.type = "star";
|
|
1992
|
+
prev.star = true;
|
|
1993
|
+
prev.value += value;
|
|
1994
|
+
prev.output = star;
|
|
1995
|
+
state.backtrack = true;
|
|
1996
|
+
state.globstar = true;
|
|
1997
|
+
consume(value);
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
let rest = remaining();
|
|
2001
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
2002
|
+
extglobOpen("star", value);
|
|
2003
|
+
continue;
|
|
2004
|
+
}
|
|
2005
|
+
if (prev.type === "star") {
|
|
2006
|
+
if (opts.noglobstar === true) {
|
|
2007
|
+
consume(value);
|
|
2008
|
+
continue;
|
|
2009
|
+
}
|
|
2010
|
+
const prior = prev.prev;
|
|
2011
|
+
const before = prior.prev;
|
|
2012
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
2013
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
2014
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
2015
|
+
push({ type: "star", value, output: "" });
|
|
2016
|
+
continue;
|
|
2017
|
+
}
|
|
2018
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
2019
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
2020
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
2021
|
+
push({ type: "star", value, output: "" });
|
|
2022
|
+
continue;
|
|
2023
|
+
}
|
|
2024
|
+
while (rest.slice(0, 3) === "/**") {
|
|
2025
|
+
const after = input[state.index + 4];
|
|
2026
|
+
if (after && after !== "/") {
|
|
2027
|
+
break;
|
|
2028
|
+
}
|
|
2029
|
+
rest = rest.slice(3);
|
|
2030
|
+
consume("/**", 3);
|
|
2031
|
+
}
|
|
2032
|
+
if (prior.type === "bos" && eos()) {
|
|
2033
|
+
prev.type = "globstar";
|
|
2034
|
+
prev.value += value;
|
|
2035
|
+
prev.output = globstar(opts);
|
|
2036
|
+
state.output = prev.output;
|
|
2037
|
+
state.globstar = true;
|
|
2038
|
+
consume(value);
|
|
2039
|
+
continue;
|
|
2040
|
+
}
|
|
2041
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
2042
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2043
|
+
prior.output = `(?:${prior.output}`;
|
|
2044
|
+
prev.type = "globstar";
|
|
2045
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
2046
|
+
prev.value += value;
|
|
2047
|
+
state.globstar = true;
|
|
2048
|
+
state.output += prior.output + prev.output;
|
|
2049
|
+
consume(value);
|
|
2050
|
+
continue;
|
|
2051
|
+
}
|
|
2052
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
2053
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
2054
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2055
|
+
prior.output = `(?:${prior.output}`;
|
|
2056
|
+
prev.type = "globstar";
|
|
2057
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
2058
|
+
prev.value += value;
|
|
2059
|
+
state.output += prior.output + prev.output;
|
|
2060
|
+
state.globstar = true;
|
|
2061
|
+
consume(value + advance());
|
|
2062
|
+
push({ type: "slash", value: "/", output: "" });
|
|
2063
|
+
continue;
|
|
2064
|
+
}
|
|
2065
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
2066
|
+
prev.type = "globstar";
|
|
2067
|
+
prev.value += value;
|
|
2068
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
2069
|
+
state.output = prev.output;
|
|
2070
|
+
state.globstar = true;
|
|
2071
|
+
consume(value + advance());
|
|
2072
|
+
push({ type: "slash", value: "/", output: "" });
|
|
2073
|
+
continue;
|
|
2074
|
+
}
|
|
2075
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
2076
|
+
prev.type = "globstar";
|
|
2077
|
+
prev.output = globstar(opts);
|
|
2078
|
+
prev.value += value;
|
|
2079
|
+
state.output += prev.output;
|
|
2080
|
+
state.globstar = true;
|
|
2081
|
+
consume(value);
|
|
2082
|
+
continue;
|
|
2083
|
+
}
|
|
2084
|
+
const token = { type: "star", value, output: star };
|
|
2085
|
+
if (opts.bash === true) {
|
|
2086
|
+
token.output = ".*?";
|
|
2087
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
2088
|
+
token.output = nodot + token.output;
|
|
2089
|
+
}
|
|
2090
|
+
push(token);
|
|
2091
|
+
continue;
|
|
2092
|
+
}
|
|
2093
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
2094
|
+
token.output = value;
|
|
2095
|
+
push(token);
|
|
2096
|
+
continue;
|
|
2097
|
+
}
|
|
2098
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
2099
|
+
if (prev.type === "dot") {
|
|
2100
|
+
state.output += NO_DOT_SLASH;
|
|
2101
|
+
prev.output += NO_DOT_SLASH;
|
|
2102
|
+
} else if (opts.dot === true) {
|
|
2103
|
+
state.output += NO_DOTS_SLASH;
|
|
2104
|
+
prev.output += NO_DOTS_SLASH;
|
|
2105
|
+
} else {
|
|
2106
|
+
state.output += nodot;
|
|
2107
|
+
prev.output += nodot;
|
|
2108
|
+
}
|
|
2109
|
+
if (peek() !== "*") {
|
|
2110
|
+
state.output += ONE_CHAR;
|
|
2111
|
+
prev.output += ONE_CHAR;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
push(token);
|
|
2115
|
+
}
|
|
2116
|
+
while (state.brackets > 0) {
|
|
2117
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
2118
|
+
state.output = utils.escapeLast(state.output, "[");
|
|
2119
|
+
decrement("brackets");
|
|
2120
|
+
}
|
|
2121
|
+
while (state.parens > 0) {
|
|
2122
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
2123
|
+
state.output = utils.escapeLast(state.output, "(");
|
|
2124
|
+
decrement("parens");
|
|
2125
|
+
}
|
|
2126
|
+
while (state.braces > 0) {
|
|
2127
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
2128
|
+
state.output = utils.escapeLast(state.output, "{");
|
|
2129
|
+
decrement("braces");
|
|
2130
|
+
}
|
|
2131
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
2132
|
+
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
2133
|
+
}
|
|
2134
|
+
if (state.backtrack === true) {
|
|
2135
|
+
state.output = "";
|
|
2136
|
+
for (const token of state.tokens) {
|
|
2137
|
+
state.output += token.output != null ? token.output : token.value;
|
|
2138
|
+
if (token.suffix) {
|
|
2139
|
+
state.output += token.suffix;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
return state;
|
|
2144
|
+
};
|
|
2145
|
+
parse.fastpaths = (input, options) => {
|
|
2146
|
+
const opts = { ...options };
|
|
2147
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2148
|
+
const len = input.length;
|
|
2149
|
+
if (len > max) {
|
|
2150
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
2151
|
+
}
|
|
2152
|
+
input = REPLACEMENTS[input] || input;
|
|
2153
|
+
const win32 = utils.isWindows(options);
|
|
2154
|
+
const {
|
|
2155
|
+
DOT_LITERAL,
|
|
2156
|
+
SLASH_LITERAL,
|
|
2157
|
+
ONE_CHAR,
|
|
2158
|
+
DOTS_SLASH,
|
|
2159
|
+
NO_DOT,
|
|
2160
|
+
NO_DOTS,
|
|
2161
|
+
NO_DOTS_SLASH,
|
|
2162
|
+
STAR,
|
|
2163
|
+
START_ANCHOR
|
|
2164
|
+
} = constants.globChars(win32);
|
|
2165
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
2166
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
2167
|
+
const capture = opts.capture ? "" : "?:";
|
|
2168
|
+
const state = { negated: false, prefix: "" };
|
|
2169
|
+
let star = opts.bash === true ? ".*?" : STAR;
|
|
2170
|
+
if (opts.capture) {
|
|
2171
|
+
star = `(${star})`;
|
|
2172
|
+
}
|
|
2173
|
+
const globstar = (opts2) => {
|
|
2174
|
+
if (opts2.noglobstar === true) return star;
|
|
2175
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
2176
|
+
};
|
|
2177
|
+
const create2 = (str) => {
|
|
2178
|
+
switch (str) {
|
|
2179
|
+
case "*":
|
|
2180
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
2181
|
+
case ".*":
|
|
2182
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2183
|
+
case "*.*":
|
|
2184
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2185
|
+
case "*/*":
|
|
2186
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
2187
|
+
case "**":
|
|
2188
|
+
return nodot + globstar(opts);
|
|
2189
|
+
case "**/*":
|
|
2190
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
2191
|
+
case "**/*.*":
|
|
2192
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2193
|
+
case "**/.*":
|
|
2194
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2195
|
+
default: {
|
|
2196
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
2197
|
+
if (!match) return;
|
|
2198
|
+
const source2 = create2(match[1]);
|
|
2199
|
+
if (!source2) return;
|
|
2200
|
+
return source2 + DOT_LITERAL + match[2];
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
};
|
|
2204
|
+
const output = utils.removePrefix(input, state);
|
|
2205
|
+
let source = create2(output);
|
|
2206
|
+
if (source && opts.strictSlashes !== true) {
|
|
2207
|
+
source += `${SLASH_LITERAL}?`;
|
|
2208
|
+
}
|
|
2209
|
+
return source;
|
|
2210
|
+
};
|
|
2211
|
+
module.exports = parse;
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2214
|
+
|
|
2215
|
+
// node_modules/picomatch/lib/picomatch.js
|
|
2216
|
+
var require_picomatch = __commonJS({
|
|
2217
|
+
"node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
2218
|
+
"use strict";
|
|
2219
|
+
var path10 = __require("path");
|
|
2220
|
+
var scan = require_scan();
|
|
2221
|
+
var parse = require_parse();
|
|
2222
|
+
var utils = require_utils();
|
|
2223
|
+
var constants = require_constants();
|
|
2224
|
+
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
2225
|
+
var picomatch2 = (glob, options, returnState = false) => {
|
|
2226
|
+
if (Array.isArray(glob)) {
|
|
2227
|
+
const fns = glob.map((input) => picomatch2(input, options, returnState));
|
|
2228
|
+
const arrayMatcher = (str) => {
|
|
2229
|
+
for (const isMatch of fns) {
|
|
2230
|
+
const state2 = isMatch(str);
|
|
2231
|
+
if (state2) return state2;
|
|
2232
|
+
}
|
|
2233
|
+
return false;
|
|
2234
|
+
};
|
|
2235
|
+
return arrayMatcher;
|
|
2236
|
+
}
|
|
2237
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
2238
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
2239
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
2240
|
+
}
|
|
2241
|
+
const opts = options || {};
|
|
2242
|
+
const posix = utils.isWindows(options);
|
|
2243
|
+
const regex = isState ? picomatch2.compileRe(glob, options) : picomatch2.makeRe(glob, options, false, true);
|
|
2244
|
+
const state = regex.state;
|
|
2245
|
+
delete regex.state;
|
|
2246
|
+
let isIgnored = () => false;
|
|
2247
|
+
if (opts.ignore) {
|
|
2248
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
2249
|
+
isIgnored = picomatch2(opts.ignore, ignoreOpts, returnState);
|
|
2250
|
+
}
|
|
2251
|
+
const matcher = (input, returnObject = false) => {
|
|
2252
|
+
const { isMatch, match, output } = picomatch2.test(input, regex, options, { glob, posix });
|
|
2253
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
2254
|
+
if (typeof opts.onResult === "function") {
|
|
2255
|
+
opts.onResult(result);
|
|
2256
|
+
}
|
|
2257
|
+
if (isMatch === false) {
|
|
2258
|
+
result.isMatch = false;
|
|
2259
|
+
return returnObject ? result : false;
|
|
2260
|
+
}
|
|
2261
|
+
if (isIgnored(input)) {
|
|
2262
|
+
if (typeof opts.onIgnore === "function") {
|
|
2263
|
+
opts.onIgnore(result);
|
|
2264
|
+
}
|
|
2265
|
+
result.isMatch = false;
|
|
2266
|
+
return returnObject ? result : false;
|
|
2267
|
+
}
|
|
2268
|
+
if (typeof opts.onMatch === "function") {
|
|
2269
|
+
opts.onMatch(result);
|
|
2270
|
+
}
|
|
2271
|
+
return returnObject ? result : true;
|
|
2272
|
+
};
|
|
2273
|
+
if (returnState) {
|
|
2274
|
+
matcher.state = state;
|
|
2275
|
+
}
|
|
2276
|
+
return matcher;
|
|
2277
|
+
};
|
|
2278
|
+
picomatch2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
2279
|
+
if (typeof input !== "string") {
|
|
2280
|
+
throw new TypeError("Expected input to be a string");
|
|
2281
|
+
}
|
|
2282
|
+
if (input === "") {
|
|
2283
|
+
return { isMatch: false, output: "" };
|
|
2284
|
+
}
|
|
2285
|
+
const opts = options || {};
|
|
2286
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
2287
|
+
let match = input === glob;
|
|
2288
|
+
let output = match && format ? format(input) : input;
|
|
2289
|
+
if (match === false) {
|
|
2290
|
+
output = format ? format(input) : input;
|
|
2291
|
+
match = output === glob;
|
|
2292
|
+
}
|
|
2293
|
+
if (match === false || opts.capture === true) {
|
|
2294
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
2295
|
+
match = picomatch2.matchBase(input, regex, options, posix);
|
|
2296
|
+
} else {
|
|
2297
|
+
match = regex.exec(output);
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
return { isMatch: Boolean(match), match, output };
|
|
2301
|
+
};
|
|
2302
|
+
picomatch2.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
2303
|
+
const regex = glob instanceof RegExp ? glob : picomatch2.makeRe(glob, options);
|
|
2304
|
+
return regex.test(path10.basename(input));
|
|
2305
|
+
};
|
|
2306
|
+
picomatch2.isMatch = (str, patterns, options) => picomatch2(patterns, options)(str);
|
|
2307
|
+
picomatch2.parse = (pattern, options) => {
|
|
2308
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch2.parse(p, options));
|
|
2309
|
+
return parse(pattern, { ...options, fastpaths: false });
|
|
2310
|
+
};
|
|
2311
|
+
picomatch2.scan = (input, options) => scan(input, options);
|
|
2312
|
+
picomatch2.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
2313
|
+
if (returnOutput === true) {
|
|
2314
|
+
return state.output;
|
|
2315
|
+
}
|
|
2316
|
+
const opts = options || {};
|
|
2317
|
+
const prepend = opts.contains ? "" : "^";
|
|
2318
|
+
const append = opts.contains ? "" : "$";
|
|
2319
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
2320
|
+
if (state && state.negated === true) {
|
|
2321
|
+
source = `^(?!${source}).*$`;
|
|
2322
|
+
}
|
|
2323
|
+
const regex = picomatch2.toRegex(source, options);
|
|
2324
|
+
if (returnState === true) {
|
|
2325
|
+
regex.state = state;
|
|
2326
|
+
}
|
|
2327
|
+
return regex;
|
|
2328
|
+
};
|
|
2329
|
+
picomatch2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
2330
|
+
if (!input || typeof input !== "string") {
|
|
2331
|
+
throw new TypeError("Expected a non-empty string");
|
|
2332
|
+
}
|
|
2333
|
+
let parsed = { negated: false, fastpaths: true };
|
|
2334
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
2335
|
+
parsed.output = parse.fastpaths(input, options);
|
|
2336
|
+
}
|
|
2337
|
+
if (!parsed.output) {
|
|
2338
|
+
parsed = parse(input, options);
|
|
2339
|
+
}
|
|
2340
|
+
return picomatch2.compileRe(parsed, options, returnOutput, returnState);
|
|
2341
|
+
};
|
|
2342
|
+
picomatch2.toRegex = (source, options) => {
|
|
2343
|
+
try {
|
|
2344
|
+
const opts = options || {};
|
|
2345
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
2346
|
+
} catch (err) {
|
|
2347
|
+
if (options && options.debug === true) throw err;
|
|
2348
|
+
return /$^/;
|
|
2349
|
+
}
|
|
2350
|
+
};
|
|
2351
|
+
picomatch2.constants = constants;
|
|
2352
|
+
module.exports = picomatch2;
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
|
|
2356
|
+
// node_modules/picomatch/index.js
|
|
2357
|
+
var require_picomatch2 = __commonJS({
|
|
2358
|
+
"node_modules/picomatch/index.js"(exports, module) {
|
|
2359
|
+
"use strict";
|
|
2360
|
+
module.exports = require_picomatch();
|
|
2361
|
+
}
|
|
2362
|
+
});
|
|
2363
|
+
|
|
848
2364
|
// node_modules/json5/lib/unicode.js
|
|
849
2365
|
var require_unicode = __commonJS({
|
|
850
2366
|
"node_modules/json5/lib/unicode.js"(exports, module) {
|
|
@@ -879,7 +2395,7 @@ var require_util = __commonJS({
|
|
|
879
2395
|
});
|
|
880
2396
|
|
|
881
2397
|
// node_modules/json5/lib/parse.js
|
|
882
|
-
var
|
|
2398
|
+
var require_parse2 = __commonJS({
|
|
883
2399
|
"node_modules/json5/lib/parse.js"(exports, module) {
|
|
884
2400
|
var util2 = require_util();
|
|
885
2401
|
var source;
|
|
@@ -1947,7 +3463,7 @@ var require_stringify = __commonJS({
|
|
|
1947
3463
|
// node_modules/json5/lib/index.js
|
|
1948
3464
|
var require_lib = __commonJS({
|
|
1949
3465
|
"node_modules/json5/lib/index.js"(exports, module) {
|
|
1950
|
-
var parse =
|
|
3466
|
+
var parse = require_parse2();
|
|
1951
3467
|
var stringify = require_stringify();
|
|
1952
3468
|
var JSON52 = {
|
|
1953
3469
|
parse,
|
|
@@ -3053,13 +4569,9 @@ var decideShouldRunJest = (vitestFiles, jestFiles, opts) => {
|
|
|
3053
4569
|
};
|
|
3054
4570
|
|
|
3055
4571
|
// src/lib/coverage-core.ts
|
|
4572
|
+
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
3056
4573
|
import * as fs3 from "node:fs/promises";
|
|
3057
|
-
import {
|
|
3058
|
-
var require2 = createRequire(import.meta.url);
|
|
3059
|
-
var { createCoverageMap } = (
|
|
3060
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3061
|
-
require2("istanbul-lib-coverage")
|
|
3062
|
-
);
|
|
4574
|
+
import { createCoverageMap } from "istanbul-lib-coverage";
|
|
3063
4575
|
var readCoverageJson = async (jsonPath) => {
|
|
3064
4576
|
try {
|
|
3065
4577
|
const txt = await fs3.readFile(jsonPath, "utf8");
|
|
@@ -3073,7 +4585,7 @@ var readCoverageJson = async (jsonPath) => {
|
|
|
3073
4585
|
}
|
|
3074
4586
|
};
|
|
3075
4587
|
var filterCoverageMap = (map, opts) => {
|
|
3076
|
-
const picomatchFn =
|
|
4588
|
+
const picomatchFn = import_picomatch.default;
|
|
3077
4589
|
const makeMatcher = (globs) => globs.length === 0 ? () => true : picomatchFn(globs, { dot: true, nocase: true });
|
|
3078
4590
|
const includeMatch = makeMatcher(opts.includes.length ? opts.includes : ["**/*"]);
|
|
3079
4591
|
const excludeMatch = makeMatcher(opts.excludes);
|
|
@@ -5067,13 +6579,16 @@ init_args();
|
|
|
5067
6579
|
import * as path9 from "node:path";
|
|
5068
6580
|
import * as os2 from "node:os";
|
|
5069
6581
|
import * as fsSync3 from "node:fs";
|
|
5070
|
-
import {
|
|
6582
|
+
import { createCoverageMap as createCoverageMap2 } from "istanbul-lib-coverage";
|
|
5071
6583
|
import * as fs5 from "node:fs/promises";
|
|
5072
6584
|
import * as LibReport from "istanbul-lib-report";
|
|
5073
6585
|
import * as Reports from "istanbul-reports";
|
|
5074
6586
|
var jestBin = "./node_modules/.bin/jest";
|
|
5075
6587
|
var babelNodeBin = "./node_modules/.bin/babel-node";
|
|
5076
|
-
var
|
|
6588
|
+
var moduleSpecifierForRequire = (
|
|
6589
|
+
// @ts-ignore
|
|
6590
|
+
typeof __filename !== "undefined" ? __filename : import.meta.url
|
|
6591
|
+
);
|
|
5077
6592
|
var registerSignalHandlersOnce = () => {
|
|
5078
6593
|
let handled = false;
|
|
5079
6594
|
const on = (sig) => {
|
|
@@ -5089,9 +6604,7 @@ Received ${sig}, exiting...
|
|
|
5089
6604
|
process.once("SIGINT", on);
|
|
5090
6605
|
process.once("SIGTERM", on);
|
|
5091
6606
|
};
|
|
5092
|
-
var isDebug = () => Boolean(
|
|
5093
|
-
process.env.TEST_CLI_DEBUG
|
|
5094
|
-
);
|
|
6607
|
+
var isDebug = () => Boolean(process.env.TEST_CLI_DEBUG);
|
|
5095
6608
|
var mergeLcov = async () => {
|
|
5096
6609
|
const jestLcovPath = "coverage/jest/lcov.info";
|
|
5097
6610
|
const vitestLcovPath = "coverage/vitest/lcov.info";
|
|
@@ -5149,24 +6662,17 @@ var emitMergedCoverage = async (ui, opts) => {
|
|
|
5149
6662
|
if (isDebug()) {
|
|
5150
6663
|
console.info(`Decoded coverage entries \u2192 jest: ${jestFilesCount}`);
|
|
5151
6664
|
}
|
|
5152
|
-
const { createCoverageMap: createCoverageMap2 } = requireCjs(
|
|
5153
|
-
"istanbul-lib-coverage"
|
|
5154
|
-
);
|
|
5155
6665
|
const map = createCoverageMap2({});
|
|
5156
6666
|
if (jestFilesCount > 0) {
|
|
5157
6667
|
try {
|
|
5158
6668
|
map.merge(jestData);
|
|
5159
6669
|
} catch (mergeJestError) {
|
|
5160
|
-
console.warn(
|
|
5161
|
-
`Failed merging jest coverage JSON: ${String(mergeJestError)}`
|
|
5162
|
-
);
|
|
6670
|
+
console.warn(`Failed merging jest coverage JSON: ${String(mergeJestError)}`);
|
|
5163
6671
|
}
|
|
5164
6672
|
}
|
|
5165
6673
|
if (map.files().length === 0) {
|
|
5166
6674
|
if (isDebug()) {
|
|
5167
|
-
console.info(
|
|
5168
|
-
"No JSON coverage to merge; skipping merged coverage print."
|
|
5169
|
-
);
|
|
6675
|
+
console.info("No JSON coverage to merge; skipping merged coverage print.");
|
|
5170
6676
|
}
|
|
5171
6677
|
return;
|
|
5172
6678
|
}
|
|
@@ -5194,18 +6700,12 @@ var emitMergedCoverage = async (ui, opts) => {
|
|
|
5194
6700
|
}
|
|
5195
6701
|
let changedFilesOutput = [];
|
|
5196
6702
|
try {
|
|
5197
|
-
const out = await runText(
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
{
|
|
5201
|
-
env: safeEnv(process.env, {})
|
|
5202
|
-
}
|
|
5203
|
-
);
|
|
6703
|
+
const out = await runText("git", ["diff", "--name-only", "--diff-filter=ACMRTUXB", "HEAD"], {
|
|
6704
|
+
env: safeEnv(process.env, {})
|
|
6705
|
+
});
|
|
5204
6706
|
changedFilesOutput = out.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((filePathText) => filePathText.replace(/\\/g, "/"));
|
|
5205
6707
|
} catch (gitError) {
|
|
5206
|
-
console.warn(
|
|
5207
|
-
`git diff failed when deriving changed files: ${String(gitError)}`
|
|
5208
|
-
);
|
|
6708
|
+
console.warn(`git diff failed when deriving changed files: ${String(gitError)}`);
|
|
5209
6709
|
}
|
|
5210
6710
|
await printPerFileCompositeTables({
|
|
5211
6711
|
map: filteredMap,
|
|
@@ -5242,18 +6742,15 @@ var emitMergedCoverage = async (ui, opts) => {
|
|
|
5242
6742
|
return `${colorize(label)}${sep}${colorize(`${num}${pct}`)}`;
|
|
5243
6743
|
}
|
|
5244
6744
|
);
|
|
5245
|
-
return updated.replace(
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
const
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
return colorize(`( ${coveredText}/${totalText} )`);
|
|
5255
|
-
}
|
|
5256
|
-
);
|
|
6745
|
+
return updated.replace(/\(\s*(\d+)\s*\/\s*(\d+)\s*\)/, (_match, coveredText, totalText) => {
|
|
6746
|
+
const percent = (() => {
|
|
6747
|
+
const totalCount = Number(totalText);
|
|
6748
|
+
const coveredCount = Number(coveredText);
|
|
6749
|
+
return totalCount > 0 ? coveredCount / totalCount * 100 : 0;
|
|
6750
|
+
})();
|
|
6751
|
+
const colorize = tintPct(percent);
|
|
6752
|
+
return colorize(`( ${coveredText}/${totalText} )`);
|
|
6753
|
+
});
|
|
5257
6754
|
}
|
|
5258
6755
|
if (lineText.includes("|")) {
|
|
5259
6756
|
const parts = lineText.split("|");
|
|
@@ -5289,11 +6786,7 @@ var emitMergedCoverage = async (ui, opts) => {
|
|
|
5289
6786
|
reporter.execute(context);
|
|
5290
6787
|
}
|
|
5291
6788
|
const textPath = path9.resolve("coverage", "merged", "coverage.txt");
|
|
5292
|
-
const summaryPath = path9.resolve(
|
|
5293
|
-
"coverage",
|
|
5294
|
-
"merged",
|
|
5295
|
-
"coverage-summary.txt"
|
|
5296
|
-
);
|
|
6789
|
+
const summaryPath = path9.resolve("coverage", "merged", "coverage-summary.txt");
|
|
5297
6790
|
const filesToPrint = [];
|
|
5298
6791
|
if (fsSync3.existsSync(textPath)) {
|
|
5299
6792
|
filesToPrint.push(textPath);
|
|
@@ -5377,9 +6870,7 @@ var program = async () => {
|
|
|
5377
6870
|
coverageMaxHotspots: coverageMaxHotspotsArg,
|
|
5378
6871
|
coveragePageFit
|
|
5379
6872
|
} = deriveArgs(argv);
|
|
5380
|
-
console.info(
|
|
5381
|
-
`Selection \u2192 specified=${selectionSpecified} paths=${selectionPaths.length}`
|
|
5382
|
-
);
|
|
6873
|
+
console.info(`Selection \u2192 specified=${selectionSpecified} paths=${selectionPaths.length}`);
|
|
5383
6874
|
const { jest } = argsForDiscovery(["run"], jestArgs);
|
|
5384
6875
|
const selectionLooksLikeTest = selectionPaths.some(
|
|
5385
6876
|
(pathText) => /\.(test|spec)\.[tj]sx?$/i.test(pathText) || /(^|\/)tests?\//i.test(pathText)
|
|
@@ -5469,12 +6960,9 @@ var program = async () => {
|
|
|
5469
6960
|
const prodSelections2 = expandedProdSelections;
|
|
5470
6961
|
for (const cfg of projectConfigs) {
|
|
5471
6962
|
const cfgCwd = path9.dirname(cfg);
|
|
5472
|
-
const allTests = await discoverJestResilient(
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
cwd: cfgCwd
|
|
5476
|
-
}
|
|
5477
|
-
);
|
|
6963
|
+
const allTests = await discoverJestResilient([...jestDiscoveryArgs, "--config", cfg], {
|
|
6964
|
+
cwd: cfgCwd
|
|
6965
|
+
});
|
|
5478
6966
|
let directPerProject = [];
|
|
5479
6967
|
try {
|
|
5480
6968
|
directPerProject = await selectDirectTestsForProduction({
|
|
@@ -5484,11 +6972,7 @@ var program = async () => {
|
|
|
5484
6972
|
});
|
|
5485
6973
|
} catch (err) {
|
|
5486
6974
|
if (isDebug()) {
|
|
5487
|
-
console.warn(
|
|
5488
|
-
`direct selection failed for project ${path9.basename(
|
|
5489
|
-
cfg
|
|
5490
|
-
)}: ${String(err)}`
|
|
5491
|
-
);
|
|
6975
|
+
console.warn(`direct selection failed for project ${path9.basename(cfg)}: ${String(err)}`);
|
|
5492
6976
|
}
|
|
5493
6977
|
}
|
|
5494
6978
|
perProjectFiles.set(cfg, directPerProject);
|
|
@@ -5501,12 +6985,9 @@ var program = async () => {
|
|
|
5501
6985
|
);
|
|
5502
6986
|
for (const cfg of projectConfigs) {
|
|
5503
6987
|
const cfgCwd = path9.dirname(cfg);
|
|
5504
|
-
const files = await discoverJestResilient(
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
cwd: cfgCwd
|
|
5508
|
-
}
|
|
5509
|
-
);
|
|
6988
|
+
const files = await discoverJestResilient([...jestDiscoveryArgs, "--config", cfg], {
|
|
6989
|
+
cwd: cfgCwd
|
|
6990
|
+
});
|
|
5510
6991
|
perProjectFiles.set(cfg, files);
|
|
5511
6992
|
}
|
|
5512
6993
|
}
|
|
@@ -5529,20 +7010,14 @@ var program = async () => {
|
|
|
5529
7010
|
perProjectFiltered.set(cfg, onlyOwned);
|
|
5530
7011
|
}
|
|
5531
7012
|
let jestFiles = Array.from(perProjectFiltered.values()).flat();
|
|
5532
|
-
console.info(
|
|
5533
|
-
`Discovery results \u2192 jest=${jestFiles.length} (projects=${projectConfigs.length})`
|
|
5534
|
-
);
|
|
7013
|
+
console.info(`Discovery results \u2192 jest=${jestFiles.length} (projects=${projectConfigs.length})`);
|
|
5535
7014
|
const looksLikeTestPath = (candidatePath) => /\.(test|spec)\.[tj]sx?$/i.test(candidatePath) || /(^|\/)tests?\//i.test(candidatePath);
|
|
5536
7015
|
const prodSelections = expandedProdSelections;
|
|
5537
7016
|
let effectiveJestFiles = jestFiles.slice();
|
|
5538
7017
|
if (selectionHasPaths && prodSelections.length > 0) {
|
|
5539
|
-
console.info(
|
|
5540
|
-
`rg related \u2192 prodSelections=${prodSelections.length} (starting)`
|
|
5541
|
-
);
|
|
7018
|
+
console.info(`rg related \u2192 prodSelections=${prodSelections.length} (starting)`);
|
|
5542
7019
|
const repoRootForRefinement = workspaceRoot ?? await findRepoRoot();
|
|
5543
|
-
const selectionKey = prodSelections.map(
|
|
5544
|
-
(absPath) => path9.relative(repoRootForRefinement, absPath).replace(/\\/g, "/")
|
|
5545
|
-
).sort((a, b) => a.localeCompare(b)).join("|");
|
|
7020
|
+
const selectionKey = prodSelections.map((absPath) => path9.relative(repoRootForRefinement, absPath).replace(/\\/g, "/")).sort((a, b) => a.localeCompare(b)).join("|");
|
|
5546
7021
|
const { cachedRelated: cachedRelated2, findRelatedTestsFast: findRelatedTestsFast2, DEFAULT_TEST_GLOBS: DEFAULT_TEST_GLOBS2 } = await Promise.resolve().then(() => (init_fast_related(), fast_related_exports));
|
|
5547
7022
|
const { DEFAULT_EXCLUDE: DEFAULT_EXCLUDE2 } = await Promise.resolve().then(() => (init_args(), args_exports));
|
|
5548
7023
|
const rgMatches = await cachedRelated2({
|
|
@@ -5561,12 +7036,8 @@ var program = async () => {
|
|
|
5561
7036
|
const normalizedCandidates = rgMatches.map(
|
|
5562
7037
|
(candidatePath) => candidatePath.replace(/\\/g, "/")
|
|
5563
7038
|
);
|
|
5564
|
-
normalizedCandidates.forEach(
|
|
5565
|
-
|
|
5566
|
-
);
|
|
5567
|
-
const rgSet = new Set(
|
|
5568
|
-
rgMatches.map((candidate) => candidate.replace(/\\/g, "/"))
|
|
5569
|
-
);
|
|
7039
|
+
normalizedCandidates.forEach((candidatePath) => console.info(` - ${candidatePath}`));
|
|
7040
|
+
const rgSet = new Set(rgMatches.map((candidate) => candidate.replace(/\\/g, "/")));
|
|
5570
7041
|
if (rgSet.size > 0) {
|
|
5571
7042
|
if (selectionIncludesProdPaths) {
|
|
5572
7043
|
const rgCandidates = Array.from(rgSet);
|
|
@@ -5596,9 +7067,7 @@ var program = async () => {
|
|
|
5596
7067
|
const base = path9.basename(withoutExt);
|
|
5597
7068
|
const segs = withoutExt.split("/");
|
|
5598
7069
|
const tail2 = segs.slice(-2).join("/");
|
|
5599
|
-
return Array.from(
|
|
5600
|
-
new Set([withoutExt, base, tail2].filter(Boolean))
|
|
5601
|
-
);
|
|
7070
|
+
return Array.from(new Set([withoutExt, base, tail2].filter(Boolean)));
|
|
5602
7071
|
};
|
|
5603
7072
|
const seeds = Array.from(new Set(prodSelections.flatMap(toSeeds)));
|
|
5604
7073
|
const includesSeed = (text) => seeds.some((seed) => text.includes(seed));
|
|
@@ -5705,9 +7174,7 @@ var program = async () => {
|
|
|
5705
7174
|
).flatMap((rel) => {
|
|
5706
7175
|
const base = path9.basename(rel);
|
|
5707
7176
|
const segments = rel.split("/");
|
|
5708
|
-
return Array.from(
|
|
5709
|
-
new Set([rel, base, segments.slice(-2).join("/")].filter(Boolean))
|
|
5710
|
-
);
|
|
7177
|
+
return Array.from(new Set([rel, base, segments.slice(-2).join("/")].filter(Boolean)));
|
|
5711
7178
|
});
|
|
5712
7179
|
const includesSeed = (text) => seeds.some((seed) => text.includes(seed));
|
|
5713
7180
|
const tryReadFile = async (absPath) => {
|
|
@@ -5720,17 +7187,7 @@ var program = async () => {
|
|
|
5720
7187
|
const resolveLocalImport = (fromFile, spec) => {
|
|
5721
7188
|
const baseDir = path9.dirname(fromFile);
|
|
5722
7189
|
const candidate = path9.resolve(baseDir, spec);
|
|
5723
|
-
const extensions = [
|
|
5724
|
-
"",
|
|
5725
|
-
".ts",
|
|
5726
|
-
".tsx",
|
|
5727
|
-
".js",
|
|
5728
|
-
".jsx",
|
|
5729
|
-
".mjs",
|
|
5730
|
-
".cjs",
|
|
5731
|
-
".mts",
|
|
5732
|
-
".cts"
|
|
5733
|
-
];
|
|
7190
|
+
const extensions = ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
|
|
5734
7191
|
for (const ext of extensions) {
|
|
5735
7192
|
const fullPath = ext ? `${candidate}${ext}` : candidate;
|
|
5736
7193
|
if (fsSync3.existsSync(fullPath)) {
|
|
@@ -5853,9 +7310,7 @@ var program = async () => {
|
|
|
5853
7310
|
if (jestKept.length) {
|
|
5854
7311
|
effectiveJestFiles = jestKept;
|
|
5855
7312
|
}
|
|
5856
|
-
console.info(
|
|
5857
|
-
`fallback refine (transitive) \u2192 jest=${effectiveJestFiles.length}`
|
|
5858
|
-
);
|
|
7313
|
+
console.info(`fallback refine (transitive) \u2192 jest=${effectiveJestFiles.length}`);
|
|
5859
7314
|
}
|
|
5860
7315
|
}
|
|
5861
7316
|
const jestDecision = decideShouldRunJest([], effectiveJestFiles, {
|
|
@@ -5868,21 +7323,15 @@ var program = async () => {
|
|
|
5868
7323
|
const msg = shouldRunJest ? `Jest selected (${sharePct}% of discovered tests; reason: ${jestDecision.reason})` : `Skipping Jest (${sharePct}% of discovered tests; reason: ${jestDecision.reason})`;
|
|
5869
7324
|
console.info(`Discovery \u2192 jest: ${jestCount}. ${msg}`);
|
|
5870
7325
|
if (!shouldRunJest) {
|
|
5871
|
-
console.warn(
|
|
5872
|
-
|
|
5873
|
-
);
|
|
5874
|
-
console.info(
|
|
5875
|
-
`Jest args: ${[...jestDiscoveryArgs, "--listTests"].join(" ")}`
|
|
5876
|
-
);
|
|
7326
|
+
console.warn("No matching tests were discovered for either Vitest or Jest.");
|
|
7327
|
+
console.info(`Jest args: ${[...jestDiscoveryArgs, "--listTests"].join(" ")}`);
|
|
5877
7328
|
console.info(
|
|
5878
7329
|
"Tip: check your -t/--testNamePattern and file path; Jest lists files selected by your patterns."
|
|
5879
7330
|
);
|
|
5880
7331
|
process.exit(1);
|
|
5881
7332
|
return;
|
|
5882
7333
|
}
|
|
5883
|
-
console.info(
|
|
5884
|
-
`Run plan \u2192 Jest maybe=${shouldRunJest} (projects=${projectConfigs.length})`
|
|
5885
|
-
);
|
|
7334
|
+
console.info(`Run plan \u2192 Jest maybe=${shouldRunJest} (projects=${projectConfigs.length})`);
|
|
5886
7335
|
let jestExitCode = 0;
|
|
5887
7336
|
const executedTestFilesSet = /* @__PURE__ */ new Set();
|
|
5888
7337
|
if (shouldRunJest) {
|
|
@@ -5895,9 +7344,7 @@ var program = async () => {
|
|
|
5895
7344
|
const totalProjectsToRun = projectsToRun.length;
|
|
5896
7345
|
const stripFooter = (text) => {
|
|
5897
7346
|
const lines = text.split("\n");
|
|
5898
|
-
const idx = lines.findIndex(
|
|
5899
|
-
(ln) => /^Test Files\s/.test(stripAnsiSimple(ln))
|
|
5900
|
-
);
|
|
7347
|
+
const idx = lines.findIndex((ln) => /^Test Files\s/.test(stripAnsiSimple(ln)));
|
|
5901
7348
|
return idx >= 0 ? lines.slice(0, idx).join("\n").trimEnd() : text;
|
|
5902
7349
|
};
|
|
5903
7350
|
for (let projIndex = 0; projIndex < projectsToRun.length; projIndex += 1) {
|
|
@@ -5905,11 +7352,7 @@ var program = async () => {
|
|
|
5905
7352
|
const isLastProject = projIndex === totalProjectsToRun - 1;
|
|
5906
7353
|
const files = perProjectFiltered.get(cfg) ?? [];
|
|
5907
7354
|
if (files.length === 0) {
|
|
5908
|
-
console.info(
|
|
5909
|
-
`Project ${path9.basename(
|
|
5910
|
-
cfg
|
|
5911
|
-
)}: 0 matching tests after filter; skipping.`
|
|
5912
|
-
);
|
|
7355
|
+
console.info(`Project ${path9.basename(cfg)}: 0 matching tests after filter; skipping.`);
|
|
5913
7356
|
continue;
|
|
5914
7357
|
}
|
|
5915
7358
|
files.forEach(
|
|
@@ -5923,22 +7366,12 @@ var program = async () => {
|
|
|
5923
7366
|
try {
|
|
5924
7367
|
if (!fsSync3.existsSync(reporterPath)) {
|
|
5925
7368
|
fsSync3.mkdirSync(path9.dirname(reporterPath), { recursive: true });
|
|
5926
|
-
fsSync3.writeFileSync(
|
|
5927
|
-
reporterPath,
|
|
5928
|
-
JEST_BRIDGE_REPORTER_SOURCE,
|
|
5929
|
-
"utf8"
|
|
5930
|
-
);
|
|
7369
|
+
fsSync3.writeFileSync(reporterPath, JEST_BRIDGE_REPORTER_SOURCE, "utf8");
|
|
5931
7370
|
}
|
|
5932
7371
|
} catch (ensureReporterError) {
|
|
5933
|
-
console.warn(
|
|
5934
|
-
`Unable to ensure jest bridge reporter: ${String(
|
|
5935
|
-
ensureReporterError
|
|
5936
|
-
)}`
|
|
5937
|
-
);
|
|
7372
|
+
console.warn(`Unable to ensure jest bridge reporter: ${String(ensureReporterError)}`);
|
|
5938
7373
|
}
|
|
5939
|
-
const selectedFilesForCoverage = selectionPaths.filter((pathToken) => /[\\/]/.test(pathToken)).filter((pathToken) => !looksLikeTestPath(pathToken)).map(
|
|
5940
|
-
(pathToken) => path9.relative(repoRootForDiscovery, pathToken).replace(/\\\\/g, "/")
|
|
5941
|
-
).filter((rel) => rel && !/^\.+\//.test(rel)).map((rel) => rel.startsWith("./") ? rel : `./${rel}`);
|
|
7374
|
+
const selectedFilesForCoverage = selectionPaths.filter((pathToken) => /[\\/]/.test(pathToken)).filter((pathToken) => !looksLikeTestPath(pathToken)).map((pathToken) => path9.relative(repoRootForDiscovery, pathToken).replace(/\\\\/g, "/")).filter((rel) => rel && !/^\.+\//.test(rel)).map((rel) => rel.startsWith("./") ? rel : `./${rel}`);
|
|
5942
7375
|
const coverageFromArgs = [];
|
|
5943
7376
|
for (const relPath of selectedFilesForCoverage) {
|
|
5944
7377
|
coverageFromArgs.push("--collectCoverageFrom", relPath);
|
|
@@ -5991,21 +7424,15 @@ var program = async () => {
|
|
|
5991
7424
|
});
|
|
5992
7425
|
if (debug) {
|
|
5993
7426
|
const preview = pretty.split("\n").slice(0, 3).join("\n");
|
|
5994
|
-
console.info(
|
|
5995
|
-
|
|
5996
|
-
${preview}${pretty.includes("\n") ? "\n\u2026" : ""}`
|
|
5997
|
-
);
|
|
7427
|
+
console.info(`pretty preview (json):
|
|
7428
|
+
${preview}${pretty.includes("\n") ? "\n\u2026" : ""}`);
|
|
5998
7429
|
}
|
|
5999
7430
|
} catch (jsonErr) {
|
|
6000
7431
|
const debug = isDebug();
|
|
6001
7432
|
if (debug) {
|
|
6002
|
-
console.info(
|
|
6003
|
-
"renderer: fallback to text prettifier (missing/invalid JSON)"
|
|
6004
|
-
);
|
|
7433
|
+
console.info("renderer: fallback to text prettifier (missing/invalid JSON)");
|
|
6005
7434
|
console.info(String(jsonErr));
|
|
6006
|
-
console.info(
|
|
6007
|
-
`fallback: raw output lines=${output.split(/\r?\n/).length}`
|
|
6008
|
-
);
|
|
7435
|
+
console.info(`fallback: raw output lines=${output.split(/\r?\n/).length}`);
|
|
6009
7436
|
}
|
|
6010
7437
|
const renderOpts = {
|
|
6011
7438
|
cwd: repoRootForDiscovery,
|
|
@@ -6014,10 +7441,8 @@ ${preview}${pretty.includes("\n") ? "\n\u2026" : ""}`
|
|
|
6014
7441
|
pretty = formatJestOutputVitest(output, renderOpts);
|
|
6015
7442
|
if (debug) {
|
|
6016
7443
|
const preview = pretty.split("\n").slice(0, 3).join("\n");
|
|
6017
|
-
console.info(
|
|
6018
|
-
|
|
6019
|
-
${preview}${pretty.includes("\n") ? "\n\u2026" : ""}`
|
|
6020
|
-
);
|
|
7444
|
+
console.info(`pretty preview (text):
|
|
7445
|
+
${preview}${pretty.includes("\n") ? "\n\u2026" : ""}`);
|
|
6021
7446
|
}
|
|
6022
7447
|
}
|
|
6023
7448
|
if (!isLastProject) {
|