vite 6.2.2 → 6.3.0-beta.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/LICENSE.md +0 -58
- package/dist/node/chunks/{dep-BL6Xg-kE.js → dep-2sb0gr4n.js} +1 -1
- package/dist/node/chunks/{dep-dLifoI9c.js → dep-BXITORG_.js} +1 -1
- package/dist/node/chunks/{dep-B0fRCRkQ.js → dep-Bt1yO2CH.js} +20248 -24358
- package/dist/node/cli.js +7 -5
- package/dist/node/index.d.ts +36 -7
- package/dist/node/index.js +43 -3
- package/dist/node-cjs/publicUtils.cjs +1 -2080
- package/index.cjs +2 -0
- package/package.json +8 -8
- package/types/customEvent.d.ts +6 -1
- package/types/hot.d.ts +7 -4
- package/types/importMeta.d.ts +10 -1
- package/types/metadata.d.ts +22 -0
@@ -9,6 +9,7 @@ var node_module = require('node:module');
|
|
9
9
|
var require$$0 = require('tty');
|
10
10
|
var require$$1 = require('util');
|
11
11
|
var require$$1$1 = require('path');
|
12
|
+
var pm = require('picomatch');
|
12
13
|
var require$$0$1 = require('crypto');
|
13
14
|
var require$$1$2 = require('fs');
|
14
15
|
var readline = require('node:readline');
|
@@ -1273,2086 +1274,6 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
|
|
1273
1274
|
var srcExports = src.exports;
|
1274
1275
|
var debug$3 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
1275
1276
|
|
1276
|
-
var utils$4 = {};
|
1277
|
-
|
1278
|
-
const WIN_SLASH = '\\\\/';
|
1279
|
-
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
1280
|
-
|
1281
|
-
/**
|
1282
|
-
* Posix glob regex
|
1283
|
-
*/
|
1284
|
-
|
1285
|
-
const DOT_LITERAL = '\\.';
|
1286
|
-
const PLUS_LITERAL = '\\+';
|
1287
|
-
const QMARK_LITERAL = '\\?';
|
1288
|
-
const SLASH_LITERAL = '\\/';
|
1289
|
-
const ONE_CHAR = '(?=.)';
|
1290
|
-
const QMARK = '[^/]';
|
1291
|
-
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
1292
|
-
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
1293
|
-
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
1294
|
-
const NO_DOT = `(?!${DOT_LITERAL})`;
|
1295
|
-
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
1296
|
-
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
1297
|
-
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
1298
|
-
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
1299
|
-
const STAR = `${QMARK}*?`;
|
1300
|
-
const SEP = '/';
|
1301
|
-
|
1302
|
-
const POSIX_CHARS = {
|
1303
|
-
DOT_LITERAL,
|
1304
|
-
PLUS_LITERAL,
|
1305
|
-
QMARK_LITERAL,
|
1306
|
-
SLASH_LITERAL,
|
1307
|
-
ONE_CHAR,
|
1308
|
-
QMARK,
|
1309
|
-
END_ANCHOR,
|
1310
|
-
DOTS_SLASH,
|
1311
|
-
NO_DOT,
|
1312
|
-
NO_DOTS,
|
1313
|
-
NO_DOT_SLASH,
|
1314
|
-
NO_DOTS_SLASH,
|
1315
|
-
QMARK_NO_DOT,
|
1316
|
-
STAR,
|
1317
|
-
START_ANCHOR,
|
1318
|
-
SEP
|
1319
|
-
};
|
1320
|
-
|
1321
|
-
/**
|
1322
|
-
* Windows glob regex
|
1323
|
-
*/
|
1324
|
-
|
1325
|
-
const WINDOWS_CHARS = {
|
1326
|
-
...POSIX_CHARS,
|
1327
|
-
|
1328
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
1329
|
-
QMARK: WIN_NO_SLASH,
|
1330
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
1331
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
1332
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
1333
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
1334
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
1335
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
1336
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
1337
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
1338
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
1339
|
-
SEP: '\\'
|
1340
|
-
};
|
1341
|
-
|
1342
|
-
/**
|
1343
|
-
* POSIX Bracket Regex
|
1344
|
-
*/
|
1345
|
-
|
1346
|
-
const POSIX_REGEX_SOURCE$1 = {
|
1347
|
-
alnum: 'a-zA-Z0-9',
|
1348
|
-
alpha: 'a-zA-Z',
|
1349
|
-
ascii: '\\x00-\\x7F',
|
1350
|
-
blank: ' \\t',
|
1351
|
-
cntrl: '\\x00-\\x1F\\x7F',
|
1352
|
-
digit: '0-9',
|
1353
|
-
graph: '\\x21-\\x7E',
|
1354
|
-
lower: 'a-z',
|
1355
|
-
print: '\\x20-\\x7E ',
|
1356
|
-
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
1357
|
-
space: ' \\t\\r\\n\\v\\f',
|
1358
|
-
upper: 'A-Z',
|
1359
|
-
word: 'A-Za-z0-9_',
|
1360
|
-
xdigit: 'A-Fa-f0-9'
|
1361
|
-
};
|
1362
|
-
|
1363
|
-
var constants$2 = {
|
1364
|
-
MAX_LENGTH: 1024 * 64,
|
1365
|
-
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
1366
|
-
|
1367
|
-
// regular expressions
|
1368
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
1369
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
1370
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
1371
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
1372
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
1373
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
1374
|
-
|
1375
|
-
// Replace globs with equivalent patterns to reduce parsing time.
|
1376
|
-
REPLACEMENTS: {
|
1377
|
-
'***': '*',
|
1378
|
-
'**/**': '**',
|
1379
|
-
'**/**/**': '**'
|
1380
|
-
},
|
1381
|
-
|
1382
|
-
// Digits
|
1383
|
-
CHAR_0: 48, /* 0 */
|
1384
|
-
CHAR_9: 57, /* 9 */
|
1385
|
-
|
1386
|
-
// Alphabet chars.
|
1387
|
-
CHAR_UPPERCASE_A: 65, /* A */
|
1388
|
-
CHAR_LOWERCASE_A: 97, /* a */
|
1389
|
-
CHAR_UPPERCASE_Z: 90, /* Z */
|
1390
|
-
CHAR_LOWERCASE_Z: 122, /* z */
|
1391
|
-
|
1392
|
-
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
1393
|
-
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
1394
|
-
|
1395
|
-
CHAR_ASTERISK: 42, /* * */
|
1396
|
-
|
1397
|
-
// Non-alphabetic chars.
|
1398
|
-
CHAR_AMPERSAND: 38, /* & */
|
1399
|
-
CHAR_AT: 64, /* @ */
|
1400
|
-
CHAR_BACKWARD_SLASH: 92, /* \ */
|
1401
|
-
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
1402
|
-
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
1403
|
-
CHAR_COLON: 58, /* : */
|
1404
|
-
CHAR_COMMA: 44, /* , */
|
1405
|
-
CHAR_DOT: 46, /* . */
|
1406
|
-
CHAR_DOUBLE_QUOTE: 34, /* " */
|
1407
|
-
CHAR_EQUAL: 61, /* = */
|
1408
|
-
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
1409
|
-
CHAR_FORM_FEED: 12, /* \f */
|
1410
|
-
CHAR_FORWARD_SLASH: 47, /* / */
|
1411
|
-
CHAR_GRAVE_ACCENT: 96, /* ` */
|
1412
|
-
CHAR_HASH: 35, /* # */
|
1413
|
-
CHAR_HYPHEN_MINUS: 45, /* - */
|
1414
|
-
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
1415
|
-
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
1416
|
-
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
1417
|
-
CHAR_LINE_FEED: 10, /* \n */
|
1418
|
-
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
1419
|
-
CHAR_PERCENT: 37, /* % */
|
1420
|
-
CHAR_PLUS: 43, /* + */
|
1421
|
-
CHAR_QUESTION_MARK: 63, /* ? */
|
1422
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
1423
|
-
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
1424
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
1425
|
-
CHAR_SEMICOLON: 59, /* ; */
|
1426
|
-
CHAR_SINGLE_QUOTE: 39, /* ' */
|
1427
|
-
CHAR_SPACE: 32, /* */
|
1428
|
-
CHAR_TAB: 9, /* \t */
|
1429
|
-
CHAR_UNDERSCORE: 95, /* _ */
|
1430
|
-
CHAR_VERTICAL_LINE: 124, /* | */
|
1431
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
1432
|
-
|
1433
|
-
/**
|
1434
|
-
* Create EXTGLOB_CHARS
|
1435
|
-
*/
|
1436
|
-
|
1437
|
-
extglobChars(chars) {
|
1438
|
-
return {
|
1439
|
-
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
1440
|
-
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
1441
|
-
'+': { type: 'plus', open: '(?:', close: ')+' },
|
1442
|
-
'*': { type: 'star', open: '(?:', close: ')*' },
|
1443
|
-
'@': { type: 'at', open: '(?:', close: ')' }
|
1444
|
-
};
|
1445
|
-
},
|
1446
|
-
|
1447
|
-
/**
|
1448
|
-
* Create GLOB_CHARS
|
1449
|
-
*/
|
1450
|
-
|
1451
|
-
globChars(win32) {
|
1452
|
-
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
1453
|
-
}
|
1454
|
-
};
|
1455
|
-
|
1456
|
-
/*global navigator*/
|
1457
|
-
|
1458
|
-
(function (exports) {
|
1459
|
-
|
1460
|
-
const {
|
1461
|
-
REGEX_BACKSLASH,
|
1462
|
-
REGEX_REMOVE_BACKSLASH,
|
1463
|
-
REGEX_SPECIAL_CHARS,
|
1464
|
-
REGEX_SPECIAL_CHARS_GLOBAL
|
1465
|
-
} = constants$2;
|
1466
|
-
|
1467
|
-
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
1468
|
-
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
1469
|
-
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
1470
|
-
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
1471
|
-
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
1472
|
-
|
1473
|
-
exports.isWindows = () => {
|
1474
|
-
if (typeof navigator !== 'undefined' && navigator.platform) {
|
1475
|
-
const platform = navigator.platform.toLowerCase();
|
1476
|
-
return platform === 'win32' || platform === 'windows';
|
1477
|
-
}
|
1478
|
-
|
1479
|
-
if (typeof process !== 'undefined' && process.platform) {
|
1480
|
-
return process.platform === 'win32';
|
1481
|
-
}
|
1482
|
-
|
1483
|
-
return false;
|
1484
|
-
};
|
1485
|
-
|
1486
|
-
exports.removeBackslashes = str => {
|
1487
|
-
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
1488
|
-
return match === '\\' ? '' : match;
|
1489
|
-
});
|
1490
|
-
};
|
1491
|
-
|
1492
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
1493
|
-
const idx = input.lastIndexOf(char, lastIdx);
|
1494
|
-
if (idx === -1) return input;
|
1495
|
-
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
1496
|
-
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
1497
|
-
};
|
1498
|
-
|
1499
|
-
exports.removePrefix = (input, state = {}) => {
|
1500
|
-
let output = input;
|
1501
|
-
if (output.startsWith('./')) {
|
1502
|
-
output = output.slice(2);
|
1503
|
-
state.prefix = './';
|
1504
|
-
}
|
1505
|
-
return output;
|
1506
|
-
};
|
1507
|
-
|
1508
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
1509
|
-
const prepend = options.contains ? '' : '^';
|
1510
|
-
const append = options.contains ? '' : '$';
|
1511
|
-
|
1512
|
-
let output = `${prepend}(?:${input})${append}`;
|
1513
|
-
if (state.negated === true) {
|
1514
|
-
output = `(?:^(?!${output}).*$)`;
|
1515
|
-
}
|
1516
|
-
return output;
|
1517
|
-
};
|
1518
|
-
|
1519
|
-
exports.basename = (path, { windows } = {}) => {
|
1520
|
-
const segs = path.split(windows ? /[\\/]/ : '/');
|
1521
|
-
const last = segs[segs.length - 1];
|
1522
|
-
|
1523
|
-
if (last === '') {
|
1524
|
-
return segs[segs.length - 2];
|
1525
|
-
}
|
1526
|
-
|
1527
|
-
return last;
|
1528
|
-
};
|
1529
|
-
} (utils$4));
|
1530
|
-
|
1531
|
-
const utils$3 = utils$4;
|
1532
|
-
const {
|
1533
|
-
CHAR_ASTERISK, /* * */
|
1534
|
-
CHAR_AT, /* @ */
|
1535
|
-
CHAR_BACKWARD_SLASH, /* \ */
|
1536
|
-
CHAR_COMMA, /* , */
|
1537
|
-
CHAR_DOT, /* . */
|
1538
|
-
CHAR_EXCLAMATION_MARK, /* ! */
|
1539
|
-
CHAR_FORWARD_SLASH, /* / */
|
1540
|
-
CHAR_LEFT_CURLY_BRACE, /* { */
|
1541
|
-
CHAR_LEFT_PARENTHESES, /* ( */
|
1542
|
-
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
1543
|
-
CHAR_PLUS, /* + */
|
1544
|
-
CHAR_QUESTION_MARK, /* ? */
|
1545
|
-
CHAR_RIGHT_CURLY_BRACE, /* } */
|
1546
|
-
CHAR_RIGHT_PARENTHESES, /* ) */
|
1547
|
-
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
1548
|
-
} = constants$2;
|
1549
|
-
|
1550
|
-
const isPathSeparator = code => {
|
1551
|
-
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
1552
|
-
};
|
1553
|
-
|
1554
|
-
const depth = token => {
|
1555
|
-
if (token.isPrefix !== true) {
|
1556
|
-
token.depth = token.isGlobstar ? Infinity : 1;
|
1557
|
-
}
|
1558
|
-
};
|
1559
|
-
|
1560
|
-
/**
|
1561
|
-
* Quickly scans a glob pattern and returns an object with a handful of
|
1562
|
-
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
1563
|
-
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
1564
|
-
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
1565
|
-
*
|
1566
|
-
* ```js
|
1567
|
-
* const pm = require('picomatch');
|
1568
|
-
* console.log(pm.scan('foo/bar/*.js'));
|
1569
|
-
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
1570
|
-
* ```
|
1571
|
-
* @param {String} `str`
|
1572
|
-
* @param {Object} `options`
|
1573
|
-
* @return {Object} Returns an object with tokens and regex source string.
|
1574
|
-
* @api public
|
1575
|
-
*/
|
1576
|
-
|
1577
|
-
const scan$1 = (input, options) => {
|
1578
|
-
const opts = options || {};
|
1579
|
-
|
1580
|
-
const length = input.length - 1;
|
1581
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
1582
|
-
const slashes = [];
|
1583
|
-
const tokens = [];
|
1584
|
-
const parts = [];
|
1585
|
-
|
1586
|
-
let str = input;
|
1587
|
-
let index = -1;
|
1588
|
-
let start = 0;
|
1589
|
-
let lastIndex = 0;
|
1590
|
-
let isBrace = false;
|
1591
|
-
let isBracket = false;
|
1592
|
-
let isGlob = false;
|
1593
|
-
let isExtglob = false;
|
1594
|
-
let isGlobstar = false;
|
1595
|
-
let braceEscaped = false;
|
1596
|
-
let backslashes = false;
|
1597
|
-
let negated = false;
|
1598
|
-
let negatedExtglob = false;
|
1599
|
-
let finished = false;
|
1600
|
-
let braces = 0;
|
1601
|
-
let prev;
|
1602
|
-
let code;
|
1603
|
-
let token = { value: '', depth: 0, isGlob: false };
|
1604
|
-
|
1605
|
-
const eos = () => index >= length;
|
1606
|
-
const peek = () => str.charCodeAt(index + 1);
|
1607
|
-
const advance = () => {
|
1608
|
-
prev = code;
|
1609
|
-
return str.charCodeAt(++index);
|
1610
|
-
};
|
1611
|
-
|
1612
|
-
while (index < length) {
|
1613
|
-
code = advance();
|
1614
|
-
let next;
|
1615
|
-
|
1616
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
1617
|
-
backslashes = token.backslashes = true;
|
1618
|
-
code = advance();
|
1619
|
-
|
1620
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
1621
|
-
braceEscaped = true;
|
1622
|
-
}
|
1623
|
-
continue;
|
1624
|
-
}
|
1625
|
-
|
1626
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
1627
|
-
braces++;
|
1628
|
-
|
1629
|
-
while (eos() !== true && (code = advance())) {
|
1630
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
1631
|
-
backslashes = token.backslashes = true;
|
1632
|
-
advance();
|
1633
|
-
continue;
|
1634
|
-
}
|
1635
|
-
|
1636
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
1637
|
-
braces++;
|
1638
|
-
continue;
|
1639
|
-
}
|
1640
|
-
|
1641
|
-
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
1642
|
-
isBrace = token.isBrace = true;
|
1643
|
-
isGlob = token.isGlob = true;
|
1644
|
-
finished = true;
|
1645
|
-
|
1646
|
-
if (scanToEnd === true) {
|
1647
|
-
continue;
|
1648
|
-
}
|
1649
|
-
|
1650
|
-
break;
|
1651
|
-
}
|
1652
|
-
|
1653
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
1654
|
-
isBrace = token.isBrace = true;
|
1655
|
-
isGlob = token.isGlob = true;
|
1656
|
-
finished = true;
|
1657
|
-
|
1658
|
-
if (scanToEnd === true) {
|
1659
|
-
continue;
|
1660
|
-
}
|
1661
|
-
|
1662
|
-
break;
|
1663
|
-
}
|
1664
|
-
|
1665
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
1666
|
-
braces--;
|
1667
|
-
|
1668
|
-
if (braces === 0) {
|
1669
|
-
braceEscaped = false;
|
1670
|
-
isBrace = token.isBrace = true;
|
1671
|
-
finished = true;
|
1672
|
-
break;
|
1673
|
-
}
|
1674
|
-
}
|
1675
|
-
}
|
1676
|
-
|
1677
|
-
if (scanToEnd === true) {
|
1678
|
-
continue;
|
1679
|
-
}
|
1680
|
-
|
1681
|
-
break;
|
1682
|
-
}
|
1683
|
-
|
1684
|
-
if (code === CHAR_FORWARD_SLASH) {
|
1685
|
-
slashes.push(index);
|
1686
|
-
tokens.push(token);
|
1687
|
-
token = { value: '', depth: 0, isGlob: false };
|
1688
|
-
|
1689
|
-
if (finished === true) continue;
|
1690
|
-
if (prev === CHAR_DOT && index === (start + 1)) {
|
1691
|
-
start += 2;
|
1692
|
-
continue;
|
1693
|
-
}
|
1694
|
-
|
1695
|
-
lastIndex = index + 1;
|
1696
|
-
continue;
|
1697
|
-
}
|
1698
|
-
|
1699
|
-
if (opts.noext !== true) {
|
1700
|
-
const isExtglobChar = code === CHAR_PLUS
|
1701
|
-
|| code === CHAR_AT
|
1702
|
-
|| code === CHAR_ASTERISK
|
1703
|
-
|| code === CHAR_QUESTION_MARK
|
1704
|
-
|| code === CHAR_EXCLAMATION_MARK;
|
1705
|
-
|
1706
|
-
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
1707
|
-
isGlob = token.isGlob = true;
|
1708
|
-
isExtglob = token.isExtglob = true;
|
1709
|
-
finished = true;
|
1710
|
-
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
1711
|
-
negatedExtglob = true;
|
1712
|
-
}
|
1713
|
-
|
1714
|
-
if (scanToEnd === true) {
|
1715
|
-
while (eos() !== true && (code = advance())) {
|
1716
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
1717
|
-
backslashes = token.backslashes = true;
|
1718
|
-
code = advance();
|
1719
|
-
continue;
|
1720
|
-
}
|
1721
|
-
|
1722
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
1723
|
-
isGlob = token.isGlob = true;
|
1724
|
-
finished = true;
|
1725
|
-
break;
|
1726
|
-
}
|
1727
|
-
}
|
1728
|
-
continue;
|
1729
|
-
}
|
1730
|
-
break;
|
1731
|
-
}
|
1732
|
-
}
|
1733
|
-
|
1734
|
-
if (code === CHAR_ASTERISK) {
|
1735
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
1736
|
-
isGlob = token.isGlob = true;
|
1737
|
-
finished = true;
|
1738
|
-
|
1739
|
-
if (scanToEnd === true) {
|
1740
|
-
continue;
|
1741
|
-
}
|
1742
|
-
break;
|
1743
|
-
}
|
1744
|
-
|
1745
|
-
if (code === CHAR_QUESTION_MARK) {
|
1746
|
-
isGlob = token.isGlob = true;
|
1747
|
-
finished = true;
|
1748
|
-
|
1749
|
-
if (scanToEnd === true) {
|
1750
|
-
continue;
|
1751
|
-
}
|
1752
|
-
break;
|
1753
|
-
}
|
1754
|
-
|
1755
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
1756
|
-
while (eos() !== true && (next = advance())) {
|
1757
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
1758
|
-
backslashes = token.backslashes = true;
|
1759
|
-
advance();
|
1760
|
-
continue;
|
1761
|
-
}
|
1762
|
-
|
1763
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
1764
|
-
isBracket = token.isBracket = true;
|
1765
|
-
isGlob = token.isGlob = true;
|
1766
|
-
finished = true;
|
1767
|
-
break;
|
1768
|
-
}
|
1769
|
-
}
|
1770
|
-
|
1771
|
-
if (scanToEnd === true) {
|
1772
|
-
continue;
|
1773
|
-
}
|
1774
|
-
|
1775
|
-
break;
|
1776
|
-
}
|
1777
|
-
|
1778
|
-
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
1779
|
-
negated = token.negated = true;
|
1780
|
-
start++;
|
1781
|
-
continue;
|
1782
|
-
}
|
1783
|
-
|
1784
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
1785
|
-
isGlob = token.isGlob = true;
|
1786
|
-
|
1787
|
-
if (scanToEnd === true) {
|
1788
|
-
while (eos() !== true && (code = advance())) {
|
1789
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
1790
|
-
backslashes = token.backslashes = true;
|
1791
|
-
code = advance();
|
1792
|
-
continue;
|
1793
|
-
}
|
1794
|
-
|
1795
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
1796
|
-
finished = true;
|
1797
|
-
break;
|
1798
|
-
}
|
1799
|
-
}
|
1800
|
-
continue;
|
1801
|
-
}
|
1802
|
-
break;
|
1803
|
-
}
|
1804
|
-
|
1805
|
-
if (isGlob === true) {
|
1806
|
-
finished = true;
|
1807
|
-
|
1808
|
-
if (scanToEnd === true) {
|
1809
|
-
continue;
|
1810
|
-
}
|
1811
|
-
|
1812
|
-
break;
|
1813
|
-
}
|
1814
|
-
}
|
1815
|
-
|
1816
|
-
if (opts.noext === true) {
|
1817
|
-
isExtglob = false;
|
1818
|
-
isGlob = false;
|
1819
|
-
}
|
1820
|
-
|
1821
|
-
let base = str;
|
1822
|
-
let prefix = '';
|
1823
|
-
let glob = '';
|
1824
|
-
|
1825
|
-
if (start > 0) {
|
1826
|
-
prefix = str.slice(0, start);
|
1827
|
-
str = str.slice(start);
|
1828
|
-
lastIndex -= start;
|
1829
|
-
}
|
1830
|
-
|
1831
|
-
if (base && isGlob === true && lastIndex > 0) {
|
1832
|
-
base = str.slice(0, lastIndex);
|
1833
|
-
glob = str.slice(lastIndex);
|
1834
|
-
} else if (isGlob === true) {
|
1835
|
-
base = '';
|
1836
|
-
glob = str;
|
1837
|
-
} else {
|
1838
|
-
base = str;
|
1839
|
-
}
|
1840
|
-
|
1841
|
-
if (base && base !== '' && base !== '/' && base !== str) {
|
1842
|
-
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
1843
|
-
base = base.slice(0, -1);
|
1844
|
-
}
|
1845
|
-
}
|
1846
|
-
|
1847
|
-
if (opts.unescape === true) {
|
1848
|
-
if (glob) glob = utils$3.removeBackslashes(glob);
|
1849
|
-
|
1850
|
-
if (base && backslashes === true) {
|
1851
|
-
base = utils$3.removeBackslashes(base);
|
1852
|
-
}
|
1853
|
-
}
|
1854
|
-
|
1855
|
-
const state = {
|
1856
|
-
prefix,
|
1857
|
-
input,
|
1858
|
-
start,
|
1859
|
-
base,
|
1860
|
-
glob,
|
1861
|
-
isBrace,
|
1862
|
-
isBracket,
|
1863
|
-
isGlob,
|
1864
|
-
isExtglob,
|
1865
|
-
isGlobstar,
|
1866
|
-
negated,
|
1867
|
-
negatedExtglob
|
1868
|
-
};
|
1869
|
-
|
1870
|
-
if (opts.tokens === true) {
|
1871
|
-
state.maxDepth = 0;
|
1872
|
-
if (!isPathSeparator(code)) {
|
1873
|
-
tokens.push(token);
|
1874
|
-
}
|
1875
|
-
state.tokens = tokens;
|
1876
|
-
}
|
1877
|
-
|
1878
|
-
if (opts.parts === true || opts.tokens === true) {
|
1879
|
-
let prevIndex;
|
1880
|
-
|
1881
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
1882
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
1883
|
-
const i = slashes[idx];
|
1884
|
-
const value = input.slice(n, i);
|
1885
|
-
if (opts.tokens) {
|
1886
|
-
if (idx === 0 && start !== 0) {
|
1887
|
-
tokens[idx].isPrefix = true;
|
1888
|
-
tokens[idx].value = prefix;
|
1889
|
-
} else {
|
1890
|
-
tokens[idx].value = value;
|
1891
|
-
}
|
1892
|
-
depth(tokens[idx]);
|
1893
|
-
state.maxDepth += tokens[idx].depth;
|
1894
|
-
}
|
1895
|
-
if (idx !== 0 || value !== '') {
|
1896
|
-
parts.push(value);
|
1897
|
-
}
|
1898
|
-
prevIndex = i;
|
1899
|
-
}
|
1900
|
-
|
1901
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
1902
|
-
const value = input.slice(prevIndex + 1);
|
1903
|
-
parts.push(value);
|
1904
|
-
|
1905
|
-
if (opts.tokens) {
|
1906
|
-
tokens[tokens.length - 1].value = value;
|
1907
|
-
depth(tokens[tokens.length - 1]);
|
1908
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
1909
|
-
}
|
1910
|
-
}
|
1911
|
-
|
1912
|
-
state.slashes = slashes;
|
1913
|
-
state.parts = parts;
|
1914
|
-
}
|
1915
|
-
|
1916
|
-
return state;
|
1917
|
-
};
|
1918
|
-
|
1919
|
-
var scan_1 = scan$1;
|
1920
|
-
|
1921
|
-
const constants$1 = constants$2;
|
1922
|
-
const utils$2 = utils$4;
|
1923
|
-
|
1924
|
-
/**
|
1925
|
-
* Constants
|
1926
|
-
*/
|
1927
|
-
|
1928
|
-
const {
|
1929
|
-
MAX_LENGTH,
|
1930
|
-
POSIX_REGEX_SOURCE,
|
1931
|
-
REGEX_NON_SPECIAL_CHARS,
|
1932
|
-
REGEX_SPECIAL_CHARS_BACKREF,
|
1933
|
-
REPLACEMENTS
|
1934
|
-
} = constants$1;
|
1935
|
-
|
1936
|
-
/**
|
1937
|
-
* Helpers
|
1938
|
-
*/
|
1939
|
-
|
1940
|
-
const expandRange = (args, options) => {
|
1941
|
-
if (typeof options.expandRange === 'function') {
|
1942
|
-
return options.expandRange(...args, options);
|
1943
|
-
}
|
1944
|
-
|
1945
|
-
args.sort();
|
1946
|
-
const value = `[${args.join('-')}]`;
|
1947
|
-
|
1948
|
-
return value;
|
1949
|
-
};
|
1950
|
-
|
1951
|
-
/**
|
1952
|
-
* Create the message for a syntax error
|
1953
|
-
*/
|
1954
|
-
|
1955
|
-
const syntaxError = (type, char) => {
|
1956
|
-
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
1957
|
-
};
|
1958
|
-
|
1959
|
-
/**
|
1960
|
-
* Parse the given input string.
|
1961
|
-
* @param {String} input
|
1962
|
-
* @param {Object} options
|
1963
|
-
* @return {Object}
|
1964
|
-
*/
|
1965
|
-
|
1966
|
-
const parse$2 = (input, options) => {
|
1967
|
-
if (typeof input !== 'string') {
|
1968
|
-
throw new TypeError('Expected a string');
|
1969
|
-
}
|
1970
|
-
|
1971
|
-
input = REPLACEMENTS[input] || input;
|
1972
|
-
|
1973
|
-
const opts = { ...options };
|
1974
|
-
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
1975
|
-
|
1976
|
-
let len = input.length;
|
1977
|
-
if (len > max) {
|
1978
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
1979
|
-
}
|
1980
|
-
|
1981
|
-
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
1982
|
-
const tokens = [bos];
|
1983
|
-
|
1984
|
-
const capture = opts.capture ? '' : '?:';
|
1985
|
-
|
1986
|
-
// create constants based on platform, for windows or posix
|
1987
|
-
const PLATFORM_CHARS = constants$1.globChars(opts.windows);
|
1988
|
-
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
1989
|
-
|
1990
|
-
const {
|
1991
|
-
DOT_LITERAL,
|
1992
|
-
PLUS_LITERAL,
|
1993
|
-
SLASH_LITERAL,
|
1994
|
-
ONE_CHAR,
|
1995
|
-
DOTS_SLASH,
|
1996
|
-
NO_DOT,
|
1997
|
-
NO_DOT_SLASH,
|
1998
|
-
NO_DOTS_SLASH,
|
1999
|
-
QMARK,
|
2000
|
-
QMARK_NO_DOT,
|
2001
|
-
STAR,
|
2002
|
-
START_ANCHOR
|
2003
|
-
} = PLATFORM_CHARS;
|
2004
|
-
|
2005
|
-
const globstar = opts => {
|
2006
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
2007
|
-
};
|
2008
|
-
|
2009
|
-
const nodot = opts.dot ? '' : NO_DOT;
|
2010
|
-
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
2011
|
-
let star = opts.bash === true ? globstar(opts) : STAR;
|
2012
|
-
|
2013
|
-
if (opts.capture) {
|
2014
|
-
star = `(${star})`;
|
2015
|
-
}
|
2016
|
-
|
2017
|
-
// minimatch options support
|
2018
|
-
if (typeof opts.noext === 'boolean') {
|
2019
|
-
opts.noextglob = opts.noext;
|
2020
|
-
}
|
2021
|
-
|
2022
|
-
const state = {
|
2023
|
-
input,
|
2024
|
-
index: -1,
|
2025
|
-
start: 0,
|
2026
|
-
dot: opts.dot === true,
|
2027
|
-
consumed: '',
|
2028
|
-
output: '',
|
2029
|
-
prefix: '',
|
2030
|
-
backtrack: false,
|
2031
|
-
negated: false,
|
2032
|
-
brackets: 0,
|
2033
|
-
braces: 0,
|
2034
|
-
parens: 0,
|
2035
|
-
quotes: 0,
|
2036
|
-
globstar: false,
|
2037
|
-
tokens
|
2038
|
-
};
|
2039
|
-
|
2040
|
-
input = utils$2.removePrefix(input, state);
|
2041
|
-
len = input.length;
|
2042
|
-
|
2043
|
-
const extglobs = [];
|
2044
|
-
const braces = [];
|
2045
|
-
const stack = [];
|
2046
|
-
let prev = bos;
|
2047
|
-
let value;
|
2048
|
-
|
2049
|
-
/**
|
2050
|
-
* Tokenizing helpers
|
2051
|
-
*/
|
2052
|
-
|
2053
|
-
const eos = () => state.index === len - 1;
|
2054
|
-
const peek = state.peek = (n = 1) => input[state.index + n];
|
2055
|
-
const advance = state.advance = () => input[++state.index] || '';
|
2056
|
-
const remaining = () => input.slice(state.index + 1);
|
2057
|
-
const consume = (value = '', num = 0) => {
|
2058
|
-
state.consumed += value;
|
2059
|
-
state.index += num;
|
2060
|
-
};
|
2061
|
-
|
2062
|
-
const append = token => {
|
2063
|
-
state.output += token.output != null ? token.output : token.value;
|
2064
|
-
consume(token.value);
|
2065
|
-
};
|
2066
|
-
|
2067
|
-
const negate = () => {
|
2068
|
-
let count = 1;
|
2069
|
-
|
2070
|
-
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
2071
|
-
advance();
|
2072
|
-
state.start++;
|
2073
|
-
count++;
|
2074
|
-
}
|
2075
|
-
|
2076
|
-
if (count % 2 === 0) {
|
2077
|
-
return false;
|
2078
|
-
}
|
2079
|
-
|
2080
|
-
state.negated = true;
|
2081
|
-
state.start++;
|
2082
|
-
return true;
|
2083
|
-
};
|
2084
|
-
|
2085
|
-
const increment = type => {
|
2086
|
-
state[type]++;
|
2087
|
-
stack.push(type);
|
2088
|
-
};
|
2089
|
-
|
2090
|
-
const decrement = type => {
|
2091
|
-
state[type]--;
|
2092
|
-
stack.pop();
|
2093
|
-
};
|
2094
|
-
|
2095
|
-
/**
|
2096
|
-
* Push tokens onto the tokens array. This helper speeds up
|
2097
|
-
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
2098
|
-
* and 2) helping us avoid creating extra tokens when consecutive
|
2099
|
-
* characters are plain text. This improves performance and simplifies
|
2100
|
-
* lookbehinds.
|
2101
|
-
*/
|
2102
|
-
|
2103
|
-
const push = tok => {
|
2104
|
-
if (prev.type === 'globstar') {
|
2105
|
-
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
2106
|
-
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
2107
|
-
|
2108
|
-
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
2109
|
-
state.output = state.output.slice(0, -prev.output.length);
|
2110
|
-
prev.type = 'star';
|
2111
|
-
prev.value = '*';
|
2112
|
-
prev.output = star;
|
2113
|
-
state.output += prev.output;
|
2114
|
-
}
|
2115
|
-
}
|
2116
|
-
|
2117
|
-
if (extglobs.length && tok.type !== 'paren') {
|
2118
|
-
extglobs[extglobs.length - 1].inner += tok.value;
|
2119
|
-
}
|
2120
|
-
|
2121
|
-
if (tok.value || tok.output) append(tok);
|
2122
|
-
if (prev && prev.type === 'text' && tok.type === 'text') {
|
2123
|
-
prev.output = (prev.output || prev.value) + tok.value;
|
2124
|
-
prev.value += tok.value;
|
2125
|
-
return;
|
2126
|
-
}
|
2127
|
-
|
2128
|
-
tok.prev = prev;
|
2129
|
-
tokens.push(tok);
|
2130
|
-
prev = tok;
|
2131
|
-
};
|
2132
|
-
|
2133
|
-
const extglobOpen = (type, value) => {
|
2134
|
-
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
2135
|
-
|
2136
|
-
token.prev = prev;
|
2137
|
-
token.parens = state.parens;
|
2138
|
-
token.output = state.output;
|
2139
|
-
const output = (opts.capture ? '(' : '') + token.open;
|
2140
|
-
|
2141
|
-
increment('parens');
|
2142
|
-
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
2143
|
-
push({ type: 'paren', extglob: true, value: advance(), output });
|
2144
|
-
extglobs.push(token);
|
2145
|
-
};
|
2146
|
-
|
2147
|
-
const extglobClose = token => {
|
2148
|
-
let output = token.close + (opts.capture ? ')' : '');
|
2149
|
-
let rest;
|
2150
|
-
|
2151
|
-
if (token.type === 'negate') {
|
2152
|
-
let extglobStar = star;
|
2153
|
-
|
2154
|
-
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
2155
|
-
extglobStar = globstar(opts);
|
2156
|
-
}
|
2157
|
-
|
2158
|
-
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
2159
|
-
output = token.close = `)$))${extglobStar}`;
|
2160
|
-
}
|
2161
|
-
|
2162
|
-
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
2163
|
-
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
2164
|
-
// In this case, we need to parse the string and use it in the output of the original pattern.
|
2165
|
-
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
2166
|
-
//
|
2167
|
-
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
2168
|
-
const expression = parse$2(rest, { ...options, fastpaths: false }).output;
|
2169
|
-
|
2170
|
-
output = token.close = `)${expression})${extglobStar})`;
|
2171
|
-
}
|
2172
|
-
|
2173
|
-
if (token.prev.type === 'bos') {
|
2174
|
-
state.negatedExtglob = true;
|
2175
|
-
}
|
2176
|
-
}
|
2177
|
-
|
2178
|
-
push({ type: 'paren', extglob: true, value, output });
|
2179
|
-
decrement('parens');
|
2180
|
-
};
|
2181
|
-
|
2182
|
-
/**
|
2183
|
-
* Fast paths
|
2184
|
-
*/
|
2185
|
-
|
2186
|
-
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
2187
|
-
let backslashes = false;
|
2188
|
-
|
2189
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
2190
|
-
if (first === '\\') {
|
2191
|
-
backslashes = true;
|
2192
|
-
return m;
|
2193
|
-
}
|
2194
|
-
|
2195
|
-
if (first === '?') {
|
2196
|
-
if (esc) {
|
2197
|
-
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
2198
|
-
}
|
2199
|
-
if (index === 0) {
|
2200
|
-
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
2201
|
-
}
|
2202
|
-
return QMARK.repeat(chars.length);
|
2203
|
-
}
|
2204
|
-
|
2205
|
-
if (first === '.') {
|
2206
|
-
return DOT_LITERAL.repeat(chars.length);
|
2207
|
-
}
|
2208
|
-
|
2209
|
-
if (first === '*') {
|
2210
|
-
if (esc) {
|
2211
|
-
return esc + first + (rest ? star : '');
|
2212
|
-
}
|
2213
|
-
return star;
|
2214
|
-
}
|
2215
|
-
return esc ? m : `\\${m}`;
|
2216
|
-
});
|
2217
|
-
|
2218
|
-
if (backslashes === true) {
|
2219
|
-
if (opts.unescape === true) {
|
2220
|
-
output = output.replace(/\\/g, '');
|
2221
|
-
} else {
|
2222
|
-
output = output.replace(/\\+/g, m => {
|
2223
|
-
return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
|
2224
|
-
});
|
2225
|
-
}
|
2226
|
-
}
|
2227
|
-
|
2228
|
-
if (output === input && opts.contains === true) {
|
2229
|
-
state.output = input;
|
2230
|
-
return state;
|
2231
|
-
}
|
2232
|
-
|
2233
|
-
state.output = utils$2.wrapOutput(output, state, options);
|
2234
|
-
return state;
|
2235
|
-
}
|
2236
|
-
|
2237
|
-
/**
|
2238
|
-
* Tokenize input until we reach end-of-string
|
2239
|
-
*/
|
2240
|
-
|
2241
|
-
while (!eos()) {
|
2242
|
-
value = advance();
|
2243
|
-
|
2244
|
-
if (value === '\u0000') {
|
2245
|
-
continue;
|
2246
|
-
}
|
2247
|
-
|
2248
|
-
/**
|
2249
|
-
* Escaped characters
|
2250
|
-
*/
|
2251
|
-
|
2252
|
-
if (value === '\\') {
|
2253
|
-
const next = peek();
|
2254
|
-
|
2255
|
-
if (next === '/' && opts.bash !== true) {
|
2256
|
-
continue;
|
2257
|
-
}
|
2258
|
-
|
2259
|
-
if (next === '.' || next === ';') {
|
2260
|
-
continue;
|
2261
|
-
}
|
2262
|
-
|
2263
|
-
if (!next) {
|
2264
|
-
value += '\\';
|
2265
|
-
push({ type: 'text', value });
|
2266
|
-
continue;
|
2267
|
-
}
|
2268
|
-
|
2269
|
-
// collapse slashes to reduce potential for exploits
|
2270
|
-
const match = /^\\+/.exec(remaining());
|
2271
|
-
let slashes = 0;
|
2272
|
-
|
2273
|
-
if (match && match[0].length > 2) {
|
2274
|
-
slashes = match[0].length;
|
2275
|
-
state.index += slashes;
|
2276
|
-
if (slashes % 2 !== 0) {
|
2277
|
-
value += '\\';
|
2278
|
-
}
|
2279
|
-
}
|
2280
|
-
|
2281
|
-
if (opts.unescape === true) {
|
2282
|
-
value = advance();
|
2283
|
-
} else {
|
2284
|
-
value += advance();
|
2285
|
-
}
|
2286
|
-
|
2287
|
-
if (state.brackets === 0) {
|
2288
|
-
push({ type: 'text', value });
|
2289
|
-
continue;
|
2290
|
-
}
|
2291
|
-
}
|
2292
|
-
|
2293
|
-
/**
|
2294
|
-
* If we're inside a regex character class, continue
|
2295
|
-
* until we reach the closing bracket.
|
2296
|
-
*/
|
2297
|
-
|
2298
|
-
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
2299
|
-
if (opts.posix !== false && value === ':') {
|
2300
|
-
const inner = prev.value.slice(1);
|
2301
|
-
if (inner.includes('[')) {
|
2302
|
-
prev.posix = true;
|
2303
|
-
|
2304
|
-
if (inner.includes(':')) {
|
2305
|
-
const idx = prev.value.lastIndexOf('[');
|
2306
|
-
const pre = prev.value.slice(0, idx);
|
2307
|
-
const rest = prev.value.slice(idx + 2);
|
2308
|
-
const posix = POSIX_REGEX_SOURCE[rest];
|
2309
|
-
if (posix) {
|
2310
|
-
prev.value = pre + posix;
|
2311
|
-
state.backtrack = true;
|
2312
|
-
advance();
|
2313
|
-
|
2314
|
-
if (!bos.output && tokens.indexOf(prev) === 1) {
|
2315
|
-
bos.output = ONE_CHAR;
|
2316
|
-
}
|
2317
|
-
continue;
|
2318
|
-
}
|
2319
|
-
}
|
2320
|
-
}
|
2321
|
-
}
|
2322
|
-
|
2323
|
-
if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
|
2324
|
-
value = `\\${value}`;
|
2325
|
-
}
|
2326
|
-
|
2327
|
-
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
|
2328
|
-
value = `\\${value}`;
|
2329
|
-
}
|
2330
|
-
|
2331
|
-
if (opts.posix === true && value === '!' && prev.value === '[') {
|
2332
|
-
value = '^';
|
2333
|
-
}
|
2334
|
-
|
2335
|
-
prev.value += value;
|
2336
|
-
append({ value });
|
2337
|
-
continue;
|
2338
|
-
}
|
2339
|
-
|
2340
|
-
/**
|
2341
|
-
* If we're inside a quoted string, continue
|
2342
|
-
* until we reach the closing double quote.
|
2343
|
-
*/
|
2344
|
-
|
2345
|
-
if (state.quotes === 1 && value !== '"') {
|
2346
|
-
value = utils$2.escapeRegex(value);
|
2347
|
-
prev.value += value;
|
2348
|
-
append({ value });
|
2349
|
-
continue;
|
2350
|
-
}
|
2351
|
-
|
2352
|
-
/**
|
2353
|
-
* Double quotes
|
2354
|
-
*/
|
2355
|
-
|
2356
|
-
if (value === '"') {
|
2357
|
-
state.quotes = state.quotes === 1 ? 0 : 1;
|
2358
|
-
if (opts.keepQuotes === true) {
|
2359
|
-
push({ type: 'text', value });
|
2360
|
-
}
|
2361
|
-
continue;
|
2362
|
-
}
|
2363
|
-
|
2364
|
-
/**
|
2365
|
-
* Parentheses
|
2366
|
-
*/
|
2367
|
-
|
2368
|
-
if (value === '(') {
|
2369
|
-
increment('parens');
|
2370
|
-
push({ type: 'paren', value });
|
2371
|
-
continue;
|
2372
|
-
}
|
2373
|
-
|
2374
|
-
if (value === ')') {
|
2375
|
-
if (state.parens === 0 && opts.strictBrackets === true) {
|
2376
|
-
throw new SyntaxError(syntaxError('opening', '('));
|
2377
|
-
}
|
2378
|
-
|
2379
|
-
const extglob = extglobs[extglobs.length - 1];
|
2380
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
2381
|
-
extglobClose(extglobs.pop());
|
2382
|
-
continue;
|
2383
|
-
}
|
2384
|
-
|
2385
|
-
push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
|
2386
|
-
decrement('parens');
|
2387
|
-
continue;
|
2388
|
-
}
|
2389
|
-
|
2390
|
-
/**
|
2391
|
-
* Square brackets
|
2392
|
-
*/
|
2393
|
-
|
2394
|
-
if (value === '[') {
|
2395
|
-
if (opts.nobracket === true || !remaining().includes(']')) {
|
2396
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
2397
|
-
throw new SyntaxError(syntaxError('closing', ']'));
|
2398
|
-
}
|
2399
|
-
|
2400
|
-
value = `\\${value}`;
|
2401
|
-
} else {
|
2402
|
-
increment('brackets');
|
2403
|
-
}
|
2404
|
-
|
2405
|
-
push({ type: 'bracket', value });
|
2406
|
-
continue;
|
2407
|
-
}
|
2408
|
-
|
2409
|
-
if (value === ']') {
|
2410
|
-
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
2411
|
-
push({ type: 'text', value, output: `\\${value}` });
|
2412
|
-
continue;
|
2413
|
-
}
|
2414
|
-
|
2415
|
-
if (state.brackets === 0) {
|
2416
|
-
if (opts.strictBrackets === true) {
|
2417
|
-
throw new SyntaxError(syntaxError('opening', '['));
|
2418
|
-
}
|
2419
|
-
|
2420
|
-
push({ type: 'text', value, output: `\\${value}` });
|
2421
|
-
continue;
|
2422
|
-
}
|
2423
|
-
|
2424
|
-
decrement('brackets');
|
2425
|
-
|
2426
|
-
const prevValue = prev.value.slice(1);
|
2427
|
-
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
2428
|
-
value = `/${value}`;
|
2429
|
-
}
|
2430
|
-
|
2431
|
-
prev.value += value;
|
2432
|
-
append({ value });
|
2433
|
-
|
2434
|
-
// when literal brackets are explicitly disabled
|
2435
|
-
// assume we should match with a regex character class
|
2436
|
-
if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) {
|
2437
|
-
continue;
|
2438
|
-
}
|
2439
|
-
|
2440
|
-
const escaped = utils$2.escapeRegex(prev.value);
|
2441
|
-
state.output = state.output.slice(0, -prev.value.length);
|
2442
|
-
|
2443
|
-
// when literal brackets are explicitly enabled
|
2444
|
-
// assume we should escape the brackets to match literal characters
|
2445
|
-
if (opts.literalBrackets === true) {
|
2446
|
-
state.output += escaped;
|
2447
|
-
prev.value = escaped;
|
2448
|
-
continue;
|
2449
|
-
}
|
2450
|
-
|
2451
|
-
// when the user specifies nothing, try to match both
|
2452
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
2453
|
-
state.output += prev.value;
|
2454
|
-
continue;
|
2455
|
-
}
|
2456
|
-
|
2457
|
-
/**
|
2458
|
-
* Braces
|
2459
|
-
*/
|
2460
|
-
|
2461
|
-
if (value === '{' && opts.nobrace !== true) {
|
2462
|
-
increment('braces');
|
2463
|
-
|
2464
|
-
const open = {
|
2465
|
-
type: 'brace',
|
2466
|
-
value,
|
2467
|
-
output: '(',
|
2468
|
-
outputIndex: state.output.length,
|
2469
|
-
tokensIndex: state.tokens.length
|
2470
|
-
};
|
2471
|
-
|
2472
|
-
braces.push(open);
|
2473
|
-
push(open);
|
2474
|
-
continue;
|
2475
|
-
}
|
2476
|
-
|
2477
|
-
if (value === '}') {
|
2478
|
-
const brace = braces[braces.length - 1];
|
2479
|
-
|
2480
|
-
if (opts.nobrace === true || !brace) {
|
2481
|
-
push({ type: 'text', value, output: value });
|
2482
|
-
continue;
|
2483
|
-
}
|
2484
|
-
|
2485
|
-
let output = ')';
|
2486
|
-
|
2487
|
-
if (brace.dots === true) {
|
2488
|
-
const arr = tokens.slice();
|
2489
|
-
const range = [];
|
2490
|
-
|
2491
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
2492
|
-
tokens.pop();
|
2493
|
-
if (arr[i].type === 'brace') {
|
2494
|
-
break;
|
2495
|
-
}
|
2496
|
-
if (arr[i].type !== 'dots') {
|
2497
|
-
range.unshift(arr[i].value);
|
2498
|
-
}
|
2499
|
-
}
|
2500
|
-
|
2501
|
-
output = expandRange(range, opts);
|
2502
|
-
state.backtrack = true;
|
2503
|
-
}
|
2504
|
-
|
2505
|
-
if (brace.comma !== true && brace.dots !== true) {
|
2506
|
-
const out = state.output.slice(0, brace.outputIndex);
|
2507
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
2508
|
-
brace.value = brace.output = '\\{';
|
2509
|
-
value = output = '\\}';
|
2510
|
-
state.output = out;
|
2511
|
-
for (const t of toks) {
|
2512
|
-
state.output += (t.output || t.value);
|
2513
|
-
}
|
2514
|
-
}
|
2515
|
-
|
2516
|
-
push({ type: 'brace', value, output });
|
2517
|
-
decrement('braces');
|
2518
|
-
braces.pop();
|
2519
|
-
continue;
|
2520
|
-
}
|
2521
|
-
|
2522
|
-
/**
|
2523
|
-
* Pipes
|
2524
|
-
*/
|
2525
|
-
|
2526
|
-
if (value === '|') {
|
2527
|
-
if (extglobs.length > 0) {
|
2528
|
-
extglobs[extglobs.length - 1].conditions++;
|
2529
|
-
}
|
2530
|
-
push({ type: 'text', value });
|
2531
|
-
continue;
|
2532
|
-
}
|
2533
|
-
|
2534
|
-
/**
|
2535
|
-
* Commas
|
2536
|
-
*/
|
2537
|
-
|
2538
|
-
if (value === ',') {
|
2539
|
-
let output = value;
|
2540
|
-
|
2541
|
-
const brace = braces[braces.length - 1];
|
2542
|
-
if (brace && stack[stack.length - 1] === 'braces') {
|
2543
|
-
brace.comma = true;
|
2544
|
-
output = '|';
|
2545
|
-
}
|
2546
|
-
|
2547
|
-
push({ type: 'comma', value, output });
|
2548
|
-
continue;
|
2549
|
-
}
|
2550
|
-
|
2551
|
-
/**
|
2552
|
-
* Slashes
|
2553
|
-
*/
|
2554
|
-
|
2555
|
-
if (value === '/') {
|
2556
|
-
// if the beginning of the glob is "./", advance the start
|
2557
|
-
// to the current index, and don't add the "./" characters
|
2558
|
-
// to the state. This greatly simplifies lookbehinds when
|
2559
|
-
// checking for BOS characters like "!" and "." (not "./")
|
2560
|
-
if (prev.type === 'dot' && state.index === state.start + 1) {
|
2561
|
-
state.start = state.index + 1;
|
2562
|
-
state.consumed = '';
|
2563
|
-
state.output = '';
|
2564
|
-
tokens.pop();
|
2565
|
-
prev = bos; // reset "prev" to the first token
|
2566
|
-
continue;
|
2567
|
-
}
|
2568
|
-
|
2569
|
-
push({ type: 'slash', value, output: SLASH_LITERAL });
|
2570
|
-
continue;
|
2571
|
-
}
|
2572
|
-
|
2573
|
-
/**
|
2574
|
-
* Dots
|
2575
|
-
*/
|
2576
|
-
|
2577
|
-
if (value === '.') {
|
2578
|
-
if (state.braces > 0 && prev.type === 'dot') {
|
2579
|
-
if (prev.value === '.') prev.output = DOT_LITERAL;
|
2580
|
-
const brace = braces[braces.length - 1];
|
2581
|
-
prev.type = 'dots';
|
2582
|
-
prev.output += value;
|
2583
|
-
prev.value += value;
|
2584
|
-
brace.dots = true;
|
2585
|
-
continue;
|
2586
|
-
}
|
2587
|
-
|
2588
|
-
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
2589
|
-
push({ type: 'text', value, output: DOT_LITERAL });
|
2590
|
-
continue;
|
2591
|
-
}
|
2592
|
-
|
2593
|
-
push({ type: 'dot', value, output: DOT_LITERAL });
|
2594
|
-
continue;
|
2595
|
-
}
|
2596
|
-
|
2597
|
-
/**
|
2598
|
-
* Question marks
|
2599
|
-
*/
|
2600
|
-
|
2601
|
-
if (value === '?') {
|
2602
|
-
const isGroup = prev && prev.value === '(';
|
2603
|
-
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
2604
|
-
extglobOpen('qmark', value);
|
2605
|
-
continue;
|
2606
|
-
}
|
2607
|
-
|
2608
|
-
if (prev && prev.type === 'paren') {
|
2609
|
-
const next = peek();
|
2610
|
-
let output = value;
|
2611
|
-
|
2612
|
-
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
|
2613
|
-
output = `\\${value}`;
|
2614
|
-
}
|
2615
|
-
|
2616
|
-
push({ type: 'text', value, output });
|
2617
|
-
continue;
|
2618
|
-
}
|
2619
|
-
|
2620
|
-
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
|
2621
|
-
push({ type: 'qmark', value, output: QMARK_NO_DOT });
|
2622
|
-
continue;
|
2623
|
-
}
|
2624
|
-
|
2625
|
-
push({ type: 'qmark', value, output: QMARK });
|
2626
|
-
continue;
|
2627
|
-
}
|
2628
|
-
|
2629
|
-
/**
|
2630
|
-
* Exclamation
|
2631
|
-
*/
|
2632
|
-
|
2633
|
-
if (value === '!') {
|
2634
|
-
if (opts.noextglob !== true && peek() === '(') {
|
2635
|
-
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
|
2636
|
-
extglobOpen('negate', value);
|
2637
|
-
continue;
|
2638
|
-
}
|
2639
|
-
}
|
2640
|
-
|
2641
|
-
if (opts.nonegate !== true && state.index === 0) {
|
2642
|
-
negate();
|
2643
|
-
continue;
|
2644
|
-
}
|
2645
|
-
}
|
2646
|
-
|
2647
|
-
/**
|
2648
|
-
* Plus
|
2649
|
-
*/
|
2650
|
-
|
2651
|
-
if (value === '+') {
|
2652
|
-
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
2653
|
-
extglobOpen('plus', value);
|
2654
|
-
continue;
|
2655
|
-
}
|
2656
|
-
|
2657
|
-
if ((prev && prev.value === '(') || opts.regex === false) {
|
2658
|
-
push({ type: 'plus', value, output: PLUS_LITERAL });
|
2659
|
-
continue;
|
2660
|
-
}
|
2661
|
-
|
2662
|
-
if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
|
2663
|
-
push({ type: 'plus', value });
|
2664
|
-
continue;
|
2665
|
-
}
|
2666
|
-
|
2667
|
-
push({ type: 'plus', value: PLUS_LITERAL });
|
2668
|
-
continue;
|
2669
|
-
}
|
2670
|
-
|
2671
|
-
/**
|
2672
|
-
* Plain text
|
2673
|
-
*/
|
2674
|
-
|
2675
|
-
if (value === '@') {
|
2676
|
-
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
2677
|
-
push({ type: 'at', extglob: true, value, output: '' });
|
2678
|
-
continue;
|
2679
|
-
}
|
2680
|
-
|
2681
|
-
push({ type: 'text', value });
|
2682
|
-
continue;
|
2683
|
-
}
|
2684
|
-
|
2685
|
-
/**
|
2686
|
-
* Plain text
|
2687
|
-
*/
|
2688
|
-
|
2689
|
-
if (value !== '*') {
|
2690
|
-
if (value === '$' || value === '^') {
|
2691
|
-
value = `\\${value}`;
|
2692
|
-
}
|
2693
|
-
|
2694
|
-
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
2695
|
-
if (match) {
|
2696
|
-
value += match[0];
|
2697
|
-
state.index += match[0].length;
|
2698
|
-
}
|
2699
|
-
|
2700
|
-
push({ type: 'text', value });
|
2701
|
-
continue;
|
2702
|
-
}
|
2703
|
-
|
2704
|
-
/**
|
2705
|
-
* Stars
|
2706
|
-
*/
|
2707
|
-
|
2708
|
-
if (prev && (prev.type === 'globstar' || prev.star === true)) {
|
2709
|
-
prev.type = 'star';
|
2710
|
-
prev.star = true;
|
2711
|
-
prev.value += value;
|
2712
|
-
prev.output = star;
|
2713
|
-
state.backtrack = true;
|
2714
|
-
state.globstar = true;
|
2715
|
-
consume(value);
|
2716
|
-
continue;
|
2717
|
-
}
|
2718
|
-
|
2719
|
-
let rest = remaining();
|
2720
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
2721
|
-
extglobOpen('star', value);
|
2722
|
-
continue;
|
2723
|
-
}
|
2724
|
-
|
2725
|
-
if (prev.type === 'star') {
|
2726
|
-
if (opts.noglobstar === true) {
|
2727
|
-
consume(value);
|
2728
|
-
continue;
|
2729
|
-
}
|
2730
|
-
|
2731
|
-
const prior = prev.prev;
|
2732
|
-
const before = prior.prev;
|
2733
|
-
const isStart = prior.type === 'slash' || prior.type === 'bos';
|
2734
|
-
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
|
2735
|
-
|
2736
|
-
if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
|
2737
|
-
push({ type: 'star', value, output: '' });
|
2738
|
-
continue;
|
2739
|
-
}
|
2740
|
-
|
2741
|
-
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
|
2742
|
-
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
|
2743
|
-
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
|
2744
|
-
push({ type: 'star', value, output: '' });
|
2745
|
-
continue;
|
2746
|
-
}
|
2747
|
-
|
2748
|
-
// strip consecutive `/**/`
|
2749
|
-
while (rest.slice(0, 3) === '/**') {
|
2750
|
-
const after = input[state.index + 4];
|
2751
|
-
if (after && after !== '/') {
|
2752
|
-
break;
|
2753
|
-
}
|
2754
|
-
rest = rest.slice(3);
|
2755
|
-
consume('/**', 3);
|
2756
|
-
}
|
2757
|
-
|
2758
|
-
if (prior.type === 'bos' && eos()) {
|
2759
|
-
prev.type = 'globstar';
|
2760
|
-
prev.value += value;
|
2761
|
-
prev.output = globstar(opts);
|
2762
|
-
state.output = prev.output;
|
2763
|
-
state.globstar = true;
|
2764
|
-
consume(value);
|
2765
|
-
continue;
|
2766
|
-
}
|
2767
|
-
|
2768
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
|
2769
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
2770
|
-
prior.output = `(?:${prior.output}`;
|
2771
|
-
|
2772
|
-
prev.type = 'globstar';
|
2773
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
2774
|
-
prev.value += value;
|
2775
|
-
state.globstar = true;
|
2776
|
-
state.output += prior.output + prev.output;
|
2777
|
-
consume(value);
|
2778
|
-
continue;
|
2779
|
-
}
|
2780
|
-
|
2781
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
2782
|
-
const end = rest[1] !== void 0 ? '|$' : '';
|
2783
|
-
|
2784
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
2785
|
-
prior.output = `(?:${prior.output}`;
|
2786
|
-
|
2787
|
-
prev.type = 'globstar';
|
2788
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
2789
|
-
prev.value += value;
|
2790
|
-
|
2791
|
-
state.output += prior.output + prev.output;
|
2792
|
-
state.globstar = true;
|
2793
|
-
|
2794
|
-
consume(value + advance());
|
2795
|
-
|
2796
|
-
push({ type: 'slash', value: '/', output: '' });
|
2797
|
-
continue;
|
2798
|
-
}
|
2799
|
-
|
2800
|
-
if (prior.type === 'bos' && rest[0] === '/') {
|
2801
|
-
prev.type = 'globstar';
|
2802
|
-
prev.value += value;
|
2803
|
-
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
2804
|
-
state.output = prev.output;
|
2805
|
-
state.globstar = true;
|
2806
|
-
consume(value + advance());
|
2807
|
-
push({ type: 'slash', value: '/', output: '' });
|
2808
|
-
continue;
|
2809
|
-
}
|
2810
|
-
|
2811
|
-
// remove single star from output
|
2812
|
-
state.output = state.output.slice(0, -prev.output.length);
|
2813
|
-
|
2814
|
-
// reset previous token to globstar
|
2815
|
-
prev.type = 'globstar';
|
2816
|
-
prev.output = globstar(opts);
|
2817
|
-
prev.value += value;
|
2818
|
-
|
2819
|
-
// reset output with globstar
|
2820
|
-
state.output += prev.output;
|
2821
|
-
state.globstar = true;
|
2822
|
-
consume(value);
|
2823
|
-
continue;
|
2824
|
-
}
|
2825
|
-
|
2826
|
-
const token = { type: 'star', value, output: star };
|
2827
|
-
|
2828
|
-
if (opts.bash === true) {
|
2829
|
-
token.output = '.*?';
|
2830
|
-
if (prev.type === 'bos' || prev.type === 'slash') {
|
2831
|
-
token.output = nodot + token.output;
|
2832
|
-
}
|
2833
|
-
push(token);
|
2834
|
-
continue;
|
2835
|
-
}
|
2836
|
-
|
2837
|
-
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
2838
|
-
token.output = value;
|
2839
|
-
push(token);
|
2840
|
-
continue;
|
2841
|
-
}
|
2842
|
-
|
2843
|
-
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
2844
|
-
if (prev.type === 'dot') {
|
2845
|
-
state.output += NO_DOT_SLASH;
|
2846
|
-
prev.output += NO_DOT_SLASH;
|
2847
|
-
|
2848
|
-
} else if (opts.dot === true) {
|
2849
|
-
state.output += NO_DOTS_SLASH;
|
2850
|
-
prev.output += NO_DOTS_SLASH;
|
2851
|
-
|
2852
|
-
} else {
|
2853
|
-
state.output += nodot;
|
2854
|
-
prev.output += nodot;
|
2855
|
-
}
|
2856
|
-
|
2857
|
-
if (peek() !== '*') {
|
2858
|
-
state.output += ONE_CHAR;
|
2859
|
-
prev.output += ONE_CHAR;
|
2860
|
-
}
|
2861
|
-
}
|
2862
|
-
|
2863
|
-
push(token);
|
2864
|
-
}
|
2865
|
-
|
2866
|
-
while (state.brackets > 0) {
|
2867
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
2868
|
-
state.output = utils$2.escapeLast(state.output, '[');
|
2869
|
-
decrement('brackets');
|
2870
|
-
}
|
2871
|
-
|
2872
|
-
while (state.parens > 0) {
|
2873
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
2874
|
-
state.output = utils$2.escapeLast(state.output, '(');
|
2875
|
-
decrement('parens');
|
2876
|
-
}
|
2877
|
-
|
2878
|
-
while (state.braces > 0) {
|
2879
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
2880
|
-
state.output = utils$2.escapeLast(state.output, '{');
|
2881
|
-
decrement('braces');
|
2882
|
-
}
|
2883
|
-
|
2884
|
-
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
2885
|
-
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
2886
|
-
}
|
2887
|
-
|
2888
|
-
// rebuild the output if we had to backtrack at any point
|
2889
|
-
if (state.backtrack === true) {
|
2890
|
-
state.output = '';
|
2891
|
-
|
2892
|
-
for (const token of state.tokens) {
|
2893
|
-
state.output += token.output != null ? token.output : token.value;
|
2894
|
-
|
2895
|
-
if (token.suffix) {
|
2896
|
-
state.output += token.suffix;
|
2897
|
-
}
|
2898
|
-
}
|
2899
|
-
}
|
2900
|
-
|
2901
|
-
return state;
|
2902
|
-
};
|
2903
|
-
|
2904
|
-
/**
|
2905
|
-
* Fast paths for creating regular expressions for common glob patterns.
|
2906
|
-
* This can significantly speed up processing and has very little downside
|
2907
|
-
* impact when none of the fast paths match.
|
2908
|
-
*/
|
2909
|
-
|
2910
|
-
parse$2.fastpaths = (input, options) => {
|
2911
|
-
const opts = { ...options };
|
2912
|
-
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
2913
|
-
const len = input.length;
|
2914
|
-
if (len > max) {
|
2915
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
2916
|
-
}
|
2917
|
-
|
2918
|
-
input = REPLACEMENTS[input] || input;
|
2919
|
-
|
2920
|
-
// create constants based on platform, for windows or posix
|
2921
|
-
const {
|
2922
|
-
DOT_LITERAL,
|
2923
|
-
SLASH_LITERAL,
|
2924
|
-
ONE_CHAR,
|
2925
|
-
DOTS_SLASH,
|
2926
|
-
NO_DOT,
|
2927
|
-
NO_DOTS,
|
2928
|
-
NO_DOTS_SLASH,
|
2929
|
-
STAR,
|
2930
|
-
START_ANCHOR
|
2931
|
-
} = constants$1.globChars(opts.windows);
|
2932
|
-
|
2933
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
2934
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
2935
|
-
const capture = opts.capture ? '' : '?:';
|
2936
|
-
const state = { negated: false, prefix: '' };
|
2937
|
-
let star = opts.bash === true ? '.*?' : STAR;
|
2938
|
-
|
2939
|
-
if (opts.capture) {
|
2940
|
-
star = `(${star})`;
|
2941
|
-
}
|
2942
|
-
|
2943
|
-
const globstar = opts => {
|
2944
|
-
if (opts.noglobstar === true) return star;
|
2945
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
2946
|
-
};
|
2947
|
-
|
2948
|
-
const create = str => {
|
2949
|
-
switch (str) {
|
2950
|
-
case '*':
|
2951
|
-
return `${nodot}${ONE_CHAR}${star}`;
|
2952
|
-
|
2953
|
-
case '.*':
|
2954
|
-
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2955
|
-
|
2956
|
-
case '*.*':
|
2957
|
-
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2958
|
-
|
2959
|
-
case '*/*':
|
2960
|
-
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
2961
|
-
|
2962
|
-
case '**':
|
2963
|
-
return nodot + globstar(opts);
|
2964
|
-
|
2965
|
-
case '**/*':
|
2966
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
2967
|
-
|
2968
|
-
case '**/*.*':
|
2969
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2970
|
-
|
2971
|
-
case '**/.*':
|
2972
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2973
|
-
|
2974
|
-
default: {
|
2975
|
-
const match = /^(.*?)\.(\w+)$/.exec(str);
|
2976
|
-
if (!match) return;
|
2977
|
-
|
2978
|
-
const source = create(match[1]);
|
2979
|
-
if (!source) return;
|
2980
|
-
|
2981
|
-
return source + DOT_LITERAL + match[2];
|
2982
|
-
}
|
2983
|
-
}
|
2984
|
-
};
|
2985
|
-
|
2986
|
-
const output = utils$2.removePrefix(input, state);
|
2987
|
-
let source = create(output);
|
2988
|
-
|
2989
|
-
if (source && opts.strictSlashes !== true) {
|
2990
|
-
source += `${SLASH_LITERAL}?`;
|
2991
|
-
}
|
2992
|
-
|
2993
|
-
return source;
|
2994
|
-
};
|
2995
|
-
|
2996
|
-
var parse_1$1 = parse$2;
|
2997
|
-
|
2998
|
-
const scan = scan_1;
|
2999
|
-
const parse$1 = parse_1$1;
|
3000
|
-
const utils$1 = utils$4;
|
3001
|
-
const constants = constants$2;
|
3002
|
-
const isObject$2 = val => val && typeof val === 'object' && !Array.isArray(val);
|
3003
|
-
|
3004
|
-
/**
|
3005
|
-
* Creates a matcher function from one or more glob patterns. The
|
3006
|
-
* returned function takes a string to match as its first argument,
|
3007
|
-
* and returns true if the string is a match. The returned matcher
|
3008
|
-
* function also takes a boolean as the second argument that, when true,
|
3009
|
-
* returns an object with additional information.
|
3010
|
-
*
|
3011
|
-
* ```js
|
3012
|
-
* const picomatch = require('picomatch');
|
3013
|
-
* // picomatch(glob[, options]);
|
3014
|
-
*
|
3015
|
-
* const isMatch = picomatch('*.!(*a)');
|
3016
|
-
* console.log(isMatch('a.a')); //=> false
|
3017
|
-
* console.log(isMatch('a.b')); //=> true
|
3018
|
-
* ```
|
3019
|
-
* @name picomatch
|
3020
|
-
* @param {String|Array} `globs` One or more glob patterns.
|
3021
|
-
* @param {Object=} `options`
|
3022
|
-
* @return {Function=} Returns a matcher function.
|
3023
|
-
* @api public
|
3024
|
-
*/
|
3025
|
-
|
3026
|
-
const picomatch$1 = (glob, options, returnState = false) => {
|
3027
|
-
if (Array.isArray(glob)) {
|
3028
|
-
const fns = glob.map(input => picomatch$1(input, options, returnState));
|
3029
|
-
const arrayMatcher = str => {
|
3030
|
-
for (const isMatch of fns) {
|
3031
|
-
const state = isMatch(str);
|
3032
|
-
if (state) return state;
|
3033
|
-
}
|
3034
|
-
return false;
|
3035
|
-
};
|
3036
|
-
return arrayMatcher;
|
3037
|
-
}
|
3038
|
-
|
3039
|
-
const isState = isObject$2(glob) && glob.tokens && glob.input;
|
3040
|
-
|
3041
|
-
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
3042
|
-
throw new TypeError('Expected pattern to be a non-empty string');
|
3043
|
-
}
|
3044
|
-
|
3045
|
-
const opts = options || {};
|
3046
|
-
const posix = opts.windows;
|
3047
|
-
const regex = isState
|
3048
|
-
? picomatch$1.compileRe(glob, options)
|
3049
|
-
: picomatch$1.makeRe(glob, options, false, true);
|
3050
|
-
|
3051
|
-
const state = regex.state;
|
3052
|
-
delete regex.state;
|
3053
|
-
|
3054
|
-
let isIgnored = () => false;
|
3055
|
-
if (opts.ignore) {
|
3056
|
-
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
3057
|
-
isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
|
3058
|
-
}
|
3059
|
-
|
3060
|
-
const matcher = (input, returnObject = false) => {
|
3061
|
-
const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
|
3062
|
-
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
3063
|
-
|
3064
|
-
if (typeof opts.onResult === 'function') {
|
3065
|
-
opts.onResult(result);
|
3066
|
-
}
|
3067
|
-
|
3068
|
-
if (isMatch === false) {
|
3069
|
-
result.isMatch = false;
|
3070
|
-
return returnObject ? result : false;
|
3071
|
-
}
|
3072
|
-
|
3073
|
-
if (isIgnored(input)) {
|
3074
|
-
if (typeof opts.onIgnore === 'function') {
|
3075
|
-
opts.onIgnore(result);
|
3076
|
-
}
|
3077
|
-
result.isMatch = false;
|
3078
|
-
return returnObject ? result : false;
|
3079
|
-
}
|
3080
|
-
|
3081
|
-
if (typeof opts.onMatch === 'function') {
|
3082
|
-
opts.onMatch(result);
|
3083
|
-
}
|
3084
|
-
return returnObject ? result : true;
|
3085
|
-
};
|
3086
|
-
|
3087
|
-
if (returnState) {
|
3088
|
-
matcher.state = state;
|
3089
|
-
}
|
3090
|
-
|
3091
|
-
return matcher;
|
3092
|
-
};
|
3093
|
-
|
3094
|
-
/**
|
3095
|
-
* Test `input` with the given `regex`. This is used by the main
|
3096
|
-
* `picomatch()` function to test the input string.
|
3097
|
-
*
|
3098
|
-
* ```js
|
3099
|
-
* const picomatch = require('picomatch');
|
3100
|
-
* // picomatch.test(input, regex[, options]);
|
3101
|
-
*
|
3102
|
-
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
3103
|
-
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
3104
|
-
* ```
|
3105
|
-
* @param {String} `input` String to test.
|
3106
|
-
* @param {RegExp} `regex`
|
3107
|
-
* @return {Object} Returns an object with matching info.
|
3108
|
-
* @api public
|
3109
|
-
*/
|
3110
|
-
|
3111
|
-
picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
3112
|
-
if (typeof input !== 'string') {
|
3113
|
-
throw new TypeError('Expected input to be a string');
|
3114
|
-
}
|
3115
|
-
|
3116
|
-
if (input === '') {
|
3117
|
-
return { isMatch: false, output: '' };
|
3118
|
-
}
|
3119
|
-
|
3120
|
-
const opts = options || {};
|
3121
|
-
const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
|
3122
|
-
let match = input === glob;
|
3123
|
-
let output = (match && format) ? format(input) : input;
|
3124
|
-
|
3125
|
-
if (match === false) {
|
3126
|
-
output = format ? format(input) : input;
|
3127
|
-
match = output === glob;
|
3128
|
-
}
|
3129
|
-
|
3130
|
-
if (match === false || opts.capture === true) {
|
3131
|
-
if (opts.matchBase === true || opts.basename === true) {
|
3132
|
-
match = picomatch$1.matchBase(input, regex, options, posix);
|
3133
|
-
} else {
|
3134
|
-
match = regex.exec(output);
|
3135
|
-
}
|
3136
|
-
}
|
3137
|
-
|
3138
|
-
return { isMatch: Boolean(match), match, output };
|
3139
|
-
};
|
3140
|
-
|
3141
|
-
/**
|
3142
|
-
* Match the basename of a filepath.
|
3143
|
-
*
|
3144
|
-
* ```js
|
3145
|
-
* const picomatch = require('picomatch');
|
3146
|
-
* // picomatch.matchBase(input, glob[, options]);
|
3147
|
-
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
3148
|
-
* ```
|
3149
|
-
* @param {String} `input` String to test.
|
3150
|
-
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
3151
|
-
* @return {Boolean}
|
3152
|
-
* @api public
|
3153
|
-
*/
|
3154
|
-
|
3155
|
-
picomatch$1.matchBase = (input, glob, options) => {
|
3156
|
-
const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
|
3157
|
-
return regex.test(utils$1.basename(input));
|
3158
|
-
};
|
3159
|
-
|
3160
|
-
/**
|
3161
|
-
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
3162
|
-
*
|
3163
|
-
* ```js
|
3164
|
-
* const picomatch = require('picomatch');
|
3165
|
-
* // picomatch.isMatch(string, patterns[, options]);
|
3166
|
-
*
|
3167
|
-
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
3168
|
-
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
3169
|
-
* ```
|
3170
|
-
* @param {String|Array} str The string to test.
|
3171
|
-
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
3172
|
-
* @param {Object} [options] See available [options](#options).
|
3173
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
3174
|
-
* @api public
|
3175
|
-
*/
|
3176
|
-
|
3177
|
-
picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
|
3178
|
-
|
3179
|
-
/**
|
3180
|
-
* Parse a glob pattern to create the source string for a regular
|
3181
|
-
* expression.
|
3182
|
-
*
|
3183
|
-
* ```js
|
3184
|
-
* const picomatch = require('picomatch');
|
3185
|
-
* const result = picomatch.parse(pattern[, options]);
|
3186
|
-
* ```
|
3187
|
-
* @param {String} `pattern`
|
3188
|
-
* @param {Object} `options`
|
3189
|
-
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
3190
|
-
* @api public
|
3191
|
-
*/
|
3192
|
-
|
3193
|
-
picomatch$1.parse = (pattern, options) => {
|
3194
|
-
if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
|
3195
|
-
return parse$1(pattern, { ...options, fastpaths: false });
|
3196
|
-
};
|
3197
|
-
|
3198
|
-
/**
|
3199
|
-
* Scan a glob pattern to separate the pattern into segments.
|
3200
|
-
*
|
3201
|
-
* ```js
|
3202
|
-
* const picomatch = require('picomatch');
|
3203
|
-
* // picomatch.scan(input[, options]);
|
3204
|
-
*
|
3205
|
-
* const result = picomatch.scan('!./foo/*.js');
|
3206
|
-
* console.log(result);
|
3207
|
-
* { prefix: '!./',
|
3208
|
-
* input: '!./foo/*.js',
|
3209
|
-
* start: 3,
|
3210
|
-
* base: 'foo',
|
3211
|
-
* glob: '*.js',
|
3212
|
-
* isBrace: false,
|
3213
|
-
* isBracket: false,
|
3214
|
-
* isGlob: true,
|
3215
|
-
* isExtglob: false,
|
3216
|
-
* isGlobstar: false,
|
3217
|
-
* negated: true }
|
3218
|
-
* ```
|
3219
|
-
* @param {String} `input` Glob pattern to scan.
|
3220
|
-
* @param {Object} `options`
|
3221
|
-
* @return {Object} Returns an object with
|
3222
|
-
* @api public
|
3223
|
-
*/
|
3224
|
-
|
3225
|
-
picomatch$1.scan = (input, options) => scan(input, options);
|
3226
|
-
|
3227
|
-
/**
|
3228
|
-
* Compile a regular expression from the `state` object returned by the
|
3229
|
-
* [parse()](#parse) method.
|
3230
|
-
*
|
3231
|
-
* @param {Object} `state`
|
3232
|
-
* @param {Object} `options`
|
3233
|
-
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
3234
|
-
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
3235
|
-
* @return {RegExp}
|
3236
|
-
* @api public
|
3237
|
-
*/
|
3238
|
-
|
3239
|
-
picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
3240
|
-
if (returnOutput === true) {
|
3241
|
-
return state.output;
|
3242
|
-
}
|
3243
|
-
|
3244
|
-
const opts = options || {};
|
3245
|
-
const prepend = opts.contains ? '' : '^';
|
3246
|
-
const append = opts.contains ? '' : '$';
|
3247
|
-
|
3248
|
-
let source = `${prepend}(?:${state.output})${append}`;
|
3249
|
-
if (state && state.negated === true) {
|
3250
|
-
source = `^(?!${source}).*$`;
|
3251
|
-
}
|
3252
|
-
|
3253
|
-
const regex = picomatch$1.toRegex(source, options);
|
3254
|
-
if (returnState === true) {
|
3255
|
-
regex.state = state;
|
3256
|
-
}
|
3257
|
-
|
3258
|
-
return regex;
|
3259
|
-
};
|
3260
|
-
|
3261
|
-
/**
|
3262
|
-
* Create a regular expression from a parsed glob pattern.
|
3263
|
-
*
|
3264
|
-
* ```js
|
3265
|
-
* const picomatch = require('picomatch');
|
3266
|
-
* const state = picomatch.parse('*.js');
|
3267
|
-
* // picomatch.compileRe(state[, options]);
|
3268
|
-
*
|
3269
|
-
* console.log(picomatch.compileRe(state));
|
3270
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
3271
|
-
* ```
|
3272
|
-
* @param {String} `state` The object returned from the `.parse` method.
|
3273
|
-
* @param {Object} `options`
|
3274
|
-
* @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.
|
3275
|
-
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
3276
|
-
* @return {RegExp} Returns a regex created from the given pattern.
|
3277
|
-
* @api public
|
3278
|
-
*/
|
3279
|
-
|
3280
|
-
picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
3281
|
-
if (!input || typeof input !== 'string') {
|
3282
|
-
throw new TypeError('Expected a non-empty string');
|
3283
|
-
}
|
3284
|
-
|
3285
|
-
let parsed = { negated: false, fastpaths: true };
|
3286
|
-
|
3287
|
-
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
3288
|
-
parsed.output = parse$1.fastpaths(input, options);
|
3289
|
-
}
|
3290
|
-
|
3291
|
-
if (!parsed.output) {
|
3292
|
-
parsed = parse$1(input, options);
|
3293
|
-
}
|
3294
|
-
|
3295
|
-
return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
|
3296
|
-
};
|
3297
|
-
|
3298
|
-
/**
|
3299
|
-
* Create a regular expression from the given regex source string.
|
3300
|
-
*
|
3301
|
-
* ```js
|
3302
|
-
* const picomatch = require('picomatch');
|
3303
|
-
* // picomatch.toRegex(source[, options]);
|
3304
|
-
*
|
3305
|
-
* const { output } = picomatch.parse('*.js');
|
3306
|
-
* console.log(picomatch.toRegex(output));
|
3307
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
3308
|
-
* ```
|
3309
|
-
* @param {String} `source` Regular expression source string.
|
3310
|
-
* @param {Object} `options`
|
3311
|
-
* @return {RegExp}
|
3312
|
-
* @api public
|
3313
|
-
*/
|
3314
|
-
|
3315
|
-
picomatch$1.toRegex = (source, options) => {
|
3316
|
-
try {
|
3317
|
-
const opts = options || {};
|
3318
|
-
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
3319
|
-
} catch (err) {
|
3320
|
-
if (options && options.debug === true) throw err;
|
3321
|
-
return /$^/;
|
3322
|
-
}
|
3323
|
-
};
|
3324
|
-
|
3325
|
-
/**
|
3326
|
-
* Picomatch constants.
|
3327
|
-
* @return {Object}
|
3328
|
-
*/
|
3329
|
-
|
3330
|
-
picomatch$1.constants = constants;
|
3331
|
-
|
3332
|
-
/**
|
3333
|
-
* Expose "picomatch"
|
3334
|
-
*/
|
3335
|
-
|
3336
|
-
var picomatch_1$1 = picomatch$1;
|
3337
|
-
|
3338
|
-
const pico = picomatch_1$1;
|
3339
|
-
const utils = utils$4;
|
3340
|
-
|
3341
|
-
function picomatch(glob, options, returnState = false) {
|
3342
|
-
// default to os.platform()
|
3343
|
-
if (options && (options.windows === null || options.windows === undefined)) {
|
3344
|
-
// don't mutate the original options object
|
3345
|
-
options = { ...options, windows: utils.isWindows() };
|
3346
|
-
}
|
3347
|
-
|
3348
|
-
return pico(glob, options, returnState);
|
3349
|
-
}
|
3350
|
-
|
3351
|
-
Object.assign(picomatch, pico);
|
3352
|
-
var picomatch_1 = picomatch;
|
3353
|
-
|
3354
|
-
var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch_1);
|
3355
|
-
|
3356
1277
|
// Helper since Typescript can't detect readonly arrays with Array.isArray
|
3357
1278
|
function isArray(arg) {
|
3358
1279
|
return Array.isArray(arg);
|