fumadocs-openapi 12.5.4 → 12.5.6

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 (135) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/dist/.translations/index.d.ts +6 -3
  3. package/dist/.translations/keys.js +6 -2
  4. package/dist/_virtual/_rolldown/runtime.js +1 -2
  5. package/dist/generate-file.d.ts +1 -3
  6. package/dist/generate-file.js +3 -3
  7. package/dist/i18n.d.ts +1 -3
  8. package/dist/i18n.js +1 -2
  9. package/dist/index.browser.d.ts +0 -2
  10. package/dist/index.browser.js +1 -2
  11. package/dist/node_modules/.pnpm/fast-content-type-parse@4.0.1/node_modules/fast-content-type-parse/index.js +1 -2
  12. package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/array-helper.js +1 -2
  13. package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js +1 -2
  14. package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/options-helper.js +1 -2
  15. package/dist/operation.d.ts +1 -3
  16. package/dist/operation.js +1 -2
  17. package/dist/packages/shared-api/dist/.translations/index.d.ts +2 -5
  18. package/dist/packages/shared-api/dist/.translations/keys.js +2 -2
  19. package/dist/packages/shared-api/dist/auto-anchor/index.js +1 -2
  20. package/dist/packages/shared-api/dist/codegen.d.ts +0 -3
  21. package/dist/packages/shared-api/dist/codegen.js +1 -2
  22. package/dist/packages/shared-api/dist/components/badge.js +1 -2
  23. package/dist/packages/shared-api/dist/components/collapsible.js +1 -2
  24. package/dist/packages/shared-api/dist/components/copy-typescript.js +1 -2
  25. package/dist/packages/shared-api/dist/components/defaults.d.ts +2 -4
  26. package/dist/packages/shared-api/dist/components/defaults.js +21 -21
  27. package/dist/packages/shared-api/dist/components/dialog.js +1 -2
  28. package/dist/packages/shared-api/dist/components/example.js +3 -3
  29. package/dist/packages/shared-api/dist/components/playground/fields.js +27 -9
  30. package/dist/packages/shared-api/dist/components/playground/json-editor.js +1 -2
  31. package/dist/packages/shared-api/dist/components/playground/panels.js +1 -2
  32. package/dist/packages/shared-api/dist/components/playground/param-input.js +1 -2
  33. package/dist/packages/shared-api/dist/components/playground/result.js +1 -2
  34. package/dist/packages/shared-api/dist/components/playground/schema.js +1 -2
  35. package/dist/packages/shared-api/dist/components/playground/server-select.js +1 -2
  36. package/dist/packages/shared-api/dist/components/schema/client.d.ts +1 -4
  37. package/dist/packages/shared-api/dist/components/schema/client.js +3 -2
  38. package/dist/packages/shared-api/dist/components/schema/index.d.ts +0 -3
  39. package/dist/packages/shared-api/dist/components/schema/index.js +1 -2
  40. package/dist/packages/shared-api/dist/components/segmented.js +1 -2
  41. package/dist/packages/shared-api/dist/components/select-tab.js +1 -2
  42. package/dist/packages/shared-api/dist/components/select.js +1 -2
  43. package/dist/packages/shared-api/dist/components/spinner.js +1 -2
  44. package/dist/packages/shared-api/dist/i18n.js +1 -2
  45. package/dist/packages/shared-api/dist/source.d.ts +1 -4
  46. package/dist/packages/shared-api/dist/source.js +1 -2
  47. package/dist/packages/shared-api/dist/utils/document-cache.js +1 -2
  48. package/dist/packages/shared-api/dist/utils/id-to-title.js +1 -2
  49. package/dist/packages/shared-api/dist/utils/is-plain-object.js +1 -2
  50. package/dist/packages/shared-api/dist/utils/url.js +1 -2
  51. package/dist/packages/shared-api/dist/utils/use-query.js +1 -2
  52. package/dist/packages/shared-api/dist/utils/use-server-store.js +1 -2
  53. package/dist/playground/auth.d.ts +2 -2
  54. package/dist/playground/auth.js +1 -2
  55. package/dist/playground/fetcher.d.ts +1 -3
  56. package/dist/playground/fetcher.js +1 -2
  57. package/dist/playground/use-playground.d.ts +1 -3
  58. package/dist/playground/use-playground.js +1 -2
  59. package/dist/requests/generators/all.d.ts +1 -3
  60. package/dist/requests/generators/all.js +1 -2
  61. package/dist/requests/generators/csharp.d.ts +1 -3
  62. package/dist/requests/generators/csharp.js +1 -2
  63. package/dist/requests/generators/curl.d.ts +1 -3
  64. package/dist/requests/generators/curl.js +1 -2
  65. package/dist/requests/generators/go.d.ts +1 -3
  66. package/dist/requests/generators/go.js +1 -2
  67. package/dist/requests/generators/index.d.ts +1 -3
  68. package/dist/requests/generators/index.js +1 -2
  69. package/dist/requests/generators/java.d.ts +1 -3
  70. package/dist/requests/generators/java.js +1 -2
  71. package/dist/requests/generators/javascript.d.ts +1 -3
  72. package/dist/requests/generators/javascript.js +1 -2
  73. package/dist/requests/generators/python.d.ts +1 -3
  74. package/dist/requests/generators/python.js +1 -2
  75. package/dist/requests/generators/rust.d.ts +1 -3
  76. package/dist/requests/generators/rust.js +1 -2
  77. package/dist/requests/media/adapter.d.ts +0 -2
  78. package/dist/requests/media/adapter.js +1 -2
  79. package/dist/requests/media/encode.d.ts +1 -3
  80. package/dist/requests/media/encode.js +1 -2
  81. package/dist/requests/media/resolve-adapter.d.ts +1 -3
  82. package/dist/requests/media/resolve-adapter.js +1 -2
  83. package/dist/requests/string-utils.js +1 -2
  84. package/dist/requests/types.d.ts +1 -3
  85. package/dist/server/index.d.ts +0 -2
  86. package/dist/server/index.js +1 -2
  87. package/dist/server/oauth.d.ts +1 -3
  88. package/dist/server/oauth.js +1 -2
  89. package/dist/server/proxy.d.ts +0 -2
  90. package/dist/server/proxy.js +8 -4
  91. package/dist/types/openapi.d.ts +1 -3
  92. package/dist/types.d.ts +1 -3
  93. package/dist/ui/base.d.ts +1 -6
  94. package/dist/ui/base.js +1 -2
  95. package/dist/ui/components/codeblock.js +1 -2
  96. package/dist/ui/components/endpoint.js +1 -2
  97. package/dist/ui/components/heading.js +1 -2
  98. package/dist/ui/components/markdown.js +1 -2
  99. package/dist/ui/components/method-label.js +1 -2
  100. package/dist/ui/components/schema.js +1 -2
  101. package/dist/ui/index.d.ts +0 -2
  102. package/dist/ui/index.js +1 -2
  103. package/dist/ui/operation/index.js +14 -5
  104. package/dist/ui/operation/usage-tabs.js +12 -5
  105. package/dist/ui/playground/client.d.ts +6 -5
  106. package/dist/ui/playground/client.js +1 -2
  107. package/dist/ui/playground/components/auth.js +1 -2
  108. package/dist/ui/playground/components/request-panel.d.ts +8 -0
  109. package/dist/ui/playground/components/request-panel.js +18 -8
  110. package/dist/ui/playground/components/response-panel.js +1 -2
  111. package/dist/ui/playground/components/result-display.d.ts +1 -3
  112. package/dist/ui/playground/components/result-display.js +1 -2
  113. package/dist/ui/playground/components/server-select.js +1 -2
  114. package/dist/ui/playground/components/url-bar.js +1 -2
  115. package/dist/ui/scalar/client.js +1 -2
  116. package/dist/ui/scalar/index.d.ts +1 -3
  117. package/dist/ui/scalar/index.js +1 -2
  118. package/dist/utils/create-page.d.ts +10 -9
  119. package/dist/utils/create-page.js +14 -8
  120. package/dist/utils/document/dereference.d.ts +1 -3
  121. package/dist/utils/document/dereference.js +1 -2
  122. package/dist/utils/document/load.js +1 -2
  123. package/dist/utils/get-example-requests.js +4 -4
  124. package/dist/utils/pages/builder.d.ts +0 -2
  125. package/dist/utils/pages/builder.js +1 -2
  126. package/dist/utils/pages/preset-auto.d.ts +0 -2
  127. package/dist/utils/pages/preset-auto.js +1 -2
  128. package/dist/utils/pages/to-static-data.d.ts +1 -3
  129. package/dist/utils/pages/to-static-data.js +1 -2
  130. package/dist/utils/pages/to-text.d.ts +1 -3
  131. package/dist/utils/pages/to-text.js +1 -2
  132. package/dist/utils/schema.js +1 -2
  133. package/dist/utils/use-server.d.ts +0 -2
  134. package/dist/utils/use-server.js +1 -2
  135. package/package.json +12 -13
@@ -1,4 +1,2 @@
1
1
  import { CodeUsageGenerator } from "./index.js";
2
- //#region src/requests/generators/go.d.ts
3
- export declare const go: CodeUsageGenerator;
4
- //#endregion
2
+ export declare const go: CodeUsageGenerator;
@@ -1,6 +1,6 @@
1
1
  import { cookieString, doubleQuote, indent } from "../string-utils.js";
2
2
  import { generateBodyExample } from "../media/adapter.js";
3
- //#region src/requests/generators/go.ts
3
+ // src/requests/generators/go.ts
4
4
  const go = {
5
5
  label: "Go",
6
6
  lang: "go",
@@ -36,5 +36,4 @@ ${body ? `${multipart ? indent(body) : ` ${body}`}\n` : ""}${indent(s.join("\n"
36
36
  }`;
37
37
  }
38
38
  };
39
- //#endregion
40
39
  export { go };
@@ -1,7 +1,6 @@
1
1
  import { RequestData } from "../types.js";
2
2
  import { MediaAdapter } from "../media/adapter.js";
3
3
  import { CodeUsageGenerator as CodeUsageGenerator$1, CodeUsageGeneratorRegistry as CodeUsageGeneratorRegistry$1, InlineCodeUsageGenerator as InlineCodeUsageGenerator$1 } from "../../packages/shared-api/dist/codegen.js";
4
- //#region src/requests/generators/index.d.ts
5
4
  export declare function pathnameFromRequest(pathname: string, { path, query }: RequestData): string;
6
5
  export type CodeUsageGeneratorRegistry = CodeUsageGeneratorRegistry$1<RequestData & {
7
6
  url: string;
@@ -33,5 +32,4 @@ export type CodeUsageGeneratorFn<T = unknown> = (data: RequestData & {
33
32
  }, context: {
34
33
  mediaAdapters: Record<string, MediaAdapter>;
35
34
  custom: T;
36
- }) => string;
37
- //#endregion
35
+ }) => string;
@@ -1,5 +1,5 @@
1
1
  import { createCodeUsageGeneratorRegistry as createCodeUsageGeneratorRegistry$1 } from "../../packages/shared-api/dist/codegen.js";
2
- //#region src/requests/generators/index.ts
2
+ // src/requests/generators/index.ts
3
3
  function pathnameFromRequest(pathname, { path, query }) {
4
4
  for (const key in path) {
5
5
  const param = path[key];
@@ -18,5 +18,4 @@ function pathnameFromRequest(pathname, { path, query }) {
18
18
  function createCodeUsageGeneratorRegistry(inherit) {
19
19
  return createCodeUsageGeneratorRegistry$1(inherit);
20
20
  }
21
- //#endregion
22
21
  export { createCodeUsageGeneratorRegistry, pathnameFromRequest };
@@ -1,4 +1,2 @@
1
1
  import { CodeUsageGenerator } from "./index.js";
2
- //#region src/requests/generators/java.d.ts
3
- export declare const java: CodeUsageGenerator;
4
- //#endregion
2
+ export declare const java: CodeUsageGenerator;
@@ -1,6 +1,6 @@
1
1
  import { cookieString, doubleQuote, indent, inputToString } from "../string-utils.js";
2
2
  import { generateBodyExample } from "../media/adapter.js";
3
- //#region src/requests/generators/java.ts
3
+ // src/requests/generators/java.ts
4
4
  const boundary = "form-data-boundary";
5
5
  const java = {
6
6
  label: "Java",
@@ -48,5 +48,4 @@ function multipartBody(body) {
48
48
  }
49
49
  return `var body = HttpRequest.BodyPublishers.ofString(${JSON.stringify(`${text}--${boundary}--\r\n`)});`;
50
50
  }
51
- //#endregion
52
51
  export { java };
@@ -1,4 +1,2 @@
1
1
  import { CodeUsageGenerator } from "./index.js";
2
- //#region src/requests/generators/javascript.d.ts
3
- export declare const javascript: CodeUsageGenerator;
4
- //#endregion
2
+ export declare const javascript: CodeUsageGenerator;
@@ -1,6 +1,6 @@
1
1
  import { cookieString, doubleQuote, indent } from "../string-utils.js";
2
2
  import { generateBodyExample } from "../media/adapter.js";
3
- //#region src/requests/generators/javascript.ts
3
+ // src/requests/generators/javascript.ts
4
4
  const javascript = {
5
5
  label: "JavaScript",
6
6
  lang: "js",
@@ -27,5 +27,4 @@ const javascript = {
27
27
  return s.join("\n\n");
28
28
  }
29
29
  };
30
- //#endregion
31
30
  export { javascript };
@@ -1,4 +1,2 @@
1
1
  import { CodeUsageGenerator } from "./index.js";
2
- //#region src/requests/generators/python.d.ts
3
- export declare const python: CodeUsageGenerator;
4
- //#endregion
2
+ export declare const python: CodeUsageGenerator;
@@ -1,6 +1,6 @@
1
1
  import { doubleQuote } from "../string-utils.js";
2
2
  import { generateBodyExample } from "../media/adapter.js";
3
- //#region src/requests/generators/python.ts
3
+ // src/requests/generators/python.ts
4
4
  const python = {
5
5
  label: "Python",
6
6
  lang: "python",
@@ -40,5 +40,4 @@ function generatePythonObject(v, imports) {
40
40
  } else if (typeof v === "object") return `{\n${Object.entries(v).map(([key, value]) => ` ${doubleQuote(key)}: ${generatePythonObject(value, imports)}`).join(", \n")}\n}`;
41
41
  else throw new Error(`Unsupported type: ${typeof v}`);
42
42
  }
43
- //#endregion
44
43
  export { python };
@@ -1,4 +1,2 @@
1
1
  import { CodeUsageGenerator } from "./index.js";
2
- //#region src/requests/generators/rust.d.ts
3
- export declare const rust: CodeUsageGenerator;
4
- //#endregion
2
+ export declare const rust: CodeUsageGenerator;
@@ -1,6 +1,6 @@
1
1
  import { cookieString, doubleQuote, indent } from "../string-utils.js";
2
2
  import { generateBodyExample } from "../media/adapter.js";
3
- //#region src/requests/generators/rust.ts
3
+ // src/requests/generators/rust.ts
4
4
  const rust = {
5
5
  label: "Rust",
6
6
  lang: "rust",
@@ -30,5 +30,4 @@ ${indent(request.join("\n"), 2)}
30
30
  }`;
31
31
  }
32
32
  };
33
- //#endregion
34
33
  export { rust };
@@ -1,4 +1,3 @@
1
- //#region src/requests/media/adapter.d.ts
2
1
  interface BaseContext {
3
2
  /**
4
3
  * Passed by your custom example generator, for your custom media adapter to receive.
@@ -46,5 +45,4 @@ export interface MediaAdapter {
46
45
  body: unknown;
47
46
  }, ctx: MediaContext) => string | undefined;
48
47
  }
49
- //#endregion
50
48
  export {};
@@ -3,7 +3,7 @@ import { csharpRawString, goString, javaTextBlock, jsTemplateLiteral, pythonStri
3
3
  import { require_js2xml } from "../../node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js";
4
4
  import { inputToString } from "../string-utils.js";
5
5
  import { resolveMediaAdapter } from "./resolve-adapter.js";
6
- //#region src/requests/media/adapter.ts
6
+ // src/requests/media/adapter.ts
7
7
  var import_js2xml = /* @__PURE__ */ __toESM(require_js2xml(), 1);
8
8
  const defaultAdapters = {
9
9
  "application/json": {
@@ -141,5 +141,4 @@ function str(init, mediaType, ctx) {
141
141
  case "rust": return `let body = ${rustString(text)};`;
142
142
  }
143
143
  }
144
- //#endregion
145
144
  export { defaultAdapters, generateBodyExample };
@@ -1,7 +1,6 @@
1
1
  import { RawRequestData, RequestData } from "../types.js";
2
2
  import { MediaAdapter } from "./adapter.js";
3
3
  import { ParameterObject } from "../../types.js";
4
- //#region src/requests/media/encode.d.ts
5
4
  export interface EncodedParameter {
6
5
  readonly value: string;
7
6
  }
@@ -11,5 +10,4 @@ export interface EncodedParameterMultiple {
11
10
  /**
12
11
  * serialize parameters, see https://swagger.io/docs/specification/v3_0/serialization.
13
12
  */
14
- export declare function encodeRequestData(from: RawRequestData, adapters: Record<string, MediaAdapter>, parameters?: ParameterObject[]): RequestData;
15
- //#endregion
13
+ export declare function encodeRequestData(from: RawRequestData, adapters: Record<string, MediaAdapter>, parameters?: ParameterObject[]): RequestData;
@@ -1,5 +1,5 @@
1
1
  import { resolveMediaAdapter } from "./resolve-adapter.js";
2
- //#region src/requests/media/encode.ts
2
+ // src/requests/media/encode.ts
3
3
  /**
4
4
  * serialize parameters, see https://swagger.io/docs/specification/v3_0/serialization.
5
5
  */
@@ -123,5 +123,4 @@ function serializeCookieParameter(field, value, output) {
123
123
  else if (typeof value === "object") output[field.name] = { value: Object.entries(value).flat().join(",") };
124
124
  else output[field.name] = { value: String(value) };
125
125
  }
126
- //#endregion
127
126
  export { encodeRequestData };
@@ -1,5 +1,4 @@
1
1
  import { MediaAdapter } from "./adapter.js";
2
- //#region src/requests/media/resolve-adapter.d.ts
3
2
  /**
4
3
  * Resolve a media adapter for a given media type.
5
4
  * Supports exact matches and pattern matching (e.g., +json suffix).
@@ -8,5 +7,4 @@ import { MediaAdapter } from "./adapter.js";
8
7
  * @param adapters - Record of media adapters
9
8
  * @returns The resolved adapter or undefined if not found
10
9
  */
11
- export declare function resolveMediaAdapter(mediaType: string, adapters: Record<string, MediaAdapter>): MediaAdapter | undefined;
12
- //#endregion
10
+ export declare function resolveMediaAdapter(mediaType: string, adapters: Record<string, MediaAdapter>): MediaAdapter | undefined;
@@ -1,4 +1,4 @@
1
- //#region src/requests/media/resolve-adapter.ts
1
+ // src/requests/media/resolve-adapter.ts
2
2
  const VariantMediaTypeRegex = /^(?<dir>[a-zA-Z0-9._-]+)\/(?<content>[a-zA-Z0-9._-]+)\+(?<variant>[a-zA-Z0-9._-]+)$/;
3
3
  /**
4
4
  * Resolve the media type of the adapter for a given media type, like `application/json` for `+json` variants.
@@ -24,5 +24,4 @@ function resolveMediaAdapter(mediaType, adapters) {
24
24
  const type = resolveMediaType(mediaType, adapters);
25
25
  if (type) return adapters[type];
26
26
  }
27
- //#endregion
28
27
  export { resolveMediaAdapter, resolveMediaType };
@@ -1,6 +1,6 @@
1
1
  import { __toESM } from "../_virtual/_rolldown/runtime.js";
2
2
  import { require_js2xml } from "../node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js";
3
- //#region src/requests/string-utils.ts
3
+ // src/requests/string-utils.ts
4
4
  var import_js2xml = /* @__PURE__ */ __toESM(require_js2xml(), 1);
5
5
  /**
6
6
  * The text of a body value in the format of a media type, strings are already serialized.
@@ -44,5 +44,4 @@ function indent(code, tab = 1) {
44
44
  const p = " ".repeat(tab);
45
45
  return code.split("\n").map((v) => v.length === 0 ? v : p + v).join("\n");
46
46
  }
47
- //#endregion
48
47
  export { cookieString, doubleQuote, indent, inputToString, jsxString };
@@ -1,6 +1,5 @@
1
1
  import { EncodedParameter, EncodedParameterMultiple } from "./media/encode.js";
2
2
  import { HttpMethods } from "../types.js";
3
- //#region src/requests/types.d.ts
4
3
  export interface RawRequestData {
5
4
  method: HttpMethods;
6
5
  path: Record<string, unknown>;
@@ -18,5 +17,4 @@ export interface RequestData {
18
17
  cookie: Record<string, EncodedParameter>;
19
18
  body?: unknown;
20
19
  bodyMediaType?: string;
21
- }
22
- //#endregion
20
+ }
@@ -9,7 +9,6 @@ import "../ui/index.js";
9
9
  import { DynamicSource, LoaderPlugin, MetaData, Page, PageData, Source } from "fumadocs-core/source";
10
10
  import { TOCItemType } from "fumadocs-core/toc";
11
11
  import { StructuredData } from "fumadocs-core/mdx-plugins/remark-structure";
12
- //#region src/server/index.d.ts
13
12
  /**
14
13
  * schema ID -> file path, URL, downloaded schema object, or a function returning them
15
14
  */
@@ -84,5 +83,4 @@ export declare function openapiSource(server: OpenAPIServer, options?: OpenAPISo
84
83
  metaData: MetaData;
85
84
  pageData: OpenAPIPageData;
86
85
  }>>;
87
- //#endregion
88
86
  export type { CreateProxyOptions, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec, Proxy };
@@ -7,7 +7,7 @@ import { createOAuthHandler } from "./oauth.js";
7
7
  import { loadDocument } from "../utils/document/load.js";
8
8
  import { MethodLabel } from "../ui/components/method-label.js";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
- //#region src/server/index.tsx
10
+ // src/server/index.tsx
11
11
  function createOpenAPI(options = {}) {
12
12
  const { disableCache = false, includeDocument = true } = options;
13
13
  const docCache = /* @__PURE__ */ new Map();
@@ -145,5 +145,4 @@ function openapiPlugin() {
145
145
  async function openapiSource(server, options = {}) {
146
146
  return server.staticSource(options);
147
147
  }
148
- //#endregion
149
148
  export { createOpenAPI, openapiPlugin, openapiSource };
@@ -1,6 +1,4 @@
1
- //#region src/server/oauth.d.ts
2
1
  /**
3
2
  * A route handler for the redirect URI of OAuth flows, it sends users back to the page that started the flow.
4
3
  */
5
- export declare function createOAuthHandler(): (req: Request) => Response;
6
- //#endregion
4
+ export declare function createOAuthHandler(): (req: Request) => Response;
@@ -1,4 +1,4 @@
1
- //#region src/server/oauth.ts
1
+ // src/server/oauth.ts
2
2
  /**
3
3
  * A route handler for the redirect URI of OAuth flows, it sends users back to the page that started the flow.
4
4
  */
@@ -13,5 +13,4 @@ function createOAuthHandler() {
13
13
  });
14
14
  };
15
15
  }
16
- //#endregion
17
16
  export { createOAuthHandler };
@@ -1,4 +1,3 @@
1
- //#region src/server/proxy.d.ts
2
1
  declare const methods: readonly ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
3
2
  type Handler = (req: Request) => Promise<Response>;
4
3
  type OriginMatcher = string | RegExp;
@@ -30,5 +29,4 @@ export interface CreateProxyOptions {
30
29
  };
31
30
  }
32
31
  export declare function createProxy(options?: CreateProxyOptions): Proxy;
33
- //#endregion
34
32
  export {};
@@ -1,4 +1,4 @@
1
- //#region src/server/proxy.ts
1
+ // src/server/proxy.ts
2
2
  const methods = [
3
3
  "GET",
4
4
  "POST",
@@ -61,6 +61,7 @@ function createProxy(options = {}) {
61
61
  let method = initial.method;
62
62
  let url = new URL(initial.url);
63
63
  const headers = new Headers(initial.headers);
64
+ headers.delete("content-length");
64
65
  let body = initial.body && methodsWithBody.has(method.toUpperCase()) ? await initial.arrayBuffer() : void 0;
65
66
  for (let redirects = 0; redirects <= maxRedirects; redirects++) {
66
67
  const response = await send(url, {
@@ -87,7 +88,6 @@ function createProxy(options = {}) {
87
88
  case 303:
88
89
  method = "GET";
89
90
  body = void 0;
90
- headers.delete("content-length");
91
91
  headers.delete("content-type");
92
92
  }
93
93
  url = next;
@@ -171,8 +171,13 @@ let publicFetch;
171
171
  */
172
172
  async function createPublicFetch() {
173
173
  if ("Bun" in globalThis) throw new ProxyError("Private networks cannot be blocked on Bun, specify `allowedOrigins`.", 500);
174
+ const key = Symbol.for("undici.globalDispatcher.1");
175
+ const builtin = Reflect.get(globalThis, key);
174
176
  const [{ Agent, fetch }, dns, { BlockList, isIP }] = await Promise.all([
175
- import("undici"),
177
+ import("undici").then((undici) => {
178
+ Reflect.set(globalThis, key, builtin);
179
+ return undici;
180
+ }),
176
181
  import("node:dns"),
177
182
  import("node:net")
178
183
  ]);
@@ -196,5 +201,4 @@ async function createPublicFetch() {
196
201
  });
197
202
  };
198
203
  }
199
- //#endregion
200
204
  export { createProxy };
@@ -1,4 +1,3 @@
1
- //#region src/types/openapi.d.ts
2
1
  /** Original copy: https://github.com/scalar/scalar/blob/main/packages/openapi-types/src/openapi-types.ts
3
2
  * - Removed Record<string, unknown> fallbacks
4
3
  */
@@ -897,5 +896,4 @@ export type IJsonSchema = {
897
896
  oneOf?: IJsonSchema[];
898
897
  not?: IJsonSchema;
899
898
  $ref?: string;
900
- };
901
- //#endregion
899
+ };
package/dist/types.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { OpenAPIV3, OpenAPIV3_2 } from "./types/openapi.js";
2
2
  import { InlineCodeUsageGenerator } from "./requests/generators/index.js";
3
- //#region src/types.d.ts
4
3
  export type Document = OpenAPIV3_2.Document;
5
4
  export type OperationObject = OpenAPIV3_2.OperationObject & {
6
5
  'x-codeSamples'?: InlineCodeUsageGenerator[];
@@ -23,5 +22,4 @@ export type ExampleObject = OpenAPIV3_2.ExampleObject;
23
22
  export type MediaTypeObject = OpenAPIV3_2.MediaTypeObject;
24
23
  export type RequestBodyObject = OpenAPIV3_2.RequestBodyObject;
25
24
  export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
26
- export type Awaitable<T> = T | Promise<T>;
27
- //#endregion
25
+ export type Awaitable<T> = T | Promise<T>;
package/dist/ui/base.d.ts CHANGED
@@ -1,12 +1,7 @@
1
1
  import { OpenAPIPageProps } from "../utils/pages/builder.js";
2
2
  import { CreateOpenAPIPageOptions } from "./index.js";
3
3
  import { FC } from "react";
4
- import { ShikiFactory } from "fumadocs-core/highlight/shiki";
5
- //#region src/ui/base.d.ts
6
4
  /**
7
5
  * Create `<OpenAPIPage />` (a client component) without the full Shiki bundle.
8
6
  */
9
- export declare function createOpenAPIPageBase(options: CreateOpenAPIPageOptions & {
10
- shiki: ShikiFactory;
11
- }): FC<OpenAPIPageProps>;
12
- //#endregion
7
+ export declare function createOpenAPIPageBase(options: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
package/dist/ui/base.js CHANGED
@@ -3,7 +3,7 @@ import { createRenderer } from "../utils/create-page.js";
3
3
  import { Schema } from "../packages/shared-api/dist/components/schema/index.js";
4
4
  import { Operation } from "./operation/index.js";
5
5
  import { jsxs } from "react/jsx-runtime";
6
- //#region src/ui/base.tsx
6
+ // src/ui/base.tsx
7
7
  /**
8
8
  * Create `<OpenAPIPage />` (a client component) without the full Shiki bundle.
9
9
  */
@@ -24,5 +24,4 @@ function Layout({ operations, webhooks }) {
24
24
  children: [operations?.map((item) => item.children), webhooks?.map((item) => item.children)]
25
25
  });
26
26
  }
27
- //#endregion
28
27
  export { createOpenAPIPageBase };
@@ -1,10 +1,9 @@
1
1
  "use client";
2
2
  import { useComponents } from "../../utils/create-page.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/ui/components/codeblock.tsx
4
+ // src/ui/components/codeblock.tsx
5
5
  function ClientCodeBlock(props) {
6
6
  const { CodeBlock } = useComponents();
7
7
  return /* @__PURE__ */ jsx(CodeBlock, { ...props });
8
8
  }
9
- //#endregion
10
9
  export { ClientCodeBlock };
@@ -1,7 +1,7 @@
1
1
  import { MethodLabel } from "./method-label.js";
2
2
  import { cn } from "../../utils/cn.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- //#region src/ui/components/endpoint.tsx
4
+ // src/ui/components/endpoint.tsx
5
5
  function EndpointBar({ method, route, deprecated = false, children, ...props }) {
6
6
  return /* @__PURE__ */ jsxs("div", {
7
7
  ...props,
@@ -36,5 +36,4 @@ function Route({ route, ...props }) {
36
36
  })
37
37
  });
38
38
  }
39
- //#endregion
40
39
  export { EndpointBar };
@@ -2,7 +2,7 @@
2
2
  import { useComponents } from "../../utils/create-page.js";
3
3
  import { useAnchorId } from "../../packages/shared-api/dist/auto-anchor/index.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
- //#region src/ui/components/heading.tsx
5
+ // src/ui/components/heading.tsx
6
6
  /**
7
7
  * A heading of the page, `id` is resolved against the anchor sections it is under.
8
8
  */
@@ -13,5 +13,4 @@ function Heading({ id, ...props }) {
13
13
  ...props
14
14
  });
15
15
  }
16
- //#endregion
17
16
  export { Heading };
@@ -1,10 +1,9 @@
1
1
  "use client";
2
2
  import { useComponents } from "../../utils/create-page.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/ui/components/markdown.tsx
4
+ // src/ui/components/markdown.tsx
5
5
  function Markdown({ md }) {
6
6
  const { Markdown: Comp } = useComponents();
7
7
  return /* @__PURE__ */ jsx(Comp, { md });
8
8
  }
9
- //#endregion
10
9
  export { Markdown };
@@ -1,6 +1,6 @@
1
1
  import { Badge } from "../../packages/shared-api/dist/components/badge.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
- //#region src/ui/components/method-label.tsx
3
+ // src/ui/components/method-label.tsx
4
4
  function getMethodColor(method) {
5
5
  switch (method.toUpperCase()) {
6
6
  case "PUT": return "yellow";
@@ -17,5 +17,4 @@ function MethodLabel({ children, ...props }) {
17
17
  children: children.toUpperCase()
18
18
  });
19
19
  }
20
- //#endregion
21
20
  export { MethodLabel };
@@ -3,7 +3,7 @@ import { useComponents, useRenderContext } from "../../utils/create-page.js";
3
3
  import { useAnchorId } from "../../packages/shared-api/dist/auto-anchor/index.js";
4
4
  import { useMemo } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
- //#region src/ui/components/schema.tsx
6
+ // src/ui/components/schema.tsx
7
7
  /**
8
8
  * The Schema UI of the page, with the anchor ID of the root schema resolved.
9
9
  */
@@ -24,5 +24,4 @@ function SchemaUI({ client, ...props }) {
24
24
  }
25
25
  });
26
26
  }
27
- //#endregion
28
27
  export { SchemaUI };
@@ -1,7 +1,6 @@
1
1
  import { OpenAPIPageProps, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec } from "../utils/pages/builder.js";
2
2
  import { CreateOpenAPIRendererOptions } from "../utils/create-page.js";
3
3
  import { FC } from "react";
4
- //#region src/ui/index.d.ts
5
4
  export interface CreateOpenAPIPageOptions extends Omit<CreateOpenAPIRendererOptions, 'components'> {
6
5
  /**
7
6
  * Replace parts of the UI, e.g. the ones installed with Fumadocs CLI.
@@ -12,5 +11,4 @@ export interface CreateOpenAPIPageOptions extends Omit<CreateOpenAPIRendererOpti
12
11
  * Create `<OpenAPIPage />` (a client component).
13
12
  */
14
13
  export declare function createOpenAPIPage(options?: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
15
- //#endregion
16
14
  export type { OpenAPIPageProps, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec };
package/dist/ui/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createOpenAPIPageBase } from "./base.js";
3
3
  import { defaultShikiFactory } from "fumadocs-core/highlight/shiki/full";
4
- //#region src/ui/index.tsx
4
+ // src/ui/index.tsx
5
5
  /**
6
6
  * Create `<OpenAPIPage />` (a client component).
7
7
  */
@@ -11,5 +11,4 @@ function createOpenAPIPage(options = {}) {
11
11
  shiki: options.shiki ?? defaultShikiFactory
12
12
  });
13
13
  }
14
- //#endregion
15
14
  export { createOpenAPIPage };
@@ -22,7 +22,7 @@ import { ChevronRight, Plus, X } from "lucide-react";
22
22
  import { buttonVariants } from "fumadocs-ui/components/ui/button";
23
23
  import { Dialog } from "@base-ui/react/dialog";
24
24
  import { Callout } from "fumadocs-ui/components/callout";
25
- //#region src/ui/operation/index.tsx
25
+ // src/ui/operation/index.tsx
26
26
  function Operation({ type, path, method, operation, pathItem, ...props }) {
27
27
  return /* @__PURE__ */ jsx(OperationProvider, {
28
28
  type,
@@ -88,7 +88,10 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
88
88
  children: /* @__PURE__ */ jsx(MediaContent, {
89
89
  schema: content.schema,
90
90
  required: requestBody.required,
91
- selector: /* @__PURE__ */ jsx(SelectTabTrigger, { items }),
91
+ selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
92
+ "aria-label": t("Media type"),
93
+ items
94
+ }),
92
95
  request: true
93
96
  })
94
97
  }, mediaType))
@@ -153,7 +156,10 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
153
156
  className: "overflow-hidden rounded-xl border bg-fd-card",
154
157
  children: [/* @__PURE__ */ jsx("div", {
155
158
  className: "flex h-9 items-center border-b ps-1.5 pe-1 text-[0.8125rem] not-prose",
156
- children: /* @__PURE__ */ jsx(SelectTabTrigger, { items })
159
+ children: /* @__PURE__ */ jsx(SelectTabTrigger, {
160
+ "aria-label": t("Security scheme"),
161
+ items
162
+ })
157
163
  }), security.map((requirement, i) => /* @__PURE__ */ jsx(SelectTab, {
158
164
  value: items[i].value,
159
165
  className: "px-3",
@@ -326,6 +332,7 @@ function ResponseSection({ responses, headingLevel }) {
326
332
  });
327
333
  }
328
334
  function ResponseContent({ item: { status, response, content }, onLink }) {
335
+ const t = useTranslations({ note: "operation page" });
329
336
  const segments = ["response", status];
330
337
  const ref = useAnchorLink(segments, onLink);
331
338
  const contentTypes = Object.entries(content);
@@ -348,7 +355,10 @@ function ResponseContent({ item: { status, response, content }, onLink }) {
348
355
  anchorSegments: [mediaType],
349
356
  children: /* @__PURE__ */ jsx(MediaContent, {
350
357
  schema: media.schema,
351
- selector: /* @__PURE__ */ jsx(SelectTabTrigger, { items })
358
+ selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
359
+ "aria-label": t("Media type"),
360
+ items
361
+ })
352
362
  })
353
363
  }, mediaType))]
354
364
  })
@@ -496,5 +506,4 @@ function Callback({ item, path, headingLevel }) {
496
506
  })]
497
507
  });
498
508
  }
499
- //#endregion
500
509
  export { Operation };