fumadocs-openapi 10.7.1 → 10.8.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.
Files changed (46) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/dist/_virtual/_rolldown/runtime.js +1 -1
  3. package/dist/generate-file.d.ts +2 -0
  4. package/dist/generate-file.js +2 -2
  5. package/dist/node_modules/.pnpm/{@scalar_helpers@0.4.3 → @scalar_helpers@0.5.2}/node_modules/@scalar/helpers/dist/general/create-limiter.js +1 -1
  6. package/dist/node_modules/.pnpm/{@scalar_helpers@0.4.3 → @scalar_helpers@0.5.2}/node_modules/@scalar/helpers/dist/object/is-object.js +12 -11
  7. package/dist/node_modules/.pnpm/{@scalar_helpers@0.4.3 → @scalar_helpers@0.5.2}/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +1 -1
  8. package/dist/node_modules/.pnpm/{@scalar_helpers@0.4.3 → @scalar_helpers@0.5.2}/node_modules/@scalar/helpers/dist/queue/queue.js +1 -1
  9. package/dist/node_modules/.pnpm/{@scalar_helpers@0.4.3 → @scalar_helpers@0.5.2}/node_modules/@scalar/helpers/dist/string/generate-hash.js +1 -1
  10. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/bundle/bundle.js +13 -2
  11. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js +2 -2
  12. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js +1 -1
  13. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +17 -3
  14. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/convert-to-local-ref.js +1 -1
  15. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +1 -1
  16. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +1 -1
  17. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/get-segments-from-path.js +1 -1
  18. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/get-value-by-path.js +1 -1
  19. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +1 -1
  20. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +1 -1
  21. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +2 -2
  22. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +1 -1
  23. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/normalize.js +1 -1
  24. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +1 -1
  25. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/set-value-at-path.js +2 -2
  26. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +1 -1
  27. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +1 -1
  28. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.4 → @scalar_openapi-upgrader@0.2.6}/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js +1 -1
  29. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.4 → @scalar_openapi-upgrader@0.2.6}/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +1 -1
  30. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.4 → @scalar_openapi-upgrader@0.2.6}/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js +1 -1
  31. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.4 → @scalar_openapi-upgrader@0.2.6}/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js +1 -1
  32. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.4 → @scalar_openapi-upgrader@0.2.6}/node_modules/@scalar/openapi-upgrader/dist/upgrade.js +1 -1
  33. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/doc/anchors.js +5 -0
  34. package/dist/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +8 -0
  35. package/dist/playground/client.d.ts +1 -1
  36. package/dist/playground/components/inputs.js +1 -2
  37. package/dist/ui/base.d.ts +2 -2
  38. package/dist/ui/components/dialog.js +0 -1
  39. package/dist/ui/components/select.js +0 -1
  40. package/dist/ui/schema/index.js +3 -3
  41. package/dist/utils/document/process.js +5 -5
  42. package/dist/utils/pages/to-text.d.ts +1 -1
  43. package/dist/utils/schema/to-string.js +5 -10
  44. package/package.json +15 -15
  45. /package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +0 -0
  46. /package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.5 → @scalar_json-magic@0.12.8}/node_modules/@scalar/json-magic/dist/bundle/plugins/parse-yaml/index.js +0 -0
@@ -193,7 +193,7 @@
193
193
  @source inline("current");
194
194
  @source inline("currentRef");
195
195
  @source inline("currentValue");
196
- @source inline("customisation");
196
+ @source inline("customization");
197
197
  @source inline("cva");
198
198
  @source inline("dark");
199
199
  @source inline("dark:text-blue-400");
@@ -1,6 +1,6 @@
1
1
  //#region \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
4
  var __exportAll = (all, no_symbols) => {
5
5
  let target = {};
6
6
  for (var name in all) __defProp(target, name, {
@@ -60,7 +60,9 @@ interface GenerateFilesConfig extends PagesToTextOptions {
60
60
  beforeWrite?: (this: BeforeWriteContext, files: OutputFile[]) => void | Promise<void>;
61
61
  }
62
62
  interface MetaOptions {
63
+ /** @deprecated use `folderStyle` instead */
63
64
  groupStyle?: 'folder' | 'separator';
65
+ folderStyle?: 'folder' | 'separator';
64
66
  }
65
67
  type Config = SchemaToPagesOptions & GenerateFilesConfig & {
66
68
  /**
@@ -65,14 +65,14 @@ async function generateFilesOnly(options) {
65
65
  }
66
66
  function generateMeta(context, options) {
67
67
  const files = [];
68
- const { groupStyle = "folder" } = options;
68
+ const folderStyle = options.folderStyle ?? options.groupStyle ?? "folder";
69
69
  function scan(entries, parent) {
70
70
  const pages = [];
71
71
  for (const entry of entries) {
72
72
  const relativePath = PathUtils.slash(parent ? path$1.relative(parent.path, entry.path) : entry.path);
73
73
  if (entry.type === "group") {
74
74
  scan(entry.entries, entry);
75
- if (groupStyle === "folder") pages.push(relativePath);
75
+ if (folderStyle === "folder") pages.push(relativePath);
76
76
  else pages.push(`---${entry.info.title}---`, `...${relativePath}`);
77
77
  } else pages.push(relativePath.slice(0, -path$1.extname(entry.path).length));
78
78
  }
@@ -1,5 +1,5 @@
1
1
  import { Queue } from "../queue/queue.js";
2
- //#region ../../node_modules/.pnpm/@scalar+helpers@0.4.3/node_modules/@scalar/helpers/dist/general/create-limiter.js
2
+ //#region ../../node_modules/.pnpm/@scalar+helpers@0.5.2/node_modules/@scalar/helpers/dist/general/create-limiter.js
3
3
  /**
4
4
  * Creates a function that limits the number of concurrent executions of async functions.
5
5
  *
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+helpers@0.4.3/node_modules/@scalar/helpers/dist/object/is-object.js
1
+ //#region ../../node_modules/.pnpm/@scalar+helpers@0.5.2/node_modules/@scalar/helpers/dist/object/is-object.js
2
2
  /**
3
3
  * Returns true if the provided value is a record object
4
4
  * (i.e. not null, not an array, and has an actual object as the prototype).
@@ -6,16 +6,17 @@
6
6
  * Differs from the previous isObject in that it returns false for Date,
7
7
  * RegExp, Error, Map, Set, WeakMap, WeakSet, Promise, and other non-plain objects.
8
8
  *
9
- * Examples:
10
- * isObject({}) // true
11
- * isObject({ a: 1 }) // true
12
- * isObject([]) // false (Array)
13
- * isObject(null) // false
14
- * isObject(123) // false
15
- * isObject('string') // false
16
- * isObject(new Error('test')) // false
17
- * isObject(new Date()) // false
18
- * isObject(Object.create(null)) // true
9
+ * | Value | Result |
10
+ * | :--- | :--- |
11
+ * | `isObject({})` | `true` |
12
+ * | `isObject({ a: 1 })` | `true` |
13
+ * | `isObject([])` | `false` (Array) |
14
+ * | `isObject(null)` | `false` |
15
+ * | `isObject(123)` | `false` |
16
+ * | `isObject('string')` | `false` |
17
+ * | `isObject(new Error('test'))` | `false` |
18
+ * | `isObject(new Date())` | `false` |
19
+ * | `isObject(Object.create(null))` | `true` |
19
20
  */
20
21
  const isObject = (value) => {
21
22
  if (value === null || typeof value !== "object") return false;
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+helpers@0.4.3/node_modules/@scalar/helpers/dist/object/prevent-pollution.js
1
+ //#region ../../node_modules/.pnpm/@scalar+helpers@0.5.2/node_modules/@scalar/helpers/dist/object/prevent-pollution.js
2
2
  /**
3
3
  * Set of dangerous keys that can be used for prototype pollution attacks.
4
4
  * These keys should never be used as property names in dynamic object operations.
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+helpers@0.4.3/node_modules/@scalar/helpers/dist/queue/queue.js
1
+ //#region ../../node_modules/.pnpm/@scalar+helpers@0.5.2/node_modules/@scalar/helpers/dist/queue/queue.js
2
2
  /**
3
3
  * Represents a node in a singly linked list structure, used internally by the Queue.
4
4
  *
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+helpers@0.4.3/node_modules/@scalar/helpers/dist/string/generate-hash.js
1
+ //#region ../../node_modules/.pnpm/@scalar+helpers@0.5.2/node_modules/@scalar/helpers/dist/string/generate-hash.js
2
2
  /**
3
3
  * MurmurHash3 implementation
4
4
  *
@@ -1,4 +1,4 @@
1
- import { isObject } from "../../../../../../@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/object/is-object.js";
1
+ import { isObject } from "../../../../../../@scalar_helpers@0.5.2/node_modules/@scalar/helpers/dist/object/is-object.js";
2
2
  import { convertToLocalRef } from "../helpers/convert-to-local-ref.js";
3
3
  import { getId, getSchemas } from "../helpers/get-schemas.js";
4
4
  import { getValueByPath } from "../helpers/get-value-by-path.js";
@@ -10,7 +10,7 @@ import { setValueAtPath } from "../helpers/set-value-at-path.js";
10
10
  import { toRelativePath } from "../helpers/to-relative-path.js";
11
11
  import { escapeJsonPointer } from "../helpers/escape-json-pointer.js";
12
12
  import { getHash, uniqueValueGeneratorFactory } from "./value-generator.js";
13
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/bundle.js
13
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/bundle.js
14
14
  /** Type guard to check if a value is an object with a $ref property */
15
15
  const hasRef = (value) => isObject(value) && "$ref" in value && typeof value["$ref"] === "string";
16
16
  /**
@@ -155,7 +155,18 @@ const resolveAndCopyReferences = (targetDocument, sourceDocument, referencePath,
155
155
  * These custom extensions help maintain the structure and traceability of bundled documents.
156
156
  */
157
157
  const extensions = {
158
+ /**
159
+ * Custom OpenAPI extension key used to store external references.
160
+ * This key will contain all bundled external documents.
161
+ * The x-ext key is used to maintain a clean separation between the main
162
+ * OpenAPI document and its bundled external references.
163
+ */
158
164
  externalDocuments: "x-ext",
165
+ /**
166
+ * Custom OpenAPI extension key used to maintain a mapping between
167
+ * hashed keys and their original URLs in x-ext.
168
+ * This mapping is essential for tracking the source of bundled references
169
+ */
159
170
  externalDocumentsMappings: "x-ext-urls"
160
171
  };
161
172
  /**
@@ -1,7 +1,7 @@
1
1
  import { isHttpUrl } from "../../../helpers/is-http-url.js";
2
- import { createLimiter } from "../../../../../../../../@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/general/create-limiter.js";
2
+ import { createLimiter } from "../../../../../../../../@scalar_helpers@0.5.2/node_modules/@scalar/helpers/dist/general/create-limiter.js";
3
3
  import { normalize } from "../../../helpers/normalize.js";
4
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js
4
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js
5
5
  /**
6
6
  * Safely checks for host from a URL
7
7
  * Needed because we cannot create a URL from a relative remote URL ex: examples/openapi.json
@@ -1,6 +1,6 @@
1
1
  import { isFilePath } from "../../../helpers/is-file-path.js";
2
2
  import { normalize } from "../../../helpers/normalize.js";
3
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js
3
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js
4
4
  /**
5
5
  * Reads and normalizes data from a local file
6
6
  * @param path - The file path to read from
@@ -1,5 +1,5 @@
1
- import { generateHash } from "../../../../../../@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/string/generate-hash.js";
2
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/value-generator.js
1
+ import { generateHash } from "../../../../../../@scalar_helpers@0.5.2/node_modules/@scalar/helpers/dist/string/generate-hash.js";
2
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/value-generator.js
3
3
  /**
4
4
  * Generates a short hash from a string value using xxhash.
5
5
  *
@@ -75,7 +75,21 @@ async function generateUniqueValue(compress, value, compressedToValue, prevCompr
75
75
  */
76
76
  const uniqueValueGeneratorFactory = (compress, compressedToValue) => {
77
77
  const valueToCompressed = Object.fromEntries(Object.entries(compressedToValue).map(([key, value]) => [value, key]));
78
- return { generate: async (value) => {
78
+ return {
79
+ /**
80
+ * Generates a unique compressed value for the given input string.
81
+ * First checks if a compressed value already exists in the cache.
82
+ * If not, generates a new unique compressed value and stores it in the cache.
83
+ *
84
+ * @param value - The original string value to compress
85
+ * @returns A Promise that resolves to the compressed string value
86
+ *
87
+ * @example
88
+ * const generator = uniqueValueGeneratorFactory(compress, {})
89
+ * const compressed = await generator.generate('example.com/schema.json')
90
+ * // Returns a unique compressed value like 'example'
91
+ */
92
+ generate: async (value) => {
79
93
  const cache = valueToCompressed[value];
80
94
  if (cache) return cache;
81
95
  const generatedValue = await generateUniqueValue(compress, value, compressedToValue);
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/convert-to-local-ref.js
1
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/convert-to-local-ref.js
2
2
  /**
3
3
  * Translates a JSON Reference ($ref) to a local object path within the root schema.
4
4
  *
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js
1
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js
2
2
  /**
3
3
  * Escapes a JSON pointer string.
4
4
  *
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js
1
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js
2
2
  /**
3
3
  * Retrieves the $id property from the input object if it exists and is a string.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { unescapeJsonPointer } from "./unescape-json-pointer.js";
2
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/get-segments-from-path.js
2
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/get-segments-from-path.js
3
3
  /**
4
4
  * Translate `/paths/~1test` to `['paths', '/test']`
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { getId } from "./get-schemas.js";
2
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/get-value-by-path.js
2
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/get-value-by-path.js
3
3
  /**
4
4
  * Traverses an object using an array of string segments (path keys) and returns
5
5
  * the value at the specified path along with its context (id if available).
@@ -1,7 +1,7 @@
1
1
  import { isHttpUrl } from "./is-http-url.js";
2
2
  import { isJsonObject } from "./is-json-object.js";
3
3
  import { isYaml } from "./is-yaml.js";
4
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js
4
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js
5
5
  /**
6
6
  * Checks if a string represents a file path by ensuring it's not a remote URL,
7
7
  * YAML content, or JSON content.
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js
1
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js
2
2
  /**
3
3
  * Checks if a string is a remote URL (starts with http:// or https://)
4
4
  * @param value - The URL string to check
@@ -1,5 +1,5 @@
1
- import { isObject } from "../../../../../../@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/object/is-object.js";
2
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js
1
+ import { isObject } from "../../../../../../@scalar_helpers@0.5.2/node_modules/@scalar/helpers/dist/object/is-object.js";
2
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js
3
3
  /**
4
4
  * Determines if a string represents a valid JSON object (i.e., a plain object, not an array, primitive, or null).
5
5
  * The function first checks if the string appears to start with an opening curly brace (ignoring leading whitespace),
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js
1
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js
2
2
  /**
3
3
  * Checks if a string appears to be YAML content.
4
4
  * This function uses a simple heuristic: it looks for a line that starts with an optional dash,
@@ -1,6 +1,6 @@
1
1
  import { parse } from "../../../../../../yaml@2.8.3/node_modules/yaml/browser/dist/public-api.js";
2
2
  import "../../../../../../yaml@2.8.3/node_modules/yaml/browser/index.js";
3
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/normalize.js
3
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/normalize.js
4
4
  /**
5
5
  * Normalize a string (YAML, JSON, object) to a JavaScript datatype.
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { isHttpUrl } from "./is-http-url.js";
2
2
  import { posix } from "../../../../../../pathe@2.0.3/node_modules/pathe/dist/index.js";
3
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js
3
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js
4
4
  /**
5
5
  * Resolves a reference path by combining a base path with a relative path.
6
6
  * Handles both remote URLs and local file paths.
@@ -1,6 +1,6 @@
1
- import { preventPollution } from "../../../../../../@scalar_helpers@0.4.3/node_modules/@scalar/helpers/dist/object/prevent-pollution.js";
1
+ import { preventPollution } from "../../../../../../@scalar_helpers@0.5.2/node_modules/@scalar/helpers/dist/object/prevent-pollution.js";
2
2
  import { getSegmentsFromPath } from "./get-segments-from-path.js";
3
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/set-value-at-path.js
3
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/set-value-at-path.js
4
4
  /**
5
5
  * Sets a value at a specified path in an object, creating intermediate objects/arrays as needed.
6
6
  * This function traverses the object structure and creates any missing intermediate objects
@@ -1,6 +1,6 @@
1
1
  import { isHttpUrl } from "./is-http-url.js";
2
2
  import { posix } from "../../../../../../pathe@2.0.3/node_modules/pathe/dist/index.js";
3
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js
3
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js
4
4
  /**
5
5
  * Converts an input path or URL to a relative path based on the provided base.
6
6
  * Handles both remote URLs and local file system paths.
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.5/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js
1
+ //#region ../../node_modules/.pnpm/@scalar+json-magic@0.12.8/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js
2
2
  /**
3
3
  * Unescape JSON pointer
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { traverse } from "../helpers/traverse.js";
2
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js
2
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.6/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js
3
3
  const DEFAULT_MEDIA_TYPE = "application/json";
4
4
  /** Extracts and removes x-example and x-examples extensions from an object */
5
5
  function extractXExampleExtensions(obj) {
@@ -1,5 +1,5 @@
1
1
  import { traverse } from "../helpers/traverse.js";
2
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js
2
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.6/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js
3
3
  const SCHEMA_SEGMENTS = new Set([
4
4
  "properties",
5
5
  "items",
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js
1
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.6/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js
2
2
  /**
3
3
  * Recursively migrate XML object properties from 3.1 to 3.2 format
4
4
  */
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js
1
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.6/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js
2
2
  /**
3
3
  * Recursively traverses the content and applies the transform function to each node.
4
4
  */
@@ -1,7 +1,7 @@
1
1
  import { upgradeFromThreeOneToThreeTwo } from "./3.1-to-3.2/upgrade-from-three-one-to-three-two.js";
2
2
  import { upgradeFromTwoToThree } from "./2.0-to-3.0/upgrade-from-two-to-three.js";
3
3
  import { upgradeFromThreeToThreeOne } from "./3.0-to-3.1/upgrade-from-three-to-three-one.js";
4
- //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/upgrade.js
4
+ //#region ../../node_modules/.pnpm/@scalar+openapi-upgrader@0.2.6/node_modules/@scalar/openapi-upgrader/dist/upgrade.js
5
5
  function upgrade(value, targetVersion) {
6
6
  const openapi30 = upgradeFromTwoToThree(value);
7
7
  if (targetVersion === "3.0") return openapi30;
@@ -39,6 +39,11 @@ function createNodeAnchors(doc, prefix) {
39
39
  prevAnchors.add(anchor);
40
40
  return anchor;
41
41
  },
42
+ /**
43
+ * With circular references, the source node is only resolved after all
44
+ * of its child nodes are. This is why anchors are set only after all of
45
+ * the nodes have been created.
46
+ */
42
47
  setAnchors: () => {
43
48
  for (const source of aliasObjects) {
44
49
  const ref = sourceObjects.get(source);
@@ -5,6 +5,14 @@ const binary = {
5
5
  identify: (value) => value instanceof Uint8Array,
6
6
  default: false,
7
7
  tag: "tag:yaml.org,2002:binary",
8
+ /**
9
+ * Returns a Buffer in node and an Uint8Array in browsers
10
+ *
11
+ * To use the resulting buffer as an image, you'll want to do something like:
12
+ *
13
+ * const blob = new Blob([buffer], { type: 'image/jpeg' })
14
+ * document.querySelector('#photo').src = URL.createObjectURL(blob)
15
+ */
8
16
  resolve(src, onError) {
9
17
  if (typeof atob === "function") {
10
18
  const str = atob(src.replace(/[\n\r]/g, ""));
@@ -55,7 +55,7 @@ interface PlaygroundClientOptions {
55
55
  /**
56
56
  * render the input for API endpoint body.
57
57
  *
58
- * @see renderParameterField for customisation tips
58
+ * @see renderParameterField for customization tips
59
59
  */
60
60
  renderBodyField?: (fieldName: 'body', info: RequestBodyInfo) => ReactNode;
61
61
  }
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { useTranslations } from "../../ui/client/i18n.js";
3
3
  import { cn } from "../../utils/cn.js";
4
- import { FormatFlags } from "../../utils/schema/to-string.js";
5
4
  import { anyFields, useFieldInfo, useResolvedSchema, useSchemaScope, useSchemaUtils } from "../schema.js";
6
5
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/components/select.js";
7
6
  import { Input, labelVariants } from "../../ui/components/input.js";
@@ -283,7 +282,7 @@ function FieldSet({ field: _field, fieldName, toolbar, name, isRequired, depth =
283
282
  children: union.map((item, i) => /* @__PURE__ */ jsx("option", {
284
283
  value: i,
285
284
  className: "bg-fd-popover text-fd-popover-foreground",
286
- children: schemaToString(item, FormatFlags.UseAlias)
285
+ children: schemaToString(item, 1)
287
286
  }, i))
288
287
  }), toolbar] })
289
288
  });
package/dist/ui/base.d.ts CHANGED
@@ -71,7 +71,7 @@ interface CreateAPIPageOptions {
71
71
  */
72
72
  mediaAdapters?: Record<string, MediaAdapter>;
73
73
  /**
74
- * Customise page content
74
+ * Customize page content
75
75
  */
76
76
  content?: {
77
77
  renderResponseTabs?: (tabs: ResponseTab[], ctx: RenderContext) => ReactNode;
@@ -133,7 +133,7 @@ interface CreateAPIPageOptions {
133
133
  showExample?: boolean;
134
134
  };
135
135
  /**
136
- * Customise API playground
136
+ * Customize API playground
137
137
  */
138
138
  playground?: {
139
139
  /**
@@ -10,7 +10,6 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
10
10
  const Dialog = DialogPrimitive.Root;
11
11
  const DialogTrigger = DialogPrimitive.Trigger;
12
12
  const DialogPortal = DialogPrimitive.Portal;
13
- DialogPrimitive.Close;
14
13
  const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
15
14
  ref,
16
15
  className: cn("fixed inset-0 z-50 bg-black/30 backdrop-blur-sm data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", className),
@@ -5,7 +5,6 @@ import { Check, ChevronDown, ChevronUp } from "lucide-react";
5
5
  import * as SelectPrimitive from "@radix-ui/react-select";
6
6
  //#region src/ui/components/select.tsx
7
7
  const Select = SelectPrimitive.Root;
8
- SelectPrimitive.Group;
9
8
  const SelectValue = SelectPrimitive.Value;
10
9
  const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
11
10
  ref,
@@ -1,6 +1,6 @@
1
1
  import { I18nLabel } from "../client/i18n.js";
2
2
  import { mergeAllOf } from "../../utils/schema/merge.js";
3
- import { FormatFlags, schemaToString } from "../../utils/schema/to-string.js";
3
+ import { schemaToString } from "../../utils/schema/to-string.js";
4
4
  import { useMemo } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/ui/schema/index.tsx
@@ -103,7 +103,7 @@ function generateSchemaUI(root, readOnly = false, writeOnly = false, ctx) {
103
103
  description: schema.description ? ctx.renderMarkdown(schema.description) : void 0,
104
104
  infoTags: generateInfoTags(schema),
105
105
  typeName: schemaToString(schema, ctx.schema),
106
- aliasName: schemaToString(schema, ctx.schema, FormatFlags.UseAlias),
106
+ aliasName: schemaToString(schema, ctx.schema, 1),
107
107
  deprecated: schema.deprecated
108
108
  };
109
109
  }
@@ -180,7 +180,7 @@ function generateSchemaUI(root, readOnly = false, writeOnly = false, ctx) {
180
180
  });
181
181
  out.items.push({
182
182
  $type: key,
183
- name: refs[itemId]?.aliasName ?? schemaToString(item, ctx.schema, FormatFlags.UseAlias)
183
+ name: refs[itemId]?.aliasName ?? schemaToString(item, ctx.schema, 1)
184
184
  });
185
185
  }
186
186
  return;
@@ -1,8 +1,8 @@
1
- import { bundle } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/bundle.js";
2
- import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.4/node_modules/@scalar/openapi-upgrader/dist/upgrade.js";
3
- import { fetchUrls } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js";
4
- import { readFiles } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js";
5
- import "../../node_modules/.pnpm/@scalar_json-magic@0.12.5/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js";
1
+ import { bundle } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/bundle.js";
2
+ import { upgrade } from "../../node_modules/.pnpm/@scalar_openapi-upgrader@0.2.6/node_modules/@scalar/openapi-upgrader/dist/upgrade.js";
3
+ import { fetchUrls } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js";
4
+ import { readFiles } from "../../node_modules/.pnpm/@scalar_json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js";
5
+ import "../../node_modules/.pnpm/@scalar_json-magic@0.12.8/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js";
6
6
  import { dereferenceDocument } from "./dereference.js";
7
7
  //#region src/utils/document/process.ts
8
8
  /**
@@ -9,7 +9,7 @@ interface PagesToTextOptions {
9
9
  from: string;
10
10
  }[];
11
11
  /**
12
- * Customise frontmatter.
12
+ * Customize frontmatter.
13
13
  *
14
14
  * A `full: true` property will be added by default.
15
15
  */
@@ -1,10 +1,5 @@
1
1
  //#region src/utils/schema/to-string.ts
2
- let FormatFlags = /* @__PURE__ */ function(FormatFlags) {
3
- FormatFlags[FormatFlags["None"] = 0] = "None";
4
- FormatFlags[FormatFlags["UseAlias"] = 1] = "UseAlias";
5
- return FormatFlags;
6
- }({});
7
- function schemaToString(value, _resolver, flags = FormatFlags.None) {
2
+ function schemaToString(value, _resolver, flags = 0) {
8
3
  const resolver = typeof _resolver === "function" ? _resolver : (schema) => {
9
4
  const ref = _resolver && typeof schema === "object" ? _resolver.getRawRef(schema) : void 0;
10
5
  return {
@@ -16,7 +11,7 @@ function schemaToString(value, _resolver, flags = FormatFlags.None) {
16
11
  const members = /* @__PURE__ */ new Set();
17
12
  let nullable = false;
18
13
  for (const item of union) {
19
- const result = run(item, flags | FormatFlags.UseAlias);
14
+ const result = run(item, flags | 1);
20
15
  if (result === "null") nullable = true;
21
16
  else if (result !== "unknown") members.add(result);
22
17
  }
@@ -27,7 +22,7 @@ function schemaToString(value, _resolver, flags = FormatFlags.None) {
27
22
  const { dereferenced: schema, raw } = resolver(input);
28
23
  if (schema === true) return "any";
29
24
  else if (schema === false) return "never";
30
- if ((flags & FormatFlags.UseAlias) === FormatFlags.UseAlias) {
25
+ if ((flags & 1) === 1) {
31
26
  if (schema.title) return schema.title;
32
27
  if (typeof raw === "object" && raw.$ref) {
33
28
  const ref = raw.$ref.split("/");
@@ -38,7 +33,7 @@ function schemaToString(value, _resolver, flags = FormatFlags.None) {
38
33
  ...schema,
39
34
  type
40
35
  })), " | ", flags);
41
- if (schema.type === "array") return `array<${schema.items ? run(schema.items, flags | FormatFlags.UseAlias) : "unknown"}>`;
36
+ if (schema.type === "array") return `array<${schema.items ? run(schema.items, flags | 1) : "unknown"}>`;
42
37
  const or = schema.oneOf ?? schema.anyOf;
43
38
  if (schema.oneOf && schema.anyOf) return `(${union(schema.oneOf, " | ", flags)}) & (${union(schema.anyOf, " | ", flags)})`;
44
39
  else if (or) return union(or, " | ", flags);
@@ -52,4 +47,4 @@ function schemaToString(value, _resolver, flags = FormatFlags.None) {
52
47
  return run(value, flags);
53
48
  }
54
49
  //#endregion
55
- export { FormatFlags, schemaToString };
50
+ export { schemaToString };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.7.1",
3
+ "version": "10.8.1",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -48,13 +48,13 @@
48
48
  "@radix-ui/react-dialog": "^1.1.15",
49
49
  "@radix-ui/react-select": "^2.2.6",
50
50
  "@radix-ui/react-slot": "^1.2.4",
51
- "ajv": "^8.18.0",
51
+ "ajv": "^8.20.0",
52
52
  "chokidar": "^5.0.0",
53
53
  "class-variance-authority": "^0.7.1",
54
54
  "github-slugger": "^2.0.0",
55
55
  "hast-util-to-jsx-runtime": "^2.3.6",
56
56
  "js-yaml": "^4.1.1",
57
- "lucide-react": "^1.8.0",
57
+ "lucide-react": "^1.11.0",
58
58
  "remark": "^15.0.1",
59
59
  "remark-rehype": "^11.1.2",
60
60
  "shiki": "^4.0.2",
@@ -64,23 +64,23 @@
64
64
  },
65
65
  "devDependencies": {
66
66
  "@fastify/deepmerge": "^3.2.1",
67
- "@scalar/api-client-react": "^2.0.1",
68
- "@scalar/json-magic": "^0.12.5",
69
- "@scalar/openapi-upgrader": "^0.2.4",
67
+ "@scalar/api-client-react": "2.0.1",
68
+ "@scalar/json-magic": "^0.12.8",
69
+ "@scalar/openapi-upgrader": "^0.2.6",
70
+ "@tailwindcss/oxide": "^4.2.4",
70
71
  "@types/js-yaml": "^4.0.9",
71
72
  "@types/node": "25.6.0",
72
73
  "@types/react": "^19.2.14",
73
74
  "fast-content-type-parse": "^3.0.0",
74
75
  "json-schema-typed": "^8.0.2",
75
- "tailwindcss": "^4.2.2",
76
- "tsdown": "0.21.8",
77
- "@fumadocs/tailwind": "0.0.5",
78
- "fumadocs-core": "16.7.16",
79
- "fumadocs-ui": "16.7.16",
76
+ "tailwindcss": "^4.2.4",
77
+ "tsdown": "0.21.10",
78
+ "fumadocs-core": "16.8.5",
79
+ "fumadocs-ui": "16.8.5",
80
80
  "tsconfig": "0.0.0"
81
81
  },
82
82
  "peerDependencies": {
83
- "@scalar/api-client-react": "2.x.x",
83
+ "@scalar/api-client-react": "2.0.1",
84
84
  "@types/react": "*",
85
85
  "fumadocs-core": "^16.7.15",
86
86
  "fumadocs-ui": "^16.7.15",
@@ -101,9 +101,9 @@
101
101
  },
102
102
  "inlinedDependencies": {
103
103
  "@fastify/deepmerge": "3.2.1",
104
- "@scalar/helpers": "0.4.3",
105
- "@scalar/json-magic": "0.12.5",
106
- "@scalar/openapi-upgrader": "0.2.4",
104
+ "@scalar/helpers": "0.5.2",
105
+ "@scalar/json-magic": "0.12.8",
106
+ "@scalar/openapi-upgrader": "0.2.6",
107
107
  "fast-content-type-parse": "3.0.0",
108
108
  "pathe": "2.0.3",
109
109
  "yaml": "2.8.3"