fumadocs-openapi 11.4.0 → 11.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,226 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../node_modules/.pnpm/fast-content-type-parse@4.0.0/node_modules/fast-content-type-parse/index.js
3
+ var require_fast_content_type_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ const NullObject = function NullObject() {};
5
+ NullObject.prototype = Object.create(null);
6
+ const HTAB = 9;
7
+ const SP = 32;
8
+ const SEMI = 59;
9
+ const EQ = 61;
10
+ const SLASH = 47;
11
+ const DQUOTE = 34;
12
+ const BSLASH = 92;
13
+ /**
14
+ * Character class lookup table, indexed by UTF-16 code unit. It covers the
15
+ * whole code unit range so that lookups are never out of bounds and always
16
+ * yield a small integer, which keeps the scanning loops on V8's fast path.
17
+ * Code units above 0xff have no class: header field values are octets.
18
+ *
19
+ * RFC 9110 Section 5.6.2:
20
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
21
+ * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
22
+ * / DIGIT / ALPHA
23
+ * ; any VCHAR, except delimiters
24
+ *
25
+ * RFC 9110 Section 5.6.4:
26
+ * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
27
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
28
+ * obs-text = %x80-FF
29
+ */
30
+ const TCHAR = 1;
31
+ const QDTEXT = 2;
32
+ const QUOTED_PAIR = 4;
33
+ const UPPER = 8;
34
+ const CHAR_CLASS = /* @__PURE__ */ new Uint8Array(65536);
35
+ for (const ch of "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyz") CHAR_CLASS[ch.charCodeAt(0)] = TCHAR;
36
+ for (const ch of "ABCDEFGHIJKLMNOPQRSTUVWXYZ") CHAR_CLASS[ch.charCodeAt(0)] = 9;
37
+ CHAR_CLASS[HTAB] |= 6;
38
+ CHAR_CLASS[SP] |= 6;
39
+ CHAR_CLASS[33] |= 6;
40
+ CHAR_CLASS[DQUOTE] |= QUOTED_PAIR;
41
+ for (let i = 35; i <= 91; i++) CHAR_CLASS[i] |= 6;
42
+ CHAR_CLASS[BSLASH] |= QUOTED_PAIR;
43
+ for (let i = 93; i <= 126; i++) CHAR_CLASS[i] |= 6;
44
+ for (let i = 128; i <= 255; i++) CHAR_CLASS[i] |= 6;
45
+ /**
46
+ * Remove the backslashes of the quoted-pairs in header[start, end).
47
+ * The range is known to be a valid quoted-string body.
48
+ */
49
+ function unescapeQuotedPairs(header, start, end) {
50
+ let value = "";
51
+ let index = start;
52
+ while (index < end) {
53
+ if (header.charCodeAt(index) === BSLASH) {
54
+ value += header.slice(start, index);
55
+ start = ++index;
56
+ }
57
+ index++;
58
+ }
59
+ return value + header.slice(start, end);
60
+ }
61
+ const defaultContentType = {
62
+ type: "",
63
+ parameters: new NullObject()
64
+ };
65
+ Object.freeze(defaultContentType.parameters);
66
+ Object.freeze(defaultContentType);
67
+ const invalidParameterFormat = {
68
+ type: "",
69
+ parameters: defaultContentType.parameters
70
+ };
71
+ Object.freeze(invalidParameterFormat);
72
+ /**
73
+ * Parse media type to object, following RFC 9110 Section 8.3.1:
74
+ *
75
+ * media-type = type "/" subtype parameters
76
+ * type = token
77
+ * subtype = token
78
+ * parameters = *( OWS ";" OWS [ parameter ] )
79
+ * parameter = parameter-name "=" parameter-value
80
+ * parameter-name = token
81
+ * parameter-value = ( token / quoted-string )
82
+ * OWS = *( SP / HTAB )
83
+ *
84
+ * Leading and trailing OWS is tolerated, as a field parser is required to
85
+ * strip it before evaluating the field value (RFC 9110 Section 5.5).
86
+ *
87
+ * Returns `defaultContentType` when the media type is invalid and
88
+ * `invalidParameterFormat` when the parameters are malformed.
89
+ *
90
+ * @param {string} header
91
+ * @return {Object}
92
+ */
93
+ function parseHeader(header) {
94
+ const len = header.length;
95
+ let index = 0;
96
+ let code = 0;
97
+ let flags = 0;
98
+ while (index < len) {
99
+ code = header.charCodeAt(index);
100
+ if (code !== SP && code !== HTAB) break;
101
+ index++;
102
+ }
103
+ const typeStart = index;
104
+ let upper = 0;
105
+ while (index < len) {
106
+ code = header.charCodeAt(index);
107
+ flags = CHAR_CLASS[code];
108
+ if ((flags & TCHAR) === 0) break;
109
+ upper |= flags;
110
+ index++;
111
+ }
112
+ if (index === typeStart || index === len || code !== SLASH) return defaultContentType;
113
+ index++;
114
+ const subtypeStart = index;
115
+ while (index < len) {
116
+ code = header.charCodeAt(index);
117
+ flags = CHAR_CLASS[code];
118
+ if ((flags & TCHAR) === 0) break;
119
+ upper |= flags;
120
+ index++;
121
+ }
122
+ if (index === subtypeStart) return defaultContentType;
123
+ const typeEnd = index;
124
+ while (index < len) {
125
+ code = header.charCodeAt(index);
126
+ if (code !== SP && code !== HTAB) break;
127
+ index++;
128
+ }
129
+ if (index !== len && code !== SEMI) return defaultContentType;
130
+ const type = header.slice(typeStart, typeEnd);
131
+ const result = {
132
+ type: (upper & UPPER) !== 0 ? type.toLowerCase() : type,
133
+ parameters: new NullObject()
134
+ };
135
+ if (index === len) return result;
136
+ const parameters = result.parameters;
137
+ while (index < len) {
138
+ index++;
139
+ while (index < len) {
140
+ code = header.charCodeAt(index);
141
+ if (code !== SP && code !== HTAB) break;
142
+ index++;
143
+ }
144
+ if (index === len) return result;
145
+ if (code === SEMI) continue;
146
+ const keyStart = index;
147
+ upper = 0;
148
+ while (index < len) {
149
+ code = header.charCodeAt(index);
150
+ flags = CHAR_CLASS[code];
151
+ if ((flags & TCHAR) === 0) break;
152
+ upper |= flags;
153
+ index++;
154
+ }
155
+ if (index === keyStart || index === len || code !== EQ) return invalidParameterFormat;
156
+ const key = header.slice(keyStart, index);
157
+ index++;
158
+ let value;
159
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
160
+ index++;
161
+ const valueStart = index;
162
+ let escaped = false;
163
+ while (index < len) {
164
+ code = header.charCodeAt(index);
165
+ if (code === DQUOTE) break;
166
+ if ((CHAR_CLASS[code] & QDTEXT) !== 0) {
167
+ index++;
168
+ continue;
169
+ }
170
+ if (code !== BSLASH) return invalidParameterFormat;
171
+ index++;
172
+ if (index === len || (CHAR_CLASS[header.charCodeAt(index)] & QUOTED_PAIR) === 0) return invalidParameterFormat;
173
+ escaped = true;
174
+ index++;
175
+ }
176
+ if (index === len) return invalidParameterFormat;
177
+ value = escaped ? unescapeQuotedPairs(header, valueStart, index) : header.slice(valueStart, index);
178
+ index++;
179
+ } else {
180
+ const valueStart = index;
181
+ while (index < len && (CHAR_CLASS[header.charCodeAt(index)] & TCHAR) !== 0) index++;
182
+ if (index === valueStart) return invalidParameterFormat;
183
+ value = header.slice(valueStart, index);
184
+ }
185
+ while (index < len) {
186
+ code = header.charCodeAt(index);
187
+ if (code !== SP && code !== HTAB) break;
188
+ index++;
189
+ }
190
+ if (index !== len && code !== SEMI) return invalidParameterFormat;
191
+ const name = (upper & UPPER) !== 0 ? key.toLowerCase() : key;
192
+ if (parameters[name] === void 0) parameters[name] = value;
193
+ }
194
+ return result;
195
+ }
196
+ /**
197
+ * Parse media type to object.
198
+ *
199
+ * @param {string|object} header
200
+ * @return {Object}
201
+ * @public
202
+ */
203
+ function parse(header) {
204
+ if (typeof header !== "string") throw new TypeError("argument header is required and must be a string");
205
+ const result = parseHeader(header);
206
+ if (result === defaultContentType) throw new TypeError("invalid media type");
207
+ if (result === invalidParameterFormat) throw new TypeError("invalid parameter format");
208
+ return result;
209
+ }
210
+ function safeParse(header) {
211
+ if (typeof header !== "string") return defaultContentType;
212
+ const result = parseHeader(header);
213
+ if (result === invalidParameterFormat) return defaultContentType;
214
+ return result;
215
+ }
216
+ module.exports.default = {
217
+ parse,
218
+ safeParse
219
+ };
220
+ module.exports.parse = parse;
221
+ module.exports.safeParse = safeParse;
222
+ module.exports.defaultContentType = defaultContentType;
223
+ }));
224
+ //#endregion
225
+ export default require_fast_content_type_parse();
226
+ export { require_fast_content_type_parse };
@@ -56,7 +56,7 @@ interface RequestBodyInfo {
56
56
  mediaType: string;
57
57
  }
58
58
  declare function PlaygroundClient({ route, method, operation, pathItem, writeOnly, readOnly, ...rest }: PlaygroundClientProps): import("react").JSX.Element;
59
- declare const ParamTypes: readonly ["path", "header", "cookie", "query"];
59
+ declare const ParamTypes: readonly ['path', 'header', 'cookie', 'query'];
60
60
  type ParamType = (typeof ParamTypes)[number];
61
61
  interface AuthField {
62
62
  fieldName: FieldKey;
@@ -2,7 +2,7 @@
2
2
  import { useStatusInfo } from "../status-info.js";
3
3
  import { cn } from "../../utils/cn.js";
4
4
  import { ClientCodeBlock } from "../../ui/components/codeblock.js";
5
- import { require_fast_content_type_parse } from "../../node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.js";
5
+ import { require_fast_content_type_parse } from "../../node_modules/.pnpm/fast-content-type-parse@4.0.0/node_modules/fast-content-type-parse/index.js";
6
6
  import { Fragment, useEffect, useMemo, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { ChevronDown, CircleX, SignpostIcon } from "lucide-react";
@@ -1,5 +1,5 @@
1
1
  //#region src/server/proxy.d.ts
2
- declare const methods: readonly ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"];
2
+ declare const methods: readonly ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
3
3
  type Handler = (req: Request) => Promise<Response>;
4
4
  type OriginMatcher = string | RegExp;
5
5
  interface Proxy extends Record<(typeof methods)[number], Handler> {
package/dist/utils/cn.js CHANGED
@@ -1,2 +1,2 @@
1
- import { cn } from "cnfast";
1
+ import { cn } from "cn";
2
2
  export { cn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "11.4.0",
3
+ "version": "11.4.1",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -45,34 +45,34 @@
45
45
  "dependencies": {
46
46
  "@fuma-translate/react": "^1.0.2",
47
47
  "@fumari/json-schema-ts": "^1.0.2",
48
- "@scalar/json-magic": "^0.13.2",
48
+ "@scalar/json-magic": "^0.13.3",
49
49
  "chokidar": "^5.0.0",
50
50
  "class-variance-authority": "^0.7.1",
51
- "cnfast": "^0.1.0",
51
+ "cn": "^0.2.4",
52
52
  "github-slugger": "^2.0.0",
53
53
  "hast-util-to-jsx-runtime": "^2.3.6",
54
- "lucide-react": "^1.34.0",
54
+ "lucide-react": "^1.39.0",
55
55
  "remark": "^15.0.1",
56
56
  "remark-rehype": "^11.1.2",
57
57
  "shiki": "^4.4.3",
58
58
  "yaml": "^2.9.0",
59
- "@fumadocs/api-docs": "0.2.7",
59
+ "@fumadocs/api-docs": "0.2.8",
60
60
  "@fumari/stf": "1.1.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@scalar/api-client-react": "^2.0.42",
63
+ "@scalar/api-client-react": "^2.0.43",
64
64
  "@scalar/openapi-upgrader": "^0.2.15",
65
65
  "@tailwindcss/oxide": "^4.3.3",
66
- "@types/node": "26.3.0",
66
+ "@types/node": "26.4.1",
67
67
  "@types/react": "^19.2.18",
68
- "fast-content-type-parse": "^3.0.0",
68
+ "fast-content-type-parse": "^4.0.0",
69
69
  "fuma-cli": "^0.1.1",
70
70
  "json-schema-typed": "^8.0.2",
71
71
  "tsdown": "0.22.14",
72
72
  "xml-js": "^1.6.11",
73
- "fumadocs-core": "16.15.5",
74
- "tsconfig": "0.0.0",
75
- "fumadocs-ui": "npm:@fumadocs/base-ui@16.15.5"
73
+ "fumadocs-core": "16.15.6",
74
+ "fumadocs-ui": "npm:@fumadocs/base-ui@16.15.6",
75
+ "tsconfig": "0.0.0"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@scalar/api-client-react": "^2.0.20",
@@ -96,7 +96,7 @@
96
96
  },
97
97
  "inlinedDependencies": {
98
98
  "@scalar/openapi-upgrader": "0.2.15",
99
- "fast-content-type-parse": "3.0.0",
99
+ "fast-content-type-parse": "4.0.0",
100
100
  "xml-js": "1.6.11"
101
101
  },
102
102
  "scripts": {
@@ -1,115 +0,0 @@
1
- import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
- //#region ../../node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.js
3
- var require_fast_content_type_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
- const NullObject = function NullObject() {};
5
- NullObject.prototype = Object.create(null);
6
- /**
7
- * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
8
- *
9
- * parameter = token "=" ( token / quoted-string )
10
- * token = 1*tchar
11
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
12
- * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
13
- * / DIGIT / ALPHA
14
- * ; any VCHAR, except delimiters
15
- * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
16
- * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
17
- * obs-text = %x80-FF
18
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
19
- */
20
- const paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
21
- /**
22
- * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
23
- *
24
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
25
- * obs-text = %x80-FF
26
- */
27
- const quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
28
- /**
29
- * RegExp to match type in RFC 7231 sec 3.1.1.1
30
- *
31
- * media-type = type "/" subtype
32
- * type = token
33
- * subtype = token
34
- */
35
- const mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u;
36
- const defaultContentType = {
37
- type: "",
38
- parameters: new NullObject()
39
- };
40
- Object.freeze(defaultContentType.parameters);
41
- Object.freeze(defaultContentType);
42
- /**
43
- * Parse media type to object.
44
- *
45
- * @param {string|object} header
46
- * @return {Object}
47
- * @public
48
- */
49
- function parse(header) {
50
- if (typeof header !== "string") throw new TypeError("argument header is required and must be a string");
51
- let index = header.indexOf(";");
52
- const type = index !== -1 ? header.slice(0, index).trim() : header.trim();
53
- if (mediaTypeRE.test(type) === false) throw new TypeError("invalid media type");
54
- const result = {
55
- type: type.toLowerCase(),
56
- parameters: new NullObject()
57
- };
58
- if (index === -1) return result;
59
- let key;
60
- let match;
61
- let value;
62
- paramRE.lastIndex = index;
63
- while (match = paramRE.exec(header)) {
64
- if (match.index !== index) throw new TypeError("invalid parameter format");
65
- index += match[0].length;
66
- key = match[1].toLowerCase();
67
- value = match[2];
68
- if (value[0] === "\"") {
69
- value = value.slice(1, value.length - 1);
70
- quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1"));
71
- }
72
- result.parameters[key] = value;
73
- }
74
- if (index !== header.length) throw new TypeError("invalid parameter format");
75
- return result;
76
- }
77
- function safeParse(header) {
78
- if (typeof header !== "string") return defaultContentType;
79
- let index = header.indexOf(";");
80
- const type = index !== -1 ? header.slice(0, index).trim() : header.trim();
81
- if (mediaTypeRE.test(type) === false) return defaultContentType;
82
- const result = {
83
- type: type.toLowerCase(),
84
- parameters: new NullObject()
85
- };
86
- if (index === -1) return result;
87
- let key;
88
- let match;
89
- let value;
90
- paramRE.lastIndex = index;
91
- while (match = paramRE.exec(header)) {
92
- if (match.index !== index) return defaultContentType;
93
- index += match[0].length;
94
- key = match[1].toLowerCase();
95
- value = match[2];
96
- if (value[0] === "\"") {
97
- value = value.slice(1, value.length - 1);
98
- quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1"));
99
- }
100
- result.parameters[key] = value;
101
- }
102
- if (index !== header.length) return defaultContentType;
103
- return result;
104
- }
105
- module.exports.default = {
106
- parse,
107
- safeParse
108
- };
109
- module.exports.parse = parse;
110
- module.exports.safeParse = safeParse;
111
- module.exports.defaultContentType = defaultContentType;
112
- }));
113
- //#endregion
114
- export default require_fast_content_type_parse();
115
- export { require_fast_content_type_parse };