@rspress/core 2.0.16 → 2.0.17

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 (86) hide show
  1. package/bin/rspress.js +6 -1
  2. package/dist/0~execa.js +1 -1
  3. package/dist/{9882.js → 102.js} +1 -1
  4. package/dist/{9958.js → 7448.js} +1 -1
  5. package/dist/{5580.js → 8629.js} +2455 -6
  6. package/dist/cli/index.d.ts +8 -1
  7. package/dist/cli/index.js +105 -102
  8. package/dist/config/loadConfigFile.js +1 -1
  9. package/dist/eject-theme/components/Link/index.tsx +1 -1
  10. package/dist/eject-theme/components/Link/useLinkNavigate.ts +17 -4
  11. package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +48 -0
  12. package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +35 -20
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +2 -1
  15. package/dist/node/PluginDriver.js +1 -1
  16. package/dist/node/auto-nav-sidebar/index.js +1 -1
  17. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  18. package/dist/node/auto-nav-sidebar/normalize.js +2 -2
  19. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  20. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  21. package/dist/node/constants.js +1 -1
  22. package/dist/node/eject.js +2 -2
  23. package/dist/node/initRsbuild.js +5 -5
  24. package/dist/node/logger/hint.js +1 -1
  25. package/dist/node/mdx/options.js +1 -1
  26. package/dist/node/mdx/processor.js +1 -1
  27. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  28. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  29. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  30. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  31. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +2 -2
  32. package/dist/node/mdx/remarkPlugins/image.js +2 -2
  33. package/dist/node/mdx/remarkPlugins/link.js +2 -2
  34. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  35. package/dist/node/medium-zoom/index.js +1 -1
  36. package/dist/node/route/RoutePage.js +1 -1
  37. package/dist/node/route/RouteService.js +1 -1
  38. package/dist/node/route/extractPageData.js +1 -1
  39. package/dist/node/route/normalizeRoutePath.js +1 -1
  40. package/dist/node/runtimeModule/i18n.js +3 -3
  41. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  42. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  43. package/dist/node/runtimeModule/searchHooks.js +1 -1
  44. package/dist/node/runtimeModule/siteData/createSiteData.js +6 -2
  45. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  46. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  47. package/dist/node/serve.js +1 -1
  48. package/dist/node/ssg/htmlFile.js +1 -1
  49. package/dist/node/ssg/renderPage.js +2 -2
  50. package/dist/node/ssg/renderPageWorker.js +2 -2
  51. package/dist/node/ssg/renderPages.js +3 -3
  52. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  53. package/dist/node/ssg/ssgEnv.js +1 -1
  54. package/dist/node/ssg-md/llms/emitLlmsTxt.js +3 -3
  55. package/dist/node/ssg-md/llms/llmsTxt.d.ts +3 -3
  56. package/dist/node/ssg-md/llms/llmsTxt.js +8 -8
  57. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  58. package/dist/node/ssg-md/renderPage.js +2 -2
  59. package/dist/node/ssg-md/renderPages.js +3 -3
  60. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  61. package/dist/node/utils/checkLanguageParity.js +1 -1
  62. package/dist/node/utils/createHash.js +1 -1
  63. package/dist/node/utils/error.js +1 -1
  64. package/dist/node/utils/flattenMdxContent.js +1 -1
  65. package/dist/node/utils/fs.js +1 -1
  66. package/dist/node/utils/getPageKey.js +1 -1
  67. package/dist/node/utils/normalizePath.js +1 -1
  68. package/dist/node/utils/reactAlias.js +2 -2
  69. package/dist/runtime/ClientApp.js +3 -2
  70. package/dist/runtime/route.js +2 -0
  71. package/dist/theme/components/DocContent/docComponents/index.d.ts +25 -18
  72. package/dist/theme/components/Link/index.d.ts +1 -1
  73. package/dist/theme/components/Link/useLinkNavigate.d.ts +1 -1
  74. package/dist/theme/components/Link/useLinkNavigate.js +13 -5
  75. package/dist/theme/components/Search/SearchPanel.js +8 -8
  76. package/dist/theme/components/SocialLinks/GithubStars.js +27 -17
  77. package/dist/theme/logic/getCopyableText.js +1 -0
  78. package/package.json +9 -9
  79. package/dist/6010.js +0 -2461
  80. package/dist/{0~8787.js → 0~8016.js} +0 -0
  81. package/dist/{7986.js → 4538.js} +0 -0
  82. package/dist/{3358.js → 5357.js} +0 -0
  83. package/dist/{8005.js → 7748.js} +2 -2
  84. /package/dist/{5580.js.LICENSE.txt → 8629.js.LICENSE.txt} +0 -0
  85. /package/dist/{6646.js → 9857.js} +0 -0
  86. /package/dist/{9283.js → 9940.js} +0 -0
@@ -1,6 +1,11 @@
1
- /*! LICENSE: 5580.js.LICENSE.txt */
1
+ /*! LICENSE: 8629.js.LICENSE.txt */
2
+ import node_path, { extname, join, relative as external_node_path_relative } from "node:path";
2
3
  import { __webpack_require__ } from "./0~rslib-runtime.js";
3
- import "./6010.js";
4
+ import { fileURLToPath as external_url_fileURLToPath } from "url";
5
+ import { basename, dirname, isAbsolute, normalize, posix, relative as external_path_relative, resolve, sep } from "path";
6
+ import * as __rspack_external_fs from "fs";
7
+ import { readdir, readdirSync, realpath, realpathSync, stat as external_fs_stat, statSync } from "fs";
8
+ import { createRequire as external_module_createRequire } from "module";
4
9
  import { createRequire as __rspack_createRequire } from "node:module";
5
10
  const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
6
11
  __webpack_require__.add({
@@ -3830,6 +3835,1625 @@ __webpack_require__.add({
3830
3835
  return output;
3831
3836
  };
3832
3837
  },
3838
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
3839
+ const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js");
3840
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
3841
+ function picomatch(glob, options, returnState = false) {
3842
+ if (options && (null === options.windows || void 0 === options.windows)) options = {
3843
+ ...options,
3844
+ windows: utils.isWindows()
3845
+ };
3846
+ return pico(glob, options, returnState);
3847
+ }
3848
+ Object.assign(picomatch, pico);
3849
+ module.exports = picomatch;
3850
+ },
3851
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js" (module) {
3852
+ const WIN_SLASH = '\\\\/';
3853
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
3854
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
3855
+ const DOT_LITERAL = '\\.';
3856
+ const PLUS_LITERAL = '\\+';
3857
+ const QMARK_LITERAL = '\\?';
3858
+ const SLASH_LITERAL = '\\/';
3859
+ const ONE_CHAR = '(?=.)';
3860
+ const QMARK = '[^/]';
3861
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
3862
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
3863
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
3864
+ const NO_DOT = `(?!${DOT_LITERAL})`;
3865
+ const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
3866
+ const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
3867
+ const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
3868
+ const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
3869
+ const STAR = `${QMARK}*?`;
3870
+ const SEP = '/';
3871
+ const POSIX_CHARS = {
3872
+ DOT_LITERAL,
3873
+ PLUS_LITERAL,
3874
+ QMARK_LITERAL,
3875
+ SLASH_LITERAL,
3876
+ ONE_CHAR,
3877
+ QMARK,
3878
+ END_ANCHOR,
3879
+ DOTS_SLASH,
3880
+ NO_DOT,
3881
+ NO_DOTS,
3882
+ NO_DOT_SLASH,
3883
+ NO_DOTS_SLASH,
3884
+ QMARK_NO_DOT,
3885
+ STAR,
3886
+ START_ANCHOR,
3887
+ SEP
3888
+ };
3889
+ const WINDOWS_CHARS = {
3890
+ ...POSIX_CHARS,
3891
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
3892
+ QMARK: WIN_NO_SLASH,
3893
+ STAR: `${WIN_NO_SLASH}*?`,
3894
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
3895
+ NO_DOT: `(?!${DOT_LITERAL})`,
3896
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
3897
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
3898
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
3899
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
3900
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
3901
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
3902
+ SEP: '\\'
3903
+ };
3904
+ const POSIX_REGEX_SOURCE = {
3905
+ __proto__: null,
3906
+ alnum: 'a-zA-Z0-9',
3907
+ alpha: 'a-zA-Z',
3908
+ ascii: '\\x00-\\x7F',
3909
+ blank: ' \\t',
3910
+ cntrl: '\\x00-\\x1F\\x7F',
3911
+ digit: '0-9',
3912
+ graph: '\\x21-\\x7E',
3913
+ lower: 'a-z',
3914
+ print: '\\x20-\\x7E ',
3915
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
3916
+ space: ' \\t\\r\\n\\v\\f',
3917
+ upper: 'A-Z',
3918
+ word: 'A-Za-z0-9_',
3919
+ xdigit: 'A-Fa-f0-9'
3920
+ };
3921
+ module.exports = {
3922
+ DEFAULT_MAX_EXTGLOB_RECURSION,
3923
+ MAX_LENGTH: 65536,
3924
+ POSIX_REGEX_SOURCE,
3925
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
3926
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
3927
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
3928
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
3929
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
3930
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
3931
+ REPLACEMENTS: {
3932
+ __proto__: null,
3933
+ '***': '*',
3934
+ '**/**': '**',
3935
+ '**/**/**': '**'
3936
+ },
3937
+ CHAR_0: 48,
3938
+ CHAR_9: 57,
3939
+ CHAR_UPPERCASE_A: 65,
3940
+ CHAR_LOWERCASE_A: 97,
3941
+ CHAR_UPPERCASE_Z: 90,
3942
+ CHAR_LOWERCASE_Z: 122,
3943
+ CHAR_LEFT_PARENTHESES: 40,
3944
+ CHAR_RIGHT_PARENTHESES: 41,
3945
+ CHAR_ASTERISK: 42,
3946
+ CHAR_AMPERSAND: 38,
3947
+ CHAR_AT: 64,
3948
+ CHAR_BACKWARD_SLASH: 92,
3949
+ CHAR_CARRIAGE_RETURN: 13,
3950
+ CHAR_CIRCUMFLEX_ACCENT: 94,
3951
+ CHAR_COLON: 58,
3952
+ CHAR_COMMA: 44,
3953
+ CHAR_DOT: 46,
3954
+ CHAR_DOUBLE_QUOTE: 34,
3955
+ CHAR_EQUAL: 61,
3956
+ CHAR_EXCLAMATION_MARK: 33,
3957
+ CHAR_FORM_FEED: 12,
3958
+ CHAR_FORWARD_SLASH: 47,
3959
+ CHAR_GRAVE_ACCENT: 96,
3960
+ CHAR_HASH: 35,
3961
+ CHAR_HYPHEN_MINUS: 45,
3962
+ CHAR_LEFT_ANGLE_BRACKET: 60,
3963
+ CHAR_LEFT_CURLY_BRACE: 123,
3964
+ CHAR_LEFT_SQUARE_BRACKET: 91,
3965
+ CHAR_LINE_FEED: 10,
3966
+ CHAR_NO_BREAK_SPACE: 160,
3967
+ CHAR_PERCENT: 37,
3968
+ CHAR_PLUS: 43,
3969
+ CHAR_QUESTION_MARK: 63,
3970
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
3971
+ CHAR_RIGHT_CURLY_BRACE: 125,
3972
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
3973
+ CHAR_SEMICOLON: 59,
3974
+ CHAR_SINGLE_QUOTE: 39,
3975
+ CHAR_SPACE: 32,
3976
+ CHAR_TAB: 9,
3977
+ CHAR_UNDERSCORE: 95,
3978
+ CHAR_VERTICAL_LINE: 124,
3979
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
3980
+ extglobChars (chars) {
3981
+ return {
3982
+ '!': {
3983
+ type: 'negate',
3984
+ open: '(?:(?!(?:',
3985
+ close: `))${chars.STAR})`
3986
+ },
3987
+ '?': {
3988
+ type: 'qmark',
3989
+ open: '(?:',
3990
+ close: ')?'
3991
+ },
3992
+ '+': {
3993
+ type: 'plus',
3994
+ open: '(?:',
3995
+ close: ')+'
3996
+ },
3997
+ '*': {
3998
+ type: 'star',
3999
+ open: '(?:',
4000
+ close: ')*'
4001
+ },
4002
+ '@': {
4003
+ type: 'at',
4004
+ open: '(?:',
4005
+ close: ')'
4006
+ }
4007
+ };
4008
+ },
4009
+ globChars (win32) {
4010
+ return true === win32 ? WINDOWS_CHARS : POSIX_CHARS;
4011
+ }
4012
+ };
4013
+ },
4014
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
4015
+ const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
4016
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
4017
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
4018
+ const expandRange = (args, options)=>{
4019
+ if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
4020
+ args.sort();
4021
+ const value = `[${args.join('-')}]`;
4022
+ try {
4023
+ new RegExp(value);
4024
+ } catch (ex) {
4025
+ return args.map((v)=>utils.escapeRegex(v)).join('..');
4026
+ }
4027
+ return value;
4028
+ };
4029
+ const syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
4030
+ const splitTopLevel = (input)=>{
4031
+ const parts = [];
4032
+ let bracket = 0;
4033
+ let paren = 0;
4034
+ let quote = 0;
4035
+ let value = '';
4036
+ let escaped = false;
4037
+ for (const ch of input){
4038
+ if (true === escaped) {
4039
+ value += ch;
4040
+ escaped = false;
4041
+ continue;
4042
+ }
4043
+ if ('\\' === ch) {
4044
+ value += ch;
4045
+ escaped = true;
4046
+ continue;
4047
+ }
4048
+ if ('"' === ch) {
4049
+ quote = 1 === quote ? 0 : 1;
4050
+ value += ch;
4051
+ continue;
4052
+ }
4053
+ if (0 === quote) {
4054
+ if ('[' === ch) bracket++;
4055
+ else if (']' === ch && bracket > 0) bracket--;
4056
+ else if (0 === bracket) {
4057
+ if ('(' === ch) paren++;
4058
+ else if (')' === ch && paren > 0) paren--;
4059
+ else if ('|' === ch && 0 === paren) {
4060
+ parts.push(value);
4061
+ value = '';
4062
+ continue;
4063
+ }
4064
+ }
4065
+ }
4066
+ value += ch;
4067
+ }
4068
+ parts.push(value);
4069
+ return parts;
4070
+ };
4071
+ const isPlainBranch = (branch)=>{
4072
+ let escaped = false;
4073
+ for (const ch of branch){
4074
+ if (true === escaped) {
4075
+ escaped = false;
4076
+ continue;
4077
+ }
4078
+ if ('\\' === ch) {
4079
+ escaped = true;
4080
+ continue;
4081
+ }
4082
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
4083
+ }
4084
+ return true;
4085
+ };
4086
+ const normalizeSimpleBranch = (branch)=>{
4087
+ let value = branch.trim();
4088
+ let changed = true;
4089
+ while(true === changed){
4090
+ changed = false;
4091
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
4092
+ value = value.slice(2, -1);
4093
+ changed = true;
4094
+ }
4095
+ }
4096
+ if (!isPlainBranch(value)) return;
4097
+ return value.replace(/\\(.)/g, '$1');
4098
+ };
4099
+ const hasRepeatedCharPrefixOverlap = (branches)=>{
4100
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
4101
+ for(let i = 0; i < values.length; i++)for(let j = i + 1; j < values.length; j++){
4102
+ const a = values[i];
4103
+ const b = values[j];
4104
+ const char = a[0];
4105
+ if (char && a === char.repeat(a.length) && b === char.repeat(b.length)) {
4106
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
4107
+ }
4108
+ }
4109
+ return false;
4110
+ };
4111
+ const parseRepeatedExtglob = (pattern, requireEnd = true)=>{
4112
+ if ('+' !== pattern[0] && '*' !== pattern[0] || '(' !== pattern[1]) return;
4113
+ let bracket = 0;
4114
+ let paren = 0;
4115
+ let quote = 0;
4116
+ let escaped = false;
4117
+ for(let i = 1; i < pattern.length; i++){
4118
+ const ch = pattern[i];
4119
+ if (true === escaped) {
4120
+ escaped = false;
4121
+ continue;
4122
+ }
4123
+ if ('\\' === ch) {
4124
+ escaped = true;
4125
+ continue;
4126
+ }
4127
+ if ('"' === ch) {
4128
+ quote = 1 === quote ? 0 : 1;
4129
+ continue;
4130
+ }
4131
+ if (1 !== quote) {
4132
+ if ('[' === ch) {
4133
+ bracket++;
4134
+ continue;
4135
+ }
4136
+ if (']' === ch && bracket > 0) {
4137
+ bracket--;
4138
+ continue;
4139
+ }
4140
+ if (!(bracket > 0)) {
4141
+ if ('(' === ch) {
4142
+ paren++;
4143
+ continue;
4144
+ }
4145
+ if (')' === ch) {
4146
+ paren--;
4147
+ if (0 === paren) {
4148
+ if (true === requireEnd && i !== pattern.length - 1) return;
4149
+ return {
4150
+ type: pattern[0],
4151
+ body: pattern.slice(2, i),
4152
+ end: i
4153
+ };
4154
+ }
4155
+ }
4156
+ }
4157
+ }
4158
+ }
4159
+ };
4160
+ const getStarExtglobSequenceOutput = (pattern)=>{
4161
+ let index = 0;
4162
+ const chars = [];
4163
+ while(index < pattern.length){
4164
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
4165
+ if (!match || '*' !== match.type) return;
4166
+ const branches = splitTopLevel(match.body).map((branch)=>branch.trim());
4167
+ if (1 !== branches.length) return;
4168
+ const branch = normalizeSimpleBranch(branches[0]);
4169
+ if (!branch || 1 !== branch.length) return;
4170
+ chars.push(branch);
4171
+ index += match.end + 1;
4172
+ }
4173
+ if (chars.length < 1) return;
4174
+ const source = 1 === chars.length ? utils.escapeRegex(chars[0]) : `[${chars.map((ch)=>utils.escapeRegex(ch)).join('')}]`;
4175
+ return `${source}*`;
4176
+ };
4177
+ const repeatedExtglobRecursion = (pattern)=>{
4178
+ let depth = 0;
4179
+ let value = pattern.trim();
4180
+ let match = parseRepeatedExtglob(value);
4181
+ while(match){
4182
+ depth++;
4183
+ value = match.body.trim();
4184
+ match = parseRepeatedExtglob(value);
4185
+ }
4186
+ return depth;
4187
+ };
4188
+ const analyzeRepeatedExtglob = (body, options)=>{
4189
+ if (false === options.maxExtglobRecursion) return {
4190
+ risky: false
4191
+ };
4192
+ const max = 'number' == typeof options.maxExtglobRecursion ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
4193
+ const branches = splitTopLevel(body).map((branch)=>branch.trim());
4194
+ if (branches.length > 1) {
4195
+ if (branches.some((branch)=>'' === branch) || branches.some((branch)=>/^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return {
4196
+ risky: true
4197
+ };
4198
+ }
4199
+ for (const branch of branches){
4200
+ const safeOutput = getStarExtglobSequenceOutput(branch);
4201
+ if (safeOutput) return {
4202
+ risky: true,
4203
+ safeOutput
4204
+ };
4205
+ if (repeatedExtglobRecursion(branch) > max) return {
4206
+ risky: true
4207
+ };
4208
+ }
4209
+ return {
4210
+ risky: false
4211
+ };
4212
+ };
4213
+ const parse = (input, options)=>{
4214
+ if ('string' != typeof input) throw new TypeError('Expected a string');
4215
+ input = REPLACEMENTS[input] || input;
4216
+ const opts = {
4217
+ ...options
4218
+ };
4219
+ const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
4220
+ let len = input.length;
4221
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
4222
+ const bos = {
4223
+ type: 'bos',
4224
+ value: '',
4225
+ output: opts.prepend || ''
4226
+ };
4227
+ const tokens = [
4228
+ bos
4229
+ ];
4230
+ const capture = opts.capture ? '' : '?:';
4231
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
4232
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
4233
+ 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;
4234
+ const globstar = (opts)=>`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
4235
+ const nodot = opts.dot ? '' : NO_DOT;
4236
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
4237
+ let star = true === opts.bash ? globstar(opts) : STAR;
4238
+ if (opts.capture) star = `(${star})`;
4239
+ if ('boolean' == typeof opts.noext) opts.noextglob = opts.noext;
4240
+ const state = {
4241
+ input,
4242
+ index: -1,
4243
+ start: 0,
4244
+ dot: true === opts.dot,
4245
+ consumed: '',
4246
+ output: '',
4247
+ prefix: '',
4248
+ backtrack: false,
4249
+ negated: false,
4250
+ brackets: 0,
4251
+ braces: 0,
4252
+ parens: 0,
4253
+ quotes: 0,
4254
+ globstar: false,
4255
+ tokens
4256
+ };
4257
+ input = utils.removePrefix(input, state);
4258
+ len = input.length;
4259
+ const extglobs = [];
4260
+ const braces = [];
4261
+ const stack = [];
4262
+ let prev = bos;
4263
+ let value;
4264
+ const eos = ()=>state.index === len - 1;
4265
+ const peek = state.peek = (n = 1)=>input[state.index + n];
4266
+ const advance = state.advance = ()=>input[++state.index] || '';
4267
+ const remaining = ()=>input.slice(state.index + 1);
4268
+ const consume = (value = '', num = 0)=>{
4269
+ state.consumed += value;
4270
+ state.index += num;
4271
+ };
4272
+ const append = (token)=>{
4273
+ state.output += null != token.output ? token.output : token.value;
4274
+ consume(token.value);
4275
+ };
4276
+ const negate = ()=>{
4277
+ let count = 1;
4278
+ while('!' === peek() && ('(' !== peek(2) || '?' === peek(3))){
4279
+ advance();
4280
+ state.start++;
4281
+ count++;
4282
+ }
4283
+ if (count % 2 === 0) return false;
4284
+ state.negated = true;
4285
+ state.start++;
4286
+ return true;
4287
+ };
4288
+ const increment = (type)=>{
4289
+ state[type]++;
4290
+ stack.push(type);
4291
+ };
4292
+ const decrement = (type)=>{
4293
+ state[type]--;
4294
+ stack.pop();
4295
+ };
4296
+ const push = (tok)=>{
4297
+ if ('globstar' === prev.type) {
4298
+ const isBrace = state.braces > 0 && ('comma' === tok.type || 'brace' === tok.type);
4299
+ const isExtglob = true === tok.extglob || extglobs.length && ('pipe' === tok.type || 'paren' === tok.type);
4300
+ if ('slash' !== tok.type && 'paren' !== tok.type && !isBrace && !isExtglob) {
4301
+ state.output = state.output.slice(0, -prev.output.length);
4302
+ prev.type = 'star';
4303
+ prev.value = '*';
4304
+ prev.output = star;
4305
+ state.output += prev.output;
4306
+ }
4307
+ }
4308
+ if (extglobs.length && 'paren' !== tok.type) extglobs[extglobs.length - 1].inner += tok.value;
4309
+ if (tok.value || tok.output) append(tok);
4310
+ if (prev && 'text' === prev.type && 'text' === tok.type) {
4311
+ prev.output = (prev.output || prev.value) + tok.value;
4312
+ prev.value += tok.value;
4313
+ return;
4314
+ }
4315
+ tok.prev = prev;
4316
+ tokens.push(tok);
4317
+ prev = tok;
4318
+ };
4319
+ const extglobOpen = (type, value)=>{
4320
+ const token = {
4321
+ ...EXTGLOB_CHARS[value],
4322
+ conditions: 1,
4323
+ inner: ''
4324
+ };
4325
+ token.prev = prev;
4326
+ token.parens = state.parens;
4327
+ token.output = state.output;
4328
+ token.startIndex = state.index;
4329
+ token.tokensIndex = tokens.length;
4330
+ const output = (opts.capture ? '(' : '') + token.open;
4331
+ increment('parens');
4332
+ push({
4333
+ type,
4334
+ value,
4335
+ output: state.output ? '' : ONE_CHAR
4336
+ });
4337
+ push({
4338
+ type: 'paren',
4339
+ extglob: true,
4340
+ value: advance(),
4341
+ output
4342
+ });
4343
+ extglobs.push(token);
4344
+ };
4345
+ const extglobClose = (token)=>{
4346
+ const literal = input.slice(token.startIndex, state.index + 1);
4347
+ const body = input.slice(token.startIndex + 2, state.index);
4348
+ const analysis = analyzeRepeatedExtglob(body, opts);
4349
+ if (('plus' === token.type || 'star' === token.type) && analysis.risky) {
4350
+ const safeOutput = analysis.safeOutput ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
4351
+ const open = tokens[token.tokensIndex];
4352
+ open.type = 'text';
4353
+ open.value = literal;
4354
+ open.output = safeOutput || utils.escapeRegex(literal);
4355
+ for(let i = token.tokensIndex + 1; i < tokens.length; i++){
4356
+ tokens[i].value = '';
4357
+ tokens[i].output = '';
4358
+ delete tokens[i].suffix;
4359
+ }
4360
+ state.output = token.output + open.output;
4361
+ state.backtrack = true;
4362
+ push({
4363
+ type: 'paren',
4364
+ extglob: true,
4365
+ value,
4366
+ output: ''
4367
+ });
4368
+ decrement('parens');
4369
+ return;
4370
+ }
4371
+ let output = token.close + (opts.capture ? ')' : '');
4372
+ let rest;
4373
+ if ('negate' === token.type) {
4374
+ let extglobStar = star;
4375
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) extglobStar = globstar(opts);
4376
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
4377
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
4378
+ const expression = parse(rest, {
4379
+ ...options,
4380
+ fastpaths: false
4381
+ }).output;
4382
+ output = token.close = `)${expression})${extglobStar})`;
4383
+ }
4384
+ if ('bos' === token.prev.type) state.negatedExtglob = true;
4385
+ }
4386
+ push({
4387
+ type: 'paren',
4388
+ extglob: true,
4389
+ value,
4390
+ output
4391
+ });
4392
+ decrement('parens');
4393
+ };
4394
+ if (false !== opts.fastpaths && !/(^[*!]|[/()[\]{}"])/.test(input)) {
4395
+ let backslashes = false;
4396
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index)=>{
4397
+ if ('\\' === first) {
4398
+ backslashes = true;
4399
+ return m;
4400
+ }
4401
+ if ('?' === first) {
4402
+ if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : '');
4403
+ if (0 === index) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
4404
+ return QMARK.repeat(chars.length);
4405
+ }
4406
+ if ('.' === first) return DOT_LITERAL.repeat(chars.length);
4407
+ if ('*' === first) {
4408
+ if (esc) return esc + first + (rest ? star : '');
4409
+ return star;
4410
+ }
4411
+ return esc ? m : `\\${m}`;
4412
+ });
4413
+ if (true === backslashes) output = true === opts.unescape ? output.replace(/\\/g, '') : output.replace(/\\+/g, (m)=>m.length % 2 === 0 ? '\\\\' : m ? '\\' : '');
4414
+ if (output === input && true === opts.contains) {
4415
+ state.output = input;
4416
+ return state;
4417
+ }
4418
+ state.output = utils.wrapOutput(output, state, options);
4419
+ return state;
4420
+ }
4421
+ while(!eos()){
4422
+ value = advance();
4423
+ if ('\u0000' === value) continue;
4424
+ if ('\\' === value) {
4425
+ const next = peek();
4426
+ if ('/' === next && true !== opts.bash) continue;
4427
+ if ('.' === next || ';' === next) continue;
4428
+ if (!next) {
4429
+ value += '\\';
4430
+ push({
4431
+ type: 'text',
4432
+ value
4433
+ });
4434
+ continue;
4435
+ }
4436
+ const match = /^\\+/.exec(remaining());
4437
+ let slashes = 0;
4438
+ if (match && match[0].length > 2) {
4439
+ slashes = match[0].length;
4440
+ state.index += slashes;
4441
+ if (slashes % 2 !== 0) value += '\\';
4442
+ }
4443
+ if (true === opts.unescape) value = advance();
4444
+ else value += advance();
4445
+ if (0 === state.brackets) {
4446
+ push({
4447
+ type: 'text',
4448
+ value
4449
+ });
4450
+ continue;
4451
+ }
4452
+ }
4453
+ if (state.brackets > 0 && (']' !== value || '[' === prev.value || '[^' === prev.value)) {
4454
+ if (false !== opts.posix && ':' === value) {
4455
+ const inner = prev.value.slice(1);
4456
+ if (inner.includes('[')) {
4457
+ prev.posix = true;
4458
+ if (inner.includes(':')) {
4459
+ const idx = prev.value.lastIndexOf('[');
4460
+ const pre = prev.value.slice(0, idx);
4461
+ const rest = prev.value.slice(idx + 2);
4462
+ const posix = POSIX_REGEX_SOURCE[rest];
4463
+ if (posix) {
4464
+ prev.value = pre + posix;
4465
+ state.backtrack = true;
4466
+ advance();
4467
+ if (!bos.output && 1 === tokens.indexOf(prev)) bos.output = ONE_CHAR;
4468
+ continue;
4469
+ }
4470
+ }
4471
+ }
4472
+ }
4473
+ if ('[' === value && ':' !== peek() || '-' === value && ']' === peek()) value = `\\${value}`;
4474
+ if (']' === value && ('[' === prev.value || '[^' === prev.value)) value = `\\${value}`;
4475
+ if (true === opts.posix && '!' === value && '[' === prev.value) value = '^';
4476
+ prev.value += value;
4477
+ append({
4478
+ value
4479
+ });
4480
+ continue;
4481
+ }
4482
+ if (1 === state.quotes && '"' !== value) {
4483
+ value = utils.escapeRegex(value);
4484
+ prev.value += value;
4485
+ append({
4486
+ value
4487
+ });
4488
+ continue;
4489
+ }
4490
+ if ('"' === value) {
4491
+ state.quotes = 1 === state.quotes ? 0 : 1;
4492
+ if (true === opts.keepQuotes) push({
4493
+ type: 'text',
4494
+ value
4495
+ });
4496
+ continue;
4497
+ }
4498
+ if ('(' === value) {
4499
+ increment('parens');
4500
+ push({
4501
+ type: 'paren',
4502
+ value
4503
+ });
4504
+ continue;
4505
+ }
4506
+ if (')' === value) {
4507
+ if (0 === state.parens && true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '('));
4508
+ const extglob = extglobs[extglobs.length - 1];
4509
+ if (extglob && state.parens === extglob.parens + 1) {
4510
+ extglobClose(extglobs.pop());
4511
+ continue;
4512
+ }
4513
+ push({
4514
+ type: 'paren',
4515
+ value,
4516
+ output: state.parens ? ')' : '\\)'
4517
+ });
4518
+ decrement('parens');
4519
+ continue;
4520
+ }
4521
+ if ('[' === value) {
4522
+ if (true !== opts.nobracket && remaining().includes(']')) increment('brackets');
4523
+ else {
4524
+ if (true !== opts.nobracket && true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
4525
+ value = `\\${value}`;
4526
+ }
4527
+ push({
4528
+ type: 'bracket',
4529
+ value
4530
+ });
4531
+ continue;
4532
+ }
4533
+ if (']' === value) {
4534
+ if (true === opts.nobracket || prev && 'bracket' === prev.type && 1 === prev.value.length) {
4535
+ push({
4536
+ type: 'text',
4537
+ value,
4538
+ output: `\\${value}`
4539
+ });
4540
+ continue;
4541
+ }
4542
+ if (0 === state.brackets) {
4543
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('opening', '['));
4544
+ push({
4545
+ type: 'text',
4546
+ value,
4547
+ output: `\\${value}`
4548
+ });
4549
+ continue;
4550
+ }
4551
+ decrement('brackets');
4552
+ const prevValue = prev.value.slice(1);
4553
+ if (true !== prev.posix && '^' === prevValue[0] && !prevValue.includes('/')) value = `/${value}`;
4554
+ prev.value += value;
4555
+ append({
4556
+ value
4557
+ });
4558
+ if (false === opts.literalBrackets || utils.hasRegexChars(prevValue)) continue;
4559
+ const escaped = utils.escapeRegex(prev.value);
4560
+ state.output = state.output.slice(0, -prev.value.length);
4561
+ if (true === opts.literalBrackets) {
4562
+ state.output += escaped;
4563
+ prev.value = escaped;
4564
+ continue;
4565
+ }
4566
+ prev.value = `(${capture}${escaped}|${prev.value})`;
4567
+ state.output += prev.value;
4568
+ continue;
4569
+ }
4570
+ if ('{' === value && true !== opts.nobrace) {
4571
+ increment('braces');
4572
+ const open = {
4573
+ type: 'brace',
4574
+ value,
4575
+ output: '(',
4576
+ outputIndex: state.output.length,
4577
+ tokensIndex: state.tokens.length
4578
+ };
4579
+ braces.push(open);
4580
+ push(open);
4581
+ continue;
4582
+ }
4583
+ if ('}' === value) {
4584
+ const brace = braces[braces.length - 1];
4585
+ if (true === opts.nobrace || !brace) {
4586
+ push({
4587
+ type: 'text',
4588
+ value,
4589
+ output: value
4590
+ });
4591
+ continue;
4592
+ }
4593
+ let output = ')';
4594
+ if (true === brace.dots) {
4595
+ const arr = tokens.slice();
4596
+ const range = [];
4597
+ for(let i = arr.length - 1; i >= 0; i--){
4598
+ tokens.pop();
4599
+ if ('brace' === arr[i].type) break;
4600
+ if ('dots' !== arr[i].type) range.unshift(arr[i].value);
4601
+ }
4602
+ output = expandRange(range, opts);
4603
+ state.backtrack = true;
4604
+ }
4605
+ if (true !== brace.comma && true !== brace.dots) {
4606
+ const out = state.output.slice(0, brace.outputIndex);
4607
+ const toks = state.tokens.slice(brace.tokensIndex);
4608
+ brace.value = brace.output = '\\{';
4609
+ value = output = '\\}';
4610
+ state.output = out;
4611
+ for (const t of toks)state.output += t.output || t.value;
4612
+ }
4613
+ push({
4614
+ type: 'brace',
4615
+ value,
4616
+ output
4617
+ });
4618
+ decrement('braces');
4619
+ braces.pop();
4620
+ continue;
4621
+ }
4622
+ if ('|' === value) {
4623
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
4624
+ push({
4625
+ type: 'text',
4626
+ value
4627
+ });
4628
+ continue;
4629
+ }
4630
+ if (',' === value) {
4631
+ let output = value;
4632
+ const brace = braces[braces.length - 1];
4633
+ if (brace && 'braces' === stack[stack.length - 1]) {
4634
+ brace.comma = true;
4635
+ output = '|';
4636
+ }
4637
+ push({
4638
+ type: 'comma',
4639
+ value,
4640
+ output
4641
+ });
4642
+ continue;
4643
+ }
4644
+ if ('/' === value) {
4645
+ if ('dot' === prev.type && state.index === state.start + 1) {
4646
+ state.start = state.index + 1;
4647
+ state.consumed = '';
4648
+ state.output = '';
4649
+ tokens.pop();
4650
+ prev = bos;
4651
+ continue;
4652
+ }
4653
+ push({
4654
+ type: 'slash',
4655
+ value,
4656
+ output: SLASH_LITERAL
4657
+ });
4658
+ continue;
4659
+ }
4660
+ if ('.' === value) {
4661
+ if (state.braces > 0 && 'dot' === prev.type) {
4662
+ if ('.' === prev.value) prev.output = DOT_LITERAL;
4663
+ const brace = braces[braces.length - 1];
4664
+ prev.type = 'dots';
4665
+ prev.output += value;
4666
+ prev.value += value;
4667
+ brace.dots = true;
4668
+ continue;
4669
+ }
4670
+ if (state.braces + state.parens === 0 && 'bos' !== prev.type && 'slash' !== prev.type) {
4671
+ push({
4672
+ type: 'text',
4673
+ value,
4674
+ output: DOT_LITERAL
4675
+ });
4676
+ continue;
4677
+ }
4678
+ push({
4679
+ type: 'dot',
4680
+ value,
4681
+ output: DOT_LITERAL
4682
+ });
4683
+ continue;
4684
+ }
4685
+ if ('?' === value) {
4686
+ const isGroup = prev && '(' === prev.value;
4687
+ if (!isGroup && true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
4688
+ extglobOpen('qmark', value);
4689
+ continue;
4690
+ }
4691
+ if (prev && 'paren' === prev.type) {
4692
+ const next = peek();
4693
+ let output = value;
4694
+ if ('(' === prev.value && !/[!=<:]/.test(next) || '<' === next && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
4695
+ push({
4696
+ type: 'text',
4697
+ value,
4698
+ output
4699
+ });
4700
+ continue;
4701
+ }
4702
+ if (true !== opts.dot && ('slash' === prev.type || 'bos' === prev.type)) {
4703
+ push({
4704
+ type: 'qmark',
4705
+ value,
4706
+ output: QMARK_NO_DOT
4707
+ });
4708
+ continue;
4709
+ }
4710
+ push({
4711
+ type: 'qmark',
4712
+ value,
4713
+ output: QMARK
4714
+ });
4715
+ continue;
4716
+ }
4717
+ if ('!' === value) {
4718
+ if (true !== opts.noextglob && '(' === peek()) {
4719
+ if ('?' !== peek(2) || !/[!=<:]/.test(peek(3))) {
4720
+ extglobOpen('negate', value);
4721
+ continue;
4722
+ }
4723
+ }
4724
+ if (true !== opts.nonegate && 0 === state.index) {
4725
+ negate();
4726
+ continue;
4727
+ }
4728
+ }
4729
+ if ('+' === value) {
4730
+ if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
4731
+ extglobOpen('plus', value);
4732
+ continue;
4733
+ }
4734
+ if (prev && '(' === prev.value || false === opts.regex) {
4735
+ push({
4736
+ type: 'plus',
4737
+ value,
4738
+ output: PLUS_LITERAL
4739
+ });
4740
+ continue;
4741
+ }
4742
+ if (prev && ('bracket' === prev.type || 'paren' === prev.type || 'brace' === prev.type) || state.parens > 0) {
4743
+ push({
4744
+ type: 'plus',
4745
+ value
4746
+ });
4747
+ continue;
4748
+ }
4749
+ push({
4750
+ type: 'plus',
4751
+ value: PLUS_LITERAL
4752
+ });
4753
+ continue;
4754
+ }
4755
+ if ('@' === value) {
4756
+ if (true !== opts.noextglob && '(' === peek() && '?' !== peek(2)) {
4757
+ push({
4758
+ type: 'at',
4759
+ extglob: true,
4760
+ value,
4761
+ output: ''
4762
+ });
4763
+ continue;
4764
+ }
4765
+ push({
4766
+ type: 'text',
4767
+ value
4768
+ });
4769
+ continue;
4770
+ }
4771
+ if ('*' !== value) {
4772
+ if ('$' === value || '^' === value) value = `\\${value}`;
4773
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
4774
+ if (match) {
4775
+ value += match[0];
4776
+ state.index += match[0].length;
4777
+ }
4778
+ push({
4779
+ type: 'text',
4780
+ value
4781
+ });
4782
+ continue;
4783
+ }
4784
+ if (prev && ('globstar' === prev.type || true === prev.star)) {
4785
+ prev.type = 'star';
4786
+ prev.star = true;
4787
+ prev.value += value;
4788
+ prev.output = star;
4789
+ state.backtrack = true;
4790
+ state.globstar = true;
4791
+ consume(value);
4792
+ continue;
4793
+ }
4794
+ let rest = remaining();
4795
+ if (true !== opts.noextglob && /^\([^?]/.test(rest)) {
4796
+ extglobOpen('star', value);
4797
+ continue;
4798
+ }
4799
+ if ('star' === prev.type) {
4800
+ if (true === opts.noglobstar) {
4801
+ consume(value);
4802
+ continue;
4803
+ }
4804
+ const prior = prev.prev;
4805
+ const before = prior.prev;
4806
+ const isStart = 'slash' === prior.type || 'bos' === prior.type;
4807
+ const afterStar = before && ('star' === before.type || 'globstar' === before.type);
4808
+ if (true === opts.bash && (!isStart || rest[0] && '/' !== rest[0])) {
4809
+ push({
4810
+ type: 'star',
4811
+ value,
4812
+ output: ''
4813
+ });
4814
+ continue;
4815
+ }
4816
+ const isBrace = state.braces > 0 && ('comma' === prior.type || 'brace' === prior.type);
4817
+ const isExtglob = extglobs.length && ('pipe' === prior.type || 'paren' === prior.type);
4818
+ if (!isStart && 'paren' !== prior.type && !isBrace && !isExtglob) {
4819
+ push({
4820
+ type: 'star',
4821
+ value,
4822
+ output: ''
4823
+ });
4824
+ continue;
4825
+ }
4826
+ while('/**' === rest.slice(0, 3)){
4827
+ const after = input[state.index + 4];
4828
+ if (after && '/' !== after) break;
4829
+ rest = rest.slice(3);
4830
+ consume('/**', 3);
4831
+ }
4832
+ if ('bos' === prior.type && eos()) {
4833
+ prev.type = 'globstar';
4834
+ prev.value += value;
4835
+ prev.output = globstar(opts);
4836
+ state.output = prev.output;
4837
+ state.globstar = true;
4838
+ consume(value);
4839
+ continue;
4840
+ }
4841
+ if ('slash' === prior.type && 'bos' !== prior.prev.type && !afterStar && eos()) {
4842
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
4843
+ prior.output = `(?:${prior.output}`;
4844
+ prev.type = 'globstar';
4845
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
4846
+ prev.value += value;
4847
+ state.globstar = true;
4848
+ state.output += prior.output + prev.output;
4849
+ consume(value);
4850
+ continue;
4851
+ }
4852
+ if ('slash' === prior.type && 'bos' !== prior.prev.type && '/' === rest[0]) {
4853
+ const end = void 0 !== rest[1] ? '|$' : '';
4854
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
4855
+ prior.output = `(?:${prior.output}`;
4856
+ prev.type = 'globstar';
4857
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
4858
+ prev.value += value;
4859
+ state.output += prior.output + prev.output;
4860
+ state.globstar = true;
4861
+ consume(value + advance());
4862
+ push({
4863
+ type: 'slash',
4864
+ value: '/',
4865
+ output: ''
4866
+ });
4867
+ continue;
4868
+ }
4869
+ if ('bos' === prior.type && '/' === rest[0]) {
4870
+ prev.type = 'globstar';
4871
+ prev.value += value;
4872
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
4873
+ state.output = prev.output;
4874
+ state.globstar = true;
4875
+ consume(value + advance());
4876
+ push({
4877
+ type: 'slash',
4878
+ value: '/',
4879
+ output: ''
4880
+ });
4881
+ continue;
4882
+ }
4883
+ state.output = state.output.slice(0, -prev.output.length);
4884
+ prev.type = 'globstar';
4885
+ prev.output = globstar(opts);
4886
+ prev.value += value;
4887
+ state.output += prev.output;
4888
+ state.globstar = true;
4889
+ consume(value);
4890
+ continue;
4891
+ }
4892
+ const token = {
4893
+ type: 'star',
4894
+ value,
4895
+ output: star
4896
+ };
4897
+ if (true === opts.bash) {
4898
+ token.output = '.*?';
4899
+ if ('bos' === prev.type || 'slash' === prev.type) token.output = nodot + token.output;
4900
+ push(token);
4901
+ continue;
4902
+ }
4903
+ if (prev && ('bracket' === prev.type || 'paren' === prev.type) && true === opts.regex) {
4904
+ token.output = value;
4905
+ push(token);
4906
+ continue;
4907
+ }
4908
+ if (state.index === state.start || 'slash' === prev.type || 'dot' === prev.type) {
4909
+ if ('dot' === prev.type) {
4910
+ state.output += NO_DOT_SLASH;
4911
+ prev.output += NO_DOT_SLASH;
4912
+ } else if (true === opts.dot) {
4913
+ state.output += NO_DOTS_SLASH;
4914
+ prev.output += NO_DOTS_SLASH;
4915
+ } else {
4916
+ state.output += nodot;
4917
+ prev.output += nodot;
4918
+ }
4919
+ if ('*' !== peek()) {
4920
+ state.output += ONE_CHAR;
4921
+ prev.output += ONE_CHAR;
4922
+ }
4923
+ }
4924
+ push(token);
4925
+ }
4926
+ while(state.brackets > 0){
4927
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ']'));
4928
+ state.output = utils.escapeLast(state.output, '[');
4929
+ decrement('brackets');
4930
+ }
4931
+ while(state.parens > 0){
4932
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', ')'));
4933
+ state.output = utils.escapeLast(state.output, '(');
4934
+ decrement('parens');
4935
+ }
4936
+ while(state.braces > 0){
4937
+ if (true === opts.strictBrackets) throw new SyntaxError(syntaxError('closing', '}'));
4938
+ state.output = utils.escapeLast(state.output, '{');
4939
+ decrement('braces');
4940
+ }
4941
+ if (true !== opts.strictSlashes && ('star' === prev.type || 'bracket' === prev.type)) push({
4942
+ type: 'maybe_slash',
4943
+ value: '',
4944
+ output: `${SLASH_LITERAL}?`
4945
+ });
4946
+ if (true === state.backtrack) {
4947
+ state.output = '';
4948
+ for (const token of state.tokens){
4949
+ state.output += null != token.output ? token.output : token.value;
4950
+ if (token.suffix) state.output += token.suffix;
4951
+ }
4952
+ }
4953
+ return state;
4954
+ };
4955
+ parse.fastpaths = (input, options)=>{
4956
+ const opts = {
4957
+ ...options
4958
+ };
4959
+ const max = 'number' == typeof opts.maxLength ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
4960
+ const len = input.length;
4961
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
4962
+ input = REPLACEMENTS[input] || input;
4963
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
4964
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
4965
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
4966
+ const capture = opts.capture ? '' : '?:';
4967
+ const state = {
4968
+ negated: false,
4969
+ prefix: ''
4970
+ };
4971
+ let star = true === opts.bash ? '.*?' : STAR;
4972
+ if (opts.capture) star = `(${star})`;
4973
+ const globstar = (opts)=>{
4974
+ if (true === opts.noglobstar) return star;
4975
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
4976
+ };
4977
+ const create = (str)=>{
4978
+ switch(str){
4979
+ case '*':
4980
+ return `${nodot}${ONE_CHAR}${star}`;
4981
+ case '.*':
4982
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
4983
+ case '*.*':
4984
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
4985
+ case '*/*':
4986
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
4987
+ case '**':
4988
+ return nodot + globstar(opts);
4989
+ case '**/*':
4990
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
4991
+ case '**/*.*':
4992
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
4993
+ case '**/.*':
4994
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
4995
+ default:
4996
+ {
4997
+ const match = /^(.*?)\.(\w+)$/.exec(str);
4998
+ if (!match) return;
4999
+ const source = create(match[1]);
5000
+ if (!source) return;
5001
+ return source + DOT_LITERAL + match[2];
5002
+ }
5003
+ }
5004
+ };
5005
+ const output = utils.removePrefix(input, state);
5006
+ let source = create(output);
5007
+ if (source && true !== opts.strictSlashes) source += `${SLASH_LITERAL}?`;
5008
+ return source;
5009
+ };
5010
+ module.exports = parse;
5011
+ },
5012
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js" (module, __unused_rspack_exports, __webpack_require__) {
5013
+ const scan = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js");
5014
+ const parse = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js");
5015
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
5016
+ const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
5017
+ const isObject = (val)=>val && 'object' == typeof val && !Array.isArray(val);
5018
+ const picomatch = (glob, options, returnState = false)=>{
5019
+ if (Array.isArray(glob)) {
5020
+ const fns = glob.map((input)=>picomatch(input, options, returnState));
5021
+ const arrayMatcher = (str)=>{
5022
+ for (const isMatch of fns){
5023
+ const state = isMatch(str);
5024
+ if (state) return state;
5025
+ }
5026
+ return false;
5027
+ };
5028
+ return arrayMatcher;
5029
+ }
5030
+ const isState = isObject(glob) && glob.tokens && glob.input;
5031
+ if ('' === glob || 'string' != typeof glob && !isState) throw new TypeError('Expected pattern to be a non-empty string');
5032
+ const opts = options || {};
5033
+ const posix = opts.windows;
5034
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
5035
+ const state = regex.state;
5036
+ delete regex.state;
5037
+ let isIgnored = ()=>false;
5038
+ if (opts.ignore) {
5039
+ const ignoreOpts = {
5040
+ ...options,
5041
+ ignore: null,
5042
+ onMatch: null,
5043
+ onResult: null
5044
+ };
5045
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
5046
+ }
5047
+ const matcher = (input, returnObject = false)=>{
5048
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
5049
+ glob,
5050
+ posix
5051
+ });
5052
+ const result = {
5053
+ glob,
5054
+ state,
5055
+ regex,
5056
+ posix,
5057
+ input,
5058
+ output,
5059
+ match,
5060
+ isMatch
5061
+ };
5062
+ if ('function' == typeof opts.onResult) opts.onResult(result);
5063
+ if (false === isMatch) {
5064
+ result.isMatch = false;
5065
+ return returnObject ? result : false;
5066
+ }
5067
+ if (isIgnored(input)) {
5068
+ if ('function' == typeof opts.onIgnore) opts.onIgnore(result);
5069
+ result.isMatch = false;
5070
+ return returnObject ? result : false;
5071
+ }
5072
+ if ('function' == typeof opts.onMatch) opts.onMatch(result);
5073
+ return returnObject ? result : true;
5074
+ };
5075
+ if (returnState) matcher.state = state;
5076
+ return matcher;
5077
+ };
5078
+ picomatch.test = (input, regex, options, { glob, posix } = {})=>{
5079
+ if ('string' != typeof input) throw new TypeError('Expected input to be a string');
5080
+ if ('' === input) return {
5081
+ isMatch: false,
5082
+ output: ''
5083
+ };
5084
+ const opts = options || {};
5085
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
5086
+ let match = input === glob;
5087
+ let output = match && format ? format(input) : input;
5088
+ if (false === match) {
5089
+ output = format ? format(input) : input;
5090
+ match = output === glob;
5091
+ }
5092
+ if (false === match || true === opts.capture) match = true === opts.matchBase || true === opts.basename ? picomatch.matchBase(input, regex, options, posix) : regex.exec(output);
5093
+ return {
5094
+ isMatch: Boolean(match),
5095
+ match,
5096
+ output
5097
+ };
5098
+ };
5099
+ picomatch.matchBase = (input, glob, options)=>{
5100
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
5101
+ return regex.test(utils.basename(input));
5102
+ };
5103
+ picomatch.isMatch = (str, patterns, options)=>picomatch(patterns, options)(str);
5104
+ picomatch.parse = (pattern, options)=>{
5105
+ if (Array.isArray(pattern)) return pattern.map((p)=>picomatch.parse(p, options));
5106
+ return parse(pattern, {
5107
+ ...options,
5108
+ fastpaths: false
5109
+ });
5110
+ };
5111
+ picomatch.scan = (input, options)=>scan(input, options);
5112
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false)=>{
5113
+ if (true === returnOutput) return state.output;
5114
+ const opts = options || {};
5115
+ const prepend = opts.contains ? '' : '^';
5116
+ const append = opts.contains ? '' : '$';
5117
+ let source = `${prepend}(?:${state.output})${append}`;
5118
+ if (state && true === state.negated) source = `^(?!${source}).*$`;
5119
+ const regex = picomatch.toRegex(source, options);
5120
+ if (true === returnState) regex.state = state;
5121
+ return regex;
5122
+ };
5123
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false)=>{
5124
+ if (!input || 'string' != typeof input) throw new TypeError('Expected a non-empty string');
5125
+ let parsed = {
5126
+ negated: false,
5127
+ fastpaths: true
5128
+ };
5129
+ if (false !== options.fastpaths && ('.' === input[0] || '*' === input[0])) parsed.output = parse.fastpaths(input, options);
5130
+ if (!parsed.output) parsed = parse(input, options);
5131
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
5132
+ };
5133
+ picomatch.toRegex = (source, options)=>{
5134
+ try {
5135
+ const opts = options || {};
5136
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
5137
+ } catch (err) {
5138
+ if (options && true === options.debug) throw err;
5139
+ return /$^/;
5140
+ }
5141
+ };
5142
+ picomatch.constants = constants;
5143
+ module.exports = picomatch;
5144
+ },
5145
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js" (module, __unused_rspack_exports, __webpack_require__) {
5146
+ const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
5147
+ 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");
5148
+ const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
5149
+ const depth = (token)=>{
5150
+ if (true !== token.isPrefix) token.depth = token.isGlobstar ? 1 / 0 : 1;
5151
+ };
5152
+ const scan = (input, options)=>{
5153
+ const opts = options || {};
5154
+ const length = input.length - 1;
5155
+ const scanToEnd = true === opts.parts || true === opts.scanToEnd;
5156
+ const slashes = [];
5157
+ const tokens = [];
5158
+ const parts = [];
5159
+ let str = input;
5160
+ let index = -1;
5161
+ let start = 0;
5162
+ let lastIndex = 0;
5163
+ let isBrace = false;
5164
+ let isBracket = false;
5165
+ let isGlob = false;
5166
+ let isExtglob = false;
5167
+ let isGlobstar = false;
5168
+ let braceEscaped = false;
5169
+ let backslashes = false;
5170
+ let negated = false;
5171
+ let negatedExtglob = false;
5172
+ let finished = false;
5173
+ let braces = 0;
5174
+ let prev;
5175
+ let code;
5176
+ let token = {
5177
+ value: '',
5178
+ depth: 0,
5179
+ isGlob: false
5180
+ };
5181
+ const eos = ()=>index >= length;
5182
+ const peek = ()=>str.charCodeAt(index + 1);
5183
+ const advance = ()=>{
5184
+ prev = code;
5185
+ return str.charCodeAt(++index);
5186
+ };
5187
+ while(index < length){
5188
+ code = advance();
5189
+ let next;
5190
+ if (code === CHAR_BACKWARD_SLASH) {
5191
+ backslashes = token.backslashes = true;
5192
+ code = advance();
5193
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
5194
+ continue;
5195
+ }
5196
+ if (true === braceEscaped || code === CHAR_LEFT_CURLY_BRACE) {
5197
+ braces++;
5198
+ while(true !== eos() && (code = advance())){
5199
+ if (code === CHAR_BACKWARD_SLASH) {
5200
+ backslashes = token.backslashes = true;
5201
+ advance();
5202
+ continue;
5203
+ }
5204
+ if (code === CHAR_LEFT_CURLY_BRACE) {
5205
+ braces++;
5206
+ continue;
5207
+ }
5208
+ if (true !== braceEscaped && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
5209
+ isBrace = token.isBrace = true;
5210
+ isGlob = token.isGlob = true;
5211
+ finished = true;
5212
+ if (true === scanToEnd) continue;
5213
+ break;
5214
+ }
5215
+ if (true !== braceEscaped && code === CHAR_COMMA) {
5216
+ isBrace = token.isBrace = true;
5217
+ isGlob = token.isGlob = true;
5218
+ finished = true;
5219
+ if (true === scanToEnd) continue;
5220
+ break;
5221
+ }
5222
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
5223
+ braces--;
5224
+ if (0 === braces) {
5225
+ braceEscaped = false;
5226
+ isBrace = token.isBrace = true;
5227
+ finished = true;
5228
+ break;
5229
+ }
5230
+ }
5231
+ }
5232
+ if (true === scanToEnd) continue;
5233
+ break;
5234
+ }
5235
+ if (code === CHAR_FORWARD_SLASH) {
5236
+ slashes.push(index);
5237
+ tokens.push(token);
5238
+ token = {
5239
+ value: '',
5240
+ depth: 0,
5241
+ isGlob: false
5242
+ };
5243
+ if (true === finished) continue;
5244
+ if (prev === CHAR_DOT && index === start + 1) {
5245
+ start += 2;
5246
+ continue;
5247
+ }
5248
+ lastIndex = index + 1;
5249
+ continue;
5250
+ }
5251
+ if (true !== opts.noext) {
5252
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
5253
+ if (true === isExtglobChar && peek() === CHAR_LEFT_PARENTHESES) {
5254
+ isGlob = token.isGlob = true;
5255
+ isExtglob = token.isExtglob = true;
5256
+ finished = true;
5257
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
5258
+ if (true === scanToEnd) {
5259
+ while(true !== eos() && (code = advance())){
5260
+ if (code === CHAR_BACKWARD_SLASH) {
5261
+ backslashes = token.backslashes = true;
5262
+ code = advance();
5263
+ continue;
5264
+ }
5265
+ if (code === CHAR_RIGHT_PARENTHESES) {
5266
+ isGlob = token.isGlob = true;
5267
+ finished = true;
5268
+ break;
5269
+ }
5270
+ }
5271
+ continue;
5272
+ }
5273
+ break;
5274
+ }
5275
+ }
5276
+ if (code === CHAR_ASTERISK) {
5277
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
5278
+ isGlob = token.isGlob = true;
5279
+ finished = true;
5280
+ if (true === scanToEnd) continue;
5281
+ break;
5282
+ }
5283
+ if (code === CHAR_QUESTION_MARK) {
5284
+ isGlob = token.isGlob = true;
5285
+ finished = true;
5286
+ if (true === scanToEnd) continue;
5287
+ break;
5288
+ }
5289
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
5290
+ while(true !== eos() && (next = advance())){
5291
+ if (next === CHAR_BACKWARD_SLASH) {
5292
+ backslashes = token.backslashes = true;
5293
+ advance();
5294
+ continue;
5295
+ }
5296
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
5297
+ isBracket = token.isBracket = true;
5298
+ isGlob = token.isGlob = true;
5299
+ finished = true;
5300
+ break;
5301
+ }
5302
+ }
5303
+ if (true === scanToEnd) continue;
5304
+ break;
5305
+ }
5306
+ if (true !== opts.nonegate && code === CHAR_EXCLAMATION_MARK && index === start) {
5307
+ negated = token.negated = true;
5308
+ start++;
5309
+ continue;
5310
+ }
5311
+ if (true !== opts.noparen && code === CHAR_LEFT_PARENTHESES) {
5312
+ isGlob = token.isGlob = true;
5313
+ if (true === scanToEnd) {
5314
+ while(true !== eos() && (code = advance())){
5315
+ if (code === CHAR_LEFT_PARENTHESES) {
5316
+ backslashes = token.backslashes = true;
5317
+ code = advance();
5318
+ continue;
5319
+ }
5320
+ if (code === CHAR_RIGHT_PARENTHESES) {
5321
+ finished = true;
5322
+ break;
5323
+ }
5324
+ }
5325
+ continue;
5326
+ }
5327
+ break;
5328
+ }
5329
+ if (true === isGlob) {
5330
+ finished = true;
5331
+ if (true === scanToEnd) continue;
5332
+ break;
5333
+ }
5334
+ }
5335
+ if (true === opts.noext) {
5336
+ isExtglob = false;
5337
+ isGlob = false;
5338
+ }
5339
+ let base = str;
5340
+ let prefix = '';
5341
+ let glob = '';
5342
+ if (start > 0) {
5343
+ prefix = str.slice(0, start);
5344
+ str = str.slice(start);
5345
+ lastIndex -= start;
5346
+ }
5347
+ if (base && true === isGlob && lastIndex > 0) {
5348
+ base = str.slice(0, lastIndex);
5349
+ glob = str.slice(lastIndex);
5350
+ } else if (true === isGlob) {
5351
+ base = '';
5352
+ glob = str;
5353
+ } else base = str;
5354
+ if (base && '' !== base && '/' !== base && base !== str) {
5355
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
5356
+ }
5357
+ if (true === opts.unescape) {
5358
+ if (glob) glob = utils.removeBackslashes(glob);
5359
+ if (base && true === backslashes) base = utils.removeBackslashes(base);
5360
+ }
5361
+ const state = {
5362
+ prefix,
5363
+ input,
5364
+ start,
5365
+ base,
5366
+ glob,
5367
+ isBrace,
5368
+ isBracket,
5369
+ isGlob,
5370
+ isExtglob,
5371
+ isGlobstar,
5372
+ negated,
5373
+ negatedExtglob
5374
+ };
5375
+ if (true === opts.tokens) {
5376
+ state.maxDepth = 0;
5377
+ if (!isPathSeparator(code)) tokens.push(token);
5378
+ state.tokens = tokens;
5379
+ }
5380
+ if (true === opts.parts || true === opts.tokens) {
5381
+ let prevIndex;
5382
+ for(let idx = 0; idx < slashes.length; idx++){
5383
+ const n = prevIndex ? prevIndex + 1 : start;
5384
+ const i = slashes[idx];
5385
+ const value = input.slice(n, i);
5386
+ if (opts.tokens) {
5387
+ if (0 === idx && 0 !== start) {
5388
+ tokens[idx].isPrefix = true;
5389
+ tokens[idx].value = prefix;
5390
+ } else tokens[idx].value = value;
5391
+ depth(tokens[idx]);
5392
+ state.maxDepth += tokens[idx].depth;
5393
+ }
5394
+ if (0 !== idx || '' !== value) parts.push(value);
5395
+ prevIndex = i;
5396
+ }
5397
+ if (prevIndex && prevIndex + 1 < input.length) {
5398
+ const value = input.slice(prevIndex + 1);
5399
+ parts.push(value);
5400
+ if (opts.tokens) {
5401
+ tokens[tokens.length - 1].value = value;
5402
+ depth(tokens[tokens.length - 1]);
5403
+ state.maxDepth += tokens[tokens.length - 1].depth;
5404
+ }
5405
+ }
5406
+ state.slashes = slashes;
5407
+ state.parts = parts;
5408
+ }
5409
+ return state;
5410
+ };
5411
+ module.exports = scan;
5412
+ },
5413
+ "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js" (__unused_rspack_module, exports, __webpack_require__) {
5414
+ 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");
5415
+ exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
5416
+ exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
5417
+ exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str);
5418
+ exports.escapeRegex = (str)=>str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
5419
+ exports.toPosixSlashes = (str)=>str.replace(REGEX_BACKSLASH, '/');
5420
+ exports.isWindows = ()=>{
5421
+ if ("u" > typeof navigator && navigator.platform) {
5422
+ const platform = navigator.platform.toLowerCase();
5423
+ return 'win32' === platform || 'windows' === platform;
5424
+ }
5425
+ if ("u" > typeof process && process.platform) return 'win32' === process.platform;
5426
+ return false;
5427
+ };
5428
+ exports.removeBackslashes = (str)=>str.replace(REGEX_REMOVE_BACKSLASH, (match)=>'\\' === match ? '' : match);
5429
+ exports.escapeLast = (input, char, lastIdx)=>{
5430
+ const idx = input.lastIndexOf(char, lastIdx);
5431
+ if (-1 === idx) return input;
5432
+ if ('\\' === input[idx - 1]) return exports.escapeLast(input, char, idx - 1);
5433
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
5434
+ };
5435
+ exports.removePrefix = (input, state = {})=>{
5436
+ let output = input;
5437
+ if (output.startsWith('./')) {
5438
+ output = output.slice(2);
5439
+ state.prefix = './';
5440
+ }
5441
+ return output;
5442
+ };
5443
+ exports.wrapOutput = (input, state = {}, options = {})=>{
5444
+ const prepend = options.contains ? '' : '^';
5445
+ const append = options.contains ? '' : '$';
5446
+ let output = `${prepend}(?:${input})${append}`;
5447
+ if (true === state.negated) output = `(?:^(?!${output}).*$)`;
5448
+ return output;
5449
+ };
5450
+ exports.basename = (path, { windows } = {})=>{
5451
+ const segs = path.split(windows ? /[\\/]/ : '/');
5452
+ const last = segs[segs.length - 1];
5453
+ if ('' === last) return segs[segs.length - 2];
5454
+ return last;
5455
+ };
5456
+ },
3833
5457
  "../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js" (module, __unused_rspack_exports, __webpack_require__) {
3834
5458
  const fs = __webpack_require__("fs?8b28");
3835
5459
  const { Readable } = __webpack_require__("stream");
@@ -4258,12 +5882,24 @@ __webpack_require__.add({
4258
5882
  toRegexRange.clearCache = ()=>toRegexRange.cache = {};
4259
5883
  module.exports = toRegexRange;
4260
5884
  },
5885
+ child_process (module) {
5886
+ module.exports = __rspack_createRequire_require("child_process");
5887
+ },
4261
5888
  events (module) {
4262
5889
  module.exports = __rspack_createRequire_require("events");
4263
5890
  },
5891
+ "fs?8b28" (module) {
5892
+ module.exports = __rspack_createRequire_require("fs");
5893
+ },
4264
5894
  os (module) {
4265
5895
  module.exports = __rspack_createRequire_require("os");
4266
5896
  },
5897
+ "path?aeb1" (module) {
5898
+ module.exports = __rspack_createRequire_require("path");
5899
+ },
5900
+ stream (module) {
5901
+ module.exports = __rspack_createRequire_require("stream");
5902
+ },
4267
5903
  util (module) {
4268
5904
  module.exports = __rspack_createRequire_require("util");
4269
5905
  },
@@ -4818,9 +6454,822 @@ var CAC = class extends EventTarget {
4818
6454
  }
4819
6455
  };
4820
6456
  const cac = (name = "")=>new CAC(name);
4821
- export { default as node_path, join } from "node:path";
6457
+ const PLUGIN_VIRTUAL_MODULE_NAME = 'rsbuild:virtual-module';
6458
+ const pluginVirtualModule = (pluginOptions = {})=>({
6459
+ name: PLUGIN_VIRTUAL_MODULE_NAME,
6460
+ async setup (api) {
6461
+ const { virtualModules = {}, tempDir: virtualFolderName = '.rsbuild-virtual-module' } = pluginOptions;
6462
+ const TEMP_DIR = join(api.context.rootPath, virtualFolderName);
6463
+ const virtualFileAbsolutePaths = Object.keys(virtualModules).map((i)=>{
6464
+ let absolutePath = join(TEMP_DIR, i);
6465
+ if (!extname(absolutePath)) absolutePath = `${absolutePath}.js`;
6466
+ return [
6467
+ i,
6468
+ absolutePath
6469
+ ];
6470
+ });
6471
+ api.modifyBundlerChain((chain, { rspack })=>{
6472
+ const pluginId = 'RSBUILD_VIRTUAL_MODULE_PLUGIN';
6473
+ const virtualModules = Object.fromEntries(virtualFileAbsolutePaths.map((i)=>[
6474
+ i[1],
6475
+ ''
6476
+ ]));
6477
+ if (chain.plugins.has(pluginId)) chain.plugin(pluginId).tap((options)=>{
6478
+ const existingPaths = new Set(Object.keys(options[0] ?? {}));
6479
+ const conflictPath = virtualFileAbsolutePaths.find(([, path])=>existingPaths.has(path));
6480
+ if (conflictPath) throw new Error(`Virtual module name conflicted: ${conflictPath[0]}`);
6481
+ return [
6482
+ {
6483
+ ...options[0],
6484
+ ...virtualModules
6485
+ }
6486
+ ];
6487
+ });
6488
+ else chain.plugin(pluginId).use(rspack.experiments.VirtualModulesPlugin, [
6489
+ virtualModules
6490
+ ]);
6491
+ chain.resolve.alias.merge(Object.fromEntries(virtualFileAbsolutePaths));
6492
+ });
6493
+ for (const [moduleName, absolutePath] of virtualFileAbsolutePaths){
6494
+ const handler = virtualModules[moduleName];
6495
+ if (handler) api.transform({
6496
+ test: absolutePath
6497
+ }, handler);
6498
+ }
6499
+ }
6500
+ });
6501
+ var __require = /* @__PURE__ */ external_module_createRequire(import.meta.url);
6502
+ function cleanPath(path) {
6503
+ let normalized = normalize(path);
6504
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
6505
+ return normalized;
6506
+ }
6507
+ const SLASHES_REGEX = /[\\/]/g;
6508
+ function convertSlashes(path, separator) {
6509
+ return path.replace(SLASHES_REGEX, separator);
6510
+ }
6511
+ const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
6512
+ function isRootDirectory(path) {
6513
+ return "/" === path || WINDOWS_ROOT_DIR_REGEX.test(path);
6514
+ }
6515
+ function normalizePath(path, options) {
6516
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
6517
+ const pathNeedsCleaning = "win32" === process.platform && path.includes("/") || path.startsWith(".");
6518
+ if (resolvePaths) path = resolve(path);
6519
+ if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path);
6520
+ if ("." === path) return "";
6521
+ const needsSeperator = path[path.length - 1] !== pathSeparator;
6522
+ return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator);
6523
+ }
6524
+ function joinPathWithBasePath(filename, directoryPath) {
6525
+ return directoryPath + filename;
6526
+ }
6527
+ function joinPathWithRelativePath(root, options) {
6528
+ return function(filename, directoryPath) {
6529
+ const sameRoot = directoryPath.startsWith(root);
6530
+ if (sameRoot) return directoryPath.slice(root.length) + filename;
6531
+ return convertSlashes(external_path_relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
6532
+ };
6533
+ }
6534
+ function joinPath(filename) {
6535
+ return filename;
6536
+ }
6537
+ function joinDirectoryPath(filename, directoryPath, separator) {
6538
+ return directoryPath + filename + separator;
6539
+ }
6540
+ function build$7(root, options) {
6541
+ const { relativePaths, includeBasePath } = options;
6542
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
6543
+ }
6544
+ function pushDirectoryWithRelativePath(root) {
6545
+ return function(directoryPath, paths) {
6546
+ paths.push(directoryPath.substring(root.length) || ".");
6547
+ };
6548
+ }
6549
+ function pushDirectoryFilterWithRelativePath(root) {
6550
+ return function(directoryPath, paths, filters) {
6551
+ const relativePath = directoryPath.substring(root.length) || ".";
6552
+ if (filters.every((filter)=>filter(relativePath, true))) paths.push(relativePath);
6553
+ };
6554
+ }
6555
+ const pushDirectory = (directoryPath, paths)=>{
6556
+ paths.push(directoryPath || ".");
6557
+ };
6558
+ const pushDirectoryFilter = (directoryPath, paths, filters)=>{
6559
+ const path = directoryPath || ".";
6560
+ if (filters.every((filter)=>filter(path, true))) paths.push(path);
6561
+ };
6562
+ const empty$2 = ()=>{};
6563
+ function build$6(root, options) {
6564
+ const { includeDirs, filters, relativePaths } = options;
6565
+ if (!includeDirs) return empty$2;
6566
+ if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
6567
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory;
6568
+ }
6569
+ const pushFileFilterAndCount = (filename, _paths, counts, filters)=>{
6570
+ if (filters.every((filter)=>filter(filename, false))) counts.files++;
6571
+ };
6572
+ const pushFileFilter = (filename, paths, _counts, filters)=>{
6573
+ if (filters.every((filter)=>filter(filename, false))) paths.push(filename);
6574
+ };
6575
+ const pushFileCount = (_filename, _paths, counts, _filters)=>{
6576
+ counts.files++;
6577
+ };
6578
+ const pushFile = (filename, paths)=>{
6579
+ paths.push(filename);
6580
+ };
6581
+ const empty$1 = ()=>{};
6582
+ function build$5(options) {
6583
+ const { excludeFiles, filters, onlyCounts } = options;
6584
+ if (excludeFiles) return empty$1;
6585
+ if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
6586
+ if (onlyCounts) return pushFileCount;
6587
+ return pushFile;
6588
+ }
6589
+ const getArray = (paths)=>paths;
6590
+ const getArrayGroup = ()=>[
6591
+ ""
6592
+ ].slice(0, 0);
6593
+ function build$4(options) {
6594
+ return options.group ? getArrayGroup : getArray;
6595
+ }
6596
+ const groupFiles = (groups, directory, files)=>{
6597
+ groups.push({
6598
+ directory,
6599
+ files,
6600
+ dir: directory
6601
+ });
6602
+ };
6603
+ const empty = ()=>{};
6604
+ function build$3(options) {
6605
+ return options.group ? groupFiles : empty;
6606
+ }
6607
+ const resolveSymlinksAsync = function(path, state, callback$1) {
6608
+ const { queue, fs, options: { suppressErrors } } = state;
6609
+ queue.enqueue();
6610
+ fs.realpath(path, (error, resolvedPath)=>{
6611
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
6612
+ fs.stat(resolvedPath, (error$1, stat)=>{
6613
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
6614
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
6615
+ callback$1(stat, resolvedPath);
6616
+ queue.dequeue(null, state);
6617
+ });
6618
+ });
6619
+ };
6620
+ const resolveSymlinks = function(path, state, callback$1) {
6621
+ const { queue, fs, options: { suppressErrors } } = state;
6622
+ queue.enqueue();
6623
+ try {
6624
+ const resolvedPath = fs.realpathSync(path);
6625
+ const stat = fs.statSync(resolvedPath);
6626
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return;
6627
+ callback$1(stat, resolvedPath);
6628
+ } catch (e) {
6629
+ if (!suppressErrors) throw e;
6630
+ }
6631
+ };
6632
+ function build$2(options, isSynchronous) {
6633
+ if (!options.resolveSymlinks || options.excludeSymlinks) return null;
6634
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
6635
+ }
6636
+ function isRecursive(path, resolved, state) {
6637
+ if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
6638
+ let parent = dirname(path);
6639
+ let depth = 1;
6640
+ while(parent !== state.root && depth < 2){
6641
+ const resolvedPath = state.symlinks.get(parent);
6642
+ const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
6643
+ if (isSameRoot) depth++;
6644
+ else parent = dirname(parent);
6645
+ }
6646
+ state.symlinks.set(path, resolved);
6647
+ return depth > 1;
6648
+ }
6649
+ function isRecursiveUsingRealPaths(resolved, state) {
6650
+ return state.visited.includes(resolved + state.options.pathSeparator);
6651
+ }
6652
+ const onlyCountsSync = (state)=>state.counts;
6653
+ const groupsSync = (state)=>state.groups;
6654
+ const defaultSync = (state)=>state.paths;
6655
+ const limitFilesSync = (state)=>state.paths.slice(0, state.options.maxFiles);
6656
+ const onlyCountsAsync = (state, error, callback$1)=>{
6657
+ report(error, callback$1, state.counts, state.options.suppressErrors);
6658
+ return null;
6659
+ };
6660
+ const defaultAsync = (state, error, callback$1)=>{
6661
+ report(error, callback$1, state.paths, state.options.suppressErrors);
6662
+ return null;
6663
+ };
6664
+ const limitFilesAsync = (state, error, callback$1)=>{
6665
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
6666
+ return null;
6667
+ };
6668
+ const groupsAsync = (state, error, callback$1)=>{
6669
+ report(error, callback$1, state.groups, state.options.suppressErrors);
6670
+ return null;
6671
+ };
6672
+ function report(error, callback$1, output, suppressErrors) {
6673
+ callback$1(error && !suppressErrors ? error : null, output);
6674
+ }
6675
+ function build$1(options, isSynchronous) {
6676
+ const { onlyCounts, group, maxFiles } = options;
6677
+ if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
6678
+ if (group) return isSynchronous ? groupsSync : groupsAsync;
6679
+ if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
6680
+ return isSynchronous ? defaultSync : defaultAsync;
6681
+ }
6682
+ const readdirOpts = {
6683
+ withFileTypes: true
6684
+ };
6685
+ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1)=>{
6686
+ state.queue.enqueue();
6687
+ if (currentDepth < 0) return state.queue.dequeue(null, state);
6688
+ const { fs } = state;
6689
+ state.visited.push(crawlPath);
6690
+ state.counts.directories++;
6691
+ fs.readdir(crawlPath || ".", readdirOpts, (error, entries = [])=>{
6692
+ callback$1(entries, directoryPath, currentDepth);
6693
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
6694
+ });
6695
+ };
6696
+ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1)=>{
6697
+ const { fs } = state;
6698
+ if (currentDepth < 0) return;
6699
+ state.visited.push(crawlPath);
6700
+ state.counts.directories++;
6701
+ let entries = [];
6702
+ try {
6703
+ entries = fs.readdirSync(crawlPath || ".", readdirOpts);
6704
+ } catch (e) {
6705
+ if (!state.options.suppressErrors) throw e;
6706
+ }
6707
+ callback$1(entries, directoryPath, currentDepth);
6708
+ };
6709
+ function build(isSynchronous) {
6710
+ return isSynchronous ? walkSync : walkAsync;
6711
+ }
6712
+ var Queue = class {
6713
+ count = 0;
6714
+ constructor(onQueueEmpty){
6715
+ this.onQueueEmpty = onQueueEmpty;
6716
+ }
6717
+ enqueue() {
6718
+ this.count++;
6719
+ return this.count;
6720
+ }
6721
+ dequeue(error, output) {
6722
+ if (this.onQueueEmpty && (--this.count <= 0 || error)) {
6723
+ this.onQueueEmpty(error, output);
6724
+ if (error) {
6725
+ output.controller.abort();
6726
+ this.onQueueEmpty = void 0;
6727
+ }
6728
+ }
6729
+ }
6730
+ };
6731
+ var Counter = class {
6732
+ _files = 0;
6733
+ _directories = 0;
6734
+ set files(num) {
6735
+ this._files = num;
6736
+ }
6737
+ get files() {
6738
+ return this._files;
6739
+ }
6740
+ set directories(num) {
6741
+ this._directories = num;
6742
+ }
6743
+ get directories() {
6744
+ return this._directories;
6745
+ }
6746
+ get dirs() {
6747
+ return this._directories;
6748
+ }
6749
+ };
6750
+ var Aborter = class {
6751
+ aborted = false;
6752
+ abort() {
6753
+ this.aborted = true;
6754
+ }
6755
+ };
6756
+ var Walker = class {
6757
+ root;
6758
+ isSynchronous;
6759
+ state;
6760
+ joinPath;
6761
+ pushDirectory;
6762
+ pushFile;
6763
+ getArray;
6764
+ groupFiles;
6765
+ resolveSymlink;
6766
+ walkDirectory;
6767
+ callbackInvoker;
6768
+ constructor(root, options, callback$1){
6769
+ this.isSynchronous = !callback$1;
6770
+ this.callbackInvoker = build$1(options, this.isSynchronous);
6771
+ this.root = normalizePath(root, options);
6772
+ this.state = {
6773
+ root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
6774
+ paths: [
6775
+ ""
6776
+ ].slice(0, 0),
6777
+ groups: [],
6778
+ counts: new Counter(),
6779
+ options,
6780
+ queue: new Queue((error, state)=>this.callbackInvoker(state, error, callback$1)),
6781
+ symlinks: /* @__PURE__ */ new Map(),
6782
+ visited: [
6783
+ ""
6784
+ ].slice(0, 0),
6785
+ controller: new Aborter(),
6786
+ fs: options.fs || __rspack_external_fs
6787
+ };
6788
+ this.joinPath = build$7(this.root, options);
6789
+ this.pushDirectory = build$6(this.root, options);
6790
+ this.pushFile = build$5(options);
6791
+ this.getArray = build$4(options);
6792
+ this.groupFiles = build$3(options);
6793
+ this.resolveSymlink = build$2(options, this.isSynchronous);
6794
+ this.walkDirectory = build(this.isSynchronous);
6795
+ }
6796
+ start() {
6797
+ this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
6798
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
6799
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
6800
+ }
6801
+ walk = (entries, directoryPath, depth)=>{
6802
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
6803
+ if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
6804
+ const files = this.getArray(this.state.paths);
6805
+ for(let i = 0; i < entries.length; ++i){
6806
+ const entry = entries[i];
6807
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
6808
+ const filename = this.joinPath(entry.name, directoryPath);
6809
+ this.pushFile(filename, files, this.state.counts, filters);
6810
+ } else if (entry.isDirectory()) {
6811
+ let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
6812
+ if (exclude && exclude(entry.name, path)) continue;
6813
+ this.pushDirectory(path, paths, filters);
6814
+ this.walkDirectory(this.state, path, path, depth - 1, this.walk);
6815
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
6816
+ let path = joinPathWithBasePath(entry.name, directoryPath);
6817
+ this.resolveSymlink(path, this.state, (stat, resolvedPath)=>{
6818
+ if (stat.isDirectory()) {
6819
+ resolvedPath = normalizePath(resolvedPath, this.state.options);
6820
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
6821
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
6822
+ } else {
6823
+ resolvedPath = useRealPaths ? resolvedPath : path;
6824
+ const filename = basename(resolvedPath);
6825
+ const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
6826
+ resolvedPath = this.joinPath(filename, directoryPath$1);
6827
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
6828
+ }
6829
+ });
6830
+ }
6831
+ }
6832
+ this.groupFiles(this.state.groups, directoryPath, files);
6833
+ };
6834
+ };
6835
+ function promise(root, options) {
6836
+ return new Promise((resolve$1, reject)=>{
6837
+ dist_callback(root, options, (err, output)=>{
6838
+ if (err) return reject(err);
6839
+ resolve$1(output);
6840
+ });
6841
+ });
6842
+ }
6843
+ function dist_callback(root, options, callback$1) {
6844
+ let walker = new Walker(root, options, callback$1);
6845
+ walker.start();
6846
+ }
6847
+ function sync(root, options) {
6848
+ const walker = new Walker(root, options);
6849
+ return walker.start();
6850
+ }
6851
+ var APIBuilder = class {
6852
+ constructor(root, options){
6853
+ this.root = root;
6854
+ this.options = options;
6855
+ }
6856
+ withPromise() {
6857
+ return promise(this.root, this.options);
6858
+ }
6859
+ withCallback(cb) {
6860
+ dist_callback(this.root, this.options, cb);
6861
+ }
6862
+ sync() {
6863
+ return sync(this.root, this.options);
6864
+ }
6865
+ };
6866
+ let pm = null;
6867
+ try {
6868
+ __require.resolve("picomatch");
6869
+ pm = __require("picomatch");
6870
+ } catch {}
6871
+ var Builder = class {
6872
+ globCache = {};
6873
+ options = {
6874
+ maxDepth: 1 / 0,
6875
+ suppressErrors: true,
6876
+ pathSeparator: sep,
6877
+ filters: []
6878
+ };
6879
+ globFunction;
6880
+ constructor(options){
6881
+ this.options = {
6882
+ ...this.options,
6883
+ ...options
6884
+ };
6885
+ this.globFunction = this.options.globFunction;
6886
+ }
6887
+ group() {
6888
+ this.options.group = true;
6889
+ return this;
6890
+ }
6891
+ withPathSeparator(separator) {
6892
+ this.options.pathSeparator = separator;
6893
+ return this;
6894
+ }
6895
+ withBasePath() {
6896
+ this.options.includeBasePath = true;
6897
+ return this;
6898
+ }
6899
+ withRelativePaths() {
6900
+ this.options.relativePaths = true;
6901
+ return this;
6902
+ }
6903
+ withDirs() {
6904
+ this.options.includeDirs = true;
6905
+ return this;
6906
+ }
6907
+ withMaxDepth(depth) {
6908
+ this.options.maxDepth = depth;
6909
+ return this;
6910
+ }
6911
+ withMaxFiles(limit) {
6912
+ this.options.maxFiles = limit;
6913
+ return this;
6914
+ }
6915
+ withFullPaths() {
6916
+ this.options.resolvePaths = true;
6917
+ this.options.includeBasePath = true;
6918
+ return this;
6919
+ }
6920
+ withErrors() {
6921
+ this.options.suppressErrors = false;
6922
+ return this;
6923
+ }
6924
+ withSymlinks({ resolvePaths = true } = {}) {
6925
+ this.options.resolveSymlinks = true;
6926
+ this.options.useRealPaths = resolvePaths;
6927
+ return this.withFullPaths();
6928
+ }
6929
+ withAbortSignal(signal) {
6930
+ this.options.signal = signal;
6931
+ return this;
6932
+ }
6933
+ normalize() {
6934
+ this.options.normalizePath = true;
6935
+ return this;
6936
+ }
6937
+ filter(predicate) {
6938
+ this.options.filters.push(predicate);
6939
+ return this;
6940
+ }
6941
+ onlyDirs() {
6942
+ this.options.excludeFiles = true;
6943
+ this.options.includeDirs = true;
6944
+ return this;
6945
+ }
6946
+ exclude(predicate) {
6947
+ this.options.exclude = predicate;
6948
+ return this;
6949
+ }
6950
+ onlyCounts() {
6951
+ this.options.onlyCounts = true;
6952
+ return this;
6953
+ }
6954
+ crawl(root) {
6955
+ return new APIBuilder(root || ".", this.options);
6956
+ }
6957
+ withGlobFunction(fn) {
6958
+ this.globFunction = fn;
6959
+ return this;
6960
+ }
6961
+ crawlWithOptions(root, options) {
6962
+ this.options = {
6963
+ ...this.options,
6964
+ ...options
6965
+ };
6966
+ return new APIBuilder(root || ".", this.options);
6967
+ }
6968
+ glob(...patterns) {
6969
+ if (this.globFunction) return this.globWithOptions(patterns);
6970
+ return this.globWithOptions(patterns, {
6971
+ dot: true
6972
+ });
6973
+ }
6974
+ globWithOptions(patterns, ...options) {
6975
+ const globFn = this.globFunction || pm;
6976
+ if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
6977
+ var isMatch = this.globCache[patterns.join("\0")];
6978
+ if (!isMatch) {
6979
+ isMatch = globFn(patterns, ...options);
6980
+ this.globCache[patterns.join("\0")] = isMatch;
6981
+ }
6982
+ this.options.filters.push((path)=>isMatch(path));
6983
+ return this;
6984
+ }
6985
+ };
6986
+ const node_modules_picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js");
6987
+ const isReadonlyArray = Array.isArray;
6988
+ const BACKSLASHES = /\\/g;
6989
+ const DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
6990
+ const isWin = "win32" === process.platform;
6991
+ const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
6992
+ function getPartialMatcher(patterns, options = {}) {
6993
+ const patternsCount = patterns.length;
6994
+ const patternsParts = Array(patternsCount);
6995
+ const matchers = Array(patternsCount);
6996
+ let i, j;
6997
+ for(i = 0; i < patternsCount; i++){
6998
+ const parts = splitPattern(patterns[i]);
6999
+ patternsParts[i] = parts;
7000
+ const partsCount = parts.length;
7001
+ const partMatchers = Array(partsCount);
7002
+ for(j = 0; j < partsCount; j++)partMatchers[j] = node_modules_picomatch(parts[j], options);
7003
+ matchers[i] = partMatchers;
7004
+ }
7005
+ return (input)=>{
7006
+ const inputParts = input.split("/");
7007
+ if (".." === inputParts[0] && ONLY_PARENT_DIRECTORIES.test(input)) return true;
7008
+ for(i = 0; i < patternsCount; i++){
7009
+ const patternParts = patternsParts[i];
7010
+ const matcher = matchers[i];
7011
+ const inputPatternCount = inputParts.length;
7012
+ const minParts = Math.min(inputPatternCount, patternParts.length);
7013
+ j = 0;
7014
+ while(j < minParts){
7015
+ const part = patternParts[j];
7016
+ if (part.includes("/")) return true;
7017
+ if (!matcher[j](inputParts[j])) break;
7018
+ if (!options.noglobstar && "**" === part) return true;
7019
+ j++;
7020
+ }
7021
+ if (j === inputPatternCount) return true;
7022
+ }
7023
+ return false;
7024
+ };
7025
+ }
7026
+ const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
7027
+ const isRoot = isWin ? (p)=>WIN32_ROOT_DIR.test(p) : (p)=>"/" === p;
7028
+ function buildFormat(cwd, root, absolute) {
7029
+ if (cwd === root || root.startsWith(`${cwd}/`)) {
7030
+ if (absolute) {
7031
+ const start = cwd.length + +!isRoot(cwd);
7032
+ return (p, isDir)=>p.slice(start, isDir ? -1 : void 0) || ".";
7033
+ }
7034
+ const prefix = root.slice(cwd.length + 1);
7035
+ if (prefix) return (p, isDir)=>{
7036
+ if ("." === p) return prefix;
7037
+ const result = `${prefix}/${p}`;
7038
+ return isDir ? result.slice(0, -1) : result;
7039
+ };
7040
+ return (p, isDir)=>isDir && "." !== p ? p.slice(0, -1) : p;
7041
+ }
7042
+ if (absolute) return (p)=>posix.relative(cwd, p) || ".";
7043
+ return (p)=>posix.relative(cwd, `${root}/${p}`) || ".";
7044
+ }
7045
+ function buildRelative(cwd, root) {
7046
+ if (root.startsWith(`${cwd}/`)) {
7047
+ const prefix = root.slice(cwd.length + 1);
7048
+ return (p)=>`${prefix}/${p}`;
7049
+ }
7050
+ return (p)=>{
7051
+ const result = posix.relative(cwd, `${root}/${p}`);
7052
+ return "/" === p[p.length - 1] && "" !== result ? `${result}/` : result || ".";
7053
+ };
7054
+ }
7055
+ function ensureNonDriveRelativePath(path) {
7056
+ return path.replace(DRIVE_RELATIVE_PATH, (match)=>`${match}/`);
7057
+ }
7058
+ const splitPatternOptions = {
7059
+ parts: true
7060
+ };
7061
+ function splitPattern(path) {
7062
+ var _result$parts;
7063
+ const result = node_modules_picomatch.scan(path, splitPatternOptions);
7064
+ return (null == (_result$parts = result.parts) ? void 0 : _result$parts.length) ? result.parts : [
7065
+ path
7066
+ ];
7067
+ }
7068
+ const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
7069
+ const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
7070
+ const escapePosixPath = (path)=>path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
7071
+ const escapeWin32Path = (path)=>path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
7072
+ const escapePath = isWin ? escapeWin32Path : escapePosixPath;
7073
+ function isDynamicPattern(pattern, options) {
7074
+ if ((null == options ? void 0 : options.caseSensitiveMatch) === false) return true;
7075
+ const scan = node_modules_picomatch.scan(pattern);
7076
+ return scan.isGlob || scan.negated;
7077
+ }
7078
+ function log(...tasks) {
7079
+ console.log(`[tinyglobby ${/* @__PURE__ */ new Date().toLocaleTimeString("es")}]`, ...tasks);
7080
+ }
7081
+ function ensureStringArray(value) {
7082
+ return "string" == typeof value ? [
7083
+ value
7084
+ ] : null != value ? value : [];
7085
+ }
7086
+ const PARENT_DIRECTORY = /^(\/?\.\.)+/;
7087
+ const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
7088
+ function normalizePattern(pattern, opts, props, isIgnore) {
7089
+ var _PARENT_DIRECTORY$exe;
7090
+ const cwd = opts.cwd;
7091
+ let result = pattern;
7092
+ if ("/" === pattern[pattern.length - 1]) result = pattern.slice(0, -1);
7093
+ if ("*" !== result[result.length - 1] && opts.expandDirectories) result += "/**";
7094
+ const escapedCwd = escapePath(cwd);
7095
+ result = isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
7096
+ const parentDir = null == (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) ? void 0 : _PARENT_DIRECTORY$exe[0];
7097
+ const parts = splitPattern(result);
7098
+ if (parentDir) {
7099
+ const n = (parentDir.length + 1) / 3;
7100
+ let i = 0;
7101
+ const cwdParts = escapedCwd.split("/");
7102
+ while(i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]){
7103
+ result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
7104
+ i++;
7105
+ }
7106
+ const potentialRoot = posix.join(cwd, parentDir.slice(3 * i));
7107
+ if ("." !== potentialRoot[0] && props.root.length > potentialRoot.length) {
7108
+ props.root = ensureNonDriveRelativePath(potentialRoot);
7109
+ props.depthOffset = -n + i;
7110
+ }
7111
+ }
7112
+ if (!isIgnore && props.depthOffset >= 0) {
7113
+ null != props.commonPath || (props.commonPath = parts);
7114
+ const newCommonPath = [];
7115
+ const length = Math.min(props.commonPath.length, parts.length);
7116
+ for(let i = 0; i < length; i++){
7117
+ const part = parts[i];
7118
+ if ("**" === part && !parts[i + 1]) {
7119
+ newCommonPath.pop();
7120
+ break;
7121
+ }
7122
+ if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
7123
+ newCommonPath.push(part);
7124
+ }
7125
+ props.depthOffset = newCommonPath.length;
7126
+ props.commonPath = newCommonPath;
7127
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd);
7128
+ }
7129
+ return result;
7130
+ }
7131
+ function processPatterns(options, patterns, props) {
7132
+ const matchPatterns = [];
7133
+ const ignorePatterns = [];
7134
+ for (const pattern of options.ignore)if (pattern) {
7135
+ if ("!" !== pattern[0] || "(" === pattern[1]) ignorePatterns.push(normalizePattern(pattern, options, props, true));
7136
+ }
7137
+ for (const pattern of patterns)if (pattern) {
7138
+ if ("!" !== pattern[0] || "(" === pattern[1]) matchPatterns.push(normalizePattern(pattern, options, props, false));
7139
+ else if ("!" !== pattern[1] || "(" === pattern[2]) ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
7140
+ }
7141
+ return {
7142
+ match: matchPatterns,
7143
+ ignore: ignorePatterns
7144
+ };
7145
+ }
7146
+ function buildCrawler(options, patterns) {
7147
+ const cwd = options.cwd;
7148
+ const props = {
7149
+ root: cwd,
7150
+ depthOffset: 0
7151
+ };
7152
+ const processed = processPatterns(options, patterns, props);
7153
+ if (options.debug) log("internal processing patterns:", processed);
7154
+ const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
7155
+ const root = props.root.replace(BACKSLASHES, "");
7156
+ const matchOptions = {
7157
+ dot,
7158
+ nobrace: false === options.braceExpansion,
7159
+ nocase: !caseSensitiveMatch,
7160
+ noextglob: false === options.extglob,
7161
+ noglobstar: false === options.globstar,
7162
+ posix: true
7163
+ };
7164
+ const matcher = node_modules_picomatch(processed.match, matchOptions);
7165
+ const ignore = node_modules_picomatch(processed.ignore, matchOptions);
7166
+ const partialMatcher = getPartialMatcher(processed.match, matchOptions);
7167
+ const format = buildFormat(cwd, root, absolute);
7168
+ const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
7169
+ const excludePredicate = (_, p)=>{
7170
+ const relativePath = excludeFormatter(p, true);
7171
+ return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
7172
+ };
7173
+ let maxDepth;
7174
+ if (void 0 !== options.deep) maxDepth = Math.round(options.deep - props.depthOffset);
7175
+ const crawler = new Builder({
7176
+ filters: [
7177
+ debug ? (p, isDirectory)=>{
7178
+ const path = format(p, isDirectory);
7179
+ const matches = matcher(path) && !ignore(path);
7180
+ if (matches) log(`matched ${path}`);
7181
+ return matches;
7182
+ } : (p, isDirectory)=>{
7183
+ const path = format(p, isDirectory);
7184
+ return matcher(path) && !ignore(path);
7185
+ }
7186
+ ],
7187
+ exclude: debug ? (_, p)=>{
7188
+ const skipped = excludePredicate(_, p);
7189
+ log(`${skipped ? "skipped" : "crawling"} ${p}`);
7190
+ return skipped;
7191
+ } : excludePredicate,
7192
+ fs: options.fs,
7193
+ pathSeparator: "/",
7194
+ relativePaths: !absolute,
7195
+ resolvePaths: absolute,
7196
+ includeBasePath: absolute,
7197
+ resolveSymlinks: followSymbolicLinks,
7198
+ excludeSymlinks: !followSymbolicLinks,
7199
+ excludeFiles: onlyDirectories,
7200
+ includeDirs: onlyDirectories || !options.onlyFiles,
7201
+ maxDepth,
7202
+ signal: options.signal
7203
+ }).crawl(root);
7204
+ if (options.debug) log("internal properties:", {
7205
+ ...props,
7206
+ root
7207
+ });
7208
+ return [
7209
+ crawler,
7210
+ cwd !== root && !absolute && buildRelative(cwd, root)
7211
+ ];
7212
+ }
7213
+ function formatPaths(paths, mapper) {
7214
+ if (mapper) for(let i = paths.length - 1; i >= 0; i--)paths[i] = mapper(paths[i]);
7215
+ return paths;
7216
+ }
7217
+ const defaultOptions = {
7218
+ caseSensitiveMatch: true,
7219
+ debug: !!process.env.TINYGLOBBY_DEBUG,
7220
+ expandDirectories: true,
7221
+ followSymbolicLinks: true,
7222
+ onlyFiles: true
7223
+ };
7224
+ function getOptions(options) {
7225
+ const opts = Object.assign({}, options);
7226
+ for(const key in defaultOptions)if (void 0 === opts[key]) Object.assign(opts, {
7227
+ [key]: defaultOptions[key]
7228
+ });
7229
+ opts.cwd = (opts.cwd instanceof URL ? external_url_fileURLToPath(opts.cwd) : resolve(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
7230
+ opts.ignore = ensureStringArray(opts.ignore);
7231
+ opts.fs && (opts.fs = {
7232
+ readdir: opts.fs.readdir || readdir,
7233
+ readdirSync: opts.fs.readdirSync || readdirSync,
7234
+ realpath: opts.fs.realpath || realpath,
7235
+ realpathSync: opts.fs.realpathSync || realpathSync,
7236
+ stat: opts.fs.stat || external_fs_stat,
7237
+ statSync: opts.fs.statSync || statSync
7238
+ });
7239
+ if (opts.debug) log("globbing with options:", opts);
7240
+ return opts;
7241
+ }
7242
+ function getCrawler(globInput, inputOptions = {}) {
7243
+ var _ref;
7244
+ if (globInput && (null == inputOptions ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
7245
+ const isModern = isReadonlyArray(globInput) || "string" == typeof globInput;
7246
+ const patterns = ensureStringArray(null != (_ref = isModern ? globInput : globInput.patterns) ? _ref : "**/*");
7247
+ const options = getOptions(isModern ? inputOptions : globInput);
7248
+ return patterns.length > 0 ? buildCrawler(options, patterns) : [];
7249
+ }
7250
+ async function glob(globInput, options) {
7251
+ const [crawler, relative] = getCrawler(globInput, options);
7252
+ return crawler ? formatPaths(await crawler.withPromise(), relative) : [];
7253
+ }
4822
7254
  export { logger } from "@rspress/shared/logger";
4823
7255
  export { default as node_fs } from "node:fs";
4824
- export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "@rspress/shared/constants";
4825
- export { default as promises } from "node:fs/promises";
4826
- export { cac };
7256
+ export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
7257
+ export { default as promises, mkdir, readdir as promises_readdir, rm, stat as promises_stat, writeFile } from "node:fs/promises";
7258
+ export { createRequire } from "node:module";
7259
+ export { cwd as external_node_process_cwd } from "node:process";
7260
+ export { fileURLToPath, pathToFileURL } from "node:url";
7261
+ export { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
7262
+ export { MDX_OR_MD_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, getSidebarDataGroup, isDebugMode, isExternalUrl, isProduction, normalizeDarkMode, normalizeHref, removeLeadingSlash, removeTrailingSlash, slash, withBase, withSiteOrigin } from "@rspress/shared";
7263
+ export { chunk, groupBy } from "@rspress/shared/lodash-es";
7264
+ export { extractTextAndId, getIconUrlPath, loadFrontMatter } from "@rspress/shared/node-utils";
7265
+ export { default as remark_gfm } from "remark-gfm";
7266
+ export { default as remark_parse } from "remark-parse";
7267
+ export { unified } from "unified";
7268
+ export { remove } from "unist-util-remove";
7269
+ export { createProcessor } from "@mdx-js/mdx";
7270
+ export { mergeRsbuildConfig, rspack as core_rspack } from "@rsbuild/core";
7271
+ export { createHash } from "node:crypto";
7272
+ export { default as node_os } from "node:os";
7273
+ export { matchPath } from "react-router-dom";
7274
+ export { createHead } from "@unhead/react/server";
7275
+ export { cac, external_node_path_relative, extname, glob, join, node_path, pluginVirtualModule };