@hey-api/json-schema-ref-parser 0.0.0-next-20260223231818 → 0.0.0-next-20260402234153

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.
package/dist/index.d.mts CHANGED
@@ -112,22 +112,50 @@ declare class JSONParserError extends Error {
112
112
  constructor(message: string, source?: string);
113
113
  get footprint(): string;
114
114
  }
115
+ declare class JSONParserErrorGroup<S extends object = JSONSchema> extends Error {
116
+ files: $RefParser;
117
+ constructor(parser: $RefParser);
118
+ static getParserErrors<S extends object = JSONSchema>(parser: $RefParser): JSONParserError[];
119
+ get errors(): Array<JSONParserError | InvalidPointerError | ResolverError | ParserError | MissingPointerError | UnmatchedParserError | UnmatchedResolverError>;
120
+ }
115
121
  declare class ParserError extends JSONParserError {
116
122
  code: JSONParserErrorType;
117
123
  name: string;
118
124
  constructor(message: any, source: any);
119
125
  }
126
+ declare class UnmatchedParserError extends JSONParserError {
127
+ code: JSONParserErrorType;
128
+ name: string;
129
+ constructor(source: string);
130
+ }
120
131
  declare class ResolverError extends JSONParserError {
121
132
  code: JSONParserErrorType;
122
133
  name: string;
123
134
  ioErrorCode?: string;
124
135
  constructor(ex: Error | any, source?: string);
125
136
  }
137
+ declare class UnmatchedResolverError extends JSONParserError {
138
+ code: JSONParserErrorType;
139
+ name: string;
140
+ constructor(source: any);
141
+ }
126
142
  declare class MissingPointerError extends JSONParserError {
127
143
  code: JSONParserErrorType;
128
144
  name: string;
129
145
  constructor(token: string, path: string);
130
146
  }
147
+ declare class TimeoutError extends JSONParserError {
148
+ code: JSONParserErrorType;
149
+ name: string;
150
+ constructor(timeout: number);
151
+ }
152
+ declare class InvalidPointerError extends JSONParserError {
153
+ code: JSONParserErrorType;
154
+ name: string;
155
+ constructor(pointer: string, path: string);
156
+ }
157
+ declare function isHandledError(err: any): err is JSONParserError;
158
+ declare function normalizeError(err: any): any;
131
159
  //#endregion
132
160
  //#region src/ref.d.ts
133
161
  type $RefError = JSONParserError | ResolverError | ParserError | MissingPointerError;
@@ -162,7 +190,7 @@ declare class $Ref<S extends object = JSONSchema> {
162
190
  */
163
191
  $refs: $Refs<S>;
164
192
  /**
165
- * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.)
193
+ * Indicates the type of {@link $Ref#path} (e.g., "file", "http", etc.)
166
194
  */
167
195
  pathType: string | unknown;
168
196
  /**
@@ -371,7 +399,7 @@ declare class Pointer<S extends object = JSONSchema> {
371
399
  /**
372
400
  * Parses a JSON pointer (or a path containing a JSON pointer in the hash)
373
401
  * and returns an array of the pointer's tokens.
374
- * (e.g. "schema.json#/definitions/person/name" => ["definitions", "person", "name"])
402
+ * (e.g., "schema.json#/definitions/person/name" => ["definitions", "person", "name"])
375
403
  *
376
404
  * The pointer is parsed according to RFC 6901
377
405
  * {@link https://tools.ietf.org/html/rfc6901#section-3}
@@ -384,8 +412,8 @@ declare class Pointer<S extends object = JSONSchema> {
384
412
  /**
385
413
  * Creates a JSON pointer path, by joining one or more tokens to a base path.
386
414
  *
387
- * @param base - The base path (e.g. "schema.json#/definitions/person")
388
- * @param tokens - The token(s) to append (e.g. ["name", "first"])
415
+ * @param base - The base path (e.g., "schema.json#/definitions/person")
416
+ * @param tokens - The token(s) to append (e.g., ["name", "first"])
389
417
  * @returns
390
418
  */
391
419
  static join(base: string, tokens: string | string[]): string;
@@ -625,5 +653,5 @@ declare class $RefParser {
625
653
  mergeMany(): JSONSchema;
626
654
  }
627
655
  //#endregion
628
- export { $RefParser, type JSONSchema, getResolvedInput, sendRequest };
656
+ export { $RefParser, InvalidPointerError, JSONParserError, JSONParserErrorGroup, type JSONParserErrorType, type JSONSchema, MissingPointerError, ParserError, ResolverError, TimeoutError, UnmatchedParserError, UnmatchedResolverError, getResolvedInput, isHandledError, normalizeError, sendRequest };
629
657
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/index.ts","../src/options.ts","../src/util/errors.ts","../src/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MACd,QAAQ;ELtGF;AAUZ;;;EAAqC,UAAA,CAAA;IAAA,WAAA;IAAA,KAAA;IAAA,kBAAA;IAAA;EAoFnB,CApFmB,EAAA;IAAK,WAAA,CAAA,EK2HxB,WL3HwB,EAAA;IA+D7B,KAAA,CAAA,EK6DD,WL7Da;IAiBZ,kBAAc,EK6CH,KL7CG,CK6CG,UL7CH,GAAA,MAAA,GAAA,OAAA,CAAA;IACH,cAAA,CAAA,EK6CH,aL7CG,EAAA;EAGN,CAAA,CAAA,EK2CZ,OL3CY,CK2CJ,UL3CI,CAAA;EAJiB;;AAoBnC;;;;ACzGA;;EAA0C,KAAA,CAAA;IAAA,WAAA;IAAA,KAAA;IAAA,iBAAA;IAAA,aAAA,EImKvB;EJ5JW,CAPY,EAAA;IAAgB,WAAA,CAAA,EIqKxC,WJrKwC;IAAc,KAAA,CAAA,EIsK5D,WJtK4D;IAAmB,iBAAA,EIuKpE,UJvKoE,GAAA,MAAA,GAAA,OAAA;IAOrF,aAAI,CAAA,EIiKU,aJjKV;EAAoB,CAAA,CAAA,EIkKxB,OJlKwB,CAAA;IA0Bf,MAAA,EIwIS,UJxIT;EAAN,CAAA,CAAA;EAUO,QAAA,SAAA;EAAN,SAAA,CAAA,CAAA,EIkPY,UJlPZ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/index.ts","../src/options.ts","../src/util/errors.ts","../src/ref.ts","../src/pointer.ts","../src/refs.ts","../src/resolvers/url.ts","../src/index.ts"],"mappings":";;;KASY,UAAA,GAAa,WAAA,GAAc,WAAA,GAAc,WAAA;AAAA,KACzC,gBAAA,GAAmB,iBAAA,GAAoB,iBAAA,GAAoB,iBAAA;AAAA,UAEtD,MAAA;EAHK;;;EAOpB,SAAA,GAAY,IAAA,EAAM,QAAA;EAPiC;;;;;EAanD,OAAA,GACE,IAAA,EAAM,QAAA,cAGJ,MAAA,GACA,UAAA,GACA,OAAA;IAAU,IAAA,EAAM,MAAA;EAAA,KAChB,OAAA,UA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_SCHEMA } from "js-yaml";
3
+ import { parse } from "yaml";
4
4
  import fs from "fs";
5
5
 
6
6
  //#region src/util/convert-path-to-posix.ts
@@ -228,6 +228,13 @@ var ParserError = class extends JSONParserError {
228
228
  super(`Error parsing ${source}: ${message}`, source);
229
229
  }
230
230
  };
231
+ var UnmatchedParserError = class extends JSONParserError {
232
+ code = "EUNMATCHEDPARSER";
233
+ name = "UnmatchedParserError";
234
+ constructor(source) {
235
+ super(`Could not find parser for "${source}"`, source);
236
+ }
237
+ };
231
238
  var ResolverError = class extends JSONParserError {
232
239
  code = "ERESOLVER";
233
240
  name = "ResolverError";
@@ -237,6 +244,13 @@ var ResolverError = class extends JSONParserError {
237
244
  if ("code" in ex) this.ioErrorCode = String(ex.code);
238
245
  }
239
246
  };
247
+ var UnmatchedResolverError = class extends JSONParserError {
248
+ code = "EUNMATCHEDRESOLVER";
249
+ name = "UnmatchedResolverError";
250
+ constructor(source) {
251
+ super(`Could not find resolver for "${source}"`, source);
252
+ }
253
+ };
240
254
  var MissingPointerError = class extends JSONParserError {
241
255
  code = "EMISSINGPOINTER";
242
256
  name = "MissingPointerError";
@@ -244,6 +258,13 @@ var MissingPointerError = class extends JSONParserError {
244
258
  super(`Missing $ref pointer "${getHash(path)}". Token "${token}" does not exist.`, stripHash(path));
245
259
  }
246
260
  };
261
+ var TimeoutError = class extends JSONParserError {
262
+ code = "ETIMEOUT";
263
+ name = "TimeoutError";
264
+ constructor(timeout) {
265
+ super(`Dereferencing timeout reached: ${timeout}ms`);
266
+ }
267
+ };
247
268
  var InvalidPointerError = class extends JSONParserError {
248
269
  code = "EUNMATCHEDRESOLVER";
249
270
  name = "InvalidPointerError";
@@ -292,7 +313,7 @@ var $Ref = class $Ref {
292
313
  */
293
314
  $refs;
294
315
  /**
295
- * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.)
316
+ * Indicates the type of {@link $Ref#path} (e.g., "file", "http", etc.)
296
317
  */
297
318
  pathType;
298
319
  /**
@@ -349,7 +370,7 @@ var $Ref = class $Ref {
349
370
  * @returns
350
371
  */
351
372
  resolve(path, options, friendlyPath, pathFromRoot) {
352
- return new pointer_default(this, path, friendlyPath).resolve(this.value, options, pathFromRoot);
373
+ return new Pointer(this, path, friendlyPath).resolve(this.value, options, pathFromRoot);
353
374
  }
354
375
  /**
355
376
  * Sets the value of a nested property within this {@link $Ref#value}.
@@ -359,7 +380,7 @@ var $Ref = class $Ref {
359
380
  * @param value - The value to assign
360
381
  */
361
382
  set(path, value) {
362
- this.value = new pointer_default(this, path).set(this.value, value);
383
+ this.value = new Pointer(this, path).set(this.value, value);
363
384
  }
364
385
  /**
365
386
  * Determines whether the given value is a JSON reference.
@@ -368,7 +389,7 @@ var $Ref = class $Ref {
368
389
  * @returns
369
390
  */
370
391
  static is$Ref(value) {
371
- return Boolean(value) && typeof value === "object" && value !== null && "$ref" in value && typeof value.$ref === "string" && value.$ref.length > 0;
392
+ return Boolean(value) && typeof value === "object" && value !== null && "$ref" in value && typeof value.$ref === "string" && Boolean(value.$ref.length);
372
393
  }
373
394
  /**
374
395
  * Determines whether the given value is an external JSON reference.
@@ -469,7 +490,6 @@ var $Ref = class $Ref {
469
490
  } else return resolvedValue;
470
491
  }
471
492
  };
472
- var ref_default = $Ref;
473
493
 
474
494
  //#endregion
475
495
  //#region src/pointer.ts
@@ -565,7 +585,7 @@ var Pointer = class Pointer {
565
585
  errors.push(new MissingPointerError(token, decodeURI(this.originalPath)));
566
586
  } else this.value = this.value[token];
567
587
  }
568
- if (errors.length > 0) throw errors.length === 1 ? errors[0] : new AggregateError(errors, "Multiple missing pointer errors");
588
+ if (errors.length) throw errors.length === 1 ? errors[0] : new AggregateError(errors, "Multiple missing pointer errors");
569
589
  if (!this.value || this.value.$ref && resolve(this.path, this.value.$ref) !== pathFromRoot) resolveIf$Ref(this, options, pathFromRoot);
570
590
  return this;
571
591
  }
@@ -582,7 +602,7 @@ var Pointer = class Pointer {
582
602
  set(obj, value, options) {
583
603
  const tokens = Pointer.parse(this.path);
584
604
  let token;
585
- if (tokens.length === 0) {
605
+ if (!tokens.length) {
586
606
  this.value = value;
587
607
  return value;
588
608
  }
@@ -601,7 +621,7 @@ var Pointer = class Pointer {
601
621
  /**
602
622
  * Parses a JSON pointer (or a path containing a JSON pointer in the hash)
603
623
  * and returns an array of the pointer's tokens.
604
- * (e.g. "schema.json#/definitions/person/name" => ["definitions", "person", "name"])
624
+ * (e.g., "schema.json#/definitions/person/name" => ["definitions", "person", "name"])
605
625
  *
606
626
  * The pointer is parsed according to RFC 6901
607
627
  * {@link https://tools.ietf.org/html/rfc6901#section-3}
@@ -621,8 +641,8 @@ var Pointer = class Pointer {
621
641
  /**
622
642
  * Creates a JSON pointer path, by joining one or more tokens to a base path.
623
643
  *
624
- * @param base - The base path (e.g. "schema.json#/definitions/person")
625
- * @param tokens - The token(s) to append (e.g. ["name", "first"])
644
+ * @param base - The base path (e.g., "schema.json#/definitions/person")
645
+ * @param tokens - The token(s) to append (e.g., ["name", "first"])
626
646
  * @returns
627
647
  */
628
648
  static join(base, tokens) {
@@ -647,15 +667,15 @@ var Pointer = class Pointer {
647
667
  * @returns - Returns `true` if the resolution path changed
648
668
  */
649
669
  function resolveIf$Ref(pointer, options, pathFromRoot) {
650
- if (ref_default.isAllowed$Ref(pointer.value)) {
670
+ if ($Ref.isAllowed$Ref(pointer.value)) {
651
671
  const $refPath = resolve(pointer.path, pointer.value.$ref);
652
672
  if ($refPath === pointer.path && !isRootPath(pathFromRoot)) pointer.circular = true;
653
673
  else {
654
674
  const resolved = pointer.$ref.$refs._resolve($refPath, pointer.path, options);
655
675
  if (resolved === null) return false;
656
676
  pointer.indirections += resolved.indirections + 1;
657
- if (ref_default.isExtended$Ref(pointer.value)) {
658
- pointer.value = ref_default.dereference(pointer.value, resolved.value);
677
+ if ($Ref.isExtended$Ref(pointer.value)) {
678
+ pointer.value = $Ref.dereference(pointer.value, resolved.value);
659
679
  return false;
660
680
  } else {
661
681
  pointer.$ref = resolved.$ref;
@@ -666,7 +686,6 @@ function resolveIf$Ref(pointer, options, pathFromRoot) {
666
686
  }
667
687
  }
668
688
  }
669
- var pointer_default = Pointer;
670
689
  /**
671
690
  * Sets the specified token value of the {@link Pointer#value}.
672
691
  *
@@ -729,7 +748,7 @@ const createInventoryLookup = () => {
729
748
  * @returns The container type: "schemas", "parameters", "requestBodies", "responses", or "headers"
730
749
  */
731
750
  const getContainerTypeFromPath = (path) => {
732
- const tokens = pointer_default.parse(path);
751
+ const tokens = Pointer.parse(path);
733
752
  const has = (t) => tokens.includes(t);
734
753
  if (has("parameters")) return "parameters";
735
754
  if (has("requestBody")) return "requestBodies";
@@ -739,7 +758,7 @@ const getContainerTypeFromPath = (path) => {
739
758
  return "schemas";
740
759
  };
741
760
  /**
742
- * Inventories the given JSON Reference (i.e. records detailed information about it so we can
761
+ * Inventories the given JSON Reference (i.e., records detailed information about it so we can
743
762
  * optimize all $refs in the schema), and then crawls the resolved value.
744
763
  */
745
764
  const inventory$Ref = ({ $refKey, $refParent, $refs, indirections, inventory, inventoryLookup, options, path, pathFromRoot, resolvedRefs = /* @__PURE__ */ new Map(), visitedObjects = /* @__PURE__ */ new WeakSet() }) => {
@@ -751,13 +770,13 @@ const inventory$Ref = ({ $refKey, $refParent, $refs, indirections, inventory, in
751
770
  pointer = $refs._resolve($refPath, pathFromRoot, options);
752
771
  } catch (error) {
753
772
  if (error instanceof MissingPointerError) {
754
- const hash$1 = getHash($refPath);
755
- if (hash$1) {
773
+ const hash = getHash($refPath);
774
+ if (hash) {
756
775
  const baseFile = stripHash($refPath);
757
776
  for (const filePath of Object.keys($refs._$refs)) {
758
777
  if (filePath === baseFile) continue;
759
778
  try {
760
- pointer = $refs._resolve(filePath + hash$1, pathFromRoot, options);
779
+ pointer = $refs._resolve(filePath + hash, pathFromRoot, options);
761
780
  if (pointer) break;
762
781
  } catch {}
763
782
  }
@@ -771,11 +790,11 @@ const inventory$Ref = ({ $refKey, $refParent, $refs, indirections, inventory, in
771
790
  if (pointer) resolvedRefs.set($refPath, pointer);
772
791
  }
773
792
  if (pointer === null) return;
774
- const depth = pointer_default.parse(pathFromRoot).length;
793
+ const depth = Pointer.parse(pathFromRoot).length;
775
794
  const file = stripHash(pointer.path);
776
795
  const hash = getHash(pointer.path);
777
796
  const external = file !== $refs._root$Ref.path;
778
- const extended = ref_default.isExtended$Ref($ref);
797
+ const extended = $Ref.isExtended$Ref($ref);
779
798
  indirections += pointer.indirections;
780
799
  const existingEntry = inventoryLookup.find($refParent, $refKey);
781
800
  if (existingEntry && existingEntry.pathFromRoot === pathFromRoot) if (depth < existingEntry.depth || indirections < existingEntry.indirections) {
@@ -824,7 +843,7 @@ const crawl$1 = ({ $refs, indirections, inventory, inventoryLookup, key, options
824
843
  const obj = key === null ? parent : parent[key];
825
844
  if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) {
826
845
  if (visitedObjects.has(obj)) return;
827
- if (ref_default.isAllowed$Ref(obj)) inventory$Ref({
846
+ if ($Ref.isAllowed$Ref(obj)) inventory$Ref({
828
847
  $refKey: key,
829
848
  $refParent: parent,
830
849
  $refs,
@@ -844,12 +863,12 @@ const crawl$1 = ({ $refs, indirections, inventory, inventoryLookup, key, options
844
863
  else if (b === "definitions") return 1;
845
864
  else return a.length - b.length;
846
865
  });
847
- for (const key$1 of keys) {
848
- const keyPath = pointer_default.join(path, key$1);
849
- const keyPathFromRoot = pointer_default.join(pathFromRoot, key$1);
850
- const value = obj[key$1];
851
- if (ref_default.isAllowed$Ref(value)) inventory$Ref({
852
- $refKey: key$1,
866
+ for (const key of keys) {
867
+ const keyPath = Pointer.join(path, key);
868
+ const keyPathFromRoot = Pointer.join(pathFromRoot, key);
869
+ const value = obj[key];
870
+ if ($Ref.isAllowed$Ref(value)) inventory$Ref({
871
+ $refKey: key,
853
872
  $refParent: obj,
854
873
  $refs,
855
874
  indirections,
@@ -866,7 +885,7 @@ const crawl$1 = ({ $refs, indirections, inventory, inventoryLookup, key, options
866
885
  indirections,
867
886
  inventory,
868
887
  inventoryLookup,
869
- key: key$1,
888
+ key,
870
889
  options,
871
890
  parent: obj,
872
891
  path: keyPath,
@@ -899,8 +918,8 @@ function remap(parser, inventory) {
899
918
  }
900
919
  });
901
920
  const ensureContainer = (type) => {
902
- const isOas3 = !!(root && typeof root === "object" && typeof root.openapi === "string");
903
- const isOas2 = !!(root && typeof root === "object" && typeof root.swagger === "string");
921
+ const isOas3 = Boolean(root && typeof root === "object" && typeof root.openapi === "string");
922
+ const isOas2 = Boolean(root && typeof root === "object" && typeof root.swagger === "string");
904
923
  if (isOas3) {
905
924
  if (!root.components || typeof root.components !== "object") root.components = {};
906
925
  if (!root.components[type] || typeof root.components[type] !== "object") root.components[type] = {};
@@ -1096,8 +1115,8 @@ const jsonParser = {
1096
1115
  const firstCurlyBrace = data.indexOf("{");
1097
1116
  data = data.slice(firstCurlyBrace);
1098
1117
  return JSON.parse(data);
1099
- } catch (error$1) {
1100
- throw new ParserError(error$1.message, file.url);
1118
+ } catch (error) {
1119
+ throw new ParserError(error.message, file.url);
1101
1120
  }
1102
1121
  }
1103
1122
  },
@@ -1129,7 +1148,7 @@ const yamlParser = {
1129
1148
  const data = Buffer.isBuffer(file.data) ? file.data.toString() : file.data;
1130
1149
  if (typeof data !== "string") return data;
1131
1150
  try {
1132
- return yaml.load(data, { schema: JSON_SCHEMA });
1151
+ return parse(data);
1133
1152
  } catch (error) {
1134
1153
  throw new ParserError(error?.message || "Parser Error", file.url);
1135
1154
  }
@@ -1167,13 +1186,13 @@ async function run(plugins, file) {
1167
1186
  let index = 0;
1168
1187
  let lastError;
1169
1188
  let plugin;
1170
- return new Promise((resolve$1, reject) => {
1189
+ return new Promise((resolve, reject) => {
1171
1190
  const runNextPlugin = async () => {
1172
1191
  plugin = plugins[index++];
1173
1192
  if (!plugin) return reject(lastError);
1174
1193
  try {
1175
1194
  const result = await plugin.handler(file);
1176
- if (result !== void 0) return resolve$1({
1195
+ if (result !== void 0) return resolve({
1177
1196
  plugin,
1178
1197
  result
1179
1198
  });
@@ -1336,7 +1355,7 @@ var $Refs = class {
1336
1355
  */
1337
1356
  _add(path) {
1338
1357
  const withoutHash = stripHash(path);
1339
- const $ref = new ref_default(this);
1358
+ const $ref = new $Ref(this);
1340
1359
  $ref.path = withoutHash;
1341
1360
  this._$refs[withoutHash] = $ref;
1342
1361
  this._root$Ref = this._root$Ref || $ref;
@@ -1416,7 +1435,7 @@ var $Refs = class {
1416
1435
  function getPaths($refs, types) {
1417
1436
  let paths = Object.keys($refs);
1418
1437
  types = Array.isArray(types[0]) ? types[0] : Array.prototype.slice.call(types);
1419
- if (types.length > 0 && types[0]) paths = paths.filter((key) => types.includes($refs[key].pathType));
1438
+ if (types.length && types[0]) paths = paths.filter((key) => types.includes($refs[key].pathType));
1420
1439
  return paths.map((path) => ({
1421
1440
  decoded: $refs[path].pathType === "file" ? toFileSystemPath(path, true) : path,
1422
1441
  encoded: path
@@ -1521,7 +1540,7 @@ function crawl(obj, { $refs, external = false, options, path, seen = /* @__PURE_
1521
1540
  let promises = [];
1522
1541
  if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
1523
1542
  seen.add(obj);
1524
- if (ref_default.isExternal$Ref(obj)) promises.push(resolve$Ref(obj, {
1543
+ if ($Ref.isExternal$Ref(obj)) promises.push(resolve$Ref(obj, {
1525
1544
  $refs,
1526
1545
  options,
1527
1546
  path,
@@ -1531,7 +1550,7 @@ function crawl(obj, { $refs, external = false, options, path, seen = /* @__PURE_
1531
1550
  $refs,
1532
1551
  external,
1533
1552
  options,
1534
- path: pointer_default.join(path, key),
1553
+ path: Pointer.join(path, key),
1535
1554
  seen
1536
1555
  }));
1537
1556
  }
@@ -1643,35 +1662,35 @@ var $RefParser = class {
1643
1662
  *
1644
1663
  * @param pathOrUrlOrSchema A JSON Schema object, or the file path or URL of a JSON Schema file.
1645
1664
  */
1646
- async bundle({ arrayBuffer, fetch: fetch$1, pathOrUrlOrSchema, resolvedInput }) {
1665
+ async bundle({ arrayBuffer, fetch, pathOrUrlOrSchema, resolvedInput }) {
1647
1666
  await this.parse({
1648
1667
  arrayBuffer,
1649
- fetch: fetch$1,
1668
+ fetch,
1650
1669
  pathOrUrlOrSchema,
1651
1670
  resolvedInput
1652
1671
  });
1653
1672
  await resolveExternal(this, this.options);
1654
- if (JSONParserErrorGroup.getParserErrors(this).length > 0) throw new JSONParserErrorGroup(this);
1673
+ if (JSONParserErrorGroup.getParserErrors(this).length) throw new JSONParserErrorGroup(this);
1655
1674
  bundle(this, this.options);
1656
- if (JSONParserErrorGroup.getParserErrors(this).length > 0) throw new JSONParserErrorGroup(this);
1675
+ if (JSONParserErrorGroup.getParserErrors(this).length) throw new JSONParserErrorGroup(this);
1657
1676
  return this.schema;
1658
1677
  }
1659
1678
  /**
1660
1679
  * Bundles multiple roots (files/URLs/objects) into a single schema by creating a synthetic root
1661
1680
  * that references each input, resolving all externals, and then hoisting via the existing bundler.
1662
1681
  */
1663
- async bundleMany({ arrayBuffer, fetch: fetch$1, pathOrUrlOrSchemas, resolvedInputs }) {
1682
+ async bundleMany({ arrayBuffer, fetch, pathOrUrlOrSchemas, resolvedInputs }) {
1664
1683
  await this.parseMany({
1665
1684
  arrayBuffer,
1666
- fetch: fetch$1,
1685
+ fetch,
1667
1686
  pathOrUrlOrSchemas,
1668
1687
  resolvedInputs
1669
1688
  });
1670
1689
  this.mergeMany();
1671
1690
  await resolveExternal(this, this.options);
1672
- if (JSONParserErrorGroup.getParserErrors(this).length > 0) throw new JSONParserErrorGroup(this);
1691
+ if (JSONParserErrorGroup.getParserErrors(this).length) throw new JSONParserErrorGroup(this);
1673
1692
  bundle(this, this.options);
1674
- if (JSONParserErrorGroup.getParserErrors(this).length > 0) throw new JSONParserErrorGroup(this);
1693
+ if (JSONParserErrorGroup.getParserErrors(this).length) throw new JSONParserErrorGroup(this);
1675
1694
  return this.schema;
1676
1695
  }
1677
1696
  /**
@@ -1682,7 +1701,7 @@ var $RefParser = class {
1682
1701
  * @param pathOrUrlOrSchema A JSON Schema object, or the file path or URL of a JSON Schema file.
1683
1702
  * @returns - The returned promise resolves with the parsed JSON schema object.
1684
1703
  */
1685
- async parse({ arrayBuffer, fetch: fetch$1, pathOrUrlOrSchema, resolvedInput: _resolvedInput }) {
1704
+ async parse({ arrayBuffer, fetch, pathOrUrlOrSchema, resolvedInput: _resolvedInput }) {
1686
1705
  const resolvedInput = _resolvedInput || getResolvedInput({ pathOrUrlOrSchema });
1687
1706
  const { path, type } = resolvedInput;
1688
1707
  let { schema } = resolvedInput;
@@ -1699,7 +1718,7 @@ var $RefParser = class {
1699
1718
  try {
1700
1719
  await (type === "file" ? fileResolver : urlResolver).handler({
1701
1720
  arrayBuffer,
1702
- fetch: fetch$1,
1721
+ fetch,
1703
1722
  file
1704
1723
  });
1705
1724
  const parseResult = await parseFile(file, this.options.parse);
@@ -1714,7 +1733,7 @@ var $RefParser = class {
1714
1733
  this.schema = schema;
1715
1734
  return { schema };
1716
1735
  }
1717
- async parseMany({ arrayBuffer, fetch: fetch$1, pathOrUrlOrSchemas, resolvedInputs: _resolvedInputs }) {
1736
+ async parseMany({ arrayBuffer, fetch, pathOrUrlOrSchemas, resolvedInputs: _resolvedInputs }) {
1718
1737
  const resolvedInputs = [..._resolvedInputs || []];
1719
1738
  resolvedInputs.push(...pathOrUrlOrSchemas.map((schema) => getResolvedInput({ pathOrUrlOrSchema: schema })) || []);
1720
1739
  this.schemaMany = [];
@@ -1731,7 +1750,7 @@ var $RefParser = class {
1731
1750
  try {
1732
1751
  await (type === "file" ? fileResolver : urlResolver).handler({
1733
1752
  arrayBuffer: arrayBuffer?.[i],
1734
- fetch: fetch$1,
1753
+ fetch,
1735
1754
  file
1736
1755
  });
1737
1756
  const parseResult = await parseFile(file, this.options.parse);
@@ -1750,7 +1769,7 @@ var $RefParser = class {
1750
1769
  }
1751
1770
  mergeMany() {
1752
1771
  const schemas = this.schemaMany || [];
1753
- if (schemas.length === 0) throw ono("mergeMany called with no schemas. Did you run parseMany?");
1772
+ if (!schemas.length) throw ono("mergeMany called with no schemas. Did you run parseMany?");
1754
1773
  const merged = {};
1755
1774
  let chosenOpenapi;
1756
1775
  let chosenSwagger;
@@ -1768,7 +1787,7 @@ var $RefParser = class {
1768
1787
  for (const [k, v] of Object.entries(info)) if (infoAccumulator[k] === void 0 && v !== void 0) infoAccumulator[k] = JSON.parse(JSON.stringify(v));
1769
1788
  }
1770
1789
  }
1771
- if (Object.keys(infoAccumulator).length > 0) merged.info = infoAccumulator;
1790
+ if (Object.keys(infoAccumulator).length) merged.info = infoAccumulator;
1772
1791
  const servers = [];
1773
1792
  const seenServers = /* @__PURE__ */ new Set();
1774
1793
  for (const s of schemas) {
@@ -1783,7 +1802,7 @@ var $RefParser = class {
1783
1802
  }
1784
1803
  }
1785
1804
  }
1786
- if (servers.length > 0) merged.servers = servers;
1805
+ if (servers.length) merged.servers = servers;
1787
1806
  merged.paths = {};
1788
1807
  merged.components = {};
1789
1808
  const componentSections = [
@@ -1904,7 +1923,7 @@ var $RefParser = class {
1904
1923
  } else Object.assign(merged.paths[p], rewritten);
1905
1924
  } else merged.paths[p] = cloneAndRewrite(item, refMap, tagMap, prefix, stripHash(sourcePath));
1906
1925
  }
1907
- if (tags.length > 0) merged.tags = tags;
1926
+ if (tags.length) merged.tags = tags;
1908
1927
  const rootPath = this.schemaManySources[0] || cwd();
1909
1928
  this.$refs = new $Refs();
1910
1929
  const rootRef = this.$refs._add(rootPath);
@@ -1916,5 +1935,5 @@ var $RefParser = class {
1916
1935
  };
1917
1936
 
1918
1937
  //#endregion
1919
- export { $RefParser, getResolvedInput, sendRequest };
1938
+ export { $RefParser, InvalidPointerError, JSONParserError, JSONParserErrorGroup, MissingPointerError, ParserError, ResolverError, TimeoutError, UnmatchedParserError, UnmatchedResolverError, getResolvedInput, isHandledError, normalizeError, sendRequest };
1920
1939
  //# sourceMappingURL=index.mjs.map