@apidevtools/json-schema-ref-parser 11.6.3 → 11.6.5

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/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  [![License](https://img.shields.io/npm/l/@apidevtools/json-schema-ref-parser.svg)](LICENSE)
10
10
  [![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/APIDevTools/json-schema-ref-parser)
11
11
 
12
- Installation
13
- --------------------------
12
+ ## Installation
13
+
14
14
  Install using [npm](https://docs.npmjs.com/about-npm/):
15
15
 
16
16
  ```bash
@@ -19,8 +19,8 @@ yarn add @apidevtools/json-schema-ref-parser
19
19
  bun add @apidevtools/json-schema-ref-parser
20
20
  ```
21
21
 
22
- The Problem:
23
- --------------------------
22
+ ## The Problem:
23
+
24
24
  You've got a JSON Schema with `$ref` pointers to other files and/or URLs. Maybe you know all the referenced files ahead
25
25
  of time. Maybe you don't. Maybe some are local files, and others are remote URLs. Maybe they are a mix of JSON and YAML
26
26
  format. Maybe some of the files contain cross-references to each other.
@@ -48,8 +48,8 @@ format. Maybe some of the files contain cross-references to each other.
48
48
  }
49
49
  ```
50
50
 
51
- The Solution:
52
- --------------------------
51
+ ## The Solution:
52
+
53
53
  JSON Schema $Ref Parser is a full [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03)
54
54
  and [JSON Pointer](https://tools.ietf.org/html/rfc6901) implementation that crawls even the most
55
55
  complex [JSON Schemas](http://json-schema.org/latest/json-schema-core.html) and gives you simple, straightforward
@@ -68,8 +68,7 @@ JavaScript objects.
68
68
  instance
69
69
  - Compatible with Node LTS and beyond, and all major web browsers on Windows, Mac, and Linux
70
70
 
71
- Example
72
- --------------------------
71
+ ## Example
73
72
 
74
73
  ```javascript
75
74
  import $RefParser from "@apidevtools/json-schema-ref-parser";
@@ -89,10 +88,7 @@ try {
89
88
 
90
89
  For more detailed examples, please see the [API Documentation](https://apitools.dev/json-schema-ref-parser/docs/)
91
90
 
92
-
93
- Polyfills
94
- --------------------------
95
-
91
+ ## Polyfills
96
92
 
97
93
  If you are using Node.js < 18, you'll need a polyfill for `fetch`,
98
94
  like [node-fetch](https://github.com/node-fetch/node-fetch):
@@ -103,8 +99,8 @@ import fetch from "node-fetch";
103
99
  globalThis.fetch = fetch;
104
100
  ```
105
101
 
106
- Browser support
107
- --------------------------
102
+ ## Browser support
103
+
108
104
  JSON Schema $Ref Parser supports recent versions of every major web browser. Older browsers may
109
105
  require [Babel](https://babeljs.io/) and/or [polyfills](https://babeljs.io/docs/en/next/babel-polyfill).
110
106
 
@@ -121,54 +117,50 @@ Edit your `webpack.config.js` :
121
117
 
122
118
  ```js
123
119
  config.resolve.fallback = {
124
- "path": require.resolve("path-browserify"),
125
- 'fs': require.resolve('browserify-fs')
126
- }
120
+ path: require.resolve("path-browserify"),
121
+ fs: require.resolve("browserify-fs"),
122
+ };
127
123
 
128
124
  config.plugins.push(
129
125
  new webpack.ProvidePlugin({
130
- Buffer: ['buffer', 'Buffer']
131
- })
132
- )
133
-
126
+ Buffer: ["buffer", "Buffer"],
127
+ }),
128
+ );
134
129
  ```
135
130
 
136
- API Documentation
137
- --------------------------
131
+ ## API Documentation
132
+
138
133
  Full API documentation is available [right here](https://apitools.dev/json-schema-ref-parser/docs/)
139
134
 
135
+ ## Contributing
140
136
 
141
- Contributing
142
- --------------------------
143
137
  I welcome any contributions, enhancements, and
144
- bug-fixes. [Open an issue](https://github.com/APIDevTools/json-schema-ref-parser/issues) on GitHub
138
+ bug-fixes. [Open an issue](https://github.com/APIDevTools/json-schema-ref-parser/issues) on GitHub
145
139
  and [submit a pull request](https://github.com/APIDevTools/json-schema-ref-parser/pulls).
146
140
 
147
141
  #### Building/Testing
148
142
 
149
143
  To build/test the project locally on your computer:
150
144
 
151
- 1. __Clone this repo__<br>
145
+ 1. **Clone this repo**<br>
152
146
  `git clone https://github.com/APIDevTools/json-schema-ref-parser.git`
153
147
 
154
- 2. __Install dependencies__<br>
148
+ 2. **Install dependencies**<br>
155
149
  `yarn install`
156
150
 
157
- 3. __Run the tests__<br>
151
+ 3. **Run the tests**<br>
158
152
  `yarn test`
159
153
 
160
- License
161
- --------------------------
154
+ ## License
155
+
162
156
  JSON Schema $Ref Parser is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.
163
157
 
164
158
  This package is [Treeware](http://treeware.earth). If you use it in production, then we ask that you [**buy the world a
165
159
  tree**](https://plant.treeware.earth/APIDevTools/json-schema-ref-parser) to thank us for our work. By contributing to
166
160
  the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
167
161
 
162
+ ## Big Thanks To
168
163
 
169
-
170
- Big Thanks To
171
- --------------------------
172
164
  Thanks to these awesome companies for their support of Open Source developers ❤
173
165
 
174
166
  [![Stoplight](https://svgshare.com/i/TK5.svg)](https://stoplight.io/?utm_source=github&utm_medium=readme&utm_campaign=json_schema_ref_parser)
@@ -82,7 +82,6 @@ function crawl(parent, key, path, pathFromRoot, indirections, inventory, $refs,
82
82
  return a.length - b.length;
83
83
  }
84
84
  });
85
- // eslint-disable-next-line no-shadow
86
85
  for (const key of keys) {
87
86
  const keyPath = pointer_js_1.default.join(path, key);
88
87
  const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key);
@@ -167,7 +167,9 @@ function dereference$Ref($ref, path, pathFromRoot, parents, processedObjects, de
167
167
  // Check for circular references
168
168
  const directCircular = pointer.circular;
169
169
  let circular = directCircular || parents.has(pointer.value);
170
- circular && foundCircularReference(path, $refs, options);
170
+ if (circular) {
171
+ foundCircularReference(path, $refs, options);
172
+ }
171
173
  // Dereference the JSON reference
172
174
  let dereferencedValue = ref_js_1.default.dereference($ref, pointer.value);
173
175
  // Crawl the dereferenced value (unless it's circular)
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeArgs = void 0;
3
+ exports.normalizeArgs = normalizeArgs;
4
4
  const options_js_1 = require("./options.js");
5
5
  /**
6
6
  * Normalizes the given arguments, accounting for optional args.
@@ -52,5 +52,4 @@ function normalizeArgs(_args) {
52
52
  callback,
53
53
  };
54
54
  }
55
- exports.normalizeArgs = normalizeArgs;
56
55
  exports.default = normalizeArgs;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { HTTPResolverOptions, JSONSchema, JSONSchemaObject, Plugin, ResolverOptions } from "./types/index.js";
3
2
  export type DeepPartial<T> = T extends object ? {
4
3
  [P in keyof T]?: DeepPartial<T[P]>;
@@ -91,7 +90,7 @@ export interface $RefParserOptions<S extends object = JSONSchema> {
91
90
  timeoutMs?: number;
92
91
  }
93
92
  export declare const getJsonSchemaRefParserDefaultOptions: () => $RefParserOptions<JSONSchema>;
94
- export declare const getNewOptions: <S extends object = JSONSchema, O extends {
93
+ export declare const getNewOptions: <S extends object = JSONSchema, O extends ParserOptions<S> = {
95
94
  parse?: {
96
95
  [x: string]: boolean | {
97
96
  name?: string | undefined;
@@ -113,6 +112,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
113
112
  readonly unicode?: boolean | undefined;
114
113
  readonly dotAll?: boolean | undefined;
115
114
  readonly hasIndices?: boolean | undefined;
115
+ readonly unicodeSets?: boolean | undefined;
116
116
  [Symbol.match]?: {} | undefined;
117
117
  [Symbol.replace]?: {} | undefined;
118
118
  [Symbol.search]?: {} | undefined;
@@ -141,6 +141,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
141
141
  readonly unicode?: boolean | undefined;
142
142
  readonly dotAll?: boolean | undefined;
143
143
  readonly hasIndices?: boolean | undefined;
144
+ readonly unicodeSets?: boolean | undefined;
144
145
  [Symbol.match]?: {} | undefined;
145
146
  [Symbol.replace]?: {} | undefined;
146
147
  [Symbol.search]?: {} | undefined;
@@ -169,6 +170,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
169
170
  readonly unicode?: boolean | undefined;
170
171
  readonly dotAll?: boolean | undefined;
171
172
  readonly hasIndices?: boolean | undefined;
173
+ readonly unicodeSets?: boolean | undefined;
172
174
  [Symbol.match]?: {} | undefined;
173
175
  [Symbol.replace]?: {} | undefined;
174
176
  [Symbol.search]?: {} | undefined;
@@ -197,6 +199,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
197
199
  readonly unicode?: boolean | undefined;
198
200
  readonly dotAll?: boolean | undefined;
199
201
  readonly hasIndices?: boolean | undefined;
202
+ readonly unicodeSets?: boolean | undefined;
200
203
  [Symbol.match]?: {} | undefined;
201
204
  [Symbol.replace]?: {} | undefined;
202
205
  [Symbol.search]?: {} | undefined;
@@ -225,6 +228,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
225
228
  readonly unicode?: boolean | undefined;
226
229
  readonly dotAll?: boolean | undefined;
227
230
  readonly hasIndices?: boolean | undefined;
231
+ readonly unicodeSets?: boolean | undefined;
228
232
  [Symbol.match]?: {} | undefined;
229
233
  [Symbol.replace]?: {} | undefined;
230
234
  [Symbol.search]?: {} | undefined;
@@ -252,6 +256,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
252
256
  readonly unicode?: boolean | undefined;
253
257
  readonly dotAll?: boolean | undefined;
254
258
  readonly hasIndices?: boolean | undefined;
259
+ readonly unicodeSets?: boolean | undefined;
255
260
  [Symbol.match]?: {} | undefined;
256
261
  [Symbol.replace]?: {} | undefined;
257
262
  [Symbol.search]?: {} | undefined;
@@ -290,6 +295,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
290
295
  readonly unicode?: boolean | undefined;
291
296
  readonly dotAll?: boolean | undefined;
292
297
  readonly hasIndices?: boolean | undefined;
298
+ readonly unicodeSets?: boolean | undefined;
293
299
  [Symbol.match]?: {} | undefined;
294
300
  [Symbol.replace]?: {} | undefined;
295
301
  [Symbol.search]?: {} | undefined;
@@ -316,6 +322,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
316
322
  readonly unicode?: boolean | undefined;
317
323
  readonly dotAll?: boolean | undefined;
318
324
  readonly hasIndices?: boolean | undefined;
325
+ readonly unicodeSets?: boolean | undefined;
319
326
  [Symbol.match]?: {} | undefined;
320
327
  [Symbol.replace]?: {} | undefined;
321
328
  [Symbol.search]?: {} | undefined;
@@ -355,6 +362,7 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
355
362
  readonly unicode?: boolean | undefined;
356
363
  readonly dotAll?: boolean | undefined;
357
364
  readonly hasIndices?: boolean | undefined;
365
+ readonly unicodeSets?: boolean | undefined;
358
366
  [Symbol.match]?: {} | undefined;
359
367
  [Symbol.replace]?: {} | undefined;
360
368
  [Symbol.search]?: {} | undefined;
@@ -366,292 +374,10 @@ export declare const getNewOptions: <S extends object = JSONSchema, O extends {
366
374
  } | undefined;
367
375
  continueOnError?: boolean | undefined;
368
376
  dereference?: {
369
- circular?: boolean | "ignore" | undefined;
377
+ circular?: (boolean | "ignore") | undefined;
370
378
  excludedPathMatcher?: {} | undefined;
371
379
  onDereference?: {} | undefined;
372
- externalReferenceResolution?: "relative" | "root" | undefined;
373
- } | undefined;
374
- mutateInputSchema?: boolean | undefined;
375
- timeoutMs?: number | undefined;
376
- } = {
377
- parse?: {
378
- [x: string]: boolean | {
379
- name?: string | undefined;
380
- order?: number | undefined;
381
- allowEmpty?: boolean | undefined;
382
- allowBOM?: boolean | undefined;
383
- encoding?: BufferEncoding | undefined;
384
- canParse?: string | boolean | {
385
- exec?: {} | undefined;
386
- test?: {} | undefined;
387
- readonly source?: string | undefined;
388
- readonly global?: boolean | undefined;
389
- readonly ignoreCase?: boolean | undefined;
390
- readonly multiline?: boolean | undefined;
391
- lastIndex?: number | undefined;
392
- compile?: {} | undefined;
393
- readonly flags?: string | undefined;
394
- readonly sticky?: boolean | undefined;
395
- readonly unicode?: boolean | undefined;
396
- readonly dotAll?: boolean | undefined;
397
- readonly hasIndices?: boolean | undefined;
398
- [Symbol.match]?: {} | undefined;
399
- [Symbol.replace]?: {} | undefined;
400
- [Symbol.search]?: {} | undefined;
401
- [Symbol.split]?: {} | undefined;
402
- [Symbol.matchAll]?: {} | undefined;
403
- } | (string | undefined)[] | {} | undefined;
404
- parse?: string | number | {} | undefined;
405
- } | undefined;
406
- json?: boolean | {
407
- name?: string | undefined;
408
- order?: number | undefined;
409
- allowEmpty?: boolean | undefined;
410
- allowBOM?: boolean | undefined;
411
- encoding?: BufferEncoding | undefined;
412
- canParse?: string | boolean | {
413
- exec?: {} | undefined;
414
- test?: {} | undefined;
415
- readonly source?: string | undefined;
416
- readonly global?: boolean | undefined;
417
- readonly ignoreCase?: boolean | undefined;
418
- readonly multiline?: boolean | undefined;
419
- lastIndex?: number | undefined;
420
- compile?: {} | undefined;
421
- readonly flags?: string | undefined;
422
- readonly sticky?: boolean | undefined;
423
- readonly unicode?: boolean | undefined;
424
- readonly dotAll?: boolean | undefined;
425
- readonly hasIndices?: boolean | undefined;
426
- [Symbol.match]?: {} | undefined;
427
- [Symbol.replace]?: {} | undefined;
428
- [Symbol.search]?: {} | undefined;
429
- [Symbol.split]?: {} | undefined;
430
- [Symbol.matchAll]?: {} | undefined;
431
- } | (string | undefined)[] | {} | undefined;
432
- parse?: string | number | {} | undefined;
433
- } | undefined;
434
- yaml?: boolean | {
435
- name?: string | undefined;
436
- order?: number | undefined;
437
- allowEmpty?: boolean | undefined;
438
- allowBOM?: boolean | undefined;
439
- encoding?: BufferEncoding | undefined;
440
- canParse?: string | boolean | {
441
- exec?: {} | undefined;
442
- test?: {} | undefined;
443
- readonly source?: string | undefined;
444
- readonly global?: boolean | undefined;
445
- readonly ignoreCase?: boolean | undefined;
446
- readonly multiline?: boolean | undefined;
447
- lastIndex?: number | undefined;
448
- compile?: {} | undefined;
449
- readonly flags?: string | undefined;
450
- readonly sticky?: boolean | undefined;
451
- readonly unicode?: boolean | undefined;
452
- readonly dotAll?: boolean | undefined;
453
- readonly hasIndices?: boolean | undefined;
454
- [Symbol.match]?: {} | undefined;
455
- [Symbol.replace]?: {} | undefined;
456
- [Symbol.search]?: {} | undefined;
457
- [Symbol.split]?: {} | undefined;
458
- [Symbol.matchAll]?: {} | undefined;
459
- } | (string | undefined)[] | {} | undefined;
460
- parse?: string | number | {} | undefined;
461
- } | undefined;
462
- binary?: boolean | {
463
- name?: string | undefined;
464
- order?: number | undefined;
465
- allowEmpty?: boolean | undefined;
466
- allowBOM?: boolean | undefined;
467
- encoding?: BufferEncoding | undefined;
468
- canParse?: string | boolean | {
469
- exec?: {} | undefined;
470
- test?: {} | undefined;
471
- readonly source?: string | undefined;
472
- readonly global?: boolean | undefined;
473
- readonly ignoreCase?: boolean | undefined;
474
- readonly multiline?: boolean | undefined;
475
- lastIndex?: number | undefined;
476
- compile?: {} | undefined;
477
- readonly flags?: string | undefined;
478
- readonly sticky?: boolean | undefined;
479
- readonly unicode?: boolean | undefined;
480
- readonly dotAll?: boolean | undefined;
481
- readonly hasIndices?: boolean | undefined;
482
- [Symbol.match]?: {} | undefined;
483
- [Symbol.replace]?: {} | undefined;
484
- [Symbol.search]?: {} | undefined;
485
- [Symbol.split]?: {} | undefined;
486
- [Symbol.matchAll]?: {} | undefined;
487
- } | (string | undefined)[] | {} | undefined;
488
- parse?: string | number | {} | undefined;
489
- } | undefined;
490
- text?: boolean | {
491
- name?: string | undefined;
492
- order?: number | undefined;
493
- allowEmpty?: boolean | undefined;
494
- allowBOM?: boolean | undefined;
495
- encoding?: BufferEncoding | undefined;
496
- canParse?: string | boolean | {
497
- exec?: {} | undefined;
498
- test?: {} | undefined;
499
- readonly source?: string | undefined;
500
- readonly global?: boolean | undefined;
501
- readonly ignoreCase?: boolean | undefined;
502
- readonly multiline?: boolean | undefined;
503
- lastIndex?: number | undefined;
504
- compile?: {} | undefined;
505
- readonly flags?: string | undefined;
506
- readonly sticky?: boolean | undefined;
507
- readonly unicode?: boolean | undefined;
508
- readonly dotAll?: boolean | undefined;
509
- readonly hasIndices?: boolean | undefined;
510
- [Symbol.match]?: {} | undefined;
511
- [Symbol.replace]?: {} | undefined;
512
- [Symbol.search]?: {} | undefined;
513
- [Symbol.split]?: {} | undefined;
514
- [Symbol.matchAll]?: {} | undefined;
515
- } | (string | undefined)[] | {} | undefined;
516
- parse?: string | number | {} | undefined;
517
- } | undefined;
518
- } | undefined;
519
- resolve?: {
520
- [x: string]: boolean | {
521
- name?: string | undefined;
522
- order?: number | undefined;
523
- canRead?: string | boolean | {
524
- exec?: {} | undefined;
525
- test?: {} | undefined;
526
- readonly source?: string | undefined;
527
- readonly global?: boolean | undefined;
528
- readonly ignoreCase?: boolean | undefined;
529
- readonly multiline?: boolean | undefined;
530
- lastIndex?: number | undefined;
531
- compile?: {} | undefined;
532
- readonly flags?: string | undefined;
533
- readonly sticky?: boolean | undefined;
534
- readonly unicode?: boolean | undefined;
535
- readonly dotAll?: boolean | undefined;
536
- readonly hasIndices?: boolean | undefined;
537
- [Symbol.match]?: {} | undefined;
538
- [Symbol.replace]?: {} | undefined;
539
- [Symbol.search]?: {} | undefined;
540
- [Symbol.split]?: {} | undefined;
541
- [Symbol.matchAll]?: {} | undefined;
542
- } | (string | undefined)[] | {} | undefined;
543
- read?: string | object | {} | undefined;
544
- } | {
545
- headers?: ([(string | undefined)?, (string | undefined)?] | undefined)[] | {
546
- [x: string]: string | undefined;
547
- } | {
548
- append?: {} | undefined;
549
- delete?: {} | undefined;
550
- get?: {} | undefined;
551
- getSetCookie?: {} | undefined;
552
- has?: {} | undefined;
553
- set?: {} | undefined;
554
- forEach?: {} | undefined;
555
- } | null | undefined;
556
- timeout?: number | undefined;
557
- redirects?: number | undefined;
558
- withCredentials?: boolean | undefined;
559
- name?: string | undefined;
560
- order?: number | undefined;
561
- canRead?: string | boolean | {
562
- exec?: {} | undefined;
563
- test?: {} | undefined;
564
- readonly source?: string | undefined;
565
- readonly global?: boolean | undefined;
566
- readonly ignoreCase?: boolean | undefined;
567
- readonly multiline?: boolean | undefined;
568
- lastIndex?: number | undefined;
569
- compile?: {} | undefined;
570
- readonly flags?: string | undefined;
571
- readonly sticky?: boolean | undefined;
572
- readonly unicode?: boolean | undefined;
573
- readonly dotAll?: boolean | undefined;
574
- readonly hasIndices?: boolean | undefined;
575
- [Symbol.match]?: {} | undefined;
576
- [Symbol.replace]?: {} | undefined;
577
- [Symbol.search]?: {} | undefined;
578
- [Symbol.split]?: {} | undefined;
579
- [Symbol.matchAll]?: {} | undefined;
580
- } | (string | undefined)[] | {} | undefined;
581
- read?: string | object | {} | undefined;
582
- } | undefined;
583
- external?: boolean | undefined;
584
- file?: boolean | {
585
- name?: string | undefined;
586
- order?: number | undefined;
587
- canRead?: string | boolean | {
588
- exec?: {} | undefined;
589
- test?: {} | undefined;
590
- readonly source?: string | undefined;
591
- readonly global?: boolean | undefined;
592
- readonly ignoreCase?: boolean | undefined;
593
- readonly multiline?: boolean | undefined;
594
- lastIndex?: number | undefined;
595
- compile?: {} | undefined;
596
- readonly flags?: string | undefined;
597
- readonly sticky?: boolean | undefined;
598
- readonly unicode?: boolean | undefined;
599
- readonly dotAll?: boolean | undefined;
600
- readonly hasIndices?: boolean | undefined;
601
- [Symbol.match]?: {} | undefined;
602
- [Symbol.replace]?: {} | undefined;
603
- [Symbol.search]?: {} | undefined;
604
- [Symbol.split]?: {} | undefined;
605
- [Symbol.matchAll]?: {} | undefined;
606
- } | (string | undefined)[] | {} | undefined;
607
- read?: string | object | {} | undefined;
608
- } | undefined;
609
- http?: boolean | {
610
- headers?: ([(string | undefined)?, (string | undefined)?] | undefined)[] | {
611
- [x: string]: string | undefined;
612
- } | {
613
- append?: {} | undefined;
614
- delete?: {} | undefined;
615
- get?: {} | undefined;
616
- getSetCookie?: {} | undefined;
617
- has?: {} | undefined;
618
- set?: {} | undefined;
619
- forEach?: {} | undefined;
620
- } | null | undefined;
621
- timeout?: number | undefined;
622
- redirects?: number | undefined;
623
- withCredentials?: boolean | undefined;
624
- name?: string | undefined;
625
- order?: number | undefined;
626
- canRead?: string | boolean | {
627
- exec?: {} | undefined;
628
- test?: {} | undefined;
629
- readonly source?: string | undefined;
630
- readonly global?: boolean | undefined;
631
- readonly ignoreCase?: boolean | undefined;
632
- readonly multiline?: boolean | undefined;
633
- lastIndex?: number | undefined;
634
- compile?: {} | undefined;
635
- readonly flags?: string | undefined;
636
- readonly sticky?: boolean | undefined;
637
- readonly unicode?: boolean | undefined;
638
- readonly dotAll?: boolean | undefined;
639
- readonly hasIndices?: boolean | undefined;
640
- [Symbol.match]?: {} | undefined;
641
- [Symbol.replace]?: {} | undefined;
642
- [Symbol.search]?: {} | undefined;
643
- [Symbol.split]?: {} | undefined;
644
- [Symbol.matchAll]?: {} | undefined;
645
- } | (string | undefined)[] | {} | undefined;
646
- read?: string | object | {} | undefined;
647
- } | undefined;
648
- } | undefined;
649
- continueOnError?: boolean | undefined;
650
- dereference?: {
651
- circular?: boolean | "ignore" | undefined;
652
- excludedPathMatcher?: {} | undefined;
653
- onDereference?: {} | undefined;
654
- externalReferenceResolution?: "relative" | "root" | undefined;
380
+ externalReferenceResolution?: ("relative" | "root") | undefined;
655
381
  } | undefined;
656
382
  mutateInputSchema?: boolean | undefined;
657
383
  timeoutMs?: number | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type $Refs from "./refs.js";
3
2
  import type { ParserOptions } from "./options.js";
4
3
  import type { JSONSchema } from "./types/index.js";
package/dist/lib/ref.js CHANGED
@@ -52,7 +52,7 @@ class $Ref {
52
52
  this.resolve(path, options);
53
53
  return true;
54
54
  }
55
- catch (e) {
55
+ catch {
56
56
  return false;
57
57
  }
58
58
  }
package/dist/lib/refs.js CHANGED
@@ -85,7 +85,7 @@ class $Refs {
85
85
  this._resolve(path, "", options);
86
86
  return true;
87
87
  }
88
- catch (e) {
88
+ catch {
89
89
  return false;
90
90
  }
91
91
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { JSONSchema4, JSONSchema4Object, JSONSchema6, JSONSchema6Object, JSONSchema7, JSONSchema7Object } from "json-schema";
3
2
  import type $Refs from "../refs.js";
4
3
  import type { ParserOptions } from "../options";
@@ -13,7 +12,7 @@ export interface HTTPResolverOptions<S extends object = JSONSchema> extends Part
13
12
  /**
14
13
  * 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.
15
14
  */
16
- headers?: HeadersInit | null;
15
+ headers?: RequestInit["headers"] | null;
17
16
  /**
18
17
  * The amount of time (in milliseconds) to wait for a response from the server when downloading files. The default is 5 seconds.
19
18
  */
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = convertPathToPosix;
6
7
  const path_1 = __importDefault(require("path"));
7
8
  function convertPathToPosix(filePath) {
8
9
  const isExtendedLengthPath = filePath.startsWith("\\\\?\\");
@@ -11,4 +12,3 @@ function convertPathToPosix(filePath) {
11
12
  }
12
13
  return filePath.split(path_1.default?.win32?.sep).join(path_1.default?.posix?.sep ?? "/");
13
14
  }
14
- exports.default = convertPathToPosix;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeError = exports.isHandledError = exports.InvalidPointerError = exports.TimeoutError = exports.MissingPointerError = exports.UnmatchedResolverError = exports.ResolverError = exports.UnmatchedParserError = exports.ParserError = exports.JSONParserErrorGroup = exports.JSONParserError = void 0;
3
+ exports.InvalidPointerError = exports.TimeoutError = exports.MissingPointerError = exports.UnmatchedResolverError = exports.ResolverError = exports.UnmatchedParserError = exports.ParserError = exports.JSONParserErrorGroup = exports.JSONParserError = void 0;
4
+ exports.isHandledError = isHandledError;
5
+ exports.normalizeError = normalizeError;
4
6
  const ono_1 = require("@jsdevtools/ono");
5
7
  const url_js_1 = require("./url.js");
6
8
  class JSONParserError extends Error {
@@ -102,11 +104,9 @@ exports.InvalidPointerError = InvalidPointerError;
102
104
  function isHandledError(err) {
103
105
  return err instanceof JSONParserError || err instanceof JSONParserErrorGroup;
104
106
  }
105
- exports.isHandledError = isHandledError;
106
107
  function normalizeError(err) {
107
108
  if (err.path === null) {
108
109
  err.path = [];
109
110
  }
110
111
  return err;
111
112
  }
112
- exports.normalizeError = normalizeError;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = maybe;
6
7
  const next_js_1 = __importDefault(require("./next.js"));
7
8
  function maybe(cb, promise) {
8
9
  if (cb) {
@@ -21,4 +22,3 @@ function maybe(cb, promise) {
21
22
  return promise;
22
23
  }
23
24
  }
24
- exports.default = maybe;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { FileInfo, JSONSchema } from "../types/index.js";
3
2
  import type { ParserOptions } from "../options.js";
4
3
  import type { ResolverOptions } from "../types/index.js";
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = exports.sort = exports.filter = exports.all = void 0;
3
+ exports.all = all;
4
+ exports.filter = filter;
5
+ exports.sort = sort;
6
+ exports.run = run;
4
7
  /**
5
8
  * Returns the given plugins as an array, rather than an object map.
6
9
  * All other methods in this module expect an array of plugins rather than an object map.
@@ -17,7 +20,6 @@ function all(plugins) {
17
20
  return plugins[key];
18
21
  });
19
22
  }
20
- exports.all = all;
21
23
  /**
22
24
  * Filters the given plugins, returning only the ones return `true` for the given method.
23
25
  */
@@ -26,7 +28,6 @@ function filter(plugins, method, file) {
26
28
  return !!getResult(plugin, method, file);
27
29
  });
28
30
  }
29
- exports.filter = filter;
30
31
  /**
31
32
  * Sorts the given plugins, in place, by their `order` property.
32
33
  */
@@ -38,7 +39,6 @@ function sort(plugins) {
38
39
  return a.order - b.order;
39
40
  });
40
41
  }
41
- exports.sort = sort;
42
42
  /**
43
43
  * Runs the specified method of the given plugins, in order, until one of them returns a successful result.
44
44
  * Each method can return a synchronous value, a Promise, or call an error-first callback.
@@ -103,7 +103,6 @@ async function run(plugins, method, file, $refs) {
103
103
  }
104
104
  });
105
105
  }
106
- exports.run = run;
107
106
  /**
108
107
  * Returns the value of the given property.
109
108
  * If the property is a function, then the result of the function is returned.
@@ -26,7 +26,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.relative = exports.safePointerToPath = exports.toFileSystemPath = exports.fromFileSystemPath = exports.isFileSystemPath = exports.isHttp = exports.stripHash = exports.getHash = exports.stripQuery = exports.getExtension = exports.getProtocol = exports.cwd = exports.resolve = exports.parse = void 0;
29
+ exports.parse = void 0;
30
+ exports.resolve = resolve;
31
+ exports.cwd = cwd;
32
+ exports.getProtocol = getProtocol;
33
+ exports.getExtension = getExtension;
34
+ exports.stripQuery = stripQuery;
35
+ exports.getHash = getHash;
36
+ exports.stripHash = stripHash;
37
+ exports.isHttp = isHttp;
38
+ exports.isFileSystemPath = isFileSystemPath;
39
+ exports.fromFileSystemPath = fromFileSystemPath;
40
+ exports.toFileSystemPath = toFileSystemPath;
41
+ exports.safePointerToPath = safePointerToPath;
42
+ exports.relative = relative;
30
43
  const convert_path_to_posix_1 = __importDefault(require("./convert-path-to-posix"));
31
44
  const path_1 = __importStar(require("path"));
32
45
  const forwardSlashPattern = /\//g;
@@ -60,7 +73,6 @@ function resolve(from, to) {
60
73
  }
61
74
  return resolvedUrl.toString() + endSpaces;
62
75
  }
63
- exports.resolve = resolve;
64
76
  /**
65
77
  * Returns the current working directory (in Node) or the current page URL (in browsers).
66
78
  *
@@ -79,7 +91,6 @@ function cwd() {
79
91
  return path + "/";
80
92
  }
81
93
  }
82
- exports.cwd = cwd;
83
94
  /**
84
95
  * Returns the protocol of the given URL, or `undefined` if it has no protocol.
85
96
  *
@@ -93,7 +104,6 @@ function getProtocol(path) {
93
104
  }
94
105
  return undefined;
95
106
  }
96
- exports.getProtocol = getProtocol;
97
107
  /**
98
108
  * Returns the lowercased file extension of the given URL,
99
109
  * or an empty string if it has no extension.
@@ -108,7 +118,6 @@ function getExtension(path) {
108
118
  }
109
119
  return "";
110
120
  }
111
- exports.getExtension = getExtension;
112
121
  /**
113
122
  * Removes the query, if any, from the given path.
114
123
  *
@@ -122,7 +131,6 @@ function stripQuery(path) {
122
131
  }
123
132
  return path;
124
133
  }
125
- exports.stripQuery = stripQuery;
126
134
  /**
127
135
  * Returns the hash (URL fragment), of the given path.
128
136
  * If there is no hash, then the root hash ("#") is returned.
@@ -140,7 +148,6 @@ function getHash(path) {
140
148
  }
141
149
  return "#";
142
150
  }
143
- exports.getHash = getHash;
144
151
  /**
145
152
  * Removes the hash (URL fragment), if any, from the given path.
146
153
  *
@@ -157,7 +164,6 @@ function stripHash(path) {
157
164
  }
158
165
  return path;
159
166
  }
160
- exports.stripHash = stripHash;
161
167
  /**
162
168
  * Determines whether the given path is an HTTP(S) URL.
163
169
  *
@@ -178,7 +184,6 @@ function isHttp(path) {
178
184
  return false;
179
185
  }
180
186
  }
181
- exports.isHttp = isHttp;
182
187
  /**
183
188
  * Determines whether the given path is a filesystem path.
184
189
  * This includes "file://" URLs.
@@ -188,7 +193,7 @@ exports.isHttp = isHttp;
188
193
  */
189
194
  function isFileSystemPath(path) {
190
195
  // @ts-ignore
191
- if (typeof window !== "undefined" || process.browser) {
196
+ if (typeof window !== "undefined" || (typeof process !== "undefined" && process.browser)) {
192
197
  // We're running in a browser, so assume that all paths are URLs.
193
198
  // This way, even relative paths will be treated as URLs rather than as filesystem paths
194
199
  return false;
@@ -196,7 +201,6 @@ function isFileSystemPath(path) {
196
201
  const protocol = getProtocol(path);
197
202
  return protocol === undefined || protocol === "file";
198
203
  }
199
- exports.isFileSystemPath = isFileSystemPath;
200
204
  /**
201
205
  * Converts a filesystem path to a properly-encoded URL.
202
206
  *
@@ -242,7 +246,6 @@ function fromFileSystemPath(path) {
242
246
  }
243
247
  return path;
244
248
  }
245
- exports.fromFileSystemPath = fromFileSystemPath;
246
249
  /**
247
250
  * Converts a URL to a local filesystem path.
248
251
  */
@@ -288,7 +291,6 @@ function toFileSystemPath(path, keepFileProtocol) {
288
291
  }
289
292
  return path;
290
293
  }
291
- exports.toFileSystemPath = toFileSystemPath;
292
294
  /**
293
295
  * Converts a $ref pointer to a valid JSON Path.
294
296
  *
@@ -306,7 +308,6 @@ function safePointerToPath(pointer) {
306
308
  return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
307
309
  });
308
310
  }
309
- exports.safePointerToPath = safePointerToPath;
310
311
  function relative(from, to) {
311
312
  if (!isFileSystemPath(from) || !isFileSystemPath(to)) {
312
313
  return resolve(from, to);
@@ -316,4 +317,3 @@ function relative(from, to) {
316
317
  const result = path_1.default.relative(fromDir, toPath);
317
318
  return result + getHash(to);
318
319
  }
319
- exports.relative = relative;
package/lib/bundle.ts CHANGED
@@ -87,7 +87,6 @@ function crawl<S extends object = JSONSchema, O extends ParserOptions<S> = Parse
87
87
  }
88
88
  }) as (keyof typeof obj)[];
89
89
 
90
- // eslint-disable-next-line no-shadow
91
90
  for (const key of keys) {
92
91
  const keyPath = Pointer.join(path, key);
93
92
  const keyPathFromRoot = Pointer.join(pathFromRoot, key);
@@ -290,7 +289,7 @@ function findInInventory(inventory: InventoryEntry[], $refParent: any, $refKey:
290
289
  return existingEntry;
291
290
  }
292
291
  }
293
- return undefined
292
+ return undefined;
294
293
  }
295
294
 
296
295
  function removeFromInventory(inventory: InventoryEntry[], entry: any) {
@@ -221,7 +221,9 @@ function dereference$Ref<S extends object = JSONSchema, O extends ParserOptions<
221
221
  // Check for circular references
222
222
  const directCircular = pointer.circular;
223
223
  let circular = directCircular || parents.has(pointer.value);
224
- circular && foundCircularReference(path, $refs, options);
224
+ if (circular) {
225
+ foundCircularReference(path, $refs, options);
226
+ }
225
227
 
226
228
  // Dereference the JSON reference
227
229
  let dereferencedValue = $Ref.dereference($ref, pointer.value);
package/lib/pointer.ts CHANGED
@@ -284,7 +284,7 @@ function resolveIf$Ref(pointer: any, options: any, pathFromRoot?: any) {
284
284
  return true;
285
285
  }
286
286
  }
287
- return undefined
287
+ return undefined;
288
288
  }
289
289
  export default Pointer;
290
290
 
package/lib/ref.ts CHANGED
@@ -91,7 +91,7 @@ class $Ref<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOpt
91
91
  try {
92
92
  this.resolve(path, options);
93
93
  return true;
94
- } catch (e) {
94
+ } catch {
95
95
  return false;
96
96
  }
97
97
  }
@@ -195,7 +195,7 @@ class $Ref<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOpt
195
195
  return true;
196
196
  }
197
197
  }
198
- return undefined
198
+ return undefined;
199
199
  }
200
200
 
201
201
  /**
package/lib/refs.ts CHANGED
@@ -72,7 +72,7 @@ export default class $Refs<S extends object = JSONSchema, O extends ParserOption
72
72
  try {
73
73
  this._resolve(path, "", options);
74
74
  return true;
75
- } catch (e) {
75
+ } catch {
76
76
  return false;
77
77
  }
78
78
  }
@@ -25,7 +25,7 @@ export interface HTTPResolverOptions<S extends object = JSONSchema> extends Part
25
25
  /**
26
26
  * 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.
27
27
  */
28
- headers?: HeadersInit | null;
28
+ headers?: RequestInit["headers"] | null;
29
29
 
30
30
  /**
31
31
  * The amount of time (in milliseconds) to wait for a response from the server when downloading files. The default is 5 seconds.
package/lib/util/url.ts CHANGED
@@ -163,7 +163,7 @@ export function isHttp(path: string) {
163
163
  */
164
164
  export function isFileSystemPath(path: string | undefined) {
165
165
  // @ts-ignore
166
- if (typeof window !== "undefined" || process.browser) {
166
+ if (typeof window !== "undefined" || (typeof process !== "undefined" && process.browser)) {
167
167
  // We're running in a browser, so assume that all paths are URLs.
168
168
  // This way, even relative paths will be treated as URLs rather than as filesystem paths
169
169
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apidevtools/json-schema-ref-parser",
3
- "version": "11.6.3",
3
+ "version": "11.6.5",
4
4
  "description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
5
5
  "keywords": [
6
6
  "json",
@@ -67,25 +67,29 @@
67
67
  "test:watch": "vitest -w"
68
68
  },
69
69
  "devDependencies": {
70
- "@types/eslint": "8.56.10",
70
+ "@eslint/compat": "^1.1.1",
71
+ "@eslint/js": "^9.8.0",
72
+ "@types/eslint": "9.6.0",
71
73
  "@types/js-yaml": "^4.0.9",
72
- "@types/node": "^18",
73
- "@typescript-eslint/eslint-plugin": "^7.9.0",
74
- "@typescript-eslint/parser": "^7.9.0",
75
- "@vitest/coverage-v8": "^1.6.0",
74
+ "@types/node": "^22",
75
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
76
+ "@typescript-eslint/parser": "^8.0.0",
77
+ "@vitest/coverage-v8": "^2.0.5",
76
78
  "cross-env": "^7.0.3",
77
- "eslint": "^8.57.0",
79
+ "eslint": "^9.8.0",
78
80
  "eslint-config-prettier": "^9.1.0",
79
81
  "eslint-config-standard": "^17.1.0",
80
82
  "eslint-plugin-import": "^2.29.1",
81
- "eslint-plugin-prettier": "^5.1.3",
82
- "eslint-plugin-promise": "^6.1.1",
83
- "eslint-plugin-unused-imports": "^3.2.0",
84
- "jsdom": "^24.1.0",
85
- "prettier": "^3.3.0",
86
- "rimraf": "^5.0.7",
87
- "typescript": "^5.4.5",
88
- "vitest": "^1.6.0"
83
+ "eslint-plugin-prettier": "^5.2.1",
84
+ "eslint-plugin-promise": "^7.0.0",
85
+ "eslint-plugin-unused-imports": "^4.0.1",
86
+ "globals": "^15.9.0",
87
+ "jsdom": "^24.1.1",
88
+ "prettier": "^3.3.3",
89
+ "rimraf": "^6.0.1",
90
+ "typescript": "^5.5.4",
91
+ "typescript-eslint": "^8.0.0",
92
+ "vitest": "^2.0.5"
89
93
  },
90
94
  "dependencies": {
91
95
  "@jsdevtools/ono": "^7.1.3",