@fumadocs/api-docs 0.0.2 → 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 (58) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/dist/components/schema/client.d.ts +16 -1
  3. package/dist/components/schema/client.js +17 -12
  4. package/dist/components/schema/index.d.ts +13 -20
  5. package/dist/components/schema/index.js +82 -60
  6. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
  7. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +2 -2
  8. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -1
  9. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +1 -1
  10. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
  11. package/dist/ref-parser/bundle.d.ts +10 -0
  12. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/bundle.js +76 -6
  13. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/normalize-args.js +1 -1
  14. package/dist/ref-parser/options.d.ts +28 -0
  15. package/dist/ref-parser/options.js +27 -0
  16. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parse.js +1 -1
  17. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/json.js +1 -1
  18. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/yaml.js +6 -12
  19. package/dist/ref-parser/pointer.d.ts +1 -0
  20. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/pointer.js +24 -53
  21. package/dist/ref-parser/ref.d.ts +1 -0
  22. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/ref.js +6 -48
  23. package/dist/ref-parser/refs.d.ts +1 -0
  24. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/refs.js +4 -41
  25. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolve-external.js +3 -3
  26. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolvers/file.js +1 -1
  27. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/types/index.d.ts +8 -40
  28. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@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
  29. package/dist/ref-parser/util/errors.d.ts +1 -0
  30. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/errors.js +16 -34
  31. package/dist/ref-parser/util/is-windows.js +5 -0
  32. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/maybe.js +1 -1
  33. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/next.js +1 -1
  34. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/plugins.js +1 -1
  35. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/schema-resources.js +1 -1
  36. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/url.js +4 -113
  37. package/dist/schema/bundle.d.ts +1 -1
  38. package/dist/schema/bundle.js +1 -1
  39. package/dist/schema/ref.d.ts +3 -1
  40. package/dist/schema/ref.js +1 -1
  41. package/dist/schema/sample.js +5 -7
  42. package/dist/schema/to-string.js +6 -0
  43. package/dist/utils/cn.js +1 -1
  44. package/dist/utils/deep-merge.js +8 -0
  45. package/package.json +18 -17
  46. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +0 -187
  47. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.d.ts +0 -157
  48. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +0 -136
  49. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.d.ts +0 -166
  50. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +0 -124
  51. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +0 -30
  52. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +0 -36
  53. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.d.ts +0 -96
  54. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts +0 -190
  55. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts +0 -134
  56. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +0 -112
  57. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts +0 -34
  58. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +0 -5
@@ -1,190 +0,0 @@
1
- import { JSONSchema } from "./types/index.js";
2
- import { ParserOptions } from "./options.js";
3
- import { JSONParserError, MissingPointerError, ParserError, ResolverError } from "./util/errors.js";
4
- import { Pointer } from "./pointer.js";
5
- import { $Refs } from "./refs.js";
6
- import { JSONSchema4Type, JSONSchema6Type, JSONSchema7Type } from "json-schema";
7
-
8
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts
9
- type $RefError = JSONParserError | ResolverError | ParserError | MissingPointerError;
10
- /**
11
- * This class represents a single JSON reference and its resolved value.
12
- *
13
- * @class
14
- */
15
- declare class $Ref<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
16
- /**
17
- * The file path or URL of the referenced file.
18
- * This path is relative to the path of the main JSON schema file.
19
- *
20
- * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file.
21
- * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get
22
- * specific JSON pointers within the file.
23
- *
24
- * @type {string}
25
- */
26
- path: undefined | string;
27
- /**
28
- * The resolved value of the JSON reference.
29
- * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
30
- *
31
- * @type {?*}
32
- */
33
- value: any;
34
- /**
35
- * The {@link $Refs} object that contains this {@link $Ref} object.
36
- *
37
- * @type {$Refs}
38
- */
39
- $refs: $Refs<S, O>;
40
- /**
41
- * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.)
42
- */
43
- pathType: string | unknown;
44
- /**
45
- * Whether this document/resource should use JSON Schema 2019-09+ nested $id scope semantics.
46
- */
47
- dynamicIdScope: boolean;
48
- /**
49
- * List of all errors. Undefined if no errors.
50
- */
51
- errors: Array<$RefError>;
52
- constructor($refs: $Refs<S, O>);
53
- /**
54
- * Pushes an error to errors array.
55
- *
56
- * @param err - The error to be pushed
57
- * @returns
58
- */
59
- addError(err: $RefError): void;
60
- /**
61
- * Determines whether the given JSON reference exists within this {@link $Ref#value}.
62
- *
63
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
64
- * @param options
65
- * @returns
66
- */
67
- exists(path: string, options?: O): boolean;
68
- /**
69
- * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value.
70
- *
71
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
72
- * @param options
73
- * @returns - Returns the resolved value
74
- */
75
- get(path: string, options?: O): any;
76
- /**
77
- * Resolves the given JSON reference within this {@link $Ref#value}.
78
- *
79
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
80
- * @param options
81
- * @param friendlyPath - The original user-specified path (used for error messages)
82
- * @param pathFromRoot - The path of `obj` from the schema root
83
- * @returns
84
- */
85
- resolve(path: string, options?: O, friendlyPath?: string, pathFromRoot?: string): Pointer<S, O> | null;
86
- /**
87
- * Sets the value of a nested property within this {@link $Ref#value}.
88
- * If the property, or any of its parents don't exist, they will be created.
89
- *
90
- * @param path - The full path of the property to set, optionally with a JSON pointer in the hash
91
- * @param value - The value to assign
92
- */
93
- set(path: string, value: JSONSchema4Type | JSONSchema6Type | JSONSchema7Type): void;
94
- /**
95
- * Determines whether the given value is a JSON reference.
96
- *
97
- * @param value - The value to inspect
98
- * @returns
99
- */
100
- static is$Ref(value: unknown): value is {
101
- $ref: string;
102
- length?: number;
103
- };
104
- /**
105
- * Determines whether the given value is an external JSON reference.
106
- *
107
- * @param value - The value to inspect
108
- * @returns
109
- */
110
- static isExternal$Ref(value: unknown): boolean;
111
- /**
112
- * Determines whether the given value is a JSON reference, and whether it is allowed by the options.
113
- * For example, if it references an external file, then options.resolve.external must be true.
114
- *
115
- * @param value - The value to inspect
116
- * @param options
117
- * @returns
118
- */
119
- static isAllowed$Ref<S extends object = JSONSchema>(value: unknown, options?: ParserOptions<S>): true | undefined;
120
- /**
121
- * Determines whether the given value is a JSON reference that "extends" its resolved value.
122
- * That is, it has extra properties (in addition to "$ref"), so rather than simply pointing to
123
- * an existing value, this $ref actually creates a NEW value that is a shallow copy of the resolved
124
- * value, plus the extra properties.
125
- *
126
- * @example: {
127
- person: {
128
- properties: {
129
- firstName: { type: string }
130
- lastName: { type: string }
131
- }
132
- }
133
- employee: {
134
- properties: {
135
- $ref: #/person/properties
136
- salary: { type: number }
137
- }
138
- }
139
- }
140
- * In this example, "employee" is an extended $ref, since it extends "person" with an additional
141
- * property (salary). The result is a NEW value that looks like this:
142
- *
143
- * {
144
- * properties: {
145
- * firstName: { type: string }
146
- * lastName: { type: string }
147
- * salary: { type: number }
148
- * }
149
- * }
150
- *
151
- * @param value - The value to inspect
152
- * @returns
153
- */
154
- static isExtended$Ref(value: unknown): boolean;
155
- /**
156
- * Returns the resolved value of a JSON Reference.
157
- * If necessary, the resolved value is merged with the JSON Reference to create a new object
158
- *
159
- * @example: {
160
- person: {
161
- properties: {
162
- firstName: { type: string }
163
- lastName: { type: string }
164
- }
165
- }
166
- employee: {
167
- properties: {
168
- $ref: #/person/properties
169
- salary: { type: number }
170
- }
171
- }
172
- } When "person" and "employee" are merged, you end up with the following object:
173
- *
174
- * {
175
- * properties: {
176
- * firstName: { type: string }
177
- * lastName: { type: string }
178
- * salary: { type: number }
179
- * }
180
- * }
181
- *
182
- * @param $ref - The JSON reference object (the one with the "$ref" property)
183
- * @param resolvedValue - The resolved value, which can be any type
184
- * @param options - The options
185
- * @returns - Returns the dereferenced value
186
- */
187
- static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>($ref: $Ref<S, O>, resolvedValue: S, options?: O): S;
188
- }
189
- //#endregion
190
- export { $Ref };
@@ -1,134 +0,0 @@
1
- import { JSONSchema } from "./types/index.js";
2
- import { ParserOptions } from "./options.js";
3
- import { $Ref } from "./ref.js";
4
- import { Pointer } from "./pointer.js";
5
- import { JSONSchema4Type, JSONSchema6Type, JSONSchema7Type } from "json-schema";
6
-
7
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts
8
- interface $RefsMap<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
9
- [url: string]: $Ref<S, O>;
10
- }
11
- /**
12
- * When you call the resolve method, the value that gets passed to the callback function (or Promise) is a $Refs object. This same object is accessible via the parser.$refs property of $RefParser objects.
13
- *
14
- * This object is a map of JSON References and their resolved values. It also has several convenient helper methods that make it easy for you to navigate and manipulate the JSON References.
15
- *
16
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html
17
- */
18
- declare class $Refs<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
19
- /**
20
- * This property is true if the schema contains any circular references. You may want to check this property before serializing the dereferenced schema as JSON, since JSON.stringify() does not support circular references by default.
21
- *
22
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#circular
23
- */
24
- circular: boolean;
25
- /**
26
- * Returns the paths/URLs of all the files in your schema (including the main schema file).
27
- *
28
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#pathstypes
29
- *
30
- * @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
31
- */
32
- paths(...types: (string | string[])[]): string[];
33
- /**
34
- * Returns a map of paths/URLs and their correspond values.
35
- *
36
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#valuestypes
37
- *
38
- * @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
39
- */
40
- values(...types: (string | string[])[]): S;
41
- /**
42
- * Returns `true` if the given path exists in the schema; otherwise, returns `false`
43
- *
44
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#existsref
45
- *
46
- * @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
47
- */
48
- /**
49
- * Determines whether the given JSON reference exists.
50
- *
51
- * @param path - The path being resolved, optionally with a JSON pointer in the hash
52
- * @param [options]
53
- * @returns
54
- */
55
- exists(path: string, options: any): boolean;
56
- /**
57
- * Resolves the given JSON reference and returns the resolved value.
58
- *
59
- * @param path - The path being resolved, with a JSON pointer in the hash
60
- * @param [options]
61
- * @returns - Returns the resolved value
62
- */
63
- get(path: string, options?: O): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type;
64
- /**
65
- * Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
66
- *
67
- * @param path The JSON Reference path, optionally with a JSON Pointer in the hash
68
- * @param value The value to assign. Can be anything (object, string, number, etc.)
69
- */
70
- set(path: string, value: JSONSchema4Type | JSONSchema6Type | JSONSchema7Type): void;
71
- /**
72
- * Returns the specified {@link $Ref} object, or undefined.
73
- *
74
- * @param path - The path being resolved, optionally with a JSON pointer in the hash
75
- * @returns
76
- * @protected
77
- */
78
- _get$Ref(path: string): $Ref<S, O>;
79
- /**
80
- * Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.
81
- *
82
- * @param path - The file path or URL of the referenced file
83
- */
84
- _add(path: string): $Ref<S, O>;
85
- _addAlias(path: string, value: S, pathType?: string | unknown, dynamicIdScope?: boolean): $Ref<S, O>;
86
- /**
87
- * Resolves the given JSON reference.
88
- *
89
- * @param path - The path being resolved, optionally with a JSON pointer in the hash
90
- * @param pathFromRoot - The path of `obj` from the schema root
91
- * @param [options]
92
- * @returns
93
- * @protected
94
- */
95
- _resolve(path: string, pathFromRoot: string, options?: O): Pointer<S, O> | null;
96
- /**
97
- * A map of paths/urls to {@link $Ref} objects
98
- *
99
- * @type {object}
100
- * @protected
101
- */
102
- _$refs: $RefsMap<S, O>;
103
- _aliases: $RefsMap<S, O>;
104
- /**
105
- * The {@link $Ref} object that is the root of the JSON schema.
106
- *
107
- * @type {$Ref}
108
- * @protected
109
- */
110
- _root$Ref: $Ref<S, O>;
111
- constructor();
112
- /**
113
- * Returns the paths of all the files/URLs that are referenced by the JSON schema,
114
- * including the schema itself.
115
- *
116
- * @param [types] - Only return paths of the given types ("file", "http", etc.)
117
- * @returns
118
- */
119
- /**
120
- * Returns the map of JSON references and their resolved values.
121
- *
122
- * @param [types] - Only return references of the given types ("file", "http", etc.)
123
- * @returns
124
- */
125
- /**
126
- * Returns a POJO (plain old JavaScript object) for serialization as JSON.
127
- *
128
- * @returns {object}
129
- */
130
- toJSON: (...types: (string | string[])[]) => S;
131
- private _getRef;
132
- }
133
- //#endregion
134
- export { $Refs };
@@ -1,112 +0,0 @@
1
- import { isHttp, isUnsafeUrl, parse, resolve } from "../util/url.js";
2
- import { ResolverError } from "../util/errors.js";
3
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js
4
- var http_default = {
5
- /**
6
- * The order that this resolver will run, in relation to other resolvers.
7
- */
8
- order: 200,
9
- /**
10
- * HTTP headers to send when downloading files.
11
- *
12
- * @example:
13
- * {
14
- * "User-Agent": "JSON Schema $Ref Parser",
15
- * Accept: "application/json"
16
- * }
17
- */
18
- headers: null,
19
- /**
20
- * HTTP request timeout (in milliseconds).
21
- */
22
- timeout: 6e4,
23
- /**
24
- * The maximum number of HTTP redirects to follow.
25
- * To disable automatic following of redirects, set this to zero.
26
- */
27
- redirects: 5,
28
- /**
29
- * The `withCredentials` option of XMLHttpRequest.
30
- * Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication
31
- */
32
- withCredentials: false,
33
- /**
34
- * Set this to `false` if you want to allow unsafe URLs (e.g., `127.0.0.1`, localhost, and other internal URLs).
35
- */
36
- safeUrlResolver: true,
37
- /**
38
- * Determines whether this resolver can read a given file reference.
39
- * Resolvers that return true will be tried in order, until one successfully resolves the file.
40
- * Resolvers that return false will not be given a chance to resolve the file.
41
- */
42
- canRead(file) {
43
- return isHttp(file.url) && (!this.safeUrlResolver || !isUnsafeUrl(file.url));
44
- },
45
- /**
46
- * Reads the given URL and returns its raw contents as a Buffer.
47
- */
48
- read(file) {
49
- const u = parse(file.url);
50
- if (typeof window !== "undefined" && !u.protocol) u.protocol = parse(location.href).protocol;
51
- return download(u, this);
52
- }
53
- };
54
- /**
55
- * Downloads the given file.
56
- * @returns
57
- * The promise resolves with the raw downloaded data, or rejects if there is an HTTP error.
58
- */
59
- async function download(u, httpOptions, _redirects) {
60
- u = parse(u);
61
- const redirects = _redirects || [];
62
- redirects.push(u.href);
63
- try {
64
- const res = await get(u, httpOptions);
65
- if (res.status >= 400) {
66
- const error = /* @__PURE__ */ new Error(`HTTP ERROR ${res.status}`);
67
- error.status = res.status;
68
- throw error;
69
- } else if (res.status >= 300) if (!Number.isNaN(httpOptions.redirects) && redirects.length > httpOptions.redirects) {
70
- const error = /* @__PURE__ */ new Error(`Error downloading ${redirects[0]}. \nToo many redirects: \n ${redirects.join(" \n ")}`);
71
- error.status = res.status;
72
- throw new ResolverError(error);
73
- } else if (!("location" in res.headers) || !res.headers.location) {
74
- const error = /* @__PURE__ */ new Error(`HTTP ${res.status} redirect with no location header`);
75
- error.status = res.status;
76
- throw error;
77
- } else return download(resolve(u.href, res.headers.location), httpOptions, redirects);
78
- else {
79
- if (res.body) {
80
- const buf = await res.arrayBuffer();
81
- return Buffer.from(buf);
82
- }
83
- return Buffer.alloc(0);
84
- }
85
- } catch (err) {
86
- const e = err;
87
- e.message = `Error downloading ${u.href}: ${e.message}`;
88
- throw new ResolverError(e, u.href);
89
- }
90
- }
91
- /**
92
- * Sends an HTTP GET request.
93
- * The promise resolves with the HTTP Response object.
94
- */
95
- async function get(u, httpOptions) {
96
- let controller;
97
- let timeoutId;
98
- if (httpOptions.timeout && typeof AbortController !== "undefined") {
99
- controller = new AbortController();
100
- timeoutId = setTimeout(() => controller.abort(), httpOptions.timeout);
101
- }
102
- const response = await fetch(u, {
103
- method: "GET",
104
- headers: httpOptions.headers || {},
105
- credentials: httpOptions.withCredentials ? "include" : "same-origin",
106
- signal: controller ? controller.signal : null
107
- });
108
- if (timeoutId) clearTimeout(timeoutId);
109
- return response;
110
- }
111
- //#endregion
112
- export { http_default as default };
@@ -1,34 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts
2
- type JSONParserErrorType = "EUNKNOWN" | "EPARSER" | "EUNMATCHEDPARSER" | "ETIMEOUT" | "ERESOLVER" | "EUNMATCHEDRESOLVER" | "EMISSINGPOINTER" | "EINVALIDPOINTER";
3
- declare class JSONParserError extends Error {
4
- readonly name: string;
5
- readonly message: string;
6
- source: string | undefined;
7
- path: Array<string | number> | null;
8
- readonly code: JSONParserErrorType;
9
- constructor(message: string, source?: string);
10
- toJSON: () => Error;
11
- get footprint(): string;
12
- }
13
- declare class ParserError extends JSONParserError {
14
- code: JSONParserErrorType;
15
- name: string;
16
- constructor(message: any, source: any);
17
- }
18
- declare class ResolverError extends JSONParserError {
19
- code: JSONParserErrorType;
20
- name: string;
21
- ioErrorCode?: string;
22
- constructor(ex: Error | any, source?: string);
23
- }
24
- declare class MissingPointerError extends JSONParserError {
25
- code: JSONParserErrorType;
26
- name: string;
27
- targetToken: any;
28
- targetRef: string;
29
- targetFound: string;
30
- parentPath: string;
31
- constructor(token: any, path: any, targetRef: any, targetFound: any, parentPath: any);
32
- }
33
- //#endregion
34
- export { JSONParserError, MissingPointerError, ParserError, ResolverError };
@@ -1,5 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js
2
- const isWindowsConst = /^win/.test(globalThis.process ? globalThis.process.platform : "");
3
- const isWindows = () => isWindowsConst;
4
- //#endregion
5
- export { isWindows };