@storybook/addon-docs 10.1.0-alpha.10 → 10.1.0-alpha.12
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/_browser-chunks/Color-S5NAVK5F.js +1096 -0
- package/dist/_browser-chunks/{DocsRenderer-HT7GNKAR.js → DocsRenderer-GHJI37HO.js} +2 -2
- package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
- package/dist/_browser-chunks/chunk-CYSK6WYR.js +7 -0
- package/dist/_browser-chunks/chunk-DDRHE7EB.js +949 -0
- package/dist/_browser-chunks/{chunk-74ZUTOZN.js → chunk-OATZR77O.js} +9 -22
- package/dist/_browser-chunks/chunk-UUESKCKV.js +31 -0
- package/dist/_node-chunks/{chunk-AAP3IT42.js → chunk-C335KFTP.js} +13 -19
- package/dist/_node-chunks/chunk-KYCOJTNB.js +168 -0
- package/dist/_node-chunks/chunk-O7PYD3IJ.js +22630 -0
- package/dist/_node-chunks/chunk-W3QUNYQ5.js +196 -0
- package/dist/_node-chunks/mdx-plugin-DEILFM7O.js +1032 -0
- package/dist/_node-chunks/rehype-external-links-5BFMYXOM.js +121 -0
- package/dist/_node-chunks/{rehype-slug-NPV5OLTF.js → rehype-slug-WW2KPWVT.js} +24 -58
- package/dist/angular/index.js +3 -5
- package/dist/blocks.d.ts +4 -2
- package/dist/blocks.js +1833 -3846
- package/dist/ember/index.js +3 -5
- package/dist/index.js +4 -6
- package/dist/manager.js +11 -22
- package/dist/mdx-loader.js +13 -19
- package/dist/preset.js +155 -454
- package/dist/preview.js +2 -2
- package/package.json +6 -6
- package/dist/_browser-chunks/Color-553OW3OY.js +0 -1694
- package/dist/_browser-chunks/chunk-DMNQCVA2.js +0 -12
- package/dist/_browser-chunks/chunk-UZFOWTVP.js +0 -974
- package/dist/_browser-chunks/chunk-YDZYZRYC.js +0 -39
- package/dist/_node-chunks/chunk-BHIBLL2L.js +0 -36332
- package/dist/_node-chunks/chunk-RAVRMRBT.js +0 -248
- package/dist/_node-chunks/chunk-TSMODHW2.js +0 -231
- package/dist/_node-chunks/mdx-plugin-OGZHIA54.js +0 -1654
- package/dist/_node-chunks/rehype-external-links-32F3YIMH.js +0 -168
|
@@ -1,1654 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_l24grcih83q from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_l24grcih83q from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_l24grcih83q from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_l24grcih83q.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_l24grcih83q.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_l24grcih83q.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
compile
|
|
14
|
-
} from "./chunk-BHIBLL2L.js";
|
|
15
|
-
import "./chunk-RAVRMRBT.js";
|
|
16
|
-
import "./chunk-TSMODHW2.js";
|
|
17
|
-
import {
|
|
18
|
-
__commonJS,
|
|
19
|
-
__name,
|
|
20
|
-
__toESM
|
|
21
|
-
} from "./chunk-AAP3IT42.js";
|
|
22
|
-
|
|
23
|
-
// ../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/constants.js
|
|
24
|
-
var require_constants = __commonJS({
|
|
25
|
-
"../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/constants.js"(exports, module) {
|
|
26
|
-
"use strict";
|
|
27
|
-
var WIN_SLASH = "\\\\/";
|
|
28
|
-
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
29
|
-
var DOT_LITERAL = "\\.";
|
|
30
|
-
var PLUS_LITERAL = "\\+";
|
|
31
|
-
var QMARK_LITERAL = "\\?";
|
|
32
|
-
var SLASH_LITERAL = "\\/";
|
|
33
|
-
var ONE_CHAR = "(?=.)";
|
|
34
|
-
var QMARK = "[^/]";
|
|
35
|
-
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
36
|
-
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
37
|
-
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
38
|
-
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
39
|
-
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
40
|
-
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
41
|
-
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
42
|
-
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
43
|
-
var STAR = `${QMARK}*?`;
|
|
44
|
-
var SEP = "/";
|
|
45
|
-
var POSIX_CHARS = {
|
|
46
|
-
DOT_LITERAL,
|
|
47
|
-
PLUS_LITERAL,
|
|
48
|
-
QMARK_LITERAL,
|
|
49
|
-
SLASH_LITERAL,
|
|
50
|
-
ONE_CHAR,
|
|
51
|
-
QMARK,
|
|
52
|
-
END_ANCHOR,
|
|
53
|
-
DOTS_SLASH,
|
|
54
|
-
NO_DOT,
|
|
55
|
-
NO_DOTS,
|
|
56
|
-
NO_DOT_SLASH,
|
|
57
|
-
NO_DOTS_SLASH,
|
|
58
|
-
QMARK_NO_DOT,
|
|
59
|
-
STAR,
|
|
60
|
-
START_ANCHOR,
|
|
61
|
-
SEP
|
|
62
|
-
};
|
|
63
|
-
var WINDOWS_CHARS = {
|
|
64
|
-
...POSIX_CHARS,
|
|
65
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
66
|
-
QMARK: WIN_NO_SLASH,
|
|
67
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
68
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
69
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
70
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
71
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
72
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
73
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
74
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
75
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
76
|
-
SEP: "\\"
|
|
77
|
-
};
|
|
78
|
-
var POSIX_REGEX_SOURCE = {
|
|
79
|
-
alnum: "a-zA-Z0-9",
|
|
80
|
-
alpha: "a-zA-Z",
|
|
81
|
-
ascii: "\\x00-\\x7F",
|
|
82
|
-
blank: " \\t",
|
|
83
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
84
|
-
digit: "0-9",
|
|
85
|
-
graph: "\\x21-\\x7E",
|
|
86
|
-
lower: "a-z",
|
|
87
|
-
print: "\\x20-\\x7E ",
|
|
88
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
89
|
-
space: " \\t\\r\\n\\v\\f",
|
|
90
|
-
upper: "A-Z",
|
|
91
|
-
word: "A-Za-z0-9_",
|
|
92
|
-
xdigit: "A-Fa-f0-9"
|
|
93
|
-
};
|
|
94
|
-
module.exports = {
|
|
95
|
-
MAX_LENGTH: 1024 * 64,
|
|
96
|
-
POSIX_REGEX_SOURCE,
|
|
97
|
-
// regular expressions
|
|
98
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
99
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
100
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
101
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
102
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
103
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
104
|
-
// Replace globs with equivalent patterns to reduce parsing time.
|
|
105
|
-
REPLACEMENTS: {
|
|
106
|
-
__proto__: null,
|
|
107
|
-
"***": "*",
|
|
108
|
-
"**/**": "**",
|
|
109
|
-
"**/**/**": "**"
|
|
110
|
-
},
|
|
111
|
-
// Digits
|
|
112
|
-
CHAR_0: 48,
|
|
113
|
-
/* 0 */
|
|
114
|
-
CHAR_9: 57,
|
|
115
|
-
/* 9 */
|
|
116
|
-
// Alphabet chars.
|
|
117
|
-
CHAR_UPPERCASE_A: 65,
|
|
118
|
-
/* A */
|
|
119
|
-
CHAR_LOWERCASE_A: 97,
|
|
120
|
-
/* a */
|
|
121
|
-
CHAR_UPPERCASE_Z: 90,
|
|
122
|
-
/* Z */
|
|
123
|
-
CHAR_LOWERCASE_Z: 122,
|
|
124
|
-
/* z */
|
|
125
|
-
CHAR_LEFT_PARENTHESES: 40,
|
|
126
|
-
/* ( */
|
|
127
|
-
CHAR_RIGHT_PARENTHESES: 41,
|
|
128
|
-
/* ) */
|
|
129
|
-
CHAR_ASTERISK: 42,
|
|
130
|
-
/* * */
|
|
131
|
-
// Non-alphabetic chars.
|
|
132
|
-
CHAR_AMPERSAND: 38,
|
|
133
|
-
/* & */
|
|
134
|
-
CHAR_AT: 64,
|
|
135
|
-
/* @ */
|
|
136
|
-
CHAR_BACKWARD_SLASH: 92,
|
|
137
|
-
/* \ */
|
|
138
|
-
CHAR_CARRIAGE_RETURN: 13,
|
|
139
|
-
/* \r */
|
|
140
|
-
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
141
|
-
/* ^ */
|
|
142
|
-
CHAR_COLON: 58,
|
|
143
|
-
/* : */
|
|
144
|
-
CHAR_COMMA: 44,
|
|
145
|
-
/* , */
|
|
146
|
-
CHAR_DOT: 46,
|
|
147
|
-
/* . */
|
|
148
|
-
CHAR_DOUBLE_QUOTE: 34,
|
|
149
|
-
/* " */
|
|
150
|
-
CHAR_EQUAL: 61,
|
|
151
|
-
/* = */
|
|
152
|
-
CHAR_EXCLAMATION_MARK: 33,
|
|
153
|
-
/* ! */
|
|
154
|
-
CHAR_FORM_FEED: 12,
|
|
155
|
-
/* \f */
|
|
156
|
-
CHAR_FORWARD_SLASH: 47,
|
|
157
|
-
/* / */
|
|
158
|
-
CHAR_GRAVE_ACCENT: 96,
|
|
159
|
-
/* ` */
|
|
160
|
-
CHAR_HASH: 35,
|
|
161
|
-
/* # */
|
|
162
|
-
CHAR_HYPHEN_MINUS: 45,
|
|
163
|
-
/* - */
|
|
164
|
-
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
165
|
-
/* < */
|
|
166
|
-
CHAR_LEFT_CURLY_BRACE: 123,
|
|
167
|
-
/* { */
|
|
168
|
-
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
169
|
-
/* [ */
|
|
170
|
-
CHAR_LINE_FEED: 10,
|
|
171
|
-
/* \n */
|
|
172
|
-
CHAR_NO_BREAK_SPACE: 160,
|
|
173
|
-
/* \u00A0 */
|
|
174
|
-
CHAR_PERCENT: 37,
|
|
175
|
-
/* % */
|
|
176
|
-
CHAR_PLUS: 43,
|
|
177
|
-
/* + */
|
|
178
|
-
CHAR_QUESTION_MARK: 63,
|
|
179
|
-
/* ? */
|
|
180
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
181
|
-
/* > */
|
|
182
|
-
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
183
|
-
/* } */
|
|
184
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
185
|
-
/* ] */
|
|
186
|
-
CHAR_SEMICOLON: 59,
|
|
187
|
-
/* ; */
|
|
188
|
-
CHAR_SINGLE_QUOTE: 39,
|
|
189
|
-
/* ' */
|
|
190
|
-
CHAR_SPACE: 32,
|
|
191
|
-
/* */
|
|
192
|
-
CHAR_TAB: 9,
|
|
193
|
-
/* \t */
|
|
194
|
-
CHAR_UNDERSCORE: 95,
|
|
195
|
-
/* _ */
|
|
196
|
-
CHAR_VERTICAL_LINE: 124,
|
|
197
|
-
/* | */
|
|
198
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
199
|
-
/* \uFEFF */
|
|
200
|
-
/**
|
|
201
|
-
* Create EXTGLOB_CHARS
|
|
202
|
-
*/
|
|
203
|
-
extglobChars(chars) {
|
|
204
|
-
return {
|
|
205
|
-
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
206
|
-
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
207
|
-
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
208
|
-
"*": { type: "star", open: "(?:", close: ")*" },
|
|
209
|
-
"@": { type: "at", open: "(?:", close: ")" }
|
|
210
|
-
};
|
|
211
|
-
},
|
|
212
|
-
/**
|
|
213
|
-
* Create GLOB_CHARS
|
|
214
|
-
*/
|
|
215
|
-
globChars(win322) {
|
|
216
|
-
return win322 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
// ../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/utils.js
|
|
223
|
-
var require_utils = __commonJS({
|
|
224
|
-
"../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/utils.js"(exports) {
|
|
225
|
-
"use strict";
|
|
226
|
-
var {
|
|
227
|
-
REGEX_BACKSLASH,
|
|
228
|
-
REGEX_REMOVE_BACKSLASH,
|
|
229
|
-
REGEX_SPECIAL_CHARS,
|
|
230
|
-
REGEX_SPECIAL_CHARS_GLOBAL
|
|
231
|
-
} = require_constants();
|
|
232
|
-
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
233
|
-
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
234
|
-
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
235
|
-
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
236
|
-
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
237
|
-
exports.isWindows = () => {
|
|
238
|
-
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
239
|
-
const platform = navigator.platform.toLowerCase();
|
|
240
|
-
return platform === "win32" || platform === "windows";
|
|
241
|
-
}
|
|
242
|
-
if (typeof process !== "undefined" && process.platform) {
|
|
243
|
-
return process.platform === "win32";
|
|
244
|
-
}
|
|
245
|
-
return false;
|
|
246
|
-
};
|
|
247
|
-
exports.removeBackslashes = (str) => {
|
|
248
|
-
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
249
|
-
return match === "\\" ? "" : match;
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
253
|
-
const idx = input.lastIndexOf(char, lastIdx);
|
|
254
|
-
if (idx === -1) return input;
|
|
255
|
-
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
256
|
-
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
257
|
-
};
|
|
258
|
-
exports.removePrefix = (input, state = {}) => {
|
|
259
|
-
let output = input;
|
|
260
|
-
if (output.startsWith("./")) {
|
|
261
|
-
output = output.slice(2);
|
|
262
|
-
state.prefix = "./";
|
|
263
|
-
}
|
|
264
|
-
return output;
|
|
265
|
-
};
|
|
266
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
267
|
-
const prepend = options.contains ? "" : "^";
|
|
268
|
-
const append = options.contains ? "" : "$";
|
|
269
|
-
let output = `${prepend}(?:${input})${append}`;
|
|
270
|
-
if (state.negated === true) {
|
|
271
|
-
output = `(?:^(?!${output}).*$)`;
|
|
272
|
-
}
|
|
273
|
-
return output;
|
|
274
|
-
};
|
|
275
|
-
exports.basename = (path, { windows } = {}) => {
|
|
276
|
-
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
277
|
-
const last = segs[segs.length - 1];
|
|
278
|
-
if (last === "") {
|
|
279
|
-
return segs[segs.length - 2];
|
|
280
|
-
}
|
|
281
|
-
return last;
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
// ../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/scan.js
|
|
287
|
-
var require_scan = __commonJS({
|
|
288
|
-
"../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/scan.js"(exports, module) {
|
|
289
|
-
"use strict";
|
|
290
|
-
var utils = require_utils();
|
|
291
|
-
var {
|
|
292
|
-
CHAR_ASTERISK,
|
|
293
|
-
/* * */
|
|
294
|
-
CHAR_AT,
|
|
295
|
-
/* @ */
|
|
296
|
-
CHAR_BACKWARD_SLASH,
|
|
297
|
-
/* \ */
|
|
298
|
-
CHAR_COMMA,
|
|
299
|
-
/* , */
|
|
300
|
-
CHAR_DOT,
|
|
301
|
-
/* . */
|
|
302
|
-
CHAR_EXCLAMATION_MARK,
|
|
303
|
-
/* ! */
|
|
304
|
-
CHAR_FORWARD_SLASH,
|
|
305
|
-
/* / */
|
|
306
|
-
CHAR_LEFT_CURLY_BRACE,
|
|
307
|
-
/* { */
|
|
308
|
-
CHAR_LEFT_PARENTHESES,
|
|
309
|
-
/* ( */
|
|
310
|
-
CHAR_LEFT_SQUARE_BRACKET,
|
|
311
|
-
/* [ */
|
|
312
|
-
CHAR_PLUS,
|
|
313
|
-
/* + */
|
|
314
|
-
CHAR_QUESTION_MARK,
|
|
315
|
-
/* ? */
|
|
316
|
-
CHAR_RIGHT_CURLY_BRACE,
|
|
317
|
-
/* } */
|
|
318
|
-
CHAR_RIGHT_PARENTHESES,
|
|
319
|
-
/* ) */
|
|
320
|
-
CHAR_RIGHT_SQUARE_BRACKET
|
|
321
|
-
/* ] */
|
|
322
|
-
} = require_constants();
|
|
323
|
-
var isPathSeparator = /* @__PURE__ */ __name((code) => {
|
|
324
|
-
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
325
|
-
}, "isPathSeparator");
|
|
326
|
-
var depth = /* @__PURE__ */ __name((token) => {
|
|
327
|
-
if (token.isPrefix !== true) {
|
|
328
|
-
token.depth = token.isGlobstar ? Infinity : 1;
|
|
329
|
-
}
|
|
330
|
-
}, "depth");
|
|
331
|
-
var scan = /* @__PURE__ */ __name((input, options) => {
|
|
332
|
-
const opts = options || {};
|
|
333
|
-
const length = input.length - 1;
|
|
334
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
335
|
-
const slashes = [];
|
|
336
|
-
const tokens = [];
|
|
337
|
-
const parts = [];
|
|
338
|
-
let str = input;
|
|
339
|
-
let index = -1;
|
|
340
|
-
let start = 0;
|
|
341
|
-
let lastIndex = 0;
|
|
342
|
-
let isBrace = false;
|
|
343
|
-
let isBracket = false;
|
|
344
|
-
let isGlob = false;
|
|
345
|
-
let isExtglob = false;
|
|
346
|
-
let isGlobstar = false;
|
|
347
|
-
let braceEscaped = false;
|
|
348
|
-
let backslashes = false;
|
|
349
|
-
let negated = false;
|
|
350
|
-
let negatedExtglob = false;
|
|
351
|
-
let finished = false;
|
|
352
|
-
let braces = 0;
|
|
353
|
-
let prev;
|
|
354
|
-
let code;
|
|
355
|
-
let token = { value: "", depth: 0, isGlob: false };
|
|
356
|
-
const eos = /* @__PURE__ */ __name(() => index >= length, "eos");
|
|
357
|
-
const peek = /* @__PURE__ */ __name(() => str.charCodeAt(index + 1), "peek");
|
|
358
|
-
const advance = /* @__PURE__ */ __name(() => {
|
|
359
|
-
prev = code;
|
|
360
|
-
return str.charCodeAt(++index);
|
|
361
|
-
}, "advance");
|
|
362
|
-
while (index < length) {
|
|
363
|
-
code = advance();
|
|
364
|
-
let next;
|
|
365
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
366
|
-
backslashes = token.backslashes = true;
|
|
367
|
-
code = advance();
|
|
368
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
369
|
-
braceEscaped = true;
|
|
370
|
-
}
|
|
371
|
-
continue;
|
|
372
|
-
}
|
|
373
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
374
|
-
braces++;
|
|
375
|
-
while (eos() !== true && (code = advance())) {
|
|
376
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
377
|
-
backslashes = token.backslashes = true;
|
|
378
|
-
advance();
|
|
379
|
-
continue;
|
|
380
|
-
}
|
|
381
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
382
|
-
braces++;
|
|
383
|
-
continue;
|
|
384
|
-
}
|
|
385
|
-
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
386
|
-
isBrace = token.isBrace = true;
|
|
387
|
-
isGlob = token.isGlob = true;
|
|
388
|
-
finished = true;
|
|
389
|
-
if (scanToEnd === true) {
|
|
390
|
-
continue;
|
|
391
|
-
}
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
395
|
-
isBrace = token.isBrace = true;
|
|
396
|
-
isGlob = token.isGlob = true;
|
|
397
|
-
finished = true;
|
|
398
|
-
if (scanToEnd === true) {
|
|
399
|
-
continue;
|
|
400
|
-
}
|
|
401
|
-
break;
|
|
402
|
-
}
|
|
403
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
404
|
-
braces--;
|
|
405
|
-
if (braces === 0) {
|
|
406
|
-
braceEscaped = false;
|
|
407
|
-
isBrace = token.isBrace = true;
|
|
408
|
-
finished = true;
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
if (scanToEnd === true) {
|
|
414
|
-
continue;
|
|
415
|
-
}
|
|
416
|
-
break;
|
|
417
|
-
}
|
|
418
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
419
|
-
slashes.push(index);
|
|
420
|
-
tokens.push(token);
|
|
421
|
-
token = { value: "", depth: 0, isGlob: false };
|
|
422
|
-
if (finished === true) continue;
|
|
423
|
-
if (prev === CHAR_DOT && index === start + 1) {
|
|
424
|
-
start += 2;
|
|
425
|
-
continue;
|
|
426
|
-
}
|
|
427
|
-
lastIndex = index + 1;
|
|
428
|
-
continue;
|
|
429
|
-
}
|
|
430
|
-
if (opts.noext !== true) {
|
|
431
|
-
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
432
|
-
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
433
|
-
isGlob = token.isGlob = true;
|
|
434
|
-
isExtglob = token.isExtglob = true;
|
|
435
|
-
finished = true;
|
|
436
|
-
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
437
|
-
negatedExtglob = true;
|
|
438
|
-
}
|
|
439
|
-
if (scanToEnd === true) {
|
|
440
|
-
while (eos() !== true && (code = advance())) {
|
|
441
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
442
|
-
backslashes = token.backslashes = true;
|
|
443
|
-
code = advance();
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
447
|
-
isGlob = token.isGlob = true;
|
|
448
|
-
finished = true;
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
454
|
-
break;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
if (code === CHAR_ASTERISK) {
|
|
458
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
459
|
-
isGlob = token.isGlob = true;
|
|
460
|
-
finished = true;
|
|
461
|
-
if (scanToEnd === true) {
|
|
462
|
-
continue;
|
|
463
|
-
}
|
|
464
|
-
break;
|
|
465
|
-
}
|
|
466
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
467
|
-
isGlob = token.isGlob = true;
|
|
468
|
-
finished = true;
|
|
469
|
-
if (scanToEnd === true) {
|
|
470
|
-
continue;
|
|
471
|
-
}
|
|
472
|
-
break;
|
|
473
|
-
}
|
|
474
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
475
|
-
while (eos() !== true && (next = advance())) {
|
|
476
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
477
|
-
backslashes = token.backslashes = true;
|
|
478
|
-
advance();
|
|
479
|
-
continue;
|
|
480
|
-
}
|
|
481
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
482
|
-
isBracket = token.isBracket = true;
|
|
483
|
-
isGlob = token.isGlob = true;
|
|
484
|
-
finished = true;
|
|
485
|
-
break;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
if (scanToEnd === true) {
|
|
489
|
-
continue;
|
|
490
|
-
}
|
|
491
|
-
break;
|
|
492
|
-
}
|
|
493
|
-
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
494
|
-
negated = token.negated = true;
|
|
495
|
-
start++;
|
|
496
|
-
continue;
|
|
497
|
-
}
|
|
498
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
499
|
-
isGlob = token.isGlob = true;
|
|
500
|
-
if (scanToEnd === true) {
|
|
501
|
-
while (eos() !== true && (code = advance())) {
|
|
502
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
503
|
-
backslashes = token.backslashes = true;
|
|
504
|
-
code = advance();
|
|
505
|
-
continue;
|
|
506
|
-
}
|
|
507
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
508
|
-
finished = true;
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
continue;
|
|
513
|
-
}
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
if (isGlob === true) {
|
|
517
|
-
finished = true;
|
|
518
|
-
if (scanToEnd === true) {
|
|
519
|
-
continue;
|
|
520
|
-
}
|
|
521
|
-
break;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
if (opts.noext === true) {
|
|
525
|
-
isExtglob = false;
|
|
526
|
-
isGlob = false;
|
|
527
|
-
}
|
|
528
|
-
let base = str;
|
|
529
|
-
let prefix = "";
|
|
530
|
-
let glob = "";
|
|
531
|
-
if (start > 0) {
|
|
532
|
-
prefix = str.slice(0, start);
|
|
533
|
-
str = str.slice(start);
|
|
534
|
-
lastIndex -= start;
|
|
535
|
-
}
|
|
536
|
-
if (base && isGlob === true && lastIndex > 0) {
|
|
537
|
-
base = str.slice(0, lastIndex);
|
|
538
|
-
glob = str.slice(lastIndex);
|
|
539
|
-
} else if (isGlob === true) {
|
|
540
|
-
base = "";
|
|
541
|
-
glob = str;
|
|
542
|
-
} else {
|
|
543
|
-
base = str;
|
|
544
|
-
}
|
|
545
|
-
if (base && base !== "" && base !== "/" && base !== str) {
|
|
546
|
-
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
547
|
-
base = base.slice(0, -1);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
if (opts.unescape === true) {
|
|
551
|
-
if (glob) glob = utils.removeBackslashes(glob);
|
|
552
|
-
if (base && backslashes === true) {
|
|
553
|
-
base = utils.removeBackslashes(base);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
const state = {
|
|
557
|
-
prefix,
|
|
558
|
-
input,
|
|
559
|
-
start,
|
|
560
|
-
base,
|
|
561
|
-
glob,
|
|
562
|
-
isBrace,
|
|
563
|
-
isBracket,
|
|
564
|
-
isGlob,
|
|
565
|
-
isExtglob,
|
|
566
|
-
isGlobstar,
|
|
567
|
-
negated,
|
|
568
|
-
negatedExtglob
|
|
569
|
-
};
|
|
570
|
-
if (opts.tokens === true) {
|
|
571
|
-
state.maxDepth = 0;
|
|
572
|
-
if (!isPathSeparator(code)) {
|
|
573
|
-
tokens.push(token);
|
|
574
|
-
}
|
|
575
|
-
state.tokens = tokens;
|
|
576
|
-
}
|
|
577
|
-
if (opts.parts === true || opts.tokens === true) {
|
|
578
|
-
let prevIndex;
|
|
579
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
|
580
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
581
|
-
const i = slashes[idx];
|
|
582
|
-
const value = input.slice(n, i);
|
|
583
|
-
if (opts.tokens) {
|
|
584
|
-
if (idx === 0 && start !== 0) {
|
|
585
|
-
tokens[idx].isPrefix = true;
|
|
586
|
-
tokens[idx].value = prefix;
|
|
587
|
-
} else {
|
|
588
|
-
tokens[idx].value = value;
|
|
589
|
-
}
|
|
590
|
-
depth(tokens[idx]);
|
|
591
|
-
state.maxDepth += tokens[idx].depth;
|
|
592
|
-
}
|
|
593
|
-
if (idx !== 0 || value !== "") {
|
|
594
|
-
parts.push(value);
|
|
595
|
-
}
|
|
596
|
-
prevIndex = i;
|
|
597
|
-
}
|
|
598
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
599
|
-
const value = input.slice(prevIndex + 1);
|
|
600
|
-
parts.push(value);
|
|
601
|
-
if (opts.tokens) {
|
|
602
|
-
tokens[tokens.length - 1].value = value;
|
|
603
|
-
depth(tokens[tokens.length - 1]);
|
|
604
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
state.slashes = slashes;
|
|
608
|
-
state.parts = parts;
|
|
609
|
-
}
|
|
610
|
-
return state;
|
|
611
|
-
}, "scan");
|
|
612
|
-
module.exports = scan;
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
// ../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/parse.js
|
|
617
|
-
var require_parse = __commonJS({
|
|
618
|
-
"../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
619
|
-
"use strict";
|
|
620
|
-
var constants = require_constants();
|
|
621
|
-
var utils = require_utils();
|
|
622
|
-
var {
|
|
623
|
-
MAX_LENGTH,
|
|
624
|
-
POSIX_REGEX_SOURCE,
|
|
625
|
-
REGEX_NON_SPECIAL_CHARS,
|
|
626
|
-
REGEX_SPECIAL_CHARS_BACKREF,
|
|
627
|
-
REPLACEMENTS
|
|
628
|
-
} = constants;
|
|
629
|
-
var expandRange = /* @__PURE__ */ __name((args, options) => {
|
|
630
|
-
if (typeof options.expandRange === "function") {
|
|
631
|
-
return options.expandRange(...args, options);
|
|
632
|
-
}
|
|
633
|
-
args.sort();
|
|
634
|
-
const value = `[${args.join("-")}]`;
|
|
635
|
-
try {
|
|
636
|
-
new RegExp(value);
|
|
637
|
-
} catch (ex) {
|
|
638
|
-
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
639
|
-
}
|
|
640
|
-
return value;
|
|
641
|
-
}, "expandRange");
|
|
642
|
-
var syntaxError = /* @__PURE__ */ __name((type, char) => {
|
|
643
|
-
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
644
|
-
}, "syntaxError");
|
|
645
|
-
var parse = /* @__PURE__ */ __name((input, options) => {
|
|
646
|
-
if (typeof input !== "string") {
|
|
647
|
-
throw new TypeError("Expected a string");
|
|
648
|
-
}
|
|
649
|
-
input = REPLACEMENTS[input] || input;
|
|
650
|
-
const opts = { ...options };
|
|
651
|
-
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
652
|
-
let len = input.length;
|
|
653
|
-
if (len > max) {
|
|
654
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
655
|
-
}
|
|
656
|
-
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
657
|
-
const tokens = [bos];
|
|
658
|
-
const capture = opts.capture ? "" : "?:";
|
|
659
|
-
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
660
|
-
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
661
|
-
const {
|
|
662
|
-
DOT_LITERAL,
|
|
663
|
-
PLUS_LITERAL,
|
|
664
|
-
SLASH_LITERAL,
|
|
665
|
-
ONE_CHAR,
|
|
666
|
-
DOTS_SLASH,
|
|
667
|
-
NO_DOT,
|
|
668
|
-
NO_DOT_SLASH,
|
|
669
|
-
NO_DOTS_SLASH,
|
|
670
|
-
QMARK,
|
|
671
|
-
QMARK_NO_DOT,
|
|
672
|
-
STAR,
|
|
673
|
-
START_ANCHOR
|
|
674
|
-
} = PLATFORM_CHARS;
|
|
675
|
-
const globstar = /* @__PURE__ */ __name((opts2) => {
|
|
676
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
677
|
-
}, "globstar");
|
|
678
|
-
const nodot = opts.dot ? "" : NO_DOT;
|
|
679
|
-
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
680
|
-
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
681
|
-
if (opts.capture) {
|
|
682
|
-
star = `(${star})`;
|
|
683
|
-
}
|
|
684
|
-
if (typeof opts.noext === "boolean") {
|
|
685
|
-
opts.noextglob = opts.noext;
|
|
686
|
-
}
|
|
687
|
-
const state = {
|
|
688
|
-
input,
|
|
689
|
-
index: -1,
|
|
690
|
-
start: 0,
|
|
691
|
-
dot: opts.dot === true,
|
|
692
|
-
consumed: "",
|
|
693
|
-
output: "",
|
|
694
|
-
prefix: "",
|
|
695
|
-
backtrack: false,
|
|
696
|
-
negated: false,
|
|
697
|
-
brackets: 0,
|
|
698
|
-
braces: 0,
|
|
699
|
-
parens: 0,
|
|
700
|
-
quotes: 0,
|
|
701
|
-
globstar: false,
|
|
702
|
-
tokens
|
|
703
|
-
};
|
|
704
|
-
input = utils.removePrefix(input, state);
|
|
705
|
-
len = input.length;
|
|
706
|
-
const extglobs = [];
|
|
707
|
-
const braces = [];
|
|
708
|
-
const stack = [];
|
|
709
|
-
let prev = bos;
|
|
710
|
-
let value;
|
|
711
|
-
const eos = /* @__PURE__ */ __name(() => state.index === len - 1, "eos");
|
|
712
|
-
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
713
|
-
const advance = state.advance = () => input[++state.index] || "";
|
|
714
|
-
const remaining = /* @__PURE__ */ __name(() => input.slice(state.index + 1), "remaining");
|
|
715
|
-
const consume = /* @__PURE__ */ __name((value2 = "", num = 0) => {
|
|
716
|
-
state.consumed += value2;
|
|
717
|
-
state.index += num;
|
|
718
|
-
}, "consume");
|
|
719
|
-
const append = /* @__PURE__ */ __name((token) => {
|
|
720
|
-
state.output += token.output != null ? token.output : token.value;
|
|
721
|
-
consume(token.value);
|
|
722
|
-
}, "append");
|
|
723
|
-
const negate = /* @__PURE__ */ __name(() => {
|
|
724
|
-
let count = 1;
|
|
725
|
-
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
726
|
-
advance();
|
|
727
|
-
state.start++;
|
|
728
|
-
count++;
|
|
729
|
-
}
|
|
730
|
-
if (count % 2 === 0) {
|
|
731
|
-
return false;
|
|
732
|
-
}
|
|
733
|
-
state.negated = true;
|
|
734
|
-
state.start++;
|
|
735
|
-
return true;
|
|
736
|
-
}, "negate");
|
|
737
|
-
const increment = /* @__PURE__ */ __name((type) => {
|
|
738
|
-
state[type]++;
|
|
739
|
-
stack.push(type);
|
|
740
|
-
}, "increment");
|
|
741
|
-
const decrement = /* @__PURE__ */ __name((type) => {
|
|
742
|
-
state[type]--;
|
|
743
|
-
stack.pop();
|
|
744
|
-
}, "decrement");
|
|
745
|
-
const push = /* @__PURE__ */ __name((tok) => {
|
|
746
|
-
if (prev.type === "globstar") {
|
|
747
|
-
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
748
|
-
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
749
|
-
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
750
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
751
|
-
prev.type = "star";
|
|
752
|
-
prev.value = "*";
|
|
753
|
-
prev.output = star;
|
|
754
|
-
state.output += prev.output;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
if (extglobs.length && tok.type !== "paren") {
|
|
758
|
-
extglobs[extglobs.length - 1].inner += tok.value;
|
|
759
|
-
}
|
|
760
|
-
if (tok.value || tok.output) append(tok);
|
|
761
|
-
if (prev && prev.type === "text" && tok.type === "text") {
|
|
762
|
-
prev.output = (prev.output || prev.value) + tok.value;
|
|
763
|
-
prev.value += tok.value;
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
tok.prev = prev;
|
|
767
|
-
tokens.push(tok);
|
|
768
|
-
prev = tok;
|
|
769
|
-
}, "push");
|
|
770
|
-
const extglobOpen = /* @__PURE__ */ __name((type, value2) => {
|
|
771
|
-
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
|
772
|
-
token.prev = prev;
|
|
773
|
-
token.parens = state.parens;
|
|
774
|
-
token.output = state.output;
|
|
775
|
-
const output = (opts.capture ? "(" : "") + token.open;
|
|
776
|
-
increment("parens");
|
|
777
|
-
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
778
|
-
push({ type: "paren", extglob: true, value: advance(), output });
|
|
779
|
-
extglobs.push(token);
|
|
780
|
-
}, "extglobOpen");
|
|
781
|
-
const extglobClose = /* @__PURE__ */ __name((token) => {
|
|
782
|
-
let output = token.close + (opts.capture ? ")" : "");
|
|
783
|
-
let rest;
|
|
784
|
-
if (token.type === "negate") {
|
|
785
|
-
let extglobStar = star;
|
|
786
|
-
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
787
|
-
extglobStar = globstar(opts);
|
|
788
|
-
}
|
|
789
|
-
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
790
|
-
output = token.close = `)$))${extglobStar}`;
|
|
791
|
-
}
|
|
792
|
-
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
793
|
-
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
|
794
|
-
output = token.close = `)${expression})${extglobStar})`;
|
|
795
|
-
}
|
|
796
|
-
if (token.prev.type === "bos") {
|
|
797
|
-
state.negatedExtglob = true;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
push({ type: "paren", extglob: true, value, output });
|
|
801
|
-
decrement("parens");
|
|
802
|
-
}, "extglobClose");
|
|
803
|
-
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
804
|
-
let backslashes = false;
|
|
805
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
806
|
-
if (first === "\\") {
|
|
807
|
-
backslashes = true;
|
|
808
|
-
return m;
|
|
809
|
-
}
|
|
810
|
-
if (first === "?") {
|
|
811
|
-
if (esc) {
|
|
812
|
-
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
813
|
-
}
|
|
814
|
-
if (index === 0) {
|
|
815
|
-
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
816
|
-
}
|
|
817
|
-
return QMARK.repeat(chars.length);
|
|
818
|
-
}
|
|
819
|
-
if (first === ".") {
|
|
820
|
-
return DOT_LITERAL.repeat(chars.length);
|
|
821
|
-
}
|
|
822
|
-
if (first === "*") {
|
|
823
|
-
if (esc) {
|
|
824
|
-
return esc + first + (rest ? star : "");
|
|
825
|
-
}
|
|
826
|
-
return star;
|
|
827
|
-
}
|
|
828
|
-
return esc ? m : `\\${m}`;
|
|
829
|
-
});
|
|
830
|
-
if (backslashes === true) {
|
|
831
|
-
if (opts.unescape === true) {
|
|
832
|
-
output = output.replace(/\\/g, "");
|
|
833
|
-
} else {
|
|
834
|
-
output = output.replace(/\\+/g, (m) => {
|
|
835
|
-
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
if (output === input && opts.contains === true) {
|
|
840
|
-
state.output = input;
|
|
841
|
-
return state;
|
|
842
|
-
}
|
|
843
|
-
state.output = utils.wrapOutput(output, state, options);
|
|
844
|
-
return state;
|
|
845
|
-
}
|
|
846
|
-
while (!eos()) {
|
|
847
|
-
value = advance();
|
|
848
|
-
if (value === "\0") {
|
|
849
|
-
continue;
|
|
850
|
-
}
|
|
851
|
-
if (value === "\\") {
|
|
852
|
-
const next = peek();
|
|
853
|
-
if (next === "/" && opts.bash !== true) {
|
|
854
|
-
continue;
|
|
855
|
-
}
|
|
856
|
-
if (next === "." || next === ";") {
|
|
857
|
-
continue;
|
|
858
|
-
}
|
|
859
|
-
if (!next) {
|
|
860
|
-
value += "\\";
|
|
861
|
-
push({ type: "text", value });
|
|
862
|
-
continue;
|
|
863
|
-
}
|
|
864
|
-
const match = /^\\+/.exec(remaining());
|
|
865
|
-
let slashes = 0;
|
|
866
|
-
if (match && match[0].length > 2) {
|
|
867
|
-
slashes = match[0].length;
|
|
868
|
-
state.index += slashes;
|
|
869
|
-
if (slashes % 2 !== 0) {
|
|
870
|
-
value += "\\";
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
if (opts.unescape === true) {
|
|
874
|
-
value = advance();
|
|
875
|
-
} else {
|
|
876
|
-
value += advance();
|
|
877
|
-
}
|
|
878
|
-
if (state.brackets === 0) {
|
|
879
|
-
push({ type: "text", value });
|
|
880
|
-
continue;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
884
|
-
if (opts.posix !== false && value === ":") {
|
|
885
|
-
const inner = prev.value.slice(1);
|
|
886
|
-
if (inner.includes("[")) {
|
|
887
|
-
prev.posix = true;
|
|
888
|
-
if (inner.includes(":")) {
|
|
889
|
-
const idx = prev.value.lastIndexOf("[");
|
|
890
|
-
const pre = prev.value.slice(0, idx);
|
|
891
|
-
const rest2 = prev.value.slice(idx + 2);
|
|
892
|
-
const posix2 = POSIX_REGEX_SOURCE[rest2];
|
|
893
|
-
if (posix2) {
|
|
894
|
-
prev.value = pre + posix2;
|
|
895
|
-
state.backtrack = true;
|
|
896
|
-
advance();
|
|
897
|
-
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
898
|
-
bos.output = ONE_CHAR;
|
|
899
|
-
}
|
|
900
|
-
continue;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
906
|
-
value = `\\${value}`;
|
|
907
|
-
}
|
|
908
|
-
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
909
|
-
value = `\\${value}`;
|
|
910
|
-
}
|
|
911
|
-
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
912
|
-
value = "^";
|
|
913
|
-
}
|
|
914
|
-
prev.value += value;
|
|
915
|
-
append({ value });
|
|
916
|
-
continue;
|
|
917
|
-
}
|
|
918
|
-
if (state.quotes === 1 && value !== '"') {
|
|
919
|
-
value = utils.escapeRegex(value);
|
|
920
|
-
prev.value += value;
|
|
921
|
-
append({ value });
|
|
922
|
-
continue;
|
|
923
|
-
}
|
|
924
|
-
if (value === '"') {
|
|
925
|
-
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
926
|
-
if (opts.keepQuotes === true) {
|
|
927
|
-
push({ type: "text", value });
|
|
928
|
-
}
|
|
929
|
-
continue;
|
|
930
|
-
}
|
|
931
|
-
if (value === "(") {
|
|
932
|
-
increment("parens");
|
|
933
|
-
push({ type: "paren", value });
|
|
934
|
-
continue;
|
|
935
|
-
}
|
|
936
|
-
if (value === ")") {
|
|
937
|
-
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
938
|
-
throw new SyntaxError(syntaxError("opening", "("));
|
|
939
|
-
}
|
|
940
|
-
const extglob = extglobs[extglobs.length - 1];
|
|
941
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
|
942
|
-
extglobClose(extglobs.pop());
|
|
943
|
-
continue;
|
|
944
|
-
}
|
|
945
|
-
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
946
|
-
decrement("parens");
|
|
947
|
-
continue;
|
|
948
|
-
}
|
|
949
|
-
if (value === "[") {
|
|
950
|
-
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
951
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
952
|
-
throw new SyntaxError(syntaxError("closing", "]"));
|
|
953
|
-
}
|
|
954
|
-
value = `\\${value}`;
|
|
955
|
-
} else {
|
|
956
|
-
increment("brackets");
|
|
957
|
-
}
|
|
958
|
-
push({ type: "bracket", value });
|
|
959
|
-
continue;
|
|
960
|
-
}
|
|
961
|
-
if (value === "]") {
|
|
962
|
-
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
963
|
-
push({ type: "text", value, output: `\\${value}` });
|
|
964
|
-
continue;
|
|
965
|
-
}
|
|
966
|
-
if (state.brackets === 0) {
|
|
967
|
-
if (opts.strictBrackets === true) {
|
|
968
|
-
throw new SyntaxError(syntaxError("opening", "["));
|
|
969
|
-
}
|
|
970
|
-
push({ type: "text", value, output: `\\${value}` });
|
|
971
|
-
continue;
|
|
972
|
-
}
|
|
973
|
-
decrement("brackets");
|
|
974
|
-
const prevValue = prev.value.slice(1);
|
|
975
|
-
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
976
|
-
value = `/${value}`;
|
|
977
|
-
}
|
|
978
|
-
prev.value += value;
|
|
979
|
-
append({ value });
|
|
980
|
-
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
981
|
-
continue;
|
|
982
|
-
}
|
|
983
|
-
const escaped = utils.escapeRegex(prev.value);
|
|
984
|
-
state.output = state.output.slice(0, -prev.value.length);
|
|
985
|
-
if (opts.literalBrackets === true) {
|
|
986
|
-
state.output += escaped;
|
|
987
|
-
prev.value = escaped;
|
|
988
|
-
continue;
|
|
989
|
-
}
|
|
990
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
991
|
-
state.output += prev.value;
|
|
992
|
-
continue;
|
|
993
|
-
}
|
|
994
|
-
if (value === "{" && opts.nobrace !== true) {
|
|
995
|
-
increment("braces");
|
|
996
|
-
const open = {
|
|
997
|
-
type: "brace",
|
|
998
|
-
value,
|
|
999
|
-
output: "(",
|
|
1000
|
-
outputIndex: state.output.length,
|
|
1001
|
-
tokensIndex: state.tokens.length
|
|
1002
|
-
};
|
|
1003
|
-
braces.push(open);
|
|
1004
|
-
push(open);
|
|
1005
|
-
continue;
|
|
1006
|
-
}
|
|
1007
|
-
if (value === "}") {
|
|
1008
|
-
const brace = braces[braces.length - 1];
|
|
1009
|
-
if (opts.nobrace === true || !brace) {
|
|
1010
|
-
push({ type: "text", value, output: value });
|
|
1011
|
-
continue;
|
|
1012
|
-
}
|
|
1013
|
-
let output = ")";
|
|
1014
|
-
if (brace.dots === true) {
|
|
1015
|
-
const arr = tokens.slice();
|
|
1016
|
-
const range = [];
|
|
1017
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
1018
|
-
tokens.pop();
|
|
1019
|
-
if (arr[i].type === "brace") {
|
|
1020
|
-
break;
|
|
1021
|
-
}
|
|
1022
|
-
if (arr[i].type !== "dots") {
|
|
1023
|
-
range.unshift(arr[i].value);
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
output = expandRange(range, opts);
|
|
1027
|
-
state.backtrack = true;
|
|
1028
|
-
}
|
|
1029
|
-
if (brace.comma !== true && brace.dots !== true) {
|
|
1030
|
-
const out = state.output.slice(0, brace.outputIndex);
|
|
1031
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1032
|
-
brace.value = brace.output = "\\{";
|
|
1033
|
-
value = output = "\\}";
|
|
1034
|
-
state.output = out;
|
|
1035
|
-
for (const t of toks) {
|
|
1036
|
-
state.output += t.output || t.value;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
push({ type: "brace", value, output });
|
|
1040
|
-
decrement("braces");
|
|
1041
|
-
braces.pop();
|
|
1042
|
-
continue;
|
|
1043
|
-
}
|
|
1044
|
-
if (value === "|") {
|
|
1045
|
-
if (extglobs.length > 0) {
|
|
1046
|
-
extglobs[extglobs.length - 1].conditions++;
|
|
1047
|
-
}
|
|
1048
|
-
push({ type: "text", value });
|
|
1049
|
-
continue;
|
|
1050
|
-
}
|
|
1051
|
-
if (value === ",") {
|
|
1052
|
-
let output = value;
|
|
1053
|
-
const brace = braces[braces.length - 1];
|
|
1054
|
-
if (brace && stack[stack.length - 1] === "braces") {
|
|
1055
|
-
brace.comma = true;
|
|
1056
|
-
output = "|";
|
|
1057
|
-
}
|
|
1058
|
-
push({ type: "comma", value, output });
|
|
1059
|
-
continue;
|
|
1060
|
-
}
|
|
1061
|
-
if (value === "/") {
|
|
1062
|
-
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
1063
|
-
state.start = state.index + 1;
|
|
1064
|
-
state.consumed = "";
|
|
1065
|
-
state.output = "";
|
|
1066
|
-
tokens.pop();
|
|
1067
|
-
prev = bos;
|
|
1068
|
-
continue;
|
|
1069
|
-
}
|
|
1070
|
-
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
1071
|
-
continue;
|
|
1072
|
-
}
|
|
1073
|
-
if (value === ".") {
|
|
1074
|
-
if (state.braces > 0 && prev.type === "dot") {
|
|
1075
|
-
if (prev.value === ".") prev.output = DOT_LITERAL;
|
|
1076
|
-
const brace = braces[braces.length - 1];
|
|
1077
|
-
prev.type = "dots";
|
|
1078
|
-
prev.output += value;
|
|
1079
|
-
prev.value += value;
|
|
1080
|
-
brace.dots = true;
|
|
1081
|
-
continue;
|
|
1082
|
-
}
|
|
1083
|
-
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
1084
|
-
push({ type: "text", value, output: DOT_LITERAL });
|
|
1085
|
-
continue;
|
|
1086
|
-
}
|
|
1087
|
-
push({ type: "dot", value, output: DOT_LITERAL });
|
|
1088
|
-
continue;
|
|
1089
|
-
}
|
|
1090
|
-
if (value === "?") {
|
|
1091
|
-
const isGroup = prev && prev.value === "(";
|
|
1092
|
-
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1093
|
-
extglobOpen("qmark", value);
|
|
1094
|
-
continue;
|
|
1095
|
-
}
|
|
1096
|
-
if (prev && prev.type === "paren") {
|
|
1097
|
-
const next = peek();
|
|
1098
|
-
let output = value;
|
|
1099
|
-
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
1100
|
-
output = `\\${value}`;
|
|
1101
|
-
}
|
|
1102
|
-
push({ type: "text", value, output });
|
|
1103
|
-
continue;
|
|
1104
|
-
}
|
|
1105
|
-
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
1106
|
-
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
1107
|
-
continue;
|
|
1108
|
-
}
|
|
1109
|
-
push({ type: "qmark", value, output: QMARK });
|
|
1110
|
-
continue;
|
|
1111
|
-
}
|
|
1112
|
-
if (value === "!") {
|
|
1113
|
-
if (opts.noextglob !== true && peek() === "(") {
|
|
1114
|
-
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
1115
|
-
extglobOpen("negate", value);
|
|
1116
|
-
continue;
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
if (opts.nonegate !== true && state.index === 0) {
|
|
1120
|
-
negate();
|
|
1121
|
-
continue;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
if (value === "+") {
|
|
1125
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1126
|
-
extglobOpen("plus", value);
|
|
1127
|
-
continue;
|
|
1128
|
-
}
|
|
1129
|
-
if (prev && prev.value === "(" || opts.regex === false) {
|
|
1130
|
-
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
1131
|
-
continue;
|
|
1132
|
-
}
|
|
1133
|
-
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
1134
|
-
push({ type: "plus", value });
|
|
1135
|
-
continue;
|
|
1136
|
-
}
|
|
1137
|
-
push({ type: "plus", value: PLUS_LITERAL });
|
|
1138
|
-
continue;
|
|
1139
|
-
}
|
|
1140
|
-
if (value === "@") {
|
|
1141
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1142
|
-
push({ type: "at", extglob: true, value, output: "" });
|
|
1143
|
-
continue;
|
|
1144
|
-
}
|
|
1145
|
-
push({ type: "text", value });
|
|
1146
|
-
continue;
|
|
1147
|
-
}
|
|
1148
|
-
if (value !== "*") {
|
|
1149
|
-
if (value === "$" || value === "^") {
|
|
1150
|
-
value = `\\${value}`;
|
|
1151
|
-
}
|
|
1152
|
-
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1153
|
-
if (match) {
|
|
1154
|
-
value += match[0];
|
|
1155
|
-
state.index += match[0].length;
|
|
1156
|
-
}
|
|
1157
|
-
push({ type: "text", value });
|
|
1158
|
-
continue;
|
|
1159
|
-
}
|
|
1160
|
-
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
1161
|
-
prev.type = "star";
|
|
1162
|
-
prev.star = true;
|
|
1163
|
-
prev.value += value;
|
|
1164
|
-
prev.output = star;
|
|
1165
|
-
state.backtrack = true;
|
|
1166
|
-
state.globstar = true;
|
|
1167
|
-
consume(value);
|
|
1168
|
-
continue;
|
|
1169
|
-
}
|
|
1170
|
-
let rest = remaining();
|
|
1171
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
1172
|
-
extglobOpen("star", value);
|
|
1173
|
-
continue;
|
|
1174
|
-
}
|
|
1175
|
-
if (prev.type === "star") {
|
|
1176
|
-
if (opts.noglobstar === true) {
|
|
1177
|
-
consume(value);
|
|
1178
|
-
continue;
|
|
1179
|
-
}
|
|
1180
|
-
const prior = prev.prev;
|
|
1181
|
-
const before = prior.prev;
|
|
1182
|
-
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
1183
|
-
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
1184
|
-
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
1185
|
-
push({ type: "star", value, output: "" });
|
|
1186
|
-
continue;
|
|
1187
|
-
}
|
|
1188
|
-
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
1189
|
-
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
1190
|
-
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
1191
|
-
push({ type: "star", value, output: "" });
|
|
1192
|
-
continue;
|
|
1193
|
-
}
|
|
1194
|
-
while (rest.slice(0, 3) === "/**") {
|
|
1195
|
-
const after = input[state.index + 4];
|
|
1196
|
-
if (after && after !== "/") {
|
|
1197
|
-
break;
|
|
1198
|
-
}
|
|
1199
|
-
rest = rest.slice(3);
|
|
1200
|
-
consume("/**", 3);
|
|
1201
|
-
}
|
|
1202
|
-
if (prior.type === "bos" && eos()) {
|
|
1203
|
-
prev.type = "globstar";
|
|
1204
|
-
prev.value += value;
|
|
1205
|
-
prev.output = globstar(opts);
|
|
1206
|
-
state.output = prev.output;
|
|
1207
|
-
state.globstar = true;
|
|
1208
|
-
consume(value);
|
|
1209
|
-
continue;
|
|
1210
|
-
}
|
|
1211
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
1212
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1213
|
-
prior.output = `(?:${prior.output}`;
|
|
1214
|
-
prev.type = "globstar";
|
|
1215
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
1216
|
-
prev.value += value;
|
|
1217
|
-
state.globstar = true;
|
|
1218
|
-
state.output += prior.output + prev.output;
|
|
1219
|
-
consume(value);
|
|
1220
|
-
continue;
|
|
1221
|
-
}
|
|
1222
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
1223
|
-
const end = rest[1] !== void 0 ? "|$" : "";
|
|
1224
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1225
|
-
prior.output = `(?:${prior.output}`;
|
|
1226
|
-
prev.type = "globstar";
|
|
1227
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
1228
|
-
prev.value += value;
|
|
1229
|
-
state.output += prior.output + prev.output;
|
|
1230
|
-
state.globstar = true;
|
|
1231
|
-
consume(value + advance());
|
|
1232
|
-
push({ type: "slash", value: "/", output: "" });
|
|
1233
|
-
continue;
|
|
1234
|
-
}
|
|
1235
|
-
if (prior.type === "bos" && rest[0] === "/") {
|
|
1236
|
-
prev.type = "globstar";
|
|
1237
|
-
prev.value += value;
|
|
1238
|
-
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
1239
|
-
state.output = prev.output;
|
|
1240
|
-
state.globstar = true;
|
|
1241
|
-
consume(value + advance());
|
|
1242
|
-
push({ type: "slash", value: "/", output: "" });
|
|
1243
|
-
continue;
|
|
1244
|
-
}
|
|
1245
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
1246
|
-
prev.type = "globstar";
|
|
1247
|
-
prev.output = globstar(opts);
|
|
1248
|
-
prev.value += value;
|
|
1249
|
-
state.output += prev.output;
|
|
1250
|
-
state.globstar = true;
|
|
1251
|
-
consume(value);
|
|
1252
|
-
continue;
|
|
1253
|
-
}
|
|
1254
|
-
const token = { type: "star", value, output: star };
|
|
1255
|
-
if (opts.bash === true) {
|
|
1256
|
-
token.output = ".*?";
|
|
1257
|
-
if (prev.type === "bos" || prev.type === "slash") {
|
|
1258
|
-
token.output = nodot + token.output;
|
|
1259
|
-
}
|
|
1260
|
-
push(token);
|
|
1261
|
-
continue;
|
|
1262
|
-
}
|
|
1263
|
-
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
1264
|
-
token.output = value;
|
|
1265
|
-
push(token);
|
|
1266
|
-
continue;
|
|
1267
|
-
}
|
|
1268
|
-
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
1269
|
-
if (prev.type === "dot") {
|
|
1270
|
-
state.output += NO_DOT_SLASH;
|
|
1271
|
-
prev.output += NO_DOT_SLASH;
|
|
1272
|
-
} else if (opts.dot === true) {
|
|
1273
|
-
state.output += NO_DOTS_SLASH;
|
|
1274
|
-
prev.output += NO_DOTS_SLASH;
|
|
1275
|
-
} else {
|
|
1276
|
-
state.output += nodot;
|
|
1277
|
-
prev.output += nodot;
|
|
1278
|
-
}
|
|
1279
|
-
if (peek() !== "*") {
|
|
1280
|
-
state.output += ONE_CHAR;
|
|
1281
|
-
prev.output += ONE_CHAR;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
push(token);
|
|
1285
|
-
}
|
|
1286
|
-
while (state.brackets > 0) {
|
|
1287
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
1288
|
-
state.output = utils.escapeLast(state.output, "[");
|
|
1289
|
-
decrement("brackets");
|
|
1290
|
-
}
|
|
1291
|
-
while (state.parens > 0) {
|
|
1292
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
1293
|
-
state.output = utils.escapeLast(state.output, "(");
|
|
1294
|
-
decrement("parens");
|
|
1295
|
-
}
|
|
1296
|
-
while (state.braces > 0) {
|
|
1297
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
1298
|
-
state.output = utils.escapeLast(state.output, "{");
|
|
1299
|
-
decrement("braces");
|
|
1300
|
-
}
|
|
1301
|
-
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
1302
|
-
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
1303
|
-
}
|
|
1304
|
-
if (state.backtrack === true) {
|
|
1305
|
-
state.output = "";
|
|
1306
|
-
for (const token of state.tokens) {
|
|
1307
|
-
state.output += token.output != null ? token.output : token.value;
|
|
1308
|
-
if (token.suffix) {
|
|
1309
|
-
state.output += token.suffix;
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
return state;
|
|
1314
|
-
}, "parse");
|
|
1315
|
-
parse.fastpaths = (input, options) => {
|
|
1316
|
-
const opts = { ...options };
|
|
1317
|
-
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1318
|
-
const len = input.length;
|
|
1319
|
-
if (len > max) {
|
|
1320
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1321
|
-
}
|
|
1322
|
-
input = REPLACEMENTS[input] || input;
|
|
1323
|
-
const {
|
|
1324
|
-
DOT_LITERAL,
|
|
1325
|
-
SLASH_LITERAL,
|
|
1326
|
-
ONE_CHAR,
|
|
1327
|
-
DOTS_SLASH,
|
|
1328
|
-
NO_DOT,
|
|
1329
|
-
NO_DOTS,
|
|
1330
|
-
NO_DOTS_SLASH,
|
|
1331
|
-
STAR,
|
|
1332
|
-
START_ANCHOR
|
|
1333
|
-
} = constants.globChars(opts.windows);
|
|
1334
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
1335
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
1336
|
-
const capture = opts.capture ? "" : "?:";
|
|
1337
|
-
const state = { negated: false, prefix: "" };
|
|
1338
|
-
let star = opts.bash === true ? ".*?" : STAR;
|
|
1339
|
-
if (opts.capture) {
|
|
1340
|
-
star = `(${star})`;
|
|
1341
|
-
}
|
|
1342
|
-
const globstar = /* @__PURE__ */ __name((opts2) => {
|
|
1343
|
-
if (opts2.noglobstar === true) return star;
|
|
1344
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1345
|
-
}, "globstar");
|
|
1346
|
-
const create = /* @__PURE__ */ __name((str) => {
|
|
1347
|
-
switch (str) {
|
|
1348
|
-
case "*":
|
|
1349
|
-
return `${nodot}${ONE_CHAR}${star}`;
|
|
1350
|
-
case ".*":
|
|
1351
|
-
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1352
|
-
case "*.*":
|
|
1353
|
-
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1354
|
-
case "*/*":
|
|
1355
|
-
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
1356
|
-
case "**":
|
|
1357
|
-
return nodot + globstar(opts);
|
|
1358
|
-
case "**/*":
|
|
1359
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
1360
|
-
case "**/*.*":
|
|
1361
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1362
|
-
case "**/.*":
|
|
1363
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1364
|
-
default: {
|
|
1365
|
-
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1366
|
-
if (!match) return;
|
|
1367
|
-
const source2 = create(match[1]);
|
|
1368
|
-
if (!source2) return;
|
|
1369
|
-
return source2 + DOT_LITERAL + match[2];
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
}, "create");
|
|
1373
|
-
const output = utils.removePrefix(input, state);
|
|
1374
|
-
let source = create(output);
|
|
1375
|
-
if (source && opts.strictSlashes !== true) {
|
|
1376
|
-
source += `${SLASH_LITERAL}?`;
|
|
1377
|
-
}
|
|
1378
|
-
return source;
|
|
1379
|
-
};
|
|
1380
|
-
module.exports = parse;
|
|
1381
|
-
}
|
|
1382
|
-
});
|
|
1383
|
-
|
|
1384
|
-
// ../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/picomatch.js
|
|
1385
|
-
var require_picomatch = __commonJS({
|
|
1386
|
-
"../../node_modules/@rollup/pluginutils/node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
1387
|
-
"use strict";
|
|
1388
|
-
var scan = require_scan();
|
|
1389
|
-
var parse = require_parse();
|
|
1390
|
-
var utils = require_utils();
|
|
1391
|
-
var constants = require_constants();
|
|
1392
|
-
var isObject = /* @__PURE__ */ __name((val) => val && typeof val === "object" && !Array.isArray(val), "isObject");
|
|
1393
|
-
var picomatch = /* @__PURE__ */ __name((glob, options, returnState = false) => {
|
|
1394
|
-
if (Array.isArray(glob)) {
|
|
1395
|
-
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
1396
|
-
const arrayMatcher = /* @__PURE__ */ __name((str) => {
|
|
1397
|
-
for (const isMatch of fns) {
|
|
1398
|
-
const state2 = isMatch(str);
|
|
1399
|
-
if (state2) return state2;
|
|
1400
|
-
}
|
|
1401
|
-
return false;
|
|
1402
|
-
}, "arrayMatcher");
|
|
1403
|
-
return arrayMatcher;
|
|
1404
|
-
}
|
|
1405
|
-
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
1406
|
-
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
1407
|
-
throw new TypeError("Expected pattern to be a non-empty string");
|
|
1408
|
-
}
|
|
1409
|
-
const opts = options || {};
|
|
1410
|
-
const posix2 = opts.windows;
|
|
1411
|
-
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
1412
|
-
const state = regex.state;
|
|
1413
|
-
delete regex.state;
|
|
1414
|
-
let isIgnored = /* @__PURE__ */ __name(() => false, "isIgnored");
|
|
1415
|
-
if (opts.ignore) {
|
|
1416
|
-
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
1417
|
-
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
1418
|
-
}
|
|
1419
|
-
const matcher = /* @__PURE__ */ __name((input, returnObject = false) => {
|
|
1420
|
-
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix: posix2 });
|
|
1421
|
-
const result = { glob, state, regex, posix: posix2, input, output, match, isMatch };
|
|
1422
|
-
if (typeof opts.onResult === "function") {
|
|
1423
|
-
opts.onResult(result);
|
|
1424
|
-
}
|
|
1425
|
-
if (isMatch === false) {
|
|
1426
|
-
result.isMatch = false;
|
|
1427
|
-
return returnObject ? result : false;
|
|
1428
|
-
}
|
|
1429
|
-
if (isIgnored(input)) {
|
|
1430
|
-
if (typeof opts.onIgnore === "function") {
|
|
1431
|
-
opts.onIgnore(result);
|
|
1432
|
-
}
|
|
1433
|
-
result.isMatch = false;
|
|
1434
|
-
return returnObject ? result : false;
|
|
1435
|
-
}
|
|
1436
|
-
if (typeof opts.onMatch === "function") {
|
|
1437
|
-
opts.onMatch(result);
|
|
1438
|
-
}
|
|
1439
|
-
return returnObject ? result : true;
|
|
1440
|
-
}, "matcher");
|
|
1441
|
-
if (returnState) {
|
|
1442
|
-
matcher.state = state;
|
|
1443
|
-
}
|
|
1444
|
-
return matcher;
|
|
1445
|
-
}, "picomatch");
|
|
1446
|
-
picomatch.test = (input, regex, options, { glob, posix: posix2 } = {}) => {
|
|
1447
|
-
if (typeof input !== "string") {
|
|
1448
|
-
throw new TypeError("Expected input to be a string");
|
|
1449
|
-
}
|
|
1450
|
-
if (input === "") {
|
|
1451
|
-
return { isMatch: false, output: "" };
|
|
1452
|
-
}
|
|
1453
|
-
const opts = options || {};
|
|
1454
|
-
const format = opts.format || (posix2 ? utils.toPosixSlashes : null);
|
|
1455
|
-
let match = input === glob;
|
|
1456
|
-
let output = match && format ? format(input) : input;
|
|
1457
|
-
if (match === false) {
|
|
1458
|
-
output = format ? format(input) : input;
|
|
1459
|
-
match = output === glob;
|
|
1460
|
-
}
|
|
1461
|
-
if (match === false || opts.capture === true) {
|
|
1462
|
-
if (opts.matchBase === true || opts.basename === true) {
|
|
1463
|
-
match = picomatch.matchBase(input, regex, options, posix2);
|
|
1464
|
-
} else {
|
|
1465
|
-
match = regex.exec(output);
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
return { isMatch: Boolean(match), match, output };
|
|
1469
|
-
};
|
|
1470
|
-
picomatch.matchBase = (input, glob, options) => {
|
|
1471
|
-
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
1472
|
-
return regex.test(utils.basename(input));
|
|
1473
|
-
};
|
|
1474
|
-
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
1475
|
-
picomatch.parse = (pattern, options) => {
|
|
1476
|
-
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
1477
|
-
return parse(pattern, { ...options, fastpaths: false });
|
|
1478
|
-
};
|
|
1479
|
-
picomatch.scan = (input, options) => scan(input, options);
|
|
1480
|
-
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
1481
|
-
if (returnOutput === true) {
|
|
1482
|
-
return state.output;
|
|
1483
|
-
}
|
|
1484
|
-
const opts = options || {};
|
|
1485
|
-
const prepend = opts.contains ? "" : "^";
|
|
1486
|
-
const append = opts.contains ? "" : "$";
|
|
1487
|
-
let source = `${prepend}(?:${state.output})${append}`;
|
|
1488
|
-
if (state && state.negated === true) {
|
|
1489
|
-
source = `^(?!${source}).*$`;
|
|
1490
|
-
}
|
|
1491
|
-
const regex = picomatch.toRegex(source, options);
|
|
1492
|
-
if (returnState === true) {
|
|
1493
|
-
regex.state = state;
|
|
1494
|
-
}
|
|
1495
|
-
return regex;
|
|
1496
|
-
};
|
|
1497
|
-
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
1498
|
-
if (!input || typeof input !== "string") {
|
|
1499
|
-
throw new TypeError("Expected a non-empty string");
|
|
1500
|
-
}
|
|
1501
|
-
let parsed = { negated: false, fastpaths: true };
|
|
1502
|
-
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
1503
|
-
parsed.output = parse.fastpaths(input, options);
|
|
1504
|
-
}
|
|
1505
|
-
if (!parsed.output) {
|
|
1506
|
-
parsed = parse(input, options);
|
|
1507
|
-
}
|
|
1508
|
-
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
1509
|
-
};
|
|
1510
|
-
picomatch.toRegex = (source, options) => {
|
|
1511
|
-
try {
|
|
1512
|
-
const opts = options || {};
|
|
1513
|
-
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
1514
|
-
} catch (err) {
|
|
1515
|
-
if (options && options.debug === true) throw err;
|
|
1516
|
-
return /$^/;
|
|
1517
|
-
}
|
|
1518
|
-
};
|
|
1519
|
-
picomatch.constants = constants;
|
|
1520
|
-
module.exports = picomatch;
|
|
1521
|
-
}
|
|
1522
|
-
});
|
|
1523
|
-
|
|
1524
|
-
// ../../node_modules/@rollup/pluginutils/node_modules/picomatch/index.js
|
|
1525
|
-
var require_picomatch2 = __commonJS({
|
|
1526
|
-
"../../node_modules/@rollup/pluginutils/node_modules/picomatch/index.js"(exports, module) {
|
|
1527
|
-
"use strict";
|
|
1528
|
-
var pico = require_picomatch();
|
|
1529
|
-
var utils = require_utils();
|
|
1530
|
-
function picomatch(glob, options, returnState = false) {
|
|
1531
|
-
if (options && (options.windows === null || options.windows === void 0)) {
|
|
1532
|
-
options = { ...options, windows: utils.isWindows() };
|
|
1533
|
-
}
|
|
1534
|
-
return pico(glob, options, returnState);
|
|
1535
|
-
}
|
|
1536
|
-
__name(picomatch, "picomatch");
|
|
1537
|
-
Object.assign(picomatch, pico);
|
|
1538
|
-
module.exports = picomatch;
|
|
1539
|
-
}
|
|
1540
|
-
});
|
|
1541
|
-
|
|
1542
|
-
// ../../node_modules/@rollup/pluginutils/dist/es/index.js
|
|
1543
|
-
import { extname, win32, posix, isAbsolute, resolve } from "path";
|
|
1544
|
-
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
1545
|
-
function isArray(arg) {
|
|
1546
|
-
return Array.isArray(arg);
|
|
1547
|
-
}
|
|
1548
|
-
__name(isArray, "isArray");
|
|
1549
|
-
function ensureArray(thing) {
|
|
1550
|
-
if (isArray(thing))
|
|
1551
|
-
return thing;
|
|
1552
|
-
if (thing == null)
|
|
1553
|
-
return [];
|
|
1554
|
-
return [thing];
|
|
1555
|
-
}
|
|
1556
|
-
__name(ensureArray, "ensureArray");
|
|
1557
|
-
var normalizePathRegExp = new RegExp(`\\${win32.sep}`, "g");
|
|
1558
|
-
var normalizePath = /* @__PURE__ */ __name(function normalizePath2(filename) {
|
|
1559
|
-
return filename.replace(normalizePathRegExp, posix.sep);
|
|
1560
|
-
}, "normalizePath");
|
|
1561
|
-
function getMatcherString(id, resolutionBase) {
|
|
1562
|
-
if (resolutionBase === false || isAbsolute(id) || id.startsWith("**")) {
|
|
1563
|
-
return normalizePath(id);
|
|
1564
|
-
}
|
|
1565
|
-
const basePath = normalizePath(resolve(resolutionBase || "")).replace(/[-^$*+?.()|[\]{}]/g, "\\$&");
|
|
1566
|
-
return posix.join(basePath, normalizePath(id));
|
|
1567
|
-
}
|
|
1568
|
-
__name(getMatcherString, "getMatcherString");
|
|
1569
|
-
var createFilter = /* @__PURE__ */ __name(function createFilter2(include, exclude, options) {
|
|
1570
|
-
const resolutionBase = options && options.resolve;
|
|
1571
|
-
const getMatcher = /* @__PURE__ */ __name((id) => id instanceof RegExp ? id : {
|
|
1572
|
-
test: /* @__PURE__ */ __name((what) => {
|
|
1573
|
-
const pattern = getMatcherString(id, resolutionBase);
|
|
1574
|
-
const fn = (0, import_picomatch.default)(pattern, { dot: true });
|
|
1575
|
-
const result = fn(what);
|
|
1576
|
-
return result;
|
|
1577
|
-
}, "test")
|
|
1578
|
-
}, "getMatcher");
|
|
1579
|
-
const includeMatchers = ensureArray(include).map(getMatcher);
|
|
1580
|
-
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
|
1581
|
-
if (!includeMatchers.length && !excludeMatchers.length)
|
|
1582
|
-
return (id) => typeof id === "string" && !id.includes("\0");
|
|
1583
|
-
return /* @__PURE__ */ __name(function result(id) {
|
|
1584
|
-
if (typeof id !== "string")
|
|
1585
|
-
return false;
|
|
1586
|
-
if (id.includes("\0"))
|
|
1587
|
-
return false;
|
|
1588
|
-
const pathId = normalizePath(id);
|
|
1589
|
-
for (let i = 0; i < excludeMatchers.length; ++i) {
|
|
1590
|
-
const matcher = excludeMatchers[i];
|
|
1591
|
-
if (matcher instanceof RegExp) {
|
|
1592
|
-
matcher.lastIndex = 0;
|
|
1593
|
-
}
|
|
1594
|
-
if (matcher.test(pathId))
|
|
1595
|
-
return false;
|
|
1596
|
-
}
|
|
1597
|
-
for (let i = 0; i < includeMatchers.length; ++i) {
|
|
1598
|
-
const matcher = includeMatchers[i];
|
|
1599
|
-
if (matcher instanceof RegExp) {
|
|
1600
|
-
matcher.lastIndex = 0;
|
|
1601
|
-
}
|
|
1602
|
-
if (matcher.test(pathId))
|
|
1603
|
-
return true;
|
|
1604
|
-
}
|
|
1605
|
-
return !includeMatchers.length;
|
|
1606
|
-
}, "result");
|
|
1607
|
-
}, "createFilter");
|
|
1608
|
-
var reservedWords = "break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public";
|
|
1609
|
-
var builtins = "arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl";
|
|
1610
|
-
var forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(" "));
|
|
1611
|
-
forbiddenIdentifiers.add("");
|
|
1612
|
-
var hasStringIsWellFormed = "isWellFormed" in String.prototype;
|
|
1613
|
-
|
|
1614
|
-
// src/mdx-plugin.ts
|
|
1615
|
-
async function mdxPlugin(options) {
|
|
1616
|
-
const include = /\.mdx$/;
|
|
1617
|
-
const filter = createFilter(include);
|
|
1618
|
-
const { presets } = options;
|
|
1619
|
-
const presetOptions = await presets.apply("options", {});
|
|
1620
|
-
const mdxPluginOptions = presetOptions?.mdxPluginOptions;
|
|
1621
|
-
const rehypeSlug = (await import("./rehype-slug-NPV5OLTF.js")).default;
|
|
1622
|
-
const rehypeExternalLinks = (await import("./rehype-external-links-32F3YIMH.js")).default;
|
|
1623
|
-
return {
|
|
1624
|
-
name: "storybook:mdx-plugin",
|
|
1625
|
-
enforce: "pre",
|
|
1626
|
-
async transform(src, id) {
|
|
1627
|
-
if (!filter(id)) {
|
|
1628
|
-
return void 0;
|
|
1629
|
-
}
|
|
1630
|
-
const mdxLoaderOptions = await presets.apply("mdxLoaderOptions", {
|
|
1631
|
-
...mdxPluginOptions,
|
|
1632
|
-
mdxCompileOptions: {
|
|
1633
|
-
providerImportSource: import.meta.resolve("@storybook/addon-docs/mdx-react-shim"),
|
|
1634
|
-
...mdxPluginOptions?.mdxCompileOptions,
|
|
1635
|
-
rehypePlugins: [
|
|
1636
|
-
...mdxPluginOptions?.mdxCompileOptions?.rehypePlugins ?? [],
|
|
1637
|
-
rehypeSlug,
|
|
1638
|
-
rehypeExternalLinks
|
|
1639
|
-
]
|
|
1640
|
-
}
|
|
1641
|
-
});
|
|
1642
|
-
const code = String(await compile(src, mdxLoaderOptions));
|
|
1643
|
-
return {
|
|
1644
|
-
code,
|
|
1645
|
-
// TODO: support source maps
|
|
1646
|
-
map: null
|
|
1647
|
-
};
|
|
1648
|
-
}
|
|
1649
|
-
};
|
|
1650
|
-
}
|
|
1651
|
-
__name(mdxPlugin, "mdxPlugin");
|
|
1652
|
-
export {
|
|
1653
|
-
mdxPlugin
|
|
1654
|
-
};
|