@@ -10,10 +10,8 @@ var require_balanced_match = __commonJS({ |
10 | 10 | "use strict"; |
11 | 11 | module2.exports = balanced; |
12 | 12 | function balanced(a, b, str) { |
13 | | - if (a instanceof RegExp) |
14 | | - a = maybeMatch(a, str); |
15 | | - if (b instanceof RegExp) |
16 | | - b = maybeMatch(b, str); |
| 13 | + if (a instanceof RegExp) a = maybeMatch(a, str); |
| 14 | + if (b instanceof RegExp) b = maybeMatch(b, str); |
17 | 15 | var r = range(a, b, str); |
18 | 16 | return r && { |
19 | 17 | start: r[0], |
@@ -126,8 +124,7 @@ var require_brace_expansion = __commonJS({ |
126 | 124 | function expand(str, isTop) { |
127 | 125 | var expansions = []; |
128 | 126 | var m = balanced("{", "}", str); |
129 | | - if (!m) |
130 | | - return [str]; |
| 127 | + if (!m) return [str]; |
131 | 128 | var pre = m.pre; |
132 | 129 | var post = m.post.length ? expand(m.post, false) : [""]; |
133 | 130 | if (/\$$/.test(m.pre)) { |
@@ -273,66 +270,65 @@ var require_brace_expressions = __commonJS({ |
273 | 270 | let negate = false; |
274 | 271 | let endPos = pos; |
275 | 272 | let rangeStart = ""; |
276 | | - WHILE: |
277 | | - while (i < glob.length) { |
278 | | - const c = glob.charAt(i); |
279 | | - if ((c === "!" || c === "^") && i === pos + 1) { |
280 | | - negate = true; |
| 273 | + WHILE: while (i < glob.length) { |
| 274 | + const c = glob.charAt(i); |
| 275 | + if ((c === "!" || c === "^") && i === pos + 1) { |
| 276 | + negate = true; |
| 277 | + i++; |
| 278 | + continue; |
| 279 | + } |
| 280 | + if (c === "]" && sawStart && !escaping) { |
| 281 | + endPos = i + 1; |
| 282 | + break; |
| 283 | + } |
| 284 | + sawStart = true; |
| 285 | + if (c === "\\") { |
| 286 | + if (!escaping) { |
| 287 | + escaping = true; |
281 | 288 | i++; |
282 | 289 | continue; |
283 | 290 | } |
284 | | - if (c === "]" && sawStart && !escaping) { |
285 | | - endPos = i + 1; |
286 | | - break; |
287 | | - } |
288 | | - sawStart = true; |
289 | | - if (c === "\\") { |
290 | | - if (!escaping) { |
291 | | - escaping = true; |
292 | | - i++; |
293 | | - continue; |
294 | | - } |
295 | | - } |
296 | | - if (c === "[" && !escaping) { |
297 | | - for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) { |
298 | | - if (glob.startsWith(cls, i)) { |
299 | | - if (rangeStart) { |
300 | | - return ["$.", false, glob.length - pos, true]; |
301 | | - } |
302 | | - i += cls.length; |
303 | | - if (neg) |
304 | | - negs.push(unip); |
305 | | - else |
306 | | - ranges.push(unip); |
307 | | - uflag = uflag || u; |
308 | | - continue WHILE; |
| 291 | + } |
| 292 | + if (c === "[" && !escaping) { |
| 293 | + for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) { |
| 294 | + if (glob.startsWith(cls, i)) { |
| 295 | + if (rangeStart) { |
| 296 | + return ["$.", false, glob.length - pos, true]; |
309 | 297 | } |
| 298 | + i += cls.length; |
| 299 | + if (neg) |
| 300 | + negs.push(unip); |
| 301 | + else |
| 302 | + ranges.push(unip); |
| 303 | + uflag = uflag || u; |
| 304 | + continue WHILE; |
310 | 305 | } |
311 | 306 | } |
312 | | - escaping = false; |
313 | | - if (rangeStart) { |
314 | | - if (c > rangeStart) { |
315 | | - ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c)); |
316 | | - } else if (c === rangeStart) { |
317 | | - ranges.push(braceEscape(c)); |
318 | | - } |
319 | | - rangeStart = ""; |
320 | | - i++; |
321 | | - continue; |
322 | | - } |
323 | | - if (glob.startsWith("-]", i + 1)) { |
324 | | - ranges.push(braceEscape(c + "-")); |
325 | | - i += 2; |
326 | | - continue; |
327 | | - } |
328 | | - if (glob.startsWith("-", i + 1)) { |
329 | | - rangeStart = c; |
330 | | - i += 2; |
331 | | - continue; |
| 307 | + } |
| 308 | + escaping = false; |
| 309 | + if (rangeStart) { |
| 310 | + if (c > rangeStart) { |
| 311 | + ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c)); |
| 312 | + } else if (c === rangeStart) { |
| 313 | + ranges.push(braceEscape(c)); |
332 | 314 | } |
333 | | - ranges.push(braceEscape(c)); |
| 315 | + rangeStart = ""; |
334 | 316 | i++; |
| 317 | + continue; |
335 | 318 | } |
| 319 | + if (glob.startsWith("-]", i + 1)) { |
| 320 | + ranges.push(braceEscape(c + "-")); |
| 321 | + i += 2; |
| 322 | + continue; |
| 323 | + } |
| 324 | + if (glob.startsWith("-", i + 1)) { |
| 325 | + rangeStart = c; |
| 326 | + i += 2; |
| 327 | + continue; |
| 328 | + } |
| 329 | + ranges.push(braceEscape(c)); |
| 330 | + i++; |
| 331 | + } |
336 | 332 | if (endPos < i) { |
337 | 333 | return ["", false, 0, false]; |
338 | 334 | } |
@@ -1304,10 +1300,11 @@ var Minimatch = class { |
1304 | 1300 | for (let i = 0; i < globParts.length - 1; i++) { |
1305 | 1301 | for (let j = i + 1; j < globParts.length; j++) { |
1306 | 1302 | const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes); |
1307 | | - if (!matched) |
1308 | | - continue; |
1309 | | - globParts[i] = matched; |
1310 | | - globParts[j] = []; |
| 1303 | + if (matched) { |
| 1304 | + globParts[i] = []; |
| 1305 | + globParts[j] = matched; |
| 1306 | + break; |
| 1307 | + } |
1311 | 1308 | } |
1312 | 1309 | } |
1313 | 1310 | return globParts.filter((gs) => gs.length); |
|