@fumadocs/api-docs 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
  2. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +2 -2
  3. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -1
  4. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +1 -1
  5. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
  6. package/dist/ref-parser/bundle.d.ts +10 -0
  7. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/bundle.js +76 -6
  8. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/normalize-args.js +1 -1
  9. package/dist/ref-parser/options.d.ts +28 -0
  10. package/dist/ref-parser/options.js +27 -0
  11. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parse.js +1 -1
  12. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/json.js +1 -1
  13. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/yaml.js +6 -12
  14. package/dist/ref-parser/pointer.d.ts +1 -0
  15. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/pointer.js +16 -54
  16. package/dist/ref-parser/ref.d.ts +1 -0
  17. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/ref.js +6 -48
  18. package/dist/ref-parser/refs.d.ts +1 -0
  19. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/refs.js +4 -41
  20. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolve-external.js +3 -3
  21. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolvers/file.js +1 -1
  22. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/types/index.d.ts +8 -40
  23. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/convert-path-to-posix.js +1 -1
  24. package/dist/ref-parser/util/errors.d.ts +1 -0
  25. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/errors.js +16 -34
  26. package/dist/ref-parser/util/is-windows.js +5 -0
  27. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/maybe.js +1 -1
  28. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/next.js +1 -1
  29. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/plugins.js +1 -1
  30. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/schema-resources.js +1 -1
  31. package/dist/ref-parser/util/url.js +206 -0
  32. package/dist/schema/bundle.d.ts +1 -1
  33. package/dist/schema/bundle.js +1 -1
  34. package/dist/schema/ref.d.ts +3 -1
  35. package/dist/schema/ref.js +1 -1
  36. package/dist/schema/sample.js +5 -7
  37. package/dist/utils/cn.js +1 -1
  38. package/dist/utils/deep-merge.js +8 -0
  39. package/package.json +8 -10
  40. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +0 -187
  41. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.d.ts +0 -157
  42. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +0 -136
  43. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.d.ts +0 -166
  44. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +0 -124
  45. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +0 -30
  46. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +0 -36
  47. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.d.ts +0 -96
  48. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts +0 -190
  49. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts +0 -134
  50. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +0 -121
  51. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts +0 -34
  52. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +0 -5
  53. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +0 -381
@@ -1,43 +1,11 @@
1
- import { ParserOptions } from "../options.js";
2
- import { $Refs } from "../refs.js";
3
- import { JSONSchema4, JSONSchema4Object, JSONSchema6, JSONSchema6Object, JSONSchema7, JSONSchema7Object } from "json-schema";
1
+ import { JSONSchema } from "json-schema-typed/draft-2020-12";
2
+ import { JSONSchema as JSONSchema$1 } from "json-schema-typed/draft-07";
4
3
 
5
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/types/index.d.ts
6
- type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
7
- type JSONSchemaObject = JSONSchema4Object | JSONSchema6Object | JSONSchema7Object;
8
- type SchemaCallback<S extends object = JSONSchema> = (err: Error | null, schema?: S | object | null) => any;
9
- type $RefsCallback<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> = (err: Error | null, $refs?: $Refs<S, O>) => any;
10
- /**
11
- * See https://apidevtools.com/json-schema-ref-parser/docs/options.html
12
- */
13
- interface HTTPResolverOptions<S extends object = JSONSchema> extends Partial<ResolverOptions<S>> {
14
- /**
15
- * You can specify any HTTP headers that should be sent when downloading files. For example, some servers may require you to set the `Accept` or `Referrer` header.
16
- */
17
- headers?: RequestInit["headers"] | null;
18
- /**
19
- * The amount of time (in milliseconds) to wait for a response from the server when downloading files. The default is 5 seconds.
20
- */
21
- timeout?: number;
22
- /**
23
- * The maximum number of HTTP redirects to follow per file. The default is 5. To disable automatic following of redirects, set this to zero.
24
- */
25
- redirects?: number;
26
- /**
27
- * Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication
28
- */
29
- withCredentials?: boolean;
30
- /**
31
- * Set this to `false` if you want to allow unsafe URLs (e.g., `127.0.0.1`, localhost, and other internal URLs).
32
- */
33
- safeUrlResolver?: boolean;
34
- }
35
- /**
36
- * JSON Schema `$Ref` Parser comes with built-in resolvers for HTTP and HTTPS URLs, as well as local filesystem paths (when running in Node.js). You can add your own custom resolvers to support additional protocols, or even replace any of the built-in resolvers with your own custom implementation.
37
- *
38
- * See https://apidevtools.com/json-schema-ref-parser/docs/plugins/resolvers.html
39
- */
40
- interface ResolverOptions<S extends object = JSONSchema> {
4
+ //#region src/ref-parser/types/index.d.ts
5
+ type JSONSchemaObject = Exclude<JSONSchema$1, boolean> | Exclude<JSONSchema, boolean>;
6
+ type JSONSchema$2 = JSONSchemaObject;
7
+ type SchemaCallback<S extends object = JSONSchema$2> = (err: Error | null, schema?: S | object | null) => any;
8
+ interface ResolverOptions<S extends object = JSONSchema$2> {
41
9
  name?: string;
42
10
  /**
43
11
  * All resolvers have an order property, even the built-in resolvers. If you don't specify an order property, then your resolver will run last. Specifying `order: 1`, like we did in this example, will make your resolver run first. Or you can squeeze your resolver in-between some of the built-in resolvers. For example, `order: 101` would make it run after the file resolver, but before the HTTP resolver. You can see the order of all the built-in resolvers by looking at their source code.
@@ -130,4 +98,4 @@ interface FileInfo {
130
98
  data: string | Buffer;
131
99
  }
132
100
  //#endregion
133
- export { $RefsCallback, FileInfo, HTTPResolverOptions, JSONSchema, JSONSchemaObject, Plugin, ResolverOptions, SchemaCallback };
101
+ export { JSONSchema$2 as JSONSchema, JSONSchemaObject, Plugin, ResolverOptions, SchemaCallback };
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js
1
+ //#region src/ref-parser/util/convert-path-to-posix.ts
2
2
  const win32Sep = "\\";
3
3
  function convertPathToPosix(filePath) {
4
4
  if (filePath.startsWith("\\\\?\\")) return filePath;
@@ -0,0 +1 @@
1
+ export { };
@@ -1,5 +1,5 @@
1
1
  import { getHash, stripHash, toFileSystemPath } from "./url.js";
2
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js
2
+ //#region src/ref-parser/util/errors.ts
3
3
  const nonJsonTypes = [
4
4
  "function",
5
5
  "symbol",
@@ -40,33 +40,27 @@ function getDeepKeys(obj, omit = []) {
40
40
  return uniqueKeys;
41
41
  }
42
42
  var JSONParserError = class extends Error {
43
- name;
44
- message;
45
- source;
46
- path;
47
- code;
48
43
  constructor(message, source) {
49
44
  super();
45
+ this.toJSON = toJSON.bind(this);
50
46
  this.code = "EUNKNOWN";
51
47
  this.name = "JSONParserError";
52
48
  this.message = message;
53
49
  this.source = source;
54
50
  this.path = null;
55
51
  }
56
- toJSON = toJSON.bind(this);
57
52
  get footprint() {
58
53
  return `${this.path}+${this.source}+${this.code}+${this.message}`;
59
54
  }
60
55
  };
61
56
  var JSONParserErrorGroup = class JSONParserErrorGroup extends Error {
62
- files;
63
57
  constructor(parser) {
64
58
  super();
59
+ this.toJSON = toJSON.bind(this);
65
60
  this.files = parser;
66
61
  this.name = "JSONParserErrorGroup";
67
62
  this.message = `${this.errors.length} error${this.errors.length > 1 ? "s" : ""} occurred while reading '${toFileSystemPath(parser.$refs._root$Ref.path)}'`;
68
63
  }
69
- toJSON = toJSON.bind(this);
70
64
  static getParserErrors(parser) {
71
65
  const errors = [];
72
66
  for (const $ref of Object.values(parser.$refs._$refs)) if ($ref.errors) errors.push(...$ref.errors);
@@ -77,62 +71,50 @@ var JSONParserErrorGroup = class JSONParserErrorGroup extends Error {
77
71
  }
78
72
  };
79
73
  var ParserError = class extends JSONParserError {
80
- code = "EPARSER";
81
- name = "ParserError";
82
74
  constructor(message, source) {
83
75
  super(`Error parsing ${source}: ${message}`, source);
76
+ this.code = "EPARSER";
77
+ this.name = "ParserError";
84
78
  }
85
79
  };
86
80
  var UnmatchedParserError = class extends JSONParserError {
87
- code = "EUNMATCHEDPARSER";
88
- name = "UnmatchedParserError";
89
81
  constructor(source) {
90
82
  super(`Could not find parser for "${source}"`, source);
83
+ this.code = "EUNMATCHEDPARSER";
84
+ this.name = "UnmatchedParserError";
91
85
  }
92
86
  };
93
87
  var ResolverError = class extends JSONParserError {
94
- code = "ERESOLVER";
95
- name = "ResolverError";
96
- ioErrorCode;
97
88
  constructor(ex, source) {
98
89
  super(ex.message || `Error reading file "${source}"`, source);
90
+ this.code = "ERESOLVER";
91
+ this.name = "ResolverError";
99
92
  if ("code" in ex) this.ioErrorCode = String(ex.code);
100
93
  }
101
94
  };
102
95
  var UnmatchedResolverError = class extends JSONParserError {
103
- code = "EUNMATCHEDRESOLVER";
104
- name = "UnmatchedResolverError";
105
96
  constructor(source) {
106
97
  super(`Could not find resolver for "${source}"`, source);
98
+ this.code = "EUNMATCHEDRESOLVER";
99
+ this.name = "UnmatchedResolverError";
107
100
  }
108
101
  };
109
102
  var MissingPointerError = class extends JSONParserError {
110
- code = "EMISSINGPOINTER";
111
- name = "MissingPointerError";
112
- targetToken;
113
- targetRef;
114
- targetFound;
115
- parentPath;
116
103
  constructor(token, path, targetRef, targetFound, parentPath) {
117
104
  super(`Missing $ref pointer "${getHash(path)}". Token "${token}" does not exist.`, stripHash(path));
105
+ this.code = "EMISSINGPOINTER";
106
+ this.name = "MissingPointerError";
118
107
  this.targetToken = token;
119
108
  this.targetRef = targetRef;
120
109
  this.targetFound = targetFound;
121
110
  this.parentPath = parentPath;
122
111
  }
123
112
  };
124
- var TimeoutError = class extends JSONParserError {
125
- code = "ETIMEOUT";
126
- name = "TimeoutError";
127
- constructor(timeout) {
128
- super(`Dereferencing timeout reached: ${timeout}ms`);
129
- }
130
- };
131
113
  var InvalidPointerError = class extends JSONParserError {
132
- code = "EUNMATCHEDRESOLVER";
133
- name = "InvalidPointerError";
134
114
  constructor(pointer, path) {
135
115
  super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(path));
116
+ this.code = "EUNMATCHEDRESOLVER";
117
+ this.name = "InvalidPointerError";
136
118
  }
137
119
  };
138
120
  function isHandledError(err) {
@@ -143,4 +125,4 @@ function normalizeError(err) {
143
125
  return err;
144
126
  }
145
127
  //#endregion
146
- export { InvalidPointerError, JSONParserError, JSONParserErrorGroup, MissingPointerError, ParserError, ResolverError, TimeoutError, UnmatchedParserError, UnmatchedResolverError, isHandledError, normalizeError };
128
+ export { InvalidPointerError, JSONParserError, JSONParserErrorGroup, MissingPointerError, ParserError, ResolverError, UnmatchedParserError, UnmatchedResolverError, isHandledError, normalizeError };
@@ -0,0 +1,5 @@
1
+ //#region src/ref-parser/util/is-windows.ts
2
+ const isWindowsConst = /^win/.test(globalThis.process ? globalThis.process.platform : "");
3
+ const isWindows = () => isWindowsConst;
4
+ //#endregion
5
+ export { isWindows };
@@ -1,5 +1,5 @@
1
1
  import next_default from "./next.js";
2
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js
2
+ //#region src/ref-parser/util/maybe.ts
3
3
  function maybe(cb, promise) {
4
4
  if (cb) {
5
5
  promise.then(function(result) {
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js
1
+ //#region src/ref-parser/util/next.ts
2
2
  function makeNext() {
3
3
  if (typeof process === "object" && typeof process.nextTick === "function") return process.nextTick;
4
4
  else if (typeof setImmediate === "function") return setImmediate;
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js
1
+ //#region src/ref-parser/util/plugins.ts
2
2
  /**
3
3
  * Returns the given plugins as an array, rather than an object map.
4
4
  * All other methods in this module expect an array of plugins rather than an object map.
@@ -1,5 +1,5 @@
1
1
  import { resolve } from "./url.js";
2
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js
2
+ //#region src/ref-parser/util/schema-resources.ts
3
3
  function getSchemaBasePath(basePath, value) {
4
4
  const schemaId = getSchemaId(value);
5
5
  return schemaId ? resolve(basePath, schemaId) : basePath;
@@ -0,0 +1,206 @@
1
+ import convertPathToPosix from "./convert-path-to-posix.js";
2
+ import { decodeInternalRef } from "../../schema/ref.js";
3
+ import { isWindows } from "./is-windows.js";
4
+ //#region src/ref-parser/util/url.ts
5
+ const forwardSlashPattern = /\//g;
6
+ const protocolPattern = /^(\w{2,}):\/\//i;
7
+ const isAbsoluteWin32Path = /^[a-zA-Z]:[\\/]/;
8
+ const urlEncodePatterns = [[/\?/g, "%3F"], [/#/g, "%23"]];
9
+ const urlDecodePatterns = [
10
+ /%23/g,
11
+ "#",
12
+ /%24/g,
13
+ "$",
14
+ /%26/g,
15
+ "&",
16
+ /%2C/g,
17
+ ",",
18
+ /%40/g,
19
+ "@"
20
+ ];
21
+ /**
22
+ * Returns resolved target URL relative to a base URL in a manner similar to that of a Web browser resolving an anchor tag HREF.
23
+ *
24
+ * @returns
25
+ */
26
+ function resolve(from, to) {
27
+ const fromUrl = new URL(convertPathToPosix(from), "https://aaa.nonexistanturl.com");
28
+ const resolvedUrl = new URL(convertPathToPosix(to), fromUrl);
29
+ const endSpaces = to.match(/(\s*)$/)?.[1] || "";
30
+ if (resolvedUrl.hostname === "aaa.nonexistanturl.com") {
31
+ const { pathname, search, hash } = resolvedUrl;
32
+ return pathname + search + decodeURIComponent(hash) + endSpaces;
33
+ }
34
+ const resolved = resolvedUrl.toString() + endSpaces;
35
+ if (resolved.includes("#")) {
36
+ const [base, hash] = resolved.split("#", 2);
37
+ return base + "#" + decodeURIComponent(hash || "");
38
+ }
39
+ return resolved;
40
+ }
41
+ /**
42
+ * Returns the current working directory (in Node) or the current page URL (in browsers).
43
+ *
44
+ * @returns
45
+ */
46
+ function cwd() {
47
+ if (typeof window !== "undefined" && window.location && window.location.href) {
48
+ const href = window.location.href;
49
+ if (!href || !href.startsWith("http")) try {
50
+ new URL(href);
51
+ return href;
52
+ } catch {
53
+ return "/";
54
+ }
55
+ return href;
56
+ }
57
+ if (typeof process !== "undefined" && process.cwd) {
58
+ const path = process.cwd();
59
+ const lastChar = path.slice(-1);
60
+ if (lastChar === "/" || lastChar === "\\") return path;
61
+ else return path + "/";
62
+ }
63
+ return "/";
64
+ }
65
+ /**
66
+ * Returns the protocol of the given URL, or `undefined` if it has no protocol.
67
+ *
68
+ * @param path
69
+ * @returns
70
+ */
71
+ function getProtocol(path) {
72
+ const match = protocolPattern.exec(path || "");
73
+ if (match) return match[1].toLowerCase();
74
+ }
75
+ /**
76
+ * Returns the lowercased file extension of the given URL,
77
+ * or an empty string if it has no extension.
78
+ *
79
+ * @param path
80
+ * @returns
81
+ */
82
+ function getExtension(path) {
83
+ const lastDot = path.lastIndexOf(".");
84
+ if (lastDot >= 0) return stripQuery(path.substring(lastDot).toLowerCase());
85
+ return "";
86
+ }
87
+ /**
88
+ * Removes the query, if any, from the given path.
89
+ *
90
+ * @param path
91
+ * @returns
92
+ */
93
+ function stripQuery(path) {
94
+ const queryIndex = path.indexOf("?");
95
+ if (queryIndex >= 0) path = path.substring(0, queryIndex);
96
+ return path;
97
+ }
98
+ /**
99
+ * Returns the hash (URL fragment), of the given path.
100
+ * If there is no hash, then the root hash ("#") is returned.
101
+ *
102
+ * @param path
103
+ * @returns
104
+ */
105
+ function getHash(path) {
106
+ if (!path) return "#";
107
+ const hashIndex = path.indexOf("#");
108
+ if (hashIndex >= 0) return path.substring(hashIndex);
109
+ return "#";
110
+ }
111
+ /**
112
+ * Removes the hash (URL fragment), if any, from the given path.
113
+ *
114
+ * @param path
115
+ * @returns
116
+ */
117
+ function stripHash(path) {
118
+ if (!path) return "";
119
+ const hashIndex = path.indexOf("#");
120
+ if (hashIndex >= 0) path = path.substring(0, hashIndex);
121
+ return path;
122
+ }
123
+ /**
124
+ * Determines whether the given path is a filesystem path.
125
+ * This includes "file://" URLs.
126
+ *
127
+ * @param path
128
+ * @returns
129
+ */
130
+ function isFileSystemPath(path) {
131
+ if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) return false;
132
+ const protocol = getProtocol(path);
133
+ return protocol === void 0 || protocol === "file";
134
+ }
135
+ /**
136
+ * Converts a filesystem path to a properly-encoded URL.
137
+ *
138
+ * This is intended to handle situations where JSON Schema $Ref Parser is called
139
+ * with a filesystem path that contains characters which are not allowed in URLs.
140
+ *
141
+ * @example
142
+ * The following filesystem paths would be converted to the following URLs:
143
+ *
144
+ * <"!@#$%^&*+=?'>.json ==> %3C%22!@%23$%25%5E&*+=%3F\'%3E.json
145
+ * C:\\My Documents\\File (1).json ==> C:/My%20Documents/File%20(1).json
146
+ * file://Project #42/file.json ==> file://Project%20%2342/file.json
147
+ *
148
+ * @param path
149
+ * @returns
150
+ */
151
+ function fromFileSystemPath(path) {
152
+ if (isWindows()) {
153
+ const projectDir = cwd();
154
+ const upperPath = path.toUpperCase();
155
+ const posixUpper = convertPathToPosix(projectDir).toUpperCase();
156
+ const hasProjectDir = upperPath.includes(posixUpper);
157
+ const hasProjectUri = upperPath.includes(posixUpper);
158
+ const isAbsolutePath = isAbsoluteWin32Path.test(path) || path.startsWith("http://") || path.startsWith("https://") || path.startsWith("file://");
159
+ if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
160
+ const join = (a, b) => {
161
+ if (a.endsWith("/") || a.endsWith("\\")) return a + b;
162
+ else return a + "/" + b;
163
+ };
164
+ path = join(projectDir, path);
165
+ }
166
+ path = convertPathToPosix(path);
167
+ }
168
+ path = encodeURI(path);
169
+ for (const pattern of urlEncodePatterns) path = path.replace(pattern[0], pattern[1]);
170
+ return path;
171
+ }
172
+ /**
173
+ * Converts a URL to a local filesystem path.
174
+ */
175
+ function toFileSystemPath(path, keepFileProtocol) {
176
+ path = path.replace(/%(?![0-9A-Fa-f]{2})/g, "%25");
177
+ path = decodeURI(path);
178
+ for (let i = 0; i < urlDecodePatterns.length; i += 2) path = path.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);
179
+ let isFileUrl = path.toLowerCase().startsWith("file://");
180
+ if (isFileUrl) {
181
+ path = path.replace(/^file:\/\//, "").replace(/^\//, "");
182
+ if (isWindows() && path[1] === "/") path = `${path[0]}:${path.substring(1)}`;
183
+ if (keepFileProtocol) path = "file:///" + path;
184
+ else {
185
+ isFileUrl = false;
186
+ path = isWindows() ? path : "/" + path;
187
+ }
188
+ }
189
+ if (isWindows() && !isFileUrl) {
190
+ path = path.replace(forwardSlashPattern, "\\");
191
+ if (path.match(/^[a-z]:\\/i)) path = path[0].toUpperCase() + path.substring(1);
192
+ }
193
+ return path;
194
+ }
195
+ /**
196
+ * Converts a $ref pointer to a valid JSON Path.
197
+ *
198
+ * @param pointer
199
+ * @returns
200
+ */
201
+ function safePointerToPath(pointer) {
202
+ if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") return [];
203
+ return decodeInternalRef(pointer);
204
+ }
205
+ //#endregion
206
+ export { cwd, fromFileSystemPath, getExtension, getHash, isFileSystemPath, resolve, safePointerToPath, stripHash, toFileSystemPath };
@@ -1,2 +1,2 @@
1
- import { bundle } from "../node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js";
1
+ import { bundle } from "../ref-parser/bundle.js";
2
2
  export { bundle };
@@ -1,2 +1,2 @@
1
- import { bundle } from "../node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js";
1
+ import { bundle } from "../ref-parser/bundle.js";
2
2
  export { bundle };
@@ -4,6 +4,8 @@
4
4
  *
5
5
  * @see https://datatracker.ietf.org/doc/html/rfc6901
6
6
  */
7
+ declare function encodeSegment(segment: string): string;
8
+ declare function decodeSegment(segment: string): string;
7
9
  /**
8
10
  * Build an in-document `$ref` string from logical path segments (e.g. `['components','schemas','Pet']` → `#/components/schemas/Pet`).
9
11
  */
@@ -17,4 +19,4 @@ declare function appendInternalRefPath(base: string, segment: string | number):
17
19
  */
18
20
  declare function decodeInternalRef(ref: string): string[];
19
21
  //#endregion
20
- export { appendInternalRefPath, decodeInternalRef, encodeInternalRef };
22
+ export { appendInternalRefPath, decodeInternalRef, decodeSegment, encodeInternalRef, encodeSegment };
@@ -40,4 +40,4 @@ function decodeInternalRef(ref) {
40
40
  return out;
41
41
  }
42
42
  //#endregion
43
- export { appendInternalRefPath, decodeInternalRef, encodeInternalRef };
43
+ export { appendInternalRefPath, decodeInternalRef, decodeSegment, encodeInternalRef, encodeSegment };
@@ -1,12 +1,10 @@
1
1
  import { isPlainObject } from "../utils/is-plain-object.js";
2
+ import { mergeDeep } from "../utils/deep-merge.js";
2
3
  import { resolveRefSync } from "./resolve-ref.js";
3
- import { require_deepmerge } from "../node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js";
4
- const mergeDeep = (0, require_deepmerge().deepmerge)({
5
- all: true,
6
- isMergeableObject(value) {
7
- return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof RegExp) && !(value instanceof Date);
8
- }
9
- });
4
+ //#region src/schema/sample.ts
5
+ /**
6
+ * inspired by https://github.com/Redocly/openapi-sampler (MIT)
7
+ */
10
8
  const SKIP = Symbol("skip");
11
9
  const defaultOptions = {
12
10
  skipReadOnly: false,
package/dist/utils/cn.js CHANGED
@@ -1,2 +1,2 @@
1
- import { twMerge as cn } from "tailwind-merge";
1
+ import { cn } from "cnfast";
2
2
  export { cn };
@@ -0,0 +1,8 @@
1
+ import { require_deepmerge } from "../node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js";
2
+ import { isPlainObject } from "./is-plain-object.js";
3
+ const mergeDeep = (0, require_deepmerge().deepmerge)({
4
+ all: true,
5
+ isMergeableObject: isPlainObject
6
+ });
7
+ //#endregion
8
+ export { mergeDeep };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fumadocs/api-docs",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Shared utils for API docs generation",
5
5
  "keywords": [
6
6
  "Docs",
@@ -55,24 +55,23 @@
55
55
  "@radix-ui/react-dialog": "^1.1.17",
56
56
  "@radix-ui/react-select": "^2.3.1",
57
57
  "class-variance-authority": "^0.7.1",
58
+ "cnfast": "^0.0.8",
58
59
  "github-slugger": "^2.0.0",
59
- "js-yaml": "^4.2.0",
60
- "lucide-react": "^1.20.0",
61
- "tailwind-merge": "^3.6.0",
60
+ "js-yaml": "^5.1.0",
61
+ "lucide-react": "^1.21.0",
62
62
  "@fumari/stf": "1.0.5"
63
63
  },
64
64
  "devDependencies": {
65
- "@apidevtools/json-schema-ref-parser": "^15.3.6",
66
65
  "@fastify/deepmerge": "^3.2.1",
67
66
  "@tailwindcss/oxide": "^4.3.1",
68
- "@types/node": "25.9.3",
67
+ "@types/node": "26.0.0",
69
68
  "@types/react": "^19.2.17",
70
69
  "ajv": "^8.20.0",
71
70
  "json-schema-typed": "^8.0.2",
72
71
  "tsdown": "0.22.3",
73
- "fumadocs-ui": "16.10.5",
74
- "fumadocs-core": "16.10.5",
75
- "tsconfig": "0.0.0"
72
+ "tsconfig": "0.0.0",
73
+ "fumadocs-core": "16.10.6",
74
+ "fumadocs-ui": "16.10.6"
76
75
  },
77
76
  "peerDependencies": {
78
77
  "@types/react": "*",
@@ -91,7 +90,6 @@
91
90
  }
92
91
  },
93
92
  "inlinedDependencies": {
94
- "@apidevtools/json-schema-ref-parser": "15.3.6",
95
93
  "@fastify/deepmerge": "3.2.1",
96
94
  "ajv": "8.20.0",
97
95
  "fast-deep-equal": "3.1.3",