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