rollup 4.22.4 → 4.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rollup +2 -2
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +2014 -1958
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +8304 -3891
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +8532 -4119
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +2045 -1989
- package/dist/shared/watch-cli.js +3 -3
- package/dist/shared/watch.js +2 -2
- package/package.json +38 -39
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.22.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.22.5
|
|
4
|
+
Fri, 27 Sep 2024 11:47:46 GMT - commit bc7780c322e134492f40a76bf64afe561670425c
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const parseAst_js = require('./parseAst.js');
|
|
13
13
|
const process$1 = require('node:process');
|
|
14
14
|
const tty = require('tty');
|
|
15
|
-
const path
|
|
15
|
+
const path = require('node:path');
|
|
16
16
|
const require$$0 = require('path');
|
|
17
17
|
const native_js = require('../native.js');
|
|
18
18
|
const node_perf_hooks = require('node:perf_hooks');
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version = "4.22.
|
|
34
|
+
var version = "4.22.5";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -199,7 +199,7 @@ function renderNamePattern(pattern, patternName, replacements) {
|
|
|
199
199
|
function makeUnique(name, { [lowercaseBundleKeys]: reservedLowercaseBundleKeys }) {
|
|
200
200
|
if (!reservedLowercaseBundleKeys.has(name.toLowerCase()))
|
|
201
201
|
return name;
|
|
202
|
-
const extension = path
|
|
202
|
+
const extension = path.extname(name);
|
|
203
203
|
name = name.slice(0, Math.max(0, name.length - extension.length));
|
|
204
204
|
let uniqueName, uniqueIndex = 1;
|
|
205
205
|
while (reservedLowercaseBundleKeys.has((uniqueName = name + ++uniqueIndex + extension).toLowerCase()))
|
|
@@ -212,10 +212,10 @@ function generateAssetFileName(name, source, originalFileName, sourceHash, outpu
|
|
|
212
212
|
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
213
213
|
? outputOptions.assetFileNames({ name, originalFileName, source, type: 'asset' })
|
|
214
214
|
: outputOptions.assetFileNames, 'output.assetFileNames', {
|
|
215
|
-
ext: () => path
|
|
216
|
-
extname: () => path
|
|
215
|
+
ext: () => path.extname(emittedName).slice(1),
|
|
216
|
+
extname: () => path.extname(emittedName),
|
|
217
217
|
hash: size => sourceHash.slice(0, Math.max(0, size || DEFAULT_HASH_SIZE)),
|
|
218
|
-
name: () => emittedName.slice(0, Math.max(0, emittedName.length - path
|
|
218
|
+
name: () => emittedName.slice(0, Math.max(0, emittedName.length - path.extname(emittedName).length))
|
|
219
219
|
}), bundle);
|
|
220
220
|
}
|
|
221
221
|
function reserveFileNameInBundle(fileName, { bundle }, log) {
|
|
@@ -1963,7 +1963,7 @@ function getRelativePath(from, to) {
|
|
|
1963
1963
|
|
|
1964
1964
|
const toString = Object.prototype.toString;
|
|
1965
1965
|
|
|
1966
|
-
function isObject
|
|
1966
|
+
function isObject(thing) {
|
|
1967
1967
|
return toString.call(thing) === '[object Object]';
|
|
1968
1968
|
}
|
|
1969
1969
|
|
|
@@ -2284,7 +2284,7 @@ class MagicString {
|
|
|
2284
2284
|
indent(indentStr, options) {
|
|
2285
2285
|
const pattern = /^[^\r\n]/gm;
|
|
2286
2286
|
|
|
2287
|
-
if (isObject
|
|
2287
|
+
if (isObject(indentStr)) {
|
|
2288
2288
|
options = indentStr;
|
|
2289
2289
|
indentStr = undefined;
|
|
2290
2290
|
}
|
|
@@ -2961,7 +2961,7 @@ let Bundle$1 = class Bundle {
|
|
|
2961
2961
|
});
|
|
2962
2962
|
}
|
|
2963
2963
|
|
|
2964
|
-
if (!isObject
|
|
2964
|
+
if (!isObject(source) || !source.content) {
|
|
2965
2965
|
throw new Error(
|
|
2966
2966
|
'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',
|
|
2967
2967
|
);
|
|
@@ -8638,7 +8638,7 @@ class MetaProperty extends NodeBase {
|
|
|
8638
8638
|
const chunkId = preliminaryChunkId;
|
|
8639
8639
|
if (referenceId) {
|
|
8640
8640
|
const fileName = pluginDriver.getFileName(referenceId);
|
|
8641
|
-
const relativePath = parseAst_js.normalize(path
|
|
8641
|
+
const relativePath = parseAst_js.normalize(path.relative(path.dirname(chunkId), fileName));
|
|
8642
8642
|
const replacement = pluginDriver.hookFirstSync('resolveFileUrl', [
|
|
8643
8643
|
{ chunkId, fileName, format, moduleId, referenceId, relativePath }
|
|
8644
8644
|
]) || relativeUrlMechanisms[format](relativePath);
|
|
@@ -9005,7 +9005,7 @@ class ExternalChunk {
|
|
|
9005
9005
|
const { paths } = this.options;
|
|
9006
9006
|
return (this.fileName =
|
|
9007
9007
|
(typeof paths === 'function' ? paths(this.id) : paths[this.id]) ||
|
|
9008
|
-
(this.renormalizeRenderPath ? parseAst_js.normalize(path
|
|
9008
|
+
(this.renormalizeRenderPath ? parseAst_js.normalize(path.relative(this.inputBase, this.id)) : this.id));
|
|
9009
9009
|
}
|
|
9010
9010
|
getImportAttributes(snippets) {
|
|
9011
9011
|
return (this.importAttributes ||= formatAttributes(this.options.format === 'es' &&
|
|
@@ -9927,2069 +9927,2122 @@ function getAugmentedNamespace(n) {
|
|
|
9927
9927
|
return a;
|
|
9928
9928
|
}
|
|
9929
9929
|
|
|
9930
|
-
var utils
|
|
9930
|
+
var utils = {};
|
|
9931
9931
|
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
9932
|
+
var constants;
|
|
9933
|
+
var hasRequiredConstants;
|
|
9935
9934
|
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
const DOT_LITERAL = '\\.';
|
|
9941
|
-
const PLUS_LITERAL = '\\+';
|
|
9942
|
-
const QMARK_LITERAL = '\\?';
|
|
9943
|
-
const SLASH_LITERAL = '\\/';
|
|
9944
|
-
const ONE_CHAR = '(?=.)';
|
|
9945
|
-
const QMARK = '[^/]';
|
|
9946
|
-
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
9947
|
-
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
9948
|
-
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
9949
|
-
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
9950
|
-
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
9951
|
-
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
9952
|
-
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
9953
|
-
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
9954
|
-
const STAR = `${QMARK}*?`;
|
|
9955
|
-
|
|
9956
|
-
const POSIX_CHARS = {
|
|
9957
|
-
DOT_LITERAL,
|
|
9958
|
-
PLUS_LITERAL,
|
|
9959
|
-
QMARK_LITERAL,
|
|
9960
|
-
SLASH_LITERAL,
|
|
9961
|
-
ONE_CHAR,
|
|
9962
|
-
QMARK,
|
|
9963
|
-
END_ANCHOR,
|
|
9964
|
-
DOTS_SLASH,
|
|
9965
|
-
NO_DOT,
|
|
9966
|
-
NO_DOTS,
|
|
9967
|
-
NO_DOT_SLASH,
|
|
9968
|
-
NO_DOTS_SLASH,
|
|
9969
|
-
QMARK_NO_DOT,
|
|
9970
|
-
STAR,
|
|
9971
|
-
START_ANCHOR
|
|
9972
|
-
};
|
|
9973
|
-
|
|
9974
|
-
/**
|
|
9975
|
-
* Windows glob regex
|
|
9976
|
-
*/
|
|
9977
|
-
|
|
9978
|
-
const WINDOWS_CHARS = {
|
|
9979
|
-
...POSIX_CHARS,
|
|
9980
|
-
|
|
9981
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
9982
|
-
QMARK: WIN_NO_SLASH,
|
|
9983
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
9984
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
9985
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
9986
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
9987
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
9988
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
9989
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
9990
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
9991
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
9992
|
-
};
|
|
9993
|
-
|
|
9994
|
-
/**
|
|
9995
|
-
* POSIX Bracket Regex
|
|
9996
|
-
*/
|
|
9997
|
-
|
|
9998
|
-
const POSIX_REGEX_SOURCE$1 = {
|
|
9999
|
-
alnum: 'a-zA-Z0-9',
|
|
10000
|
-
alpha: 'a-zA-Z',
|
|
10001
|
-
ascii: '\\x00-\\x7F',
|
|
10002
|
-
blank: ' \\t',
|
|
10003
|
-
cntrl: '\\x00-\\x1F\\x7F',
|
|
10004
|
-
digit: '0-9',
|
|
10005
|
-
graph: '\\x21-\\x7E',
|
|
10006
|
-
lower: 'a-z',
|
|
10007
|
-
print: '\\x20-\\x7E ',
|
|
10008
|
-
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
10009
|
-
space: ' \\t\\r\\n\\v\\f',
|
|
10010
|
-
upper: 'A-Z',
|
|
10011
|
-
word: 'A-Za-z0-9_',
|
|
10012
|
-
xdigit: 'A-Fa-f0-9'
|
|
10013
|
-
};
|
|
10014
|
-
|
|
10015
|
-
var constants$2 = {
|
|
10016
|
-
MAX_LENGTH: 1024 * 64,
|
|
10017
|
-
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
10018
|
-
|
|
10019
|
-
// regular expressions
|
|
10020
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
10021
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
10022
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
10023
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
10024
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
10025
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
10026
|
-
|
|
10027
|
-
// Replace globs with equivalent patterns to reduce parsing time.
|
|
10028
|
-
REPLACEMENTS: {
|
|
10029
|
-
'***': '*',
|
|
10030
|
-
'**/**': '**',
|
|
10031
|
-
'**/**/**': '**'
|
|
10032
|
-
},
|
|
10033
|
-
|
|
10034
|
-
// Digits
|
|
10035
|
-
CHAR_0: 48, /* 0 */
|
|
10036
|
-
CHAR_9: 57, /* 9 */
|
|
10037
|
-
|
|
10038
|
-
// Alphabet chars.
|
|
10039
|
-
CHAR_UPPERCASE_A: 65, /* A */
|
|
10040
|
-
CHAR_LOWERCASE_A: 97, /* a */
|
|
10041
|
-
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
10042
|
-
CHAR_LOWERCASE_Z: 122, /* z */
|
|
10043
|
-
|
|
10044
|
-
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
10045
|
-
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
10046
|
-
|
|
10047
|
-
CHAR_ASTERISK: 42, /* * */
|
|
10048
|
-
|
|
10049
|
-
// Non-alphabetic chars.
|
|
10050
|
-
CHAR_AMPERSAND: 38, /* & */
|
|
10051
|
-
CHAR_AT: 64, /* @ */
|
|
10052
|
-
CHAR_BACKWARD_SLASH: 92, /* \ */
|
|
10053
|
-
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
|
10054
|
-
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
|
10055
|
-
CHAR_COLON: 58, /* : */
|
|
10056
|
-
CHAR_COMMA: 44, /* , */
|
|
10057
|
-
CHAR_DOT: 46, /* . */
|
|
10058
|
-
CHAR_DOUBLE_QUOTE: 34, /* " */
|
|
10059
|
-
CHAR_EQUAL: 61, /* = */
|
|
10060
|
-
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
|
10061
|
-
CHAR_FORM_FEED: 12, /* \f */
|
|
10062
|
-
CHAR_FORWARD_SLASH: 47, /* / */
|
|
10063
|
-
CHAR_GRAVE_ACCENT: 96, /* ` */
|
|
10064
|
-
CHAR_HASH: 35, /* # */
|
|
10065
|
-
CHAR_HYPHEN_MINUS: 45, /* - */
|
|
10066
|
-
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
|
10067
|
-
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
|
10068
|
-
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
|
10069
|
-
CHAR_LINE_FEED: 10, /* \n */
|
|
10070
|
-
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
|
10071
|
-
CHAR_PERCENT: 37, /* % */
|
|
10072
|
-
CHAR_PLUS: 43, /* + */
|
|
10073
|
-
CHAR_QUESTION_MARK: 63, /* ? */
|
|
10074
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
|
10075
|
-
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
|
10076
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
|
10077
|
-
CHAR_SEMICOLON: 59, /* ; */
|
|
10078
|
-
CHAR_SINGLE_QUOTE: 39, /* ' */
|
|
10079
|
-
CHAR_SPACE: 32, /* */
|
|
10080
|
-
CHAR_TAB: 9, /* \t */
|
|
10081
|
-
CHAR_UNDERSCORE: 95, /* _ */
|
|
10082
|
-
CHAR_VERTICAL_LINE: 124, /* | */
|
|
10083
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
10084
|
-
|
|
10085
|
-
SEP: path$1.sep,
|
|
10086
|
-
|
|
10087
|
-
/**
|
|
10088
|
-
* Create EXTGLOB_CHARS
|
|
10089
|
-
*/
|
|
10090
|
-
|
|
10091
|
-
extglobChars(chars) {
|
|
10092
|
-
return {
|
|
10093
|
-
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
|
10094
|
-
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
|
10095
|
-
'+': { type: 'plus', open: '(?:', close: ')+' },
|
|
10096
|
-
'*': { type: 'star', open: '(?:', close: ')*' },
|
|
10097
|
-
'@': { type: 'at', open: '(?:', close: ')' }
|
|
10098
|
-
};
|
|
10099
|
-
},
|
|
10100
|
-
|
|
10101
|
-
/**
|
|
10102
|
-
* Create GLOB_CHARS
|
|
10103
|
-
*/
|
|
10104
|
-
|
|
10105
|
-
globChars(win32) {
|
|
10106
|
-
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
10107
|
-
}
|
|
10108
|
-
};
|
|
10109
|
-
|
|
10110
|
-
(function (exports) {
|
|
9935
|
+
function requireConstants () {
|
|
9936
|
+
if (hasRequiredConstants) return constants;
|
|
9937
|
+
hasRequiredConstants = 1;
|
|
10111
9938
|
|
|
10112
9939
|
const path = require$$0;
|
|
10113
|
-
const
|
|
10114
|
-
const {
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
9940
|
+
const WIN_SLASH = '\\\\/';
|
|
9941
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
9942
|
+
|
|
9943
|
+
/**
|
|
9944
|
+
* Posix glob regex
|
|
9945
|
+
*/
|
|
9946
|
+
|
|
9947
|
+
const DOT_LITERAL = '\\.';
|
|
9948
|
+
const PLUS_LITERAL = '\\+';
|
|
9949
|
+
const QMARK_LITERAL = '\\?';
|
|
9950
|
+
const SLASH_LITERAL = '\\/';
|
|
9951
|
+
const ONE_CHAR = '(?=.)';
|
|
9952
|
+
const QMARK = '[^/]';
|
|
9953
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
9954
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
9955
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
9956
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
9957
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
9958
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
9959
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
9960
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
9961
|
+
const STAR = `${QMARK}*?`;
|
|
9962
|
+
|
|
9963
|
+
const POSIX_CHARS = {
|
|
9964
|
+
DOT_LITERAL,
|
|
9965
|
+
PLUS_LITERAL,
|
|
9966
|
+
QMARK_LITERAL,
|
|
9967
|
+
SLASH_LITERAL,
|
|
9968
|
+
ONE_CHAR,
|
|
9969
|
+
QMARK,
|
|
9970
|
+
END_ANCHOR,
|
|
9971
|
+
DOTS_SLASH,
|
|
9972
|
+
NO_DOT,
|
|
9973
|
+
NO_DOTS,
|
|
9974
|
+
NO_DOT_SLASH,
|
|
9975
|
+
NO_DOTS_SLASH,
|
|
9976
|
+
QMARK_NO_DOT,
|
|
9977
|
+
STAR,
|
|
9978
|
+
START_ANCHOR
|
|
10131
9979
|
};
|
|
10132
9980
|
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
9981
|
+
/**
|
|
9982
|
+
* Windows glob regex
|
|
9983
|
+
*/
|
|
9984
|
+
|
|
9985
|
+
const WINDOWS_CHARS = {
|
|
9986
|
+
...POSIX_CHARS,
|
|
9987
|
+
|
|
9988
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
9989
|
+
QMARK: WIN_NO_SLASH,
|
|
9990
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
9991
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
9992
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
9993
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
9994
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
9995
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
9996
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
9997
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
9998
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
10139
9999
|
};
|
|
10140
10000
|
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10001
|
+
/**
|
|
10002
|
+
* POSIX Bracket Regex
|
|
10003
|
+
*/
|
|
10004
|
+
|
|
10005
|
+
const POSIX_REGEX_SOURCE = {
|
|
10006
|
+
alnum: 'a-zA-Z0-9',
|
|
10007
|
+
alpha: 'a-zA-Z',
|
|
10008
|
+
ascii: '\\x00-\\x7F',
|
|
10009
|
+
blank: ' \\t',
|
|
10010
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
10011
|
+
digit: '0-9',
|
|
10012
|
+
graph: '\\x21-\\x7E',
|
|
10013
|
+
lower: 'a-z',
|
|
10014
|
+
print: '\\x20-\\x7E ',
|
|
10015
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
10016
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
10017
|
+
upper: 'A-Z',
|
|
10018
|
+
word: 'A-Za-z0-9_',
|
|
10019
|
+
xdigit: 'A-Fa-f0-9'
|
|
10146
10020
|
};
|
|
10147
10021
|
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10022
|
+
constants = {
|
|
10023
|
+
MAX_LENGTH: 1024 * 64,
|
|
10024
|
+
POSIX_REGEX_SOURCE,
|
|
10025
|
+
|
|
10026
|
+
// regular expressions
|
|
10027
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
10028
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
10029
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
10030
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
10031
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
10032
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
10033
|
+
|
|
10034
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
10035
|
+
REPLACEMENTS: {
|
|
10036
|
+
'***': '*',
|
|
10037
|
+
'**/**': '**',
|
|
10038
|
+
'**/**/**': '**'
|
|
10039
|
+
},
|
|
10040
|
+
|
|
10041
|
+
// Digits
|
|
10042
|
+
CHAR_0: 48, /* 0 */
|
|
10043
|
+
CHAR_9: 57, /* 9 */
|
|
10044
|
+
|
|
10045
|
+
// Alphabet chars.
|
|
10046
|
+
CHAR_UPPERCASE_A: 65, /* A */
|
|
10047
|
+
CHAR_LOWERCASE_A: 97, /* a */
|
|
10048
|
+
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
10049
|
+
CHAR_LOWERCASE_Z: 122, /* z */
|
|
10050
|
+
|
|
10051
|
+
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
10052
|
+
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
10053
|
+
|
|
10054
|
+
CHAR_ASTERISK: 42, /* * */
|
|
10055
|
+
|
|
10056
|
+
// Non-alphabetic chars.
|
|
10057
|
+
CHAR_AMPERSAND: 38, /* & */
|
|
10058
|
+
CHAR_AT: 64, /* @ */
|
|
10059
|
+
CHAR_BACKWARD_SLASH: 92, /* \ */
|
|
10060
|
+
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
|
10061
|
+
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
|
10062
|
+
CHAR_COLON: 58, /* : */
|
|
10063
|
+
CHAR_COMMA: 44, /* , */
|
|
10064
|
+
CHAR_DOT: 46, /* . */
|
|
10065
|
+
CHAR_DOUBLE_QUOTE: 34, /* " */
|
|
10066
|
+
CHAR_EQUAL: 61, /* = */
|
|
10067
|
+
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
|
10068
|
+
CHAR_FORM_FEED: 12, /* \f */
|
|
10069
|
+
CHAR_FORWARD_SLASH: 47, /* / */
|
|
10070
|
+
CHAR_GRAVE_ACCENT: 96, /* ` */
|
|
10071
|
+
CHAR_HASH: 35, /* # */
|
|
10072
|
+
CHAR_HYPHEN_MINUS: 45, /* - */
|
|
10073
|
+
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
|
10074
|
+
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
|
10075
|
+
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
|
10076
|
+
CHAR_LINE_FEED: 10, /* \n */
|
|
10077
|
+
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
|
10078
|
+
CHAR_PERCENT: 37, /* % */
|
|
10079
|
+
CHAR_PLUS: 43, /* + */
|
|
10080
|
+
CHAR_QUESTION_MARK: 63, /* ? */
|
|
10081
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
|
10082
|
+
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
|
10083
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
|
10084
|
+
CHAR_SEMICOLON: 59, /* ; */
|
|
10085
|
+
CHAR_SINGLE_QUOTE: 39, /* ' */
|
|
10086
|
+
CHAR_SPACE: 32, /* */
|
|
10087
|
+
CHAR_TAB: 9, /* \t */
|
|
10088
|
+
CHAR_UNDERSCORE: 95, /* _ */
|
|
10089
|
+
CHAR_VERTICAL_LINE: 124, /* | */
|
|
10090
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
10091
|
+
|
|
10092
|
+
SEP: path.sep,
|
|
10093
|
+
|
|
10094
|
+
/**
|
|
10095
|
+
* Create EXTGLOB_CHARS
|
|
10096
|
+
*/
|
|
10097
|
+
|
|
10098
|
+
extglobChars(chars) {
|
|
10099
|
+
return {
|
|
10100
|
+
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
|
10101
|
+
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
|
10102
|
+
'+': { type: 'plus', open: '(?:', close: ')+' },
|
|
10103
|
+
'*': { type: 'star', open: '(?:', close: ')*' },
|
|
10104
|
+
'@': { type: 'at', open: '(?:', close: ')' }
|
|
10105
|
+
};
|
|
10106
|
+
},
|
|
10107
|
+
|
|
10108
|
+
/**
|
|
10109
|
+
* Create GLOB_CHARS
|
|
10110
|
+
*/
|
|
10111
|
+
|
|
10112
|
+
globChars(win32) {
|
|
10113
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
10160
10114
|
}
|
|
10161
|
-
return output;
|
|
10162
10115
|
};
|
|
10116
|
+
return constants;
|
|
10117
|
+
}
|
|
10118
|
+
|
|
10119
|
+
var hasRequiredUtils;
|
|
10120
|
+
|
|
10121
|
+
function requireUtils () {
|
|
10122
|
+
if (hasRequiredUtils) return utils;
|
|
10123
|
+
hasRequiredUtils = 1;
|
|
10124
|
+
(function (exports) {
|
|
10125
|
+
|
|
10126
|
+
const path = require$$0;
|
|
10127
|
+
const win32 = process.platform === 'win32';
|
|
10128
|
+
const {
|
|
10129
|
+
REGEX_BACKSLASH,
|
|
10130
|
+
REGEX_REMOVE_BACKSLASH,
|
|
10131
|
+
REGEX_SPECIAL_CHARS,
|
|
10132
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
10133
|
+
} = /*@__PURE__*/ requireConstants();
|
|
10134
|
+
|
|
10135
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
10136
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
10137
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
10138
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
10139
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
10140
|
+
|
|
10141
|
+
exports.removeBackslashes = str => {
|
|
10142
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
10143
|
+
return match === '\\' ? '' : match;
|
|
10144
|
+
});
|
|
10145
|
+
};
|
|
10163
10146
|
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
}
|
|
10172
|
-
return output;
|
|
10173
|
-
};
|
|
10174
|
-
} (utils$3));
|
|
10175
|
-
|
|
10176
|
-
const utils$2 = utils$3;
|
|
10177
|
-
const {
|
|
10178
|
-
CHAR_ASTERISK, /* * */
|
|
10179
|
-
CHAR_AT, /* @ */
|
|
10180
|
-
CHAR_BACKWARD_SLASH, /* \ */
|
|
10181
|
-
CHAR_COMMA, /* , */
|
|
10182
|
-
CHAR_DOT, /* . */
|
|
10183
|
-
CHAR_EXCLAMATION_MARK, /* ! */
|
|
10184
|
-
CHAR_FORWARD_SLASH, /* / */
|
|
10185
|
-
CHAR_LEFT_CURLY_BRACE, /* { */
|
|
10186
|
-
CHAR_LEFT_PARENTHESES, /* ( */
|
|
10187
|
-
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
|
10188
|
-
CHAR_PLUS, /* + */
|
|
10189
|
-
CHAR_QUESTION_MARK, /* ? */
|
|
10190
|
-
CHAR_RIGHT_CURLY_BRACE, /* } */
|
|
10191
|
-
CHAR_RIGHT_PARENTHESES, /* ) */
|
|
10192
|
-
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
|
10193
|
-
} = constants$2;
|
|
10194
|
-
|
|
10195
|
-
const isPathSeparator = code => {
|
|
10196
|
-
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
10197
|
-
};
|
|
10198
|
-
|
|
10199
|
-
const depth = token => {
|
|
10200
|
-
if (token.isPrefix !== true) {
|
|
10201
|
-
token.depth = token.isGlobstar ? Infinity : 1;
|
|
10202
|
-
}
|
|
10203
|
-
};
|
|
10204
|
-
|
|
10205
|
-
/**
|
|
10206
|
-
* Quickly scans a glob pattern and returns an object with a handful of
|
|
10207
|
-
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
10208
|
-
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
10209
|
-
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
10210
|
-
*
|
|
10211
|
-
* ```js
|
|
10212
|
-
* const pm = require('picomatch');
|
|
10213
|
-
* console.log(pm.scan('foo/bar/*.js'));
|
|
10214
|
-
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
10215
|
-
* ```
|
|
10216
|
-
* @param {String} `str`
|
|
10217
|
-
* @param {Object} `options`
|
|
10218
|
-
* @return {Object} Returns an object with tokens and regex source string.
|
|
10219
|
-
* @api public
|
|
10220
|
-
*/
|
|
10221
|
-
|
|
10222
|
-
const scan$1 = (input, options) => {
|
|
10223
|
-
const opts = options || {};
|
|
10224
|
-
|
|
10225
|
-
const length = input.length - 1;
|
|
10226
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
10227
|
-
const slashes = [];
|
|
10228
|
-
const tokens = [];
|
|
10229
|
-
const parts = [];
|
|
10230
|
-
|
|
10231
|
-
let str = input;
|
|
10232
|
-
let index = -1;
|
|
10233
|
-
let start = 0;
|
|
10234
|
-
let lastIndex = 0;
|
|
10235
|
-
let isBrace = false;
|
|
10236
|
-
let isBracket = false;
|
|
10237
|
-
let isGlob = false;
|
|
10238
|
-
let isExtglob = false;
|
|
10239
|
-
let isGlobstar = false;
|
|
10240
|
-
let braceEscaped = false;
|
|
10241
|
-
let backslashes = false;
|
|
10242
|
-
let negated = false;
|
|
10243
|
-
let negatedExtglob = false;
|
|
10244
|
-
let finished = false;
|
|
10245
|
-
let braces = 0;
|
|
10246
|
-
let prev;
|
|
10247
|
-
let code;
|
|
10248
|
-
let token = { value: '', depth: 0, isGlob: false };
|
|
10249
|
-
|
|
10250
|
-
const eos = () => index >= length;
|
|
10251
|
-
const peek = () => str.charCodeAt(index + 1);
|
|
10252
|
-
const advance = () => {
|
|
10253
|
-
prev = code;
|
|
10254
|
-
return str.charCodeAt(++index);
|
|
10255
|
-
};
|
|
10256
|
-
|
|
10257
|
-
while (index < length) {
|
|
10258
|
-
code = advance();
|
|
10259
|
-
let next;
|
|
10260
|
-
|
|
10261
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
10262
|
-
backslashes = token.backslashes = true;
|
|
10263
|
-
code = advance();
|
|
10264
|
-
|
|
10265
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
10266
|
-
braceEscaped = true;
|
|
10267
|
-
}
|
|
10268
|
-
continue;
|
|
10269
|
-
}
|
|
10270
|
-
|
|
10271
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
10272
|
-
braces++;
|
|
10273
|
-
|
|
10274
|
-
while (eos() !== true && (code = advance())) {
|
|
10275
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
10276
|
-
backslashes = token.backslashes = true;
|
|
10277
|
-
advance();
|
|
10278
|
-
continue;
|
|
10279
|
-
}
|
|
10280
|
-
|
|
10281
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
10282
|
-
braces++;
|
|
10283
|
-
continue;
|
|
10284
|
-
}
|
|
10285
|
-
|
|
10286
|
-
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
10287
|
-
isBrace = token.isBrace = true;
|
|
10288
|
-
isGlob = token.isGlob = true;
|
|
10289
|
-
finished = true;
|
|
10290
|
-
|
|
10291
|
-
if (scanToEnd === true) {
|
|
10292
|
-
continue;
|
|
10293
|
-
}
|
|
10294
|
-
|
|
10295
|
-
break;
|
|
10296
|
-
}
|
|
10297
|
-
|
|
10298
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
10299
|
-
isBrace = token.isBrace = true;
|
|
10300
|
-
isGlob = token.isGlob = true;
|
|
10301
|
-
finished = true;
|
|
10302
|
-
|
|
10303
|
-
if (scanToEnd === true) {
|
|
10304
|
-
continue;
|
|
10305
|
-
}
|
|
10306
|
-
|
|
10307
|
-
break;
|
|
10308
|
-
}
|
|
10309
|
-
|
|
10310
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
10311
|
-
braces--;
|
|
10312
|
-
|
|
10313
|
-
if (braces === 0) {
|
|
10314
|
-
braceEscaped = false;
|
|
10315
|
-
isBrace = token.isBrace = true;
|
|
10316
|
-
finished = true;
|
|
10317
|
-
break;
|
|
10318
|
-
}
|
|
10319
|
-
}
|
|
10320
|
-
}
|
|
10321
|
-
|
|
10322
|
-
if (scanToEnd === true) {
|
|
10323
|
-
continue;
|
|
10324
|
-
}
|
|
10325
|
-
|
|
10326
|
-
break;
|
|
10327
|
-
}
|
|
10328
|
-
|
|
10329
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
10330
|
-
slashes.push(index);
|
|
10331
|
-
tokens.push(token);
|
|
10332
|
-
token = { value: '', depth: 0, isGlob: false };
|
|
10333
|
-
|
|
10334
|
-
if (finished === true) continue;
|
|
10335
|
-
if (prev === CHAR_DOT && index === (start + 1)) {
|
|
10336
|
-
start += 2;
|
|
10337
|
-
continue;
|
|
10338
|
-
}
|
|
10339
|
-
|
|
10340
|
-
lastIndex = index + 1;
|
|
10341
|
-
continue;
|
|
10342
|
-
}
|
|
10343
|
-
|
|
10344
|
-
if (opts.noext !== true) {
|
|
10345
|
-
const isExtglobChar = code === CHAR_PLUS
|
|
10346
|
-
|| code === CHAR_AT
|
|
10347
|
-
|| code === CHAR_ASTERISK
|
|
10348
|
-
|| code === CHAR_QUESTION_MARK
|
|
10349
|
-
|| code === CHAR_EXCLAMATION_MARK;
|
|
10350
|
-
|
|
10351
|
-
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
10352
|
-
isGlob = token.isGlob = true;
|
|
10353
|
-
isExtglob = token.isExtglob = true;
|
|
10354
|
-
finished = true;
|
|
10355
|
-
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
10356
|
-
negatedExtglob = true;
|
|
10357
|
-
}
|
|
10358
|
-
|
|
10359
|
-
if (scanToEnd === true) {
|
|
10360
|
-
while (eos() !== true && (code = advance())) {
|
|
10361
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
10362
|
-
backslashes = token.backslashes = true;
|
|
10363
|
-
code = advance();
|
|
10364
|
-
continue;
|
|
10365
|
-
}
|
|
10366
|
-
|
|
10367
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
10368
|
-
isGlob = token.isGlob = true;
|
|
10369
|
-
finished = true;
|
|
10370
|
-
break;
|
|
10371
|
-
}
|
|
10372
|
-
}
|
|
10373
|
-
continue;
|
|
10374
|
-
}
|
|
10375
|
-
break;
|
|
10376
|
-
}
|
|
10377
|
-
}
|
|
10378
|
-
|
|
10379
|
-
if (code === CHAR_ASTERISK) {
|
|
10380
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
10381
|
-
isGlob = token.isGlob = true;
|
|
10382
|
-
finished = true;
|
|
10383
|
-
|
|
10384
|
-
if (scanToEnd === true) {
|
|
10385
|
-
continue;
|
|
10386
|
-
}
|
|
10387
|
-
break;
|
|
10388
|
-
}
|
|
10389
|
-
|
|
10390
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
10391
|
-
isGlob = token.isGlob = true;
|
|
10392
|
-
finished = true;
|
|
10393
|
-
|
|
10394
|
-
if (scanToEnd === true) {
|
|
10395
|
-
continue;
|
|
10396
|
-
}
|
|
10397
|
-
break;
|
|
10398
|
-
}
|
|
10399
|
-
|
|
10400
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
10401
|
-
while (eos() !== true && (next = advance())) {
|
|
10402
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
10403
|
-
backslashes = token.backslashes = true;
|
|
10404
|
-
advance();
|
|
10405
|
-
continue;
|
|
10406
|
-
}
|
|
10407
|
-
|
|
10408
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
10409
|
-
isBracket = token.isBracket = true;
|
|
10410
|
-
isGlob = token.isGlob = true;
|
|
10411
|
-
finished = true;
|
|
10412
|
-
break;
|
|
10413
|
-
}
|
|
10414
|
-
}
|
|
10415
|
-
|
|
10416
|
-
if (scanToEnd === true) {
|
|
10417
|
-
continue;
|
|
10418
|
-
}
|
|
10419
|
-
|
|
10420
|
-
break;
|
|
10421
|
-
}
|
|
10422
|
-
|
|
10423
|
-
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
10424
|
-
negated = token.negated = true;
|
|
10425
|
-
start++;
|
|
10426
|
-
continue;
|
|
10427
|
-
}
|
|
10428
|
-
|
|
10429
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
10430
|
-
isGlob = token.isGlob = true;
|
|
10431
|
-
|
|
10432
|
-
if (scanToEnd === true) {
|
|
10433
|
-
while (eos() !== true && (code = advance())) {
|
|
10434
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
10435
|
-
backslashes = token.backslashes = true;
|
|
10436
|
-
code = advance();
|
|
10437
|
-
continue;
|
|
10438
|
-
}
|
|
10439
|
-
|
|
10440
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
10441
|
-
finished = true;
|
|
10442
|
-
break;
|
|
10443
|
-
}
|
|
10444
|
-
}
|
|
10445
|
-
continue;
|
|
10446
|
-
}
|
|
10447
|
-
break;
|
|
10448
|
-
}
|
|
10449
|
-
|
|
10450
|
-
if (isGlob === true) {
|
|
10451
|
-
finished = true;
|
|
10452
|
-
|
|
10453
|
-
if (scanToEnd === true) {
|
|
10454
|
-
continue;
|
|
10455
|
-
}
|
|
10456
|
-
|
|
10457
|
-
break;
|
|
10458
|
-
}
|
|
10459
|
-
}
|
|
10460
|
-
|
|
10461
|
-
if (opts.noext === true) {
|
|
10462
|
-
isExtglob = false;
|
|
10463
|
-
isGlob = false;
|
|
10464
|
-
}
|
|
10465
|
-
|
|
10466
|
-
let base = str;
|
|
10467
|
-
let prefix = '';
|
|
10468
|
-
let glob = '';
|
|
10469
|
-
|
|
10470
|
-
if (start > 0) {
|
|
10471
|
-
prefix = str.slice(0, start);
|
|
10472
|
-
str = str.slice(start);
|
|
10473
|
-
lastIndex -= start;
|
|
10474
|
-
}
|
|
10475
|
-
|
|
10476
|
-
if (base && isGlob === true && lastIndex > 0) {
|
|
10477
|
-
base = str.slice(0, lastIndex);
|
|
10478
|
-
glob = str.slice(lastIndex);
|
|
10479
|
-
} else if (isGlob === true) {
|
|
10480
|
-
base = '';
|
|
10481
|
-
glob = str;
|
|
10482
|
-
} else {
|
|
10483
|
-
base = str;
|
|
10484
|
-
}
|
|
10485
|
-
|
|
10486
|
-
if (base && base !== '' && base !== '/' && base !== str) {
|
|
10487
|
-
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
10488
|
-
base = base.slice(0, -1);
|
|
10489
|
-
}
|
|
10490
|
-
}
|
|
10491
|
-
|
|
10492
|
-
if (opts.unescape === true) {
|
|
10493
|
-
if (glob) glob = utils$2.removeBackslashes(glob);
|
|
10494
|
-
|
|
10495
|
-
if (base && backslashes === true) {
|
|
10496
|
-
base = utils$2.removeBackslashes(base);
|
|
10497
|
-
}
|
|
10498
|
-
}
|
|
10499
|
-
|
|
10500
|
-
const state = {
|
|
10501
|
-
prefix,
|
|
10502
|
-
input,
|
|
10503
|
-
start,
|
|
10504
|
-
base,
|
|
10505
|
-
glob,
|
|
10506
|
-
isBrace,
|
|
10507
|
-
isBracket,
|
|
10508
|
-
isGlob,
|
|
10509
|
-
isExtglob,
|
|
10510
|
-
isGlobstar,
|
|
10511
|
-
negated,
|
|
10512
|
-
negatedExtglob
|
|
10513
|
-
};
|
|
10514
|
-
|
|
10515
|
-
if (opts.tokens === true) {
|
|
10516
|
-
state.maxDepth = 0;
|
|
10517
|
-
if (!isPathSeparator(code)) {
|
|
10518
|
-
tokens.push(token);
|
|
10519
|
-
}
|
|
10520
|
-
state.tokens = tokens;
|
|
10521
|
-
}
|
|
10522
|
-
|
|
10523
|
-
if (opts.parts === true || opts.tokens === true) {
|
|
10524
|
-
let prevIndex;
|
|
10525
|
-
|
|
10526
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
|
10527
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
10528
|
-
const i = slashes[idx];
|
|
10529
|
-
const value = input.slice(n, i);
|
|
10530
|
-
if (opts.tokens) {
|
|
10531
|
-
if (idx === 0 && start !== 0) {
|
|
10532
|
-
tokens[idx].isPrefix = true;
|
|
10533
|
-
tokens[idx].value = prefix;
|
|
10534
|
-
} else {
|
|
10535
|
-
tokens[idx].value = value;
|
|
10536
|
-
}
|
|
10537
|
-
depth(tokens[idx]);
|
|
10538
|
-
state.maxDepth += tokens[idx].depth;
|
|
10539
|
-
}
|
|
10540
|
-
if (idx !== 0 || value !== '') {
|
|
10541
|
-
parts.push(value);
|
|
10542
|
-
}
|
|
10543
|
-
prevIndex = i;
|
|
10544
|
-
}
|
|
10545
|
-
|
|
10546
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
10547
|
-
const value = input.slice(prevIndex + 1);
|
|
10548
|
-
parts.push(value);
|
|
10549
|
-
|
|
10550
|
-
if (opts.tokens) {
|
|
10551
|
-
tokens[tokens.length - 1].value = value;
|
|
10552
|
-
depth(tokens[tokens.length - 1]);
|
|
10553
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
10554
|
-
}
|
|
10555
|
-
}
|
|
10556
|
-
|
|
10557
|
-
state.slashes = slashes;
|
|
10558
|
-
state.parts = parts;
|
|
10559
|
-
}
|
|
10560
|
-
|
|
10561
|
-
return state;
|
|
10562
|
-
};
|
|
10563
|
-
|
|
10564
|
-
var scan_1 = scan$1;
|
|
10565
|
-
|
|
10566
|
-
const constants$1 = constants$2;
|
|
10567
|
-
const utils$1 = utils$3;
|
|
10568
|
-
|
|
10569
|
-
/**
|
|
10570
|
-
* Constants
|
|
10571
|
-
*/
|
|
10572
|
-
|
|
10573
|
-
const {
|
|
10574
|
-
MAX_LENGTH,
|
|
10575
|
-
POSIX_REGEX_SOURCE,
|
|
10576
|
-
REGEX_NON_SPECIAL_CHARS,
|
|
10577
|
-
REGEX_SPECIAL_CHARS_BACKREF,
|
|
10578
|
-
REPLACEMENTS
|
|
10579
|
-
} = constants$1;
|
|
10580
|
-
|
|
10581
|
-
/**
|
|
10582
|
-
* Helpers
|
|
10583
|
-
*/
|
|
10584
|
-
|
|
10585
|
-
const expandRange = (args, options) => {
|
|
10586
|
-
if (typeof options.expandRange === 'function') {
|
|
10587
|
-
return options.expandRange(...args, options);
|
|
10588
|
-
}
|
|
10589
|
-
|
|
10590
|
-
args.sort();
|
|
10591
|
-
const value = `[${args.join('-')}]`;
|
|
10592
|
-
|
|
10593
|
-
return value;
|
|
10594
|
-
};
|
|
10595
|
-
|
|
10596
|
-
/**
|
|
10597
|
-
* Create the message for a syntax error
|
|
10598
|
-
*/
|
|
10599
|
-
|
|
10600
|
-
const syntaxError = (type, char) => {
|
|
10601
|
-
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
10602
|
-
};
|
|
10603
|
-
|
|
10604
|
-
/**
|
|
10605
|
-
* Parse the given input string.
|
|
10606
|
-
* @param {String} input
|
|
10607
|
-
* @param {Object} options
|
|
10608
|
-
* @return {Object}
|
|
10609
|
-
*/
|
|
10610
|
-
|
|
10611
|
-
const parse$1 = (input, options) => {
|
|
10612
|
-
if (typeof input !== 'string') {
|
|
10613
|
-
throw new TypeError('Expected a string');
|
|
10614
|
-
}
|
|
10615
|
-
|
|
10616
|
-
input = REPLACEMENTS[input] || input;
|
|
10617
|
-
|
|
10618
|
-
const opts = { ...options };
|
|
10619
|
-
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
10620
|
-
|
|
10621
|
-
let len = input.length;
|
|
10622
|
-
if (len > max) {
|
|
10623
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
10624
|
-
}
|
|
10625
|
-
|
|
10626
|
-
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
|
10627
|
-
const tokens = [bos];
|
|
10628
|
-
|
|
10629
|
-
const capture = opts.capture ? '' : '?:';
|
|
10630
|
-
const win32 = utils$1.isWindows(options);
|
|
10631
|
-
|
|
10632
|
-
// create constants based on platform, for windows or posix
|
|
10633
|
-
const PLATFORM_CHARS = constants$1.globChars(win32);
|
|
10634
|
-
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
|
10635
|
-
|
|
10636
|
-
const {
|
|
10637
|
-
DOT_LITERAL,
|
|
10638
|
-
PLUS_LITERAL,
|
|
10639
|
-
SLASH_LITERAL,
|
|
10640
|
-
ONE_CHAR,
|
|
10641
|
-
DOTS_SLASH,
|
|
10642
|
-
NO_DOT,
|
|
10643
|
-
NO_DOT_SLASH,
|
|
10644
|
-
NO_DOTS_SLASH,
|
|
10645
|
-
QMARK,
|
|
10646
|
-
QMARK_NO_DOT,
|
|
10647
|
-
STAR,
|
|
10648
|
-
START_ANCHOR
|
|
10649
|
-
} = PLATFORM_CHARS;
|
|
10650
|
-
|
|
10651
|
-
const globstar = opts => {
|
|
10652
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
10653
|
-
};
|
|
10654
|
-
|
|
10655
|
-
const nodot = opts.dot ? '' : NO_DOT;
|
|
10656
|
-
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
10657
|
-
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
10658
|
-
|
|
10659
|
-
if (opts.capture) {
|
|
10660
|
-
star = `(${star})`;
|
|
10661
|
-
}
|
|
10662
|
-
|
|
10663
|
-
// minimatch options support
|
|
10664
|
-
if (typeof opts.noext === 'boolean') {
|
|
10665
|
-
opts.noextglob = opts.noext;
|
|
10666
|
-
}
|
|
10667
|
-
|
|
10668
|
-
const state = {
|
|
10669
|
-
input,
|
|
10670
|
-
index: -1,
|
|
10671
|
-
start: 0,
|
|
10672
|
-
dot: opts.dot === true,
|
|
10673
|
-
consumed: '',
|
|
10674
|
-
output: '',
|
|
10675
|
-
prefix: '',
|
|
10676
|
-
backtrack: false,
|
|
10677
|
-
negated: false,
|
|
10678
|
-
brackets: 0,
|
|
10679
|
-
braces: 0,
|
|
10680
|
-
parens: 0,
|
|
10681
|
-
quotes: 0,
|
|
10682
|
-
globstar: false,
|
|
10683
|
-
tokens
|
|
10684
|
-
};
|
|
10685
|
-
|
|
10686
|
-
input = utils$1.removePrefix(input, state);
|
|
10687
|
-
len = input.length;
|
|
10688
|
-
|
|
10689
|
-
const extglobs = [];
|
|
10690
|
-
const braces = [];
|
|
10691
|
-
const stack = [];
|
|
10692
|
-
let prev = bos;
|
|
10693
|
-
let value;
|
|
10694
|
-
|
|
10695
|
-
/**
|
|
10696
|
-
* Tokenizing helpers
|
|
10697
|
-
*/
|
|
10698
|
-
|
|
10699
|
-
const eos = () => state.index === len - 1;
|
|
10700
|
-
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
10701
|
-
const advance = state.advance = () => input[++state.index] || '';
|
|
10702
|
-
const remaining = () => input.slice(state.index + 1);
|
|
10703
|
-
const consume = (value = '', num = 0) => {
|
|
10704
|
-
state.consumed += value;
|
|
10705
|
-
state.index += num;
|
|
10706
|
-
};
|
|
10707
|
-
|
|
10708
|
-
const append = token => {
|
|
10709
|
-
state.output += token.output != null ? token.output : token.value;
|
|
10710
|
-
consume(token.value);
|
|
10711
|
-
};
|
|
10712
|
-
|
|
10713
|
-
const negate = () => {
|
|
10714
|
-
let count = 1;
|
|
10715
|
-
|
|
10716
|
-
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
|
10717
|
-
advance();
|
|
10718
|
-
state.start++;
|
|
10719
|
-
count++;
|
|
10720
|
-
}
|
|
10721
|
-
|
|
10722
|
-
if (count % 2 === 0) {
|
|
10723
|
-
return false;
|
|
10724
|
-
}
|
|
10725
|
-
|
|
10726
|
-
state.negated = true;
|
|
10727
|
-
state.start++;
|
|
10728
|
-
return true;
|
|
10729
|
-
};
|
|
10730
|
-
|
|
10731
|
-
const increment = type => {
|
|
10732
|
-
state[type]++;
|
|
10733
|
-
stack.push(type);
|
|
10734
|
-
};
|
|
10735
|
-
|
|
10736
|
-
const decrement = type => {
|
|
10737
|
-
state[type]--;
|
|
10738
|
-
stack.pop();
|
|
10739
|
-
};
|
|
10740
|
-
|
|
10741
|
-
/**
|
|
10742
|
-
* Push tokens onto the tokens array. This helper speeds up
|
|
10743
|
-
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
10744
|
-
* and 2) helping us avoid creating extra tokens when consecutive
|
|
10745
|
-
* characters are plain text. This improves performance and simplifies
|
|
10746
|
-
* lookbehinds.
|
|
10747
|
-
*/
|
|
10748
|
-
|
|
10749
|
-
const push = tok => {
|
|
10750
|
-
if (prev.type === 'globstar') {
|
|
10751
|
-
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
|
10752
|
-
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
|
10753
|
-
|
|
10754
|
-
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
|
10755
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
10756
|
-
prev.type = 'star';
|
|
10757
|
-
prev.value = '*';
|
|
10758
|
-
prev.output = star;
|
|
10759
|
-
state.output += prev.output;
|
|
10760
|
-
}
|
|
10761
|
-
}
|
|
10762
|
-
|
|
10763
|
-
if (extglobs.length && tok.type !== 'paren') {
|
|
10764
|
-
extglobs[extglobs.length - 1].inner += tok.value;
|
|
10765
|
-
}
|
|
10766
|
-
|
|
10767
|
-
if (tok.value || tok.output) append(tok);
|
|
10768
|
-
if (prev && prev.type === 'text' && tok.type === 'text') {
|
|
10769
|
-
prev.value += tok.value;
|
|
10770
|
-
prev.output = (prev.output || '') + tok.value;
|
|
10771
|
-
return;
|
|
10772
|
-
}
|
|
10773
|
-
|
|
10774
|
-
tok.prev = prev;
|
|
10775
|
-
tokens.push(tok);
|
|
10776
|
-
prev = tok;
|
|
10777
|
-
};
|
|
10778
|
-
|
|
10779
|
-
const extglobOpen = (type, value) => {
|
|
10780
|
-
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
|
10781
|
-
|
|
10782
|
-
token.prev = prev;
|
|
10783
|
-
token.parens = state.parens;
|
|
10784
|
-
token.output = state.output;
|
|
10785
|
-
const output = (opts.capture ? '(' : '') + token.open;
|
|
10786
|
-
|
|
10787
|
-
increment('parens');
|
|
10788
|
-
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
|
10789
|
-
push({ type: 'paren', extglob: true, value: advance(), output });
|
|
10790
|
-
extglobs.push(token);
|
|
10791
|
-
};
|
|
10792
|
-
|
|
10793
|
-
const extglobClose = token => {
|
|
10794
|
-
let output = token.close + (opts.capture ? ')' : '');
|
|
10795
|
-
let rest;
|
|
10796
|
-
|
|
10797
|
-
if (token.type === 'negate') {
|
|
10798
|
-
let extglobStar = star;
|
|
10799
|
-
|
|
10800
|
-
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
|
10801
|
-
extglobStar = globstar(opts);
|
|
10802
|
-
}
|
|
10803
|
-
|
|
10804
|
-
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
10805
|
-
output = token.close = `)$))${extglobStar}`;
|
|
10806
|
-
}
|
|
10807
|
-
|
|
10808
|
-
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
10809
|
-
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
|
10810
|
-
// In this case, we need to parse the string and use it in the output of the original pattern.
|
|
10811
|
-
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
10812
|
-
//
|
|
10813
|
-
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
10814
|
-
const expression = parse$1(rest, { ...options, fastpaths: false }).output;
|
|
10815
|
-
|
|
10816
|
-
output = token.close = `)${expression})${extglobStar})`;
|
|
10817
|
-
}
|
|
10818
|
-
|
|
10819
|
-
if (token.prev.type === 'bos') {
|
|
10820
|
-
state.negatedExtglob = true;
|
|
10821
|
-
}
|
|
10822
|
-
}
|
|
10823
|
-
|
|
10824
|
-
push({ type: 'paren', extglob: true, value, output });
|
|
10825
|
-
decrement('parens');
|
|
10826
|
-
};
|
|
10827
|
-
|
|
10828
|
-
/**
|
|
10829
|
-
* Fast paths
|
|
10830
|
-
*/
|
|
10831
|
-
|
|
10832
|
-
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
10833
|
-
let backslashes = false;
|
|
10834
|
-
|
|
10835
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
10836
|
-
if (first === '\\') {
|
|
10837
|
-
backslashes = true;
|
|
10838
|
-
return m;
|
|
10839
|
-
}
|
|
10840
|
-
|
|
10841
|
-
if (first === '?') {
|
|
10842
|
-
if (esc) {
|
|
10843
|
-
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
10844
|
-
}
|
|
10845
|
-
if (index === 0) {
|
|
10846
|
-
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
10847
|
-
}
|
|
10848
|
-
return QMARK.repeat(chars.length);
|
|
10849
|
-
}
|
|
10850
|
-
|
|
10851
|
-
if (first === '.') {
|
|
10852
|
-
return DOT_LITERAL.repeat(chars.length);
|
|
10853
|
-
}
|
|
10854
|
-
|
|
10855
|
-
if (first === '*') {
|
|
10856
|
-
if (esc) {
|
|
10857
|
-
return esc + first + (rest ? star : '');
|
|
10858
|
-
}
|
|
10859
|
-
return star;
|
|
10860
|
-
}
|
|
10861
|
-
return esc ? m : `\\${m}`;
|
|
10862
|
-
});
|
|
10863
|
-
|
|
10864
|
-
if (backslashes === true) {
|
|
10865
|
-
if (opts.unescape === true) {
|
|
10866
|
-
output = output.replace(/\\/g, '');
|
|
10867
|
-
} else {
|
|
10868
|
-
output = output.replace(/\\+/g, m => {
|
|
10869
|
-
return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
|
|
10870
|
-
});
|
|
10871
|
-
}
|
|
10872
|
-
}
|
|
10873
|
-
|
|
10874
|
-
if (output === input && opts.contains === true) {
|
|
10875
|
-
state.output = input;
|
|
10876
|
-
return state;
|
|
10877
|
-
}
|
|
10878
|
-
|
|
10879
|
-
state.output = utils$1.wrapOutput(output, state, options);
|
|
10880
|
-
return state;
|
|
10881
|
-
}
|
|
10882
|
-
|
|
10883
|
-
/**
|
|
10884
|
-
* Tokenize input until we reach end-of-string
|
|
10885
|
-
*/
|
|
10886
|
-
|
|
10887
|
-
while (!eos()) {
|
|
10888
|
-
value = advance();
|
|
10889
|
-
|
|
10890
|
-
if (value === '\u0000') {
|
|
10891
|
-
continue;
|
|
10892
|
-
}
|
|
10893
|
-
|
|
10894
|
-
/**
|
|
10895
|
-
* Escaped characters
|
|
10896
|
-
*/
|
|
10897
|
-
|
|
10898
|
-
if (value === '\\') {
|
|
10899
|
-
const next = peek();
|
|
10900
|
-
|
|
10901
|
-
if (next === '/' && opts.bash !== true) {
|
|
10902
|
-
continue;
|
|
10903
|
-
}
|
|
10904
|
-
|
|
10905
|
-
if (next === '.' || next === ';') {
|
|
10906
|
-
continue;
|
|
10907
|
-
}
|
|
10908
|
-
|
|
10909
|
-
if (!next) {
|
|
10910
|
-
value += '\\';
|
|
10911
|
-
push({ type: 'text', value });
|
|
10912
|
-
continue;
|
|
10913
|
-
}
|
|
10914
|
-
|
|
10915
|
-
// collapse slashes to reduce potential for exploits
|
|
10916
|
-
const match = /^\\+/.exec(remaining());
|
|
10917
|
-
let slashes = 0;
|
|
10918
|
-
|
|
10919
|
-
if (match && match[0].length > 2) {
|
|
10920
|
-
slashes = match[0].length;
|
|
10921
|
-
state.index += slashes;
|
|
10922
|
-
if (slashes % 2 !== 0) {
|
|
10923
|
-
value += '\\';
|
|
10924
|
-
}
|
|
10925
|
-
}
|
|
10926
|
-
|
|
10927
|
-
if (opts.unescape === true) {
|
|
10928
|
-
value = advance();
|
|
10929
|
-
} else {
|
|
10930
|
-
value += advance();
|
|
10931
|
-
}
|
|
10932
|
-
|
|
10933
|
-
if (state.brackets === 0) {
|
|
10934
|
-
push({ type: 'text', value });
|
|
10935
|
-
continue;
|
|
10936
|
-
}
|
|
10937
|
-
}
|
|
10938
|
-
|
|
10939
|
-
/**
|
|
10940
|
-
* If we're inside a regex character class, continue
|
|
10941
|
-
* until we reach the closing bracket.
|
|
10942
|
-
*/
|
|
10943
|
-
|
|
10944
|
-
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
|
10945
|
-
if (opts.posix !== false && value === ':') {
|
|
10946
|
-
const inner = prev.value.slice(1);
|
|
10947
|
-
if (inner.includes('[')) {
|
|
10948
|
-
prev.posix = true;
|
|
10949
|
-
|
|
10950
|
-
if (inner.includes(':')) {
|
|
10951
|
-
const idx = prev.value.lastIndexOf('[');
|
|
10952
|
-
const pre = prev.value.slice(0, idx);
|
|
10953
|
-
const rest = prev.value.slice(idx + 2);
|
|
10954
|
-
const posix = POSIX_REGEX_SOURCE[rest];
|
|
10955
|
-
if (posix) {
|
|
10956
|
-
prev.value = pre + posix;
|
|
10957
|
-
state.backtrack = true;
|
|
10958
|
-
advance();
|
|
10959
|
-
|
|
10960
|
-
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
10961
|
-
bos.output = ONE_CHAR;
|
|
10962
|
-
}
|
|
10963
|
-
continue;
|
|
10964
|
-
}
|
|
10965
|
-
}
|
|
10966
|
-
}
|
|
10967
|
-
}
|
|
10968
|
-
|
|
10969
|
-
if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
|
|
10970
|
-
value = `\\${value}`;
|
|
10971
|
-
}
|
|
10972
|
-
|
|
10973
|
-
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
|
|
10974
|
-
value = `\\${value}`;
|
|
10975
|
-
}
|
|
10976
|
-
|
|
10977
|
-
if (opts.posix === true && value === '!' && prev.value === '[') {
|
|
10978
|
-
value = '^';
|
|
10979
|
-
}
|
|
10980
|
-
|
|
10981
|
-
prev.value += value;
|
|
10982
|
-
append({ value });
|
|
10983
|
-
continue;
|
|
10984
|
-
}
|
|
10985
|
-
|
|
10986
|
-
/**
|
|
10987
|
-
* If we're inside a quoted string, continue
|
|
10988
|
-
* until we reach the closing double quote.
|
|
10989
|
-
*/
|
|
10990
|
-
|
|
10991
|
-
if (state.quotes === 1 && value !== '"') {
|
|
10992
|
-
value = utils$1.escapeRegex(value);
|
|
10993
|
-
prev.value += value;
|
|
10994
|
-
append({ value });
|
|
10995
|
-
continue;
|
|
10996
|
-
}
|
|
10997
|
-
|
|
10998
|
-
/**
|
|
10999
|
-
* Double quotes
|
|
11000
|
-
*/
|
|
11001
|
-
|
|
11002
|
-
if (value === '"') {
|
|
11003
|
-
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
11004
|
-
if (opts.keepQuotes === true) {
|
|
11005
|
-
push({ type: 'text', value });
|
|
11006
|
-
}
|
|
11007
|
-
continue;
|
|
11008
|
-
}
|
|
11009
|
-
|
|
11010
|
-
/**
|
|
11011
|
-
* Parentheses
|
|
11012
|
-
*/
|
|
11013
|
-
|
|
11014
|
-
if (value === '(') {
|
|
11015
|
-
increment('parens');
|
|
11016
|
-
push({ type: 'paren', value });
|
|
11017
|
-
continue;
|
|
11018
|
-
}
|
|
11019
|
-
|
|
11020
|
-
if (value === ')') {
|
|
11021
|
-
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
11022
|
-
throw new SyntaxError(syntaxError('opening', '('));
|
|
11023
|
-
}
|
|
11024
|
-
|
|
11025
|
-
const extglob = extglobs[extglobs.length - 1];
|
|
11026
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
|
11027
|
-
extglobClose(extglobs.pop());
|
|
11028
|
-
continue;
|
|
11029
|
-
}
|
|
11030
|
-
|
|
11031
|
-
push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
|
|
11032
|
-
decrement('parens');
|
|
11033
|
-
continue;
|
|
11034
|
-
}
|
|
11035
|
-
|
|
11036
|
-
/**
|
|
11037
|
-
* Square brackets
|
|
11038
|
-
*/
|
|
11039
|
-
|
|
11040
|
-
if (value === '[') {
|
|
11041
|
-
if (opts.nobracket === true || !remaining().includes(']')) {
|
|
11042
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
11043
|
-
throw new SyntaxError(syntaxError('closing', ']'));
|
|
11044
|
-
}
|
|
11045
|
-
|
|
11046
|
-
value = `\\${value}`;
|
|
11047
|
-
} else {
|
|
11048
|
-
increment('brackets');
|
|
11049
|
-
}
|
|
11050
|
-
|
|
11051
|
-
push({ type: 'bracket', value });
|
|
11052
|
-
continue;
|
|
11053
|
-
}
|
|
11054
|
-
|
|
11055
|
-
if (value === ']') {
|
|
11056
|
-
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
|
11057
|
-
push({ type: 'text', value, output: `\\${value}` });
|
|
11058
|
-
continue;
|
|
11059
|
-
}
|
|
11060
|
-
|
|
11061
|
-
if (state.brackets === 0) {
|
|
11062
|
-
if (opts.strictBrackets === true) {
|
|
11063
|
-
throw new SyntaxError(syntaxError('opening', '['));
|
|
11064
|
-
}
|
|
11065
|
-
|
|
11066
|
-
push({ type: 'text', value, output: `\\${value}` });
|
|
11067
|
-
continue;
|
|
11068
|
-
}
|
|
11069
|
-
|
|
11070
|
-
decrement('brackets');
|
|
11071
|
-
|
|
11072
|
-
const prevValue = prev.value.slice(1);
|
|
11073
|
-
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
|
11074
|
-
value = `/${value}`;
|
|
11075
|
-
}
|
|
11076
|
-
|
|
11077
|
-
prev.value += value;
|
|
11078
|
-
append({ value });
|
|
11079
|
-
|
|
11080
|
-
// when literal brackets are explicitly disabled
|
|
11081
|
-
// assume we should match with a regex character class
|
|
11082
|
-
if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) {
|
|
11083
|
-
continue;
|
|
11084
|
-
}
|
|
11085
|
-
|
|
11086
|
-
const escaped = utils$1.escapeRegex(prev.value);
|
|
11087
|
-
state.output = state.output.slice(0, -prev.value.length);
|
|
11088
|
-
|
|
11089
|
-
// when literal brackets are explicitly enabled
|
|
11090
|
-
// assume we should escape the brackets to match literal characters
|
|
11091
|
-
if (opts.literalBrackets === true) {
|
|
11092
|
-
state.output += escaped;
|
|
11093
|
-
prev.value = escaped;
|
|
11094
|
-
continue;
|
|
11095
|
-
}
|
|
11096
|
-
|
|
11097
|
-
// when the user specifies nothing, try to match both
|
|
11098
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
11099
|
-
state.output += prev.value;
|
|
11100
|
-
continue;
|
|
11101
|
-
}
|
|
11102
|
-
|
|
11103
|
-
/**
|
|
11104
|
-
* Braces
|
|
11105
|
-
*/
|
|
11106
|
-
|
|
11107
|
-
if (value === '{' && opts.nobrace !== true) {
|
|
11108
|
-
increment('braces');
|
|
11109
|
-
|
|
11110
|
-
const open = {
|
|
11111
|
-
type: 'brace',
|
|
11112
|
-
value,
|
|
11113
|
-
output: '(',
|
|
11114
|
-
outputIndex: state.output.length,
|
|
11115
|
-
tokensIndex: state.tokens.length
|
|
11116
|
-
};
|
|
11117
|
-
|
|
11118
|
-
braces.push(open);
|
|
11119
|
-
push(open);
|
|
11120
|
-
continue;
|
|
11121
|
-
}
|
|
11122
|
-
|
|
11123
|
-
if (value === '}') {
|
|
11124
|
-
const brace = braces[braces.length - 1];
|
|
11125
|
-
|
|
11126
|
-
if (opts.nobrace === true || !brace) {
|
|
11127
|
-
push({ type: 'text', value, output: value });
|
|
11128
|
-
continue;
|
|
11129
|
-
}
|
|
11130
|
-
|
|
11131
|
-
let output = ')';
|
|
11132
|
-
|
|
11133
|
-
if (brace.dots === true) {
|
|
11134
|
-
const arr = tokens.slice();
|
|
11135
|
-
const range = [];
|
|
11136
|
-
|
|
11137
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
11138
|
-
tokens.pop();
|
|
11139
|
-
if (arr[i].type === 'brace') {
|
|
11140
|
-
break;
|
|
11141
|
-
}
|
|
11142
|
-
if (arr[i].type !== 'dots') {
|
|
11143
|
-
range.unshift(arr[i].value);
|
|
11144
|
-
}
|
|
11145
|
-
}
|
|
11146
|
-
|
|
11147
|
-
output = expandRange(range, opts);
|
|
11148
|
-
state.backtrack = true;
|
|
11149
|
-
}
|
|
11150
|
-
|
|
11151
|
-
if (brace.comma !== true && brace.dots !== true) {
|
|
11152
|
-
const out = state.output.slice(0, brace.outputIndex);
|
|
11153
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
|
11154
|
-
brace.value = brace.output = '\\{';
|
|
11155
|
-
value = output = '\\}';
|
|
11156
|
-
state.output = out;
|
|
11157
|
-
for (const t of toks) {
|
|
11158
|
-
state.output += (t.output || t.value);
|
|
11159
|
-
}
|
|
11160
|
-
}
|
|
11161
|
-
|
|
11162
|
-
push({ type: 'brace', value, output });
|
|
11163
|
-
decrement('braces');
|
|
11164
|
-
braces.pop();
|
|
11165
|
-
continue;
|
|
11166
|
-
}
|
|
11167
|
-
|
|
11168
|
-
/**
|
|
11169
|
-
* Pipes
|
|
11170
|
-
*/
|
|
11171
|
-
|
|
11172
|
-
if (value === '|') {
|
|
11173
|
-
if (extglobs.length > 0) {
|
|
11174
|
-
extglobs[extglobs.length - 1].conditions++;
|
|
11175
|
-
}
|
|
11176
|
-
push({ type: 'text', value });
|
|
11177
|
-
continue;
|
|
11178
|
-
}
|
|
11179
|
-
|
|
11180
|
-
/**
|
|
11181
|
-
* Commas
|
|
11182
|
-
*/
|
|
11183
|
-
|
|
11184
|
-
if (value === ',') {
|
|
11185
|
-
let output = value;
|
|
11186
|
-
|
|
11187
|
-
const brace = braces[braces.length - 1];
|
|
11188
|
-
if (brace && stack[stack.length - 1] === 'braces') {
|
|
11189
|
-
brace.comma = true;
|
|
11190
|
-
output = '|';
|
|
11191
|
-
}
|
|
11192
|
-
|
|
11193
|
-
push({ type: 'comma', value, output });
|
|
11194
|
-
continue;
|
|
11195
|
-
}
|
|
11196
|
-
|
|
11197
|
-
/**
|
|
11198
|
-
* Slashes
|
|
11199
|
-
*/
|
|
11200
|
-
|
|
11201
|
-
if (value === '/') {
|
|
11202
|
-
// if the beginning of the glob is "./", advance the start
|
|
11203
|
-
// to the current index, and don't add the "./" characters
|
|
11204
|
-
// to the state. This greatly simplifies lookbehinds when
|
|
11205
|
-
// checking for BOS characters like "!" and "." (not "./")
|
|
11206
|
-
if (prev.type === 'dot' && state.index === state.start + 1) {
|
|
11207
|
-
state.start = state.index + 1;
|
|
11208
|
-
state.consumed = '';
|
|
11209
|
-
state.output = '';
|
|
11210
|
-
tokens.pop();
|
|
11211
|
-
prev = bos; // reset "prev" to the first token
|
|
11212
|
-
continue;
|
|
11213
|
-
}
|
|
11214
|
-
|
|
11215
|
-
push({ type: 'slash', value, output: SLASH_LITERAL });
|
|
11216
|
-
continue;
|
|
11217
|
-
}
|
|
11218
|
-
|
|
11219
|
-
/**
|
|
11220
|
-
* Dots
|
|
11221
|
-
*/
|
|
11222
|
-
|
|
11223
|
-
if (value === '.') {
|
|
11224
|
-
if (state.braces > 0 && prev.type === 'dot') {
|
|
11225
|
-
if (prev.value === '.') prev.output = DOT_LITERAL;
|
|
11226
|
-
const brace = braces[braces.length - 1];
|
|
11227
|
-
prev.type = 'dots';
|
|
11228
|
-
prev.output += value;
|
|
11229
|
-
prev.value += value;
|
|
11230
|
-
brace.dots = true;
|
|
11231
|
-
continue;
|
|
11232
|
-
}
|
|
11233
|
-
|
|
11234
|
-
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
|
11235
|
-
push({ type: 'text', value, output: DOT_LITERAL });
|
|
11236
|
-
continue;
|
|
11237
|
-
}
|
|
11238
|
-
|
|
11239
|
-
push({ type: 'dot', value, output: DOT_LITERAL });
|
|
11240
|
-
continue;
|
|
11241
|
-
}
|
|
10147
|
+
exports.supportsLookbehinds = () => {
|
|
10148
|
+
const segs = process.version.slice(1).split('.').map(Number);
|
|
10149
|
+
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
|
10150
|
+
return true;
|
|
10151
|
+
}
|
|
10152
|
+
return false;
|
|
10153
|
+
};
|
|
11242
10154
|
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
10155
|
+
exports.isWindows = options => {
|
|
10156
|
+
if (options && typeof options.windows === 'boolean') {
|
|
10157
|
+
return options.windows;
|
|
10158
|
+
}
|
|
10159
|
+
return win32 === true || path.sep === '\\';
|
|
10160
|
+
};
|
|
11246
10161
|
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
10162
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
10163
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
10164
|
+
if (idx === -1) return input;
|
|
10165
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
10166
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
10167
|
+
};
|
|
11253
10168
|
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
10169
|
+
exports.removePrefix = (input, state = {}) => {
|
|
10170
|
+
let output = input;
|
|
10171
|
+
if (output.startsWith('./')) {
|
|
10172
|
+
output = output.slice(2);
|
|
10173
|
+
state.prefix = './';
|
|
10174
|
+
}
|
|
10175
|
+
return output;
|
|
10176
|
+
};
|
|
11257
10177
|
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
10178
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
10179
|
+
const prepend = options.contains ? '' : '^';
|
|
10180
|
+
const append = options.contains ? '' : '$';
|
|
11261
10181
|
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
10182
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
10183
|
+
if (state.negated === true) {
|
|
10184
|
+
output = `(?:^(?!${output}).*$)`;
|
|
10185
|
+
}
|
|
10186
|
+
return output;
|
|
10187
|
+
};
|
|
10188
|
+
} (utils));
|
|
10189
|
+
return utils;
|
|
10190
|
+
}
|
|
11265
10191
|
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
}
|
|
10192
|
+
var scan_1;
|
|
10193
|
+
var hasRequiredScan;
|
|
11269
10194
|
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
}
|
|
10195
|
+
function requireScan () {
|
|
10196
|
+
if (hasRequiredScan) return scan_1;
|
|
10197
|
+
hasRequiredScan = 1;
|
|
11274
10198
|
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
10199
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
10200
|
+
const {
|
|
10201
|
+
CHAR_ASTERISK, /* * */
|
|
10202
|
+
CHAR_AT, /* @ */
|
|
10203
|
+
CHAR_BACKWARD_SLASH, /* \ */
|
|
10204
|
+
CHAR_COMMA, /* , */
|
|
10205
|
+
CHAR_DOT, /* . */
|
|
10206
|
+
CHAR_EXCLAMATION_MARK, /* ! */
|
|
10207
|
+
CHAR_FORWARD_SLASH, /* / */
|
|
10208
|
+
CHAR_LEFT_CURLY_BRACE, /* { */
|
|
10209
|
+
CHAR_LEFT_PARENTHESES, /* ( */
|
|
10210
|
+
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
|
10211
|
+
CHAR_PLUS, /* + */
|
|
10212
|
+
CHAR_QUESTION_MARK, /* ? */
|
|
10213
|
+
CHAR_RIGHT_CURLY_BRACE, /* } */
|
|
10214
|
+
CHAR_RIGHT_PARENTHESES, /* ) */
|
|
10215
|
+
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
|
10216
|
+
} = /*@__PURE__*/ requireConstants();
|
|
10217
|
+
|
|
10218
|
+
const isPathSeparator = code => {
|
|
10219
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
10220
|
+
};
|
|
11278
10221
|
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
10222
|
+
const depth = token => {
|
|
10223
|
+
if (token.isPrefix !== true) {
|
|
10224
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
10225
|
+
}
|
|
10226
|
+
};
|
|
11282
10227
|
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
10228
|
+
/**
|
|
10229
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
10230
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
10231
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
10232
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
10233
|
+
*
|
|
10234
|
+
* ```js
|
|
10235
|
+
* const pm = require('picomatch');
|
|
10236
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
10237
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
10238
|
+
* ```
|
|
10239
|
+
* @param {String} `str`
|
|
10240
|
+
* @param {Object} `options`
|
|
10241
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
10242
|
+
* @api public
|
|
10243
|
+
*/
|
|
10244
|
+
|
|
10245
|
+
const scan = (input, options) => {
|
|
10246
|
+
const opts = options || {};
|
|
10247
|
+
|
|
10248
|
+
const length = input.length - 1;
|
|
10249
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
10250
|
+
const slashes = [];
|
|
10251
|
+
const tokens = [];
|
|
10252
|
+
const parts = [];
|
|
10253
|
+
|
|
10254
|
+
let str = input;
|
|
10255
|
+
let index = -1;
|
|
10256
|
+
let start = 0;
|
|
10257
|
+
let lastIndex = 0;
|
|
10258
|
+
let isBrace = false;
|
|
10259
|
+
let isBracket = false;
|
|
10260
|
+
let isGlob = false;
|
|
10261
|
+
let isExtglob = false;
|
|
10262
|
+
let isGlobstar = false;
|
|
10263
|
+
let braceEscaped = false;
|
|
10264
|
+
let backslashes = false;
|
|
10265
|
+
let negated = false;
|
|
10266
|
+
let negatedExtglob = false;
|
|
10267
|
+
let finished = false;
|
|
10268
|
+
let braces = 0;
|
|
10269
|
+
let prev;
|
|
10270
|
+
let code;
|
|
10271
|
+
let token = { value: '', depth: 0, isGlob: false };
|
|
10272
|
+
|
|
10273
|
+
const eos = () => index >= length;
|
|
10274
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
10275
|
+
const advance = () => {
|
|
10276
|
+
prev = code;
|
|
10277
|
+
return str.charCodeAt(++index);
|
|
10278
|
+
};
|
|
10279
|
+
|
|
10280
|
+
while (index < length) {
|
|
10281
|
+
code = advance();
|
|
10282
|
+
let next;
|
|
10283
|
+
|
|
10284
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
10285
|
+
backslashes = token.backslashes = true;
|
|
10286
|
+
code = advance();
|
|
10287
|
+
|
|
10288
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
10289
|
+
braceEscaped = true;
|
|
10290
|
+
}
|
|
10291
|
+
continue;
|
|
10292
|
+
}
|
|
10293
|
+
|
|
10294
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
10295
|
+
braces++;
|
|
10296
|
+
|
|
10297
|
+
while (eos() !== true && (code = advance())) {
|
|
10298
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
10299
|
+
backslashes = token.backslashes = true;
|
|
10300
|
+
advance();
|
|
10301
|
+
continue;
|
|
10302
|
+
}
|
|
10303
|
+
|
|
10304
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
10305
|
+
braces++;
|
|
10306
|
+
continue;
|
|
10307
|
+
}
|
|
10308
|
+
|
|
10309
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
10310
|
+
isBrace = token.isBrace = true;
|
|
10311
|
+
isGlob = token.isGlob = true;
|
|
10312
|
+
finished = true;
|
|
10313
|
+
|
|
10314
|
+
if (scanToEnd === true) {
|
|
10315
|
+
continue;
|
|
10316
|
+
}
|
|
10317
|
+
|
|
10318
|
+
break;
|
|
10319
|
+
}
|
|
10320
|
+
|
|
10321
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
10322
|
+
isBrace = token.isBrace = true;
|
|
10323
|
+
isGlob = token.isGlob = true;
|
|
10324
|
+
finished = true;
|
|
10325
|
+
|
|
10326
|
+
if (scanToEnd === true) {
|
|
10327
|
+
continue;
|
|
10328
|
+
}
|
|
10329
|
+
|
|
10330
|
+
break;
|
|
10331
|
+
}
|
|
10332
|
+
|
|
10333
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
10334
|
+
braces--;
|
|
10335
|
+
|
|
10336
|
+
if (braces === 0) {
|
|
10337
|
+
braceEscaped = false;
|
|
10338
|
+
isBrace = token.isBrace = true;
|
|
10339
|
+
finished = true;
|
|
10340
|
+
break;
|
|
10341
|
+
}
|
|
10342
|
+
}
|
|
10343
|
+
}
|
|
10344
|
+
|
|
10345
|
+
if (scanToEnd === true) {
|
|
10346
|
+
continue;
|
|
10347
|
+
}
|
|
10348
|
+
|
|
10349
|
+
break;
|
|
10350
|
+
}
|
|
10351
|
+
|
|
10352
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
10353
|
+
slashes.push(index);
|
|
10354
|
+
tokens.push(token);
|
|
10355
|
+
token = { value: '', depth: 0, isGlob: false };
|
|
10356
|
+
|
|
10357
|
+
if (finished === true) continue;
|
|
10358
|
+
if (prev === CHAR_DOT && index === (start + 1)) {
|
|
10359
|
+
start += 2;
|
|
10360
|
+
continue;
|
|
10361
|
+
}
|
|
10362
|
+
|
|
10363
|
+
lastIndex = index + 1;
|
|
10364
|
+
continue;
|
|
10365
|
+
}
|
|
10366
|
+
|
|
10367
|
+
if (opts.noext !== true) {
|
|
10368
|
+
const isExtglobChar = code === CHAR_PLUS
|
|
10369
|
+
|| code === CHAR_AT
|
|
10370
|
+
|| code === CHAR_ASTERISK
|
|
10371
|
+
|| code === CHAR_QUESTION_MARK
|
|
10372
|
+
|| code === CHAR_EXCLAMATION_MARK;
|
|
10373
|
+
|
|
10374
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
10375
|
+
isGlob = token.isGlob = true;
|
|
10376
|
+
isExtglob = token.isExtglob = true;
|
|
10377
|
+
finished = true;
|
|
10378
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
10379
|
+
negatedExtglob = true;
|
|
10380
|
+
}
|
|
10381
|
+
|
|
10382
|
+
if (scanToEnd === true) {
|
|
10383
|
+
while (eos() !== true && (code = advance())) {
|
|
10384
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
10385
|
+
backslashes = token.backslashes = true;
|
|
10386
|
+
code = advance();
|
|
10387
|
+
continue;
|
|
10388
|
+
}
|
|
10389
|
+
|
|
10390
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
10391
|
+
isGlob = token.isGlob = true;
|
|
10392
|
+
finished = true;
|
|
10393
|
+
break;
|
|
10394
|
+
}
|
|
10395
|
+
}
|
|
10396
|
+
continue;
|
|
10397
|
+
}
|
|
10398
|
+
break;
|
|
10399
|
+
}
|
|
10400
|
+
}
|
|
10401
|
+
|
|
10402
|
+
if (code === CHAR_ASTERISK) {
|
|
10403
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
10404
|
+
isGlob = token.isGlob = true;
|
|
10405
|
+
finished = true;
|
|
10406
|
+
|
|
10407
|
+
if (scanToEnd === true) {
|
|
10408
|
+
continue;
|
|
10409
|
+
}
|
|
10410
|
+
break;
|
|
10411
|
+
}
|
|
10412
|
+
|
|
10413
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
10414
|
+
isGlob = token.isGlob = true;
|
|
10415
|
+
finished = true;
|
|
10416
|
+
|
|
10417
|
+
if (scanToEnd === true) {
|
|
10418
|
+
continue;
|
|
10419
|
+
}
|
|
10420
|
+
break;
|
|
10421
|
+
}
|
|
10422
|
+
|
|
10423
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
10424
|
+
while (eos() !== true && (next = advance())) {
|
|
10425
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
10426
|
+
backslashes = token.backslashes = true;
|
|
10427
|
+
advance();
|
|
10428
|
+
continue;
|
|
10429
|
+
}
|
|
10430
|
+
|
|
10431
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
10432
|
+
isBracket = token.isBracket = true;
|
|
10433
|
+
isGlob = token.isGlob = true;
|
|
10434
|
+
finished = true;
|
|
10435
|
+
break;
|
|
10436
|
+
}
|
|
10437
|
+
}
|
|
10438
|
+
|
|
10439
|
+
if (scanToEnd === true) {
|
|
10440
|
+
continue;
|
|
10441
|
+
}
|
|
10442
|
+
|
|
10443
|
+
break;
|
|
10444
|
+
}
|
|
10445
|
+
|
|
10446
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
10447
|
+
negated = token.negated = true;
|
|
10448
|
+
start++;
|
|
10449
|
+
continue;
|
|
10450
|
+
}
|
|
10451
|
+
|
|
10452
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
10453
|
+
isGlob = token.isGlob = true;
|
|
10454
|
+
|
|
10455
|
+
if (scanToEnd === true) {
|
|
10456
|
+
while (eos() !== true && (code = advance())) {
|
|
10457
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
10458
|
+
backslashes = token.backslashes = true;
|
|
10459
|
+
code = advance();
|
|
10460
|
+
continue;
|
|
10461
|
+
}
|
|
10462
|
+
|
|
10463
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
10464
|
+
finished = true;
|
|
10465
|
+
break;
|
|
10466
|
+
}
|
|
10467
|
+
}
|
|
10468
|
+
continue;
|
|
10469
|
+
}
|
|
10470
|
+
break;
|
|
10471
|
+
}
|
|
10472
|
+
|
|
10473
|
+
if (isGlob === true) {
|
|
10474
|
+
finished = true;
|
|
10475
|
+
|
|
10476
|
+
if (scanToEnd === true) {
|
|
10477
|
+
continue;
|
|
10478
|
+
}
|
|
10479
|
+
|
|
10480
|
+
break;
|
|
10481
|
+
}
|
|
10482
|
+
}
|
|
11290
10483
|
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
}
|
|
10484
|
+
if (opts.noext === true) {
|
|
10485
|
+
isExtglob = false;
|
|
10486
|
+
isGlob = false;
|
|
10487
|
+
}
|
|
11296
10488
|
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
10489
|
+
let base = str;
|
|
10490
|
+
let prefix = '';
|
|
10491
|
+
let glob = '';
|
|
11300
10492
|
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
10493
|
+
if (start > 0) {
|
|
10494
|
+
prefix = str.slice(0, start);
|
|
10495
|
+
str = str.slice(start);
|
|
10496
|
+
lastIndex -= start;
|
|
10497
|
+
}
|
|
11306
10498
|
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
10499
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
10500
|
+
base = str.slice(0, lastIndex);
|
|
10501
|
+
glob = str.slice(lastIndex);
|
|
10502
|
+
} else if (isGlob === true) {
|
|
10503
|
+
base = '';
|
|
10504
|
+
glob = str;
|
|
10505
|
+
} else {
|
|
10506
|
+
base = str;
|
|
10507
|
+
}
|
|
11311
10508
|
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
10509
|
+
if (base && base !== '' && base !== '/' && base !== str) {
|
|
10510
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
10511
|
+
base = base.slice(0, -1);
|
|
10512
|
+
}
|
|
10513
|
+
}
|
|
11316
10514
|
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
}
|
|
10515
|
+
if (opts.unescape === true) {
|
|
10516
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
11320
10517
|
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
10518
|
+
if (base && backslashes === true) {
|
|
10519
|
+
base = utils.removeBackslashes(base);
|
|
10520
|
+
}
|
|
10521
|
+
}
|
|
11324
10522
|
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
10523
|
+
const state = {
|
|
10524
|
+
prefix,
|
|
10525
|
+
input,
|
|
10526
|
+
start,
|
|
10527
|
+
base,
|
|
10528
|
+
glob,
|
|
10529
|
+
isBrace,
|
|
10530
|
+
isBracket,
|
|
10531
|
+
isGlob,
|
|
10532
|
+
isExtglob,
|
|
10533
|
+
isGlobstar,
|
|
10534
|
+
negated,
|
|
10535
|
+
negatedExtglob
|
|
10536
|
+
};
|
|
10537
|
+
|
|
10538
|
+
if (opts.tokens === true) {
|
|
10539
|
+
state.maxDepth = 0;
|
|
10540
|
+
if (!isPathSeparator(code)) {
|
|
10541
|
+
tokens.push(token);
|
|
10542
|
+
}
|
|
10543
|
+
state.tokens = tokens;
|
|
10544
|
+
}
|
|
11330
10545
|
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
10546
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
10547
|
+
let prevIndex;
|
|
10548
|
+
|
|
10549
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
10550
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
10551
|
+
const i = slashes[idx];
|
|
10552
|
+
const value = input.slice(n, i);
|
|
10553
|
+
if (opts.tokens) {
|
|
10554
|
+
if (idx === 0 && start !== 0) {
|
|
10555
|
+
tokens[idx].isPrefix = true;
|
|
10556
|
+
tokens[idx].value = prefix;
|
|
10557
|
+
} else {
|
|
10558
|
+
tokens[idx].value = value;
|
|
10559
|
+
}
|
|
10560
|
+
depth(tokens[idx]);
|
|
10561
|
+
state.maxDepth += tokens[idx].depth;
|
|
10562
|
+
}
|
|
10563
|
+
if (idx !== 0 || value !== '') {
|
|
10564
|
+
parts.push(value);
|
|
10565
|
+
}
|
|
10566
|
+
prevIndex = i;
|
|
10567
|
+
}
|
|
10568
|
+
|
|
10569
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
10570
|
+
const value = input.slice(prevIndex + 1);
|
|
10571
|
+
parts.push(value);
|
|
10572
|
+
|
|
10573
|
+
if (opts.tokens) {
|
|
10574
|
+
tokens[tokens.length - 1].value = value;
|
|
10575
|
+
depth(tokens[tokens.length - 1]);
|
|
10576
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
10577
|
+
}
|
|
10578
|
+
}
|
|
10579
|
+
|
|
10580
|
+
state.slashes = slashes;
|
|
10581
|
+
state.parts = parts;
|
|
10582
|
+
}
|
|
11334
10583
|
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
*/
|
|
10584
|
+
return state;
|
|
10585
|
+
};
|
|
11338
10586
|
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
}
|
|
10587
|
+
scan_1 = scan;
|
|
10588
|
+
return scan_1;
|
|
10589
|
+
}
|
|
11343
10590
|
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
value += match[0];
|
|
11347
|
-
state.index += match[0].length;
|
|
11348
|
-
}
|
|
10591
|
+
var parse_1;
|
|
10592
|
+
var hasRequiredParse;
|
|
11349
10593
|
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
10594
|
+
function requireParse () {
|
|
10595
|
+
if (hasRequiredParse) return parse_1;
|
|
10596
|
+
hasRequiredParse = 1;
|
|
11353
10597
|
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
*/
|
|
10598
|
+
const constants = /*@__PURE__*/ requireConstants();
|
|
10599
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
11357
10600
|
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
prev.value += value;
|
|
11362
|
-
prev.output = star;
|
|
11363
|
-
state.backtrack = true;
|
|
11364
|
-
state.globstar = true;
|
|
11365
|
-
consume(value);
|
|
11366
|
-
continue;
|
|
11367
|
-
}
|
|
11368
|
-
|
|
11369
|
-
let rest = remaining();
|
|
11370
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
11371
|
-
extglobOpen('star', value);
|
|
11372
|
-
continue;
|
|
11373
|
-
}
|
|
11374
|
-
|
|
11375
|
-
if (prev.type === 'star') {
|
|
11376
|
-
if (opts.noglobstar === true) {
|
|
11377
|
-
consume(value);
|
|
11378
|
-
continue;
|
|
11379
|
-
}
|
|
11380
|
-
|
|
11381
|
-
const prior = prev.prev;
|
|
11382
|
-
const before = prior.prev;
|
|
11383
|
-
const isStart = prior.type === 'slash' || prior.type === 'bos';
|
|
11384
|
-
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
|
|
11385
|
-
|
|
11386
|
-
if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
|
|
11387
|
-
push({ type: 'star', value, output: '' });
|
|
11388
|
-
continue;
|
|
11389
|
-
}
|
|
11390
|
-
|
|
11391
|
-
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
|
|
11392
|
-
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
|
|
11393
|
-
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
|
|
11394
|
-
push({ type: 'star', value, output: '' });
|
|
11395
|
-
continue;
|
|
11396
|
-
}
|
|
11397
|
-
|
|
11398
|
-
// strip consecutive `/**/`
|
|
11399
|
-
while (rest.slice(0, 3) === '/**') {
|
|
11400
|
-
const after = input[state.index + 4];
|
|
11401
|
-
if (after && after !== '/') {
|
|
11402
|
-
break;
|
|
11403
|
-
}
|
|
11404
|
-
rest = rest.slice(3);
|
|
11405
|
-
consume('/**', 3);
|
|
11406
|
-
}
|
|
11407
|
-
|
|
11408
|
-
if (prior.type === 'bos' && eos()) {
|
|
11409
|
-
prev.type = 'globstar';
|
|
11410
|
-
prev.value += value;
|
|
11411
|
-
prev.output = globstar(opts);
|
|
11412
|
-
state.output = prev.output;
|
|
11413
|
-
state.globstar = true;
|
|
11414
|
-
consume(value);
|
|
11415
|
-
continue;
|
|
11416
|
-
}
|
|
11417
|
-
|
|
11418
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
|
|
11419
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
11420
|
-
prior.output = `(?:${prior.output}`;
|
|
11421
|
-
|
|
11422
|
-
prev.type = 'globstar';
|
|
11423
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
11424
|
-
prev.value += value;
|
|
11425
|
-
state.globstar = true;
|
|
11426
|
-
state.output += prior.output + prev.output;
|
|
11427
|
-
consume(value);
|
|
11428
|
-
continue;
|
|
11429
|
-
}
|
|
11430
|
-
|
|
11431
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
|
11432
|
-
const end = rest[1] !== void 0 ? '|$' : '';
|
|
11433
|
-
|
|
11434
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
11435
|
-
prior.output = `(?:${prior.output}`;
|
|
11436
|
-
|
|
11437
|
-
prev.type = 'globstar';
|
|
11438
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
11439
|
-
prev.value += value;
|
|
11440
|
-
|
|
11441
|
-
state.output += prior.output + prev.output;
|
|
11442
|
-
state.globstar = true;
|
|
11443
|
-
|
|
11444
|
-
consume(value + advance());
|
|
11445
|
-
|
|
11446
|
-
push({ type: 'slash', value: '/', output: '' });
|
|
11447
|
-
continue;
|
|
11448
|
-
}
|
|
11449
|
-
|
|
11450
|
-
if (prior.type === 'bos' && rest[0] === '/') {
|
|
11451
|
-
prev.type = 'globstar';
|
|
11452
|
-
prev.value += value;
|
|
11453
|
-
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
11454
|
-
state.output = prev.output;
|
|
11455
|
-
state.globstar = true;
|
|
11456
|
-
consume(value + advance());
|
|
11457
|
-
push({ type: 'slash', value: '/', output: '' });
|
|
11458
|
-
continue;
|
|
11459
|
-
}
|
|
11460
|
-
|
|
11461
|
-
// remove single star from output
|
|
11462
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
11463
|
-
|
|
11464
|
-
// reset previous token to globstar
|
|
11465
|
-
prev.type = 'globstar';
|
|
11466
|
-
prev.output = globstar(opts);
|
|
11467
|
-
prev.value += value;
|
|
11468
|
-
|
|
11469
|
-
// reset output with globstar
|
|
11470
|
-
state.output += prev.output;
|
|
11471
|
-
state.globstar = true;
|
|
11472
|
-
consume(value);
|
|
11473
|
-
continue;
|
|
11474
|
-
}
|
|
11475
|
-
|
|
11476
|
-
const token = { type: 'star', value, output: star };
|
|
11477
|
-
|
|
11478
|
-
if (opts.bash === true) {
|
|
11479
|
-
token.output = '.*?';
|
|
11480
|
-
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
11481
|
-
token.output = nodot + token.output;
|
|
11482
|
-
}
|
|
11483
|
-
push(token);
|
|
11484
|
-
continue;
|
|
11485
|
-
}
|
|
11486
|
-
|
|
11487
|
-
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
11488
|
-
token.output = value;
|
|
11489
|
-
push(token);
|
|
11490
|
-
continue;
|
|
11491
|
-
}
|
|
11492
|
-
|
|
11493
|
-
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
11494
|
-
if (prev.type === 'dot') {
|
|
11495
|
-
state.output += NO_DOT_SLASH;
|
|
11496
|
-
prev.output += NO_DOT_SLASH;
|
|
11497
|
-
|
|
11498
|
-
} else if (opts.dot === true) {
|
|
11499
|
-
state.output += NO_DOTS_SLASH;
|
|
11500
|
-
prev.output += NO_DOTS_SLASH;
|
|
11501
|
-
|
|
11502
|
-
} else {
|
|
11503
|
-
state.output += nodot;
|
|
11504
|
-
prev.output += nodot;
|
|
11505
|
-
}
|
|
11506
|
-
|
|
11507
|
-
if (peek() !== '*') {
|
|
11508
|
-
state.output += ONE_CHAR;
|
|
11509
|
-
prev.output += ONE_CHAR;
|
|
11510
|
-
}
|
|
11511
|
-
}
|
|
11512
|
-
|
|
11513
|
-
push(token);
|
|
11514
|
-
}
|
|
10601
|
+
/**
|
|
10602
|
+
* Constants
|
|
10603
|
+
*/
|
|
11515
10604
|
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
10605
|
+
const {
|
|
10606
|
+
MAX_LENGTH,
|
|
10607
|
+
POSIX_REGEX_SOURCE,
|
|
10608
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
10609
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
10610
|
+
REPLACEMENTS
|
|
10611
|
+
} = constants;
|
|
10612
|
+
|
|
10613
|
+
/**
|
|
10614
|
+
* Helpers
|
|
10615
|
+
*/
|
|
10616
|
+
|
|
10617
|
+
const expandRange = (args, options) => {
|
|
10618
|
+
if (typeof options.expandRange === 'function') {
|
|
10619
|
+
return options.expandRange(...args, options);
|
|
10620
|
+
}
|
|
11521
10621
|
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
state.output = utils$1.escapeLast(state.output, '(');
|
|
11525
|
-
decrement('parens');
|
|
11526
|
-
}
|
|
10622
|
+
args.sort();
|
|
10623
|
+
const value = `[${args.join('-')}]`;
|
|
11527
10624
|
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
state.output = utils$1.escapeLast(state.output, '{');
|
|
11531
|
-
decrement('braces');
|
|
11532
|
-
}
|
|
10625
|
+
return value;
|
|
10626
|
+
};
|
|
11533
10627
|
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
10628
|
+
/**
|
|
10629
|
+
* Create the message for a syntax error
|
|
10630
|
+
*/
|
|
11537
10631
|
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
10632
|
+
const syntaxError = (type, char) => {
|
|
10633
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
10634
|
+
};
|
|
11541
10635
|
|
|
11542
|
-
|
|
11543
|
-
|
|
10636
|
+
/**
|
|
10637
|
+
* Parse the given input string.
|
|
10638
|
+
* @param {String} input
|
|
10639
|
+
* @param {Object} options
|
|
10640
|
+
* @return {Object}
|
|
10641
|
+
*/
|
|
11544
10642
|
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
}
|
|
10643
|
+
const parse = (input, options) => {
|
|
10644
|
+
if (typeof input !== 'string') {
|
|
10645
|
+
throw new TypeError('Expected a string');
|
|
10646
|
+
}
|
|
11550
10647
|
|
|
11551
|
-
|
|
11552
|
-
};
|
|
10648
|
+
input = REPLACEMENTS[input] || input;
|
|
11553
10649
|
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
* This can significantly speed up processing and has very little downside
|
|
11557
|
-
* impact when none of the fast paths match.
|
|
11558
|
-
*/
|
|
10650
|
+
const opts = { ...options };
|
|
10651
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
11559
10652
|
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
if (len > max) {
|
|
11565
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
11566
|
-
}
|
|
10653
|
+
let len = input.length;
|
|
10654
|
+
if (len > max) {
|
|
10655
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
10656
|
+
}
|
|
11567
10657
|
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
10658
|
+
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
|
10659
|
+
const tokens = [bos];
|
|
10660
|
+
|
|
10661
|
+
const capture = opts.capture ? '' : '?:';
|
|
10662
|
+
const win32 = utils.isWindows(options);
|
|
10663
|
+
|
|
10664
|
+
// create constants based on platform, for windows or posix
|
|
10665
|
+
const PLATFORM_CHARS = constants.globChars(win32);
|
|
10666
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
10667
|
+
|
|
10668
|
+
const {
|
|
10669
|
+
DOT_LITERAL,
|
|
10670
|
+
PLUS_LITERAL,
|
|
10671
|
+
SLASH_LITERAL,
|
|
10672
|
+
ONE_CHAR,
|
|
10673
|
+
DOTS_SLASH,
|
|
10674
|
+
NO_DOT,
|
|
10675
|
+
NO_DOT_SLASH,
|
|
10676
|
+
NO_DOTS_SLASH,
|
|
10677
|
+
QMARK,
|
|
10678
|
+
QMARK_NO_DOT,
|
|
10679
|
+
STAR,
|
|
10680
|
+
START_ANCHOR
|
|
10681
|
+
} = PLATFORM_CHARS;
|
|
10682
|
+
|
|
10683
|
+
const globstar = opts => {
|
|
10684
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
10685
|
+
};
|
|
10686
|
+
|
|
10687
|
+
const nodot = opts.dot ? '' : NO_DOT;
|
|
10688
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
10689
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
10690
|
+
|
|
10691
|
+
if (opts.capture) {
|
|
10692
|
+
star = `(${star})`;
|
|
10693
|
+
}
|
|
11593
10694
|
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
10695
|
+
// minimatch options support
|
|
10696
|
+
if (typeof opts.noext === 'boolean') {
|
|
10697
|
+
opts.noextglob = opts.noext;
|
|
10698
|
+
}
|
|
11598
10699
|
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
10700
|
+
const state = {
|
|
10701
|
+
input,
|
|
10702
|
+
index: -1,
|
|
10703
|
+
start: 0,
|
|
10704
|
+
dot: opts.dot === true,
|
|
10705
|
+
consumed: '',
|
|
10706
|
+
output: '',
|
|
10707
|
+
prefix: '',
|
|
10708
|
+
backtrack: false,
|
|
10709
|
+
negated: false,
|
|
10710
|
+
brackets: 0,
|
|
10711
|
+
braces: 0,
|
|
10712
|
+
parens: 0,
|
|
10713
|
+
quotes: 0,
|
|
10714
|
+
globstar: false,
|
|
10715
|
+
tokens
|
|
10716
|
+
};
|
|
10717
|
+
|
|
10718
|
+
input = utils.removePrefix(input, state);
|
|
10719
|
+
len = input.length;
|
|
10720
|
+
|
|
10721
|
+
const extglobs = [];
|
|
10722
|
+
const braces = [];
|
|
10723
|
+
const stack = [];
|
|
10724
|
+
let prev = bos;
|
|
10725
|
+
let value;
|
|
10726
|
+
|
|
10727
|
+
/**
|
|
10728
|
+
* Tokenizing helpers
|
|
10729
|
+
*/
|
|
10730
|
+
|
|
10731
|
+
const eos = () => state.index === len - 1;
|
|
10732
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
10733
|
+
const advance = state.advance = () => input[++state.index] || '';
|
|
10734
|
+
const remaining = () => input.slice(state.index + 1);
|
|
10735
|
+
const consume = (value = '', num = 0) => {
|
|
10736
|
+
state.consumed += value;
|
|
10737
|
+
state.index += num;
|
|
10738
|
+
};
|
|
10739
|
+
|
|
10740
|
+
const append = token => {
|
|
10741
|
+
state.output += token.output != null ? token.output : token.value;
|
|
10742
|
+
consume(token.value);
|
|
10743
|
+
};
|
|
10744
|
+
|
|
10745
|
+
const negate = () => {
|
|
10746
|
+
let count = 1;
|
|
10747
|
+
|
|
10748
|
+
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
|
10749
|
+
advance();
|
|
10750
|
+
state.start++;
|
|
10751
|
+
count++;
|
|
10752
|
+
}
|
|
10753
|
+
|
|
10754
|
+
if (count % 2 === 0) {
|
|
10755
|
+
return false;
|
|
10756
|
+
}
|
|
10757
|
+
|
|
10758
|
+
state.negated = true;
|
|
10759
|
+
state.start++;
|
|
10760
|
+
return true;
|
|
10761
|
+
};
|
|
10762
|
+
|
|
10763
|
+
const increment = type => {
|
|
10764
|
+
state[type]++;
|
|
10765
|
+
stack.push(type);
|
|
10766
|
+
};
|
|
10767
|
+
|
|
10768
|
+
const decrement = type => {
|
|
10769
|
+
state[type]--;
|
|
10770
|
+
stack.pop();
|
|
10771
|
+
};
|
|
10772
|
+
|
|
10773
|
+
/**
|
|
10774
|
+
* Push tokens onto the tokens array. This helper speeds up
|
|
10775
|
+
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
10776
|
+
* and 2) helping us avoid creating extra tokens when consecutive
|
|
10777
|
+
* characters are plain text. This improves performance and simplifies
|
|
10778
|
+
* lookbehinds.
|
|
10779
|
+
*/
|
|
10780
|
+
|
|
10781
|
+
const push = tok => {
|
|
10782
|
+
if (prev.type === 'globstar') {
|
|
10783
|
+
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
|
10784
|
+
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
|
10785
|
+
|
|
10786
|
+
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
|
10787
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
10788
|
+
prev.type = 'star';
|
|
10789
|
+
prev.value = '*';
|
|
10790
|
+
prev.output = star;
|
|
10791
|
+
state.output += prev.output;
|
|
10792
|
+
}
|
|
10793
|
+
}
|
|
10794
|
+
|
|
10795
|
+
if (extglobs.length && tok.type !== 'paren') {
|
|
10796
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
10797
|
+
}
|
|
10798
|
+
|
|
10799
|
+
if (tok.value || tok.output) append(tok);
|
|
10800
|
+
if (prev && prev.type === 'text' && tok.type === 'text') {
|
|
10801
|
+
prev.value += tok.value;
|
|
10802
|
+
prev.output = (prev.output || '') + tok.value;
|
|
10803
|
+
return;
|
|
10804
|
+
}
|
|
10805
|
+
|
|
10806
|
+
tok.prev = prev;
|
|
10807
|
+
tokens.push(tok);
|
|
10808
|
+
prev = tok;
|
|
10809
|
+
};
|
|
10810
|
+
|
|
10811
|
+
const extglobOpen = (type, value) => {
|
|
10812
|
+
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
|
10813
|
+
|
|
10814
|
+
token.prev = prev;
|
|
10815
|
+
token.parens = state.parens;
|
|
10816
|
+
token.output = state.output;
|
|
10817
|
+
const output = (opts.capture ? '(' : '') + token.open;
|
|
10818
|
+
|
|
10819
|
+
increment('parens');
|
|
10820
|
+
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
|
10821
|
+
push({ type: 'paren', extglob: true, value: advance(), output });
|
|
10822
|
+
extglobs.push(token);
|
|
10823
|
+
};
|
|
10824
|
+
|
|
10825
|
+
const extglobClose = token => {
|
|
10826
|
+
let output = token.close + (opts.capture ? ')' : '');
|
|
10827
|
+
let rest;
|
|
10828
|
+
|
|
10829
|
+
if (token.type === 'negate') {
|
|
10830
|
+
let extglobStar = star;
|
|
10831
|
+
|
|
10832
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
|
10833
|
+
extglobStar = globstar(opts);
|
|
10834
|
+
}
|
|
10835
|
+
|
|
10836
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
10837
|
+
output = token.close = `)$))${extglobStar}`;
|
|
10838
|
+
}
|
|
10839
|
+
|
|
10840
|
+
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
10841
|
+
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
|
10842
|
+
// In this case, we need to parse the string and use it in the output of the original pattern.
|
|
10843
|
+
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
10844
|
+
//
|
|
10845
|
+
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
10846
|
+
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
|
10847
|
+
|
|
10848
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
10849
|
+
}
|
|
10850
|
+
|
|
10851
|
+
if (token.prev.type === 'bos') {
|
|
10852
|
+
state.negatedExtglob = true;
|
|
10853
|
+
}
|
|
10854
|
+
}
|
|
10855
|
+
|
|
10856
|
+
push({ type: 'paren', extglob: true, value, output });
|
|
10857
|
+
decrement('parens');
|
|
10858
|
+
};
|
|
10859
|
+
|
|
10860
|
+
/**
|
|
10861
|
+
* Fast paths
|
|
10862
|
+
*/
|
|
10863
|
+
|
|
10864
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
10865
|
+
let backslashes = false;
|
|
10866
|
+
|
|
10867
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
10868
|
+
if (first === '\\') {
|
|
10869
|
+
backslashes = true;
|
|
10870
|
+
return m;
|
|
10871
|
+
}
|
|
10872
|
+
|
|
10873
|
+
if (first === '?') {
|
|
10874
|
+
if (esc) {
|
|
10875
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
10876
|
+
}
|
|
10877
|
+
if (index === 0) {
|
|
10878
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
10879
|
+
}
|
|
10880
|
+
return QMARK.repeat(chars.length);
|
|
10881
|
+
}
|
|
10882
|
+
|
|
10883
|
+
if (first === '.') {
|
|
10884
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
10885
|
+
}
|
|
10886
|
+
|
|
10887
|
+
if (first === '*') {
|
|
10888
|
+
if (esc) {
|
|
10889
|
+
return esc + first + (rest ? star : '');
|
|
10890
|
+
}
|
|
10891
|
+
return star;
|
|
10892
|
+
}
|
|
10893
|
+
return esc ? m : `\\${m}`;
|
|
10894
|
+
});
|
|
10895
|
+
|
|
10896
|
+
if (backslashes === true) {
|
|
10897
|
+
if (opts.unescape === true) {
|
|
10898
|
+
output = output.replace(/\\/g, '');
|
|
10899
|
+
} else {
|
|
10900
|
+
output = output.replace(/\\+/g, m => {
|
|
10901
|
+
return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
|
|
10902
|
+
});
|
|
10903
|
+
}
|
|
10904
|
+
}
|
|
10905
|
+
|
|
10906
|
+
if (output === input && opts.contains === true) {
|
|
10907
|
+
state.output = input;
|
|
10908
|
+
return state;
|
|
10909
|
+
}
|
|
10910
|
+
|
|
10911
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
10912
|
+
return state;
|
|
10913
|
+
}
|
|
11603
10914
|
|
|
11604
|
-
|
|
11605
|
-
|
|
10915
|
+
/**
|
|
10916
|
+
* Tokenize input until we reach end-of-string
|
|
10917
|
+
*/
|
|
10918
|
+
|
|
10919
|
+
while (!eos()) {
|
|
10920
|
+
value = advance();
|
|
10921
|
+
|
|
10922
|
+
if (value === '\u0000') {
|
|
10923
|
+
continue;
|
|
10924
|
+
}
|
|
10925
|
+
|
|
10926
|
+
/**
|
|
10927
|
+
* Escaped characters
|
|
10928
|
+
*/
|
|
10929
|
+
|
|
10930
|
+
if (value === '\\') {
|
|
10931
|
+
const next = peek();
|
|
10932
|
+
|
|
10933
|
+
if (next === '/' && opts.bash !== true) {
|
|
10934
|
+
continue;
|
|
10935
|
+
}
|
|
10936
|
+
|
|
10937
|
+
if (next === '.' || next === ';') {
|
|
10938
|
+
continue;
|
|
10939
|
+
}
|
|
10940
|
+
|
|
10941
|
+
if (!next) {
|
|
10942
|
+
value += '\\';
|
|
10943
|
+
push({ type: 'text', value });
|
|
10944
|
+
continue;
|
|
10945
|
+
}
|
|
10946
|
+
|
|
10947
|
+
// collapse slashes to reduce potential for exploits
|
|
10948
|
+
const match = /^\\+/.exec(remaining());
|
|
10949
|
+
let slashes = 0;
|
|
10950
|
+
|
|
10951
|
+
if (match && match[0].length > 2) {
|
|
10952
|
+
slashes = match[0].length;
|
|
10953
|
+
state.index += slashes;
|
|
10954
|
+
if (slashes % 2 !== 0) {
|
|
10955
|
+
value += '\\';
|
|
10956
|
+
}
|
|
10957
|
+
}
|
|
10958
|
+
|
|
10959
|
+
if (opts.unescape === true) {
|
|
10960
|
+
value = advance();
|
|
10961
|
+
} else {
|
|
10962
|
+
value += advance();
|
|
10963
|
+
}
|
|
10964
|
+
|
|
10965
|
+
if (state.brackets === 0) {
|
|
10966
|
+
push({ type: 'text', value });
|
|
10967
|
+
continue;
|
|
10968
|
+
}
|
|
10969
|
+
}
|
|
10970
|
+
|
|
10971
|
+
/**
|
|
10972
|
+
* If we're inside a regex character class, continue
|
|
10973
|
+
* until we reach the closing bracket.
|
|
10974
|
+
*/
|
|
10975
|
+
|
|
10976
|
+
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
|
10977
|
+
if (opts.posix !== false && value === ':') {
|
|
10978
|
+
const inner = prev.value.slice(1);
|
|
10979
|
+
if (inner.includes('[')) {
|
|
10980
|
+
prev.posix = true;
|
|
10981
|
+
|
|
10982
|
+
if (inner.includes(':')) {
|
|
10983
|
+
const idx = prev.value.lastIndexOf('[');
|
|
10984
|
+
const pre = prev.value.slice(0, idx);
|
|
10985
|
+
const rest = prev.value.slice(idx + 2);
|
|
10986
|
+
const posix = POSIX_REGEX_SOURCE[rest];
|
|
10987
|
+
if (posix) {
|
|
10988
|
+
prev.value = pre + posix;
|
|
10989
|
+
state.backtrack = true;
|
|
10990
|
+
advance();
|
|
10991
|
+
|
|
10992
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
10993
|
+
bos.output = ONE_CHAR;
|
|
10994
|
+
}
|
|
10995
|
+
continue;
|
|
10996
|
+
}
|
|
10997
|
+
}
|
|
10998
|
+
}
|
|
10999
|
+
}
|
|
11000
|
+
|
|
11001
|
+
if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
|
|
11002
|
+
value = `\\${value}`;
|
|
11003
|
+
}
|
|
11004
|
+
|
|
11005
|
+
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
|
|
11006
|
+
value = `\\${value}`;
|
|
11007
|
+
}
|
|
11008
|
+
|
|
11009
|
+
if (opts.posix === true && value === '!' && prev.value === '[') {
|
|
11010
|
+
value = '^';
|
|
11011
|
+
}
|
|
11012
|
+
|
|
11013
|
+
prev.value += value;
|
|
11014
|
+
append({ value });
|
|
11015
|
+
continue;
|
|
11016
|
+
}
|
|
11017
|
+
|
|
11018
|
+
/**
|
|
11019
|
+
* If we're inside a quoted string, continue
|
|
11020
|
+
* until we reach the closing double quote.
|
|
11021
|
+
*/
|
|
11022
|
+
|
|
11023
|
+
if (state.quotes === 1 && value !== '"') {
|
|
11024
|
+
value = utils.escapeRegex(value);
|
|
11025
|
+
prev.value += value;
|
|
11026
|
+
append({ value });
|
|
11027
|
+
continue;
|
|
11028
|
+
}
|
|
11029
|
+
|
|
11030
|
+
/**
|
|
11031
|
+
* Double quotes
|
|
11032
|
+
*/
|
|
11033
|
+
|
|
11034
|
+
if (value === '"') {
|
|
11035
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
11036
|
+
if (opts.keepQuotes === true) {
|
|
11037
|
+
push({ type: 'text', value });
|
|
11038
|
+
}
|
|
11039
|
+
continue;
|
|
11040
|
+
}
|
|
11041
|
+
|
|
11042
|
+
/**
|
|
11043
|
+
* Parentheses
|
|
11044
|
+
*/
|
|
11045
|
+
|
|
11046
|
+
if (value === '(') {
|
|
11047
|
+
increment('parens');
|
|
11048
|
+
push({ type: 'paren', value });
|
|
11049
|
+
continue;
|
|
11050
|
+
}
|
|
11051
|
+
|
|
11052
|
+
if (value === ')') {
|
|
11053
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
11054
|
+
throw new SyntaxError(syntaxError('opening', '('));
|
|
11055
|
+
}
|
|
11056
|
+
|
|
11057
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
11058
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
11059
|
+
extglobClose(extglobs.pop());
|
|
11060
|
+
continue;
|
|
11061
|
+
}
|
|
11062
|
+
|
|
11063
|
+
push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
|
|
11064
|
+
decrement('parens');
|
|
11065
|
+
continue;
|
|
11066
|
+
}
|
|
11067
|
+
|
|
11068
|
+
/**
|
|
11069
|
+
* Square brackets
|
|
11070
|
+
*/
|
|
11071
|
+
|
|
11072
|
+
if (value === '[') {
|
|
11073
|
+
if (opts.nobracket === true || !remaining().includes(']')) {
|
|
11074
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
11075
|
+
throw new SyntaxError(syntaxError('closing', ']'));
|
|
11076
|
+
}
|
|
11077
|
+
|
|
11078
|
+
value = `\\${value}`;
|
|
11079
|
+
} else {
|
|
11080
|
+
increment('brackets');
|
|
11081
|
+
}
|
|
11082
|
+
|
|
11083
|
+
push({ type: 'bracket', value });
|
|
11084
|
+
continue;
|
|
11085
|
+
}
|
|
11086
|
+
|
|
11087
|
+
if (value === ']') {
|
|
11088
|
+
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
|
11089
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
11090
|
+
continue;
|
|
11091
|
+
}
|
|
11092
|
+
|
|
11093
|
+
if (state.brackets === 0) {
|
|
11094
|
+
if (opts.strictBrackets === true) {
|
|
11095
|
+
throw new SyntaxError(syntaxError('opening', '['));
|
|
11096
|
+
}
|
|
11097
|
+
|
|
11098
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
11099
|
+
continue;
|
|
11100
|
+
}
|
|
11101
|
+
|
|
11102
|
+
decrement('brackets');
|
|
11103
|
+
|
|
11104
|
+
const prevValue = prev.value.slice(1);
|
|
11105
|
+
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
|
11106
|
+
value = `/${value}`;
|
|
11107
|
+
}
|
|
11108
|
+
|
|
11109
|
+
prev.value += value;
|
|
11110
|
+
append({ value });
|
|
11111
|
+
|
|
11112
|
+
// when literal brackets are explicitly disabled
|
|
11113
|
+
// assume we should match with a regex character class
|
|
11114
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
11115
|
+
continue;
|
|
11116
|
+
}
|
|
11117
|
+
|
|
11118
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
11119
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
11120
|
+
|
|
11121
|
+
// when literal brackets are explicitly enabled
|
|
11122
|
+
// assume we should escape the brackets to match literal characters
|
|
11123
|
+
if (opts.literalBrackets === true) {
|
|
11124
|
+
state.output += escaped;
|
|
11125
|
+
prev.value = escaped;
|
|
11126
|
+
continue;
|
|
11127
|
+
}
|
|
11128
|
+
|
|
11129
|
+
// when the user specifies nothing, try to match both
|
|
11130
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
11131
|
+
state.output += prev.value;
|
|
11132
|
+
continue;
|
|
11133
|
+
}
|
|
11134
|
+
|
|
11135
|
+
/**
|
|
11136
|
+
* Braces
|
|
11137
|
+
*/
|
|
11138
|
+
|
|
11139
|
+
if (value === '{' && opts.nobrace !== true) {
|
|
11140
|
+
increment('braces');
|
|
11141
|
+
|
|
11142
|
+
const open = {
|
|
11143
|
+
type: 'brace',
|
|
11144
|
+
value,
|
|
11145
|
+
output: '(',
|
|
11146
|
+
outputIndex: state.output.length,
|
|
11147
|
+
tokensIndex: state.tokens.length
|
|
11148
|
+
};
|
|
11149
|
+
|
|
11150
|
+
braces.push(open);
|
|
11151
|
+
push(open);
|
|
11152
|
+
continue;
|
|
11153
|
+
}
|
|
11154
|
+
|
|
11155
|
+
if (value === '}') {
|
|
11156
|
+
const brace = braces[braces.length - 1];
|
|
11157
|
+
|
|
11158
|
+
if (opts.nobrace === true || !brace) {
|
|
11159
|
+
push({ type: 'text', value, output: value });
|
|
11160
|
+
continue;
|
|
11161
|
+
}
|
|
11162
|
+
|
|
11163
|
+
let output = ')';
|
|
11164
|
+
|
|
11165
|
+
if (brace.dots === true) {
|
|
11166
|
+
const arr = tokens.slice();
|
|
11167
|
+
const range = [];
|
|
11168
|
+
|
|
11169
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
11170
|
+
tokens.pop();
|
|
11171
|
+
if (arr[i].type === 'brace') {
|
|
11172
|
+
break;
|
|
11173
|
+
}
|
|
11174
|
+
if (arr[i].type !== 'dots') {
|
|
11175
|
+
range.unshift(arr[i].value);
|
|
11176
|
+
}
|
|
11177
|
+
}
|
|
11178
|
+
|
|
11179
|
+
output = expandRange(range, opts);
|
|
11180
|
+
state.backtrack = true;
|
|
11181
|
+
}
|
|
11182
|
+
|
|
11183
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
11184
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
11185
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
11186
|
+
brace.value = brace.output = '\\{';
|
|
11187
|
+
value = output = '\\}';
|
|
11188
|
+
state.output = out;
|
|
11189
|
+
for (const t of toks) {
|
|
11190
|
+
state.output += (t.output || t.value);
|
|
11191
|
+
}
|
|
11192
|
+
}
|
|
11193
|
+
|
|
11194
|
+
push({ type: 'brace', value, output });
|
|
11195
|
+
decrement('braces');
|
|
11196
|
+
braces.pop();
|
|
11197
|
+
continue;
|
|
11198
|
+
}
|
|
11199
|
+
|
|
11200
|
+
/**
|
|
11201
|
+
* Pipes
|
|
11202
|
+
*/
|
|
11203
|
+
|
|
11204
|
+
if (value === '|') {
|
|
11205
|
+
if (extglobs.length > 0) {
|
|
11206
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
11207
|
+
}
|
|
11208
|
+
push({ type: 'text', value });
|
|
11209
|
+
continue;
|
|
11210
|
+
}
|
|
11211
|
+
|
|
11212
|
+
/**
|
|
11213
|
+
* Commas
|
|
11214
|
+
*/
|
|
11215
|
+
|
|
11216
|
+
if (value === ',') {
|
|
11217
|
+
let output = value;
|
|
11218
|
+
|
|
11219
|
+
const brace = braces[braces.length - 1];
|
|
11220
|
+
if (brace && stack[stack.length - 1] === 'braces') {
|
|
11221
|
+
brace.comma = true;
|
|
11222
|
+
output = '|';
|
|
11223
|
+
}
|
|
11224
|
+
|
|
11225
|
+
push({ type: 'comma', value, output });
|
|
11226
|
+
continue;
|
|
11227
|
+
}
|
|
11228
|
+
|
|
11229
|
+
/**
|
|
11230
|
+
* Slashes
|
|
11231
|
+
*/
|
|
11232
|
+
|
|
11233
|
+
if (value === '/') {
|
|
11234
|
+
// if the beginning of the glob is "./", advance the start
|
|
11235
|
+
// to the current index, and don't add the "./" characters
|
|
11236
|
+
// to the state. This greatly simplifies lookbehinds when
|
|
11237
|
+
// checking for BOS characters like "!" and "." (not "./")
|
|
11238
|
+
if (prev.type === 'dot' && state.index === state.start + 1) {
|
|
11239
|
+
state.start = state.index + 1;
|
|
11240
|
+
state.consumed = '';
|
|
11241
|
+
state.output = '';
|
|
11242
|
+
tokens.pop();
|
|
11243
|
+
prev = bos; // reset "prev" to the first token
|
|
11244
|
+
continue;
|
|
11245
|
+
}
|
|
11246
|
+
|
|
11247
|
+
push({ type: 'slash', value, output: SLASH_LITERAL });
|
|
11248
|
+
continue;
|
|
11249
|
+
}
|
|
11250
|
+
|
|
11251
|
+
/**
|
|
11252
|
+
* Dots
|
|
11253
|
+
*/
|
|
11254
|
+
|
|
11255
|
+
if (value === '.') {
|
|
11256
|
+
if (state.braces > 0 && prev.type === 'dot') {
|
|
11257
|
+
if (prev.value === '.') prev.output = DOT_LITERAL;
|
|
11258
|
+
const brace = braces[braces.length - 1];
|
|
11259
|
+
prev.type = 'dots';
|
|
11260
|
+
prev.output += value;
|
|
11261
|
+
prev.value += value;
|
|
11262
|
+
brace.dots = true;
|
|
11263
|
+
continue;
|
|
11264
|
+
}
|
|
11265
|
+
|
|
11266
|
+
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
|
11267
|
+
push({ type: 'text', value, output: DOT_LITERAL });
|
|
11268
|
+
continue;
|
|
11269
|
+
}
|
|
11270
|
+
|
|
11271
|
+
push({ type: 'dot', value, output: DOT_LITERAL });
|
|
11272
|
+
continue;
|
|
11273
|
+
}
|
|
11274
|
+
|
|
11275
|
+
/**
|
|
11276
|
+
* Question marks
|
|
11277
|
+
*/
|
|
11278
|
+
|
|
11279
|
+
if (value === '?') {
|
|
11280
|
+
const isGroup = prev && prev.value === '(';
|
|
11281
|
+
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
11282
|
+
extglobOpen('qmark', value);
|
|
11283
|
+
continue;
|
|
11284
|
+
}
|
|
11285
|
+
|
|
11286
|
+
if (prev && prev.type === 'paren') {
|
|
11287
|
+
const next = peek();
|
|
11288
|
+
let output = value;
|
|
11289
|
+
|
|
11290
|
+
if (next === '<' && !utils.supportsLookbehinds()) {
|
|
11291
|
+
throw new Error('Node.js v10 or higher is required for regex lookbehinds');
|
|
11292
|
+
}
|
|
11293
|
+
|
|
11294
|
+
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
|
|
11295
|
+
output = `\\${value}`;
|
|
11296
|
+
}
|
|
11297
|
+
|
|
11298
|
+
push({ type: 'text', value, output });
|
|
11299
|
+
continue;
|
|
11300
|
+
}
|
|
11301
|
+
|
|
11302
|
+
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
|
|
11303
|
+
push({ type: 'qmark', value, output: QMARK_NO_DOT });
|
|
11304
|
+
continue;
|
|
11305
|
+
}
|
|
11306
|
+
|
|
11307
|
+
push({ type: 'qmark', value, output: QMARK });
|
|
11308
|
+
continue;
|
|
11309
|
+
}
|
|
11310
|
+
|
|
11311
|
+
/**
|
|
11312
|
+
* Exclamation
|
|
11313
|
+
*/
|
|
11314
|
+
|
|
11315
|
+
if (value === '!') {
|
|
11316
|
+
if (opts.noextglob !== true && peek() === '(') {
|
|
11317
|
+
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
|
|
11318
|
+
extglobOpen('negate', value);
|
|
11319
|
+
continue;
|
|
11320
|
+
}
|
|
11321
|
+
}
|
|
11322
|
+
|
|
11323
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
11324
|
+
negate();
|
|
11325
|
+
continue;
|
|
11326
|
+
}
|
|
11327
|
+
}
|
|
11328
|
+
|
|
11329
|
+
/**
|
|
11330
|
+
* Plus
|
|
11331
|
+
*/
|
|
11332
|
+
|
|
11333
|
+
if (value === '+') {
|
|
11334
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
11335
|
+
extglobOpen('plus', value);
|
|
11336
|
+
continue;
|
|
11337
|
+
}
|
|
11338
|
+
|
|
11339
|
+
if ((prev && prev.value === '(') || opts.regex === false) {
|
|
11340
|
+
push({ type: 'plus', value, output: PLUS_LITERAL });
|
|
11341
|
+
continue;
|
|
11342
|
+
}
|
|
11343
|
+
|
|
11344
|
+
if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
|
|
11345
|
+
push({ type: 'plus', value });
|
|
11346
|
+
continue;
|
|
11347
|
+
}
|
|
11348
|
+
|
|
11349
|
+
push({ type: 'plus', value: PLUS_LITERAL });
|
|
11350
|
+
continue;
|
|
11351
|
+
}
|
|
11352
|
+
|
|
11353
|
+
/**
|
|
11354
|
+
* Plain text
|
|
11355
|
+
*/
|
|
11356
|
+
|
|
11357
|
+
if (value === '@') {
|
|
11358
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
11359
|
+
push({ type: 'at', extglob: true, value, output: '' });
|
|
11360
|
+
continue;
|
|
11361
|
+
}
|
|
11362
|
+
|
|
11363
|
+
push({ type: 'text', value });
|
|
11364
|
+
continue;
|
|
11365
|
+
}
|
|
11366
|
+
|
|
11367
|
+
/**
|
|
11368
|
+
* Plain text
|
|
11369
|
+
*/
|
|
11370
|
+
|
|
11371
|
+
if (value !== '*') {
|
|
11372
|
+
if (value === '$' || value === '^') {
|
|
11373
|
+
value = `\\${value}`;
|
|
11374
|
+
}
|
|
11375
|
+
|
|
11376
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
11377
|
+
if (match) {
|
|
11378
|
+
value += match[0];
|
|
11379
|
+
state.index += match[0].length;
|
|
11380
|
+
}
|
|
11381
|
+
|
|
11382
|
+
push({ type: 'text', value });
|
|
11383
|
+
continue;
|
|
11384
|
+
}
|
|
11385
|
+
|
|
11386
|
+
/**
|
|
11387
|
+
* Stars
|
|
11388
|
+
*/
|
|
11389
|
+
|
|
11390
|
+
if (prev && (prev.type === 'globstar' || prev.star === true)) {
|
|
11391
|
+
prev.type = 'star';
|
|
11392
|
+
prev.star = true;
|
|
11393
|
+
prev.value += value;
|
|
11394
|
+
prev.output = star;
|
|
11395
|
+
state.backtrack = true;
|
|
11396
|
+
state.globstar = true;
|
|
11397
|
+
consume(value);
|
|
11398
|
+
continue;
|
|
11399
|
+
}
|
|
11400
|
+
|
|
11401
|
+
let rest = remaining();
|
|
11402
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
11403
|
+
extglobOpen('star', value);
|
|
11404
|
+
continue;
|
|
11405
|
+
}
|
|
11406
|
+
|
|
11407
|
+
if (prev.type === 'star') {
|
|
11408
|
+
if (opts.noglobstar === true) {
|
|
11409
|
+
consume(value);
|
|
11410
|
+
continue;
|
|
11411
|
+
}
|
|
11412
|
+
|
|
11413
|
+
const prior = prev.prev;
|
|
11414
|
+
const before = prior.prev;
|
|
11415
|
+
const isStart = prior.type === 'slash' || prior.type === 'bos';
|
|
11416
|
+
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
|
|
11417
|
+
|
|
11418
|
+
if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
|
|
11419
|
+
push({ type: 'star', value, output: '' });
|
|
11420
|
+
continue;
|
|
11421
|
+
}
|
|
11422
|
+
|
|
11423
|
+
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
|
|
11424
|
+
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
|
|
11425
|
+
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
|
|
11426
|
+
push({ type: 'star', value, output: '' });
|
|
11427
|
+
continue;
|
|
11428
|
+
}
|
|
11429
|
+
|
|
11430
|
+
// strip consecutive `/**/`
|
|
11431
|
+
while (rest.slice(0, 3) === '/**') {
|
|
11432
|
+
const after = input[state.index + 4];
|
|
11433
|
+
if (after && after !== '/') {
|
|
11434
|
+
break;
|
|
11435
|
+
}
|
|
11436
|
+
rest = rest.slice(3);
|
|
11437
|
+
consume('/**', 3);
|
|
11438
|
+
}
|
|
11439
|
+
|
|
11440
|
+
if (prior.type === 'bos' && eos()) {
|
|
11441
|
+
prev.type = 'globstar';
|
|
11442
|
+
prev.value += value;
|
|
11443
|
+
prev.output = globstar(opts);
|
|
11444
|
+
state.output = prev.output;
|
|
11445
|
+
state.globstar = true;
|
|
11446
|
+
consume(value);
|
|
11447
|
+
continue;
|
|
11448
|
+
}
|
|
11449
|
+
|
|
11450
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
|
|
11451
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
11452
|
+
prior.output = `(?:${prior.output}`;
|
|
11453
|
+
|
|
11454
|
+
prev.type = 'globstar';
|
|
11455
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
11456
|
+
prev.value += value;
|
|
11457
|
+
state.globstar = true;
|
|
11458
|
+
state.output += prior.output + prev.output;
|
|
11459
|
+
consume(value);
|
|
11460
|
+
continue;
|
|
11461
|
+
}
|
|
11462
|
+
|
|
11463
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
|
11464
|
+
const end = rest[1] !== void 0 ? '|$' : '';
|
|
11465
|
+
|
|
11466
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
11467
|
+
prior.output = `(?:${prior.output}`;
|
|
11468
|
+
|
|
11469
|
+
prev.type = 'globstar';
|
|
11470
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
11471
|
+
prev.value += value;
|
|
11472
|
+
|
|
11473
|
+
state.output += prior.output + prev.output;
|
|
11474
|
+
state.globstar = true;
|
|
11475
|
+
|
|
11476
|
+
consume(value + advance());
|
|
11477
|
+
|
|
11478
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
11479
|
+
continue;
|
|
11480
|
+
}
|
|
11481
|
+
|
|
11482
|
+
if (prior.type === 'bos' && rest[0] === '/') {
|
|
11483
|
+
prev.type = 'globstar';
|
|
11484
|
+
prev.value += value;
|
|
11485
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
11486
|
+
state.output = prev.output;
|
|
11487
|
+
state.globstar = true;
|
|
11488
|
+
consume(value + advance());
|
|
11489
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
11490
|
+
continue;
|
|
11491
|
+
}
|
|
11492
|
+
|
|
11493
|
+
// remove single star from output
|
|
11494
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
11495
|
+
|
|
11496
|
+
// reset previous token to globstar
|
|
11497
|
+
prev.type = 'globstar';
|
|
11498
|
+
prev.output = globstar(opts);
|
|
11499
|
+
prev.value += value;
|
|
11500
|
+
|
|
11501
|
+
// reset output with globstar
|
|
11502
|
+
state.output += prev.output;
|
|
11503
|
+
state.globstar = true;
|
|
11504
|
+
consume(value);
|
|
11505
|
+
continue;
|
|
11506
|
+
}
|
|
11507
|
+
|
|
11508
|
+
const token = { type: 'star', value, output: star };
|
|
11509
|
+
|
|
11510
|
+
if (opts.bash === true) {
|
|
11511
|
+
token.output = '.*?';
|
|
11512
|
+
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
11513
|
+
token.output = nodot + token.output;
|
|
11514
|
+
}
|
|
11515
|
+
push(token);
|
|
11516
|
+
continue;
|
|
11517
|
+
}
|
|
11518
|
+
|
|
11519
|
+
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
11520
|
+
token.output = value;
|
|
11521
|
+
push(token);
|
|
11522
|
+
continue;
|
|
11523
|
+
}
|
|
11524
|
+
|
|
11525
|
+
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
11526
|
+
if (prev.type === 'dot') {
|
|
11527
|
+
state.output += NO_DOT_SLASH;
|
|
11528
|
+
prev.output += NO_DOT_SLASH;
|
|
11529
|
+
|
|
11530
|
+
} else if (opts.dot === true) {
|
|
11531
|
+
state.output += NO_DOTS_SLASH;
|
|
11532
|
+
prev.output += NO_DOTS_SLASH;
|
|
11533
|
+
|
|
11534
|
+
} else {
|
|
11535
|
+
state.output += nodot;
|
|
11536
|
+
prev.output += nodot;
|
|
11537
|
+
}
|
|
11538
|
+
|
|
11539
|
+
if (peek() !== '*') {
|
|
11540
|
+
state.output += ONE_CHAR;
|
|
11541
|
+
prev.output += ONE_CHAR;
|
|
11542
|
+
}
|
|
11543
|
+
}
|
|
11544
|
+
|
|
11545
|
+
push(token);
|
|
11546
|
+
}
|
|
11606
11547
|
|
|
11607
|
-
|
|
11608
|
-
|
|
11548
|
+
while (state.brackets > 0) {
|
|
11549
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
|
11550
|
+
state.output = utils.escapeLast(state.output, '[');
|
|
11551
|
+
decrement('brackets');
|
|
11552
|
+
}
|
|
11609
11553
|
|
|
11610
|
-
|
|
11611
|
-
|
|
11554
|
+
while (state.parens > 0) {
|
|
11555
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
|
11556
|
+
state.output = utils.escapeLast(state.output, '(');
|
|
11557
|
+
decrement('parens');
|
|
11558
|
+
}
|
|
11612
11559
|
|
|
11613
|
-
|
|
11614
|
-
|
|
11560
|
+
while (state.braces > 0) {
|
|
11561
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
|
11562
|
+
state.output = utils.escapeLast(state.output, '{');
|
|
11563
|
+
decrement('braces');
|
|
11564
|
+
}
|
|
11615
11565
|
|
|
11616
|
-
|
|
11617
|
-
|
|
11566
|
+
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
|
11567
|
+
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
11568
|
+
}
|
|
11618
11569
|
|
|
11619
|
-
|
|
11620
|
-
|
|
11570
|
+
// rebuild the output if we had to backtrack at any point
|
|
11571
|
+
if (state.backtrack === true) {
|
|
11572
|
+
state.output = '';
|
|
11621
11573
|
|
|
11622
|
-
|
|
11623
|
-
|
|
11574
|
+
for (const token of state.tokens) {
|
|
11575
|
+
state.output += token.output != null ? token.output : token.value;
|
|
11624
11576
|
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11577
|
+
if (token.suffix) {
|
|
11578
|
+
state.output += token.suffix;
|
|
11579
|
+
}
|
|
11580
|
+
}
|
|
11581
|
+
}
|
|
11628
11582
|
|
|
11629
|
-
|
|
11630
|
-
|
|
11583
|
+
return state;
|
|
11584
|
+
};
|
|
11631
11585
|
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11586
|
+
/**
|
|
11587
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
11588
|
+
* This can significantly speed up processing and has very little downside
|
|
11589
|
+
* impact when none of the fast paths match.
|
|
11590
|
+
*/
|
|
11591
|
+
|
|
11592
|
+
parse.fastpaths = (input, options) => {
|
|
11593
|
+
const opts = { ...options };
|
|
11594
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
11595
|
+
const len = input.length;
|
|
11596
|
+
if (len > max) {
|
|
11597
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
11598
|
+
}
|
|
11636
11599
|
|
|
11637
|
-
|
|
11638
|
-
|
|
11600
|
+
input = REPLACEMENTS[input] || input;
|
|
11601
|
+
const win32 = utils.isWindows(options);
|
|
11602
|
+
|
|
11603
|
+
// create constants based on platform, for windows or posix
|
|
11604
|
+
const {
|
|
11605
|
+
DOT_LITERAL,
|
|
11606
|
+
SLASH_LITERAL,
|
|
11607
|
+
ONE_CHAR,
|
|
11608
|
+
DOTS_SLASH,
|
|
11609
|
+
NO_DOT,
|
|
11610
|
+
NO_DOTS,
|
|
11611
|
+
NO_DOTS_SLASH,
|
|
11612
|
+
STAR,
|
|
11613
|
+
START_ANCHOR
|
|
11614
|
+
} = constants.globChars(win32);
|
|
11615
|
+
|
|
11616
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
11617
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
11618
|
+
const capture = opts.capture ? '' : '?:';
|
|
11619
|
+
const state = { negated: false, prefix: '' };
|
|
11620
|
+
let star = opts.bash === true ? '.*?' : STAR;
|
|
11621
|
+
|
|
11622
|
+
if (opts.capture) {
|
|
11623
|
+
star = `(${star})`;
|
|
11624
|
+
}
|
|
11639
11625
|
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11626
|
+
const globstar = opts => {
|
|
11627
|
+
if (opts.noglobstar === true) return star;
|
|
11628
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
11629
|
+
};
|
|
11643
11630
|
|
|
11644
|
-
|
|
11645
|
-
|
|
11631
|
+
const create = str => {
|
|
11632
|
+
switch (str) {
|
|
11633
|
+
case '*':
|
|
11634
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
11646
11635
|
|
|
11647
|
-
|
|
11636
|
+
case '.*':
|
|
11637
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
11648
11638
|
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
const parse = parse_1;
|
|
11652
|
-
const utils = utils$3;
|
|
11653
|
-
const constants = constants$2;
|
|
11654
|
-
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
11639
|
+
case '*.*':
|
|
11640
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
11655
11641
|
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
* returned function takes a string to match as its first argument,
|
|
11659
|
-
* and returns true if the string is a match. The returned matcher
|
|
11660
|
-
* function also takes a boolean as the second argument that, when true,
|
|
11661
|
-
* returns an object with additional information.
|
|
11662
|
-
*
|
|
11663
|
-
* ```js
|
|
11664
|
-
* const picomatch = require('picomatch');
|
|
11665
|
-
* // picomatch(glob[, options]);
|
|
11666
|
-
*
|
|
11667
|
-
* const isMatch = picomatch('*.!(*a)');
|
|
11668
|
-
* console.log(isMatch('a.a')); //=> false
|
|
11669
|
-
* console.log(isMatch('a.b')); //=> true
|
|
11670
|
-
* ```
|
|
11671
|
-
* @name picomatch
|
|
11672
|
-
* @param {String|Array} `globs` One or more glob patterns.
|
|
11673
|
-
* @param {Object=} `options`
|
|
11674
|
-
* @return {Function=} Returns a matcher function.
|
|
11675
|
-
* @api public
|
|
11676
|
-
*/
|
|
11642
|
+
case '*/*':
|
|
11643
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
11677
11644
|
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
const fns = glob.map(input => picomatch$1(input, options, returnState));
|
|
11681
|
-
const arrayMatcher = str => {
|
|
11682
|
-
for (const isMatch of fns) {
|
|
11683
|
-
const state = isMatch(str);
|
|
11684
|
-
if (state) return state;
|
|
11685
|
-
}
|
|
11686
|
-
return false;
|
|
11687
|
-
};
|
|
11688
|
-
return arrayMatcher;
|
|
11689
|
-
}
|
|
11645
|
+
case '**':
|
|
11646
|
+
return nodot + globstar(opts);
|
|
11690
11647
|
|
|
11691
|
-
|
|
11648
|
+
case '**/*':
|
|
11649
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
11692
11650
|
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
}
|
|
11651
|
+
case '**/*.*':
|
|
11652
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
11696
11653
|
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
const regex = isState
|
|
11700
|
-
? picomatch$1.compileRe(glob, options)
|
|
11701
|
-
: picomatch$1.makeRe(glob, options, false, true);
|
|
11654
|
+
case '**/.*':
|
|
11655
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
11702
11656
|
|
|
11703
|
-
|
|
11704
|
-
|
|
11657
|
+
default: {
|
|
11658
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
11659
|
+
if (!match) return;
|
|
11705
11660
|
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
11709
|
-
isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
|
|
11710
|
-
}
|
|
11661
|
+
const source = create(match[1]);
|
|
11662
|
+
if (!source) return;
|
|
11711
11663
|
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11664
|
+
return source + DOT_LITERAL + match[2];
|
|
11665
|
+
}
|
|
11666
|
+
}
|
|
11667
|
+
};
|
|
11715
11668
|
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
}
|
|
11669
|
+
const output = utils.removePrefix(input, state);
|
|
11670
|
+
let source = create(output);
|
|
11719
11671
|
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
}
|
|
11672
|
+
if (source && opts.strictSlashes !== true) {
|
|
11673
|
+
source += `${SLASH_LITERAL}?`;
|
|
11674
|
+
}
|
|
11724
11675
|
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
opts.onIgnore(result);
|
|
11728
|
-
}
|
|
11729
|
-
result.isMatch = false;
|
|
11730
|
-
return returnObject ? result : false;
|
|
11731
|
-
}
|
|
11676
|
+
return source;
|
|
11677
|
+
};
|
|
11732
11678
|
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
return returnObject ? result : true;
|
|
11737
|
-
};
|
|
11679
|
+
parse_1 = parse;
|
|
11680
|
+
return parse_1;
|
|
11681
|
+
}
|
|
11738
11682
|
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
}
|
|
11683
|
+
var picomatch_1;
|
|
11684
|
+
var hasRequiredPicomatch$1;
|
|
11742
11685
|
|
|
11743
|
-
|
|
11744
|
-
|
|
11686
|
+
function requirePicomatch$1 () {
|
|
11687
|
+
if (hasRequiredPicomatch$1) return picomatch_1;
|
|
11688
|
+
hasRequiredPicomatch$1 = 1;
|
|
11745
11689
|
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11690
|
+
const path = require$$0;
|
|
11691
|
+
const scan = /*@__PURE__*/ requireScan();
|
|
11692
|
+
const parse = /*@__PURE__*/ requireParse();
|
|
11693
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
11694
|
+
const constants = /*@__PURE__*/ requireConstants();
|
|
11695
|
+
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
11696
|
+
|
|
11697
|
+
/**
|
|
11698
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
11699
|
+
* returned function takes a string to match as its first argument,
|
|
11700
|
+
* and returns true if the string is a match. The returned matcher
|
|
11701
|
+
* function also takes a boolean as the second argument that, when true,
|
|
11702
|
+
* returns an object with additional information.
|
|
11703
|
+
*
|
|
11704
|
+
* ```js
|
|
11705
|
+
* const picomatch = require('picomatch');
|
|
11706
|
+
* // picomatch(glob[, options]);
|
|
11707
|
+
*
|
|
11708
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
11709
|
+
* console.log(isMatch('a.a')); //=> false
|
|
11710
|
+
* console.log(isMatch('a.b')); //=> true
|
|
11711
|
+
* ```
|
|
11712
|
+
* @name picomatch
|
|
11713
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
11714
|
+
* @param {Object=} `options`
|
|
11715
|
+
* @return {Function=} Returns a matcher function.
|
|
11716
|
+
* @api public
|
|
11717
|
+
*/
|
|
11718
|
+
|
|
11719
|
+
const picomatch = (glob, options, returnState = false) => {
|
|
11720
|
+
if (Array.isArray(glob)) {
|
|
11721
|
+
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
11722
|
+
const arrayMatcher = str => {
|
|
11723
|
+
for (const isMatch of fns) {
|
|
11724
|
+
const state = isMatch(str);
|
|
11725
|
+
if (state) return state;
|
|
11726
|
+
}
|
|
11727
|
+
return false;
|
|
11728
|
+
};
|
|
11729
|
+
return arrayMatcher;
|
|
11730
|
+
}
|
|
11762
11731
|
|
|
11763
|
-
|
|
11764
|
-
if (typeof input !== 'string') {
|
|
11765
|
-
throw new TypeError('Expected input to be a string');
|
|
11766
|
-
}
|
|
11732
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
11767
11733
|
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11734
|
+
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
11735
|
+
throw new TypeError('Expected pattern to be a non-empty string');
|
|
11736
|
+
}
|
|
11771
11737
|
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11738
|
+
const opts = options || {};
|
|
11739
|
+
const posix = utils.isWindows(options);
|
|
11740
|
+
const regex = isState
|
|
11741
|
+
? picomatch.compileRe(glob, options)
|
|
11742
|
+
: picomatch.makeRe(glob, options, false, true);
|
|
11776
11743
|
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
match = output === glob;
|
|
11780
|
-
}
|
|
11744
|
+
const state = regex.state;
|
|
11745
|
+
delete regex.state;
|
|
11781
11746
|
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
}
|
|
11788
|
-
}
|
|
11747
|
+
let isIgnored = () => false;
|
|
11748
|
+
if (opts.ignore) {
|
|
11749
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
11750
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
11751
|
+
}
|
|
11789
11752
|
|
|
11790
|
-
|
|
11791
|
-
};
|
|
11753
|
+
const matcher = (input, returnObject = false) => {
|
|
11754
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
11755
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
11756
|
+
|
|
11757
|
+
if (typeof opts.onResult === 'function') {
|
|
11758
|
+
opts.onResult(result);
|
|
11759
|
+
}
|
|
11760
|
+
|
|
11761
|
+
if (isMatch === false) {
|
|
11762
|
+
result.isMatch = false;
|
|
11763
|
+
return returnObject ? result : false;
|
|
11764
|
+
}
|
|
11765
|
+
|
|
11766
|
+
if (isIgnored(input)) {
|
|
11767
|
+
if (typeof opts.onIgnore === 'function') {
|
|
11768
|
+
opts.onIgnore(result);
|
|
11769
|
+
}
|
|
11770
|
+
result.isMatch = false;
|
|
11771
|
+
return returnObject ? result : false;
|
|
11772
|
+
}
|
|
11773
|
+
|
|
11774
|
+
if (typeof opts.onMatch === 'function') {
|
|
11775
|
+
opts.onMatch(result);
|
|
11776
|
+
}
|
|
11777
|
+
return returnObject ? result : true;
|
|
11778
|
+
};
|
|
11779
|
+
|
|
11780
|
+
if (returnState) {
|
|
11781
|
+
matcher.state = state;
|
|
11782
|
+
}
|
|
11792
11783
|
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
*
|
|
11796
|
-
* ```js
|
|
11797
|
-
* const picomatch = require('picomatch');
|
|
11798
|
-
* // picomatch.matchBase(input, glob[, options]);
|
|
11799
|
-
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
11800
|
-
* ```
|
|
11801
|
-
* @param {String} `input` String to test.
|
|
11802
|
-
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
11803
|
-
* @return {Boolean}
|
|
11804
|
-
* @api public
|
|
11805
|
-
*/
|
|
11784
|
+
return matcher;
|
|
11785
|
+
};
|
|
11806
11786
|
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11787
|
+
/**
|
|
11788
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
11789
|
+
* `picomatch()` function to test the input string.
|
|
11790
|
+
*
|
|
11791
|
+
* ```js
|
|
11792
|
+
* const picomatch = require('picomatch');
|
|
11793
|
+
* // picomatch.test(input, regex[, options]);
|
|
11794
|
+
*
|
|
11795
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
11796
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
11797
|
+
* ```
|
|
11798
|
+
* @param {String} `input` String to test.
|
|
11799
|
+
* @param {RegExp} `regex`
|
|
11800
|
+
* @return {Object} Returns an object with matching info.
|
|
11801
|
+
* @api public
|
|
11802
|
+
*/
|
|
11803
|
+
|
|
11804
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
11805
|
+
if (typeof input !== 'string') {
|
|
11806
|
+
throw new TypeError('Expected input to be a string');
|
|
11807
|
+
}
|
|
11811
11808
|
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
* ```js
|
|
11816
|
-
* const picomatch = require('picomatch');
|
|
11817
|
-
* // picomatch.isMatch(string, patterns[, options]);
|
|
11818
|
-
*
|
|
11819
|
-
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
11820
|
-
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
11821
|
-
* ```
|
|
11822
|
-
* @param {String|Array} str The string to test.
|
|
11823
|
-
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
11824
|
-
* @param {Object} [options] See available [options](#options).
|
|
11825
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
|
11826
|
-
* @api public
|
|
11827
|
-
*/
|
|
11809
|
+
if (input === '') {
|
|
11810
|
+
return { isMatch: false, output: '' };
|
|
11811
|
+
}
|
|
11828
11812
|
|
|
11829
|
-
|
|
11813
|
+
const opts = options || {};
|
|
11814
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
11815
|
+
let match = input === glob;
|
|
11816
|
+
let output = (match && format) ? format(input) : input;
|
|
11830
11817
|
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
* ```js
|
|
11836
|
-
* const picomatch = require('picomatch');
|
|
11837
|
-
* const result = picomatch.parse(pattern[, options]);
|
|
11838
|
-
* ```
|
|
11839
|
-
* @param {String} `pattern`
|
|
11840
|
-
* @param {Object} `options`
|
|
11841
|
-
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
11842
|
-
* @api public
|
|
11843
|
-
*/
|
|
11818
|
+
if (match === false) {
|
|
11819
|
+
output = format ? format(input) : input;
|
|
11820
|
+
match = output === glob;
|
|
11821
|
+
}
|
|
11844
11822
|
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
}
|
|
11823
|
+
if (match === false || opts.capture === true) {
|
|
11824
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
11825
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
11826
|
+
} else {
|
|
11827
|
+
match = regex.exec(output);
|
|
11828
|
+
}
|
|
11829
|
+
}
|
|
11849
11830
|
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
*
|
|
11853
|
-
* ```js
|
|
11854
|
-
* const picomatch = require('picomatch');
|
|
11855
|
-
* // picomatch.scan(input[, options]);
|
|
11856
|
-
*
|
|
11857
|
-
* const result = picomatch.scan('!./foo/*.js');
|
|
11858
|
-
* console.log(result);
|
|
11859
|
-
* { prefix: '!./',
|
|
11860
|
-
* input: '!./foo/*.js',
|
|
11861
|
-
* start: 3,
|
|
11862
|
-
* base: 'foo',
|
|
11863
|
-
* glob: '*.js',
|
|
11864
|
-
* isBrace: false,
|
|
11865
|
-
* isBracket: false,
|
|
11866
|
-
* isGlob: true,
|
|
11867
|
-
* isExtglob: false,
|
|
11868
|
-
* isGlobstar: false,
|
|
11869
|
-
* negated: true }
|
|
11870
|
-
* ```
|
|
11871
|
-
* @param {String} `input` Glob pattern to scan.
|
|
11872
|
-
* @param {Object} `options`
|
|
11873
|
-
* @return {Object} Returns an object with
|
|
11874
|
-
* @api public
|
|
11875
|
-
*/
|
|
11831
|
+
return { isMatch: Boolean(match), match, output };
|
|
11832
|
+
};
|
|
11876
11833
|
|
|
11877
|
-
|
|
11834
|
+
/**
|
|
11835
|
+
* Match the basename of a filepath.
|
|
11836
|
+
*
|
|
11837
|
+
* ```js
|
|
11838
|
+
* const picomatch = require('picomatch');
|
|
11839
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
11840
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
11841
|
+
* ```
|
|
11842
|
+
* @param {String} `input` String to test.
|
|
11843
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
11844
|
+
* @return {Boolean}
|
|
11845
|
+
* @api public
|
|
11846
|
+
*/
|
|
11847
|
+
|
|
11848
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
11849
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
11850
|
+
return regex.test(path.basename(input));
|
|
11851
|
+
};
|
|
11878
11852
|
|
|
11879
|
-
/**
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11853
|
+
/**
|
|
11854
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
11855
|
+
*
|
|
11856
|
+
* ```js
|
|
11857
|
+
* const picomatch = require('picomatch');
|
|
11858
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
11859
|
+
*
|
|
11860
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
11861
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
11862
|
+
* ```
|
|
11863
|
+
* @param {String|Array} str The string to test.
|
|
11864
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
11865
|
+
* @param {Object} [options] See available [options](#options).
|
|
11866
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
11867
|
+
* @api public
|
|
11868
|
+
*/
|
|
11869
|
+
|
|
11870
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
11871
|
+
|
|
11872
|
+
/**
|
|
11873
|
+
* Parse a glob pattern to create the source string for a regular
|
|
11874
|
+
* expression.
|
|
11875
|
+
*
|
|
11876
|
+
* ```js
|
|
11877
|
+
* const picomatch = require('picomatch');
|
|
11878
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
11879
|
+
* ```
|
|
11880
|
+
* @param {String} `pattern`
|
|
11881
|
+
* @param {Object} `options`
|
|
11882
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
11883
|
+
* @api public
|
|
11884
|
+
*/
|
|
11885
|
+
|
|
11886
|
+
picomatch.parse = (pattern, options) => {
|
|
11887
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
|
11888
|
+
return parse(pattern, { ...options, fastpaths: false });
|
|
11889
|
+
};
|
|
11890
11890
|
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11891
|
+
/**
|
|
11892
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
11893
|
+
*
|
|
11894
|
+
* ```js
|
|
11895
|
+
* const picomatch = require('picomatch');
|
|
11896
|
+
* // picomatch.scan(input[, options]);
|
|
11897
|
+
*
|
|
11898
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
11899
|
+
* console.log(result);
|
|
11900
|
+
* { prefix: '!./',
|
|
11901
|
+
* input: '!./foo/*.js',
|
|
11902
|
+
* start: 3,
|
|
11903
|
+
* base: 'foo',
|
|
11904
|
+
* glob: '*.js',
|
|
11905
|
+
* isBrace: false,
|
|
11906
|
+
* isBracket: false,
|
|
11907
|
+
* isGlob: true,
|
|
11908
|
+
* isExtglob: false,
|
|
11909
|
+
* isGlobstar: false,
|
|
11910
|
+
* negated: true }
|
|
11911
|
+
* ```
|
|
11912
|
+
* @param {String} `input` Glob pattern to scan.
|
|
11913
|
+
* @param {Object} `options`
|
|
11914
|
+
* @return {Object} Returns an object with
|
|
11915
|
+
* @api public
|
|
11916
|
+
*/
|
|
11917
|
+
|
|
11918
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
11919
|
+
|
|
11920
|
+
/**
|
|
11921
|
+
* Compile a regular expression from the `state` object returned by the
|
|
11922
|
+
* [parse()](#parse) method.
|
|
11923
|
+
*
|
|
11924
|
+
* @param {Object} `state`
|
|
11925
|
+
* @param {Object} `options`
|
|
11926
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
11927
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
11928
|
+
* @return {RegExp}
|
|
11929
|
+
* @api public
|
|
11930
|
+
*/
|
|
11931
|
+
|
|
11932
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
11933
|
+
if (returnOutput === true) {
|
|
11934
|
+
return state.output;
|
|
11935
|
+
}
|
|
11895
11936
|
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11937
|
+
const opts = options || {};
|
|
11938
|
+
const prepend = opts.contains ? '' : '^';
|
|
11939
|
+
const append = opts.contains ? '' : '$';
|
|
11899
11940
|
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11941
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
11942
|
+
if (state && state.negated === true) {
|
|
11943
|
+
source = `^(?!${source}).*$`;
|
|
11944
|
+
}
|
|
11904
11945
|
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11946
|
+
const regex = picomatch.toRegex(source, options);
|
|
11947
|
+
if (returnState === true) {
|
|
11948
|
+
regex.state = state;
|
|
11949
|
+
}
|
|
11909
11950
|
|
|
11910
|
-
|
|
11911
|
-
};
|
|
11951
|
+
return regex;
|
|
11952
|
+
};
|
|
11912
11953
|
|
|
11913
|
-
/**
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11954
|
+
/**
|
|
11955
|
+
* Create a regular expression from a parsed glob pattern.
|
|
11956
|
+
*
|
|
11957
|
+
* ```js
|
|
11958
|
+
* const picomatch = require('picomatch');
|
|
11959
|
+
* const state = picomatch.parse('*.js');
|
|
11960
|
+
* // picomatch.compileRe(state[, options]);
|
|
11961
|
+
*
|
|
11962
|
+
* console.log(picomatch.compileRe(state));
|
|
11963
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
11964
|
+
* ```
|
|
11965
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
11966
|
+
* @param {Object} `options`
|
|
11967
|
+
* @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.
|
|
11968
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
11969
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
11970
|
+
* @api public
|
|
11971
|
+
*/
|
|
11972
|
+
|
|
11973
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
11974
|
+
if (!input || typeof input !== 'string') {
|
|
11975
|
+
throw new TypeError('Expected a non-empty string');
|
|
11976
|
+
}
|
|
11931
11977
|
|
|
11932
|
-
|
|
11933
|
-
if (!input || typeof input !== 'string') {
|
|
11934
|
-
throw new TypeError('Expected a non-empty string');
|
|
11935
|
-
}
|
|
11978
|
+
let parsed = { negated: false, fastpaths: true };
|
|
11936
11979
|
|
|
11937
|
-
|
|
11980
|
+
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
11981
|
+
parsed.output = parse.fastpaths(input, options);
|
|
11982
|
+
}
|
|
11938
11983
|
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11984
|
+
if (!parsed.output) {
|
|
11985
|
+
parsed = parse(input, options);
|
|
11986
|
+
}
|
|
11942
11987
|
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
}
|
|
11988
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
11989
|
+
};
|
|
11946
11990
|
|
|
11947
|
-
|
|
11948
|
-
|
|
11991
|
+
/**
|
|
11992
|
+
* Create a regular expression from the given regex source string.
|
|
11993
|
+
*
|
|
11994
|
+
* ```js
|
|
11995
|
+
* const picomatch = require('picomatch');
|
|
11996
|
+
* // picomatch.toRegex(source[, options]);
|
|
11997
|
+
*
|
|
11998
|
+
* const { output } = picomatch.parse('*.js');
|
|
11999
|
+
* console.log(picomatch.toRegex(output));
|
|
12000
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
12001
|
+
* ```
|
|
12002
|
+
* @param {String} `source` Regular expression source string.
|
|
12003
|
+
* @param {Object} `options`
|
|
12004
|
+
* @return {RegExp}
|
|
12005
|
+
* @api public
|
|
12006
|
+
*/
|
|
12007
|
+
|
|
12008
|
+
picomatch.toRegex = (source, options) => {
|
|
12009
|
+
try {
|
|
12010
|
+
const opts = options || {};
|
|
12011
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
12012
|
+
} catch (err) {
|
|
12013
|
+
if (options && options.debug === true) throw err;
|
|
12014
|
+
return /$^/;
|
|
12015
|
+
}
|
|
12016
|
+
};
|
|
11949
12017
|
|
|
11950
|
-
/**
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
* const picomatch = require('picomatch');
|
|
11955
|
-
* // picomatch.toRegex(source[, options]);
|
|
11956
|
-
*
|
|
11957
|
-
* const { output } = picomatch.parse('*.js');
|
|
11958
|
-
* console.log(picomatch.toRegex(output));
|
|
11959
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
11960
|
-
* ```
|
|
11961
|
-
* @param {String} `source` Regular expression source string.
|
|
11962
|
-
* @param {Object} `options`
|
|
11963
|
-
* @return {RegExp}
|
|
11964
|
-
* @api public
|
|
11965
|
-
*/
|
|
12018
|
+
/**
|
|
12019
|
+
* Picomatch constants.
|
|
12020
|
+
* @return {Object}
|
|
12021
|
+
*/
|
|
11966
12022
|
|
|
11967
|
-
picomatch
|
|
11968
|
-
try {
|
|
11969
|
-
const opts = options || {};
|
|
11970
|
-
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
11971
|
-
} catch (err) {
|
|
11972
|
-
if (options && options.debug === true) throw err;
|
|
11973
|
-
return /$^/;
|
|
11974
|
-
}
|
|
11975
|
-
};
|
|
12023
|
+
picomatch.constants = constants;
|
|
11976
12024
|
|
|
11977
|
-
/**
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
*/
|
|
12025
|
+
/**
|
|
12026
|
+
* Expose "picomatch"
|
|
12027
|
+
*/
|
|
11981
12028
|
|
|
11982
|
-
|
|
12029
|
+
picomatch_1 = picomatch;
|
|
12030
|
+
return picomatch_1;
|
|
12031
|
+
}
|
|
11983
12032
|
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
*/
|
|
12033
|
+
var picomatch;
|
|
12034
|
+
var hasRequiredPicomatch;
|
|
11987
12035
|
|
|
11988
|
-
|
|
12036
|
+
function requirePicomatch () {
|
|
12037
|
+
if (hasRequiredPicomatch) return picomatch;
|
|
12038
|
+
hasRequiredPicomatch = 1;
|
|
11989
12039
|
|
|
11990
|
-
|
|
12040
|
+
picomatch = /*@__PURE__*/ requirePicomatch$1();
|
|
12041
|
+
return picomatch;
|
|
12042
|
+
}
|
|
11991
12043
|
|
|
11992
|
-
|
|
12044
|
+
var picomatchExports = /*@__PURE__*/ requirePicomatch();
|
|
12045
|
+
const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
|
|
11993
12046
|
|
|
11994
12047
|
const extractors = {
|
|
11995
12048
|
ArrayPattern(names, param) {
|
|
@@ -12038,8 +12091,9 @@ function ensureArray(thing) {
|
|
|
12038
12091
|
return [thing];
|
|
12039
12092
|
}
|
|
12040
12093
|
|
|
12094
|
+
const normalizePathRegExp = new RegExp(`\\${require$$0.win32.sep}`, 'g');
|
|
12041
12095
|
const normalizePath = function normalizePath(filename) {
|
|
12042
|
-
return filename.
|
|
12096
|
+
return filename.replace(normalizePathRegExp, require$$0.posix.sep);
|
|
12043
12097
|
};
|
|
12044
12098
|
|
|
12045
12099
|
function getMatcherString(id, resolutionBase) {
|
|
@@ -12071,10 +12125,12 @@ const createFilter = function createFilter(include, exclude, options) {
|
|
|
12071
12125
|
};
|
|
12072
12126
|
const includeMatchers = ensureArray(include).map(getMatcher);
|
|
12073
12127
|
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
|
12128
|
+
if (!includeMatchers.length && !excludeMatchers.length)
|
|
12129
|
+
return (id) => typeof id === 'string' && !id.includes('\0');
|
|
12074
12130
|
return function result(id) {
|
|
12075
12131
|
if (typeof id !== 'string')
|
|
12076
12132
|
return false;
|
|
12077
|
-
if (
|
|
12133
|
+
if (id.includes('\0'))
|
|
12078
12134
|
return false;
|
|
12079
12135
|
const pathId = normalizePath(id);
|
|
12080
12136
|
for (let i = 0; i < excludeMatchers.length; ++i) {
|
|
@@ -16262,8 +16318,8 @@ class Module {
|
|
|
16262
16318
|
};
|
|
16263
16319
|
}
|
|
16264
16320
|
basename() {
|
|
16265
|
-
const base = path
|
|
16266
|
-
const extension = path
|
|
16321
|
+
const base = path.basename(this.id);
|
|
16322
|
+
const extension = path.extname(this.id);
|
|
16267
16323
|
return makeLegal(extension ? base.slice(0, -extension.length) : base);
|
|
16268
16324
|
}
|
|
16269
16325
|
bindReferences() {
|
|
@@ -17617,7 +17673,7 @@ class Chunk {
|
|
|
17617
17673
|
let hashPlaceholder = null;
|
|
17618
17674
|
const { chunkFileNames, entryFileNames, file, format, preserveModules } = this.outputOptions;
|
|
17619
17675
|
if (file) {
|
|
17620
|
-
fileName = path
|
|
17676
|
+
fileName = path.basename(file);
|
|
17621
17677
|
}
|
|
17622
17678
|
else if (this.fileName === null) {
|
|
17623
17679
|
const [pattern, patternName] = preserveModules || this.facadeModule?.isUserDefinedEntryPoint
|
|
@@ -18068,12 +18124,12 @@ class Chunk {
|
|
|
18068
18124
|
return predefinedChunkName;
|
|
18069
18125
|
const { preserveModulesRoot, sanitizeFileName } = this.outputOptions;
|
|
18070
18126
|
const sanitizedId = sanitizeFileName(parseAst_js.normalize(module.id.split(QUERY_HASH_REGEX, 1)[0]));
|
|
18071
|
-
const extensionName = path
|
|
18127
|
+
const extensionName = path.extname(sanitizedId);
|
|
18072
18128
|
const idWithoutExtension = NON_ASSET_EXTENSIONS.has(extensionName)
|
|
18073
18129
|
? sanitizedId.slice(0, -extensionName.length)
|
|
18074
18130
|
: sanitizedId;
|
|
18075
18131
|
if (parseAst_js.isAbsolute(idWithoutExtension)) {
|
|
18076
|
-
if (preserveModulesRoot && path
|
|
18132
|
+
if (preserveModulesRoot && path.resolve(idWithoutExtension).startsWith(preserveModulesRoot)) {
|
|
18077
18133
|
return idWithoutExtension.slice(preserveModulesRoot.length).replace(/^[/\\]/, '');
|
|
18078
18134
|
}
|
|
18079
18135
|
else {
|
|
@@ -18085,7 +18141,7 @@ class Chunk {
|
|
|
18085
18141
|
}
|
|
18086
18142
|
}
|
|
18087
18143
|
else {
|
|
18088
|
-
return (this.outputOptions.virtualDirname.replace(/\/$/, '') + '/' + path
|
|
18144
|
+
return (this.outputOptions.virtualDirname.replace(/\/$/, '') + '/' + path.basename(idWithoutExtension));
|
|
18089
18145
|
}
|
|
18090
18146
|
}
|
|
18091
18147
|
getReexportSpecifiers() {
|
|
@@ -19068,7 +19124,7 @@ function commondir(files) {
|
|
|
19068
19124
|
if (files.length === 0)
|
|
19069
19125
|
return '/';
|
|
19070
19126
|
if (files.length === 1)
|
|
19071
|
-
return path
|
|
19127
|
+
return path.dirname(files[0]);
|
|
19072
19128
|
const commonSegments = files.slice(1).reduce((commonSegments, file) => {
|
|
19073
19129
|
const pathSegments = file.split(/\/+|\\+/);
|
|
19074
19130
|
let index;
|
|
@@ -19326,9 +19382,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
|
|
|
19326
19382
|
if (originalSourcemap) {
|
|
19327
19383
|
const sources = originalSourcemap.sources;
|
|
19328
19384
|
const sourcesContent = originalSourcemap.sourcesContent || [];
|
|
19329
|
-
const directory = path
|
|
19385
|
+
const directory = path.dirname(id) || '.';
|
|
19330
19386
|
const sourceRoot = originalSourcemap.sourceRoot || '.';
|
|
19331
|
-
const baseSources = sources.map((source, index) => new Source(path
|
|
19387
|
+
const baseSources = sources.map((source, index) => new Source(path.resolve(directory, sourceRoot, source), sourcesContent[index]));
|
|
19332
19388
|
source = new Link(originalSourcemap, baseSources);
|
|
19333
19389
|
}
|
|
19334
19390
|
else {
|
|
@@ -19345,9 +19401,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
|
|
|
19345
19401
|
const source = bundleSourcemapChain.reduce(linkMap, link);
|
|
19346
19402
|
let { sources, sourcesContent, names, mappings } = source.traceMappings();
|
|
19347
19403
|
if (file) {
|
|
19348
|
-
const directory = path
|
|
19349
|
-
sources = sources.map((source) => path
|
|
19350
|
-
file = path
|
|
19404
|
+
const directory = path.dirname(file);
|
|
19405
|
+
sources = sources.map((source) => path.relative(directory, source));
|
|
19406
|
+
file = path.basename(file);
|
|
19351
19407
|
}
|
|
19352
19408
|
sourcesContent = (excludeContent ? null : sourcesContent);
|
|
19353
19409
|
for (const module of modules) {
|
|
@@ -19421,11 +19477,11 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
19421
19477
|
timeStart('sourcemaps', 3);
|
|
19422
19478
|
let resultingFile;
|
|
19423
19479
|
if (file)
|
|
19424
|
-
resultingFile = path
|
|
19480
|
+
resultingFile = path.resolve(sourcemapFile || file);
|
|
19425
19481
|
else if (dir)
|
|
19426
|
-
resultingFile = path
|
|
19482
|
+
resultingFile = path.resolve(dir, fileName);
|
|
19427
19483
|
else
|
|
19428
|
-
resultingFile = path
|
|
19484
|
+
resultingFile = path.resolve(fileName);
|
|
19429
19485
|
const decodedMap = magicString.generateDecodedMap({});
|
|
19430
19486
|
map = collapseSourcemaps(resultingFile, decodedMap, usedModules, sourcemapChain, sourcemapExcludeSources, log);
|
|
19431
19487
|
for (let sourcesIndex = 0; sourcesIndex < map.sources.length; ++sourcesIndex) {
|
|
@@ -19573,7 +19629,7 @@ function emitSourceMapAndGetComment(fileName, map, pluginDriver, { sourcemap, so
|
|
|
19573
19629
|
url = map.toUrl();
|
|
19574
19630
|
}
|
|
19575
19631
|
else {
|
|
19576
|
-
const sourcemapFileName = path
|
|
19632
|
+
const sourcemapFileName = path.basename(fileName);
|
|
19577
19633
|
url = sourcemapBaseUrl
|
|
19578
19634
|
? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
|
|
19579
19635
|
: sourcemapFileName;
|
|
@@ -19867,7 +19923,7 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
|
|
|
19867
19923
|
// absolute path is created. Absolute importees therefore shortcircuit the
|
|
19868
19924
|
// resolve call and require no special handing on our part.
|
|
19869
19925
|
// See https://nodejs.org/api/path.html#path_path_resolve_paths
|
|
19870
|
-
return addJsExtensionIfNecessary(importer ? path
|
|
19926
|
+
return addJsExtensionIfNecessary(importer ? path.resolve(path.dirname(importer), source) : path.resolve(source), preserveSymlinks);
|
|
19871
19927
|
}
|
|
19872
19928
|
async function addJsExtensionIfNecessary(file, preserveSymlinks) {
|
|
19873
19929
|
return ((await findFile(file, preserveSymlinks)) ??
|
|
@@ -19881,8 +19937,8 @@ async function findFile(file, preserveSymlinks) {
|
|
|
19881
19937
|
return await findFile(await promises.realpath(file), preserveSymlinks);
|
|
19882
19938
|
if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
|
|
19883
19939
|
// check case
|
|
19884
|
-
const name = path
|
|
19885
|
-
const files = await promises.readdir(path
|
|
19940
|
+
const name = path.basename(file);
|
|
19941
|
+
const files = await promises.readdir(path.dirname(file));
|
|
19886
19942
|
if (files.includes(name))
|
|
19887
19943
|
return file;
|
|
19888
19944
|
}
|
|
@@ -20437,8 +20493,8 @@ class ModuleLoader {
|
|
|
20437
20493
|
function normalizeRelativeExternalId(source, importer) {
|
|
20438
20494
|
return parseAst_js.isRelative(source)
|
|
20439
20495
|
? importer
|
|
20440
|
-
? path
|
|
20441
|
-
: path
|
|
20496
|
+
? path.resolve(importer, '..', source)
|
|
20497
|
+
: path.resolve(source)
|
|
20442
20498
|
: source;
|
|
20443
20499
|
}
|
|
20444
20500
|
function addChunkNamesToModule(module, { fileName, name }, isUserDefined, priority) {
|
|
@@ -20811,7 +20867,7 @@ const getModuleContext = (config, context) => {
|
|
|
20811
20867
|
if (configModuleContext) {
|
|
20812
20868
|
const contextByModuleId = Object.create(null);
|
|
20813
20869
|
for (const [key, moduleContext] of Object.entries(configModuleContext)) {
|
|
20814
|
-
contextByModuleId[path
|
|
20870
|
+
contextByModuleId[path.resolve(key)] = moduleContext;
|
|
20815
20871
|
}
|
|
20816
20872
|
return id => contextByModuleId[id] ?? context;
|
|
20817
20873
|
}
|
|
@@ -21004,7 +21060,7 @@ const getPreserveModulesRoot = (config) => {
|
|
|
21004
21060
|
if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
|
|
21005
21061
|
return undefined;
|
|
21006
21062
|
}
|
|
21007
|
-
return path
|
|
21063
|
+
return path.resolve(preserveModulesRoot);
|
|
21008
21064
|
};
|
|
21009
21065
|
const getAmd = (config) => {
|
|
21010
21066
|
const mergedOption = {
|
|
@@ -21301,9 +21357,9 @@ function getSortingFileType(file) {
|
|
|
21301
21357
|
return SortingFileType.SECONDARY_CHUNK;
|
|
21302
21358
|
}
|
|
21303
21359
|
async function writeOutputFile(outputFile, outputOptions) {
|
|
21304
|
-
const fileName = path
|
|
21360
|
+
const fileName = path.resolve(outputOptions.dir || path.dirname(outputOptions.file), outputFile.fileName);
|
|
21305
21361
|
// 'recursive: true' does not throw if the folder structure, or parts of it, already exist
|
|
21306
|
-
await promises.mkdir(path
|
|
21362
|
+
await promises.mkdir(path.dirname(fileName), { recursive: true });
|
|
21307
21363
|
return promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
|
|
21308
21364
|
}
|
|
21309
21365
|
/**
|
|
@@ -21325,6 +21381,7 @@ exports.cyan$1 = cyan;
|
|
|
21325
21381
|
exports.defineConfig = defineConfig;
|
|
21326
21382
|
exports.ensureArray = ensureArray$1;
|
|
21327
21383
|
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
21384
|
+
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
21328
21385
|
exports.getNewArray = getNewArray;
|
|
21329
21386
|
exports.getOrCreate = getOrCreate;
|
|
21330
21387
|
exports.gray = gray;
|
|
@@ -21333,7 +21390,6 @@ exports.handleError = handleError;
|
|
|
21333
21390
|
exports.isWatchEnabled = isWatchEnabled;
|
|
21334
21391
|
exports.mergeOptions = mergeOptions;
|
|
21335
21392
|
exports.normalizePluginOption = normalizePluginOption;
|
|
21336
|
-
exports.picomatch = picomatch;
|
|
21337
21393
|
exports.rollup = rollup;
|
|
21338
21394
|
exports.rollupInternal = rollupInternal;
|
|
21339
21395
|
exports.stderr = stderr;
|