@apidevtools/json-schema-ref-parser 13.0.0 → 13.0.2

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.
@@ -159,4 +159,4 @@ export declare const parse: typeof $RefParser.parse;
159
159
  export declare const resolve: typeof $RefParser.resolve;
160
160
  export declare const bundle: typeof $RefParser.bundle;
161
161
  export declare const dereference: typeof $RefParser.dereference;
162
- export { UnmatchedResolverError, JSONParserError, JSONSchema, InvalidPointerError, MissingPointerError, ResolverError, ParserError, UnmatchedParserError, ParserOptions, $RefsCallback, isHandledError, JSONParserErrorGroup, SchemaCallback, FileInfo, Plugin, ResolverOptions, HTTPResolverOptions, _dereference as dereferenceInternal, normalizeArgs as jsonSchemaParserNormalizeArgs, getJsonSchemaRefParserDefaultOptions, };
162
+ export { UnmatchedResolverError, JSONParserError, JSONSchema, InvalidPointerError, MissingPointerError, ResolverError, ParserError, UnmatchedParserError, ParserOptions, $RefsCallback, isHandledError, JSONParserErrorGroup, SchemaCallback, FileInfo, Plugin, ResolverOptions, HTTPResolverOptions, _dereference as dereferenceInternal, normalizeArgs as jsonSchemaParserNormalizeArgs, getJsonSchemaRefParserDefaultOptions, $Refs, };
package/dist/lib/index.js CHANGED
@@ -36,8 +36,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getJsonSchemaRefParserDefaultOptions = exports.jsonSchemaParserNormalizeArgs = exports.dereferenceInternal = exports.JSONParserErrorGroup = exports.isHandledError = exports.UnmatchedParserError = exports.ParserError = exports.ResolverError = exports.MissingPointerError = exports.InvalidPointerError = exports.JSONParserError = exports.UnmatchedResolverError = exports.dereference = exports.bundle = exports.resolve = exports.parse = exports.$RefParser = void 0;
39
+ exports.$Refs = exports.getJsonSchemaRefParserDefaultOptions = exports.jsonSchemaParserNormalizeArgs = exports.dereferenceInternal = exports.JSONParserErrorGroup = exports.isHandledError = exports.UnmatchedParserError = exports.ParserError = exports.ResolverError = exports.MissingPointerError = exports.InvalidPointerError = exports.JSONParserError = exports.UnmatchedResolverError = exports.dereference = exports.bundle = exports.resolve = exports.parse = exports.$RefParser = void 0;
40
40
  const refs_js_1 = __importDefault(require("./refs.js"));
41
+ exports.$Refs = refs_js_1.default;
41
42
  const parse_js_1 = __importDefault(require("./parse.js"));
42
43
  const normalize_args_js_1 = __importDefault(require("./normalize-args.js"));
43
44
  exports.jsonSchemaParserNormalizeArgs = normalize_args_js_1.default;
@@ -90,17 +90,20 @@ function resolve(from, to) {
90
90
  * @returns
91
91
  */
92
92
  function cwd() {
93
- if (typeof window !== "undefined") {
93
+ if (typeof window !== "undefined" && window.location) {
94
94
  return location.href;
95
95
  }
96
- const path = process.cwd();
97
- const lastChar = path.slice(-1);
98
- if (lastChar === "/" || lastChar === "\\") {
99
- return path;
100
- }
101
- else {
102
- return path + "/";
96
+ if (typeof process !== "undefined" && process.cwd) {
97
+ const path = process.cwd();
98
+ const lastChar = path.slice(-1);
99
+ if (lastChar === "/" || lastChar === "\\") {
100
+ return path;
101
+ }
102
+ else {
103
+ return path + "/";
104
+ }
103
105
  }
106
+ return "/";
104
107
  }
105
108
  /**
106
109
  * Returns the protocol of the given URL, or `undefined` if it has no protocol.
package/lib/index.ts CHANGED
@@ -438,4 +438,5 @@ export {
438
438
  _dereference as dereferenceInternal,
439
439
  normalizeArgs as jsonSchemaParserNormalizeArgs,
440
440
  getJsonSchemaRefParserDefaultOptions,
441
+ $Refs,
441
442
  };
package/lib/util/url.ts CHANGED
@@ -44,18 +44,21 @@ export function resolve(from: string, to: string) {
44
44
  * @returns
45
45
  */
46
46
  export function cwd() {
47
- if (typeof window !== "undefined") {
47
+ if (typeof window !== "undefined" && window.location) {
48
48
  return location.href;
49
49
  }
50
50
 
51
- const path = process.cwd();
51
+ if (typeof process !== "undefined" && process.cwd) {
52
+ const path = process.cwd();
52
53
 
53
- const lastChar = path.slice(-1);
54
- if (lastChar === "/" || lastChar === "\\") {
55
- return path;
56
- } else {
57
- return path + "/";
54
+ const lastChar = path.slice(-1);
55
+ if (lastChar === "/" || lastChar === "\\") {
56
+ return path;
57
+ } else {
58
+ return path + "/";
59
+ }
58
60
  }
61
+ return "/";
59
62
  }
60
63
 
61
64
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apidevtools/json-schema-ref-parser",
3
- "version": "13.0.0",
3
+ "version": "13.0.2",
4
4
  "description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",