summaryrefslogtreecommitdiff
path: root/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs')
-rw-r--r--node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs48
1 files changed, 19 insertions, 29 deletions
diff --git a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
index 94d8dceb..e958e881 100644
--- a/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
+++ b/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
@@ -21,16 +21,6 @@ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#
* 4. Hash, including "#", optional.
*/
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) {
return schemeRegex.test(input);
}
@@ -64,21 +54,21 @@ function makeUrl(scheme, user, host, port, path, query, hash) {
path,
query,
hash,
- type: UrlType.Absolute,
+ type: 7 /* Absolute */,
};
}
function parseUrl(input) {
if (isSchemeRelativeUrl(input)) {
const url = parseAbsoluteUrl('http:' + input);
url.scheme = '';
- url.type = UrlType.SchemeRelative;
+ url.type = 6 /* SchemeRelative */;
return url;
}
if (isAbsolutePath(input)) {
const url = parseAbsoluteUrl('http://foo.com' + input);
url.scheme = '';
url.host = '';
- url.type = UrlType.AbsolutePath;
+ url.type = 5 /* AbsolutePath */;
return url;
}
if (isFileUrl(input))
@@ -90,11 +80,11 @@ function parseUrl(input) {
url.host = '';
url.type = input
? input.startsWith('?')
- ? UrlType.Query
+ ? 3 /* Query */
: input.startsWith('#')
- ? UrlType.Hash
- : UrlType.RelativePath
- : UrlType.Empty;
+ ? 2 /* Hash */
+ : 4 /* RelativePath */
+ : 1 /* Empty */;
return url;
}
function stripPathFilename(path) {
@@ -122,7 +112,7 @@ function mergePaths(url, base) {
* "foo/.". We need to normalize to a standard representation.
*/
function normalizePath(url, type) {
- const rel = type <= UrlType.RelativePath;
+ const rel = type <= 4 /* RelativePath */;
const pieces = url.path.split('/');
// We need to preserve the first piece always, so that we output a leading slash. The item at
// pieces[0] is an empty string.
@@ -183,27 +173,27 @@ function resolve(input, base) {
return '';
const url = parseUrl(input);
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.
url.user = baseUrl.user;
url.host = baseUrl.host;
url.port = baseUrl.port;
// 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.
url.scheme = baseUrl.scheme;
}
@@ -215,10 +205,10 @@ function resolve(input, base) {
switch (inputType) {
// This is impossible, because of the empty checks at the start of the function.
// 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.
const path = url.path.slice(1);
if (!path)
@@ -231,7 +221,7 @@ function resolve(input, base) {
}
return path + queryHash;
}
- case UrlType.AbsolutePath:
+ case 5 /* AbsolutePath */:
return url.path + queryHash;
default:
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;