@soda-gql/builder 0.11.25 → 0.12.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/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/plugin-support.cjs +1 -1
- package/dist/plugin-support.mjs +1 -1
- package/dist/{service-CTPXWB87.mjs → service-CqUHXFUE.mjs} +1975 -76
- package/dist/service-CqUHXFUE.mjs.map +1 -0
- package/dist/service-Do9da7Cm.d.mts.map +1 -1
- package/dist/{service-DL0gEZWQ.cjs → service-acu0uwVA.cjs} +1885 -14
- package/dist/service-acu0uwVA.cjs.map +1 -0
- package/dist/service-vzMbq7Pe.d.cts.map +1 -1
- package/package.json +14 -11
- package/dist/service-CTPXWB87.mjs.map +0 -1
- package/dist/service-DL0gEZWQ.cjs.map +0 -1
|
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
8
9
|
var __copyProps = (to, from, except, desc) => {
|
|
9
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
11
|
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
@@ -1367,11 +1368,12 @@ const generateIntermediateModules = function* ({ analyses, targetFiles, graphqlS
|
|
|
1367
1368
|
hash.update(transpiledCode);
|
|
1368
1369
|
const contentHash = hash.digest("hex");
|
|
1369
1370
|
const canonicalIds = analysis.definitions.map((definition) => definition.canonicalId);
|
|
1371
|
+
const shouldKeepSource = !!process.env.DEBUG_INTERMEDIATE_MODULE;
|
|
1370
1372
|
yield {
|
|
1371
1373
|
filePath,
|
|
1372
1374
|
canonicalIds,
|
|
1373
|
-
sourceCode,
|
|
1374
|
-
transpiledCode,
|
|
1375
|
+
sourceCode: shouldKeepSource ? sourceCode : "",
|
|
1376
|
+
transpiledCode: "",
|
|
1375
1377
|
contentHash,
|
|
1376
1378
|
script
|
|
1377
1379
|
};
|
|
@@ -1966,8 +1968,9 @@ const collectAllDefinitions$1 = ({ module: module$1, gqlIdentifiers, imports: _i
|
|
|
1966
1968
|
};
|
|
1967
1969
|
const expressionFromCall = (call) => {
|
|
1968
1970
|
const spanOffset = module$1.__spanOffset;
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
+
const converter = module$1.__spanConverter;
|
|
1972
|
+
let start = converter.byteOffsetToCharIndex(call.span.start - spanOffset);
|
|
1973
|
+
const end = converter.byteOffsetToCharIndex(call.span.end - spanOffset);
|
|
1971
1974
|
if (start > 0 && source[start] === "q" && source[start - 1] === "g" && source.slice(start, start + 3) === "ql.") {
|
|
1972
1975
|
start -= 1;
|
|
1973
1976
|
}
|
|
@@ -2130,8 +2133,9 @@ const collectAllDefinitions$1 = ({ module: module$1, gqlIdentifiers, imports: _i
|
|
|
2130
2133
|
* Get location from an SWC node span
|
|
2131
2134
|
*/
|
|
2132
2135
|
const getLocation$1 = (module$1, span) => {
|
|
2133
|
-
const
|
|
2134
|
-
const
|
|
2136
|
+
const converter = module$1.__spanConverter;
|
|
2137
|
+
const start = converter.byteOffsetToCharIndex(span.start - module$1.__spanOffset);
|
|
2138
|
+
const end = converter.byteOffsetToCharIndex(span.end - module$1.__spanOffset);
|
|
2135
2139
|
return {
|
|
2136
2140
|
start,
|
|
2137
2141
|
end
|
|
@@ -2364,10 +2368,12 @@ const swcAdapter = { analyze(input, helper) {
|
|
|
2364
2368
|
if (program.type !== "Module") {
|
|
2365
2369
|
return null;
|
|
2366
2370
|
}
|
|
2367
|
-
const
|
|
2371
|
+
const converter = (0, __soda_gql_common.createSwcSpanConverter)(input.source);
|
|
2372
|
+
const spanOffset = program.span.end - converter.byteLength + 1;
|
|
2368
2373
|
const swcModule = program;
|
|
2369
2374
|
swcModule.__filePath = input.filePath;
|
|
2370
2375
|
swcModule.__spanOffset = spanOffset;
|
|
2376
|
+
swcModule.__spanConverter = converter;
|
|
2371
2377
|
const gqlIdentifiers = collectGqlIdentifiers(swcModule, helper);
|
|
2372
2378
|
const imports = collectImports$1(swcModule);
|
|
2373
2379
|
const exports$1 = collectExports$1(swcModule);
|
|
@@ -3770,6 +3776,1856 @@ const discoverModulesAsync = async (options) => {
|
|
|
3770
3776
|
return (0, neverthrow.ok)(result.value);
|
|
3771
3777
|
};
|
|
3772
3778
|
|
|
3779
|
+
//#endregion
|
|
3780
|
+
//#region node_modules/picomatch/lib/constants.js
|
|
3781
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3782
|
+
const WIN_SLASH = "\\\\/";
|
|
3783
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
3784
|
+
/**
|
|
3785
|
+
* Posix glob regex
|
|
3786
|
+
*/
|
|
3787
|
+
const DOT_LITERAL = "\\.";
|
|
3788
|
+
const PLUS_LITERAL = "\\+";
|
|
3789
|
+
const QMARK_LITERAL = "\\?";
|
|
3790
|
+
const SLASH_LITERAL = "\\/";
|
|
3791
|
+
const ONE_CHAR = "(?=.)";
|
|
3792
|
+
const QMARK = "[^/]";
|
|
3793
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
3794
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
3795
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
3796
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
3797
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
3798
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
3799
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
3800
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
3801
|
+
const STAR = `${QMARK}*?`;
|
|
3802
|
+
const SEP = "/";
|
|
3803
|
+
const POSIX_CHARS = {
|
|
3804
|
+
DOT_LITERAL,
|
|
3805
|
+
PLUS_LITERAL,
|
|
3806
|
+
QMARK_LITERAL,
|
|
3807
|
+
SLASH_LITERAL,
|
|
3808
|
+
ONE_CHAR,
|
|
3809
|
+
QMARK,
|
|
3810
|
+
END_ANCHOR,
|
|
3811
|
+
DOTS_SLASH,
|
|
3812
|
+
NO_DOT,
|
|
3813
|
+
NO_DOTS,
|
|
3814
|
+
NO_DOT_SLASH,
|
|
3815
|
+
NO_DOTS_SLASH,
|
|
3816
|
+
QMARK_NO_DOT,
|
|
3817
|
+
STAR,
|
|
3818
|
+
START_ANCHOR,
|
|
3819
|
+
SEP
|
|
3820
|
+
};
|
|
3821
|
+
/**
|
|
3822
|
+
* Windows glob regex
|
|
3823
|
+
*/
|
|
3824
|
+
const WINDOWS_CHARS = {
|
|
3825
|
+
...POSIX_CHARS,
|
|
3826
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
3827
|
+
QMARK: WIN_NO_SLASH,
|
|
3828
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
3829
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
3830
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
3831
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
3832
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
3833
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
3834
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
3835
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
3836
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
3837
|
+
SEP: "\\"
|
|
3838
|
+
};
|
|
3839
|
+
/**
|
|
3840
|
+
* POSIX Bracket Regex
|
|
3841
|
+
*/
|
|
3842
|
+
const POSIX_REGEX_SOURCE$1 = {
|
|
3843
|
+
alnum: "a-zA-Z0-9",
|
|
3844
|
+
alpha: "a-zA-Z",
|
|
3845
|
+
ascii: "\\x00-\\x7F",
|
|
3846
|
+
blank: " \\t",
|
|
3847
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
3848
|
+
digit: "0-9",
|
|
3849
|
+
graph: "\\x21-\\x7E",
|
|
3850
|
+
lower: "a-z",
|
|
3851
|
+
print: "\\x20-\\x7E ",
|
|
3852
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
3853
|
+
space: " \\t\\r\\n\\v\\f",
|
|
3854
|
+
upper: "A-Z",
|
|
3855
|
+
word: "A-Za-z0-9_",
|
|
3856
|
+
xdigit: "A-Fa-f0-9"
|
|
3857
|
+
};
|
|
3858
|
+
module.exports = {
|
|
3859
|
+
MAX_LENGTH: 1024 * 64,
|
|
3860
|
+
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
3861
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
3862
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
3863
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
3864
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
3865
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
3866
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
3867
|
+
REPLACEMENTS: {
|
|
3868
|
+
__proto__: null,
|
|
3869
|
+
"***": "*",
|
|
3870
|
+
"**/**": "**",
|
|
3871
|
+
"**/**/**": "**"
|
|
3872
|
+
},
|
|
3873
|
+
CHAR_0: 48,
|
|
3874
|
+
CHAR_9: 57,
|
|
3875
|
+
CHAR_UPPERCASE_A: 65,
|
|
3876
|
+
CHAR_LOWERCASE_A: 97,
|
|
3877
|
+
CHAR_UPPERCASE_Z: 90,
|
|
3878
|
+
CHAR_LOWERCASE_Z: 122,
|
|
3879
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
3880
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
3881
|
+
CHAR_ASTERISK: 42,
|
|
3882
|
+
CHAR_AMPERSAND: 38,
|
|
3883
|
+
CHAR_AT: 64,
|
|
3884
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
3885
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
3886
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
3887
|
+
CHAR_COLON: 58,
|
|
3888
|
+
CHAR_COMMA: 44,
|
|
3889
|
+
CHAR_DOT: 46,
|
|
3890
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
3891
|
+
CHAR_EQUAL: 61,
|
|
3892
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
3893
|
+
CHAR_FORM_FEED: 12,
|
|
3894
|
+
CHAR_FORWARD_SLASH: 47,
|
|
3895
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
3896
|
+
CHAR_HASH: 35,
|
|
3897
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
3898
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
3899
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
3900
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
3901
|
+
CHAR_LINE_FEED: 10,
|
|
3902
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
3903
|
+
CHAR_PERCENT: 37,
|
|
3904
|
+
CHAR_PLUS: 43,
|
|
3905
|
+
CHAR_QUESTION_MARK: 63,
|
|
3906
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
3907
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
3908
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
3909
|
+
CHAR_SEMICOLON: 59,
|
|
3910
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
3911
|
+
CHAR_SPACE: 32,
|
|
3912
|
+
CHAR_TAB: 9,
|
|
3913
|
+
CHAR_UNDERSCORE: 95,
|
|
3914
|
+
CHAR_VERTICAL_LINE: 124,
|
|
3915
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
3916
|
+
extglobChars(chars) {
|
|
3917
|
+
return {
|
|
3918
|
+
"!": {
|
|
3919
|
+
type: "negate",
|
|
3920
|
+
open: "(?:(?!(?:",
|
|
3921
|
+
close: `))${chars.STAR})`
|
|
3922
|
+
},
|
|
3923
|
+
"?": {
|
|
3924
|
+
type: "qmark",
|
|
3925
|
+
open: "(?:",
|
|
3926
|
+
close: ")?"
|
|
3927
|
+
},
|
|
3928
|
+
"+": {
|
|
3929
|
+
type: "plus",
|
|
3930
|
+
open: "(?:",
|
|
3931
|
+
close: ")+"
|
|
3932
|
+
},
|
|
3933
|
+
"*": {
|
|
3934
|
+
type: "star",
|
|
3935
|
+
open: "(?:",
|
|
3936
|
+
close: ")*"
|
|
3937
|
+
},
|
|
3938
|
+
"@": {
|
|
3939
|
+
type: "at",
|
|
3940
|
+
open: "(?:",
|
|
3941
|
+
close: ")"
|
|
3942
|
+
}
|
|
3943
|
+
};
|
|
3944
|
+
},
|
|
3945
|
+
globChars(win32) {
|
|
3946
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
3947
|
+
}
|
|
3948
|
+
};
|
|
3949
|
+
}));
|
|
3950
|
+
|
|
3951
|
+
//#endregion
|
|
3952
|
+
//#region node_modules/picomatch/lib/utils.js
|
|
3953
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3954
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
3955
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
3956
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
3957
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
3958
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
3959
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
3960
|
+
exports.isWindows = () => {
|
|
3961
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
3962
|
+
const platform = navigator.platform.toLowerCase();
|
|
3963
|
+
return platform === "win32" || platform === "windows";
|
|
3964
|
+
}
|
|
3965
|
+
if (typeof process !== "undefined" && process.platform) {
|
|
3966
|
+
return process.platform === "win32";
|
|
3967
|
+
}
|
|
3968
|
+
return false;
|
|
3969
|
+
};
|
|
3970
|
+
exports.removeBackslashes = (str) => {
|
|
3971
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
3972
|
+
return match === "\\" ? "" : match;
|
|
3973
|
+
});
|
|
3974
|
+
};
|
|
3975
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
3976
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
3977
|
+
if (idx === -1) return input;
|
|
3978
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
3979
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
3980
|
+
};
|
|
3981
|
+
exports.removePrefix = (input, state = {}) => {
|
|
3982
|
+
let output = input;
|
|
3983
|
+
if (output.startsWith("./")) {
|
|
3984
|
+
output = output.slice(2);
|
|
3985
|
+
state.prefix = "./";
|
|
3986
|
+
}
|
|
3987
|
+
return output;
|
|
3988
|
+
};
|
|
3989
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
3990
|
+
const prepend = options.contains ? "" : "^";
|
|
3991
|
+
const append = options.contains ? "" : "$";
|
|
3992
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
3993
|
+
if (state.negated === true) {
|
|
3994
|
+
output = `(?:^(?!${output}).*$)`;
|
|
3995
|
+
}
|
|
3996
|
+
return output;
|
|
3997
|
+
};
|
|
3998
|
+
exports.basename = (path, { windows } = {}) => {
|
|
3999
|
+
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
4000
|
+
const last = segs[segs.length - 1];
|
|
4001
|
+
if (last === "") {
|
|
4002
|
+
return segs[segs.length - 2];
|
|
4003
|
+
}
|
|
4004
|
+
return last;
|
|
4005
|
+
};
|
|
4006
|
+
}));
|
|
4007
|
+
|
|
4008
|
+
//#endregion
|
|
4009
|
+
//#region node_modules/picomatch/lib/scan.js
|
|
4010
|
+
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4011
|
+
const utils$3 = require_utils();
|
|
4012
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
4013
|
+
const isPathSeparator = (code) => {
|
|
4014
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
4015
|
+
};
|
|
4016
|
+
const depth = (token) => {
|
|
4017
|
+
if (token.isPrefix !== true) {
|
|
4018
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
4019
|
+
}
|
|
4020
|
+
};
|
|
4021
|
+
/**
|
|
4022
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
4023
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
4024
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
4025
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
4026
|
+
*
|
|
4027
|
+
* ```js
|
|
4028
|
+
* const pm = require('picomatch');
|
|
4029
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
4030
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
4031
|
+
* ```
|
|
4032
|
+
* @param {String} `str`
|
|
4033
|
+
* @param {Object} `options`
|
|
4034
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
4035
|
+
* @api public
|
|
4036
|
+
*/
|
|
4037
|
+
const scan$1 = (input, options) => {
|
|
4038
|
+
const opts = options || {};
|
|
4039
|
+
const length = input.length - 1;
|
|
4040
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
4041
|
+
const slashes = [];
|
|
4042
|
+
const tokens = [];
|
|
4043
|
+
const parts = [];
|
|
4044
|
+
let str = input;
|
|
4045
|
+
let index = -1;
|
|
4046
|
+
let start = 0;
|
|
4047
|
+
let lastIndex = 0;
|
|
4048
|
+
let isBrace = false;
|
|
4049
|
+
let isBracket = false;
|
|
4050
|
+
let isGlob = false;
|
|
4051
|
+
let isExtglob = false;
|
|
4052
|
+
let isGlobstar = false;
|
|
4053
|
+
let braceEscaped = false;
|
|
4054
|
+
let backslashes = false;
|
|
4055
|
+
let negated = false;
|
|
4056
|
+
let negatedExtglob = false;
|
|
4057
|
+
let finished = false;
|
|
4058
|
+
let braces = 0;
|
|
4059
|
+
let prev;
|
|
4060
|
+
let code;
|
|
4061
|
+
let token = {
|
|
4062
|
+
value: "",
|
|
4063
|
+
depth: 0,
|
|
4064
|
+
isGlob: false
|
|
4065
|
+
};
|
|
4066
|
+
const eos = () => index >= length;
|
|
4067
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
4068
|
+
const advance = () => {
|
|
4069
|
+
prev = code;
|
|
4070
|
+
return str.charCodeAt(++index);
|
|
4071
|
+
};
|
|
4072
|
+
while (index < length) {
|
|
4073
|
+
code = advance();
|
|
4074
|
+
let next;
|
|
4075
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
4076
|
+
backslashes = token.backslashes = true;
|
|
4077
|
+
code = advance();
|
|
4078
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
4079
|
+
braceEscaped = true;
|
|
4080
|
+
}
|
|
4081
|
+
continue;
|
|
4082
|
+
}
|
|
4083
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
4084
|
+
braces++;
|
|
4085
|
+
while (eos() !== true && (code = advance())) {
|
|
4086
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
4087
|
+
backslashes = token.backslashes = true;
|
|
4088
|
+
advance();
|
|
4089
|
+
continue;
|
|
4090
|
+
}
|
|
4091
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
4092
|
+
braces++;
|
|
4093
|
+
continue;
|
|
4094
|
+
}
|
|
4095
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
4096
|
+
isBrace = token.isBrace = true;
|
|
4097
|
+
isGlob = token.isGlob = true;
|
|
4098
|
+
finished = true;
|
|
4099
|
+
if (scanToEnd === true) {
|
|
4100
|
+
continue;
|
|
4101
|
+
}
|
|
4102
|
+
break;
|
|
4103
|
+
}
|
|
4104
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
4105
|
+
isBrace = token.isBrace = true;
|
|
4106
|
+
isGlob = token.isGlob = true;
|
|
4107
|
+
finished = true;
|
|
4108
|
+
if (scanToEnd === true) {
|
|
4109
|
+
continue;
|
|
4110
|
+
}
|
|
4111
|
+
break;
|
|
4112
|
+
}
|
|
4113
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
4114
|
+
braces--;
|
|
4115
|
+
if (braces === 0) {
|
|
4116
|
+
braceEscaped = false;
|
|
4117
|
+
isBrace = token.isBrace = true;
|
|
4118
|
+
finished = true;
|
|
4119
|
+
break;
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
if (scanToEnd === true) {
|
|
4124
|
+
continue;
|
|
4125
|
+
}
|
|
4126
|
+
break;
|
|
4127
|
+
}
|
|
4128
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
4129
|
+
slashes.push(index);
|
|
4130
|
+
tokens.push(token);
|
|
4131
|
+
token = {
|
|
4132
|
+
value: "",
|
|
4133
|
+
depth: 0,
|
|
4134
|
+
isGlob: false
|
|
4135
|
+
};
|
|
4136
|
+
if (finished === true) continue;
|
|
4137
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
4138
|
+
start += 2;
|
|
4139
|
+
continue;
|
|
4140
|
+
}
|
|
4141
|
+
lastIndex = index + 1;
|
|
4142
|
+
continue;
|
|
4143
|
+
}
|
|
4144
|
+
if (opts.noext !== true) {
|
|
4145
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
4146
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
4147
|
+
isGlob = token.isGlob = true;
|
|
4148
|
+
isExtglob = token.isExtglob = true;
|
|
4149
|
+
finished = true;
|
|
4150
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
4151
|
+
negatedExtglob = true;
|
|
4152
|
+
}
|
|
4153
|
+
if (scanToEnd === true) {
|
|
4154
|
+
while (eos() !== true && (code = advance())) {
|
|
4155
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
4156
|
+
backslashes = token.backslashes = true;
|
|
4157
|
+
code = advance();
|
|
4158
|
+
continue;
|
|
4159
|
+
}
|
|
4160
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
4161
|
+
isGlob = token.isGlob = true;
|
|
4162
|
+
finished = true;
|
|
4163
|
+
break;
|
|
4164
|
+
}
|
|
4165
|
+
}
|
|
4166
|
+
continue;
|
|
4167
|
+
}
|
|
4168
|
+
break;
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
if (code === CHAR_ASTERISK) {
|
|
4172
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
4173
|
+
isGlob = token.isGlob = true;
|
|
4174
|
+
finished = true;
|
|
4175
|
+
if (scanToEnd === true) {
|
|
4176
|
+
continue;
|
|
4177
|
+
}
|
|
4178
|
+
break;
|
|
4179
|
+
}
|
|
4180
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
4181
|
+
isGlob = token.isGlob = true;
|
|
4182
|
+
finished = true;
|
|
4183
|
+
if (scanToEnd === true) {
|
|
4184
|
+
continue;
|
|
4185
|
+
}
|
|
4186
|
+
break;
|
|
4187
|
+
}
|
|
4188
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
4189
|
+
while (eos() !== true && (next = advance())) {
|
|
4190
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
4191
|
+
backslashes = token.backslashes = true;
|
|
4192
|
+
advance();
|
|
4193
|
+
continue;
|
|
4194
|
+
}
|
|
4195
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
4196
|
+
isBracket = token.isBracket = true;
|
|
4197
|
+
isGlob = token.isGlob = true;
|
|
4198
|
+
finished = true;
|
|
4199
|
+
break;
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
if (scanToEnd === true) {
|
|
4203
|
+
continue;
|
|
4204
|
+
}
|
|
4205
|
+
break;
|
|
4206
|
+
}
|
|
4207
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
4208
|
+
negated = token.negated = true;
|
|
4209
|
+
start++;
|
|
4210
|
+
continue;
|
|
4211
|
+
}
|
|
4212
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
4213
|
+
isGlob = token.isGlob = true;
|
|
4214
|
+
if (scanToEnd === true) {
|
|
4215
|
+
while (eos() !== true && (code = advance())) {
|
|
4216
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
4217
|
+
backslashes = token.backslashes = true;
|
|
4218
|
+
code = advance();
|
|
4219
|
+
continue;
|
|
4220
|
+
}
|
|
4221
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
4222
|
+
finished = true;
|
|
4223
|
+
break;
|
|
4224
|
+
}
|
|
4225
|
+
}
|
|
4226
|
+
continue;
|
|
4227
|
+
}
|
|
4228
|
+
break;
|
|
4229
|
+
}
|
|
4230
|
+
if (isGlob === true) {
|
|
4231
|
+
finished = true;
|
|
4232
|
+
if (scanToEnd === true) {
|
|
4233
|
+
continue;
|
|
4234
|
+
}
|
|
4235
|
+
break;
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
if (opts.noext === true) {
|
|
4239
|
+
isExtglob = false;
|
|
4240
|
+
isGlob = false;
|
|
4241
|
+
}
|
|
4242
|
+
let base = str;
|
|
4243
|
+
let prefix = "";
|
|
4244
|
+
let glob = "";
|
|
4245
|
+
if (start > 0) {
|
|
4246
|
+
prefix = str.slice(0, start);
|
|
4247
|
+
str = str.slice(start);
|
|
4248
|
+
lastIndex -= start;
|
|
4249
|
+
}
|
|
4250
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
4251
|
+
base = str.slice(0, lastIndex);
|
|
4252
|
+
glob = str.slice(lastIndex);
|
|
4253
|
+
} else if (isGlob === true) {
|
|
4254
|
+
base = "";
|
|
4255
|
+
glob = str;
|
|
4256
|
+
} else {
|
|
4257
|
+
base = str;
|
|
4258
|
+
}
|
|
4259
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
4260
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
4261
|
+
base = base.slice(0, -1);
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4264
|
+
if (opts.unescape === true) {
|
|
4265
|
+
if (glob) glob = utils$3.removeBackslashes(glob);
|
|
4266
|
+
if (base && backslashes === true) {
|
|
4267
|
+
base = utils$3.removeBackslashes(base);
|
|
4268
|
+
}
|
|
4269
|
+
}
|
|
4270
|
+
const state = {
|
|
4271
|
+
prefix,
|
|
4272
|
+
input,
|
|
4273
|
+
start,
|
|
4274
|
+
base,
|
|
4275
|
+
glob,
|
|
4276
|
+
isBrace,
|
|
4277
|
+
isBracket,
|
|
4278
|
+
isGlob,
|
|
4279
|
+
isExtglob,
|
|
4280
|
+
isGlobstar,
|
|
4281
|
+
negated,
|
|
4282
|
+
negatedExtglob
|
|
4283
|
+
};
|
|
4284
|
+
if (opts.tokens === true) {
|
|
4285
|
+
state.maxDepth = 0;
|
|
4286
|
+
if (!isPathSeparator(code)) {
|
|
4287
|
+
tokens.push(token);
|
|
4288
|
+
}
|
|
4289
|
+
state.tokens = tokens;
|
|
4290
|
+
}
|
|
4291
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
4292
|
+
let prevIndex;
|
|
4293
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
4294
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
4295
|
+
const i = slashes[idx];
|
|
4296
|
+
const value = input.slice(n, i);
|
|
4297
|
+
if (opts.tokens) {
|
|
4298
|
+
if (idx === 0 && start !== 0) {
|
|
4299
|
+
tokens[idx].isPrefix = true;
|
|
4300
|
+
tokens[idx].value = prefix;
|
|
4301
|
+
} else {
|
|
4302
|
+
tokens[idx].value = value;
|
|
4303
|
+
}
|
|
4304
|
+
depth(tokens[idx]);
|
|
4305
|
+
state.maxDepth += tokens[idx].depth;
|
|
4306
|
+
}
|
|
4307
|
+
if (idx !== 0 || value !== "") {
|
|
4308
|
+
parts.push(value);
|
|
4309
|
+
}
|
|
4310
|
+
prevIndex = i;
|
|
4311
|
+
}
|
|
4312
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
4313
|
+
const value = input.slice(prevIndex + 1);
|
|
4314
|
+
parts.push(value);
|
|
4315
|
+
if (opts.tokens) {
|
|
4316
|
+
tokens[tokens.length - 1].value = value;
|
|
4317
|
+
depth(tokens[tokens.length - 1]);
|
|
4318
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
state.slashes = slashes;
|
|
4322
|
+
state.parts = parts;
|
|
4323
|
+
}
|
|
4324
|
+
return state;
|
|
4325
|
+
};
|
|
4326
|
+
module.exports = scan$1;
|
|
4327
|
+
}));
|
|
4328
|
+
|
|
4329
|
+
//#endregion
|
|
4330
|
+
//#region node_modules/picomatch/lib/parse.js
|
|
4331
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4332
|
+
const constants$1 = require_constants();
|
|
4333
|
+
const utils$2 = require_utils();
|
|
4334
|
+
/**
|
|
4335
|
+
* Constants
|
|
4336
|
+
*/
|
|
4337
|
+
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
|
|
4338
|
+
/**
|
|
4339
|
+
* Helpers
|
|
4340
|
+
*/
|
|
4341
|
+
const expandRange = (args, options) => {
|
|
4342
|
+
if (typeof options.expandRange === "function") {
|
|
4343
|
+
return options.expandRange(...args, options);
|
|
4344
|
+
}
|
|
4345
|
+
args.sort();
|
|
4346
|
+
const value = `[${args.join("-")}]`;
|
|
4347
|
+
try {
|
|
4348
|
+
new RegExp(value);
|
|
4349
|
+
} catch (ex) {
|
|
4350
|
+
return args.map((v) => utils$2.escapeRegex(v)).join("..");
|
|
4351
|
+
}
|
|
4352
|
+
return value;
|
|
4353
|
+
};
|
|
4354
|
+
/**
|
|
4355
|
+
* Create the message for a syntax error
|
|
4356
|
+
*/
|
|
4357
|
+
const syntaxError = (type, char) => {
|
|
4358
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
4359
|
+
};
|
|
4360
|
+
/**
|
|
4361
|
+
* Parse the given input string.
|
|
4362
|
+
* @param {String} input
|
|
4363
|
+
* @param {Object} options
|
|
4364
|
+
* @return {Object}
|
|
4365
|
+
*/
|
|
4366
|
+
const parse$1 = (input, options) => {
|
|
4367
|
+
if (typeof input !== "string") {
|
|
4368
|
+
throw new TypeError("Expected a string");
|
|
4369
|
+
}
|
|
4370
|
+
input = REPLACEMENTS[input] || input;
|
|
4371
|
+
const opts = { ...options };
|
|
4372
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
4373
|
+
let len = input.length;
|
|
4374
|
+
if (len > max) {
|
|
4375
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
4376
|
+
}
|
|
4377
|
+
const bos = {
|
|
4378
|
+
type: "bos",
|
|
4379
|
+
value: "",
|
|
4380
|
+
output: opts.prepend || ""
|
|
4381
|
+
};
|
|
4382
|
+
const tokens = [bos];
|
|
4383
|
+
const capture = opts.capture ? "" : "?:";
|
|
4384
|
+
const PLATFORM_CHARS = constants$1.globChars(opts.windows);
|
|
4385
|
+
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
|
4386
|
+
const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOT_SLASH: NO_DOT_SLASH$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, QMARK: QMARK$1, QMARK_NO_DOT: QMARK_NO_DOT$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
|
|
4387
|
+
const globstar = (opts$1) => {
|
|
4388
|
+
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
4389
|
+
};
|
|
4390
|
+
const nodot = opts.dot ? "" : NO_DOT$1;
|
|
4391
|
+
const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT$1;
|
|
4392
|
+
let star = opts.bash === true ? globstar(opts) : STAR$1;
|
|
4393
|
+
if (opts.capture) {
|
|
4394
|
+
star = `(${star})`;
|
|
4395
|
+
}
|
|
4396
|
+
if (typeof opts.noext === "boolean") {
|
|
4397
|
+
opts.noextglob = opts.noext;
|
|
4398
|
+
}
|
|
4399
|
+
const state = {
|
|
4400
|
+
input,
|
|
4401
|
+
index: -1,
|
|
4402
|
+
start: 0,
|
|
4403
|
+
dot: opts.dot === true,
|
|
4404
|
+
consumed: "",
|
|
4405
|
+
output: "",
|
|
4406
|
+
prefix: "",
|
|
4407
|
+
backtrack: false,
|
|
4408
|
+
negated: false,
|
|
4409
|
+
brackets: 0,
|
|
4410
|
+
braces: 0,
|
|
4411
|
+
parens: 0,
|
|
4412
|
+
quotes: 0,
|
|
4413
|
+
globstar: false,
|
|
4414
|
+
tokens
|
|
4415
|
+
};
|
|
4416
|
+
input = utils$2.removePrefix(input, state);
|
|
4417
|
+
len = input.length;
|
|
4418
|
+
const extglobs = [];
|
|
4419
|
+
const braces = [];
|
|
4420
|
+
const stack = [];
|
|
4421
|
+
let prev = bos;
|
|
4422
|
+
let value;
|
|
4423
|
+
/**
|
|
4424
|
+
* Tokenizing helpers
|
|
4425
|
+
*/
|
|
4426
|
+
const eos = () => state.index === len - 1;
|
|
4427
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
4428
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
4429
|
+
const remaining = () => input.slice(state.index + 1);
|
|
4430
|
+
const consume = (value$1 = "", num = 0) => {
|
|
4431
|
+
state.consumed += value$1;
|
|
4432
|
+
state.index += num;
|
|
4433
|
+
};
|
|
4434
|
+
const append = (token) => {
|
|
4435
|
+
state.output += token.output != null ? token.output : token.value;
|
|
4436
|
+
consume(token.value);
|
|
4437
|
+
};
|
|
4438
|
+
const negate = () => {
|
|
4439
|
+
let count = 1;
|
|
4440
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
4441
|
+
advance();
|
|
4442
|
+
state.start++;
|
|
4443
|
+
count++;
|
|
4444
|
+
}
|
|
4445
|
+
if (count % 2 === 0) {
|
|
4446
|
+
return false;
|
|
4447
|
+
}
|
|
4448
|
+
state.negated = true;
|
|
4449
|
+
state.start++;
|
|
4450
|
+
return true;
|
|
4451
|
+
};
|
|
4452
|
+
const increment = (type) => {
|
|
4453
|
+
state[type]++;
|
|
4454
|
+
stack.push(type);
|
|
4455
|
+
};
|
|
4456
|
+
const decrement = (type) => {
|
|
4457
|
+
state[type]--;
|
|
4458
|
+
stack.pop();
|
|
4459
|
+
};
|
|
4460
|
+
/**
|
|
4461
|
+
* Push tokens onto the tokens array. This helper speeds up
|
|
4462
|
+
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
4463
|
+
* and 2) helping us avoid creating extra tokens when consecutive
|
|
4464
|
+
* characters are plain text. This improves performance and simplifies
|
|
4465
|
+
* lookbehinds.
|
|
4466
|
+
*/
|
|
4467
|
+
const push = (tok) => {
|
|
4468
|
+
if (prev.type === "globstar") {
|
|
4469
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
4470
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
4471
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
4472
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
4473
|
+
prev.type = "star";
|
|
4474
|
+
prev.value = "*";
|
|
4475
|
+
prev.output = star;
|
|
4476
|
+
state.output += prev.output;
|
|
4477
|
+
}
|
|
4478
|
+
}
|
|
4479
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
4480
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
4481
|
+
}
|
|
4482
|
+
if (tok.value || tok.output) append(tok);
|
|
4483
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
4484
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
4485
|
+
prev.value += tok.value;
|
|
4486
|
+
return;
|
|
4487
|
+
}
|
|
4488
|
+
tok.prev = prev;
|
|
4489
|
+
tokens.push(tok);
|
|
4490
|
+
prev = tok;
|
|
4491
|
+
};
|
|
4492
|
+
const extglobOpen = (type, value$1) => {
|
|
4493
|
+
const token = {
|
|
4494
|
+
...EXTGLOB_CHARS[value$1],
|
|
4495
|
+
conditions: 1,
|
|
4496
|
+
inner: ""
|
|
4497
|
+
};
|
|
4498
|
+
token.prev = prev;
|
|
4499
|
+
token.parens = state.parens;
|
|
4500
|
+
token.output = state.output;
|
|
4501
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
4502
|
+
increment("parens");
|
|
4503
|
+
push({
|
|
4504
|
+
type,
|
|
4505
|
+
value: value$1,
|
|
4506
|
+
output: state.output ? "" : ONE_CHAR$1
|
|
4507
|
+
});
|
|
4508
|
+
push({
|
|
4509
|
+
type: "paren",
|
|
4510
|
+
extglob: true,
|
|
4511
|
+
value: advance(),
|
|
4512
|
+
output
|
|
4513
|
+
});
|
|
4514
|
+
extglobs.push(token);
|
|
4515
|
+
};
|
|
4516
|
+
const extglobClose = (token) => {
|
|
4517
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
4518
|
+
let rest;
|
|
4519
|
+
if (token.type === "negate") {
|
|
4520
|
+
let extglobStar = star;
|
|
4521
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
4522
|
+
extglobStar = globstar(opts);
|
|
4523
|
+
}
|
|
4524
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
4525
|
+
output = token.close = `)$))${extglobStar}`;
|
|
4526
|
+
}
|
|
4527
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
4528
|
+
const expression = parse$1(rest, {
|
|
4529
|
+
...options,
|
|
4530
|
+
fastpaths: false
|
|
4531
|
+
}).output;
|
|
4532
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
4533
|
+
}
|
|
4534
|
+
if (token.prev.type === "bos") {
|
|
4535
|
+
state.negatedExtglob = true;
|
|
4536
|
+
}
|
|
4537
|
+
}
|
|
4538
|
+
push({
|
|
4539
|
+
type: "paren",
|
|
4540
|
+
extglob: true,
|
|
4541
|
+
value,
|
|
4542
|
+
output
|
|
4543
|
+
});
|
|
4544
|
+
decrement("parens");
|
|
4545
|
+
};
|
|
4546
|
+
/**
|
|
4547
|
+
* Fast paths
|
|
4548
|
+
*/
|
|
4549
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
4550
|
+
let backslashes = false;
|
|
4551
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
4552
|
+
if (first === "\\") {
|
|
4553
|
+
backslashes = true;
|
|
4554
|
+
return m;
|
|
4555
|
+
}
|
|
4556
|
+
if (first === "?") {
|
|
4557
|
+
if (esc) {
|
|
4558
|
+
return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
4559
|
+
}
|
|
4560
|
+
if (index === 0) {
|
|
4561
|
+
return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
4562
|
+
}
|
|
4563
|
+
return QMARK$1.repeat(chars.length);
|
|
4564
|
+
}
|
|
4565
|
+
if (first === ".") {
|
|
4566
|
+
return DOT_LITERAL$1.repeat(chars.length);
|
|
4567
|
+
}
|
|
4568
|
+
if (first === "*") {
|
|
4569
|
+
if (esc) {
|
|
4570
|
+
return esc + first + (rest ? star : "");
|
|
4571
|
+
}
|
|
4572
|
+
return star;
|
|
4573
|
+
}
|
|
4574
|
+
return esc ? m : `\\${m}`;
|
|
4575
|
+
});
|
|
4576
|
+
if (backslashes === true) {
|
|
4577
|
+
if (opts.unescape === true) {
|
|
4578
|
+
output = output.replace(/\\/g, "");
|
|
4579
|
+
} else {
|
|
4580
|
+
output = output.replace(/\\+/g, (m) => {
|
|
4581
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
4582
|
+
});
|
|
4583
|
+
}
|
|
4584
|
+
}
|
|
4585
|
+
if (output === input && opts.contains === true) {
|
|
4586
|
+
state.output = input;
|
|
4587
|
+
return state;
|
|
4588
|
+
}
|
|
4589
|
+
state.output = utils$2.wrapOutput(output, state, options);
|
|
4590
|
+
return state;
|
|
4591
|
+
}
|
|
4592
|
+
/**
|
|
4593
|
+
* Tokenize input until we reach end-of-string
|
|
4594
|
+
*/
|
|
4595
|
+
while (!eos()) {
|
|
4596
|
+
value = advance();
|
|
4597
|
+
if (value === "\0") {
|
|
4598
|
+
continue;
|
|
4599
|
+
}
|
|
4600
|
+
/**
|
|
4601
|
+
* Escaped characters
|
|
4602
|
+
*/
|
|
4603
|
+
if (value === "\\") {
|
|
4604
|
+
const next = peek();
|
|
4605
|
+
if (next === "/" && opts.bash !== true) {
|
|
4606
|
+
continue;
|
|
4607
|
+
}
|
|
4608
|
+
if (next === "." || next === ";") {
|
|
4609
|
+
continue;
|
|
4610
|
+
}
|
|
4611
|
+
if (!next) {
|
|
4612
|
+
value += "\\";
|
|
4613
|
+
push({
|
|
4614
|
+
type: "text",
|
|
4615
|
+
value
|
|
4616
|
+
});
|
|
4617
|
+
continue;
|
|
4618
|
+
}
|
|
4619
|
+
const match = /^\\+/.exec(remaining());
|
|
4620
|
+
let slashes = 0;
|
|
4621
|
+
if (match && match[0].length > 2) {
|
|
4622
|
+
slashes = match[0].length;
|
|
4623
|
+
state.index += slashes;
|
|
4624
|
+
if (slashes % 2 !== 0) {
|
|
4625
|
+
value += "\\";
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4628
|
+
if (opts.unescape === true) {
|
|
4629
|
+
value = advance();
|
|
4630
|
+
} else {
|
|
4631
|
+
value += advance();
|
|
4632
|
+
}
|
|
4633
|
+
if (state.brackets === 0) {
|
|
4634
|
+
push({
|
|
4635
|
+
type: "text",
|
|
4636
|
+
value
|
|
4637
|
+
});
|
|
4638
|
+
continue;
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
/**
|
|
4642
|
+
* If we're inside a regex character class, continue
|
|
4643
|
+
* until we reach the closing bracket.
|
|
4644
|
+
*/
|
|
4645
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
4646
|
+
if (opts.posix !== false && value === ":") {
|
|
4647
|
+
const inner = prev.value.slice(1);
|
|
4648
|
+
if (inner.includes("[")) {
|
|
4649
|
+
prev.posix = true;
|
|
4650
|
+
if (inner.includes(":")) {
|
|
4651
|
+
const idx = prev.value.lastIndexOf("[");
|
|
4652
|
+
const pre = prev.value.slice(0, idx);
|
|
4653
|
+
const rest$1 = prev.value.slice(idx + 2);
|
|
4654
|
+
const posix = POSIX_REGEX_SOURCE[rest$1];
|
|
4655
|
+
if (posix) {
|
|
4656
|
+
prev.value = pre + posix;
|
|
4657
|
+
state.backtrack = true;
|
|
4658
|
+
advance();
|
|
4659
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
4660
|
+
bos.output = ONE_CHAR$1;
|
|
4661
|
+
}
|
|
4662
|
+
continue;
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
4668
|
+
value = `\\${value}`;
|
|
4669
|
+
}
|
|
4670
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
4671
|
+
value = `\\${value}`;
|
|
4672
|
+
}
|
|
4673
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
4674
|
+
value = "^";
|
|
4675
|
+
}
|
|
4676
|
+
prev.value += value;
|
|
4677
|
+
append({ value });
|
|
4678
|
+
continue;
|
|
4679
|
+
}
|
|
4680
|
+
/**
|
|
4681
|
+
* If we're inside a quoted string, continue
|
|
4682
|
+
* until we reach the closing double quote.
|
|
4683
|
+
*/
|
|
4684
|
+
if (state.quotes === 1 && value !== "\"") {
|
|
4685
|
+
value = utils$2.escapeRegex(value);
|
|
4686
|
+
prev.value += value;
|
|
4687
|
+
append({ value });
|
|
4688
|
+
continue;
|
|
4689
|
+
}
|
|
4690
|
+
/**
|
|
4691
|
+
* Double quotes
|
|
4692
|
+
*/
|
|
4693
|
+
if (value === "\"") {
|
|
4694
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
4695
|
+
if (opts.keepQuotes === true) {
|
|
4696
|
+
push({
|
|
4697
|
+
type: "text",
|
|
4698
|
+
value
|
|
4699
|
+
});
|
|
4700
|
+
}
|
|
4701
|
+
continue;
|
|
4702
|
+
}
|
|
4703
|
+
/**
|
|
4704
|
+
* Parentheses
|
|
4705
|
+
*/
|
|
4706
|
+
if (value === "(") {
|
|
4707
|
+
increment("parens");
|
|
4708
|
+
push({
|
|
4709
|
+
type: "paren",
|
|
4710
|
+
value
|
|
4711
|
+
});
|
|
4712
|
+
continue;
|
|
4713
|
+
}
|
|
4714
|
+
if (value === ")") {
|
|
4715
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
4716
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
4717
|
+
}
|
|
4718
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
4719
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
4720
|
+
extglobClose(extglobs.pop());
|
|
4721
|
+
continue;
|
|
4722
|
+
}
|
|
4723
|
+
push({
|
|
4724
|
+
type: "paren",
|
|
4725
|
+
value,
|
|
4726
|
+
output: state.parens ? ")" : "\\)"
|
|
4727
|
+
});
|
|
4728
|
+
decrement("parens");
|
|
4729
|
+
continue;
|
|
4730
|
+
}
|
|
4731
|
+
/**
|
|
4732
|
+
* Square brackets
|
|
4733
|
+
*/
|
|
4734
|
+
if (value === "[") {
|
|
4735
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
4736
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
4737
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
4738
|
+
}
|
|
4739
|
+
value = `\\${value}`;
|
|
4740
|
+
} else {
|
|
4741
|
+
increment("brackets");
|
|
4742
|
+
}
|
|
4743
|
+
push({
|
|
4744
|
+
type: "bracket",
|
|
4745
|
+
value
|
|
4746
|
+
});
|
|
4747
|
+
continue;
|
|
4748
|
+
}
|
|
4749
|
+
if (value === "]") {
|
|
4750
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
4751
|
+
push({
|
|
4752
|
+
type: "text",
|
|
4753
|
+
value,
|
|
4754
|
+
output: `\\${value}`
|
|
4755
|
+
});
|
|
4756
|
+
continue;
|
|
4757
|
+
}
|
|
4758
|
+
if (state.brackets === 0) {
|
|
4759
|
+
if (opts.strictBrackets === true) {
|
|
4760
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
4761
|
+
}
|
|
4762
|
+
push({
|
|
4763
|
+
type: "text",
|
|
4764
|
+
value,
|
|
4765
|
+
output: `\\${value}`
|
|
4766
|
+
});
|
|
4767
|
+
continue;
|
|
4768
|
+
}
|
|
4769
|
+
decrement("brackets");
|
|
4770
|
+
const prevValue = prev.value.slice(1);
|
|
4771
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
4772
|
+
value = `/${value}`;
|
|
4773
|
+
}
|
|
4774
|
+
prev.value += value;
|
|
4775
|
+
append({ value });
|
|
4776
|
+
if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) {
|
|
4777
|
+
continue;
|
|
4778
|
+
}
|
|
4779
|
+
const escaped = utils$2.escapeRegex(prev.value);
|
|
4780
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
4781
|
+
if (opts.literalBrackets === true) {
|
|
4782
|
+
state.output += escaped;
|
|
4783
|
+
prev.value = escaped;
|
|
4784
|
+
continue;
|
|
4785
|
+
}
|
|
4786
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
4787
|
+
state.output += prev.value;
|
|
4788
|
+
continue;
|
|
4789
|
+
}
|
|
4790
|
+
/**
|
|
4791
|
+
* Braces
|
|
4792
|
+
*/
|
|
4793
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
4794
|
+
increment("braces");
|
|
4795
|
+
const open = {
|
|
4796
|
+
type: "brace",
|
|
4797
|
+
value,
|
|
4798
|
+
output: "(",
|
|
4799
|
+
outputIndex: state.output.length,
|
|
4800
|
+
tokensIndex: state.tokens.length
|
|
4801
|
+
};
|
|
4802
|
+
braces.push(open);
|
|
4803
|
+
push(open);
|
|
4804
|
+
continue;
|
|
4805
|
+
}
|
|
4806
|
+
if (value === "}") {
|
|
4807
|
+
const brace = braces[braces.length - 1];
|
|
4808
|
+
if (opts.nobrace === true || !brace) {
|
|
4809
|
+
push({
|
|
4810
|
+
type: "text",
|
|
4811
|
+
value,
|
|
4812
|
+
output: value
|
|
4813
|
+
});
|
|
4814
|
+
continue;
|
|
4815
|
+
}
|
|
4816
|
+
let output = ")";
|
|
4817
|
+
if (brace.dots === true) {
|
|
4818
|
+
const arr = tokens.slice();
|
|
4819
|
+
const range = [];
|
|
4820
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
4821
|
+
tokens.pop();
|
|
4822
|
+
if (arr[i].type === "brace") {
|
|
4823
|
+
break;
|
|
4824
|
+
}
|
|
4825
|
+
if (arr[i].type !== "dots") {
|
|
4826
|
+
range.unshift(arr[i].value);
|
|
4827
|
+
}
|
|
4828
|
+
}
|
|
4829
|
+
output = expandRange(range, opts);
|
|
4830
|
+
state.backtrack = true;
|
|
4831
|
+
}
|
|
4832
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
4833
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
4834
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
4835
|
+
brace.value = brace.output = "\\{";
|
|
4836
|
+
value = output = "\\}";
|
|
4837
|
+
state.output = out;
|
|
4838
|
+
for (const t of toks) {
|
|
4839
|
+
state.output += t.output || t.value;
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
push({
|
|
4843
|
+
type: "brace",
|
|
4844
|
+
value,
|
|
4845
|
+
output
|
|
4846
|
+
});
|
|
4847
|
+
decrement("braces");
|
|
4848
|
+
braces.pop();
|
|
4849
|
+
continue;
|
|
4850
|
+
}
|
|
4851
|
+
/**
|
|
4852
|
+
* Pipes
|
|
4853
|
+
*/
|
|
4854
|
+
if (value === "|") {
|
|
4855
|
+
if (extglobs.length > 0) {
|
|
4856
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
4857
|
+
}
|
|
4858
|
+
push({
|
|
4859
|
+
type: "text",
|
|
4860
|
+
value
|
|
4861
|
+
});
|
|
4862
|
+
continue;
|
|
4863
|
+
}
|
|
4864
|
+
/**
|
|
4865
|
+
* Commas
|
|
4866
|
+
*/
|
|
4867
|
+
if (value === ",") {
|
|
4868
|
+
let output = value;
|
|
4869
|
+
const brace = braces[braces.length - 1];
|
|
4870
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
4871
|
+
brace.comma = true;
|
|
4872
|
+
output = "|";
|
|
4873
|
+
}
|
|
4874
|
+
push({
|
|
4875
|
+
type: "comma",
|
|
4876
|
+
value,
|
|
4877
|
+
output
|
|
4878
|
+
});
|
|
4879
|
+
continue;
|
|
4880
|
+
}
|
|
4881
|
+
/**
|
|
4882
|
+
* Slashes
|
|
4883
|
+
*/
|
|
4884
|
+
if (value === "/") {
|
|
4885
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
4886
|
+
state.start = state.index + 1;
|
|
4887
|
+
state.consumed = "";
|
|
4888
|
+
state.output = "";
|
|
4889
|
+
tokens.pop();
|
|
4890
|
+
prev = bos;
|
|
4891
|
+
continue;
|
|
4892
|
+
}
|
|
4893
|
+
push({
|
|
4894
|
+
type: "slash",
|
|
4895
|
+
value,
|
|
4896
|
+
output: SLASH_LITERAL$1
|
|
4897
|
+
});
|
|
4898
|
+
continue;
|
|
4899
|
+
}
|
|
4900
|
+
/**
|
|
4901
|
+
* Dots
|
|
4902
|
+
*/
|
|
4903
|
+
if (value === ".") {
|
|
4904
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
4905
|
+
if (prev.value === ".") prev.output = DOT_LITERAL$1;
|
|
4906
|
+
const brace = braces[braces.length - 1];
|
|
4907
|
+
prev.type = "dots";
|
|
4908
|
+
prev.output += value;
|
|
4909
|
+
prev.value += value;
|
|
4910
|
+
brace.dots = true;
|
|
4911
|
+
continue;
|
|
4912
|
+
}
|
|
4913
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
4914
|
+
push({
|
|
4915
|
+
type: "text",
|
|
4916
|
+
value,
|
|
4917
|
+
output: DOT_LITERAL$1
|
|
4918
|
+
});
|
|
4919
|
+
continue;
|
|
4920
|
+
}
|
|
4921
|
+
push({
|
|
4922
|
+
type: "dot",
|
|
4923
|
+
value,
|
|
4924
|
+
output: DOT_LITERAL$1
|
|
4925
|
+
});
|
|
4926
|
+
continue;
|
|
4927
|
+
}
|
|
4928
|
+
/**
|
|
4929
|
+
* Question marks
|
|
4930
|
+
*/
|
|
4931
|
+
if (value === "?") {
|
|
4932
|
+
const isGroup = prev && prev.value === "(";
|
|
4933
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
4934
|
+
extglobOpen("qmark", value);
|
|
4935
|
+
continue;
|
|
4936
|
+
}
|
|
4937
|
+
if (prev && prev.type === "paren") {
|
|
4938
|
+
const next = peek();
|
|
4939
|
+
let output = value;
|
|
4940
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
4941
|
+
output = `\\${value}`;
|
|
4942
|
+
}
|
|
4943
|
+
push({
|
|
4944
|
+
type: "text",
|
|
4945
|
+
value,
|
|
4946
|
+
output
|
|
4947
|
+
});
|
|
4948
|
+
continue;
|
|
4949
|
+
}
|
|
4950
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
4951
|
+
push({
|
|
4952
|
+
type: "qmark",
|
|
4953
|
+
value,
|
|
4954
|
+
output: QMARK_NO_DOT$1
|
|
4955
|
+
});
|
|
4956
|
+
continue;
|
|
4957
|
+
}
|
|
4958
|
+
push({
|
|
4959
|
+
type: "qmark",
|
|
4960
|
+
value,
|
|
4961
|
+
output: QMARK$1
|
|
4962
|
+
});
|
|
4963
|
+
continue;
|
|
4964
|
+
}
|
|
4965
|
+
/**
|
|
4966
|
+
* Exclamation
|
|
4967
|
+
*/
|
|
4968
|
+
if (value === "!") {
|
|
4969
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
4970
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
4971
|
+
extglobOpen("negate", value);
|
|
4972
|
+
continue;
|
|
4973
|
+
}
|
|
4974
|
+
}
|
|
4975
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
4976
|
+
negate();
|
|
4977
|
+
continue;
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
/**
|
|
4981
|
+
* Plus
|
|
4982
|
+
*/
|
|
4983
|
+
if (value === "+") {
|
|
4984
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
4985
|
+
extglobOpen("plus", value);
|
|
4986
|
+
continue;
|
|
4987
|
+
}
|
|
4988
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
4989
|
+
push({
|
|
4990
|
+
type: "plus",
|
|
4991
|
+
value,
|
|
4992
|
+
output: PLUS_LITERAL$1
|
|
4993
|
+
});
|
|
4994
|
+
continue;
|
|
4995
|
+
}
|
|
4996
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
4997
|
+
push({
|
|
4998
|
+
type: "plus",
|
|
4999
|
+
value
|
|
5000
|
+
});
|
|
5001
|
+
continue;
|
|
5002
|
+
}
|
|
5003
|
+
push({
|
|
5004
|
+
type: "plus",
|
|
5005
|
+
value: PLUS_LITERAL$1
|
|
5006
|
+
});
|
|
5007
|
+
continue;
|
|
5008
|
+
}
|
|
5009
|
+
/**
|
|
5010
|
+
* Plain text
|
|
5011
|
+
*/
|
|
5012
|
+
if (value === "@") {
|
|
5013
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
5014
|
+
push({
|
|
5015
|
+
type: "at",
|
|
5016
|
+
extglob: true,
|
|
5017
|
+
value,
|
|
5018
|
+
output: ""
|
|
5019
|
+
});
|
|
5020
|
+
continue;
|
|
5021
|
+
}
|
|
5022
|
+
push({
|
|
5023
|
+
type: "text",
|
|
5024
|
+
value
|
|
5025
|
+
});
|
|
5026
|
+
continue;
|
|
5027
|
+
}
|
|
5028
|
+
/**
|
|
5029
|
+
* Plain text
|
|
5030
|
+
*/
|
|
5031
|
+
if (value !== "*") {
|
|
5032
|
+
if (value === "$" || value === "^") {
|
|
5033
|
+
value = `\\${value}`;
|
|
5034
|
+
}
|
|
5035
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
5036
|
+
if (match) {
|
|
5037
|
+
value += match[0];
|
|
5038
|
+
state.index += match[0].length;
|
|
5039
|
+
}
|
|
5040
|
+
push({
|
|
5041
|
+
type: "text",
|
|
5042
|
+
value
|
|
5043
|
+
});
|
|
5044
|
+
continue;
|
|
5045
|
+
}
|
|
5046
|
+
/**
|
|
5047
|
+
* Stars
|
|
5048
|
+
*/
|
|
5049
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
5050
|
+
prev.type = "star";
|
|
5051
|
+
prev.star = true;
|
|
5052
|
+
prev.value += value;
|
|
5053
|
+
prev.output = star;
|
|
5054
|
+
state.backtrack = true;
|
|
5055
|
+
state.globstar = true;
|
|
5056
|
+
consume(value);
|
|
5057
|
+
continue;
|
|
5058
|
+
}
|
|
5059
|
+
let rest = remaining();
|
|
5060
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
5061
|
+
extglobOpen("star", value);
|
|
5062
|
+
continue;
|
|
5063
|
+
}
|
|
5064
|
+
if (prev.type === "star") {
|
|
5065
|
+
if (opts.noglobstar === true) {
|
|
5066
|
+
consume(value);
|
|
5067
|
+
continue;
|
|
5068
|
+
}
|
|
5069
|
+
const prior = prev.prev;
|
|
5070
|
+
const before = prior.prev;
|
|
5071
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
5072
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
5073
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
5074
|
+
push({
|
|
5075
|
+
type: "star",
|
|
5076
|
+
value,
|
|
5077
|
+
output: ""
|
|
5078
|
+
});
|
|
5079
|
+
continue;
|
|
5080
|
+
}
|
|
5081
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
5082
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
5083
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
5084
|
+
push({
|
|
5085
|
+
type: "star",
|
|
5086
|
+
value,
|
|
5087
|
+
output: ""
|
|
5088
|
+
});
|
|
5089
|
+
continue;
|
|
5090
|
+
}
|
|
5091
|
+
while (rest.slice(0, 3) === "/**") {
|
|
5092
|
+
const after = input[state.index + 4];
|
|
5093
|
+
if (after && after !== "/") {
|
|
5094
|
+
break;
|
|
5095
|
+
}
|
|
5096
|
+
rest = rest.slice(3);
|
|
5097
|
+
consume("/**", 3);
|
|
5098
|
+
}
|
|
5099
|
+
if (prior.type === "bos" && eos()) {
|
|
5100
|
+
prev.type = "globstar";
|
|
5101
|
+
prev.value += value;
|
|
5102
|
+
prev.output = globstar(opts);
|
|
5103
|
+
state.output = prev.output;
|
|
5104
|
+
state.globstar = true;
|
|
5105
|
+
consume(value);
|
|
5106
|
+
continue;
|
|
5107
|
+
}
|
|
5108
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
5109
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
5110
|
+
prior.output = `(?:${prior.output}`;
|
|
5111
|
+
prev.type = "globstar";
|
|
5112
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
5113
|
+
prev.value += value;
|
|
5114
|
+
state.globstar = true;
|
|
5115
|
+
state.output += prior.output + prev.output;
|
|
5116
|
+
consume(value);
|
|
5117
|
+
continue;
|
|
5118
|
+
}
|
|
5119
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
5120
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
5121
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
5122
|
+
prior.output = `(?:${prior.output}`;
|
|
5123
|
+
prev.type = "globstar";
|
|
5124
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
|
|
5125
|
+
prev.value += value;
|
|
5126
|
+
state.output += prior.output + prev.output;
|
|
5127
|
+
state.globstar = true;
|
|
5128
|
+
consume(value + advance());
|
|
5129
|
+
push({
|
|
5130
|
+
type: "slash",
|
|
5131
|
+
value: "/",
|
|
5132
|
+
output: ""
|
|
5133
|
+
});
|
|
5134
|
+
continue;
|
|
5135
|
+
}
|
|
5136
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
5137
|
+
prev.type = "globstar";
|
|
5138
|
+
prev.value += value;
|
|
5139
|
+
prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
|
|
5140
|
+
state.output = prev.output;
|
|
5141
|
+
state.globstar = true;
|
|
5142
|
+
consume(value + advance());
|
|
5143
|
+
push({
|
|
5144
|
+
type: "slash",
|
|
5145
|
+
value: "/",
|
|
5146
|
+
output: ""
|
|
5147
|
+
});
|
|
5148
|
+
continue;
|
|
5149
|
+
}
|
|
5150
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
5151
|
+
prev.type = "globstar";
|
|
5152
|
+
prev.output = globstar(opts);
|
|
5153
|
+
prev.value += value;
|
|
5154
|
+
state.output += prev.output;
|
|
5155
|
+
state.globstar = true;
|
|
5156
|
+
consume(value);
|
|
5157
|
+
continue;
|
|
5158
|
+
}
|
|
5159
|
+
const token = {
|
|
5160
|
+
type: "star",
|
|
5161
|
+
value,
|
|
5162
|
+
output: star
|
|
5163
|
+
};
|
|
5164
|
+
if (opts.bash === true) {
|
|
5165
|
+
token.output = ".*?";
|
|
5166
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
5167
|
+
token.output = nodot + token.output;
|
|
5168
|
+
}
|
|
5169
|
+
push(token);
|
|
5170
|
+
continue;
|
|
5171
|
+
}
|
|
5172
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
5173
|
+
token.output = value;
|
|
5174
|
+
push(token);
|
|
5175
|
+
continue;
|
|
5176
|
+
}
|
|
5177
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
5178
|
+
if (prev.type === "dot") {
|
|
5179
|
+
state.output += NO_DOT_SLASH$1;
|
|
5180
|
+
prev.output += NO_DOT_SLASH$1;
|
|
5181
|
+
} else if (opts.dot === true) {
|
|
5182
|
+
state.output += NO_DOTS_SLASH$1;
|
|
5183
|
+
prev.output += NO_DOTS_SLASH$1;
|
|
5184
|
+
} else {
|
|
5185
|
+
state.output += nodot;
|
|
5186
|
+
prev.output += nodot;
|
|
5187
|
+
}
|
|
5188
|
+
if (peek() !== "*") {
|
|
5189
|
+
state.output += ONE_CHAR$1;
|
|
5190
|
+
prev.output += ONE_CHAR$1;
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5193
|
+
push(token);
|
|
5194
|
+
}
|
|
5195
|
+
while (state.brackets > 0) {
|
|
5196
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
5197
|
+
state.output = utils$2.escapeLast(state.output, "[");
|
|
5198
|
+
decrement("brackets");
|
|
5199
|
+
}
|
|
5200
|
+
while (state.parens > 0) {
|
|
5201
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
5202
|
+
state.output = utils$2.escapeLast(state.output, "(");
|
|
5203
|
+
decrement("parens");
|
|
5204
|
+
}
|
|
5205
|
+
while (state.braces > 0) {
|
|
5206
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
5207
|
+
state.output = utils$2.escapeLast(state.output, "{");
|
|
5208
|
+
decrement("braces");
|
|
5209
|
+
}
|
|
5210
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
5211
|
+
push({
|
|
5212
|
+
type: "maybe_slash",
|
|
5213
|
+
value: "",
|
|
5214
|
+
output: `${SLASH_LITERAL$1}?`
|
|
5215
|
+
});
|
|
5216
|
+
}
|
|
5217
|
+
if (state.backtrack === true) {
|
|
5218
|
+
state.output = "";
|
|
5219
|
+
for (const token of state.tokens) {
|
|
5220
|
+
state.output += token.output != null ? token.output : token.value;
|
|
5221
|
+
if (token.suffix) {
|
|
5222
|
+
state.output += token.suffix;
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
return state;
|
|
5227
|
+
};
|
|
5228
|
+
/**
|
|
5229
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
5230
|
+
* This can significantly speed up processing and has very little downside
|
|
5231
|
+
* impact when none of the fast paths match.
|
|
5232
|
+
*/
|
|
5233
|
+
parse$1.fastpaths = (input, options) => {
|
|
5234
|
+
const opts = { ...options };
|
|
5235
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
5236
|
+
const len = input.length;
|
|
5237
|
+
if (len > max) {
|
|
5238
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
5239
|
+
}
|
|
5240
|
+
input = REPLACEMENTS[input] || input;
|
|
5241
|
+
const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOTS: NO_DOTS$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
|
|
5242
|
+
const nodot = opts.dot ? NO_DOTS$1 : NO_DOT$1;
|
|
5243
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH$1 : NO_DOT$1;
|
|
5244
|
+
const capture = opts.capture ? "" : "?:";
|
|
5245
|
+
const state = {
|
|
5246
|
+
negated: false,
|
|
5247
|
+
prefix: ""
|
|
5248
|
+
};
|
|
5249
|
+
let star = opts.bash === true ? ".*?" : STAR$1;
|
|
5250
|
+
if (opts.capture) {
|
|
5251
|
+
star = `(${star})`;
|
|
5252
|
+
}
|
|
5253
|
+
const globstar = (opts$1) => {
|
|
5254
|
+
if (opts$1.noglobstar === true) return star;
|
|
5255
|
+
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
5256
|
+
};
|
|
5257
|
+
const create = (str) => {
|
|
5258
|
+
switch (str) {
|
|
5259
|
+
case "*": return `${nodot}${ONE_CHAR$1}${star}`;
|
|
5260
|
+
case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5261
|
+
case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5262
|
+
case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
|
|
5263
|
+
case "**": return nodot + globstar(opts);
|
|
5264
|
+
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
|
|
5265
|
+
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5266
|
+
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5267
|
+
default: {
|
|
5268
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
5269
|
+
if (!match) return;
|
|
5270
|
+
const source$1 = create(match[1]);
|
|
5271
|
+
if (!source$1) return;
|
|
5272
|
+
return source$1 + DOT_LITERAL$1 + match[2];
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
};
|
|
5276
|
+
const output = utils$2.removePrefix(input, state);
|
|
5277
|
+
let source = create(output);
|
|
5278
|
+
if (source && opts.strictSlashes !== true) {
|
|
5279
|
+
source += `${SLASH_LITERAL$1}?`;
|
|
5280
|
+
}
|
|
5281
|
+
return source;
|
|
5282
|
+
};
|
|
5283
|
+
module.exports = parse$1;
|
|
5284
|
+
}));
|
|
5285
|
+
|
|
5286
|
+
//#endregion
|
|
5287
|
+
//#region node_modules/picomatch/lib/picomatch.js
|
|
5288
|
+
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5289
|
+
const scan = require_scan();
|
|
5290
|
+
const parse = require_parse();
|
|
5291
|
+
const utils$1 = require_utils();
|
|
5292
|
+
const constants = require_constants();
|
|
5293
|
+
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
5294
|
+
/**
|
|
5295
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
5296
|
+
* returned function takes a string to match as its first argument,
|
|
5297
|
+
* and returns true if the string is a match. The returned matcher
|
|
5298
|
+
* function also takes a boolean as the second argument that, when true,
|
|
5299
|
+
* returns an object with additional information.
|
|
5300
|
+
*
|
|
5301
|
+
* ```js
|
|
5302
|
+
* const picomatch = require('picomatch');
|
|
5303
|
+
* // picomatch(glob[, options]);
|
|
5304
|
+
*
|
|
5305
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
5306
|
+
* console.log(isMatch('a.a')); //=> false
|
|
5307
|
+
* console.log(isMatch('a.b')); //=> true
|
|
5308
|
+
* ```
|
|
5309
|
+
* @name picomatch
|
|
5310
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
5311
|
+
* @param {Object=} `options`
|
|
5312
|
+
* @return {Function=} Returns a matcher function.
|
|
5313
|
+
* @api public
|
|
5314
|
+
*/
|
|
5315
|
+
const picomatch$2 = (glob, options, returnState = false) => {
|
|
5316
|
+
if (Array.isArray(glob)) {
|
|
5317
|
+
const fns = glob.map((input) => picomatch$2(input, options, returnState));
|
|
5318
|
+
const arrayMatcher = (str) => {
|
|
5319
|
+
for (const isMatch of fns) {
|
|
5320
|
+
const state$1 = isMatch(str);
|
|
5321
|
+
if (state$1) return state$1;
|
|
5322
|
+
}
|
|
5323
|
+
return false;
|
|
5324
|
+
};
|
|
5325
|
+
return arrayMatcher;
|
|
5326
|
+
}
|
|
5327
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
5328
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
5329
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
5330
|
+
}
|
|
5331
|
+
const opts = options || {};
|
|
5332
|
+
const posix = opts.windows;
|
|
5333
|
+
const regex = isState ? picomatch$2.compileRe(glob, options) : picomatch$2.makeRe(glob, options, false, true);
|
|
5334
|
+
const state = regex.state;
|
|
5335
|
+
delete regex.state;
|
|
5336
|
+
let isIgnored = () => false;
|
|
5337
|
+
if (opts.ignore) {
|
|
5338
|
+
const ignoreOpts = {
|
|
5339
|
+
...options,
|
|
5340
|
+
ignore: null,
|
|
5341
|
+
onMatch: null,
|
|
5342
|
+
onResult: null
|
|
5343
|
+
};
|
|
5344
|
+
isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
|
|
5345
|
+
}
|
|
5346
|
+
const matcher = (input, returnObject = false) => {
|
|
5347
|
+
const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
|
|
5348
|
+
glob,
|
|
5349
|
+
posix
|
|
5350
|
+
});
|
|
5351
|
+
const result = {
|
|
5352
|
+
glob,
|
|
5353
|
+
state,
|
|
5354
|
+
regex,
|
|
5355
|
+
posix,
|
|
5356
|
+
input,
|
|
5357
|
+
output,
|
|
5358
|
+
match,
|
|
5359
|
+
isMatch
|
|
5360
|
+
};
|
|
5361
|
+
if (typeof opts.onResult === "function") {
|
|
5362
|
+
opts.onResult(result);
|
|
5363
|
+
}
|
|
5364
|
+
if (isMatch === false) {
|
|
5365
|
+
result.isMatch = false;
|
|
5366
|
+
return returnObject ? result : false;
|
|
5367
|
+
}
|
|
5368
|
+
if (isIgnored(input)) {
|
|
5369
|
+
if (typeof opts.onIgnore === "function") {
|
|
5370
|
+
opts.onIgnore(result);
|
|
5371
|
+
}
|
|
5372
|
+
result.isMatch = false;
|
|
5373
|
+
return returnObject ? result : false;
|
|
5374
|
+
}
|
|
5375
|
+
if (typeof opts.onMatch === "function") {
|
|
5376
|
+
opts.onMatch(result);
|
|
5377
|
+
}
|
|
5378
|
+
return returnObject ? result : true;
|
|
5379
|
+
};
|
|
5380
|
+
if (returnState) {
|
|
5381
|
+
matcher.state = state;
|
|
5382
|
+
}
|
|
5383
|
+
return matcher;
|
|
5384
|
+
};
|
|
5385
|
+
/**
|
|
5386
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
5387
|
+
* `picomatch()` function to test the input string.
|
|
5388
|
+
*
|
|
5389
|
+
* ```js
|
|
5390
|
+
* const picomatch = require('picomatch');
|
|
5391
|
+
* // picomatch.test(input, regex[, options]);
|
|
5392
|
+
*
|
|
5393
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
5394
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
5395
|
+
* ```
|
|
5396
|
+
* @param {String} `input` String to test.
|
|
5397
|
+
* @param {RegExp} `regex`
|
|
5398
|
+
* @return {Object} Returns an object with matching info.
|
|
5399
|
+
* @api public
|
|
5400
|
+
*/
|
|
5401
|
+
picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
5402
|
+
if (typeof input !== "string") {
|
|
5403
|
+
throw new TypeError("Expected input to be a string");
|
|
5404
|
+
}
|
|
5405
|
+
if (input === "") {
|
|
5406
|
+
return {
|
|
5407
|
+
isMatch: false,
|
|
5408
|
+
output: ""
|
|
5409
|
+
};
|
|
5410
|
+
}
|
|
5411
|
+
const opts = options || {};
|
|
5412
|
+
const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
|
|
5413
|
+
let match = input === glob;
|
|
5414
|
+
let output = match && format ? format(input) : input;
|
|
5415
|
+
if (match === false) {
|
|
5416
|
+
output = format ? format(input) : input;
|
|
5417
|
+
match = output === glob;
|
|
5418
|
+
}
|
|
5419
|
+
if (match === false || opts.capture === true) {
|
|
5420
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
5421
|
+
match = picomatch$2.matchBase(input, regex, options, posix);
|
|
5422
|
+
} else {
|
|
5423
|
+
match = regex.exec(output);
|
|
5424
|
+
}
|
|
5425
|
+
}
|
|
5426
|
+
return {
|
|
5427
|
+
isMatch: Boolean(match),
|
|
5428
|
+
match,
|
|
5429
|
+
output
|
|
5430
|
+
};
|
|
5431
|
+
};
|
|
5432
|
+
/**
|
|
5433
|
+
* Match the basename of a filepath.
|
|
5434
|
+
*
|
|
5435
|
+
* ```js
|
|
5436
|
+
* const picomatch = require('picomatch');
|
|
5437
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
5438
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
5439
|
+
* ```
|
|
5440
|
+
* @param {String} `input` String to test.
|
|
5441
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
5442
|
+
* @return {Boolean}
|
|
5443
|
+
* @api public
|
|
5444
|
+
*/
|
|
5445
|
+
picomatch$2.matchBase = (input, glob, options) => {
|
|
5446
|
+
const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
|
|
5447
|
+
return regex.test(utils$1.basename(input));
|
|
5448
|
+
};
|
|
5449
|
+
/**
|
|
5450
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
5451
|
+
*
|
|
5452
|
+
* ```js
|
|
5453
|
+
* const picomatch = require('picomatch');
|
|
5454
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
5455
|
+
*
|
|
5456
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
5457
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
5458
|
+
* ```
|
|
5459
|
+
* @param {String|Array} str The string to test.
|
|
5460
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
5461
|
+
* @param {Object} [options] See available [options](#options).
|
|
5462
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
5463
|
+
* @api public
|
|
5464
|
+
*/
|
|
5465
|
+
picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
|
|
5466
|
+
/**
|
|
5467
|
+
* Parse a glob pattern to create the source string for a regular
|
|
5468
|
+
* expression.
|
|
5469
|
+
*
|
|
5470
|
+
* ```js
|
|
5471
|
+
* const picomatch = require('picomatch');
|
|
5472
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
5473
|
+
* ```
|
|
5474
|
+
* @param {String} `pattern`
|
|
5475
|
+
* @param {Object} `options`
|
|
5476
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
5477
|
+
* @api public
|
|
5478
|
+
*/
|
|
5479
|
+
picomatch$2.parse = (pattern, options) => {
|
|
5480
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
|
|
5481
|
+
return parse(pattern, {
|
|
5482
|
+
...options,
|
|
5483
|
+
fastpaths: false
|
|
5484
|
+
});
|
|
5485
|
+
};
|
|
5486
|
+
/**
|
|
5487
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
5488
|
+
*
|
|
5489
|
+
* ```js
|
|
5490
|
+
* const picomatch = require('picomatch');
|
|
5491
|
+
* // picomatch.scan(input[, options]);
|
|
5492
|
+
*
|
|
5493
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
5494
|
+
* console.log(result);
|
|
5495
|
+
* { prefix: '!./',
|
|
5496
|
+
* input: '!./foo/*.js',
|
|
5497
|
+
* start: 3,
|
|
5498
|
+
* base: 'foo',
|
|
5499
|
+
* glob: '*.js',
|
|
5500
|
+
* isBrace: false,
|
|
5501
|
+
* isBracket: false,
|
|
5502
|
+
* isGlob: true,
|
|
5503
|
+
* isExtglob: false,
|
|
5504
|
+
* isGlobstar: false,
|
|
5505
|
+
* negated: true }
|
|
5506
|
+
* ```
|
|
5507
|
+
* @param {String} `input` Glob pattern to scan.
|
|
5508
|
+
* @param {Object} `options`
|
|
5509
|
+
* @return {Object} Returns an object with
|
|
5510
|
+
* @api public
|
|
5511
|
+
*/
|
|
5512
|
+
picomatch$2.scan = (input, options) => scan(input, options);
|
|
5513
|
+
/**
|
|
5514
|
+
* Compile a regular expression from the `state` object returned by the
|
|
5515
|
+
* [parse()](#parse) method.
|
|
5516
|
+
*
|
|
5517
|
+
* @param {Object} `state`
|
|
5518
|
+
* @param {Object} `options`
|
|
5519
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
5520
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
5521
|
+
* @return {RegExp}
|
|
5522
|
+
* @api public
|
|
5523
|
+
*/
|
|
5524
|
+
picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
5525
|
+
if (returnOutput === true) {
|
|
5526
|
+
return state.output;
|
|
5527
|
+
}
|
|
5528
|
+
const opts = options || {};
|
|
5529
|
+
const prepend = opts.contains ? "" : "^";
|
|
5530
|
+
const append = opts.contains ? "" : "$";
|
|
5531
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
5532
|
+
if (state && state.negated === true) {
|
|
5533
|
+
source = `^(?!${source}).*$`;
|
|
5534
|
+
}
|
|
5535
|
+
const regex = picomatch$2.toRegex(source, options);
|
|
5536
|
+
if (returnState === true) {
|
|
5537
|
+
regex.state = state;
|
|
5538
|
+
}
|
|
5539
|
+
return regex;
|
|
5540
|
+
};
|
|
5541
|
+
/**
|
|
5542
|
+
* Create a regular expression from a parsed glob pattern.
|
|
5543
|
+
*
|
|
5544
|
+
* ```js
|
|
5545
|
+
* const picomatch = require('picomatch');
|
|
5546
|
+
* const state = picomatch.parse('*.js');
|
|
5547
|
+
* // picomatch.compileRe(state[, options]);
|
|
5548
|
+
*
|
|
5549
|
+
* console.log(picomatch.compileRe(state));
|
|
5550
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
5551
|
+
* ```
|
|
5552
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
5553
|
+
* @param {Object} `options`
|
|
5554
|
+
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
5555
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
5556
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
5557
|
+
* @api public
|
|
5558
|
+
*/
|
|
5559
|
+
picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
5560
|
+
if (!input || typeof input !== "string") {
|
|
5561
|
+
throw new TypeError("Expected a non-empty string");
|
|
5562
|
+
}
|
|
5563
|
+
let parsed = {
|
|
5564
|
+
negated: false,
|
|
5565
|
+
fastpaths: true
|
|
5566
|
+
};
|
|
5567
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
5568
|
+
parsed.output = parse.fastpaths(input, options);
|
|
5569
|
+
}
|
|
5570
|
+
if (!parsed.output) {
|
|
5571
|
+
parsed = parse(input, options);
|
|
5572
|
+
}
|
|
5573
|
+
return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
|
|
5574
|
+
};
|
|
5575
|
+
/**
|
|
5576
|
+
* Create a regular expression from the given regex source string.
|
|
5577
|
+
*
|
|
5578
|
+
* ```js
|
|
5579
|
+
* const picomatch = require('picomatch');
|
|
5580
|
+
* // picomatch.toRegex(source[, options]);
|
|
5581
|
+
*
|
|
5582
|
+
* const { output } = picomatch.parse('*.js');
|
|
5583
|
+
* console.log(picomatch.toRegex(output));
|
|
5584
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
5585
|
+
* ```
|
|
5586
|
+
* @param {String} `source` Regular expression source string.
|
|
5587
|
+
* @param {Object} `options`
|
|
5588
|
+
* @return {RegExp}
|
|
5589
|
+
* @api public
|
|
5590
|
+
*/
|
|
5591
|
+
picomatch$2.toRegex = (source, options) => {
|
|
5592
|
+
try {
|
|
5593
|
+
const opts = options || {};
|
|
5594
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
5595
|
+
} catch (err$12) {
|
|
5596
|
+
if (options && options.debug === true) throw err$12;
|
|
5597
|
+
return /$^/;
|
|
5598
|
+
}
|
|
5599
|
+
};
|
|
5600
|
+
/**
|
|
5601
|
+
* Picomatch constants.
|
|
5602
|
+
* @return {Object}
|
|
5603
|
+
*/
|
|
5604
|
+
picomatch$2.constants = constants;
|
|
5605
|
+
/**
|
|
5606
|
+
* Expose "picomatch"
|
|
5607
|
+
*/
|
|
5608
|
+
module.exports = picomatch$2;
|
|
5609
|
+
}));
|
|
5610
|
+
|
|
5611
|
+
//#endregion
|
|
5612
|
+
//#region node_modules/picomatch/index.js
|
|
5613
|
+
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5614
|
+
const pico = require_picomatch$1();
|
|
5615
|
+
const utils = require_utils();
|
|
5616
|
+
function picomatch$1(glob, options, returnState = false) {
|
|
5617
|
+
if (options && (options.windows === null || options.windows === undefined)) {
|
|
5618
|
+
options = {
|
|
5619
|
+
...options,
|
|
5620
|
+
windows: utils.isWindows()
|
|
5621
|
+
};
|
|
5622
|
+
}
|
|
5623
|
+
return pico(glob, options, returnState);
|
|
5624
|
+
}
|
|
5625
|
+
Object.assign(picomatch$1, pico);
|
|
5626
|
+
module.exports = picomatch$1;
|
|
5627
|
+
}));
|
|
5628
|
+
|
|
3773
5629
|
//#endregion
|
|
3774
5630
|
//#region packages/builder/src/utils/glob.ts
|
|
3775
5631
|
/**
|
|
@@ -3794,6 +5650,7 @@ const scanGlob = (patterns, cwd = process.cwd()) => {
|
|
|
3794
5650
|
|
|
3795
5651
|
//#endregion
|
|
3796
5652
|
//#region packages/builder/src/discovery/entry-paths.ts
|
|
5653
|
+
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
3797
5654
|
/**
|
|
3798
5655
|
* Resolve entry file paths from glob patterns or direct paths.
|
|
3799
5656
|
* Used by the discovery system to find entry points for module traversal.
|
|
@@ -3801,8 +5658,9 @@ const scanGlob = (patterns, cwd = process.cwd()) => {
|
|
|
3801
5658
|
* Uses Node.js normalize() + backslash replacement to match normalizePath from @soda-gql/common.
|
|
3802
5659
|
*
|
|
3803
5660
|
* @param entries - Include patterns (glob or direct paths). Supports negation patterns (e.g., "!./path/to/exclude.ts")
|
|
5661
|
+
* @param exclude - Exclude patterns from config.exclude. Converted to negation globs for filtering.
|
|
3804
5662
|
*/
|
|
3805
|
-
const resolveEntryPaths = (entries) => {
|
|
5663
|
+
const resolveEntryPaths = (entries, exclude = []) => {
|
|
3806
5664
|
const directPaths = [];
|
|
3807
5665
|
const globPatterns = [];
|
|
3808
5666
|
for (const entry of entries) {
|
|
@@ -3817,6 +5675,19 @@ const resolveEntryPaths = (entries) => {
|
|
|
3817
5675
|
globPatterns.push(entry);
|
|
3818
5676
|
}
|
|
3819
5677
|
}
|
|
5678
|
+
if (exclude.length > 0 && directPaths.length > 0) {
|
|
5679
|
+
const excludePatterns = exclude.map((p) => {
|
|
5680
|
+
const raw = p.startsWith("!") ? p.slice(1) : p;
|
|
5681
|
+
return (0, node_path.normalize)((0, node_path.resolve)(raw)).replace(/\\/g, "/");
|
|
5682
|
+
});
|
|
5683
|
+
const isExcluded = (0, import_picomatch.default)(excludePatterns);
|
|
5684
|
+
const filtered = directPaths.filter((p) => !isExcluded(p));
|
|
5685
|
+
directPaths.length = 0;
|
|
5686
|
+
directPaths.push(...filtered);
|
|
5687
|
+
}
|
|
5688
|
+
for (const pattern of exclude) {
|
|
5689
|
+
globPatterns.push(pattern.startsWith("!") ? pattern : `!${pattern}`);
|
|
5690
|
+
}
|
|
3820
5691
|
const globMatches = globPatterns.length > 0 ? scanGlob(globPatterns, process.cwd()).map((match) => {
|
|
3821
5692
|
return (0, node_path.normalize)((0, node_path.resolve)(match)).replace(/\\/g, "/");
|
|
3822
5693
|
}) : [];
|
|
@@ -3843,7 +5714,7 @@ const resolveEntryPaths = (entries) => {
|
|
|
3843
5714
|
const createFileTracker = () => {
|
|
3844
5715
|
let currentScan = { files: new Map() };
|
|
3845
5716
|
let nextScan = null;
|
|
3846
|
-
const scan = (extraPaths) => {
|
|
5717
|
+
const scan$2 = (extraPaths) => {
|
|
3847
5718
|
const allPathsToScan = new Set([...extraPaths, ...currentScan.files.keys()]);
|
|
3848
5719
|
const files = new Map();
|
|
3849
5720
|
for (const path of allPathsToScan) {
|
|
@@ -3884,12 +5755,12 @@ const createFileTracker = () => {
|
|
|
3884
5755
|
removed
|
|
3885
5756
|
};
|
|
3886
5757
|
};
|
|
3887
|
-
const update = (scan$
|
|
3888
|
-
currentScan = scan$
|
|
5758
|
+
const update = (scan$3) => {
|
|
5759
|
+
currentScan = scan$3;
|
|
3889
5760
|
nextScan = null;
|
|
3890
5761
|
};
|
|
3891
5762
|
return {
|
|
3892
|
-
scan,
|
|
5763
|
+
scan: scan$2,
|
|
3893
5764
|
detectChanges,
|
|
3894
5765
|
update
|
|
3895
5766
|
};
|
|
@@ -4093,7 +5964,7 @@ const createBuilderSession = (options) => {
|
|
|
4093
5964
|
* Returns either a skip result or the input for buildGen.
|
|
4094
5965
|
*/
|
|
4095
5966
|
const prepareBuildInput = (force) => {
|
|
4096
|
-
const entryPathsResult = resolveEntryPaths(Array.from(entrypoints));
|
|
5967
|
+
const entryPathsResult = resolveEntryPaths(Array.from(entrypoints), config.exclude);
|
|
4097
5968
|
if (entryPathsResult.isErr()) {
|
|
4098
5969
|
return (0, neverthrow.err)(entryPathsResult.error);
|
|
4099
5970
|
}
|
|
@@ -4497,4 +6368,4 @@ Object.defineProperty(exports, 'loadArtifactSync', {
|
|
|
4497
6368
|
return loadArtifactSync;
|
|
4498
6369
|
}
|
|
4499
6370
|
});
|
|
4500
|
-
//# sourceMappingURL=service-
|
|
6371
|
+
//# sourceMappingURL=service-acu0uwVA.cjs.map
|