minimatch 7.4.2 → 7.4.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/cjs/_parse.d.ts +7 -0
- package/dist/cjs/_parse.d.ts.map +1 -0
- package/dist/cjs/_parse.js +300 -0
- package/dist/cjs/_parse.js.map +1 -0
- package/dist/cjs/assert-valid-pattern.d.ts +2 -0
- package/dist/cjs/assert-valid-pattern.d.ts.map +1 -0
- package/dist/cjs/assert-valid-pattern.js +14 -0
- package/dist/cjs/assert-valid-pattern.js.map +1 -0
- package/dist/cjs/brace-expressions.js.map +1 -1
- package/dist/cjs/escape.js.map +1 -1
- package/dist/cjs/extglob.d.ts +2 -0
- package/dist/cjs/extglob.d.ts.map +1 -0
- package/dist/cjs/extglob.js +4 -0
- package/dist/cjs/extglob.js.map +1 -0
- package/dist/cjs/index-cjs.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/unescape.js.map +1 -1
- package/dist/mjs/_parse.d.ts +7 -0
- package/dist/mjs/_parse.d.ts.map +1 -0
- package/dist/mjs/_parse.js +296 -0
- package/dist/mjs/_parse.js.map +1 -0
- package/dist/mjs/assert-valid-pattern.d.ts +2 -0
- package/dist/mjs/assert-valid-pattern.d.ts.map +1 -0
- package/dist/mjs/assert-valid-pattern.js +10 -0
- package/dist/mjs/assert-valid-pattern.js.map +1 -0
- package/dist/mjs/brace-expressions.js.map +1 -1
- package/dist/mjs/escape.js.map +1 -1
- package/dist/mjs/extglob.d.ts +2 -0
- package/dist/mjs/extglob.d.ts.map +1 -0
- package/dist/mjs/extglob.js +3 -0
- package/dist/mjs/extglob.js.map +1 -0
- package/dist/mjs/index.d.ts +1 -1
- package/dist/mjs/index.d.ts.map +1 -1
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/unescape.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MinimatchOptions } from './index.js';
|
|
2
|
+
export type MMRegExp = RegExp & {
|
|
3
|
+
_src?: string;
|
|
4
|
+
_glob?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const parse: (options: MinimatchOptions, pattern: string, debug: (...a: any[]) => void) => false | string;
|
|
7
|
+
//# sourceMappingURL=_parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_parse.d.ts","sourceRoot":"","sources":["../../src/_parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAiD7C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAGD,eAAO,MAAM,KAAK,YACP,gBAAgB,WAChB,MAAM,gBACD,GAAG,EAAE,KAAK,IAAI,KAC3B,KAAK,GAAG,MAkTV,CAAA"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse = void 0;
|
|
4
|
+
// parse a single path portion
|
|
5
|
+
const brace_expressions_js_1 = require("./brace-expressions.js");
|
|
6
|
+
const assert_valid_pattern_js_1 = require("./assert-valid-pattern.js");
|
|
7
|
+
const globUnescape = (s) => s.replace(/\\(.)/g, '$1');
|
|
8
|
+
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
9
|
+
// "abc" -> { a:true, b:true, c:true }
|
|
10
|
+
const charSet = (s) => s.split('').reduce((set, c) => {
|
|
11
|
+
set[c] = true;
|
|
12
|
+
return set;
|
|
13
|
+
}, {});
|
|
14
|
+
const plTypes = {
|
|
15
|
+
'!': { open: '(?:(?!(?:', close: '))[^/]*?)' },
|
|
16
|
+
'?': { open: '(?:', close: ')?' },
|
|
17
|
+
'+': { open: '(?:', close: ')+' },
|
|
18
|
+
'*': { open: '(?:', close: ')*' },
|
|
19
|
+
'@': { open: '(?:', close: ')' },
|
|
20
|
+
};
|
|
21
|
+
// characters that need to be escaped in RegExp.
|
|
22
|
+
const reSpecials = charSet('().*{}+?[]^$\\!');
|
|
23
|
+
// characters that indicate we have to add the pattern start
|
|
24
|
+
const addPatternStartSet = charSet('[.(');
|
|
25
|
+
// any single thing other than /
|
|
26
|
+
// don't need to escape / when using new RegExp()
|
|
27
|
+
const qmark = '[^/]';
|
|
28
|
+
// * => any number of characters
|
|
29
|
+
const star = qmark + '*?';
|
|
30
|
+
// TODO: take an offset and length, so we can sub-parse the extglobs
|
|
31
|
+
const parse = (options, pattern, debug) => {
|
|
32
|
+
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
33
|
+
if (pattern === '')
|
|
34
|
+
return '';
|
|
35
|
+
let re = '';
|
|
36
|
+
let hasMagic = false;
|
|
37
|
+
let escaping = false;
|
|
38
|
+
// ? => one single character
|
|
39
|
+
const patternListStack = [];
|
|
40
|
+
const negativeLists = [];
|
|
41
|
+
let stateChar = false;
|
|
42
|
+
let uflag = false;
|
|
43
|
+
let pl;
|
|
44
|
+
// . and .. never match anything that doesn't start with .,
|
|
45
|
+
// even when options.dot is set. However, if the pattern
|
|
46
|
+
// starts with ., then traversal patterns can match.
|
|
47
|
+
let dotTravAllowed = pattern.charAt(0) === '.';
|
|
48
|
+
let dotFileAllowed = options.dot || dotTravAllowed;
|
|
49
|
+
const patternStart = () => dotTravAllowed
|
|
50
|
+
? ''
|
|
51
|
+
: dotFileAllowed
|
|
52
|
+
? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
|
|
53
|
+
: '(?!\\.)';
|
|
54
|
+
const subPatternStart = (p) => p.charAt(0) === '.'
|
|
55
|
+
? ''
|
|
56
|
+
: options.dot
|
|
57
|
+
? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
|
|
58
|
+
: '(?!\\.)';
|
|
59
|
+
const clearStateChar = () => {
|
|
60
|
+
if (stateChar) {
|
|
61
|
+
// we had some state-tracking character
|
|
62
|
+
// that wasn't consumed by this pass.
|
|
63
|
+
switch (stateChar) {
|
|
64
|
+
case '*':
|
|
65
|
+
re += star;
|
|
66
|
+
hasMagic = true;
|
|
67
|
+
break;
|
|
68
|
+
case '?':
|
|
69
|
+
re += qmark;
|
|
70
|
+
hasMagic = true;
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
re += '\\' + stateChar;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
debug('clearStateChar %j %j', stateChar, re);
|
|
77
|
+
stateChar = false;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
for (let i = 0, c; i < pattern.length && (c = pattern.charAt(i)); i++) {
|
|
81
|
+
debug('%s\t%s %s %j', pattern, i, re, c);
|
|
82
|
+
// skip over any that are escaped.
|
|
83
|
+
if (escaping) {
|
|
84
|
+
// completely not allowed, even escaped.
|
|
85
|
+
// should be impossible.
|
|
86
|
+
/* c8 ignore start */
|
|
87
|
+
if (c === '/') {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
/* c8 ignore stop */
|
|
91
|
+
if (reSpecials[c]) {
|
|
92
|
+
re += '\\';
|
|
93
|
+
}
|
|
94
|
+
re += c;
|
|
95
|
+
escaping = false;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
switch (c) {
|
|
99
|
+
// Should already be path-split by now.
|
|
100
|
+
/* c8 ignore start */
|
|
101
|
+
case '/': {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/* c8 ignore stop */
|
|
105
|
+
case '\\':
|
|
106
|
+
clearStateChar();
|
|
107
|
+
escaping = true;
|
|
108
|
+
continue;
|
|
109
|
+
// the various stateChar values
|
|
110
|
+
// for the "extglob" stuff.
|
|
111
|
+
case '?':
|
|
112
|
+
case '*':
|
|
113
|
+
case '+':
|
|
114
|
+
case '@':
|
|
115
|
+
case '!':
|
|
116
|
+
debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c);
|
|
117
|
+
// if we already have a stateChar, then it means
|
|
118
|
+
// that there was something like ** or +? in there.
|
|
119
|
+
// Handle the stateChar, then proceed with this one.
|
|
120
|
+
debug('call clearStateChar %j', stateChar);
|
|
121
|
+
clearStateChar();
|
|
122
|
+
stateChar = c;
|
|
123
|
+
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
|
124
|
+
// just clear the statechar *now*, rather than even diving into
|
|
125
|
+
// the patternList stuff.
|
|
126
|
+
if (options.noext)
|
|
127
|
+
clearStateChar();
|
|
128
|
+
continue;
|
|
129
|
+
case '(': {
|
|
130
|
+
if (!stateChar) {
|
|
131
|
+
re += '\\(';
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const plEntry = {
|
|
135
|
+
type: stateChar,
|
|
136
|
+
start: i - 1,
|
|
137
|
+
reStart: re.length,
|
|
138
|
+
open: plTypes[stateChar].open,
|
|
139
|
+
close: plTypes[stateChar].close,
|
|
140
|
+
};
|
|
141
|
+
debug(pattern, '\t', plEntry);
|
|
142
|
+
patternListStack.push(plEntry);
|
|
143
|
+
// negation is (?:(?!(?:js)(?:<rest>))[^/]*)
|
|
144
|
+
re += plEntry.open;
|
|
145
|
+
// next entry starts with a dot maybe?
|
|
146
|
+
if (plEntry.start === 0 && plEntry.type !== '!') {
|
|
147
|
+
dotTravAllowed = true;
|
|
148
|
+
re += subPatternStart(pattern.slice(i + 1));
|
|
149
|
+
}
|
|
150
|
+
debug('plType %j %j', stateChar, re);
|
|
151
|
+
stateChar = false;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
case ')': {
|
|
155
|
+
const plEntry = patternListStack[patternListStack.length - 1];
|
|
156
|
+
if (!plEntry) {
|
|
157
|
+
re += '\\)';
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
patternListStack.pop();
|
|
161
|
+
// closing an extglob
|
|
162
|
+
clearStateChar();
|
|
163
|
+
hasMagic = true;
|
|
164
|
+
pl = plEntry;
|
|
165
|
+
// negation is (?:(?!js)[^/]*)
|
|
166
|
+
// The others are (?:<pattern>)<type>
|
|
167
|
+
re += pl.close;
|
|
168
|
+
if (pl.type === '!') {
|
|
169
|
+
negativeLists.push(Object.assign(pl, { reEnd: re.length }));
|
|
170
|
+
}
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
case '|': {
|
|
174
|
+
const plEntry = patternListStack[patternListStack.length - 1];
|
|
175
|
+
if (!plEntry) {
|
|
176
|
+
re += '\\|';
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
clearStateChar();
|
|
180
|
+
re += '|';
|
|
181
|
+
// next subpattern can start with a dot?
|
|
182
|
+
if (plEntry.start === 0 && plEntry.type !== '!') {
|
|
183
|
+
dotTravAllowed = true;
|
|
184
|
+
re += subPatternStart(pattern.slice(i + 1));
|
|
185
|
+
}
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
// these are mostly the same in regexp and glob
|
|
189
|
+
case '[':
|
|
190
|
+
// swallow any state-tracking char before the [
|
|
191
|
+
clearStateChar();
|
|
192
|
+
const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(pattern, i);
|
|
193
|
+
if (consumed) {
|
|
194
|
+
re += src;
|
|
195
|
+
uflag = uflag || needUflag;
|
|
196
|
+
i += consumed - 1;
|
|
197
|
+
hasMagic = hasMagic || magic;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
re += '\\[';
|
|
201
|
+
}
|
|
202
|
+
continue;
|
|
203
|
+
case ']':
|
|
204
|
+
re += '\\' + c;
|
|
205
|
+
continue;
|
|
206
|
+
default:
|
|
207
|
+
// swallow any state char that wasn't consumed
|
|
208
|
+
clearStateChar();
|
|
209
|
+
re += regExpEscape(c);
|
|
210
|
+
break;
|
|
211
|
+
} // switch
|
|
212
|
+
} // for
|
|
213
|
+
// handle the case where we had a +( thing at the *end*
|
|
214
|
+
// of the pattern.
|
|
215
|
+
// each pattern list stack adds 3 chars, and we need to go through
|
|
216
|
+
// and escape any | chars that were passed through as-is for the regexp.
|
|
217
|
+
// Go through and escape them, taking care not to double-escape any
|
|
218
|
+
// | chars that were already escaped.
|
|
219
|
+
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
220
|
+
let tail;
|
|
221
|
+
tail = re.slice(pl.reStart + pl.open.length);
|
|
222
|
+
debug(pattern, 'setting tail', re, pl);
|
|
223
|
+
// maybe some even number of \, then maybe 1 \, followed by a |
|
|
224
|
+
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
|
|
225
|
+
if (!$2) {
|
|
226
|
+
// the | isn't already escaped, so escape it.
|
|
227
|
+
$2 = '\\';
|
|
228
|
+
// should already be done
|
|
229
|
+
/* c8 ignore start */
|
|
230
|
+
}
|
|
231
|
+
/* c8 ignore stop */
|
|
232
|
+
// need to escape all those slashes *again*, without escaping the
|
|
233
|
+
// one that we need for escaping the | character. As it works out,
|
|
234
|
+
// escaping an even number of slashes can be done by simply repeating
|
|
235
|
+
// it exactly after itself. That's why this trick works.
|
|
236
|
+
//
|
|
237
|
+
// I am sorry that you have to see this.
|
|
238
|
+
return $1 + $1 + $2 + '|';
|
|
239
|
+
});
|
|
240
|
+
debug('tail=%j\n %s', tail, tail, pl, re);
|
|
241
|
+
const t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type;
|
|
242
|
+
hasMagic = true;
|
|
243
|
+
re = re.slice(0, pl.reStart) + t + '\\(' + tail;
|
|
244
|
+
}
|
|
245
|
+
// handle trailing things that only matter at the very end.
|
|
246
|
+
clearStateChar();
|
|
247
|
+
if (escaping) {
|
|
248
|
+
// trailing \\
|
|
249
|
+
re += '\\\\';
|
|
250
|
+
}
|
|
251
|
+
// only need to apply the nodot start if the re starts with
|
|
252
|
+
// something that could conceivably capture a dot
|
|
253
|
+
const addPatternStart = addPatternStartSet[re.charAt(0)];
|
|
254
|
+
// Hack to work around lack of negative lookbehind in JS
|
|
255
|
+
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
|
256
|
+
// like 'a.xyz.yz' doesn't match. So, the first negative
|
|
257
|
+
// lookahead, has to look ALL the way ahead, to the end of
|
|
258
|
+
// the pattern.
|
|
259
|
+
for (let n = negativeLists.length - 1; n > -1; n--) {
|
|
260
|
+
const nl = negativeLists[n];
|
|
261
|
+
const nlBefore = re.slice(0, nl.reStart);
|
|
262
|
+
const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
|
263
|
+
let nlAfter = re.slice(nl.reEnd);
|
|
264
|
+
const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
|
|
265
|
+
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
|
266
|
+
// mean that we should *not* include the ) in the bit that is considered
|
|
267
|
+
// "after" the negated section.
|
|
268
|
+
const closeParensBefore = nlBefore.split(')').length;
|
|
269
|
+
const openParensBefore = nlBefore.split('(').length - closeParensBefore;
|
|
270
|
+
let cleanAfter = nlAfter;
|
|
271
|
+
for (let i = 0; i < openParensBefore; i++) {
|
|
272
|
+
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '');
|
|
273
|
+
}
|
|
274
|
+
nlAfter = cleanAfter;
|
|
275
|
+
const dollar = nlAfter === '' ? '(?:$|\\/)' : '';
|
|
276
|
+
re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
277
|
+
}
|
|
278
|
+
// if the re is not "" at this point, then we need to make sure
|
|
279
|
+
// it doesn't match against an empty path part.
|
|
280
|
+
// Otherwise a/* will match a/, which it should not.
|
|
281
|
+
if (re !== '' && hasMagic) {
|
|
282
|
+
re = '(?=.)' + re;
|
|
283
|
+
}
|
|
284
|
+
if (addPatternStart) {
|
|
285
|
+
re = patternStart() + re;
|
|
286
|
+
}
|
|
287
|
+
// if it's nocase, and the lcase/uppercase don't match, it's magic
|
|
288
|
+
if (options.nocase && !hasMagic && !options.nocaseMagicOnly) {
|
|
289
|
+
hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
|
|
290
|
+
}
|
|
291
|
+
// skip the regexp for non-magical patterns
|
|
292
|
+
// unescape anything in it, though, so that it'll be
|
|
293
|
+
// an exact match against a file etc.
|
|
294
|
+
if (!hasMagic) {
|
|
295
|
+
return globUnescape(re);
|
|
296
|
+
}
|
|
297
|
+
return re;
|
|
298
|
+
};
|
|
299
|
+
exports.parse = parse;
|
|
300
|
+
//# sourceMappingURL=_parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_parse.js","sourceRoot":"","sources":["../../src/_parse.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,iEAAmD;AAEnD,uEAA8D;AAE9D,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AAC7D,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CACjC,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAA;AAE/C,sCAAsC;AACtC,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE,CAC5B,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAA6B,EAAE,CAAC,EAAE,EAAE;IACtD,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACb,OAAO,GAAG,CAAA;AACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AAER,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;IAC9C,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;IACjC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;IACjC,GAAG,EAAE,E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G,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;KACpD;IAED,+DAA+D;IAC/D,+CAA+C;IAC/C,oDAAoD;IACpD,IAAI,EAAE,KAAK,EAAE,IAAI,QAAQ,EAAE;QACzB,EAAE,GAAG,OAAO,GAAG,EAAE,CAAA;KAClB;IAED,IAAI,eAAe,EAAE;QACnB,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,CAAA;KACzB;IAED,kEAAkE;IAClE,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;QAC3D,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CAAA;KAC3D;IAED,2CAA2C;IAC3C,oDAAoD;IACpD,qCAAqC;IACrC,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,YAAY,CAAC,EAAE,CAAC,CAAA;KACxB;IAED,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAtTY,QAAA,KAAK,SAsTjB","sourcesContent":["// parse a single path portion\nimport { parseClass } from './brace-expressions.js'\nimport { MinimatchOptions } from './index.js'\nimport { assertValidPattern } from './assert-valid-pattern.js'\n\nconst globUnescape = (s: string) => s.replace(/\\\\(.)/g, '$1')\nconst regExpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// \"abc\" -> { a:true, b:true, c:true }\nconst charSet = (s: string) =>\n s.split('').reduce((set: { [k: string]: boolean }, c) => {\n set[c] = true\n return set\n }, {})\n\nconst plTypes = {\n '!': { open: '(?:(?!(?:', close: '))[^/]*?)' },\n '?': { open: '(?:', close: ')?' },\n '+': { open: '(?:', close: ')+' },\n '*': { open: '(?:', close: ')*' },\n '@': { open: '(?:', close: ')' },\n}\n\n// characters that need to be escaped in RegExp.\nconst reSpecials = charSet('().*{}+?[]^$\\\\!')\n\n// characters that indicate we have to add the pattern start\nconst addPatternStartSet = charSet('[.(')\n\ntype StateChar = '!' | '?' | '+' | '*' | '@'\n\n// any single thing other than /\n// don't need to escape / when using new RegExp()\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n\ninterface PatternListEntry {\n type: string\n start: number\n reStart: number\n open: string\n close: string\n}\n\ninterface NegativePatternListEntry extends PatternListEntry {\n reEnd: number\n}\n\nexport type MMRegExp = RegExp & {\n _src?: string\n _glob?: string\n}\n\n// TODO: take an offset and length, so we can sub-parse the extglobs\nexport const parse = (\n options: MinimatchOptions,\n pattern: string,\n debug: (...a: any[]) => void,\n): false | string => {\n assertValidPattern(pattern)\n\n if (pattern === '') return ''\n\n let re = ''\n let hasMagic = false\n let escaping = false\n // ? => one single character\n const patternListStack: PatternListEntry[] = []\n const negativeLists: NegativePatternListEntry[] = []\n let stateChar: StateChar | false = false\n let uflag = false\n let pl: PatternListEntry | undefined\n // . and .. never match anything that doesn't start with .,\n // even when options.dot is set. However, if the pattern\n // starts with ., then traversal patterns can match.\n let dotTravAllowed = pattern.charAt(0) === '.'\n let dotFileAllowed = options.dot || dotTravAllowed\n const patternStart = () =>\n dotTravAllowed\n ? ''\n : dotFileAllowed\n ? '(?!(?:^|\\\\/)\\\\.{1,2}(?:$|\\\\/))'\n : '(?!\\\\.)'\n const subPatternStart = (p: string) =>\n p.charAt(0) === '.'\n ? ''\n : options.dot\n ? '(?!(?:^|\\\\/)\\\\.{1,2}(?:$|\\\\/))'\n : '(?!\\\\.)'\n\n const clearStateChar = () => {\n if (stateChar) {\n // we had some state-tracking character\n // that wasn't consumed by this pass.\n switch (stateChar) {\n case '*':\n re += star\n hasMagic = true\n break\n case '?':\n re += qmark\n hasMagic = true\n break\n default:\n re += '\\\\' + stateChar\n break\n }\n debug('clearStateChar %j %j', stateChar, re)\n stateChar = false\n }\n }\n\n for (\n let i = 0, c: string;\n i < pattern.length && (c = pattern.charAt(i));\n i++\n ) {\n debug('%s\\t%s %s %j', pattern, i, re, c)\n\n // skip over any that are escaped.\n if (escaping) {\n // completely not allowed, even escaped.\n // should be impossible.\n /* c8 ignore start */\n if (c === '/') {\n return false\n }\n /* c8 ignore stop */\n\n if (reSpecials[c]) {\n re += '\\\\'\n }\n re += c\n escaping = false\n continue\n }\n\n switch (c) {\n // Should already be path-split by now.\n /* c8 ignore start */\n case '/': {\n return false\n }\n /* c8 ignore stop */\n\n case '\\\\':\n clearStateChar()\n escaping = true\n continue\n\n // the various stateChar values\n // for the \"extglob\" stuff.\n case '?':\n case '*':\n case '+':\n case '@':\n case '!':\n debug('%s\\t%s %s %j <-- stateChar', pattern, i, re, c)\n\n // if we already have a stateChar, then it means\n // that there was something like ** or +? in there.\n // Handle the stateChar, then proceed with this one.\n debug('call clearStateChar %j', stateChar)\n clearStateChar()\n stateChar = c\n // if extglob is disabled, then +(asdf|foo) isn't a thing.\n // just clear the statechar *now*, rather than even diving into\n // the patternList stuff.\n if (options.noext) clearStateChar()\n continue\n\n case '(': {\n if (!stateChar) {\n re += '\\\\('\n continue\n }\n\n const plEntry: PatternListEntry = {\n type: stateChar,\n start: i - 1,\n reStart: re.length,\n open: plTypes[stateChar].open,\n close: plTypes[stateChar].close,\n }\n debug(pattern, '\\t', plEntry)\n patternListStack.push(plEntry)\n // negation is (?:(?!(?:js)(?:<rest>))[^/]*)\n re += plEntry.open\n // next entry starts with a dot maybe?\n if (plEntry.start === 0 && plEntry.type !== '!') {\n dotTravAllowed = true\n re += subPatternStart(pattern.slice(i + 1))\n }\n debug('plType %j %j', stateChar, re)\n stateChar = false\n continue\n }\n\n case ')': {\n const plEntry = patternListStack[patternListStack.length - 1]\n if (!plEntry) {\n re += '\\\\)'\n continue\n }\n patternListStack.pop()\n\n // closing an extglob\n clearStateChar()\n hasMagic = true\n pl = plEntry\n // negation is (?:(?!js)[^/]*)\n // The others are (?:<pattern>)<type>\n re += pl.close\n if (pl.type === '!') {\n negativeLists.push(Object.assign(pl, { reEnd: re.length }))\n }\n continue\n }\n\n case '|': {\n const plEntry = patternListStack[patternListStack.length - 1]\n if (!plEntry) {\n re += '\\\\|'\n continue\n }\n\n clearStateChar()\n re += '|'\n // next subpattern can start with a dot?\n if (plEntry.start === 0 && plEntry.type !== '!') {\n dotTravAllowed = true\n re += subPatternStart(pattern.slice(i + 1))\n }\n continue\n }\n\n // these are mostly the same in regexp and glob\n case '[':\n // swallow any state-tracking char before the [\n clearStateChar()\n const [src, needUflag, consumed, magic] = parseClass(pattern, i)\n if (consumed) {\n re += src\n uflag = uflag || needUflag\n i += consumed - 1\n hasMagic = hasMagic || magic\n } else {\n re += '\\\\['\n }\n continue\n\n case ']':\n re += '\\\\' + c\n continue\n\n default:\n // swallow any state char that wasn't consumed\n clearStateChar()\n\n re += regExpEscape(c)\n break\n } // switch\n } // for\n\n // handle the case where we had a +( thing at the *end*\n // of the pattern.\n // each pattern list stack adds 3 chars, and we need to go through\n // and escape any | chars that were passed through as-is for the regexp.\n // Go through and escape them, taking care not to double-escape any\n // | chars that were already escaped.\n for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {\n let tail: string\n tail = re.slice(pl.reStart + pl.open.length)\n debug(pattern, 'setting tail', re, pl)\n // maybe some even number of \\, then maybe 1 \\, followed by a |\n tail = tail.replace(/((?:\\\\{2}){0,64})(\\\\?)\\|/g, (_, $1, $2) => {\n if (!$2) {\n // the | isn't already escaped, so escape it.\n $2 = '\\\\'\n // should already be done\n /* c8 ignore start */\n }\n /* c8 ignore stop */\n\n // need to escape all those slashes *again*, without escaping the\n // one that we need for escaping the | character. As it works out,\n // escaping an even number of slashes can be done by simply repeating\n // it exactly after itself. That's why this trick works.\n //\n // I am sorry that you have to see this.\n return $1 + $1 + $2 + '|'\n })\n\n debug('tail=%j\\n %s', tail, tail, pl, re)\n const t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\\\' + pl.type\n\n hasMagic = true\n re = re.slice(0, pl.reStart) + t + '\\\\(' + tail\n }\n\n // handle trailing things that only matter at the very end.\n clearStateChar()\n if (escaping) {\n // trailing \\\\\n re += '\\\\\\\\'\n }\n\n // only need to apply the nodot start if the re starts with\n // something that could conceivably capture a dot\n const addPatternStart = addPatternStartSet[re.charAt(0)]\n\n // Hack to work around lack of negative lookbehind in JS\n // A pattern like: *.!(x).!(y|z) needs to ensure that a name\n // like 'a.xyz.yz' doesn't match. So, the first negative\n // lookahead, has to look ALL the way ahead, to the end of\n // the pattern.\n for (let n = negativeLists.length - 1; n > -1; n--) {\n const nl = negativeLists[n]\n\n const nlBefore = re.slice(0, nl.reStart)\n const nlFirst = re.slice(nl.reStart, nl.reEnd - 8)\n let nlAfter = re.slice(nl.reEnd)\n const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter\n\n // Handle nested stuff like *(*.js|!(*.json)), where open parens\n // mean that we should *not* include the ) in the bit that is considered\n // \"after\" the negated section.\n const closeParensBefore = nlBefore.split(')').length\n const openParensBefore = nlBefore.split('(').length - closeParensBefore\n let cleanAfter = nlAfter\n for (let i = 0; i < openParensBefore; i++) {\n cleanAfter = cleanAfter.replace(/\\)[+*?]?/, '')\n }\n nlAfter = cleanAfter\n\n const dollar = nlAfter === '' ? '(?:$|\\\\/)' : ''\n\n re = nlBefore + nlFirst + nlAfter + dollar + nlLast\n }\n\n // if the re is not \"\" at this point, then we need to make sure\n // it doesn't match against an empty path part.\n // Otherwise a/* will match a/, which it should not.\n if (re !== '' && hasMagic) {\n re = '(?=.)' + re\n }\n\n if (addPatternStart) {\n re = patternStart() + re\n }\n\n // if it's nocase, and the lcase/uppercase don't match, it's magic\n if (options.nocase && !hasMagic && !options.nocaseMagicOnly) {\n hasMagic = pattern.toUpperCase() !== pattern.toLowerCase()\n }\n\n // skip the regexp for non-magical patterns\n // unescape anything in it, though, so that it'll be\n // an exact match against a file etc.\n if (!hasMagic) {\n return globUnescape(re)\n }\n\n return re\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAUlD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertValidPattern = void 0;
|
|
4
|
+
const MAX_PATTERN_LENGTH = 1024 * 64;
|
|
5
|
+
const assertValidPattern = (pattern) => {
|
|
6
|
+
if (typeof pattern !== 'string') {
|
|
7
|
+
throw new TypeError('invalid pattern');
|
|
8
|
+
}
|
|
9
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
10
|
+
throw new TypeError('pattern is too long');
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.assertValidPattern = assertValidPattern;
|
|
14
|
+
//# sourceMappingURL=assert-valid-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AAC7B,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;KACvC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE;QACvC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;KAC3C;AACH,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n pattern: any\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]}
|
|
@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I,IAAI,CAAC,MAAM;QAC1B,CAAC,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG;QACnC,CAAC,CAAC,MAAM,CAAC,MAAM;YACf,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,KAAK,CAAA;IAEX,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;AAC1C,CAAC,CAAA;AAhIY,QAAA,UAAU,cAgItB","sourcesContent":["// translate the various posix character classes into unicode properties\n// this works across all unicode locales\n\n// { <posix class>: [<translation>, /u flag required, negated]\nconst posixClasses: { [k: string]: [e: string, u: boolean, n?: boolean] } = {\n '[:alnum:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}', true],\n '[:alpha:]': ['\\\\p{L}\\\\p{Nl}', true],\n '[:ascii:]': ['\\\\x' + '00-\\\\x' + '7f', false],\n '[:blank:]': ['\\\\p{Zs}\\\\t', true],\n '[:cntrl:]': ['\\\\p{Cc}', true],\n '[:digit:]': ['\\\\p{Nd}', true],\n '[:graph:]': ['\\\\p{Z}\\\\p{C}', true, true],\n '[:lower:]': ['\\\\p{Ll}', true],\n '[:print:]': ['\\\\p{C}', true],\n '[:punct:]': ['\\\\p{P}', true],\n '[:space:]': ['\\\\p{Z}\\\\t\\\\r\\\\n\\\\v\\\\f', true],\n '[:upper:]': ['\\\\p{Lu}', true],\n '[:word:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}', true],\n '[:xdigit:]': ['A-Fa-f0-9', false],\n}\n\n// only need to escape a few things inside of brace expressions\n// escapes: [ \\ ] -\nconst braceEscape = (s: string) => s.replace(/[[\\]\\\\-]/g, '\\\\$&')\n// escape all regexp magic characters\nconst regexpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// everything has already been escaped, we just have to join\nconst rangesToString = (ranges: string[]): string => ranges.join('')\n\nexport type ParseClassResult = [\n src: string,\n uFlag: boolean,\n consumed: number,\n hasMagic: boolean\n]\n\n// takes a glob string at a posix brace expression, and returns\n// an equivalent regular expression source, and boolean indicating\n// whether the /u flag needs to be applied, and the number of chars\n// consumed to parse the character class.\n// This also removes out of order ranges, and returns ($.) if the\n// entire class just no good.\nexport const parseClass = (\n glob: string,\n position: number\n): ParseClassResult => {\n const pos = position\n /* c8 ignore start */\n if (glob.charAt(pos) !== '[') {\n throw new Error('not in a brace expression')\n }\n /* c8 ignore stop */\n const ranges: string[] = []\n const negs: string[] = []\n\n let i = pos + 1\n let sawStart = false\n let uflag = false\n let escaping = false\n let negate = false\n let endPos = pos\n let rangeStart = ''\n WHILE: while (i < glob.length) {\n const c = glob.charAt(i)\n if ((c === '!' || c === '^') && i === pos + 1) {\n negate = true\n i++\n continue\n }\n\n if (c === ']' && sawStart && !escaping) {\n endPos = i + 1\n break\n }\n\n sawStart = true\n if (c === '\\\\') {\n if (!escaping) {\n escaping = true\n i++\n continue\n }\n // escaped \\ char, fall through and treat like normal char\n }\n if (c === '[' && !escaping) {\n // either a posix class, a collation equivalent, or just a [\n for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {\n if (glob.startsWith(cls, i)) {\n // invalid, [a-[] is fine, but not [a-[:alpha]]\n if (rangeStart) {\n return ['$.', false, glob.length - pos, true]\n }\n i += cls.length\n if (neg) negs.push(unip)\n else ranges.push(unip)\n uflag = uflag || u\n continue WHILE\n }\n }\n }\n\n // now it's just a normal character, effectively\n escaping = false\n if (rangeStart) {\n // throw this range away if it's not valid, but others\n // can still match.\n if (c > rangeStart) {\n ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c))\n } else if (c === rangeStart) {\n ranges.push(braceEscape(c))\n }\n rangeStart = ''\n i++\n continue\n }\n\n // now might be the start of a range.\n // can be either c-d or c-] or c<more...>] or c] at this point\n if (glob.startsWith('-]', i + 1)) {\n ranges.push(braceEscape(c + '-'))\n i += 2\n continue\n }\n if (glob.startsWith('-', i + 1)) {\n rangeStart = c\n i += 2\n continue\n }\n\n // not the start of a range, just a single character\n ranges.push(braceEscape(c))\n i++\n }\n\n if (endPos < i) {\n // didn't see the end of the class, not a valid class,\n // but might still be valid as a literal match.\n return ['', false, 0, false]\n }\n\n // if we got no ranges and no negates, then we have a range that\n // cannot possibly match anything, and that poisons the whole glob\n if (!ranges.length && !negs.length) {\n return ['$.', false, glob.length - pos, true]\n }\n\n // if we got one positive range, and it's a single character, then that's\n // not actually a magic pattern, it's just that one literal character.\n // we should not treat that as \"magic\", we should just return the literal\n // character. [_] is a perfectly valid way to escape glob magic chars.\n if (\n negs.length === 0 &&\n ranges.length === 1 &&\n /^\\\\?.$/.test(ranges[0]) &&\n !negate\n ) {\n const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]\n return [regexpEscape(r), false, endPos - pos, false]\n }\n\n const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']'\n const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']'\n const comb =\n ranges.length && negs.length\n ? '(' + sranges + '|' + snegs + ')'\n : ranges.length\n ? sranges\n : snegs\n\n return [comb, uflag, endPos - pos, true]\n}\n"]}
|
package/dist/cjs/escape.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;GAQG;AACI,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA;AAZY,QAAA,MAAM,UAYlB"}
|
|
1
|
+
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;GAQG;AACI,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA;AAZY,QAAA,MAAM,UAYlB","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Escape all magic characters in a glob pattern.\n *\n * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}\n * option is used, then characters are escaped by wrapping in `[]`, because\n * a magic character wrapped in a character class can only be satisfied by\n * that exact character. In this mode, `\\` is _not_ escaped, because it is\n * not interpreted as a magic character, but instead as a path separator.\n */\nexport const escape = (\n s: string,\n {\n windowsPathsNoEscape = false,\n }: Pick<MinimatchOptions, 'windowsPathsNoEscape'> = {}\n) => {\n // don't need to escape +@! because we escape the parens\n // that make those magic, and escaping ! as [!] isn't valid,\n // because [!]] is a valid glob class meaning not ']'.\n return windowsPathsNoEscape\n ? s.replace(/[?*()[\\]]/g, '[$&]')\n : s.replace(/[?*()[\\]\\\\]/g, '\\\\$&')\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extglob.d.ts","sourceRoot":"","sources":["../../src/extglob.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extglob.js","sourceRoot":"","sources":["../../src/extglob.ts"],"names":[],"mappings":";AAAA,iDAAiD","sourcesContent":["// translate an extglob into a regular expression\n\n// call into this when we get a [!?@+] followed by (\n// Walk down until we find the appropriate closing ),\n// and parse all the sections.\n\n\nexport {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-cjs.js","sourceRoot":"","sources":["../../src/index-cjs.ts"],"names":[],"mappings":";;;;AAAA,0DAAkC;AAElC,iBAAS,MAAM,CAAC,MAAM,CAAC,kBAAS,EAAE,EAAE,OAAO,EAAE,kBAAS,EAAE,SAAS,EAAT,kBAAS,EAAE,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index-cjs.js","sourceRoot":"","sources":["../../src/index-cjs.ts"],"names":[],"mappings":";;;;AAAA,0DAAkC;AAElC,iBAAS,MAAM,CAAC,MAAM,CAAC,kBAAS,EAAE,EAAE,OAAO,EAAE,kBAAS,EAAE,SAAS,EAAT,kBAAS,EAAE,CAAC,CAAA","sourcesContent":["import minimatch from './index.js'\n\nexport = Object.assign(minimatch, { default: minimatch, minimatch })\n"]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface MinimatchOptions {
|
|
|
17
17
|
flipNegate?: boolean;
|
|
18
18
|
preserveMultipleSlashes?: boolean;
|
|
19
19
|
optimizationLevel?: number;
|
|
20
|
-
platform?:
|
|
20
|
+
platform?: 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
|
|
21
21
|
windowsNoMagicRoot?: boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare const minimatch: {
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,O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