fumadocs-core 16.18.2 → 16.18.4

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 (84) hide show
  1. package/dist/{algolia-B36wJl6E.d.ts → algolia-DsNJZd4P.d.ts} +2 -2
  2. package/dist/{build-index-CqctTvug.js → build-index-8ryBfL45.js} +1 -1
  3. package/dist/{client-LE_6Q0xR.d.ts → client-Bv_2P4D3.d.ts} +3 -3
  4. package/dist/content/mdx/preset-bundler.d.ts +2 -2
  5. package/dist/content/mdx/preset-runtime.d.ts +2 -2
  6. package/dist/{dynamic-BKMu5hc8.js → dynamic-CENrXFis.js} +182 -23
  7. package/dist/dynamic-link.js +1 -1
  8. package/dist/framework/plugin.d.ts +2 -2
  9. package/dist/highlight/client.js +1 -1
  10. package/dist/highlight/index.js +1 -1
  11. package/dist/highlight/shiki/full.d.ts +1 -1
  12. package/dist/highlight/shiki/index.d.ts +1 -1
  13. package/dist/highlight/shiki/react.d.ts +2 -2
  14. package/dist/i18n/middleware.js +2088 -3439
  15. package/dist/{index-DWVer6sb.d.ts → index-BOhS1UKT.d.ts} +110 -13
  16. package/dist/{index-B0Bzrmfa.d.ts → index-e-8QoCiA.d.ts} +1 -1
  17. package/dist/mcp.d.ts +2 -2
  18. package/dist/mdx-plugins/index.d.ts +4 -4
  19. package/dist/mdx-plugins/index.js +6 -5
  20. package/dist/mdx-plugins/rehype-code.core.d.ts +1 -1
  21. package/dist/mdx-plugins/rehype-code.core.js +1 -1
  22. package/dist/mdx-plugins/rehype-code.d.ts +2 -2
  23. package/dist/mdx-plugins/rehype-code.js +1 -1
  24. package/dist/mdx-plugins/remark-code-tab.js +1 -1
  25. package/dist/mdx-plugins/remark-include.js +2 -2
  26. package/dist/mdx-plugins/remark-llms.js +1 -1
  27. package/dist/mdx-plugins/remark-npm.js +1 -1
  28. package/dist/mdx-plugins/remark-show.d.ts +2 -0
  29. package/dist/mdx-plugins/remark-show.js +162 -0
  30. package/dist/mdx-plugins/remark-steps.js +1 -1
  31. package/dist/mdx-plugins/remark-structure.js +1 -1
  32. package/dist/mdx-plugins/stringifier.js +6 -0
  33. package/dist/{meilisearch-CsyDr1xA.d.ts → meilisearch-DzjbVbAn.d.ts} +2 -2
  34. package/dist/{mixedbread-CyM4na_-.d.ts → mixedbread-CMi5F-zO.d.ts} +2 -2
  35. package/dist/negotiation/index.js +279 -290
  36. package/dist/{path-CH9Umap3.js → path-B8old5-F.js} +1 -1
  37. package/dist/{rehype-code-CPNaiqAY.d.ts → rehype-code-Czh_8L5z.d.ts} +1 -1
  38. package/dist/{rehype-code.core-D1aZ5yla.d.ts → rehype-code.core-BeCtKe7K.d.ts} +1 -1
  39. package/dist/{rehype-code.core-Dq2jmvan.js → rehype-code.core-Jt2VtK1A.js} +3 -3
  40. package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
  41. package/dist/search/algolia.d.ts +1 -1
  42. package/dist/search/algolia.js +1 -1
  43. package/dist/search/client/algolia.d.ts +1 -1
  44. package/dist/search/client/docs-search.d.ts +1 -1
  45. package/dist/search/client/fetch.d.ts +1 -1
  46. package/dist/search/client/fetch.js +1 -1
  47. package/dist/search/client/flexsearch-static.d.ts +1 -1
  48. package/dist/search/client/flexsearch-static.js +1 -1
  49. package/dist/search/client/meilisearch.d.ts +1 -1
  50. package/dist/search/client/mixedbread.d.ts +2 -2
  51. package/dist/search/client/orama-cloud-legacy.d.ts +1 -1
  52. package/dist/search/client/orama-cloud-legacy.js +1 -1
  53. package/dist/search/client/orama-cloud.d.ts +1 -1
  54. package/dist/search/client/orama-cloud.js +1 -1
  55. package/dist/search/client/orama-static.d.ts +1 -1
  56. package/dist/search/client/orama-static.js +2 -2
  57. package/dist/search/client.d.ts +1 -1
  58. package/dist/search/flexsearch.d.ts +2 -2
  59. package/dist/search/flexsearch.js +1 -1
  60. package/dist/search/index.js +1 -1
  61. package/dist/search/meilisearch.d.ts +1 -1
  62. package/dist/search/meilisearch.js +1 -1
  63. package/dist/search/mixedbread.d.ts +2 -2
  64. package/dist/search/orama-cloud-legacy.d.ts +1 -1
  65. package/dist/search/orama-cloud.d.ts +2 -3
  66. package/dist/search/orama-cloud.js +1 -1
  67. package/dist/search/server.d.ts +1 -1
  68. package/dist/search/server.js +2 -2
  69. package/dist/{server-BUYLz3H4.d.ts → server-MsDv36PV.d.ts} +3 -3
  70. package/dist/source/dynamic.d.ts +1 -1
  71. package/dist/source/dynamic.js +1 -1
  72. package/dist/source/index.d.ts +2 -2
  73. package/dist/source/index.js +3 -3
  74. package/dist/source/llms.d.ts +1 -1
  75. package/dist/source/plugins/lucide-icons.d.ts +1 -1
  76. package/dist/source/plugins/slugs.d.ts +1 -1
  77. package/dist/source/plugins/slugs.js +1 -1
  78. package/dist/source/plugins/status-badges.d.ts +1 -1
  79. package/dist/source/schema.d.ts +2 -0
  80. package/dist/source/schema.js +3 -0
  81. package/dist/utils/hast-to-jsx.js +22 -31
  82. package/package.json +21 -20
  83. package/dist/index-BFnMPJLk.d.ts +0 -17
  84. package/dist/rolldown-runtime-C-UrYobY.js +0 -13
@@ -1,319 +1,308 @@
1
- import { t as __commonJSMin } from "../rolldown-runtime-C-UrYobY.js";
2
- // src/negotiation/index.ts
3
- var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.PathError = exports.TokenData = void 0;
6
- exports.compile = compile;
7
- exports.match = match;
8
- const DEFAULT_DELIMITER = "/";
9
- const NOOP_VALUE = (value) => value;
10
- const ID_START = /^[$_\p{ID_Start}]$/u;
11
- const ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
12
- /**
13
- * Escape a regular expression string.
14
- */
15
- function escape(str) {
16
- return str.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
1
+ // ../../node_modules/.pnpm/path-to-regexp@9.0.0/node_modules/path-to-regexp/dist/index.js
2
+ const DEFAULT_DELIMITER = "/";
3
+ const NOOP_VALUE = (value) => value;
4
+ const ID_START = /^[$_\p{ID_Start}]$/u;
5
+ const ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
6
+ /**
7
+ * Escape a regular expression string.
8
+ */
9
+ function escape(str) {
10
+ return str.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
11
+ }
12
+ /**
13
+ * ParseError is thrown when there is an error processing the path.
14
+ */
15
+ var PathError = class extends TypeError {
16
+ originalPath;
17
+ constructor(message, originalPath) {
18
+ super(message + (originalPath ? `: ${originalPath}` : "") + "; visit https://git.new/pathToRegexpError for info");
19
+ this.originalPath = originalPath;
17
20
  }
18
- /**
19
- * Tokenized path instance.
20
- */
21
- var TokenData = class {
22
- constructor(tokens, originalPath) {
23
- this.tokens = tokens;
24
- this.originalPath = originalPath;
25
- }
26
- };
27
- exports.TokenData = TokenData;
28
- /**
29
- * ParseError is thrown when there is an error processing the path.
30
- */
31
- var PathError = class extends TypeError {
32
- constructor(message, originalPath) {
33
- let text = message;
34
- if (originalPath) text += `: ${originalPath}`;
35
- text += `; visit https://git.new/pathToRegexpError for info`;
36
- super(text);
37
- this.originalPath = originalPath;
21
+ };
22
+ /**
23
+ * Parse a string for the raw tokens.
24
+ */
25
+ function parse(str, options = {}) {
26
+ const { encodePath = NOOP_VALUE } = options;
27
+ const chars = [...str];
28
+ let index = 0;
29
+ function consumeUntil(end) {
30
+ const output = [];
31
+ let path = "";
32
+ function writePath() {
33
+ if (!path) return;
34
+ output.push({
35
+ type: "text",
36
+ value: encodePath(path)
37
+ });
38
+ path = "";
38
39
  }
39
- };
40
- exports.PathError = PathError;
41
- /**
42
- * Parse a string for the raw tokens.
43
- */
44
- function parse(str, options = {}) {
45
- const { encodePath = NOOP_VALUE } = options;
46
- const chars = [...str];
47
- let index = 0;
48
- function consumeUntil(end) {
49
- const output = [];
50
- let path = "";
51
- function writePath() {
52
- if (!path) return;
53
- output.push({
54
- type: "text",
55
- value: encodePath(path)
56
- });
57
- path = "";
40
+ while (index < chars.length) {
41
+ const char = chars[index++];
42
+ if (char === end) {
43
+ writePath();
44
+ return output;
58
45
  }
59
- while (index < chars.length) {
60
- const value = chars[index++];
61
- if (value === end) {
62
- writePath();
63
- return output;
64
- }
65
- if (value === "\\") {
66
- if (index === chars.length) throw new PathError(`Unexpected end after \\ at index ${index}`, str);
67
- path += chars[index++];
68
- continue;
69
- }
70
- if (value === ":" || value === "*") {
71
- const type = value === ":" ? "param" : "wildcard";
72
- let name = "";
73
- if (ID_START.test(chars[index])) do
74
- name += chars[index++];
75
- while (ID_CONTINUE.test(chars[index]));
76
- else if (chars[index] === "\"") {
77
- let quoteStart = index;
78
- while (index < chars.length) {
79
- if (chars[++index] === "\"") {
80
- index++;
81
- quoteStart = 0;
82
- break;
83
- }
84
- if (chars[index] === "\\") index++;
85
- name += chars[index];
46
+ if (char === "\\") {
47
+ if (index === chars.length) throw new PathError(`Unexpected end after \\ at index ${index}`, str);
48
+ path += chars[index++];
49
+ continue;
50
+ }
51
+ if (char === ":" || char === "*") {
52
+ const type = char === ":" ? "param" : "wildcard";
53
+ let name = "";
54
+ if (ID_START.test(chars[index])) do
55
+ name += chars[index++];
56
+ while (ID_CONTINUE.test(chars[index]));
57
+ else if (chars[index] === "\"") {
58
+ let quoteStart = index;
59
+ while (index < chars.length) {
60
+ if (chars[++index] === "\"") {
61
+ index++;
62
+ quoteStart = 0;
63
+ break;
86
64
  }
87
- if (quoteStart) throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
65
+ if (chars[index] === "\\") index++;
66
+ name += chars[index];
88
67
  }
89
- if (!name) throw new PathError(`Missing parameter name at index ${index}`, str);
90
- writePath();
91
- output.push({
92
- type,
93
- name
94
- });
95
- continue;
96
- }
97
- if (value === "{") {
98
- writePath();
99
- output.push({
100
- type: "group",
101
- tokens: consumeUntil("}")
102
- });
103
- continue;
68
+ if (quoteStart) throw new PathError(`Unterminated quote at index ${quoteStart}`, str);
104
69
  }
105
- if (value === "}" || value === "(" || value === ")" || value === "[" || value === "]" || value === "+" || value === "?" || value === "!") throw new PathError(`Unexpected ${value} at index ${index - 1}`, str);
106
- path += value;
70
+ if (!name) throw new PathError(`Missing parameter name at index ${index}`, str);
71
+ writePath();
72
+ output.push({
73
+ type,
74
+ name
75
+ });
76
+ continue;
107
77
  }
108
- if (end) throw new PathError(`Unexpected end at index ${index}, expected ${end}`, str);
109
- writePath();
110
- return output;
78
+ if (char === "{") {
79
+ writePath();
80
+ output.push({
81
+ type: "group",
82
+ tokens: consumeUntil("}")
83
+ });
84
+ continue;
85
+ }
86
+ if ("}()[]+?!".includes(char)) throw new PathError(`Unexpected ${char} at index ${index - 1}`, str);
87
+ path += char;
111
88
  }
112
- return new TokenData(consumeUntil(""), str);
113
- }
114
- /**
115
- * Compile a string to a template function for the path.
116
- */
117
- function compile(path, options = {}) {
118
- const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
119
- const fn = tokensToFunction((typeof path === "object" ? path : parse(path, options)).tokens, delimiter, encode);
120
- return function path(params = {}) {
121
- const missing = [];
122
- const path = fn(params, missing);
123
- if (missing.length) throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
124
- return path;
125
- };
89
+ if (end) throw new PathError(`Unexpected end at index ${index}, expected ${end}`, str);
90
+ writePath();
91
+ return output;
126
92
  }
127
- function tokensToFunction(tokens, delimiter, encode) {
128
- const encoders = tokens.map((token) => tokenToFunction(token, delimiter, encode));
93
+ return {
94
+ tokens: consumeUntil(""),
95
+ originalPath: str
96
+ };
97
+ }
98
+ /**
99
+ * Compile a string to a template function for the path.
100
+ */
101
+ function compile(path, options = {}) {
102
+ const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
103
+ const fn = tokensToFunction((typeof path === "object" ? path : parse(path, options)).tokens, delimiter, encode);
104
+ return function path(params = {}) {
105
+ const missing = [];
106
+ const path = fn(params, missing);
107
+ if (missing.length) throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
108
+ return path;
109
+ };
110
+ }
111
+ function tokensToFunction(tokens, delimiter, encode) {
112
+ const encoders = tokens.map((token) => tokenToFunction(token, delimiter, encode));
113
+ return (data, missing) => {
114
+ let result = "";
115
+ for (const encoder of encoders) result += encoder(data, missing);
116
+ return result;
117
+ };
118
+ }
119
+ /**
120
+ * Convert a single token into a path building function.
121
+ */
122
+ function tokenToFunction(token, delimiter, encode) {
123
+ if (token.type === "text") return () => token.value;
124
+ if (token.type === "group") {
125
+ const fn = tokensToFunction(token.tokens, delimiter, encode);
129
126
  return (data, missing) => {
130
- let result = "";
131
- for (const encoder of encoders) result += encoder(data, missing);
132
- return result;
127
+ const len = missing.length;
128
+ const value = fn(data, missing);
129
+ if (missing.length === len) return value;
130
+ missing.length = len;
131
+ return "";
133
132
  };
134
133
  }
135
- /**
136
- * Convert a single token into a path building function.
137
- */
138
- function tokenToFunction(token, delimiter, encode) {
139
- if (token.type === "text") return () => token.value;
140
- if (token.type === "group") {
141
- const fn = tokensToFunction(token.tokens, delimiter, encode);
142
- return (data, missing) => {
143
- const len = missing.length;
144
- const value = fn(data, missing);
145
- if (missing.length === len) return value;
146
- missing.length = len;
147
- return "";
148
- };
134
+ const encodeValue = encode || NOOP_VALUE;
135
+ if (token.type === "wildcard" && encode !== false) return (data, missing) => {
136
+ const value = data[token.name];
137
+ if (value == null) {
138
+ missing.push(token.name);
139
+ return "";
149
140
  }
150
- const encodeValue = encode || NOOP_VALUE;
151
- if (token.type === "wildcard" && encode !== false) return (data, missing) => {
152
- const value = data[token.name];
153
- if (value == null) {
154
- missing.push(token.name);
155
- return "";
156
- }
157
- if (!Array.isArray(value) || value.length === 0) throw new TypeError(`Expected "${token.name}" to be a non-empty array`);
158
- let result = "";
159
- for (let i = 0; i < value.length; i++) {
160
- if (typeof value[i] !== "string") throw new TypeError(`Expected "${token.name}/${i}" to be a string`);
161
- if (i > 0) result += delimiter;
162
- result += encodeValue(value[i]);
163
- }
164
- return result;
165
- };
166
- return (data, missing) => {
167
- const value = data[token.name];
168
- if (value == null) {
169
- missing.push(token.name);
170
- return "";
171
- }
172
- if (typeof value !== "string") throw new TypeError(`Expected "${token.name}" to be a string`);
173
- return encodeValue(value);
141
+ if (!Array.isArray(value) || value.length === 0) throw new TypeError(`Expected "${token.name}" to be a non-empty array`);
142
+ let result = "";
143
+ for (let i = 0; i < value.length; i++) {
144
+ if (typeof value[i] !== "string") throw new TypeError(`Expected "${token.name}/${i}" to be a string`);
145
+ if (i > 0) result += delimiter;
146
+ result += encodeValue(value[i]);
147
+ }
148
+ if (!result) throw new TypeError(`Expected "${token.name}" to be a non-empty array`);
149
+ return result;
150
+ };
151
+ return (data, missing) => {
152
+ const value = data[token.name];
153
+ if (value == null) {
154
+ missing.push(token.name);
155
+ return "";
156
+ }
157
+ if (typeof value !== "string" || value.length === 0) throw new TypeError(`Expected "${token.name}" to be a non-empty string`);
158
+ return encodeValue(value);
159
+ };
160
+ }
161
+ /**
162
+ * Transform a path into a match function.
163
+ */
164
+ function match(path, options = {}) {
165
+ const { decode = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
166
+ const { regexp, keys } = pathToRegexp(path, options);
167
+ const decoders = keys.map((key) => {
168
+ if (decode === false) return NOOP_VALUE;
169
+ if (key.type === "param") return decode;
170
+ return (value) => value.split(delimiter).map(decode);
171
+ });
172
+ return function match(input) {
173
+ const m = regexp.exec(input);
174
+ if (!m) return false;
175
+ const path = m[0];
176
+ const params = Object.create(null);
177
+ for (let i = 1; i < m.length; i++) {
178
+ if (m[i] === void 0) continue;
179
+ const key = keys[i - 1];
180
+ const decoder = decoders[i - 1];
181
+ params[key.name] = decoder(m[i]);
182
+ }
183
+ return {
184
+ path,
185
+ params
174
186
  };
175
- }
176
- /**
177
- * Transform a path into a match function.
178
- */
179
- function match(path, options = {}) {
180
- const { decode = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
181
- const { regexp, keys } = pathToRegexp(path, options);
182
- const decoders = keys.map((key) => {
183
- if (decode === false) return NOOP_VALUE;
184
- if (key.type === "param") return decode;
185
- return (value) => value.split(delimiter).map(decode);
187
+ };
188
+ }
189
+ /**
190
+ * Transform a path into a regular expression and capture keys.
191
+ */
192
+ function pathToRegexp(path, options = {}) {
193
+ const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
194
+ const keys = [];
195
+ let source = "";
196
+ let combinations = 0;
197
+ function process(path) {
198
+ if (Array.isArray(path)) {
199
+ for (const p of path) process(p);
200
+ return;
201
+ }
202
+ const data = typeof path === "object" ? path : parse(path, options);
203
+ flatten(data.tokens, 0, [], (tokens) => {
204
+ if (combinations >= 256) throw new PathError("Too many path combinations", data.originalPath);
205
+ if (combinations > 0) source += "|";
206
+ source += toRegExpSource(tokens, delimiter, keys, data.originalPath, trailing);
207
+ combinations++;
186
208
  });
187
- return function match(input) {
188
- const m = regexp.exec(input);
189
- if (!m) return false;
190
- const path = m[0];
191
- const params = Object.create(null);
192
- for (let i = 1; i < m.length; i++) {
193
- if (m[i] === void 0) continue;
194
- const key = keys[i - 1];
195
- const decoder = decoders[i - 1];
196
- params[key.name] = decoder(m[i]);
197
- }
198
- return {
199
- path,
200
- params
201
- };
202
- };
203
209
  }
204
- /**
205
- * Transform a path into a regular expression and capture keys.
206
- */
207
- function pathToRegexp(path, options = {}) {
208
- const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
209
- const keys = [];
210
- let source = "";
211
- let combinations = 0;
212
- function process(path) {
213
- if (Array.isArray(path)) {
214
- for (const p of path) process(p);
215
- return;
216
- }
217
- const data = typeof path === "object" ? path : parse(path, options);
218
- flatten(data.tokens, 0, [], (tokens) => {
219
- if (combinations >= 256) throw new PathError("Too many path combinations", data.originalPath);
220
- if (combinations > 0) source += "|";
221
- source += toRegExpSource(tokens, delimiter, keys, data.originalPath);
222
- combinations++;
223
- });
210
+ process(path);
211
+ let pattern = `^(?:${source})`;
212
+ pattern += end ? "$" : "(?=" + escape(delimiter) + "|$)";
213
+ return {
214
+ regexp: new RegExp(pattern, sensitive ? "" : "i"),
215
+ keys
216
+ };
217
+ }
218
+ /**
219
+ * Generate a flat list of sequence tokens from the given tokens.
220
+ */
221
+ function flatten(tokens, index, result, callback) {
222
+ while (index < tokens.length) {
223
+ const token = tokens[index++];
224
+ if (token.type === "group") {
225
+ const len = result.length;
226
+ flatten(token.tokens, 0, result, (seq) => flatten(tokens, index, seq, callback));
227
+ result.length = len;
228
+ continue;
224
229
  }
225
- process(path);
226
- let pattern = `^(?:${source})`;
227
- if (trailing) pattern += "(?:" + escape(delimiter) + "$)?";
228
- pattern += end ? "$" : "(?=" + escape(delimiter) + "|$)";
229
- return {
230
- regexp: new RegExp(pattern, sensitive ? "" : "i"),
231
- keys
232
- };
230
+ result.push(token);
233
231
  }
234
- /**
235
- * Generate a flat list of sequence tokens from the given tokens.
236
- */
237
- function flatten(tokens, index, result, callback) {
232
+ callback(result);
233
+ }
234
+ /**
235
+ * Transform a flat sequence of tokens into a regular expression.
236
+ */
237
+ function toRegExpSource(tokens, delimiter, keys, originalPath, trailing) {
238
+ let result = "";
239
+ let prefix = "";
240
+ let hasWildcardAhead = false;
241
+ let hasSegmentWildcard = false;
242
+ let wildcardBacktrack = "";
243
+ let index = 0;
244
+ function seekWildcard(index) {
245
+ while (index < tokens.length) if (tokens[index++].type === "wildcard") return true;
246
+ return false;
247
+ }
248
+ function textRemaining(index) {
249
+ let result = "";
238
250
  while (index < tokens.length) {
239
251
  const token = tokens[index++];
240
- if (token.type === "group") {
241
- const len = result.length;
242
- flatten(token.tokens, 0, result, (seq) => flatten(tokens, index, seq, callback));
243
- result.length = len;
244
- continue;
245
- }
246
- result.push(token);
252
+ if (token.type !== "text") return result;
253
+ if (token.value.includes(delimiter)) break;
254
+ result += token.value;
247
255
  }
248
- callback(result);
249
256
  }
250
- /**
251
- * Transform a flat sequence of tokens into a regular expression.
252
- */
253
- function toRegExpSource(tokens, delimiter, keys, originalPath) {
254
- let result = "";
255
- let backtrack = "";
256
- let wildcardBacktrack = "";
257
- let prevCaptureType = 0;
258
- let hasSegmentCapture = 0;
259
- let index = 0;
260
- function hasInSegment(index, type) {
261
- while (index < tokens.length) {
262
- const token = tokens[index++];
263
- if (token.type === type) return true;
264
- if (token.type === "text") {
265
- if (token.value.includes(delimiter)) break;
266
- }
267
- }
268
- return false;
269
- }
270
- function peekText(index) {
271
- let result = "";
272
- while (index < tokens.length) {
273
- const token = tokens[index++];
274
- if (token.type !== "text") break;
275
- result += token.value;
276
- }
277
- return result;
257
+ while (index < tokens.length) {
258
+ const token = tokens[index++];
259
+ if (token.type === "text") {
260
+ const value = escape(token.value);
261
+ result += value;
262
+ wildcardBacktrack += value;
263
+ prefix += token.value;
264
+ if (token.value.includes(delimiter)) hasSegmentWildcard = false;
265
+ continue;
278
266
  }
279
- while (index < tokens.length) {
280
- const token = tokens[index++];
281
- if (token.type === "text") {
282
- result += escape(token.value);
283
- backtrack += token.value;
284
- if (prevCaptureType === 2) wildcardBacktrack += token.value;
285
- if (token.value.includes(delimiter)) hasSegmentCapture = 0;
286
- continue;
287
- }
288
- if (token.type === "param" || token.type === "wildcard") {
289
- if (prevCaptureType && !backtrack) throw new PathError(`Missing text before "${token.name}" ${token.type}`, originalPath);
290
- if (token.type === "param") {
291
- result += hasSegmentCapture & 2 ? `(${negate(delimiter, backtrack)}+)` : hasInSegment(index, "wildcard") ? `(${negate(delimiter, peekText(index))}+)` : hasSegmentCapture & 1 ? `(${negate(delimiter, backtrack)}+|${escape(backtrack)})` : `(${negate(delimiter, "")}+)`;
292
- hasSegmentCapture |= prevCaptureType = 1;
267
+ if (token.type === "param" || token.type === "wildcard") {
268
+ if (result && !prefix) throw new PathError(`Missing text before "${token.name}" ${token.type}`, originalPath);
269
+ keys.push(token);
270
+ if (token.type === "param") {
271
+ if (hasSegmentWildcard) {
272
+ const value = negate(delimiter, prefix);
273
+ result += `(${value}+?|${value}*${escape(prefix)})`;
293
274
  } else {
294
- result += hasSegmentCapture & 2 ? `(${negate(backtrack, "")}+)` : wildcardBacktrack ? `(${negate(wildcardBacktrack, "")}+|${negate(delimiter, "")}+)` : `([^]+)`;
295
- wildcardBacktrack = "";
296
- hasSegmentCapture |= prevCaptureType = 2;
275
+ const text = textRemaining(index);
276
+ if (text) result += `(?=(${negate(delimiter, "")}+?)${escape(text)})(?:\\${keys.length})`;
277
+ else result += `(${negate(delimiter, "")}+)`;
297
278
  }
298
- keys.push(token);
299
- backtrack = "";
300
- continue;
279
+ } else {
280
+ if (hasWildcardAhead) result += `)${wildcardBacktrack}`;
281
+ hasWildcardAhead = seekWildcard(index);
282
+ result += hasWildcardAhead ? "(?=([^]+?)" : "([^]+)";
283
+ hasSegmentWildcard = true;
284
+ wildcardBacktrack = "";
301
285
  }
302
- throw new TypeError(`Unknown token type: ${token.type}`);
286
+ wildcardBacktrack += `(?:\\${keys.length})`;
287
+ prefix = "";
288
+ continue;
303
289
  }
304
- return result;
290
+ throw new TypeError(`Unknown token type: ${token.type}`);
305
291
  }
306
- /**
307
- * Block backtracking on previous text/delimiter.
308
- */
309
- function negate(a, b) {
310
- if (b.length > a.length) return negate(b, a);
311
- if (a === b) b = "";
312
- if (b.length > 1) return `(?:(?!${escape(a)}|${escape(b)})[^])`;
313
- if (a.length > 1) return `(?:(?!${escape(a)})[^${escape(b)}])`;
314
- return `[^${escape(a + b)}]`;
315
- }
316
- })))();
292
+ if (trailing && !prefix.endsWith(delimiter)) result += "(?:" + escape(delimiter) + "$)?";
293
+ return result;
294
+ }
295
+ /**
296
+ * Block backtracking on previous text/delimiter.
297
+ */
298
+ function negate(a, b) {
299
+ if (b.length > a.length) return negate(b, a);
300
+ if (a === b) b = "";
301
+ if (b.length > 1) return `(?:(?!${escape(a)}|${escape(b)})[^])`;
302
+ if (a.length > 1) return `(?:(?!${escape(a)})[^${escape(b)}])`;
303
+ return `[^${escape(a + b)}]`;
304
+ }
305
+ // src/negotiation/index.ts
317
306
  /**
318
307
  * Rewrite incoming path matching the `source` pattern into the `destination` pattern.
319
308
  *
@@ -323,8 +312,8 @@ var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
323
312
  * @param destination - the target pattern to convert into
324
313
  */
325
314
  function rewritePath(source, destination) {
326
- const matcher = (0, import_dist.match)(source, { decode: false });
327
- const compiler = (0, import_dist.compile)(destination, { encode: false });
315
+ const matcher = match(source, { decode: false });
316
+ const compiler = compile(destination, { encode: false });
328
317
  return { rewrite(pathname) {
329
318
  const result = matcher(pathname);
330
319
  if (!result) return false;
@@ -1,4 +1,4 @@
1
- import { n as __exportAll } from "./rolldown-runtime-C-UrYobY.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.js";
2
2
  // src/source/path.ts
3
3
  var path_exports = /* @__PURE__ */ __exportAll({
4
4
  basename: () => basename,
@@ -1,4 +1,4 @@
1
- import { n as RehypeCodeOptionsCommon } from "./rehype-code.core-D1aZ5yla.js";
1
+ import { n as RehypeCodeOptionsCommon } from "./rehype-code.core-BeCtKe7K.js";
2
2
  type RehypeCodeOptions = RehypeCodeOptionsCommon & {
3
3
  /**
4
4
  * The regex engine to use.
@@ -1,7 +1,7 @@
1
1
  import { n as IconOptions } from "./transformer-icon-Bi4LROAz.js";
2
2
  import { t as Awaitable } from "./types-Dvkw0Kd0.js";
3
3
  import { i as Highlighter, t as HighlightCodeOptions } from "./index-BhAz6nyI.js";
4
- import { n as ShikiFactory } from "./index-B0Bzrmfa.js";
4
+ import { n as ShikiFactory } from "./index-e-8QoCiA.js";
5
5
  import { Element, Root } from "hast";
6
6
  import { Processor, Transformer } from "unified";
7
7
  import { BuiltinLanguage, BuiltinTheme, CodeOptionsMeta, CodeOptionsThemes, CodeToHastOptionsCommon, HighlighterCore, LanguageInput, ShikiTransformer, TransformerOptions } from "shiki";
@@ -1,8 +1,8 @@
1
1
  import { n as flattenNodeHast, s as walk } from "./utils-DV8PBZiI.js";
2
- import { a as defaultThemes, n as createShikiHighlighter } from "./shiki-DL5DIaX-.js";
3
- import { parseCodeBlockAttributes } from "./mdx-plugins/codeblock-utils.js";
4
2
  import { transformerIcon } from "./mdx-plugins/transformer-icon.js";
5
- // ../../node_modules/.pnpm/@shikijs+transformers@4.5.0/node_modules/@shikijs/transformers/dist/index.mjs
3
+ import { parseCodeBlockAttributes } from "./mdx-plugins/codeblock-utils.js";
4
+ import { a as defaultThemes, n as createShikiHighlighter } from "./shiki-DL5DIaX-.js";
5
+ // ../../node_modules/.pnpm/@shikijs+transformers@4.6.0/node_modules/@shikijs/transformers/dist/index.mjs
6
6
  const RE_SPLIT_COMMENT = /(\s+\/\/)/;
7
7
  const RE_V1_END_COMMENT_PREFIX = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/;
8
8
  const RE_V3_END_COMMENT_PREFIX = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/;