@scalar/oas-utils 0.2.80 → 0.2.82
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.82
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6389557: feat: allow to pass a base URL to makeUrlAbsolute
|
|
8
|
+
- Updated dependencies [baaad1c]
|
|
9
|
+
- Updated dependencies [c984ac8]
|
|
10
|
+
- @scalar/types@0.0.22
|
|
11
|
+
- @scalar/themes@0.9.53
|
|
12
|
+
|
|
13
|
+
## 0.2.81
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [1fa0d20]
|
|
18
|
+
- @scalar/themes@0.9.52
|
|
19
|
+
|
|
3
20
|
## 0.2.80
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pass an URL or a relative URL and get an absolute URL
|
|
3
3
|
*/
|
|
4
|
-
export declare const makeUrlAbsolute: (url?: string) => string | undefined;
|
|
4
|
+
export declare const makeUrlAbsolute: (url?: string, baseUrl?: string) => string | undefined;
|
|
5
5
|
//# sourceMappingURL=makeUrlAbsolute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeUrlAbsolute.d.ts","sourceRoot":"","sources":["../../src/helpers/makeUrlAbsolute.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,SAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"makeUrlAbsolute.d.ts","sourceRoot":"","sources":["../../src/helpers/makeUrlAbsolute.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,SAAU,MAAM,YAAY,MAAM,uBAsB7D,CAAA"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pass an URL or a relative URL and get an absolute URL
|
|
3
3
|
*/
|
|
4
|
-
const makeUrlAbsolute = (url) => {
|
|
4
|
+
const makeUrlAbsolute = (url, baseUrl) => {
|
|
5
5
|
if (!url ||
|
|
6
6
|
url.startsWith('http://') ||
|
|
7
7
|
url.startsWith('https://') ||
|
|
8
|
-
typeof window === 'undefined')
|
|
8
|
+
(typeof window === 'undefined' && !baseUrl)) {
|
|
9
9
|
return url;
|
|
10
|
-
|
|
10
|
+
}
|
|
11
|
+
const base = baseUrl || window.location.href;
|
|
11
12
|
// Remove any query parameters or hash from the base URL
|
|
12
|
-
const cleanBaseUrl =
|
|
13
|
+
const cleanBaseUrl = base.split('?')[0]?.split('#')[0];
|
|
13
14
|
// For base URLs with a path component, we want to remove the last path segment
|
|
14
15
|
// if it doesn't end with a slash
|
|
15
16
|
const normalizedBaseUrl = cleanBaseUrl?.endsWith('/')
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.82",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -112,18 +112,18 @@
|
|
|
112
112
|
"yaml": "^2.4.5",
|
|
113
113
|
"zod": "^3.23.8",
|
|
114
114
|
"@scalar/object-utils": "1.1.12",
|
|
115
|
-
"@scalar/types": "0.0.21",
|
|
116
115
|
"@scalar/openapi-types": "0.1.5",
|
|
117
|
-
"@scalar/themes": "0.9.
|
|
116
|
+
"@scalar/themes": "0.9.53",
|
|
117
|
+
"@scalar/types": "0.0.22"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
120
|
"type-fest": "^4.20.0",
|
|
121
121
|
"vite": "^5.4.10",
|
|
122
122
|
"vitest": "^1.6.0",
|
|
123
123
|
"zod-to-ts": "github:amritk/zod-to-ts#build",
|
|
124
|
+
"@scalar/build-tooling": "0.1.12",
|
|
124
125
|
"@scalar/openapi-types": "0.1.5",
|
|
125
|
-
"@scalar/openapi-parser": "0.8.10"
|
|
126
|
-
"@scalar/build-tooling": "0.1.12"
|
|
126
|
+
"@scalar/openapi-parser": "0.8.10"
|
|
127
127
|
},
|
|
128
128
|
"scripts": {
|
|
129
129
|
"build": "scalar-build-rollup",
|