11"use strict" ;
22
3- const Options = require ( "./options" ) ;
43const $Refs = require ( "./refs" ) ;
5- const parse = require ( "./parse" ) ;
4+ const _parse = require ( "./parse" ) ;
65const normalizeArgs = require ( "./normalize-args" ) ;
76const resolveExternal = require ( "./resolve-external" ) ;
8- const bundle = require ( "./bundle" ) ;
9- const dereference = require ( "./dereference" ) ;
7+ const _bundle = require ( "./bundle" ) ;
8+ const _dereference = require ( "./dereference" ) ;
109const url = require ( "./util/url" ) ;
1110const { JSONParserError, InvalidPointerError, MissingPointerError, ResolverError, ParserError, UnmatchedParserError, UnmatchedResolverError, isHandledError, JSONParserErrorGroup } = require ( "./util/errors" ) ;
1211const maybe = require ( "call-me-maybe" ) ;
1312const { ono } = require ( "@jsdevtools/ono" ) ;
1413
1514module . exports = $RefParser ;
15+ module . exports . default = $RefParser ;
1616module . exports . JSONParserError = JSONParserError ;
1717module . exports . InvalidPointerError = InvalidPointerError ;
1818module . exports . MissingPointerError = MissingPointerError ;
@@ -56,7 +56,7 @@ function $RefParser () {
5656 * @param {function } [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
5757 * @returns {Promise } - The returned promise resolves with the parsed JSON schema object.
5858 */
59- $RefParser . parse = function ( path , schema , options , callback ) {
59+ $RefParser . parse = function parse ( path , schema , options , callback ) {
6060 let Class = this ; // eslint-disable-line consistent-this
6161 let instance = new Class ( ) ;
6262 return instance . parse . apply ( instance , arguments ) ;
@@ -73,7 +73,7 @@ $RefParser.parse = function (path, schema, options, callback) {
7373 * @param {function } [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
7474 * @returns {Promise } - The returned promise resolves with the parsed JSON schema object.
7575 */
76- $RefParser . prototype . parse = async function ( path , schema , options , callback ) {
76+ $RefParser . prototype . parse = async function parse ( path , schema , options , callback ) {
7777 let args = normalizeArgs ( arguments ) ;
7878 let promise ;
7979
@@ -111,7 +111,7 @@ $RefParser.prototype.parse = async function (path, schema, options, callback) {
111111 }
112112 else {
113113 // Parse the schema file/url
114- promise = parse ( args . path , this . $refs , args . options ) ;
114+ promise = _parse ( args . path , this . $refs , args . options ) ;
115115 }
116116
117117 let me = this ;
@@ -156,7 +156,7 @@ $RefParser.prototype.parse = async function (path, schema, options, callback) {
156156 * @returns {Promise }
157157 * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references
158158 */
159- $RefParser . resolve = function ( path , schema , options , callback ) {
159+ $RefParser . resolve = function resolve ( path , schema , options , callback ) {
160160 let Class = this ; // eslint-disable-line consistent-this
161161 let instance = new Class ( ) ;
162162 return instance . resolve . apply ( instance , arguments ) ;
@@ -175,7 +175,7 @@ $RefParser.resolve = function (path, schema, options, callback) {
175175 * @returns {Promise }
176176 * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references
177177 */
178- $RefParser . prototype . resolve = async function ( path , schema , options , callback ) {
178+ $RefParser . prototype . resolve = async function resolve ( path , schema , options , callback ) {
179179 let me = this ;
180180 let args = normalizeArgs ( arguments ) ;
181181
@@ -201,7 +201,7 @@ $RefParser.prototype.resolve = async function (path, schema, options, callback)
201201 * @param {function } [callback] - An error-first callback. The second parameter is the bundled JSON schema object
202202 * @returns {Promise } - The returned promise resolves with the bundled JSON schema object.
203203 */
204- $RefParser . bundle = function ( path , schema , options , callback ) {
204+ $RefParser . bundle = function bundle ( path , schema , options , callback ) {
205205 let Class = this ; // eslint-disable-line consistent-this
206206 let instance = new Class ( ) ;
207207 return instance . bundle . apply ( instance , arguments ) ;
@@ -218,13 +218,13 @@ $RefParser.bundle = function (path, schema, options, callback) {
218218 * @param {function } [callback] - An error-first callback. The second parameter is the bundled JSON schema object
219219 * @returns {Promise } - The returned promise resolves with the bundled JSON schema object.
220220 */
221- $RefParser . prototype . bundle = async function ( path , schema , options , callback ) {
221+ $RefParser . prototype . bundle = async function bundle ( path , schema , options , callback ) {
222222 let me = this ;
223223 let args = normalizeArgs ( arguments ) ;
224224
225225 try {
226226 await this . resolve ( args . path , args . schema , args . options ) ;
227- bundle ( me , args . options ) ;
227+ _bundle ( me , args . options ) ;
228228 finalize ( me ) ;
229229 return maybe ( args . callback , Promise . resolve ( me . schema ) ) ;
230230 }
@@ -243,7 +243,7 @@ $RefParser.prototype.bundle = async function (path, schema, options, callback) {
243243 * @param {function } [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
244244 * @returns {Promise } - The returned promise resolves with the dereferenced JSON schema object.
245245 */
246- $RefParser . dereference = function ( path , schema , options , callback ) {
246+ $RefParser . dereference = function dereference ( path , schema , options , callback ) {
247247 let Class = this ; // eslint-disable-line consistent-this
248248 let instance = new Class ( ) ;
249249 return instance . dereference . apply ( instance , arguments ) ;
@@ -259,13 +259,13 @@ $RefParser.dereference = function (path, schema, options, callback) {
259259 * @param {function } [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object
260260 * @returns {Promise } - The returned promise resolves with the dereferenced JSON schema object.
261261 */
262- $RefParser . prototype . dereference = async function ( path , schema , options , callback ) {
262+ $RefParser . prototype . dereference = async function dereference ( path , schema , options , callback ) {
263263 let me = this ;
264264 let args = normalizeArgs ( arguments ) ;
265265
266266 try {
267267 await this . resolve ( args . path , args . schema , args . options ) ;
268- dereference ( me , args . options ) ;
268+ _dereference ( me , args . options ) ;
269269 finalize ( me ) ;
270270 return maybe ( args . callback , Promise . resolve ( me . schema ) ) ;
271271 }
0 commit comments