@rspress/core 2.0.7 → 2.0.9

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.
Files changed (107) hide show
  1. package/dist/0~execa.js +32 -41
  2. package/dist/0~rslib-runtime.js +38 -0
  3. package/dist/0~tinypool.js +828 -0
  4. package/dist/{8311.js → 1688.js} +1 -7
  5. package/dist/{7397.js → 2240.js} +4 -2
  6. package/dist/{1361.js → 3294.js} +1 -1
  7. package/dist/{1965.js → 3425.js} +0 -1
  8. package/dist/740.js +2470 -0
  9. package/dist/8006.js +77 -0
  10. package/dist/8857.js +4827 -0
  11. package/dist/8857.js.LICENSE.txt +41 -0
  12. package/dist/cli/index.js +7 -3
  13. package/dist/config/loadConfigFile.js +1 -1
  14. package/dist/eject-theme/components/CodeBlock/index.scss +4 -0
  15. package/dist/eject-theme/components/CodeBlock/index.tsx +14 -6
  16. package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.scss +1 -1
  17. package/dist/eject-theme/components/CodeButtonGroup/index.scss +1 -1
  18. package/dist/eject-theme/components/DocContent/doc.scss +2 -0
  19. package/dist/eject-theme/components/FallbackHeading/index.tsx +1 -1
  20. package/dist/eject-theme/components/Link/useLinkNavigate.ts +4 -1
  21. package/dist/eject-theme/components/Llms/LlmsCopyButton.scss +3 -3
  22. package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -1
  23. package/dist/eject-theme/components/Steps/index.scss +32 -13
  24. package/dist/node/PluginDriver.js +2 -2
  25. package/dist/node/auto-nav-sidebar/index.js +2 -2
  26. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  27. package/dist/node/auto-nav-sidebar/normalize.js +9 -5
  28. package/dist/node/auto-nav-sidebar/utils.js +8 -2
  29. package/dist/node/auto-nav-sidebar/walk.js +2 -8
  30. package/dist/node/constants.js +1 -1
  31. package/dist/node/eject.js +14 -8
  32. package/dist/node/initRsbuild.js +6 -6
  33. package/dist/node/logger/hint.js +9 -6
  34. package/dist/node/mdx/options.js +15 -4
  35. package/dist/node/mdx/processor.js +1 -1
  36. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  37. package/dist/node/mdx/rehypePlugins/headerAnchor.js +3 -2
  38. package/dist/node/mdx/rehypePlugins/shiki.d.ts +4 -1
  39. package/dist/node/mdx/rehypePlugins/shiki.js +5 -3
  40. package/dist/node/mdx/rehypePlugins/transformers/add-fold.d.ts +7 -1
  41. package/dist/node/mdx/rehypePlugins/transformers/add-fold.js +23 -6
  42. package/dist/node/mdx/rehypePlugins/transformers/index.js +6 -6
  43. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  44. package/dist/node/mdx/remarkPlugins/containerSyntax.js +7 -1
  45. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +6 -2
  46. package/dist/node/mdx/remarkPlugins/image.d.ts +7 -2
  47. package/dist/node/mdx/remarkPlugins/image.js +51 -2
  48. package/dist/node/mdx/remarkPlugins/link.js +7 -3
  49. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  50. package/dist/node/route/RoutePage.js +1 -1
  51. package/dist/node/route/RouteService.js +1 -1
  52. package/dist/node/route/extractPageData.js +77 -27
  53. package/dist/node/route/normalizeRoutePath.js +1 -1
  54. package/dist/node/runtimeModule/i18n.js +10 -6
  55. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  56. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  57. package/dist/node/runtimeModule/searchHooks.js +1 -1
  58. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  59. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  60. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  61. package/dist/node/serve.js +1 -1
  62. package/dist/node/ssg/renderPage.js +8 -4
  63. package/dist/node/ssg/renderPageWorker.js +1 -1
  64. package/dist/node/ssg/renderPages.js +9 -5
  65. package/dist/node/ssg/rsbuildPluginSSG.js +20 -7
  66. package/dist/node/ssg/ssgEnv.js +1 -1
  67. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  68. package/dist/node/ssg-md/llms/llmsTxt.js +3 -2
  69. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  70. package/dist/node/ssg-md/renderPage.js +8 -4
  71. package/dist/node/ssg-md/renderPages.js +7 -3
  72. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  73. package/dist/node/utils/checkLanguageParity.js +1 -1
  74. package/dist/node/utils/createHash.js +1 -1
  75. package/dist/node/utils/error.js +5 -2
  76. package/dist/node/utils/flattenMdxContent.js +3 -2
  77. package/dist/node/utils/fs.js +1 -1
  78. package/dist/node/utils/getPageKey.js +1 -1
  79. package/dist/node/utils/normalizePath.js +3 -2
  80. package/dist/node/utils/reactAlias.js +7 -3
  81. package/dist/runtime/App.js +4 -1
  82. package/dist/runtime/hooks/useWindowSize.test.js +10 -10
  83. package/dist/runtime/index.d.ts +2 -1
  84. package/dist/runtime/index.js +2 -1
  85. package/dist/runtime/initPageData.d.ts +3 -0
  86. package/dist/runtime/initPageData.js +37 -2
  87. package/dist/runtime/ssrClientEntry.js +4 -2
  88. package/dist/theme/assets/success.js +1 -1
  89. package/dist/theme/assets/wrapped.js +1 -1
  90. package/dist/theme/components/CodeBlock/index.css +4 -0
  91. package/dist/theme/components/CodeBlock/index.d.ts +0 -3
  92. package/dist/theme/components/CodeBlock/index.js +8 -3
  93. package/dist/theme/components/CodeButtonGroup/CopyCodeButton.css +3 -3
  94. package/dist/theme/components/CodeButtonGroup/index.css +3 -3
  95. package/dist/theme/components/DocContent/doc.css +1 -0
  96. package/dist/theme/components/FallbackHeading/index.js +1 -1
  97. package/dist/theme/components/Link/useLinkNavigate.js +3 -2
  98. package/dist/theme/components/Llms/LlmsCopyButton.css +9 -9
  99. package/dist/theme/components/Llms/LlmsViewOptions.css +2 -2
  100. package/dist/theme/components/Search/SearchPanel.js +1 -1
  101. package/dist/theme/components/Steps/index.css +23 -12
  102. package/dist/theme/logic/useThemeState.js +1 -1
  103. package/package.json +14 -17
  104. package/dist/4454.js +0 -8
  105. package/dist/4524.js +0 -71
  106. package/dist/8885.js +0 -4
  107. package/dist/rslib-runtime.js +0 -18
package/dist/740.js ADDED
@@ -0,0 +1,2470 @@
1
+ import node_path, { extname, join, relative as external_node_path_relative } from "node:path";
2
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
3
+ import { fileURLToPath } from "url";
4
+ import { createRequire } from "module";
5
+ import fs_0, * as __rspack_external_fs from "fs";
6
+ import path_0, { basename, dirname, normalize, posix, relative as external_path_relative, resolve, sep } from "path";
7
+ import { createRequire as __rspack_createRequire } from "node:module";
8
+ const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
9
+ __webpack_require__.add({
10
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
11
+ const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js");
12
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
13
+ function picomatch(glob, options, returnState = false) {
14
+ if (options && (null === options.windows || void 0 === options.windows)) options = {
15
+ ...options,
16
+ windows: utils.isWindows()
17
+ };
18
+ return pico(glob, options, returnState);
19
+ }
20
+ Object.assign(picomatch, pico);
21
+ module.exports = picomatch;
22
+ },
23
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js" (module) {
24
+ const WIN_SLASH = '\\\\/';
25
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
26
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
27
+ const DOT_LITERAL = '\\.';
28
+ const PLUS_LITERAL = '\\+';
29
+ const QMARK_LITERAL = '\\?';
30
+ const SLASH_LITERAL = '\\/';
31
+ const ONE_CHAR = '(?=.)';
32
+ const QMARK = '[^/]';
33
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
34
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
35
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
36
+ const NO_DOT = `(?!${DOT_LITERAL})`;
37
+ const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
38
+ const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
39
+ const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
40
+ const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
41
+ const STAR = `${QMARK}*?`;
42
+ const SEP = '/';
43
+ const POSIX_CHARS = {
44
+ DOT_LITERAL,
45
+ PLUS_LITERAL,
46
+ QMARK_LITERAL,
47
+ SLASH_LITERAL,
48
+ ONE_CHAR,
49
+ QMARK,
50
+ END_ANCHOR,
51
+ DOTS_SLASH,
52
+ NO_DOT,
53
+ NO_DOTS,
54
+ NO_DOT_SLASH,
55
+ NO_DOTS_SLASH,
56
+ QMARK_NO_DOT,
57
+ STAR,
58
+ START_ANCHOR,
59
+ SEP
60
+ };
61
+ const WINDOWS_CHARS = {
62
+ ...POSIX_CHARS,
63
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
64
+ QMARK: WIN_NO_SLASH,
65
+ STAR: `${WIN_NO_SLASH}*?`,
66
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
67
+ NO_DOT: `(?!${DOT_LITERAL})`,
68
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
69
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
70
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
71
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
72
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
73
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
74
+ SEP: '\\'
75
+ };
76
+ const POSIX_REGEX_SOURCE = {
77
+ __proto__: null,
78
+ alnum: 'a-zA-Z0-9',
79
+ alpha: 'a-zA-Z',
80
+ ascii: '\\x00-\\x7F',
81
+ blank: ' \\t',
82
+ cntrl: '\\x00-\\x1F\\x7F',
83
+ digit: '0-9',
84
+ graph: '\\x21-\\x7E',
85
+ lower: 'a-z',
86
+ print: '\\x20-\\x7E ',
87
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
88
+ space: ' \\t\\r\\n\\v\\f',
89
+ upper: 'A-Z',
90
+ word: 'A-Za-z0-9_',
91
+ xdigit: 'A-Fa-f0-9'
92
+ };
93
+ module.exports = {
94
+ DEFAULT_MAX_EXTGLOB_RECURSION,
95
+ MAX_LENGTH: 65536,
96
+ POSIX_REGEX_SOURCE,
97
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
98
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
99
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
100
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
101
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
102
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
103
+ REPLACEMENTS: {
104
+ __proto__: null,
105
+ '***': '*',
106
+ '**/**': '**',
107
+ '**/**/**': '**'
108
+ },
109
+ CHAR_0: 48,
110
+ CHAR_9: 57,
111
+ CHAR_UPPERCASE_A: 65,
112
+ CHAR_LOWERCASE_A: 97,
113
+ CHAR_UPPERCASE_Z: 90,
114
+ CHAR_LOWERCASE_Z: 122,
115
+ CHAR_LEFT_PARENTHESES: 40,
116
+ CHAR_RIGHT_PARENTHESES: 41,
117
+ CHAR_ASTERISK: 42,
118
+ CHAR_AMPERSAND: 38,
119
+ CHAR_AT: 64,
120
+ CHAR_BACKWARD_SLASH: 92,
121
+ CHAR_CARRIAGE_RETURN: 13,
122
+ CHAR_CIRCUMFLEX_ACCENT: 94,
123
+ CHAR_COLON: 58,
124
+ CHAR_COMMA: 44,
125
+ CHAR_DOT: 46,
126
+ CHAR_DOUBLE_QUOTE: 34,
127
+ CHAR_EQUAL: 61,
128
+ CHAR_EXCLAMATION_MARK: 33,
129
+ CHAR_FORM_FEED: 12,
130
+ CHAR_FORWARD_SLASH: 47,
131
+ CHAR_GRAVE_ACCENT: 96,
132
+ CHAR_HASH: 35,
133
+ CHAR_HYPHEN_MINUS: 45,
134
+ CHAR_LEFT_ANGLE_BRACKET: 60,
135
+ CHAR_LEFT_CURLY_BRACE: 123,
136
+ CHAR_LEFT_SQUARE_BRACKET: 91,
137
+ CHAR_LINE_FEED: 10,
138
+ CHAR_NO_BREAK_SPACE: 160,
139
+ CHAR_PERCENT: 37,
140
+ CHAR_PLUS: 43,
141
+ CHAR_QUESTION_MARK: 63,
142
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
143
+ CHAR_RIGHT_CURLY_BRACE: 125,
144
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
145
+ CHAR_SEMICOLON: 59,
146
+ CHAR_SINGLE_QUOTE: 39,
147
+ CHAR_SPACE: 32,
148
+ CHAR_TAB: 9,
149
+ CHAR_UNDERSCORE: 95,
150
+ CHAR_VERTICAL_LINE: 124,
151
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
152
+ extglobChars (chars) {
153
+ return {
154
+ '!': {
155
+ type: 'negate',
156
+ open: '(?:(?!(?:',
157
+ close: `))${chars.STAR})`
158
+ },
159
+ '?': {
160
+ type: 'qmark',
161
+ open: '(?:',
162
+ close: ')?'
163
+ },
164
+ '+': {
165
+ type: 'plus',
166
+ open: '(?:',
167
+ close: ')+'
168
+ },
169
+ '*': {
170
+ type: 'star',
171
+ open: '(?:',
172
+ close: ')*'
173
+ },
174
+ '@': {
175
+ type: 'at',
176
+ open: '(?:',
177
+ close: ')'
178
+ }
179
+ };
180
+ },
181
+ globChars (win32) {
182
+ return true === win32 ? WINDOWS_CHARS : POSIX_CHARS;
183
+ }
184
+ };
185
+ },
186
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
187
+ const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
188
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
189
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
190
+ const expandRange = (args, options)=>{
191
+ if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
192
+ args.sort();
193
+ const value = `[${args.join('-')}]`;
194
+ try {
195
+ new RegExp(value);
196
+ } catch (ex) {
197
+ return args.map((v)=>utils.escapeRegex(v)).join('..');
198
+ }
199
+ return value;
200
+ };
201
+ const syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
202
+ const splitTopLevel = (input)=>{
203
+ const parts = [];
204
+ let bracket = 0;
205
+ let paren = 0;
206
+ let quote = 0;
207
+ let value = '';
208
+ let escaped = false;
209
+ for (const ch of input){
210
+ if (true === escaped) {
211
+ value += ch;
212
+ escaped = false;
213
+ continue;
214
+ }
215
+ if ('\\' === ch) {
216
+ value += ch;
217
+ escaped = true;
218
+ continue;
219
+ }
220
+ if ('"' === ch) {
221
+ quote = 1 === quote ? 0 : 1;
222
+ value += ch;
223
+ continue;
224
+ }
225
+ if (0 === quote) {
226
+ if ('[' === ch) bracket++;
227
+ else if (']' === ch && bracket > 0) bracket--;
228
+ else if (0 === bracket) {
229
+ if ('(' === ch) paren++;
230
+ else if (')' === ch && paren > 0) paren--;
231
+ else if ('|' === ch && 0 === paren) {
232
+ parts.push(value);
233
+ value = '';
234
+ continue;
235
+ }
236
+ }
237
+ }
238
+ value += ch;
239
+ }
240
+ parts.push(value);
241
+ return parts;
242
+ };
243
+ const isPlainBranch = (branch)=>{
244
+ let escaped = false;
245
+ for (const ch of branch){
246
+ if (true === escaped) {
247
+ escaped = false;
248
+ continue;
249
+ }
250
+ if ('\\' === ch) {
251
+ escaped = true;
252
+ continue;
253
+ }
254
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
255
+ }
256
+ return true;
257
+ };
258
+ const normalizeSimpleBranch = (branch)=>{
259
+ let value = branch.trim();
260
+ let changed = true;
261
+ while(true === changed){
262
+ changed = false;
263
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
264
+ value = value.slice(2, -1);
265
+ changed = true;
266
+ }
267
+ }
268
+ if (!isPlainBranch(value)) return;
269
+ return value.replace(/\\(.)/g, '$1');
270
+ };
271
+ const hasRepeatedCharPrefixOverlap = (branches)=>{
272
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
273
+ for(let i = 0; i < values.length; i++)for(let j = i + 1; j < values.length; j++){
274
+ const a = values[i];
275
+ const b = values[j];
276
+ const char = a[0];
277
+ if (char && a === char.repeat(a.length) && b === char.repeat(b.length)) {
278
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
279
+ }
280
+ }
281
+ return false;
282
+ };
283
+ const parseRepeatedExtglob = (pattern, requireEnd = true)=>{
284
+ if ('+' !== pattern[0] && '*' !== pattern[0] || '(' !== pattern[1]) return;
285
+ let bracket = 0;
286
+ let paren = 0;
287
+ let quote = 0;
288
+ let escaped = false;
289
+ for(let i = 1; i < pattern.length; i++){
290
+ const ch = pattern[i];
291
+ if (true === escaped) {
292
+ escaped = false;
293
+ continue;
294
+ }
295
+ if ('\\' === ch) {
296
+ escaped = true;
297
+ continue;
298
+ }
299
+ if ('"' === ch) {
300
+ quote = 1 === quote ? 0 : 1;
301
+ continue;
302
+ }
303
+ if (1 !== quote) {
304
+ if ('[' === ch) {
305
+ bracket++;
306
+ continue;
307
+ }
308
+ if (']' === ch && bracket > 0) {
309
+ bracket--;
310
+ continue;
311
+ }
312
+ if (!(bracket > 0)) {
313
+ if ('(' === ch) {
314
+ paren++;
315
+ continue;
316
+ }
317
+ if (')' === ch) {
318
+ paren--;
319
+ if (0 === paren) {
320
+ if (true === requireEnd && i !== pattern.length - 1) return;
321
+ return {
322
+ type: pattern[0],
323
+ body: pattern.slice(2, i),
324
+ end: i
325
+ };
326
+ }
327
+ }
328
+ }
329
+ }
330
+ }
331
+ };
332
+ const getStarExtglobSequenceOutput = (pattern)=>{
333
+ let index = 0;
334
+ const chars = [];
335
+ while(index < pattern.length){
336
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
337
+ if (!match || '*' !== match.type) return;
338
+ const branches = splitTopLevel(match.body).map((branch)=>branch.trim());
339
+ if (1 !== branches.length) return;
340
+ const branch = normalizeSimpleBranch(branches[0]);
341
+ if (!branch || 1 !== branch.length) return;
342
+ chars.push(branch);
343
+ index += match.end + 1;
344
+ }
345
+ if (chars.length < 1) return;
346
+ const source = 1 === chars.length ? utils.escapeRegex(chars[0]) : `[${chars.map((ch)=>utils.escapeRegex(ch)).join('')}]`;
347
+ return `${source}*`;
348
+ };
349
+ const repeatedExtglobRecursion = (pattern)=>{
350
+ let depth = 0;
351
+ let value = pattern.trim();
352
+ let match = parseRepeatedExtglob(value);
353
+ while(match){
354
+ depth++;
355
+ value = match.body.trim();
356
+ match = parseRepeatedExtglob(value);
357
+ }
358
+ return depth;
359
+ };
360
+ const analyzeRepeatedExtglob = (body, options)=>{
361
+ if (false === options.maxExtglobRecursion) return {
362
+ risky: false
363
+ };
364
+ const max = 'number' == typeof options.maxExtglobRecursion ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
365
+ const branches = splitTopLevel(body).map((branch)=>branch.trim());
366
+ if (branches.length > 1) {
367
+ if (branches.some((branch)=>'' === branch) || branches.some((branch)=>/^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return {
368
+ risky: true
369
+ };
370
+ }
371
+ for (const branch of branches){
372
+ const safeOutput = getStarExtglobSequenceOutput(branch);
373
+ if (safeOutput) return {
374
+ risky: true,
375
+ safeOutput
376
+ };
377
+ if (repeatedExtglobRecursion(branch) > max) return {
378
+ risky: true
379
+ };
380
+ }
381
+ return {
382
+ risky: false
383
+ };
384
+ };
385
+ const parse = (input, options)=>{
386
+ if ('string' != typeof input) throw new TypeError('Expected a string');
387
+ input = REPLACEMENTS[input] || input;
388
+ const opts = {
389
+ ...options
390
+ };
391
+ const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
392
+ let len = input.length;
393
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
394
+ const bos = {
395
+ type: 'bos',
396
+ value: '',
397
+ output: opts.prepend || ''
398
+ };
399
+ const tokens = [
400
+ bos
401
+ ];
402
+ const capture = opts.capture ? '' : '?:';
403
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
404
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
405
+ const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
406
+ const globstar = (opts)=>`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
407
+ const nodot = opts.dot ? '' : NO_DOT;
408
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
409
+ let star = true === opts.bash ? globstar(opts) : STAR;
410
+ if (opts.capture) star = `(${star})`;
411
+ if ('boolean' == typeof opts.noext) opts.noextglob = opts.noext;
412
+ const state = {
413
+ input,
414
+ index: -1,
415
+ start: 0,
416
+ dot: true === opts.dot,
417
+ consumed: '',
418
+ output: '',
419
+ prefix: '',
420
+ backtrack: false,
421
+ negated: false,
422
+ brackets: 0,
423
+ braces: 0,
424
+ parens: 0,
425
+ quotes: 0,
426
+ globstar: false,
427
+ tokens
428
+ };
429
+ input = utils.removePrefix(input, state);
430
+ len = input.length;
431
+ const extglobs = [];
432
+ const braces = [];
433
+ const stack = [];
434
+ let prev = bos;
435
+ let value;
436
+ const eos = ()=>state.index === len - 1;
437
+ const peek = state.peek = (n = 1)=>input[state.index + n];
438
+ const advance = state.advance = ()=>input[++state.index] || '';
439
+ const remaining = ()=>input.slice(state.index + 1);
440
+ const consume = (value = '', num = 0)=>{
441
+ state.consumed += value;
442
+ state.index += num;
443
+ };
444
+ const append = (token)=>{
445
+ state.output += null != token.output ? token.output : token.value;
446
+ consume(token.value);
447
+ };
448
+ const negate = ()=>{
449
+ let count = 1;
450
+ while('!' === peek() && ('(' !== peek(2) || '?' === peek(3))){
451
+ advance();
452
+ state.start++;
453
+ count++;
454
+ }
455
+ if (count % 2 === 0) return false;
456
+ state.negated = true;
457
+ state.start++;
458
+ return true;
459
+ };
460
+ const increment = (type)=>{
461
+ state[type]++;
462
+ stack.push(type);
463
+ };
464
+ const decrement = (type)=>{
465
+ state[type]--;
466
+ stack.pop();
467
+ };
468
+ const push = (tok)=>{
469
+ if ('globstar' === prev.type) {
470
+ const isBrace = state.braces > 0 && ('comma' === tok.type || 'brace' === tok.type);
471
+ const isExtglob = true === tok.extglob || extglobs.length && ('pipe' === tok.type || 'paren' === tok.type);
472
+ if ('slash' !== tok.type && 'paren' !== tok.type && !isBrace && !isExtglob) {
473
+ state.output = state.output.slice(0, -prev.output.length);
474
+ prev.type = 'star';
475
+ prev.value = '*';
476
+ prev.output = star;
477
+ state.output += prev.output;
478
+ }
479
+ }
480
+ if (extglobs.length && 'paren' !== tok.type) extglobs[extglobs.length - 1].inner += tok.value;
481
+ if (tok.value || tok.output) append(tok);
482
+ if (prev && 'text' === prev.type && 'text' === tok.type) {
483
+ prev.output = (prev.output || prev.value) + tok.value;
484
+ prev.value += tok.value;
485
+ return;
486
+ }
487
+ tok.prev = prev;
488
+ tokens.push(tok);
489
+ prev = tok;
490
+ };
491
+ const extglobOpen = (type, value)=>{
492
+ const token = {
493
+ ...EXTGLOB_CHARS[value],
494
+ conditions: 1,
495
+ inner: ''
496
+ };
497
+ token.prev = prev;
498
+ token.parens = state.parens;
499
+ token.output = state.output;
500
+ token.startIndex = state.index;
501
+ token.tokensIndex = tokens.length;
502
+ const output = (opts.capture ? '(' : '') + token.open;
503
+ increment('parens');
504
+ push({
505
+ type,
506
+ value,
507
+ output: state.output ? '' : ONE_CHAR
508
+ });
509
+ push({
510
+ type: 'paren',
511
+ extglob: true,
512
+ value: advance(),
513
+ output
514
+ });
515
+ extglobs.push(token);
516
+ };
517
+ const extglobClose = (token)=>{
518
+ const literal = input.slice(token.startIndex, state.index + 1);
519
+ const body = input.slice(token.startIndex + 2, state.index);
520
+ const analysis = analyzeRepeatedExtglob(body, opts);
521
+ if (('plus' === token.type || 'star' === token.type) && analysis.risky) {
522
+ const safeOutput = analysis.safeOutput ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
523
+ const open = tokens[token.tokensIndex];
524
+ open.type = 'text';
525
+ open.value = literal;
526
+ open.output = safeOutput || utils.escapeRegex(literal);
527
+ for(let i = token.tokensIndex + 1; i < tokens.length; i++){
528
+ tokens[i].value = '';
529
+ tokens[i].output = '';
530
+ delete tokens[i].suffix;
531
+ }
532
+ state.output = token.output + open.output;
533
+ state.backtrack = true;
534
+ push({
535
+ type: 'paren',
536
+ extglob: true,
537
+ value,
538
+ output: ''
539
+ });
540
+ decrement('parens');
541
+ return;
542
+ }
543
+ let output = token.close + (opts.capture ? ')' : '');
544
+ let rest;
545
+ if ('negate' === token.type) {
546
+ let extglobStar = star;
547
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) extglobStar = globstar(opts);
548
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
549
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
550
+ const expression = parse(rest, {
551
+ ...options,
552
+ fastpaths: false
553
+ }).output;
554
+ output = token.close = `)${expression})${extglobStar})`;
555
+ }
556
+ if ('bos' === token.prev.type) state.negatedExtglob = true;
557
+ }
558
+ push({
559
+ type: 'paren',
560
+ extglob: true,
561
+ value,
562
+ output
563
+ });
564
+ decrement('parens');
565
+ };
566
+ if (false !== opts.fastpaths && !/(^[*!]|[/()[\]{}"])/.test(input)) {
567
+ let backslashes = false;
568
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index)=>{
569
+ if ('\\' === first) {
570
+ backslashes = true;
571
+ return m;
572
+ }
573
+ if ('?' === first) {
574
+ if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : '');
575
+ if (0 === index) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
576
+ return QMARK.repeat(chars.length);
577
+ }
578
+ if ('.' === first) return DOT_LITERAL.repeat(chars.length);
579
+ if ('*' === first) {
580
+ if (esc) return esc + first + (rest ? star : '');
581
+ return star;
582
+ }
583
+ return esc ? m : `\\${m}`;
584
+ });
585
+ if (true === backslashes) output = true === opts.unescape ? output.replace(/\\/g, '') : output.replace(/\\+/g, (m)=>m.length % 2 === 0 ? '\\\\' : m ? '\\' : '');
586
+ if (output === input && true === opts.contains) {
587
+ state.output = input;
588
+ return state;
589
+ }
590
+ state.output = utils.wrapOutput(output, state, options);
591
+ return state;
592
+ }
593
+ while(!eos()){
594
+ value = advance();
595
+ if ('\u0000' === value) continue;
596
+ if ('\\' === value) {
597
+ const next = peek();
598
+ if ('/' === next && true !== opts.bash) continue;
599
+ if ('.' === next || ';' === next) continue;
600
+ if (!next) {
601
+ value += '\\';
602
+ push({
603
+ type: 'text',
604
+ value
605
+ });
606
+ continue;
607
+ }
608
+ const match = /^\\+/.exec(remaining());
609
+ let slashes = 0;
610
+ if (match && match[0].length > 2) {
611
+ slashes = match[0].length;
612
+ state.index += slashes;
613
+ if (slashes % 2 !== 0) value += '\\';
614
+ }
615
+ if (true === opts.unescape) value = advance();
616
+ else value += advance();
617
+ if (0 === state.brackets) {
618
+ push({
619
+ type: 'text',
620
+ value
621
+ });
622
+ continue;
623
+ }
624
+ }
625
+ if (state.brackets > 0 && (']' !== value || '[' === prev.value || '[^' === prev.value)) {
626
+ if (false !== opts.posix && ':' === value) {
627
+ const inner = prev.value.slice(1);
628
+ if (inner.includes('[')) {
629
+ prev.posix = true;
630
+ if (inner.includes(':')) {
631
+ const idx = prev.value.lastIndexOf('[');
632
+ const pre = prev.value.slice(0, idx);
633
+ const rest = prev.value.slice(idx + 2);
634
+ const posix = POSIX_REGEX_SOURCE[rest];
635
+ if (posix) {
636
+ prev.value = pre + posix;
637
+ state.backtrack = true;
638
+ advance();
639
+ if (!bos.output && 1 === tokens.indexOf(prev)) bos.output = ONE_CHAR;
640
+ continue;
641
+ }
642
+ }
643
+ }
644
+ }
645
+ if ('[' === value && ':' !== peek() || '-' === value && ']' === peek()) value = `\\${value}`;
646
+ if (']' === value && ('[' === prev.value || '[^' === prev.value)) value = `\\${value}`;
647
+ if (true === opts.posix && '!' === value && '[' === prev.value) value = '^';
648
+ prev.value += value;
649
+ append({
650
+ value
651
+ });
652
+ continue;
653
+ }
654
+ if (1 === state.quotes && '"' !== value) {
655
+ value = utils.escapeRegex(value);
656
+ prev.value += value;
657
+ append({
658
+ value
659
+ });
660
+ continue;
661
+ }
662
+ if ('"' === value) {
663
+ state.quotes = 1 === state.quotes ? 0 : 1;
664
+ if (true === opts.keepQuotes) push({
665
+ type: 'text',
666
+ value
667
+ });
668
+ continue;
669
+ }
670
+ if ('(' === value) {
671
+ increment('parens');
672
+ push({
673
+ type: 'paren',
674
+ value
675
+ });
676
+ continue;
677
+ }
678
+ if (')' === value) {
679
+ if (0 === state.parens && true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '('));
680
+ const extglob = extglobs[extglobs.length - 1];
681
+ if (extglob && state.parens === extglob.parens + 1) {
682
+ extglobClose(extglobs.pop());
683
+ continue;
684
+ }
685
+ push({
686
+ type: 'paren',
687
+ value,
688
+ output: state.parens ? ')' : '\\)'
689
+ });
690
+ decrement('parens');
691
+ continue;
692
+ }
693
+ if ('[' === value) {
694
+ if (true !== opts.nobracket && remaining().includes(']')) increment('brackets');
695
+ else {
696
+ if (true !== opts.nobracket && true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
697
+ value = `\\${value}`;
698
+ }
699
+ push({
700
+ type: 'bracket',
701
+ value
702
+ });
703
+ continue;
704
+ }
705
+ if (']' === value) {
706
+ if (true === opts.nobracket || prev && 'bracket' === prev.type && 1 === prev.value.length) {
707
+ push({
708
+ type: 'text',
709
+ value,
710
+ output: `\\${value}`
711
+ });
712
+ continue;
713
+ }
714
+ if (0 === state.brackets) {
715
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '['));
716
+ push({
717
+ type: 'text',
718
+ value,
719
+ output: `\\${value}`
720
+ });
721
+ continue;
722
+ }
723
+ decrement('brackets');
724
+ const prevValue = prev.value.slice(1);
725
+ if (true !== prev.posix && '^' === prevValue[0] && !prevValue.includes('/')) value = `/${value}`;
726
+ prev.value += value;
727
+ append({
728
+ value
729
+ });
730
+ if (false === opts.literalBrackets || utils.hasRegexChars(prevValue)) continue;
731
+ const escaped = utils.escapeRegex(prev.value);
732
+ state.output = state.output.slice(0, -prev.value.length);
733
+ if (true === opts.literalBrackets) {
734
+ state.output += escaped;
735
+ prev.value = escaped;
736
+ continue;
737
+ }
738
+ prev.value = `(${capture}${escaped}|${prev.value})`;
739
+ state.output += prev.value;
740
+ continue;
741
+ }
742
+ if ('{' === value && true !== opts.nobrace) {
743
+ increment('braces');
744
+ const open = {
745
+ type: 'brace',
746
+ value,
747
+ output: '(',
748
+ outputIndex: state.output.length,
749
+ tokensIndex: state.tokens.length
750
+ };
751
+ braces.push(open);
752
+ push(open);
753
+ continue;
754
+ }
755
+ if ('}' === value) {
756
+ const brace = braces[braces.length - 1];
757
+ if (true === opts.nobrace || !brace) {
758
+ push({
759
+ type: 'text',
760
+ value,
761
+ output: value
762
+ });
763
+ continue;
764
+ }
765
+ let output = ')';
766
+ if (true === brace.dots) {
767
+ const arr = tokens.slice();
768
+ const range = [];
769
+ for(let i = arr.length - 1; i >= 0; i--){
770
+ tokens.pop();
771
+ if ('brace' === arr[i].type) break;
772
+ if ('dots' !== arr[i].type) range.unshift(arr[i].value);
773
+ }
774
+ output = expandRange(range, opts);
775
+ state.backtrack = true;
776
+ }
777
+ if (true !== brace.comma && true !== brace.dots) {
778
+ const out = state.output.slice(0, brace.outputIndex);
779
+ const toks = state.tokens.slice(brace.tokensIndex);
780
+ brace.value = brace.output = '\\{';
781
+ value = output = '\\}';
782
+ state.output = out;
783
+ for (const t of toks)state.output += t.output || t.value;
784
+ }
785
+ push({
786
+ type: 'brace',
787
+ value,
788
+ output
789
+ });
790
+ decrement('braces');
791
+ braces.pop();
792
+ continue;
793
+ }
794
+ if ('|' === value) {
795
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
796
+ push({
797
+ type: 'text',
798
+ value
799
+ });
800
+ continue;
801
+ }
802
+ if (',' === value) {
803
+ let output = value;
804
+ const brace = braces[braces.length - 1];
805
+ if (brace && 'braces' === stack[stack.length - 1]) {
806
+ brace.comma = true;
807
+ output = '|';
808
+ }
809
+ push({
810
+ type: 'comma',
811
+ value,
812
+ output
813
+ });
814
+ continue;
815
+ }
816
+ if ('/' === value) {
817
+ if ('dot' === prev.type && state.index === state.start + 1) {
818
+ state.start = state.index + 1;
819
+ state.consumed = '';
820
+ state.output = '';
821
+ tokens.pop();
822
+ prev = bos;
823
+ continue;
824
+ }
825
+ push({
826
+ type: 'slash',
827
+ value,
828
+ output: SLASH_LITERAL
829
+ });
830
+ continue;
831
+ }
832
+ if ('.' === value) {
833
+ if (state.braces > 0 && 'dot' === prev.type) {
834
+ if ('.' === prev.value) prev.output = DOT_LITERAL;
835
+ const brace = braces[braces.length - 1];
836
+ prev.type = 'dots';
837
+ prev.output += value;
838
+ prev.value += value;
839
+ brace.dots = true;
840
+ continue;
841
+ }
842
+ if (state.braces + state.parens === 0 && 'bos' !== prev.type && 'slash' !== prev.type) {
843
+ push({
844
+ type: 'text',
845
+ value,
846
+ output: DOT_LITERAL
847
+ });
848
+ continue;
849
+ }
850
+ push({
851
+ type: 'dot',
852
+ value,
853
+ output: DOT_LITERAL
854
+ });
855
+ continue;
856
+ }
857
+ if ('?' === value) {
858
+ const isGroup = prev && '(' === prev.value;
859
+ if (!isGroup && true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
860
+ extglobOpen('qmark', value);
861
+ continue;
862
+ }
863
+ if (prev && 'paren' === prev.type) {
864
+ const next = peek();
865
+ let output = value;
866
+ if ('(' === prev.value && !/[!=<:]/.test(next) || '<' === next && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
867
+ push({
868
+ type: 'text',
869
+ value,
870
+ output
871
+ });
872
+ continue;
873
+ }
874
+ if (true !== opts.dot && ('slash' === prev.type || 'bos' === prev.type)) {
875
+ push({
876
+ type: 'qmark',
877
+ value,
878
+ output: QMARK_NO_DOT
879
+ });
880
+ continue;
881
+ }
882
+ push({
883
+ type: 'qmark',
884
+ value,
885
+ output: QMARK
886
+ });
887
+ continue;
888
+ }
889
+ if ('!' === value) {
890
+ if (true !== opts.noextglob && '(' === peek()) {
891
+ if ('?' !== peek(2) || !/[!=<:]/.test(peek(3))) {
892
+ extglobOpen('negate', value);
893
+ continue;
894
+ }
895
+ }
896
+ if (true !== opts.nonegate && 0 === state.index) {
897
+ negate();
898
+ continue;
899
+ }
900
+ }
901
+ if ('+' === value) {
902
+ if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
903
+ extglobOpen('plus', value);
904
+ continue;
905
+ }
906
+ if (prev && '(' === prev.value || false === opts.regex) {
907
+ push({
908
+ type: 'plus',
909
+ value,
910
+ output: PLUS_LITERAL
911
+ });
912
+ continue;
913
+ }
914
+ if (prev && ('bracket' === prev.type || 'paren' === prev.type || 'brace' === prev.type) || state.parens > 0) {
915
+ push({
916
+ type: 'plus',
917
+ value
918
+ });
919
+ continue;
920
+ }
921
+ push({
922
+ type: 'plus',
923
+ value: PLUS_LITERAL
924
+ });
925
+ continue;
926
+ }
927
+ if ('@' === value) {
928
+ if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
929
+ push({
930
+ type: 'at',
931
+ extglob: true,
932
+ value,
933
+ output: ''
934
+ });
935
+ continue;
936
+ }
937
+ push({
938
+ type: 'text',
939
+ value
940
+ });
941
+ continue;
942
+ }
943
+ if ('*' !== value) {
944
+ if ('$' === value || '^' === value) value = `\\${value}`;
945
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
946
+ if (match) {
947
+ value += match[0];
948
+ state.index += match[0].length;
949
+ }
950
+ push({
951
+ type: 'text',
952
+ value
953
+ });
954
+ continue;
955
+ }
956
+ if (prev && ('globstar' === prev.type || true === prev.star)) {
957
+ prev.type = 'star';
958
+ prev.star = true;
959
+ prev.value += value;
960
+ prev.output = star;
961
+ state.backtrack = true;
962
+ state.globstar = true;
963
+ consume(value);
964
+ continue;
965
+ }
966
+ let rest = remaining();
967
+ if (true !== opts.noextglob && /^\([^?]/.test(rest)) {
968
+ extglobOpen('star', value);
969
+ continue;
970
+ }
971
+ if ('star' === prev.type) {
972
+ if (true === opts.noglobstar) {
973
+ consume(value);
974
+ continue;
975
+ }
976
+ const prior = prev.prev;
977
+ const before = prior.prev;
978
+ const isStart = 'slash' === prior.type || 'bos' === prior.type;
979
+ const afterStar = before && ('star' === before.type || 'globstar' === before.type);
980
+ if (true === opts.bash && (!isStart || rest[0] && '/' !== rest[0])) {
981
+ push({
982
+ type: 'star',
983
+ value,
984
+ output: ''
985
+ });
986
+ continue;
987
+ }
988
+ const isBrace = state.braces > 0 && ('comma' === prior.type || 'brace' === prior.type);
989
+ const isExtglob = extglobs.length && ('pipe' === prior.type || 'paren' === prior.type);
990
+ if (!isStart && 'paren' !== prior.type && !isBrace && !isExtglob) {
991
+ push({
992
+ type: 'star',
993
+ value,
994
+ output: ''
995
+ });
996
+ continue;
997
+ }
998
+ while('/**' === rest.slice(0, 3)){
999
+ const after = input[state.index + 4];
1000
+ if (after && '/' !== after) break;
1001
+ rest = rest.slice(3);
1002
+ consume('/**', 3);
1003
+ }
1004
+ if ('bos' === prior.type && eos()) {
1005
+ prev.type = 'globstar';
1006
+ prev.value += value;
1007
+ prev.output = globstar(opts);
1008
+ state.output = prev.output;
1009
+ state.globstar = true;
1010
+ consume(value);
1011
+ continue;
1012
+ }
1013
+ if ('slash' === prior.type && 'bos' !== prior.prev.type && !afterStar && eos()) {
1014
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1015
+ prior.output = `(?:${prior.output}`;
1016
+ prev.type = 'globstar';
1017
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
1018
+ prev.value += value;
1019
+ state.globstar = true;
1020
+ state.output += prior.output + prev.output;
1021
+ consume(value);
1022
+ continue;
1023
+ }
1024
+ if ('slash' === prior.type && 'bos' !== prior.prev.type && '/' === rest[0]) {
1025
+ const end = void 0 !== rest[1] ? '|$' : '';
1026
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1027
+ prior.output = `(?:${prior.output}`;
1028
+ prev.type = 'globstar';
1029
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1030
+ prev.value += value;
1031
+ state.output += prior.output + prev.output;
1032
+ state.globstar = true;
1033
+ consume(value + advance());
1034
+ push({
1035
+ type: 'slash',
1036
+ value: '/',
1037
+ output: ''
1038
+ });
1039
+ continue;
1040
+ }
1041
+ if ('bos' === prior.type && '/' === rest[0]) {
1042
+ prev.type = 'globstar';
1043
+ prev.value += value;
1044
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1045
+ state.output = prev.output;
1046
+ state.globstar = true;
1047
+ consume(value + advance());
1048
+ push({
1049
+ type: 'slash',
1050
+ value: '/',
1051
+ output: ''
1052
+ });
1053
+ continue;
1054
+ }
1055
+ state.output = state.output.slice(0, -prev.output.length);
1056
+ prev.type = 'globstar';
1057
+ prev.output = globstar(opts);
1058
+ prev.value += value;
1059
+ state.output += prev.output;
1060
+ state.globstar = true;
1061
+ consume(value);
1062
+ continue;
1063
+ }
1064
+ const token = {
1065
+ type: 'star',
1066
+ value,
1067
+ output: star
1068
+ };
1069
+ if (true === opts.bash) {
1070
+ token.output = '.*?';
1071
+ if ('bos' === prev.type || 'slash' === prev.type) token.output = nodot + token.output;
1072
+ push(token);
1073
+ continue;
1074
+ }
1075
+ if (prev && ('bracket' === prev.type || 'paren' === prev.type) && true === opts.regex) {
1076
+ token.output = value;
1077
+ push(token);
1078
+ continue;
1079
+ }
1080
+ if (state.index === state.start || 'slash' === prev.type || 'dot' === prev.type) {
1081
+ if ('dot' === prev.type) {
1082
+ state.output += NO_DOT_SLASH;
1083
+ prev.output += NO_DOT_SLASH;
1084
+ } else if (true === opts.dot) {
1085
+ state.output += NO_DOTS_SLASH;
1086
+ prev.output += NO_DOTS_SLASH;
1087
+ } else {
1088
+ state.output += nodot;
1089
+ prev.output += nodot;
1090
+ }
1091
+ if ('*' !== peek()) {
1092
+ state.output += ONE_CHAR;
1093
+ prev.output += ONE_CHAR;
1094
+ }
1095
+ }
1096
+ push(token);
1097
+ }
1098
+ while(state.brackets > 0){
1099
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
1100
+ state.output = utils.escapeLast(state.output, '[');
1101
+ decrement('brackets');
1102
+ }
1103
+ while(state.parens > 0){
1104
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ')'));
1105
+ state.output = utils.escapeLast(state.output, '(');
1106
+ decrement('parens');
1107
+ }
1108
+ while(state.braces > 0){
1109
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', '}'));
1110
+ state.output = utils.escapeLast(state.output, '{');
1111
+ decrement('braces');
1112
+ }
1113
+ if (true !== opts.strictSlashes && ('star' === prev.type || 'bracket' === prev.type)) push({
1114
+ type: 'maybe_slash',
1115
+ value: '',
1116
+ output: `${SLASH_LITERAL}?`
1117
+ });
1118
+ if (true === state.backtrack) {
1119
+ state.output = '';
1120
+ for (const token of state.tokens){
1121
+ state.output += null != token.output ? token.output : token.value;
1122
+ if (token.suffix) state.output += token.suffix;
1123
+ }
1124
+ }
1125
+ return state;
1126
+ };
1127
+ parse.fastpaths = (input, options)=>{
1128
+ const opts = {
1129
+ ...options
1130
+ };
1131
+ const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1132
+ const len = input.length;
1133
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1134
+ input = REPLACEMENTS[input] || input;
1135
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
1136
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1137
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1138
+ const capture = opts.capture ? '' : '?:';
1139
+ const state = {
1140
+ negated: false,
1141
+ prefix: ''
1142
+ };
1143
+ let star = true === opts.bash ? '.*?' : STAR;
1144
+ if (opts.capture) star = `(${star})`;
1145
+ const globstar = (opts)=>{
1146
+ if (true === opts.noglobstar) return star;
1147
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1148
+ };
1149
+ const create = (str)=>{
1150
+ switch(str){
1151
+ case '*':
1152
+ return `${nodot}${ONE_CHAR}${star}`;
1153
+ case '.*':
1154
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1155
+ case '*.*':
1156
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1157
+ case '*/*':
1158
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1159
+ case '**':
1160
+ return nodot + globstar(opts);
1161
+ case '**/*':
1162
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1163
+ case '**/*.*':
1164
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1165
+ case '**/.*':
1166
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1167
+ default:
1168
+ {
1169
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1170
+ if (!match) return;
1171
+ const source = create(match[1]);
1172
+ if (!source) return;
1173
+ return source + DOT_LITERAL + match[2];
1174
+ }
1175
+ }
1176
+ };
1177
+ const output = utils.removePrefix(input, state);
1178
+ let source = create(output);
1179
+ if (source && true !== opts.strictSlashes) source += `${SLASH_LITERAL}?`;
1180
+ return source;
1181
+ };
1182
+ module.exports = parse;
1183
+ },
1184
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js" (module, __unused_rspack_exports, __webpack_require__) {
1185
+ const scan = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js");
1186
+ const parse = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js");
1187
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
1188
+ const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
1189
+ const isObject = (val)=>val && 'object' == typeof val && !Array.isArray(val);
1190
+ const picomatch = (glob, options, returnState = false)=>{
1191
+ if (Array.isArray(glob)) {
1192
+ const fns = glob.map((input)=>picomatch(input, options, returnState));
1193
+ const arrayMatcher = (str)=>{
1194
+ for (const isMatch of fns){
1195
+ const state = isMatch(str);
1196
+ if (state) return state;
1197
+ }
1198
+ return false;
1199
+ };
1200
+ return arrayMatcher;
1201
+ }
1202
+ const isState = isObject(glob) && glob.tokens && glob.input;
1203
+ if ('' === glob || 'string' != typeof glob && !isState) throw new TypeError('Expected pattern to be a non-empty string');
1204
+ const opts = options || {};
1205
+ const posix = opts.windows;
1206
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
1207
+ const state = regex.state;
1208
+ delete regex.state;
1209
+ let isIgnored = ()=>false;
1210
+ if (opts.ignore) {
1211
+ const ignoreOpts = {
1212
+ ...options,
1213
+ ignore: null,
1214
+ onMatch: null,
1215
+ onResult: null
1216
+ };
1217
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1218
+ }
1219
+ const matcher = (input, returnObject = false)=>{
1220
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
1221
+ glob,
1222
+ posix
1223
+ });
1224
+ const result = {
1225
+ glob,
1226
+ state,
1227
+ regex,
1228
+ posix,
1229
+ input,
1230
+ output,
1231
+ match,
1232
+ isMatch
1233
+ };
1234
+ if ('function' == typeof opts.onResult) opts.onResult(result);
1235
+ if (false === isMatch) {
1236
+ result.isMatch = false;
1237
+ return returnObject ? result : false;
1238
+ }
1239
+ if (isIgnored(input)) {
1240
+ if ('function' == typeof opts.onIgnore) opts.onIgnore(result);
1241
+ result.isMatch = false;
1242
+ return returnObject ? result : false;
1243
+ }
1244
+ if ('function' == typeof opts.onMatch) opts.onMatch(result);
1245
+ return returnObject ? result : true;
1246
+ };
1247
+ if (returnState) matcher.state = state;
1248
+ return matcher;
1249
+ };
1250
+ picomatch.test = (input, regex, options, { glob, posix } = {})=>{
1251
+ if ('string' != typeof input) throw new TypeError('Expected input to be a string');
1252
+ if ('' === input) return {
1253
+ isMatch: false,
1254
+ output: ''
1255
+ };
1256
+ const opts = options || {};
1257
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
1258
+ let match = input === glob;
1259
+ let output = match && format ? format(input) : input;
1260
+ if (false === match) {
1261
+ output = format ? format(input) : input;
1262
+ match = output === glob;
1263
+ }
1264
+ if (false === match || true === opts.capture) match = true === opts.matchBase || true === opts.basename ? picomatch.matchBase(input, regex, options, posix) : regex.exec(output);
1265
+ return {
1266
+ isMatch: Boolean(match),
1267
+ match,
1268
+ output
1269
+ };
1270
+ };
1271
+ picomatch.matchBase = (input, glob, options)=>{
1272
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
1273
+ return regex.test(utils.basename(input));
1274
+ };
1275
+ picomatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
1276
+ picomatch.parse = (pattern, options)=>{
1277
+ if (Array.isArray(pattern)) return pattern.map((p)=>picomatch.parse(p, options));
1278
+ return parse(pattern, {
1279
+ ...options,
1280
+ fastpaths: false
1281
+ });
1282
+ };
1283
+ picomatch.scan = (input, options)=>scan(input, options);
1284
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false)=>{
1285
+ if (true === returnOutput) return state.output;
1286
+ const opts = options || {};
1287
+ const prepend = opts.contains ? '' : '^';
1288
+ const append = opts.contains ? '' : '$';
1289
+ let source = `${prepend}(?:${state.output})${append}`;
1290
+ if (state && true === state.negated) source = `^(?!${source}).*$`;
1291
+ const regex = picomatch.toRegex(source, options);
1292
+ if (true === returnState) regex.state = state;
1293
+ return regex;
1294
+ };
1295
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false)=>{
1296
+ if (!input || 'string' != typeof input) throw new TypeError('Expected a non-empty string');
1297
+ let parsed = {
1298
+ negated: false,
1299
+ fastpaths: true
1300
+ };
1301
+ if (false !== options.fastpaths && ('.' === input[0] || '*' === input[0])) parsed.output = parse.fastpaths(input, options);
1302
+ if (!parsed.output) parsed = parse(input, options);
1303
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
1304
+ };
1305
+ picomatch.toRegex = (source, options)=>{
1306
+ try {
1307
+ const opts = options || {};
1308
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
1309
+ } catch (err) {
1310
+ if (options && true === options.debug) throw err;
1311
+ return /$^/;
1312
+ }
1313
+ };
1314
+ picomatch.constants = constants;
1315
+ module.exports = picomatch;
1316
+ },
1317
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js" (module, __unused_rspack_exports, __webpack_require__) {
1318
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
1319
+ const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
1320
+ const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
1321
+ const depth = (token)=>{
1322
+ if (true !== token.isPrefix) token.depth = token.isGlobstar ? 1 / 0 : 1;
1323
+ };
1324
+ const scan = (input, options)=>{
1325
+ const opts = options || {};
1326
+ const length = input.length - 1;
1327
+ const scanToEnd = true === opts.parts || true === opts.scanToEnd;
1328
+ const slashes = [];
1329
+ const tokens = [];
1330
+ const parts = [];
1331
+ let str = input;
1332
+ let index = -1;
1333
+ let start = 0;
1334
+ let lastIndex = 0;
1335
+ let isBrace = false;
1336
+ let isBracket = false;
1337
+ let isGlob = false;
1338
+ let isExtglob = false;
1339
+ let isGlobstar = false;
1340
+ let braceEscaped = false;
1341
+ let backslashes = false;
1342
+ let negated = false;
1343
+ let negatedExtglob = false;
1344
+ let finished = false;
1345
+ let braces = 0;
1346
+ let prev;
1347
+ let code;
1348
+ let token = {
1349
+ value: '',
1350
+ depth: 0,
1351
+ isGlob: false
1352
+ };
1353
+ const eos = ()=>index >= length;
1354
+ const peek = ()=>str.charCodeAt(index + 1);
1355
+ const advance = ()=>{
1356
+ prev = code;
1357
+ return str.charCodeAt(++index);
1358
+ };
1359
+ while(index < length){
1360
+ code = advance();
1361
+ let next;
1362
+ if (code === CHAR_BACKWARD_SLASH) {
1363
+ backslashes = token.backslashes = true;
1364
+ code = advance();
1365
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
1366
+ continue;
1367
+ }
1368
+ if (true === braceEscaped || code === CHAR_LEFT_CURLY_BRACE) {
1369
+ braces++;
1370
+ while(true !== eos() && (code = advance())){
1371
+ if (code === CHAR_BACKWARD_SLASH) {
1372
+ backslashes = token.backslashes = true;
1373
+ advance();
1374
+ continue;
1375
+ }
1376
+ if (code === CHAR_LEFT_CURLY_BRACE) {
1377
+ braces++;
1378
+ continue;
1379
+ }
1380
+ if (true !== braceEscaped && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
1381
+ isBrace = token.isBrace = true;
1382
+ isGlob = token.isGlob = true;
1383
+ finished = true;
1384
+ if (true === scanToEnd) continue;
1385
+ break;
1386
+ }
1387
+ if (true !== braceEscaped && code === CHAR_COMMA) {
1388
+ isBrace = token.isBrace = true;
1389
+ isGlob = token.isGlob = true;
1390
+ finished = true;
1391
+ if (true === scanToEnd) continue;
1392
+ break;
1393
+ }
1394
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
1395
+ braces--;
1396
+ if (0 === braces) {
1397
+ braceEscaped = false;
1398
+ isBrace = token.isBrace = true;
1399
+ finished = true;
1400
+ break;
1401
+ }
1402
+ }
1403
+ }
1404
+ if (true === scanToEnd) continue;
1405
+ break;
1406
+ }
1407
+ if (code === CHAR_FORWARD_SLASH) {
1408
+ slashes.push(index);
1409
+ tokens.push(token);
1410
+ token = {
1411
+ value: '',
1412
+ depth: 0,
1413
+ isGlob: false
1414
+ };
1415
+ if (true === finished) continue;
1416
+ if (prev === CHAR_DOT && index === start + 1) {
1417
+ start += 2;
1418
+ continue;
1419
+ }
1420
+ lastIndex = index + 1;
1421
+ continue;
1422
+ }
1423
+ if (true !== opts.noext) {
1424
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
1425
+ if (true === isExtglobChar && peek() === CHAR_LEFT_PARENTHESES) {
1426
+ isGlob = token.isGlob = true;
1427
+ isExtglob = token.isExtglob = true;
1428
+ finished = true;
1429
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
1430
+ if (true === scanToEnd) {
1431
+ while(true !== eos() && (code = advance())){
1432
+ if (code === CHAR_BACKWARD_SLASH) {
1433
+ backslashes = token.backslashes = true;
1434
+ code = advance();
1435
+ continue;
1436
+ }
1437
+ if (code === CHAR_RIGHT_PARENTHESES) {
1438
+ isGlob = token.isGlob = true;
1439
+ finished = true;
1440
+ break;
1441
+ }
1442
+ }
1443
+ continue;
1444
+ }
1445
+ break;
1446
+ }
1447
+ }
1448
+ if (code === CHAR_ASTERISK) {
1449
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
1450
+ isGlob = token.isGlob = true;
1451
+ finished = true;
1452
+ if (true === scanToEnd) continue;
1453
+ break;
1454
+ }
1455
+ if (code === CHAR_QUESTION_MARK) {
1456
+ isGlob = token.isGlob = true;
1457
+ finished = true;
1458
+ if (true === scanToEnd) continue;
1459
+ break;
1460
+ }
1461
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
1462
+ while(true !== eos() && (next = advance())){
1463
+ if (next === CHAR_BACKWARD_SLASH) {
1464
+ backslashes = token.backslashes = true;
1465
+ advance();
1466
+ continue;
1467
+ }
1468
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
1469
+ isBracket = token.isBracket = true;
1470
+ isGlob = token.isGlob = true;
1471
+ finished = true;
1472
+ break;
1473
+ }
1474
+ }
1475
+ if (true === scanToEnd) continue;
1476
+ break;
1477
+ }
1478
+ if (true !== opts.nonegate && code === CHAR_EXCLAMATION_MARK && index === start) {
1479
+ negated = token.negated = true;
1480
+ start++;
1481
+ continue;
1482
+ }
1483
+ if (true !== opts.noparen && code === CHAR_LEFT_PARENTHESES) {
1484
+ isGlob = token.isGlob = true;
1485
+ if (true === scanToEnd) {
1486
+ while(true !== eos() && (code = advance())){
1487
+ if (code === CHAR_LEFT_PARENTHESES) {
1488
+ backslashes = token.backslashes = true;
1489
+ code = advance();
1490
+ continue;
1491
+ }
1492
+ if (code === CHAR_RIGHT_PARENTHESES) {
1493
+ finished = true;
1494
+ break;
1495
+ }
1496
+ }
1497
+ continue;
1498
+ }
1499
+ break;
1500
+ }
1501
+ if (true === isGlob) {
1502
+ finished = true;
1503
+ if (true === scanToEnd) continue;
1504
+ break;
1505
+ }
1506
+ }
1507
+ if (true === opts.noext) {
1508
+ isExtglob = false;
1509
+ isGlob = false;
1510
+ }
1511
+ let base = str;
1512
+ let prefix = '';
1513
+ let glob = '';
1514
+ if (start > 0) {
1515
+ prefix = str.slice(0, start);
1516
+ str = str.slice(start);
1517
+ lastIndex -= start;
1518
+ }
1519
+ if (base && true === isGlob && lastIndex > 0) {
1520
+ base = str.slice(0, lastIndex);
1521
+ glob = str.slice(lastIndex);
1522
+ } else if (true === isGlob) {
1523
+ base = '';
1524
+ glob = str;
1525
+ } else base = str;
1526
+ if (base && '' !== base && '/' !== base && base !== str) {
1527
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
1528
+ }
1529
+ if (true === opts.unescape) {
1530
+ if (glob) glob = utils.removeBackslashes(glob);
1531
+ if (base && true === backslashes) base = utils.removeBackslashes(base);
1532
+ }
1533
+ const state = {
1534
+ prefix,
1535
+ input,
1536
+ start,
1537
+ base,
1538
+ glob,
1539
+ isBrace,
1540
+ isBracket,
1541
+ isGlob,
1542
+ isExtglob,
1543
+ isGlobstar,
1544
+ negated,
1545
+ negatedExtglob
1546
+ };
1547
+ if (true === opts.tokens) {
1548
+ state.maxDepth = 0;
1549
+ if (!isPathSeparator(code)) tokens.push(token);
1550
+ state.tokens = tokens;
1551
+ }
1552
+ if (true === opts.parts || true === opts.tokens) {
1553
+ let prevIndex;
1554
+ for(let idx = 0; idx < slashes.length; idx++){
1555
+ const n = prevIndex ? prevIndex + 1 : start;
1556
+ const i = slashes[idx];
1557
+ const value = input.slice(n, i);
1558
+ if (opts.tokens) {
1559
+ if (0 === idx && 0 !== start) {
1560
+ tokens[idx].isPrefix = true;
1561
+ tokens[idx].value = prefix;
1562
+ } else tokens[idx].value = value;
1563
+ depth(tokens[idx]);
1564
+ state.maxDepth += tokens[idx].depth;
1565
+ }
1566
+ if (0 !== idx || '' !== value) parts.push(value);
1567
+ prevIndex = i;
1568
+ }
1569
+ if (prevIndex && prevIndex + 1 < input.length) {
1570
+ const value = input.slice(prevIndex + 1);
1571
+ parts.push(value);
1572
+ if (opts.tokens) {
1573
+ tokens[tokens.length - 1].value = value;
1574
+ depth(tokens[tokens.length - 1]);
1575
+ state.maxDepth += tokens[tokens.length - 1].depth;
1576
+ }
1577
+ }
1578
+ state.slashes = slashes;
1579
+ state.parts = parts;
1580
+ }
1581
+ return state;
1582
+ };
1583
+ module.exports = scan;
1584
+ },
1585
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js" (__unused_rspack_module, exports, __webpack_require__) {
1586
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
1587
+ exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
1588
+ exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
1589
+ exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str);
1590
+ exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
1591
+ exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/');
1592
+ exports.isWindows = ()=>{
1593
+ if ("u" > typeof navigator && navigator.platform) {
1594
+ const platform = navigator.platform.toLowerCase();
1595
+ return 'win32' === platform || 'windows' === platform;
1596
+ }
1597
+ if ("u" > typeof process && process.platform) return 'win32' === process.platform;
1598
+ return false;
1599
+ };
1600
+ exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match);
1601
+ exports.escapeLast = (input, char, lastIdx)=>{
1602
+ const idx = input.lastIndexOf(char, lastIdx);
1603
+ if (-1 === idx) return input;
1604
+ if ('\\' === input[idx - 1]) return exports.escapeLast(input, char, idx - 1);
1605
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
1606
+ };
1607
+ exports.removePrefix = (input, state = {})=>{
1608
+ let output = input;
1609
+ if (output.startsWith('./')) {
1610
+ output = output.slice(2);
1611
+ state.prefix = './';
1612
+ }
1613
+ return output;
1614
+ };
1615
+ exports.wrapOutput = (input, state = {}, options = {})=>{
1616
+ const prepend = options.contains ? '' : '^';
1617
+ const append = options.contains ? '' : '$';
1618
+ let output = `${prepend}(?:${input})${append}`;
1619
+ if (true === state.negated) output = `(?:^(?!${output}).*$)`;
1620
+ return output;
1621
+ };
1622
+ exports.basename = (path, { windows } = {})=>{
1623
+ const segs = path.split(windows ? /[\\/]/ : '/');
1624
+ const last = segs[segs.length - 1];
1625
+ if ('' === last) return segs[segs.length - 2];
1626
+ return last;
1627
+ };
1628
+ },
1629
+ child_process (module) {
1630
+ module.exports = __rspack_createRequire_require("child_process");
1631
+ },
1632
+ "fs?8b28" (module) {
1633
+ module.exports = __rspack_createRequire_require("fs");
1634
+ },
1635
+ "path?aeb1" (module) {
1636
+ module.exports = __rspack_createRequire_require("path");
1637
+ },
1638
+ stream (module) {
1639
+ module.exports = __rspack_createRequire_require("stream");
1640
+ }
1641
+ });
1642
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
1643
+ function cleanPath(path) {
1644
+ let normalized = normalize(path);
1645
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
1646
+ return normalized;
1647
+ }
1648
+ const SLASHES_REGEX = /[\\/]/g;
1649
+ function convertSlashes(path, separator) {
1650
+ return path.replace(SLASHES_REGEX, separator);
1651
+ }
1652
+ const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
1653
+ function isRootDirectory(path) {
1654
+ return "/" === path || WINDOWS_ROOT_DIR_REGEX.test(path);
1655
+ }
1656
+ function normalizePath(path, options) {
1657
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
1658
+ const pathNeedsCleaning = "win32" === process.platform && path.includes("/") || path.startsWith(".");
1659
+ if (resolvePaths) path = resolve(path);
1660
+ if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path);
1661
+ if ("." === path) return "";
1662
+ const needsSeperator = path[path.length - 1] !== pathSeparator;
1663
+ return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);
1664
+ }
1665
+ function joinPathWithBasePath(filename, directoryPath) {
1666
+ return directoryPath + filename;
1667
+ }
1668
+ function joinPathWithRelativePath(root, options) {
1669
+ return function(filename, directoryPath) {
1670
+ const sameRoot = directoryPath.startsWith(root);
1671
+ if (sameRoot) return directoryPath.slice(root.length) + filename;
1672
+ return convertSlashes(external_path_relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
1673
+ };
1674
+ }
1675
+ function joinPath(filename) {
1676
+ return filename;
1677
+ }
1678
+ function joinDirectoryPath(filename, directoryPath, separator) {
1679
+ return directoryPath + filename + separator;
1680
+ }
1681
+ function build$7(root, options) {
1682
+ const { relativePaths, includeBasePath } = options;
1683
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
1684
+ }
1685
+ function pushDirectoryWithRelativePath(root) {
1686
+ return function(directoryPath, paths) {
1687
+ paths.push(directoryPath.substring(root.length) || ".");
1688
+ };
1689
+ }
1690
+ function pushDirectoryFilterWithRelativePath(root) {
1691
+ return function(directoryPath, paths, filters) {
1692
+ const relativePath = directoryPath.substring(root.length) || ".";
1693
+ if (filters.every((filter)=>filter(relativePath, true))) paths.push(relativePath);
1694
+ };
1695
+ }
1696
+ const pushDirectory = (directoryPath, paths)=>{
1697
+ paths.push(directoryPath || ".");
1698
+ };
1699
+ const pushDirectoryFilter = (directoryPath, paths, filters)=>{
1700
+ const path = directoryPath || ".";
1701
+ if (filters.every((filter)=>filter(path, true))) paths.push(path);
1702
+ };
1703
+ const empty$2 = ()=>{};
1704
+ function build$6(root, options) {
1705
+ const { includeDirs, filters, relativePaths } = options;
1706
+ if (!includeDirs) return empty$2;
1707
+ if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
1708
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory;
1709
+ }
1710
+ const pushFileFilterAndCount = (filename, _paths, counts, filters)=>{
1711
+ if (filters.every((filter)=>filter(filename, false))) counts.files++;
1712
+ };
1713
+ const pushFileFilter = (filename, paths, _counts, filters)=>{
1714
+ if (filters.every((filter)=>filter(filename, false))) paths.push(filename);
1715
+ };
1716
+ const pushFileCount = (_filename, _paths, counts, _filters)=>{
1717
+ counts.files++;
1718
+ };
1719
+ const pushFile = (filename, paths)=>{
1720
+ paths.push(filename);
1721
+ };
1722
+ const empty$1 = ()=>{};
1723
+ function build$5(options) {
1724
+ const { excludeFiles, filters, onlyCounts } = options;
1725
+ if (excludeFiles) return empty$1;
1726
+ if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
1727
+ if (onlyCounts) return pushFileCount;
1728
+ return pushFile;
1729
+ }
1730
+ const getArray = (paths)=>paths;
1731
+ const getArrayGroup = ()=>[
1732
+ ""
1733
+ ].slice(0, 0);
1734
+ function build$4(options) {
1735
+ return options.group ? getArrayGroup : getArray;
1736
+ }
1737
+ const groupFiles = (groups, directory, files)=>{
1738
+ groups.push({
1739
+ directory,
1740
+ files,
1741
+ dir: directory
1742
+ });
1743
+ };
1744
+ const empty = ()=>{};
1745
+ function build$3(options) {
1746
+ return options.group ? groupFiles : empty;
1747
+ }
1748
+ const resolveSymlinksAsync = function(path, state, callback$1) {
1749
+ const { queue, fs, options: { suppressErrors } } = state;
1750
+ queue.enqueue();
1751
+ fs.realpath(path, (error, resolvedPath)=>{
1752
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
1753
+ fs.stat(resolvedPath, (error$1, stat)=>{
1754
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
1755
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
1756
+ callback$1(stat, resolvedPath);
1757
+ queue.dequeue(null, state);
1758
+ });
1759
+ });
1760
+ };
1761
+ const resolveSymlinks = function(path, state, callback$1) {
1762
+ const { queue, fs, options: { suppressErrors } } = state;
1763
+ queue.enqueue();
1764
+ try {
1765
+ const resolvedPath = fs.realpathSync(path);
1766
+ const stat = fs.statSync(resolvedPath);
1767
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return;
1768
+ callback$1(stat, resolvedPath);
1769
+ } catch (e) {
1770
+ if (!suppressErrors) throw e;
1771
+ }
1772
+ };
1773
+ function build$2(options, isSynchronous) {
1774
+ if (!options.resolveSymlinks || options.excludeSymlinks) return null;
1775
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
1776
+ }
1777
+ function isRecursive(path, resolved, state) {
1778
+ if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
1779
+ let parent = dirname(path);
1780
+ let depth = 1;
1781
+ while(parent !== state.root && depth < 2){
1782
+ const resolvedPath = state.symlinks.get(parent);
1783
+ const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
1784
+ if (isSameRoot) depth++;
1785
+ else parent = dirname(parent);
1786
+ }
1787
+ state.symlinks.set(path, resolved);
1788
+ return depth > 1;
1789
+ }
1790
+ function isRecursiveUsingRealPaths(resolved, state) {
1791
+ return state.visited.includes(resolved + state.options.pathSeparator);
1792
+ }
1793
+ const onlyCountsSync = (state)=>state.counts;
1794
+ const groupsSync = (state)=>state.groups;
1795
+ const defaultSync = (state)=>state.paths;
1796
+ const limitFilesSync = (state)=>state.paths.slice(0, state.options.maxFiles);
1797
+ const onlyCountsAsync = (state, error, callback$1)=>{
1798
+ report(error, callback$1, state.counts, state.options.suppressErrors);
1799
+ return null;
1800
+ };
1801
+ const defaultAsync = (state, error, callback$1)=>{
1802
+ report(error, callback$1, state.paths, state.options.suppressErrors);
1803
+ return null;
1804
+ };
1805
+ const limitFilesAsync = (state, error, callback$1)=>{
1806
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
1807
+ return null;
1808
+ };
1809
+ const groupsAsync = (state, error, callback$1)=>{
1810
+ report(error, callback$1, state.groups, state.options.suppressErrors);
1811
+ return null;
1812
+ };
1813
+ function report(error, callback$1, output, suppressErrors) {
1814
+ callback$1(error && !suppressErrors ? error : null, output);
1815
+ }
1816
+ function build$1(options, isSynchronous) {
1817
+ const { onlyCounts, group, maxFiles } = options;
1818
+ if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
1819
+ if (group) return isSynchronous ? groupsSync : groupsAsync;
1820
+ if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
1821
+ return isSynchronous ? defaultSync : defaultAsync;
1822
+ }
1823
+ const readdirOpts = {
1824
+ withFileTypes: true
1825
+ };
1826
+ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1)=>{
1827
+ state.queue.enqueue();
1828
+ if (currentDepth < 0) return state.queue.dequeue(null, state);
1829
+ const { fs } = state;
1830
+ state.visited.push(crawlPath);
1831
+ state.counts.directories++;
1832
+ fs.readdir(crawlPath || ".", readdirOpts, (error, entries = [])=>{
1833
+ callback$1(entries, directoryPath, currentDepth);
1834
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
1835
+ });
1836
+ };
1837
+ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1)=>{
1838
+ const { fs } = state;
1839
+ if (currentDepth < 0) return;
1840
+ state.visited.push(crawlPath);
1841
+ state.counts.directories++;
1842
+ let entries = [];
1843
+ try {
1844
+ entries = fs.readdirSync(crawlPath || ".", readdirOpts);
1845
+ } catch (e) {
1846
+ if (!state.options.suppressErrors) throw e;
1847
+ }
1848
+ callback$1(entries, directoryPath, currentDepth);
1849
+ };
1850
+ function build(isSynchronous) {
1851
+ return isSynchronous ? walkSync : walkAsync;
1852
+ }
1853
+ var Queue = class {
1854
+ count = 0;
1855
+ constructor(onQueueEmpty){
1856
+ this.onQueueEmpty = onQueueEmpty;
1857
+ }
1858
+ enqueue() {
1859
+ this.count++;
1860
+ return this.count;
1861
+ }
1862
+ dequeue(error, output) {
1863
+ if (this.onQueueEmpty && (--this.count <= 0 || error)) {
1864
+ this.onQueueEmpty(error, output);
1865
+ if (error) {
1866
+ output.controller.abort();
1867
+ this.onQueueEmpty = void 0;
1868
+ }
1869
+ }
1870
+ }
1871
+ };
1872
+ var Counter = class {
1873
+ _files = 0;
1874
+ _directories = 0;
1875
+ set files(num) {
1876
+ this._files = num;
1877
+ }
1878
+ get files() {
1879
+ return this._files;
1880
+ }
1881
+ set directories(num) {
1882
+ this._directories = num;
1883
+ }
1884
+ get directories() {
1885
+ return this._directories;
1886
+ }
1887
+ get dirs() {
1888
+ return this._directories;
1889
+ }
1890
+ };
1891
+ var Aborter = class {
1892
+ aborted = false;
1893
+ abort() {
1894
+ this.aborted = true;
1895
+ }
1896
+ };
1897
+ var Walker = class {
1898
+ root;
1899
+ isSynchronous;
1900
+ state;
1901
+ joinPath;
1902
+ pushDirectory;
1903
+ pushFile;
1904
+ getArray;
1905
+ groupFiles;
1906
+ resolveSymlink;
1907
+ walkDirectory;
1908
+ callbackInvoker;
1909
+ constructor(root, options, callback$1){
1910
+ this.isSynchronous = !callback$1;
1911
+ this.callbackInvoker = build$1(options, this.isSynchronous);
1912
+ this.root = normalizePath(root, options);
1913
+ this.state = {
1914
+ root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
1915
+ paths: [
1916
+ ""
1917
+ ].slice(0, 0),
1918
+ groups: [],
1919
+ counts: new Counter(),
1920
+ options,
1921
+ queue: new Queue((error, state)=>this.callbackInvoker(state, error, callback$1)),
1922
+ symlinks: /* @__PURE__ */ new Map(),
1923
+ visited: [
1924
+ ""
1925
+ ].slice(0, 0),
1926
+ controller: new Aborter(),
1927
+ fs: options.fs || __rspack_external_fs
1928
+ };
1929
+ this.joinPath = build$7(this.root, options);
1930
+ this.pushDirectory = build$6(this.root, options);
1931
+ this.pushFile = build$5(options);
1932
+ this.getArray = build$4(options);
1933
+ this.groupFiles = build$3(options);
1934
+ this.resolveSymlink = build$2(options, this.isSynchronous);
1935
+ this.walkDirectory = build(this.isSynchronous);
1936
+ }
1937
+ start() {
1938
+ this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
1939
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
1940
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
1941
+ }
1942
+ walk = (entries, directoryPath, depth)=>{
1943
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
1944
+ if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
1945
+ const files = this.getArray(this.state.paths);
1946
+ for(let i = 0; i < entries.length; ++i){
1947
+ const entry = entries[i];
1948
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
1949
+ const filename = this.joinPath(entry.name, directoryPath);
1950
+ this.pushFile(filename, files, this.state.counts, filters);
1951
+ } else if (entry.isDirectory()) {
1952
+ let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
1953
+ if (exclude && exclude(entry.name, path)) continue;
1954
+ this.pushDirectory(path, paths, filters);
1955
+ this.walkDirectory(this.state, path, path, depth - 1, this.walk);
1956
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
1957
+ let path = joinPathWithBasePath(entry.name, directoryPath);
1958
+ this.resolveSymlink(path, this.state, (stat, resolvedPath)=>{
1959
+ if (stat.isDirectory()) {
1960
+ resolvedPath = normalizePath(resolvedPath, this.state.options);
1961
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
1962
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
1963
+ } else {
1964
+ resolvedPath = useRealPaths ? resolvedPath : path;
1965
+ const filename = basename(resolvedPath);
1966
+ const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
1967
+ resolvedPath = this.joinPath(filename, directoryPath$1);
1968
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
1969
+ }
1970
+ });
1971
+ }
1972
+ }
1973
+ this.groupFiles(this.state.groups, directoryPath, files);
1974
+ };
1975
+ };
1976
+ function promise(root, options) {
1977
+ return new Promise((resolve$1, reject)=>{
1978
+ callback(root, options, (err, output)=>{
1979
+ if (err) return reject(err);
1980
+ resolve$1(output);
1981
+ });
1982
+ });
1983
+ }
1984
+ function callback(root, options, callback$1) {
1985
+ let walker = new Walker(root, options, callback$1);
1986
+ walker.start();
1987
+ }
1988
+ function sync(root, options) {
1989
+ const walker = new Walker(root, options);
1990
+ return walker.start();
1991
+ }
1992
+ var APIBuilder = class {
1993
+ constructor(root, options){
1994
+ this.root = root;
1995
+ this.options = options;
1996
+ }
1997
+ withPromise() {
1998
+ return promise(this.root, this.options);
1999
+ }
2000
+ withCallback(cb) {
2001
+ callback(this.root, this.options, cb);
2002
+ }
2003
+ sync() {
2004
+ return sync(this.root, this.options);
2005
+ }
2006
+ };
2007
+ let pm = null;
2008
+ try {
2009
+ __require.resolve("picomatch");
2010
+ pm = __require("picomatch");
2011
+ } catch {}
2012
+ var Builder = class {
2013
+ globCache = {};
2014
+ options = {
2015
+ maxDepth: 1 / 0,
2016
+ suppressErrors: true,
2017
+ pathSeparator: sep,
2018
+ filters: []
2019
+ };
2020
+ globFunction;
2021
+ constructor(options){
2022
+ this.options = {
2023
+ ...this.options,
2024
+ ...options
2025
+ };
2026
+ this.globFunction = this.options.globFunction;
2027
+ }
2028
+ group() {
2029
+ this.options.group = true;
2030
+ return this;
2031
+ }
2032
+ withPathSeparator(separator) {
2033
+ this.options.pathSeparator = separator;
2034
+ return this;
2035
+ }
2036
+ withBasePath() {
2037
+ this.options.includeBasePath = true;
2038
+ return this;
2039
+ }
2040
+ withRelativePaths() {
2041
+ this.options.relativePaths = true;
2042
+ return this;
2043
+ }
2044
+ withDirs() {
2045
+ this.options.includeDirs = true;
2046
+ return this;
2047
+ }
2048
+ withMaxDepth(depth) {
2049
+ this.options.maxDepth = depth;
2050
+ return this;
2051
+ }
2052
+ withMaxFiles(limit) {
2053
+ this.options.maxFiles = limit;
2054
+ return this;
2055
+ }
2056
+ withFullPaths() {
2057
+ this.options.resolvePaths = true;
2058
+ this.options.includeBasePath = true;
2059
+ return this;
2060
+ }
2061
+ withErrors() {
2062
+ this.options.suppressErrors = false;
2063
+ return this;
2064
+ }
2065
+ withSymlinks({ resolvePaths = true } = {}) {
2066
+ this.options.resolveSymlinks = true;
2067
+ this.options.useRealPaths = resolvePaths;
2068
+ return this.withFullPaths();
2069
+ }
2070
+ withAbortSignal(signal) {
2071
+ this.options.signal = signal;
2072
+ return this;
2073
+ }
2074
+ normalize() {
2075
+ this.options.normalizePath = true;
2076
+ return this;
2077
+ }
2078
+ filter(predicate) {
2079
+ this.options.filters.push(predicate);
2080
+ return this;
2081
+ }
2082
+ onlyDirs() {
2083
+ this.options.excludeFiles = true;
2084
+ this.options.includeDirs = true;
2085
+ return this;
2086
+ }
2087
+ exclude(predicate) {
2088
+ this.options.exclude = predicate;
2089
+ return this;
2090
+ }
2091
+ onlyCounts() {
2092
+ this.options.onlyCounts = true;
2093
+ return this;
2094
+ }
2095
+ crawl(root) {
2096
+ return new APIBuilder(root || ".", this.options);
2097
+ }
2098
+ withGlobFunction(fn) {
2099
+ this.globFunction = fn;
2100
+ return this;
2101
+ }
2102
+ crawlWithOptions(root, options) {
2103
+ this.options = {
2104
+ ...this.options,
2105
+ ...options
2106
+ };
2107
+ return new APIBuilder(root || ".", this.options);
2108
+ }
2109
+ glob(...patterns) {
2110
+ if (this.globFunction) return this.globWithOptions(patterns);
2111
+ return this.globWithOptions(patterns, {
2112
+ dot: true
2113
+ });
2114
+ }
2115
+ globWithOptions(patterns, ...options) {
2116
+ const globFn = this.globFunction || pm;
2117
+ if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
2118
+ var isMatch = this.globCache[patterns.join("\0")];
2119
+ if (!isMatch) {
2120
+ isMatch = globFn(patterns, ...options);
2121
+ this.globCache[patterns.join("\0")] = isMatch;
2122
+ }
2123
+ this.options.filters.push((path)=>isMatch(path));
2124
+ return this;
2125
+ }
2126
+ };
2127
+ const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js");
2128
+ const isReadonlyArray = Array.isArray;
2129
+ const isWin = "win32" === process.platform;
2130
+ const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2131
+ function getPartialMatcher(patterns, options = {}) {
2132
+ const patternsCount = patterns.length;
2133
+ const patternsParts = Array(patternsCount);
2134
+ const matchers = Array(patternsCount);
2135
+ const globstarEnabled = !options.noglobstar;
2136
+ for(let i = 0; i < patternsCount; i++){
2137
+ const parts = splitPattern(patterns[i]);
2138
+ patternsParts[i] = parts;
2139
+ const partsCount = parts.length;
2140
+ const partMatchers = Array(partsCount);
2141
+ for(let j = 0; j < partsCount; j++)partMatchers[j] = picomatch(parts[j], options);
2142
+ matchers[i] = partMatchers;
2143
+ }
2144
+ return (input)=>{
2145
+ const inputParts = input.split("/");
2146
+ if (".." === inputParts[0] && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2147
+ for(let i = 0; i < patterns.length; i++){
2148
+ const patternParts = patternsParts[i];
2149
+ const matcher = matchers[i];
2150
+ const inputPatternCount = inputParts.length;
2151
+ const minParts = Math.min(inputPatternCount, patternParts.length);
2152
+ let j = 0;
2153
+ while(j < minParts){
2154
+ const part = patternParts[j];
2155
+ if (part.includes("/")) return true;
2156
+ const match = matcher[j](inputParts[j]);
2157
+ if (!match) break;
2158
+ if (globstarEnabled && "**" === part) return true;
2159
+ j++;
2160
+ }
2161
+ if (j === inputPatternCount) return true;
2162
+ }
2163
+ return false;
2164
+ };
2165
+ }
2166
+ const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
2167
+ const isRoot = isWin ? (p)=>WIN32_ROOT_DIR.test(p) : (p)=>"/" === p;
2168
+ function buildFormat(cwd, root, absolute) {
2169
+ if (cwd === root || root.startsWith(`${cwd}/`)) {
2170
+ if (absolute) {
2171
+ const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
2172
+ return (p, isDir)=>p.slice(start, isDir ? -1 : void 0) || ".";
2173
+ }
2174
+ const prefix = root.slice(cwd.length + 1);
2175
+ if (prefix) return (p, isDir)=>{
2176
+ if ("." === p) return prefix;
2177
+ const result = `${prefix}/${p}`;
2178
+ return isDir ? result.slice(0, -1) : result;
2179
+ };
2180
+ return (p, isDir)=>isDir && "." !== p ? p.slice(0, -1) : p;
2181
+ }
2182
+ if (absolute) return (p)=>posix.relative(cwd, p) || ".";
2183
+ return (p)=>posix.relative(cwd, `${root}/${p}`) || ".";
2184
+ }
2185
+ function buildRelative(cwd, root) {
2186
+ if (root.startsWith(`${cwd}/`)) {
2187
+ const prefix = root.slice(cwd.length + 1);
2188
+ return (p)=>`${prefix}/${p}`;
2189
+ }
2190
+ return (p)=>{
2191
+ const result = posix.relative(cwd, `${root}/${p}`);
2192
+ if (p.endsWith("/") && "" !== result) return `${result}/`;
2193
+ return result || ".";
2194
+ };
2195
+ }
2196
+ const splitPatternOptions = {
2197
+ parts: true
2198
+ };
2199
+ function splitPattern(path$1) {
2200
+ var _result$parts;
2201
+ const result = picomatch.scan(path$1, splitPatternOptions);
2202
+ return (null == (_result$parts = result.parts) ? void 0 : _result$parts.length) ? result.parts : [
2203
+ path$1
2204
+ ];
2205
+ }
2206
+ const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2207
+ const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2208
+ const escapePosixPath = (path$1)=>path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2209
+ const escapeWin32Path = (path$1)=>path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2210
+ const escapePath = isWin ? escapeWin32Path : escapePosixPath;
2211
+ function isDynamicPattern(pattern, options) {
2212
+ if ((null == options ? void 0 : options.caseSensitiveMatch) === false) return true;
2213
+ const scan = picomatch.scan(pattern);
2214
+ return scan.isGlob || scan.negated;
2215
+ }
2216
+ function log(...tasks) {
2217
+ console.log(`[tinyglobby ${/* @__PURE__ */ new Date().toLocaleTimeString("es")}]`, ...tasks);
2218
+ }
2219
+ const PARENT_DIRECTORY = /^(\/?\.\.)+/;
2220
+ const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2221
+ const BACKSLASHES = /\\/g;
2222
+ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2223
+ let result = pattern;
2224
+ if (pattern.endsWith("/")) result = pattern.slice(0, -1);
2225
+ if (!result.endsWith("*") && expandDirectories) result += "/**";
2226
+ const escapedCwd = escapePath(cwd);
2227
+ result = path_0.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
2228
+ const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2229
+ const parts = splitPattern(result);
2230
+ if (null == parentDirectoryMatch ? void 0 : parentDirectoryMatch[0]) {
2231
+ const n = (parentDirectoryMatch[0].length + 1) / 3;
2232
+ let i = 0;
2233
+ const cwdParts = escapedCwd.split("/");
2234
+ while(i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]){
2235
+ result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2236
+ i++;
2237
+ }
2238
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
2239
+ if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
2240
+ props.root = potentialRoot;
2241
+ props.depthOffset = -n + i;
2242
+ }
2243
+ }
2244
+ if (!isIgnore && props.depthOffset >= 0) {
2245
+ null != props.commonPath || (props.commonPath = parts);
2246
+ const newCommonPath = [];
2247
+ const length = Math.min(props.commonPath.length, parts.length);
2248
+ for(let i = 0; i < length; i++){
2249
+ const part = parts[i];
2250
+ if ("**" === part && !parts[i + 1]) {
2251
+ newCommonPath.pop();
2252
+ break;
2253
+ }
2254
+ if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
2255
+ newCommonPath.push(part);
2256
+ }
2257
+ props.depthOffset = newCommonPath.length;
2258
+ props.commonPath = newCommonPath;
2259
+ props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
2260
+ }
2261
+ return result;
2262
+ }
2263
+ function processPatterns({ patterns = [
2264
+ "**/*"
2265
+ ], ignore = [], expandDirectories = true }, cwd, props) {
2266
+ if ("string" == typeof patterns) patterns = [
2267
+ patterns
2268
+ ];
2269
+ if ("string" == typeof ignore) ignore = [
2270
+ ignore
2271
+ ];
2272
+ const matchPatterns = [];
2273
+ const ignorePatterns = [];
2274
+ for (const pattern of ignore)if (pattern) {
2275
+ if ("!" !== pattern[0] || "(" === pattern[1]) ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
2276
+ }
2277
+ for (const pattern of patterns)if (pattern) {
2278
+ if ("!" !== pattern[0] || "(" === pattern[1]) matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
2279
+ else if ("!" !== pattern[1] || "(" === pattern[2]) ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
2280
+ }
2281
+ return {
2282
+ match: matchPatterns,
2283
+ ignore: ignorePatterns
2284
+ };
2285
+ }
2286
+ function formatPaths(paths, relative) {
2287
+ for(let i = paths.length - 1; i >= 0; i--){
2288
+ const path$1 = paths[i];
2289
+ paths[i] = relative(path$1);
2290
+ }
2291
+ return paths;
2292
+ }
2293
+ function normalizeCwd(cwd) {
2294
+ if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
2295
+ if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
2296
+ return path_0.resolve(cwd).replace(BACKSLASHES, "/");
2297
+ }
2298
+ function getCrawler(patterns, inputOptions = {}) {
2299
+ const options = process.env.TINYGLOBBY_DEBUG ? {
2300
+ ...inputOptions,
2301
+ debug: true
2302
+ } : inputOptions;
2303
+ const cwd = normalizeCwd(options.cwd);
2304
+ if (options.debug) log("globbing with:", {
2305
+ patterns,
2306
+ options,
2307
+ cwd
2308
+ });
2309
+ if (Array.isArray(patterns) && 0 === patterns.length) return [
2310
+ {
2311
+ sync: ()=>[],
2312
+ withPromise: async ()=>[]
2313
+ },
2314
+ false
2315
+ ];
2316
+ const props = {
2317
+ root: cwd,
2318
+ commonPath: null,
2319
+ depthOffset: 0
2320
+ };
2321
+ const processed = processPatterns({
2322
+ ...options,
2323
+ patterns
2324
+ }, cwd, props);
2325
+ if (options.debug) log("internal processing patterns:", processed);
2326
+ const matchOptions = {
2327
+ dot: options.dot,
2328
+ nobrace: false === options.braceExpansion,
2329
+ nocase: false === options.caseSensitiveMatch,
2330
+ noextglob: false === options.extglob,
2331
+ noglobstar: false === options.globstar,
2332
+ posix: true
2333
+ };
2334
+ const matcher = picomatch(processed.match, {
2335
+ ...matchOptions,
2336
+ ignore: processed.ignore
2337
+ });
2338
+ const ignore = picomatch(processed.ignore, matchOptions);
2339
+ const partialMatcher = getPartialMatcher(processed.match, matchOptions);
2340
+ const format = buildFormat(cwd, props.root, options.absolute);
2341
+ const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
2342
+ const fdirOptions = {
2343
+ filters: [
2344
+ options.debug ? (p, isDirectory)=>{
2345
+ const path$1 = format(p, isDirectory);
2346
+ const matches = matcher(path$1);
2347
+ if (matches) log(`matched ${path$1}`);
2348
+ return matches;
2349
+ } : (p, isDirectory)=>matcher(format(p, isDirectory))
2350
+ ],
2351
+ exclude: options.debug ? (_, p)=>{
2352
+ const relativePath = formatExclude(p, true);
2353
+ const skipped = "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
2354
+ skipped ? log(`skipped ${p}`) : log(`crawling ${p}`);
2355
+ return skipped;
2356
+ } : (_, p)=>{
2357
+ const relativePath = formatExclude(p, true);
2358
+ return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
2359
+ },
2360
+ fs: options.fs ? {
2361
+ readdir: options.fs.readdir || fs_0.readdir,
2362
+ readdirSync: options.fs.readdirSync || fs_0.readdirSync,
2363
+ realpath: options.fs.realpath || fs_0.realpath,
2364
+ realpathSync: options.fs.realpathSync || fs_0.realpathSync,
2365
+ stat: options.fs.stat || fs_0.stat,
2366
+ statSync: options.fs.statSync || fs_0.statSync
2367
+ } : void 0,
2368
+ pathSeparator: "/",
2369
+ relativePaths: true,
2370
+ resolveSymlinks: true,
2371
+ signal: options.signal
2372
+ };
2373
+ if (void 0 !== options.deep) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
2374
+ if (options.absolute) {
2375
+ fdirOptions.relativePaths = false;
2376
+ fdirOptions.resolvePaths = true;
2377
+ fdirOptions.includeBasePath = true;
2378
+ }
2379
+ if (false === options.followSymbolicLinks) {
2380
+ fdirOptions.resolveSymlinks = false;
2381
+ fdirOptions.excludeSymlinks = true;
2382
+ }
2383
+ if (options.onlyDirectories) {
2384
+ fdirOptions.excludeFiles = true;
2385
+ fdirOptions.includeDirs = true;
2386
+ } else if (false === options.onlyFiles) fdirOptions.includeDirs = true;
2387
+ props.root = props.root.replace(BACKSLASHES, "");
2388
+ const root = props.root;
2389
+ if (options.debug) log("internal properties:", props);
2390
+ const relative = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
2391
+ return [
2392
+ new Builder(fdirOptions).crawl(root),
2393
+ relative
2394
+ ];
2395
+ }
2396
+ async function glob(patternsOrOptions, options) {
2397
+ if (patternsOrOptions && (null == options ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
2398
+ const isModern = isReadonlyArray(patternsOrOptions) || "string" == typeof patternsOrOptions;
2399
+ const opts = isModern ? options : patternsOrOptions;
2400
+ const patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;
2401
+ const [crawler, relative] = getCrawler(patterns, opts);
2402
+ if (!relative) return crawler.withPromise();
2403
+ return formatPaths(await crawler.withPromise(), relative);
2404
+ }
2405
+ const PLUGIN_VIRTUAL_MODULE_NAME = 'rsbuild:virtual-module';
2406
+ const pluginVirtualModule = (pluginOptions = {})=>({
2407
+ name: PLUGIN_VIRTUAL_MODULE_NAME,
2408
+ async setup (api) {
2409
+ const { virtualModules = {}, tempDir: virtualFolderName = '.rsbuild-virtual-module' } = pluginOptions;
2410
+ const TEMP_DIR = join(api.context.rootPath, virtualFolderName);
2411
+ const virtualFileAbsolutePaths = Object.keys(virtualModules).map((i)=>{
2412
+ let absolutePath = join(TEMP_DIR, i);
2413
+ if (!extname(absolutePath)) absolutePath = `${absolutePath}.js`;
2414
+ return [
2415
+ i,
2416
+ absolutePath
2417
+ ];
2418
+ });
2419
+ api.modifyBundlerChain((chain, { rspack })=>{
2420
+ const pluginId = 'RSBUILD_VIRTUAL_MODULE_PLUGIN';
2421
+ const virtualModules = Object.fromEntries(virtualFileAbsolutePaths.map((i)=>[
2422
+ i[1],
2423
+ ''
2424
+ ]));
2425
+ if (chain.plugins.has(pluginId)) chain.plugin(pluginId).tap((options)=>{
2426
+ const existingPaths = new Set(Object.keys(options[0] ?? {}));
2427
+ const conflictPath = virtualFileAbsolutePaths.find(([, path])=>existingPaths.has(path));
2428
+ if (conflictPath) throw new Error(`Virtual module name conflicted: ${conflictPath[0]}`);
2429
+ return [
2430
+ {
2431
+ ...options[0],
2432
+ ...virtualModules
2433
+ }
2434
+ ];
2435
+ });
2436
+ else chain.plugin(pluginId).use(rspack.experiments.VirtualModulesPlugin, [
2437
+ virtualModules
2438
+ ]);
2439
+ chain.resolve.alias.merge(Object.fromEntries(virtualFileAbsolutePaths));
2440
+ });
2441
+ for (const [moduleName, absolutePath] of virtualFileAbsolutePaths){
2442
+ const handler = virtualModules[moduleName];
2443
+ if (handler) api.transform({
2444
+ test: absolutePath
2445
+ }, handler);
2446
+ }
2447
+ }
2448
+ });
2449
+ export { DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
2450
+ export { default as promises, mkdir, readdir, rm, stat as promises_stat, writeFile } from "node:fs/promises";
2451
+ export { MDX_OR_MD_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, getSidebarDataGroup, isDebugMode, isExternalUrl, normalizeHref, removeLeadingSlash, removeTrailingSlash, slash, withBase } from "@rspress/shared";
2452
+ export { logger } from "@rspress/shared/logger";
2453
+ export { extractTextAndId, getIconUrlPath, loadFrontMatter } from "@rspress/shared/node-utils";
2454
+ export { createRequire as external_node_module_createRequire } from "node:module";
2455
+ export { cwd as external_node_process_cwd } from "node:process";
2456
+ export { fileURLToPath as external_node_url_fileURLToPath, pathToFileURL } from "node:url";
2457
+ export { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
2458
+ export { chunk, groupBy } from "@rspress/shared/lodash-es";
2459
+ export { default as remark_gfm } from "remark-gfm";
2460
+ export { default as remark_parse } from "remark-parse";
2461
+ export { unified } from "unified";
2462
+ export { remove } from "unist-util-remove";
2463
+ export { default as node_fs } from "node:fs";
2464
+ export { createProcessor } from "@mdx-js/mdx";
2465
+ export { mergeRsbuildConfig, rspack as core_rspack } from "@rsbuild/core";
2466
+ export { createHash } from "node:crypto";
2467
+ export { default as node_os } from "node:os";
2468
+ export { matchPath } from "react-router-dom";
2469
+ export { createHead } from "@unhead/react/server";
2470
+ export { external_node_path_relative, extname, glob, join, node_path, pluginVirtualModule };