@jridgewell/resolve-uri
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -30,12 +30,2 @@ (function (global, factory) { | ||
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; | ||
var UrlType; | ||
(function (UrlType) { | ||
UrlType[UrlType["Empty"] = 1] = "Empty"; | ||
UrlType[UrlType["Hash"] = 2] = "Hash"; | ||
UrlType[UrlType["Query"] = 3] = "Query"; | ||
UrlType[UrlType["RelativePath"] = 4] = "RelativePath"; | ||
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath"; | ||
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative"; | ||
UrlType[UrlType["Absolute"] = 7] = "Absolute"; | ||
})(UrlType || (UrlType = {})); | ||
function isAbsoluteUrl(input) { | ||
@@ -74,3 +64,3 @@ return schemeRegex.test(input); | ||
hash, | ||
type: UrlType.Absolute, | ||
type: 7 /* Absolute */, | ||
}; | ||
@@ -82,3 +72,3 @@ } | ||
url.scheme = ''; | ||
url.type = UrlType.SchemeRelative; | ||
url.type = 6 /* SchemeRelative */; | ||
return url; | ||
@@ -90,3 +80,3 @@ } | ||
url.host = ''; | ||
url.type = UrlType.AbsolutePath; | ||
url.type = 5 /* AbsolutePath */; | ||
return url; | ||
@@ -103,7 +93,7 @@ } | ||
? input.startsWith('?') | ||
? UrlType.Query | ||
? 3 /* Query */ | ||
: input.startsWith('#') | ||
? UrlType.Hash | ||
: UrlType.RelativePath | ||
: UrlType.Empty; | ||
? 2 /* Hash */ | ||
: 4 /* RelativePath */ | ||
: 1 /* Empty */; | ||
return url; | ||
@@ -136,3 +126,3 @@ } | ||
function normalizePath(url, type) { | ||
const rel = type <= UrlType.RelativePath; | ||
const rel = type <= 4 /* RelativePath */; | ||
const pieces = url.path.split('/'); | ||
@@ -198,17 +188,17 @@ // We need to preserve the first piece always, so that we output a leading slash. The item at | ||
let inputType = url.type; | ||
if (base && inputType !== UrlType.Absolute) { | ||
if (base && inputType !== 7 /* Absolute */) { | ||
const baseUrl = parseUrl(base); | ||
const baseType = baseUrl.type; | ||
switch (inputType) { | ||
case UrlType.Empty: | ||
case 1 /* Empty */: | ||
url.hash = baseUrl.hash; | ||
// fall through | ||
case UrlType.Hash: | ||
case 2 /* Hash */: | ||
url.query = baseUrl.query; | ||
// fall through | ||
case UrlType.Query: | ||
case UrlType.RelativePath: | ||
case 3 /* Query */: | ||
case 4 /* RelativePath */: | ||
mergePaths(url, baseUrl); | ||
// fall through | ||
case UrlType.AbsolutePath: | ||
case 5 /* AbsolutePath */: | ||
// The host, user, and port are joined, you can't copy one without the others. | ||
@@ -219,3 +209,3 @@ url.user = baseUrl.user; | ||
// fall through | ||
case UrlType.SchemeRelative: | ||
case 6 /* SchemeRelative */: | ||
// The input doesn't have a schema at least, so we need to copy at least that over. | ||
@@ -232,6 +222,6 @@ url.scheme = baseUrl.scheme; | ||
// case UrlType.Empty: | ||
case UrlType.Hash: | ||
case UrlType.Query: | ||
case 2 /* Hash */: | ||
case 3 /* Query */: | ||
return queryHash; | ||
case UrlType.RelativePath: { | ||
case 4 /* RelativePath */: { | ||
// The first char is always a "/", and we need it to be relative. | ||
@@ -249,3 +239,3 @@ const path = url.path.slice(1); | ||
} | ||
case UrlType.AbsolutePath: | ||
case 5 /* AbsolutePath */: | ||
return url.path + queryHash; | ||
@@ -252,0 +242,0 @@ default: |
{ | ||
"name": "@jridgewell/resolve-uri", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Resolve a URI relative to an optional base URI", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53153
472