@scalar/oas-utils
Advanced tools
Comparing version 0.2.76 to 0.2.77
# @scalar/oas-utils | ||
## 0.2.77 | ||
### Patch Changes | ||
- 44a7100: fix: handle no protocol prefix | ||
## 0.2.76 | ||
@@ -4,0 +10,0 @@ |
/** Redirects the request to a proxy server with a given URL. */ | ||
export declare function redirectToProxy(proxy?: string, url?: string): string; | ||
/** Check if the URL is relative, aka doesn't start with http[s] */ | ||
/** Check if the URL is relative or if it's a domain without protocol */ | ||
export declare const isRelativePath: (url: string) => boolean; | ||
@@ -5,0 +5,0 @@ /** Returns false for requests to localhost, relative URLs, if no proxy is defined … */ |
@@ -16,4 +16,15 @@ import { isLocalUrl } from './isLocalUrl.js'; | ||
} | ||
/** Check if the URL is relative, aka doesn't start with http[s] */ | ||
const isRelativePath = (url) => !/^https?:\/\//.test(url); | ||
/** Check if the URL is relative or if it's a domain without protocol */ | ||
const isRelativePath = (url) => { | ||
// Absolute URLs start with http:// or https:// | ||
if (url.startsWith('http://') || url.startsWith('https://')) { | ||
return false; | ||
} | ||
// Check if it looks like a domain (contains dots and no spaces) | ||
// This catches cases like "galaxy.scalar.com/planets" | ||
if (/^[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+(\/|$)/.test(url)) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
/** Returns false for requests to localhost, relative URLs, if no proxy is defined … */ | ||
@@ -20,0 +31,0 @@ function shouldUseProxy(proxy, url) { |
export declare const REGEX: { | ||
readonly VARIABLES: RegExp; | ||
readonly PATH: RegExp; | ||
readonly TEMPLATE_VARIABLE: RegExp; | ||
}; | ||
//# sourceMappingURL=regexHelpers.d.ts.map |
const REGEX = { | ||
VARIABLES: /{{((?:[^{}]|{[^{}]*})*)}}/g, | ||
PATH: /(?:{)([^{}]+)}(?!})/g, | ||
TEMPLATE_VARIABLE: /{{\s*([^}\s]+?)\s*}}|{\s*([^}\s]+?)\s*}|:\b[\w.]+\b/g, | ||
}; | ||
export { REGEX }; |
@@ -19,3 +19,3 @@ { | ||
], | ||
"version": "0.2.76", | ||
"version": "0.2.77", | ||
"engines": { | ||
@@ -111,4 +111,4 @@ "node": ">=18" | ||
"@scalar/openapi-types": "0.1.5", | ||
"@scalar/object-utils": "1.1.12", | ||
"@scalar/themes": "0.9.48", | ||
"@scalar/object-utils": "1.1.12", | ||
"@scalar/types": "0.0.19" | ||
@@ -118,8 +118,8 @@ }, | ||
"type-fest": "^4.20.0", | ||
"vite": "^5.4.9", | ||
"vite": "^5.4.10", | ||
"vitest": "^1.6.0", | ||
"zod-to-ts": "^1.2.0", | ||
"@scalar/build-tooling": "0.1.12", | ||
"@scalar/openapi-types": "0.1.5", | ||
"@scalar/openapi-parser": "0.8.9" | ||
"@scalar/openapi-parser": "0.8.10", | ||
"@scalar/openapi-types": "0.1.5" | ||
}, | ||
@@ -126,0 +126,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
430358
9045