@apidevtools/json-schema-ref-parser 13.0.1 → 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.
@@ -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/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.1",
3
+ "version": "13.0.2",
4
4
  "description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",