fumadocs-openapi 10.8.4 → 10.8.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 (138) hide show
  1. package/css/generated/shared.css +22 -1
  2. package/dist/generate-file.d.ts +1 -1
  3. package/dist/generate-file.js +1 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/general/create-limiter.js +1 -1
  6. package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/object/is-object.js +1 -1
  7. package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +1 -1
  8. package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/queue/queue.js +1 -1
  9. package/dist/node_modules/.pnpm/{@scalar_helpers@0.6.0 → @scalar_helpers@0.8.0}/node_modules/@scalar/helpers/dist/string/generate-hash.js +1 -1
  10. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/bundle.js +2 -2
  11. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/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.12 → @scalar_json-magic@0.12.14}/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.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +2 -2
  14. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/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.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +1 -1
  16. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +1 -1
  17. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/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.12 → @scalar_json-magic@0.12.14}/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.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +1 -1
  20. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +1 -1
  21. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +2 -2
  22. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +1 -1
  23. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/normalize.js +33 -0
  24. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +1 -1
  25. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/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.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +1 -1
  27. package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +1 -1
  28. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +110 -0
  29. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +138 -0
  30. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +674 -0
  31. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +141 -0
  32. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +102 -0
  33. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +223 -0
  34. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +28 -0
  35. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +18 -0
  36. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +133 -0
  37. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +61 -0
  38. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +146 -0
  39. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +23 -0
  40. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +48 -0
  41. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +172 -0
  42. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +31 -0
  43. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +433 -0
  44. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +113 -0
  45. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +72 -0
  46. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +583 -0
  47. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +18 -0
  48. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +42 -0
  49. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +50 -0
  50. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +20 -0
  51. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +51 -0
  52. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +16 -0
  53. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +36 -0
  54. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +19 -0
  55. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +85 -0
  56. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +59 -0
  57. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +12 -0
  58. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +25 -0
  59. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +12 -0
  60. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +16 -0
  61. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +57 -0
  62. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +96 -0
  63. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +29 -0
  64. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +16 -0
  65. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +89 -0
  66. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +87 -0
  67. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +16 -0
  68. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +62 -0
  69. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +60 -0
  70. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +59 -0
  71. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +34 -0
  72. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +31 -0
  73. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +51 -0
  74. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +61 -0
  75. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +17 -0
  76. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +52 -0
  77. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +41 -0
  78. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +17 -0
  79. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +130 -0
  80. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +14 -0
  81. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +22 -0
  82. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +112 -0
  83. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +101 -0
  84. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +14 -0
  85. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +35 -0
  86. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +46 -0
  87. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +45 -0
  88. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +22 -0
  89. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +20 -0
  90. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +15 -0
  91. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
  92. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +10 -0
  93. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +23 -0
  94. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +19 -0
  95. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +13 -0
  96. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +46 -0
  97. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +59 -0
  98. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +27 -0
  99. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +17 -0
  100. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +49 -0
  101. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +48 -0
  102. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +18 -0
  103. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +28 -0
  104. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +33 -0
  105. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +47 -0
  106. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +28 -0
  107. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +27 -0
  108. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +38 -0
  109. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +72 -0
  110. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +70 -0
  111. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +33 -0
  112. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +236 -0
  113. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +187 -0
  114. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +282 -0
  115. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +78 -0
  116. package/dist/playground/client.js +1 -1
  117. package/dist/playground/schema.d.ts +0 -2
  118. package/dist/playground/schema.js +3 -2
  119. package/dist/server/index.d.ts +108 -3
  120. package/dist/server/index.js +181 -2
  121. package/dist/server/proxy.d.ts +1 -1
  122. package/dist/types.d.ts +1 -1
  123. package/dist/ui/base.d.ts +1 -1
  124. package/dist/ui/components/method-label.js +1 -4
  125. package/dist/ui/index.d.ts +1 -1
  126. package/dist/utils/document/process.js +4 -4
  127. package/dist/utils/pages/builder.d.ts +4 -3
  128. package/dist/utils/pages/builder.js +20 -1
  129. package/dist/utils/pages/to-text.d.ts +1 -1
  130. package/dist/utils/pages/to-text.js +23 -42
  131. package/package.json +12 -8
  132. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.12/node_modules/@scalar/json-magic/dist/helpers/normalize.js +0 -26
  133. package/dist/server/create.d.ts +0 -40
  134. package/dist/server/create.js +0 -42
  135. package/dist/server/source-api.d.ts +0 -55
  136. package/dist/server/source-api.js +0 -149
  137. /package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +0 -0
  138. /package/dist/node_modules/.pnpm/{@scalar_json-magic@0.12.12 → @scalar_json-magic@0.12.14}/node_modules/@scalar/json-magic/dist/bundle/plugins/parse-yaml/index.js +0 -0
@@ -0,0 +1,282 @@
1
+ import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js
3
+ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ /** @type {(value: string) => boolean} */
5
+ const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
6
+ /** @type {(value: string) => boolean} */
7
+ const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
8
+ /**
9
+ * @param {Array<string>} input
10
+ * @returns {string}
11
+ */
12
+ function stringArrayToHexStripped(input) {
13
+ let acc = "";
14
+ let code = 0;
15
+ let i = 0;
16
+ for (i = 0; i < input.length; i++) {
17
+ code = input[i].charCodeAt(0);
18
+ if (code === 48) continue;
19
+ if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) return "";
20
+ acc += input[i];
21
+ break;
22
+ }
23
+ for (i += 1; i < input.length; i++) {
24
+ code = input[i].charCodeAt(0);
25
+ if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) return "";
26
+ acc += input[i];
27
+ }
28
+ return acc;
29
+ }
30
+ /**
31
+ * @typedef {Object} GetIPV6Result
32
+ * @property {boolean} error - Indicates if there was an error parsing the IPv6 address.
33
+ * @property {string} address - The parsed IPv6 address.
34
+ * @property {string} [zone] - The zone identifier, if present.
35
+ */
36
+ /**
37
+ * @param {string} value
38
+ * @returns {boolean}
39
+ */
40
+ const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
41
+ /**
42
+ * @param {Array<string>} buffer
43
+ * @returns {boolean}
44
+ */
45
+ function consumeIsZone(buffer) {
46
+ buffer.length = 0;
47
+ return true;
48
+ }
49
+ /**
50
+ * @param {Array<string>} buffer
51
+ * @param {Array<string>} address
52
+ * @param {GetIPV6Result} output
53
+ * @returns {boolean}
54
+ */
55
+ function consumeHextets(buffer, address, output) {
56
+ if (buffer.length) {
57
+ const hex = stringArrayToHexStripped(buffer);
58
+ if (hex !== "") address.push(hex);
59
+ else {
60
+ output.error = true;
61
+ return false;
62
+ }
63
+ buffer.length = 0;
64
+ }
65
+ return true;
66
+ }
67
+ /**
68
+ * @param {string} input
69
+ * @returns {GetIPV6Result}
70
+ */
71
+ function getIPV6(input) {
72
+ let tokenCount = 0;
73
+ const output = {
74
+ error: false,
75
+ address: "",
76
+ zone: ""
77
+ };
78
+ /** @type {Array<string>} */
79
+ const address = [];
80
+ /** @type {Array<string>} */
81
+ const buffer = [];
82
+ let endipv6Encountered = false;
83
+ let endIpv6 = false;
84
+ let consume = consumeHextets;
85
+ for (let i = 0; i < input.length; i++) {
86
+ const cursor = input[i];
87
+ if (cursor === "[" || cursor === "]") continue;
88
+ if (cursor === ":") {
89
+ if (endipv6Encountered === true) endIpv6 = true;
90
+ if (!consume(buffer, address, output)) break;
91
+ if (++tokenCount > 7) {
92
+ output.error = true;
93
+ break;
94
+ }
95
+ if (i > 0 && input[i - 1] === ":") endipv6Encountered = true;
96
+ address.push(":");
97
+ continue;
98
+ } else if (cursor === "%") {
99
+ if (!consume(buffer, address, output)) break;
100
+ consume = consumeIsZone;
101
+ } else {
102
+ buffer.push(cursor);
103
+ continue;
104
+ }
105
+ }
106
+ if (buffer.length) if (consume === consumeIsZone) output.zone = buffer.join("");
107
+ else if (endIpv6) address.push(buffer.join(""));
108
+ else address.push(stringArrayToHexStripped(buffer));
109
+ output.address = address.join("");
110
+ return output;
111
+ }
112
+ /**
113
+ * @typedef {Object} NormalizeIPv6Result
114
+ * @property {string} host - The normalized host.
115
+ * @property {string} [escapedHost] - The escaped host.
116
+ * @property {boolean} isIPV6 - Indicates if the host is an IPv6 address.
117
+ */
118
+ /**
119
+ * @param {string} host
120
+ * @returns {NormalizeIPv6Result}
121
+ */
122
+ function normalizeIPv6(host) {
123
+ if (findToken(host, ":") < 2) return {
124
+ host,
125
+ isIPV6: false
126
+ };
127
+ const ipv6 = getIPV6(host);
128
+ if (!ipv6.error) {
129
+ let newHost = ipv6.address;
130
+ let escapedHost = ipv6.address;
131
+ if (ipv6.zone) {
132
+ newHost += "%" + ipv6.zone;
133
+ escapedHost += "%25" + ipv6.zone;
134
+ }
135
+ return {
136
+ host: newHost,
137
+ isIPV6: true,
138
+ escapedHost
139
+ };
140
+ } else return {
141
+ host,
142
+ isIPV6: false
143
+ };
144
+ }
145
+ /**
146
+ * @param {string} str
147
+ * @param {string} token
148
+ * @returns {number}
149
+ */
150
+ function findToken(str, token) {
151
+ let ind = 0;
152
+ for (let i = 0; i < str.length; i++) if (str[i] === token) ind++;
153
+ return ind;
154
+ }
155
+ /**
156
+ * @param {string} path
157
+ * @returns {string}
158
+ *
159
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
160
+ */
161
+ function removeDotSegments(path) {
162
+ let input = path;
163
+ const output = [];
164
+ let nextSlash = -1;
165
+ let len = 0;
166
+ while (len = input.length) {
167
+ if (len === 1) if (input === ".") break;
168
+ else if (input === "/") {
169
+ output.push("/");
170
+ break;
171
+ } else {
172
+ output.push(input);
173
+ break;
174
+ }
175
+ else if (len === 2) {
176
+ if (input[0] === ".") {
177
+ if (input[1] === ".") break;
178
+ else if (input[1] === "/") {
179
+ input = input.slice(2);
180
+ continue;
181
+ }
182
+ } else if (input[0] === "/") {
183
+ if (input[1] === "." || input[1] === "/") {
184
+ output.push("/");
185
+ break;
186
+ }
187
+ }
188
+ } else if (len === 3) {
189
+ if (input === "/..") {
190
+ if (output.length !== 0) output.pop();
191
+ output.push("/");
192
+ break;
193
+ }
194
+ }
195
+ if (input[0] === ".") {
196
+ if (input[1] === ".") {
197
+ if (input[2] === "/") {
198
+ input = input.slice(3);
199
+ continue;
200
+ }
201
+ } else if (input[1] === "/") {
202
+ input = input.slice(2);
203
+ continue;
204
+ }
205
+ } else if (input[0] === "/") {
206
+ if (input[1] === ".") {
207
+ if (input[2] === "/") {
208
+ input = input.slice(2);
209
+ continue;
210
+ } else if (input[2] === ".") {
211
+ if (input[3] === "/") {
212
+ input = input.slice(3);
213
+ if (output.length !== 0) output.pop();
214
+ continue;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ if ((nextSlash = input.indexOf("/", 1)) === -1) {
220
+ output.push(input);
221
+ break;
222
+ } else {
223
+ output.push(input.slice(0, nextSlash));
224
+ input = input.slice(nextSlash);
225
+ }
226
+ }
227
+ return output.join("");
228
+ }
229
+ /**
230
+ * @param {import('../types/index').URIComponent} component
231
+ * @param {boolean} esc
232
+ * @returns {import('../types/index').URIComponent}
233
+ */
234
+ function normalizeComponentEncoding(component, esc) {
235
+ const func = esc !== true ? escape : unescape;
236
+ if (component.scheme !== void 0) component.scheme = func(component.scheme);
237
+ if (component.userinfo !== void 0) component.userinfo = func(component.userinfo);
238
+ if (component.host !== void 0) component.host = func(component.host);
239
+ if (component.path !== void 0) component.path = func(component.path);
240
+ if (component.query !== void 0) component.query = func(component.query);
241
+ if (component.fragment !== void 0) component.fragment = func(component.fragment);
242
+ return component;
243
+ }
244
+ /**
245
+ * @param {import('../types/index').URIComponent} component
246
+ * @returns {string|undefined}
247
+ */
248
+ function recomposeAuthority(component) {
249
+ const uriTokens = [];
250
+ if (component.userinfo !== void 0) {
251
+ uriTokens.push(component.userinfo);
252
+ uriTokens.push("@");
253
+ }
254
+ if (component.host !== void 0) {
255
+ let host = unescape(component.host);
256
+ if (!isIPv4(host)) {
257
+ const ipV6res = normalizeIPv6(host);
258
+ if (ipV6res.isIPV6 === true) host = `[${ipV6res.escapedHost}]`;
259
+ else host = component.host;
260
+ }
261
+ uriTokens.push(host);
262
+ }
263
+ if (typeof component.port === "number" || typeof component.port === "string") {
264
+ uriTokens.push(":");
265
+ uriTokens.push(String(component.port));
266
+ }
267
+ return uriTokens.length ? uriTokens.join("") : void 0;
268
+ }
269
+ module.exports = {
270
+ nonSimpleDomain,
271
+ recomposeAuthority,
272
+ normalizeComponentEncoding,
273
+ removeDotSegments,
274
+ isIPv4,
275
+ isUUID,
276
+ normalizeIPv6,
277
+ stringArrayToHexStripped
278
+ };
279
+ }));
280
+ //#endregion
281
+ export default require_utils();
282
+ export { require_utils };
@@ -0,0 +1,78 @@
1
+ import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js
3
+ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ var traverse = module.exports = function(schema, opts, cb) {
5
+ if (typeof opts == "function") {
6
+ cb = opts;
7
+ opts = {};
8
+ }
9
+ cb = opts.cb || cb;
10
+ var pre = typeof cb == "function" ? cb : cb.pre || function() {};
11
+ var post = cb.post || function() {};
12
+ _traverse(opts, pre, post, schema, "", schema);
13
+ };
14
+ traverse.keywords = {
15
+ additionalItems: true,
16
+ items: true,
17
+ contains: true,
18
+ additionalProperties: true,
19
+ propertyNames: true,
20
+ not: true,
21
+ if: true,
22
+ then: true,
23
+ else: true
24
+ };
25
+ traverse.arrayKeywords = {
26
+ items: true,
27
+ allOf: true,
28
+ anyOf: true,
29
+ oneOf: true
30
+ };
31
+ traverse.propsKeywords = {
32
+ $defs: true,
33
+ definitions: true,
34
+ properties: true,
35
+ patternProperties: true,
36
+ dependencies: true
37
+ };
38
+ traverse.skipKeywords = {
39
+ default: true,
40
+ enum: true,
41
+ const: true,
42
+ required: true,
43
+ maximum: true,
44
+ minimum: true,
45
+ exclusiveMaximum: true,
46
+ exclusiveMinimum: true,
47
+ multipleOf: true,
48
+ maxLength: true,
49
+ minLength: true,
50
+ pattern: true,
51
+ format: true,
52
+ maxItems: true,
53
+ minItems: true,
54
+ uniqueItems: true,
55
+ maxProperties: true,
56
+ minProperties: true
57
+ };
58
+ function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
59
+ if (schema && typeof schema == "object" && !Array.isArray(schema)) {
60
+ pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
61
+ for (var key in schema) {
62
+ var sch = schema[key];
63
+ if (Array.isArray(sch)) {
64
+ if (key in traverse.arrayKeywords) for (var i = 0; i < sch.length; i++) _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema, i);
65
+ } else if (key in traverse.propsKeywords) {
66
+ if (sch && typeof sch == "object") for (var prop in sch) _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
67
+ } else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema);
68
+ }
69
+ post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
70
+ }
71
+ }
72
+ function escapeJsonPtr(str) {
73
+ return str.replace(/~/g, "~0").replace(/\//g, "~1");
74
+ }
75
+ }));
76
+ //#endregion
77
+ export default require_json_schema_traverse();
78
+ export { require_json_schema_traverse };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { joinURL, resolveRequestData, resolveServerUrl, withBase } from "../utils/url.js";
3
2
  import { getPreferredType } from "../utils/schema/index.js";
3
+ import { joinURL, resolveRequestData, resolveServerUrl, withBase } from "../utils/url.js";
4
4
  import { useStorageKey } from "../ui/client/storage-key.js";
5
5
  import { useApiContext, useServerContext } from "../ui/contexts/api.js";
6
6
  import { useTranslations } from "../ui/client/i18n.js";
@@ -1,7 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- import { Ajv2020 } from "ajv/dist/2020.js";
3
2
  import { FieldKey } from "@fumari/stf";
4
-
5
3
  //#region src/playground/schema.d.ts
6
4
  interface SchemaScope {
7
5
  /**
@@ -1,13 +1,14 @@
1
+ import { require__2020 } from "../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js";
1
2
  import { mergeAllOf } from "../utils/schema/merge.js";
2
3
  import { sample } from "../utils/schema/sample.js";
3
4
  import { schemaToString } from "../utils/schema/to-string.js";
4
5
  import { dereferenceSwallow } from "../utils/schema/dereference.js";
5
6
  import { createContext, use, useMemo } from "react";
6
7
  import { jsx } from "react/jsx-runtime";
7
- import { Ajv2020 } from "ajv/dist/2020.js";
8
8
  import { useDataEngine, useFieldValue, useNamespace } from "@fumari/stf";
9
9
  import { stringifyFieldKey } from "@fumari/stf/lib/utils";
10
10
  //#region src/playground/schema.tsx
11
+ var import__2020 = require__2020();
11
12
  const SchemaContext = createContext(void 0);
12
13
  const anyFields = {
13
14
  type: [
@@ -21,7 +22,7 @@ const anyFields = {
21
22
  additionalProperties: true
22
23
  };
23
24
  function SchemaProvider({ doc, readOnly, writeOnly, children }) {
24
- const ajv = useMemo(() => new Ajv2020({
25
+ const ajv = useMemo(() => new import__2020.Ajv2020({
25
26
  strict: false,
26
27
  validateSchema: false,
27
28
  validateFormats: false
@@ -1,3 +1,108 @@
1
- import { OpenAPIOptions, OpenAPIServer, createCodeSample, createOpenAPI } from "./create.js";
2
- import { InternalOpenAPIMeta, OpenAPIPageData, OpenAPISourceOptions, openapiPlugin, openapiSource, transformerOpenAPI } from "./source-api.js";
3
- export { InternalOpenAPIMeta, OpenAPIOptions, OpenAPIPageData, OpenAPIServer, OpenAPISourceOptions, createCodeSample, createOpenAPI, openapiPlugin, openapiSource, transformerOpenAPI };
1
+ import { InlineCodeUsageGenerator } from "../requests/generators/index.js";
2
+ import { CreateProxyOptions, Proxy, createProxy } from "./proxy.js";
3
+ import { ProcessedDocument } from "../utils/document/process.js";
4
+ import { ApiPageProps } from "../ui/api-page.js";
5
+ import { ClientApiPageProps } from "../ui/create-client.js";
6
+ import { SchemaToPagesOptions } from "../utils/pages/preset-auto.js";
7
+ import { Document } from "../types.js";
8
+ import { DereferencedDocument } from "../utils/document/dereference.js";
9
+ import { DynamicSource, LoaderPlugin, MetaData, PageData, PageTreeTransformer, Source } from "fumadocs-core/source";
10
+ import { StructuredData } from "fumadocs-core/mdx-plugins/remark-structure";
11
+ import { TOCItemType } from "fumadocs-core/toc";
12
+
13
+ //#region src/server/index.d.ts
14
+ /**
15
+ * schema id -> file path, URL, or downloaded schema object
16
+ */
17
+ type SchemaMap = Record<string, string | Document>;
18
+ type ProcessedSchemaMap = Record<string, ProcessedDocument>;
19
+ interface OpenAPIOptions {
20
+ /**
21
+ * Schema files, can be:
22
+ * - URL
23
+ * - file path
24
+ * - a function returning records of downloaded schemas.
25
+ */
26
+ input?: string[] | (() => SchemaMap | Promise<SchemaMap>);
27
+ disableCache?: boolean;
28
+ /**
29
+ * The url of proxy to avoid CORS issues
30
+ */
31
+ proxyUrl?: string;
32
+ }
33
+ interface OpenAPIServer {
34
+ createProxy: typeof createProxy;
35
+ getSchemas: () => Promise<ProcessedSchemaMap>;
36
+ getSchema: (document: string) => Promise<ProcessedDocument>;
37
+ readonly options: OpenAPIOptions;
38
+ /**
39
+ * Generate virtual pages for Fumadocs Source API
40
+ */
41
+ staticSource: (options?: OpenAPISourceOptions) => Promise<Source<{
42
+ metaData: MetaData;
43
+ pageData: OpenAPIPageData;
44
+ }>>;
45
+ /**
46
+ * Generate virtual pages for Fumadocs Source API
47
+ */
48
+ dynamicSource: (options?: OpenAPISourceOptions) => DynamicSource<{
49
+ metaData: MetaData;
50
+ pageData: OpenAPIPageData;
51
+ }>;
52
+ /**
53
+ * Fumadocs Source API integration, pass this to `plugins` array in `loader()`.
54
+ */
55
+ loaderPlugin: () => LoaderPlugin;
56
+ /** @private internal API */
57
+ _getWatchPaths: () => string[];
58
+ }
59
+ interface OpenAPIPageData extends PageData {
60
+ getAPIPageProps: () => ApiPageProps;
61
+ getSchema: () => {
62
+ id: string;
63
+ } & DereferencedDocument;
64
+ getClientAPIPageProps: () => Promise<ClientApiPageProps>;
65
+ structuredData: StructuredData;
66
+ toc: TOCItemType[];
67
+ }
68
+ type OpenAPISourceOptions = SchemaToPagesOptions & {
69
+ baseDir?: string; /** Generate `meta.json` files */
70
+ meta?: boolean | {
71
+ folderStyle?: 'folder' | 'separator';
72
+ };
73
+ };
74
+ declare function createOpenAPI(options?: OpenAPIOptions): OpenAPIServer;
75
+ /**
76
+ * @deprecated
77
+ */
78
+ declare function createCodeSample<T>(options: InlineCodeUsageGenerator<T>): InlineCodeUsageGenerator<T>;
79
+ declare module 'fumadocs-core/source' {
80
+ interface PageData {
81
+ /**
82
+ * Added by Fumadocs OpenAPI
83
+ */
84
+ _openapi?: InternalOpenAPIMeta;
85
+ }
86
+ }
87
+ interface InternalOpenAPIMeta {
88
+ method?: string;
89
+ webhook?: boolean;
90
+ deprecated?: boolean;
91
+ }
92
+ /**
93
+ * Fumadocs Source API integration, pass this to `plugins` array in `loader()`.
94
+ */
95
+ declare function openapiPlugin(): LoaderPlugin;
96
+ /**
97
+ * Generate virtual pages for Fumadocs Source API
98
+ */
99
+ declare function openapiSource(server: OpenAPIServer, options?: OpenAPISourceOptions): Promise<Source<{
100
+ metaData: MetaData;
101
+ pageData: OpenAPIPageData;
102
+ }>>;
103
+ /**
104
+ * @deprecated use `openapiPlugin()`
105
+ */
106
+ declare function transformerOpenAPI(): PageTreeTransformer;
107
+ //#endregion
108
+ export { type CreateProxyOptions, InternalOpenAPIMeta, OpenAPIOptions, OpenAPIPageData, OpenAPIServer, OpenAPISourceOptions, type Proxy, createCodeSample, createOpenAPI, openapiPlugin, openapiSource, transformerOpenAPI };
@@ -1,3 +1,182 @@
1
- import { createCodeSample, createOpenAPI } from "./create.js";
2
- import { openapiPlugin, openapiSource, transformerOpenAPI } from "./source-api.js";
1
+ import { getPageProps } from "../utils/pages/builder.js";
2
+ import { toStaticData } from "../utils/pages/to-static-data.js";
3
+ import { MethodLabel } from "../ui/components/method-label.js";
4
+ import { createProxy } from "./proxy.js";
5
+ import { processDocument } from "../utils/document/process.js";
6
+ import path from "node:path";
7
+ import { PathUtils } from "fumadocs-core/source";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import fs from "node:fs";
10
+ //#region src/server/index.tsx
11
+ function createOpenAPI(options = {}) {
12
+ const { input = [], disableCache = false } = options;
13
+ let schemas;
14
+ async function getSchemas() {
15
+ if (Array.isArray(input)) {
16
+ const entries = await Promise.all(input.map(async (item) => [item, await processDocument(item)]));
17
+ return Object.fromEntries(entries);
18
+ } else {
19
+ const entries = await Promise.all(Object.entries(await input()).map(async ([k, v]) => [k, await processDocument(v)]));
20
+ return Object.fromEntries(entries);
21
+ }
22
+ }
23
+ async function getVirtualFiles(server, options) {
24
+ const { baseDir = "", meta = false } = options;
25
+ const { createAutoPreset } = await import("../utils/pages/preset-auto.js");
26
+ const { fromServer } = await import("../utils/pages/builder.js");
27
+ const files = [];
28
+ const entries = await fromServer(server, createAutoPreset(options));
29
+ for (const [schemaId, list] of Object.entries(entries)) {
30
+ const processed = await server.getSchema(schemaId);
31
+ function onEntry(entry) {
32
+ const props = getPageProps(entry);
33
+ files.push({
34
+ type: "page",
35
+ path: `${baseDir}/${entry.path}`,
36
+ data: {
37
+ ...entry.info,
38
+ getAPIPageProps() {
39
+ return props;
40
+ },
41
+ async getClientAPIPageProps() {
42
+ return {
43
+ payload: {
44
+ bundled: processed.bundled,
45
+ proxyUrl: server.options.proxyUrl
46
+ },
47
+ ...props
48
+ };
49
+ },
50
+ getSchema() {
51
+ return {
52
+ id: schemaId,
53
+ ...processed
54
+ };
55
+ },
56
+ ...toStaticData(props, processed.dereferenced),
57
+ _openapi: {
58
+ method: entry.type === "operation" || entry.type === "webhook" ? entry.item.method : void 0,
59
+ webhook: entry.type === "webhook",
60
+ deprecated: entry.info.deprecated
61
+ }
62
+ }
63
+ });
64
+ }
65
+ function onEntries(entries, parent) {
66
+ if (!meta) {
67
+ for (const entry of entries) if (entry.type === "group") onEntries(entry.entries, entry);
68
+ else onEntry(entry);
69
+ return;
70
+ }
71
+ const { folderStyle = "folder" } = meta === true ? {} : meta;
72
+ const pages = [];
73
+ for (const entry of entries) {
74
+ const relativePath = PathUtils.slash(parent ? path.relative(parent.path, entry.path) : entry.path);
75
+ if (entry.type === "group") {
76
+ onEntries(entry.entries, entry);
77
+ if (folderStyle === "folder") pages.push(relativePath);
78
+ else pages.push(`---${entry.info.title}---`, `...${relativePath}`);
79
+ } else {
80
+ onEntry(entry);
81
+ pages.push(relativePath.slice(0, -path.extname(entry.path).length));
82
+ }
83
+ }
84
+ if (pages.length === 0) return;
85
+ files.push({
86
+ type: "meta",
87
+ path: path.join(baseDir, parent?.path ?? "", "meta.json"),
88
+ data: {
89
+ title: parent?.info.title,
90
+ description: parent?.info.description,
91
+ pages
92
+ }
93
+ });
94
+ }
95
+ onEntries(list);
96
+ }
97
+ return files;
98
+ }
99
+ return {
100
+ options,
101
+ createProxy,
102
+ _getWatchPaths() {
103
+ return (Array.isArray(input) ? input : Object.keys(input)).filter((key) => !URL.canParse(key) && fs.existsSync(key));
104
+ },
105
+ async getSchema(document) {
106
+ const schemas = await this.getSchemas();
107
+ if (document in schemas) return schemas[document];
108
+ console.warn(`[Fumadocs OpenAPI] the document "${document}" is not listed in the input array, this may not be expected.`);
109
+ return processDocument(document);
110
+ },
111
+ async getSchemas() {
112
+ if (disableCache) return getSchemas();
113
+ return schemas ??= getSchemas();
114
+ },
115
+ async staticSource(options = {}) {
116
+ return { files: await getVirtualFiles(this, options) };
117
+ },
118
+ dynamicSource(options = {}) {
119
+ return { files: () => getVirtualFiles(this, options) };
120
+ },
121
+ loaderPlugin() {
122
+ return openapiPlugin();
123
+ }
124
+ };
125
+ }
126
+ /**
127
+ * @deprecated
128
+ */
129
+ function createCodeSample(options) {
130
+ return options;
131
+ }
132
+ /**
133
+ * Fumadocs Source API integration, pass this to `plugins` array in `loader()`.
134
+ */
135
+ function openapiPlugin() {
136
+ return {
137
+ name: "fumadocs:openapi",
138
+ enforce: "pre",
139
+ transformPageTree: { file(node, filePath) {
140
+ if (!filePath) return node;
141
+ const file = this.storage.read(filePath);
142
+ if (!file || file.format !== "page") return node;
143
+ const openApiData = file.data._openapi;
144
+ if (!openApiData || typeof openApiData !== "object") return node;
145
+ if (openApiData.deprecated) node.name = /* @__PURE__ */ jsx("span", {
146
+ className: "fd-page-tree-item-name line-through",
147
+ children: node.name
148
+ });
149
+ if (openApiData.webhook) node.name = /* @__PURE__ */ jsxs(Fragment, { children: [
150
+ node.name,
151
+ " ",
152
+ /* @__PURE__ */ jsx("span", {
153
+ className: "ms-auto border border-current px-1 rounded-lg text-xs text-nowrap font-mono",
154
+ children: "Webhook"
155
+ })
156
+ ] });
157
+ else if (openApiData.method) node.name = /* @__PURE__ */ jsxs(Fragment, { children: [
158
+ node.name,
159
+ " ",
160
+ /* @__PURE__ */ jsx(MethodLabel, {
161
+ className: "ms-auto text-xs text-nowrap",
162
+ children: openApiData.method
163
+ })
164
+ ] });
165
+ return node;
166
+ } }
167
+ };
168
+ }
169
+ /**
170
+ * Generate virtual pages for Fumadocs Source API
171
+ */
172
+ async function openapiSource(server, options = {}) {
173
+ return server.staticSource(options);
174
+ }
175
+ /**
176
+ * @deprecated use `openapiPlugin()`
177
+ */
178
+ function transformerOpenAPI() {
179
+ return openapiPlugin().transformPageTree;
180
+ }
181
+ //#endregion
3
182
  export { createCodeSample, createOpenAPI, openapiPlugin, openapiSource, transformerOpenAPI };