@cavelon/cli 0.2.16 → 0.2.17

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.
@@ -3343,6 +3343,37 @@ var require_utils = __commonJS({
3343
3343
  }
3344
3344
  return output.join("");
3345
3345
  }
3346
+ function removeDotSegmentsRelative(path4) {
3347
+ if (path4 === "" || path4[0] === "/") {
3348
+ return removeDotSegments(path4);
3349
+ }
3350
+ const segments = path4.split("/");
3351
+ const last = segments.length - 1;
3352
+ const output = [];
3353
+ let trailingDirectory = false;
3354
+ for (let i = 0; i <= last; i++) {
3355
+ const segment = segments[i];
3356
+ if (segment === "." || segment === "..") {
3357
+ if (segment === "..") {
3358
+ if (output.length !== 0 && output[output.length - 1] !== "..") {
3359
+ output.pop();
3360
+ } else {
3361
+ output.push("..");
3362
+ }
3363
+ }
3364
+ trailingDirectory = i === last;
3365
+ } else {
3366
+ output.push(segment);
3367
+ }
3368
+ }
3369
+ if (trailingDirectory && output[output.length - 1] !== "..") {
3370
+ output.push("");
3371
+ }
3372
+ if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
3373
+ output.unshift(".");
3374
+ }
3375
+ return output.join("/");
3376
+ }
3346
3377
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3347
3378
  var HOST_DELIM_RE = /[@/?#:]/g;
3348
3379
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3603,6 +3634,7 @@ var require_utils = __commonJS({
3603
3634
  encodeFragment,
3604
3635
  escapePreservingEscapes,
3605
3636
  removeDotSegments,
3637
+ removeDotSegmentsRelative,
3606
3638
  isIPv4,
3607
3639
  isUUID,
3608
3640
  normalizeIPv6,
@@ -3826,16 +3858,18 @@ var require_schemes = __commonJS({
3826
3858
  var require_fast_uri = __commonJS({
3827
3859
  "node_modules/fast-uri/index.js"(exports, module) {
3828
3860
  "use strict";
3829
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3861
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3830
3862
  var { SCHEMES, getSchemeHandler } = require_schemes();
3831
3863
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3832
3864
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3833
- function decodeValidScheme(scheme) {
3834
- const decodedScheme = unescape(String(scheme));
3835
- if (!VALID_SCHEME.test(decodedScheme)) {
3865
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3866
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3867
+ function validateScheme(scheme) {
3868
+ const stringScheme = String(scheme);
3869
+ if (!VALID_SCHEME.test(stringScheme)) {
3836
3870
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3837
3871
  }
3838
- return decodedScheme;
3872
+ return stringScheme;
3839
3873
  }
3840
3874
  function normalize(uri, options) {
3841
3875
  if (typeof uri === "string") {
@@ -3872,6 +3906,9 @@ var require_fast_uri = __commonJS({
3872
3906
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3873
3907
  const resolvedHost = resolved.host;
3874
3908
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3909
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3910
+ throw new Error(MALFORMED_HOST_ERROR);
3911
+ }
3875
3912
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3876
3913
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3877
3914
  if (resolved.error && !encodedASCIIHost) {
@@ -3913,14 +3950,15 @@ var require_fast_uri = __commonJS({
3913
3950
  if (relative.path[0] === "/") {
3914
3951
  target.path = removeDotSegments(relative.path);
3915
3952
  } else {
3916
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3953
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
3954
+ if (baseHasAuthority && !base.path) {
3917
3955
  target.path = "/" + relative.path;
3918
3956
  } else if (!base.path) {
3919
3957
  target.path = relative.path;
3920
3958
  } else {
3921
3959
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3922
3960
  }
3923
- target.path = removeDotSegments(target.path);
3961
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
3924
3962
  }
3925
3963
  target.query = relative.query;
3926
3964
  }
@@ -3958,12 +3996,13 @@ var require_fast_uri = __commonJS({
3958
3996
  const options = Object.assign({}, opts);
3959
3997
  const uriTokens = [];
3960
3998
  if (component.scheme) {
3961
- component.scheme = decodeValidScheme(component.scheme);
3999
+ component.scheme = validateScheme(component.scheme);
3962
4000
  }
3963
4001
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3964
4002
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3965
4003
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3966
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
4004
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
4005
+ const pathNoScheme = !options.skipEscape && schemelessReference;
3967
4006
  if (component.path !== void 0) {
3968
4007
  if (!options.skipEscape) {
3969
4008
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -3972,7 +4011,7 @@ var require_fast_uri = __commonJS({
3972
4011
  }
3973
4012
  }
3974
4013
  if (options.reference !== "suffix" && component.scheme) {
3975
- component.scheme = decodeValidScheme(component.scheme);
4014
+ component.scheme = validateScheme(component.scheme);
3976
4015
  uriTokens.push(component.scheme, ":");
3977
4016
  }
3978
4017
  const authority = recomposeAuthority(component);
@@ -3988,9 +4027,9 @@ var require_fast_uri = __commonJS({
3988
4027
  if (component.path !== void 0) {
3989
4028
  let s = component.path;
3990
4029
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3991
- s = removeDotSegments(s);
4030
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
3992
4031
  }
3993
- if (pathNoScheme) {
4032
+ if (schemelessReference) {
3994
4033
  s = serializePathEncoding(s, true);
3995
4034
  }
3996
4035
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4037,16 +4076,34 @@ var require_fast_uri = __commonJS({
4037
4076
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4038
4077
  }
4039
4078
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4079
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4080
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4081
+ return true;
4082
+ }
4040
4083
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4084
+ let url;
4041
4085
  try {
4042
- parsed.host = new URL("http://" + parsed.host).hostname;
4086
+ url = new URL("http://" + parsed.host);
4043
4087
  } catch (e) {
4044
4088
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4045
4089
  return true;
4046
4090
  }
4091
+ if (!isHostOnlyURL(url)) {
4092
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4093
+ return true;
4094
+ }
4095
+ parsed.host = url.hostname;
4047
4096
  }
4048
4097
  return false;
4049
4098
  }
4099
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4100
+ return Boolean(
4101
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4102
+ );
4103
+ }
4104
+ function isHostOnlyURL(url) {
4105
+ return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== "";
4106
+ }
4050
4107
  function parseWithStatus(uri, opts) {
4051
4108
  const options = Object.assign({}, opts);
4052
4109
  const parsed = {
@@ -4101,9 +4158,8 @@ var require_fast_uri = __commonJS({
4101
4158
  parsed.query = matches[7];
4102
4159
  parsed.fragment = matches[8];
4103
4160
  if (parsed.scheme !== void 0) {
4104
- const decodedScheme = unescape(parsed.scheme);
4105
- if (VALID_SCHEME.test(decodedScheme)) {
4106
- parsed.scheme = decodedScheme.toLowerCase();
4161
+ if (VALID_SCHEME.test(parsed.scheme)) {
4162
+ parsed.scheme = parsed.scheme.toLowerCase();
4107
4163
  } else {
4108
4164
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4109
4165
  malformedScheme = true;
@@ -4131,7 +4187,7 @@ var require_fast_uri = __commonJS({
4131
4187
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4132
4188
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4133
4189
  if (malformedIPLiteral) {
4134
- parsed.error = parsed.error || "URI host is malformed.";
4190
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4135
4191
  malformedAuthorityOrPort = true;
4136
4192
  }
4137
4193
  } else {
@@ -4159,7 +4215,7 @@ var require_fast_uri = __commonJS({
4159
4215
  if (!isIP) {
4160
4216
  host = normalizePercentEncoding(host.toLowerCase());
4161
4217
  }
4162
- parsed.host = reescapeHostDelimiters(host, isIP);
4218
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4163
4219
  }
4164
4220
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4165
4221
  if (parsed.path) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": 1,
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "entries": {
5
5
  "omp": [
6
6
  "omp-extension.mjs"
@@ -25,13 +25,13 @@
25
25
  },
26
26
  {
27
27
  "path": "kilo-server.mjs",
28
- "size": 1496469,
29
- "sha256": "95da367564676b7ba91aaca916646a44a4961ff3f70e3146d6f4336b60fd0cc2"
28
+ "size": 1498977,
29
+ "sha256": "50ae29a606a7a14653590fd61f231855815ea1afd1cb307f0a472d2520953c30"
30
30
  },
31
31
  {
32
32
  "path": "kilo-tui.mjs",
33
- "size": 942039,
34
- "sha256": "04350845fb33cf18e3427c237e1a93a93edef653492ae45dd12abc7c3c7ac316"
33
+ "size": 944520,
34
+ "sha256": "d37542f1895897e68095c59051b317766a641f9e9a6f24ca0e67f58696295094"
35
35
  },
36
36
  {
37
37
  "path": "LICENSE",
@@ -45,28 +45,28 @@
45
45
  },
46
46
  {
47
47
  "path": "omp-extension.mjs",
48
- "size": 1146631,
49
- "sha256": "9cbf90d1ca7be16e3125645b84bdc3da9c5d68105d8ac097e98dc04d13bfa577"
48
+ "size": 1149112,
49
+ "sha256": "4c2546c4516e940bbc3118601fc53dd6938fb70329af59ecb8b1044e44b5f0c2"
50
50
  },
51
51
  {
52
52
  "path": "opencode-server.mjs",
53
- "size": 1495457,
54
- "sha256": "d8db9272c893f90d4829ccfd292a023a1ae44dd04c305f0175a37e0a44788e43"
53
+ "size": 1497965,
54
+ "sha256": "43b4f13b6da9965a4c25922772aae021aa9db1566ed2460efcb142e72e9152bd"
55
55
  },
56
56
  {
57
57
  "path": "opencode-tui.mjs",
58
- "size": 941945,
59
- "sha256": "5ab9edb04a894d77c50e09ca388bfac97a88a0be08cde5982a0a8f1234e65c3a"
58
+ "size": 944426,
59
+ "sha256": "710e493c5ffe3a3502c39ade29d986f4c464ce55cd14427eba56d3b0eaefc97c"
60
60
  },
61
61
  {
62
62
  "path": "pi-extension.mjs",
63
- "size": 1146539,
64
- "sha256": "0586cc60d914c5f9fd089e76389b4be601f2c0cf7d4d2729e728e35a8552f097"
63
+ "size": 1149020,
64
+ "sha256": "dfdc37d005db9c839ab4f5b07e600953cca04c181f0951001540033dfb2592e8"
65
65
  },
66
66
  {
67
67
  "path": "THIRD-PARTY-NOTICES",
68
68
  "size": 18302,
69
- "sha256": "6548bb7b7fd6b0a92fb287b45c5addf1886f1daebb59714e16833e8041aeb28c"
69
+ "sha256": "7ed44d7c1e35f82897bcb4e89d28a07b85a915533074590250afd7f2c3b828c3"
70
70
  },
71
71
  {
72
72
  "path": "TYPEBOX-LICENSE",
@@ -3343,6 +3343,37 @@ var require_utils = __commonJS({
3343
3343
  }
3344
3344
  return output.join("");
3345
3345
  }
3346
+ function removeDotSegmentsRelative(path3) {
3347
+ if (path3 === "" || path3[0] === "/") {
3348
+ return removeDotSegments(path3);
3349
+ }
3350
+ const segments = path3.split("/");
3351
+ const last = segments.length - 1;
3352
+ const output = [];
3353
+ let trailingDirectory = false;
3354
+ for (let i = 0; i <= last; i++) {
3355
+ const segment = segments[i];
3356
+ if (segment === "." || segment === "..") {
3357
+ if (segment === "..") {
3358
+ if (output.length !== 0 && output[output.length - 1] !== "..") {
3359
+ output.pop();
3360
+ } else {
3361
+ output.push("..");
3362
+ }
3363
+ }
3364
+ trailingDirectory = i === last;
3365
+ } else {
3366
+ output.push(segment);
3367
+ }
3368
+ }
3369
+ if (trailingDirectory && output[output.length - 1] !== "..") {
3370
+ output.push("");
3371
+ }
3372
+ if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
3373
+ output.unshift(".");
3374
+ }
3375
+ return output.join("/");
3376
+ }
3346
3377
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3347
3378
  var HOST_DELIM_RE = /[@/?#:]/g;
3348
3379
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3603,6 +3634,7 @@ var require_utils = __commonJS({
3603
3634
  encodeFragment,
3604
3635
  escapePreservingEscapes,
3605
3636
  removeDotSegments,
3637
+ removeDotSegmentsRelative,
3606
3638
  isIPv4,
3607
3639
  isUUID,
3608
3640
  normalizeIPv6,
@@ -3826,16 +3858,18 @@ var require_schemes = __commonJS({
3826
3858
  var require_fast_uri = __commonJS({
3827
3859
  "node_modules/fast-uri/index.js"(exports, module) {
3828
3860
  "use strict";
3829
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3861
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3830
3862
  var { SCHEMES, getSchemeHandler } = require_schemes();
3831
3863
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3832
3864
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3833
- function decodeValidScheme(scheme) {
3834
- const decodedScheme = unescape(String(scheme));
3835
- if (!VALID_SCHEME.test(decodedScheme)) {
3865
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3866
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3867
+ function validateScheme(scheme) {
3868
+ const stringScheme = String(scheme);
3869
+ if (!VALID_SCHEME.test(stringScheme)) {
3836
3870
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3837
3871
  }
3838
- return decodedScheme;
3872
+ return stringScheme;
3839
3873
  }
3840
3874
  function normalize(uri, options) {
3841
3875
  if (typeof uri === "string") {
@@ -3872,6 +3906,9 @@ var require_fast_uri = __commonJS({
3872
3906
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3873
3907
  const resolvedHost = resolved.host;
3874
3908
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3909
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3910
+ throw new Error(MALFORMED_HOST_ERROR);
3911
+ }
3875
3912
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3876
3913
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3877
3914
  if (resolved.error && !encodedASCIIHost) {
@@ -3913,14 +3950,15 @@ var require_fast_uri = __commonJS({
3913
3950
  if (relative.path[0] === "/") {
3914
3951
  target.path = removeDotSegments(relative.path);
3915
3952
  } else {
3916
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3953
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
3954
+ if (baseHasAuthority && !base.path) {
3917
3955
  target.path = "/" + relative.path;
3918
3956
  } else if (!base.path) {
3919
3957
  target.path = relative.path;
3920
3958
  } else {
3921
3959
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3922
3960
  }
3923
- target.path = removeDotSegments(target.path);
3961
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
3924
3962
  }
3925
3963
  target.query = relative.query;
3926
3964
  }
@@ -3958,12 +3996,13 @@ var require_fast_uri = __commonJS({
3958
3996
  const options = Object.assign({}, opts);
3959
3997
  const uriTokens = [];
3960
3998
  if (component.scheme) {
3961
- component.scheme = decodeValidScheme(component.scheme);
3999
+ component.scheme = validateScheme(component.scheme);
3962
4000
  }
3963
4001
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3964
4002
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3965
4003
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3966
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
4004
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
4005
+ const pathNoScheme = !options.skipEscape && schemelessReference;
3967
4006
  if (component.path !== void 0) {
3968
4007
  if (!options.skipEscape) {
3969
4008
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -3972,7 +4011,7 @@ var require_fast_uri = __commonJS({
3972
4011
  }
3973
4012
  }
3974
4013
  if (options.reference !== "suffix" && component.scheme) {
3975
- component.scheme = decodeValidScheme(component.scheme);
4014
+ component.scheme = validateScheme(component.scheme);
3976
4015
  uriTokens.push(component.scheme, ":");
3977
4016
  }
3978
4017
  const authority = recomposeAuthority(component);
@@ -3988,9 +4027,9 @@ var require_fast_uri = __commonJS({
3988
4027
  if (component.path !== void 0) {
3989
4028
  let s = component.path;
3990
4029
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3991
- s = removeDotSegments(s);
4030
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
3992
4031
  }
3993
- if (pathNoScheme) {
4032
+ if (schemelessReference) {
3994
4033
  s = serializePathEncoding(s, true);
3995
4034
  }
3996
4035
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4037,16 +4076,34 @@ var require_fast_uri = __commonJS({
4037
4076
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4038
4077
  }
4039
4078
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4079
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4080
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4081
+ return true;
4082
+ }
4040
4083
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4084
+ let url;
4041
4085
  try {
4042
- parsed.host = new URL("http://" + parsed.host).hostname;
4086
+ url = new URL("http://" + parsed.host);
4043
4087
  } catch (e) {
4044
4088
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4045
4089
  return true;
4046
4090
  }
4091
+ if (!isHostOnlyURL(url)) {
4092
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4093
+ return true;
4094
+ }
4095
+ parsed.host = url.hostname;
4047
4096
  }
4048
4097
  return false;
4049
4098
  }
4099
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4100
+ return Boolean(
4101
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4102
+ );
4103
+ }
4104
+ function isHostOnlyURL(url) {
4105
+ return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== "";
4106
+ }
4050
4107
  function parseWithStatus(uri, opts) {
4051
4108
  const options = Object.assign({}, opts);
4052
4109
  const parsed = {
@@ -4101,9 +4158,8 @@ var require_fast_uri = __commonJS({
4101
4158
  parsed.query = matches[7];
4102
4159
  parsed.fragment = matches[8];
4103
4160
  if (parsed.scheme !== void 0) {
4104
- const decodedScheme = unescape(parsed.scheme);
4105
- if (VALID_SCHEME.test(decodedScheme)) {
4106
- parsed.scheme = decodedScheme.toLowerCase();
4161
+ if (VALID_SCHEME.test(parsed.scheme)) {
4162
+ parsed.scheme = parsed.scheme.toLowerCase();
4107
4163
  } else {
4108
4164
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4109
4165
  malformedScheme = true;
@@ -4131,7 +4187,7 @@ var require_fast_uri = __commonJS({
4131
4187
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4132
4188
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4133
4189
  if (malformedIPLiteral) {
4134
- parsed.error = parsed.error || "URI host is malformed.";
4190
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4135
4191
  malformedAuthorityOrPort = true;
4136
4192
  }
4137
4193
  } else {
@@ -4159,7 +4215,7 @@ var require_fast_uri = __commonJS({
4159
4215
  if (!isIP) {
4160
4216
  host = normalizePercentEncoding(host.toLowerCase());
4161
4217
  }
4162
- parsed.host = reescapeHostDelimiters(host, isIP);
4218
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4163
4219
  }
4164
4220
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4165
4221
  if (parsed.path) {
@@ -3343,6 +3343,37 @@ var require_utils = __commonJS({
3343
3343
  }
3344
3344
  return output2.join("");
3345
3345
  }
3346
+ function removeDotSegmentsRelative(path4) {
3347
+ if (path4 === "" || path4[0] === "/") {
3348
+ return removeDotSegments(path4);
3349
+ }
3350
+ const segments = path4.split("/");
3351
+ const last = segments.length - 1;
3352
+ const output2 = [];
3353
+ let trailingDirectory = false;
3354
+ for (let i = 0; i <= last; i++) {
3355
+ const segment = segments[i];
3356
+ if (segment === "." || segment === "..") {
3357
+ if (segment === "..") {
3358
+ if (output2.length !== 0 && output2[output2.length - 1] !== "..") {
3359
+ output2.pop();
3360
+ } else {
3361
+ output2.push("..");
3362
+ }
3363
+ }
3364
+ trailingDirectory = i === last;
3365
+ } else {
3366
+ output2.push(segment);
3367
+ }
3368
+ }
3369
+ if (trailingDirectory && output2[output2.length - 1] !== "..") {
3370
+ output2.push("");
3371
+ }
3372
+ if (output2.length === 0 || output2[0] === "" || output2[0].includes(":")) {
3373
+ output2.unshift(".");
3374
+ }
3375
+ return output2.join("/");
3376
+ }
3346
3377
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3347
3378
  var HOST_DELIM_RE = /[@/?#:]/g;
3348
3379
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3603,6 +3634,7 @@ var require_utils = __commonJS({
3603
3634
  encodeFragment,
3604
3635
  escapePreservingEscapes,
3605
3636
  removeDotSegments,
3637
+ removeDotSegmentsRelative,
3606
3638
  isIPv4,
3607
3639
  isUUID,
3608
3640
  normalizeIPv6,
@@ -3826,16 +3858,18 @@ var require_schemes = __commonJS({
3826
3858
  var require_fast_uri = __commonJS({
3827
3859
  "node_modules/fast-uri/index.js"(exports, module) {
3828
3860
  "use strict";
3829
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3861
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3830
3862
  var { SCHEMES, getSchemeHandler } = require_schemes();
3831
3863
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3832
3864
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3833
- function decodeValidScheme(scheme) {
3834
- const decodedScheme = unescape(String(scheme));
3835
- if (!VALID_SCHEME.test(decodedScheme)) {
3865
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3866
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3867
+ function validateScheme(scheme) {
3868
+ const stringScheme = String(scheme);
3869
+ if (!VALID_SCHEME.test(stringScheme)) {
3836
3870
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3837
3871
  }
3838
- return decodedScheme;
3872
+ return stringScheme;
3839
3873
  }
3840
3874
  function normalize(uri, options) {
3841
3875
  if (typeof uri === "string") {
@@ -3872,6 +3906,9 @@ var require_fast_uri = __commonJS({
3872
3906
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3873
3907
  const resolvedHost = resolved.host;
3874
3908
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3909
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3910
+ throw new Error(MALFORMED_HOST_ERROR);
3911
+ }
3875
3912
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3876
3913
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3877
3914
  if (resolved.error && !encodedASCIIHost) {
@@ -3913,14 +3950,15 @@ var require_fast_uri = __commonJS({
3913
3950
  if (relative.path[0] === "/") {
3914
3951
  target.path = removeDotSegments(relative.path);
3915
3952
  } else {
3916
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3953
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
3954
+ if (baseHasAuthority && !base.path) {
3917
3955
  target.path = "/" + relative.path;
3918
3956
  } else if (!base.path) {
3919
3957
  target.path = relative.path;
3920
3958
  } else {
3921
3959
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3922
3960
  }
3923
- target.path = removeDotSegments(target.path);
3961
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
3924
3962
  }
3925
3963
  target.query = relative.query;
3926
3964
  }
@@ -3958,12 +3996,13 @@ var require_fast_uri = __commonJS({
3958
3996
  const options = Object.assign({}, opts);
3959
3997
  const uriTokens = [];
3960
3998
  if (component.scheme) {
3961
- component.scheme = decodeValidScheme(component.scheme);
3999
+ component.scheme = validateScheme(component.scheme);
3962
4000
  }
3963
4001
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3964
4002
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3965
4003
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3966
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
4004
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
4005
+ const pathNoScheme = !options.skipEscape && schemelessReference;
3967
4006
  if (component.path !== void 0) {
3968
4007
  if (!options.skipEscape) {
3969
4008
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -3972,7 +4011,7 @@ var require_fast_uri = __commonJS({
3972
4011
  }
3973
4012
  }
3974
4013
  if (options.reference !== "suffix" && component.scheme) {
3975
- component.scheme = decodeValidScheme(component.scheme);
4014
+ component.scheme = validateScheme(component.scheme);
3976
4015
  uriTokens.push(component.scheme, ":");
3977
4016
  }
3978
4017
  const authority = recomposeAuthority(component);
@@ -3988,9 +4027,9 @@ var require_fast_uri = __commonJS({
3988
4027
  if (component.path !== void 0) {
3989
4028
  let s = component.path;
3990
4029
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3991
- s = removeDotSegments(s);
4030
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
3992
4031
  }
3993
- if (pathNoScheme) {
4032
+ if (schemelessReference) {
3994
4033
  s = serializePathEncoding(s, true);
3995
4034
  }
3996
4035
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4037,16 +4076,34 @@ var require_fast_uri = __commonJS({
4037
4076
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4038
4077
  }
4039
4078
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4079
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4080
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4081
+ return true;
4082
+ }
4040
4083
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4084
+ let url2;
4041
4085
  try {
4042
- parsed.host = new URL("http://" + parsed.host).hostname;
4086
+ url2 = new URL("http://" + parsed.host);
4043
4087
  } catch (e) {
4044
4088
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4045
4089
  return true;
4046
4090
  }
4091
+ if (!isHostOnlyURL(url2)) {
4092
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4093
+ return true;
4094
+ }
4095
+ parsed.host = url2.hostname;
4047
4096
  }
4048
4097
  return false;
4049
4098
  }
4099
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4100
+ return Boolean(
4101
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4102
+ );
4103
+ }
4104
+ function isHostOnlyURL(url2) {
4105
+ return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
4106
+ }
4050
4107
  function parseWithStatus(uri, opts) {
4051
4108
  const options = Object.assign({}, opts);
4052
4109
  const parsed = {
@@ -4101,9 +4158,8 @@ var require_fast_uri = __commonJS({
4101
4158
  parsed.query = matches[7];
4102
4159
  parsed.fragment = matches[8];
4103
4160
  if (parsed.scheme !== void 0) {
4104
- const decodedScheme = unescape(parsed.scheme);
4105
- if (VALID_SCHEME.test(decodedScheme)) {
4106
- parsed.scheme = decodedScheme.toLowerCase();
4161
+ if (VALID_SCHEME.test(parsed.scheme)) {
4162
+ parsed.scheme = parsed.scheme.toLowerCase();
4107
4163
  } else {
4108
4164
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4109
4165
  malformedScheme = true;
@@ -4131,7 +4187,7 @@ var require_fast_uri = __commonJS({
4131
4187
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4132
4188
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4133
4189
  if (malformedIPLiteral) {
4134
- parsed.error = parsed.error || "URI host is malformed.";
4190
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4135
4191
  malformedAuthorityOrPort = true;
4136
4192
  }
4137
4193
  } else {
@@ -4159,7 +4215,7 @@ var require_fast_uri = __commonJS({
4159
4215
  if (!isIP) {
4160
4216
  host = normalizePercentEncoding(host.toLowerCase());
4161
4217
  }
4162
- parsed.host = reescapeHostDelimiters(host, isIP);
4218
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4163
4219
  }
4164
4220
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4165
4221
  if (parsed.path) {