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