@grexx/grexxlinter 0.2.2447 → 0.2.2602
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/cli.js +743 -258
- package/lsp.js +648 -206
- package/package.json +1 -1
- package/schemas/studioSettings.schema.json +18 -0
package/lsp.js
CHANGED
|
@@ -13847,10 +13847,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
13847
13847
|
let offset = bm.offset;
|
|
13848
13848
|
let commentEnd = null;
|
|
13849
13849
|
for (const collItem of bm.items) {
|
|
13850
|
-
const { start, key: key2, sep, value } = collItem;
|
|
13850
|
+
const { start, key: key2, sep: sep2, value } = collItem;
|
|
13851
13851
|
const keyProps = resolveProps.resolveProps(start, {
|
|
13852
13852
|
indicator: "explicit-key-ind",
|
|
13853
|
-
next: key2 ??
|
|
13853
|
+
next: key2 ?? sep2?.[0],
|
|
13854
13854
|
offset,
|
|
13855
13855
|
onError,
|
|
13856
13856
|
parentIndent: bm.indent,
|
|
@@ -13864,7 +13864,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
13864
13864
|
else if ("indent" in key2 && key2.indent !== bm.indent)
|
|
13865
13865
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
13866
13866
|
}
|
|
13867
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
13867
|
+
if (!keyProps.anchor && !keyProps.tag && !sep2) {
|
|
13868
13868
|
commentEnd = keyProps.end;
|
|
13869
13869
|
if (keyProps.comment) {
|
|
13870
13870
|
if (map.comment)
|
|
@@ -13888,7 +13888,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
13888
13888
|
ctx2.atKey = false;
|
|
13889
13889
|
if (utilMapIncludes.mapIncludes(ctx2, map.items, keyNode))
|
|
13890
13890
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
13891
|
-
const valueProps = resolveProps.resolveProps(
|
|
13891
|
+
const valueProps = resolveProps.resolveProps(sep2 ?? [], {
|
|
13892
13892
|
indicator: "map-value-ind",
|
|
13893
13893
|
next: value,
|
|
13894
13894
|
offset: keyNode.range[2],
|
|
@@ -13904,7 +13904,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
13904
13904
|
if (ctx2.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
13905
13905
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
13906
13906
|
}
|
|
13907
|
-
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : composeEmptyNode(ctx2, offset,
|
|
13907
|
+
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : composeEmptyNode(ctx2, offset, sep2, null, valueProps, onError);
|
|
13908
13908
|
if (ctx2.schema.compat)
|
|
13909
13909
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
13910
13910
|
offset = valueNode.range[2];
|
|
@@ -13995,7 +13995,7 @@ var require_resolve_end = __commonJS({
|
|
|
13995
13995
|
let comment = "";
|
|
13996
13996
|
if (end) {
|
|
13997
13997
|
let hasSpace = false;
|
|
13998
|
-
let
|
|
13998
|
+
let sep2 = "";
|
|
13999
13999
|
for (const token of end) {
|
|
14000
14000
|
const { source, type } = token;
|
|
14001
14001
|
switch (type) {
|
|
@@ -14009,13 +14009,13 @@ var require_resolve_end = __commonJS({
|
|
|
14009
14009
|
if (!comment)
|
|
14010
14010
|
comment = cb;
|
|
14011
14011
|
else
|
|
14012
|
-
comment +=
|
|
14013
|
-
|
|
14012
|
+
comment += sep2 + cb;
|
|
14013
|
+
sep2 = "";
|
|
14014
14014
|
break;
|
|
14015
14015
|
}
|
|
14016
14016
|
case "newline":
|
|
14017
14017
|
if (comment)
|
|
14018
|
-
|
|
14018
|
+
sep2 += source;
|
|
14019
14019
|
hasSpace = true;
|
|
14020
14020
|
break;
|
|
14021
14021
|
default:
|
|
@@ -14058,18 +14058,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
14058
14058
|
let offset = fc.offset + fc.start.source.length;
|
|
14059
14059
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
14060
14060
|
const collItem = fc.items[i];
|
|
14061
|
-
const { start, key: key2, sep, value } = collItem;
|
|
14061
|
+
const { start, key: key2, sep: sep2, value } = collItem;
|
|
14062
14062
|
const props = resolveProps.resolveProps(start, {
|
|
14063
14063
|
flow: fcName,
|
|
14064
14064
|
indicator: "explicit-key-ind",
|
|
14065
|
-
next: key2 ??
|
|
14065
|
+
next: key2 ?? sep2?.[0],
|
|
14066
14066
|
offset,
|
|
14067
14067
|
onError,
|
|
14068
14068
|
parentIndent: fc.indent,
|
|
14069
14069
|
startOnNewline: false
|
|
14070
14070
|
});
|
|
14071
14071
|
if (!props.found) {
|
|
14072
|
-
if (!props.anchor && !props.tag && !
|
|
14072
|
+
if (!props.anchor && !props.tag && !sep2 && !value) {
|
|
14073
14073
|
if (i === 0 && props.comma)
|
|
14074
14074
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
14075
14075
|
else if (i < fc.items.length - 1)
|
|
@@ -14123,8 +14123,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
14123
14123
|
}
|
|
14124
14124
|
}
|
|
14125
14125
|
}
|
|
14126
|
-
if (!isMap && !
|
|
14127
|
-
const valueNode = value ? composeNode(ctx2, value, props, onError) : composeEmptyNode(ctx2, props.end,
|
|
14126
|
+
if (!isMap && !sep2 && !props.found) {
|
|
14127
|
+
const valueNode = value ? composeNode(ctx2, value, props, onError) : composeEmptyNode(ctx2, props.end, sep2, null, props, onError);
|
|
14128
14128
|
coll.items.push(valueNode);
|
|
14129
14129
|
offset = valueNode.range[2];
|
|
14130
14130
|
if (isBlock(value))
|
|
@@ -14136,7 +14136,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
14136
14136
|
if (isBlock(key2))
|
|
14137
14137
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
14138
14138
|
ctx2.atKey = false;
|
|
14139
|
-
const valueProps = resolveProps.resolveProps(
|
|
14139
|
+
const valueProps = resolveProps.resolveProps(sep2 ?? [], {
|
|
14140
14140
|
flow: fcName,
|
|
14141
14141
|
indicator: "map-value-ind",
|
|
14142
14142
|
next: value,
|
|
@@ -14147,8 +14147,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
14147
14147
|
});
|
|
14148
14148
|
if (valueProps.found) {
|
|
14149
14149
|
if (!isMap && !props.found && ctx2.options.strict) {
|
|
14150
|
-
if (
|
|
14151
|
-
for (const st of
|
|
14150
|
+
if (sep2)
|
|
14151
|
+
for (const st of sep2) {
|
|
14152
14152
|
if (st === valueProps.found)
|
|
14153
14153
|
break;
|
|
14154
14154
|
if (st.type === "newline") {
|
|
@@ -14165,7 +14165,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
14165
14165
|
else
|
|
14166
14166
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
14167
14167
|
}
|
|
14168
|
-
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx2, valueProps.end,
|
|
14168
|
+
const valueNode = value ? composeNode(ctx2, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx2, valueProps.end, sep2, null, valueProps, onError) : null;
|
|
14169
14169
|
if (valueNode) {
|
|
14170
14170
|
if (isBlock(value))
|
|
14171
14171
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -14345,7 +14345,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
14345
14345
|
chompStart = i + 1;
|
|
14346
14346
|
}
|
|
14347
14347
|
let value = "";
|
|
14348
|
-
let
|
|
14348
|
+
let sep2 = "";
|
|
14349
14349
|
let prevMoreIndented = false;
|
|
14350
14350
|
for (let i = 0; i < contentStart; ++i)
|
|
14351
14351
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -14362,24 +14362,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
14362
14362
|
indent = "";
|
|
14363
14363
|
}
|
|
14364
14364
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
14365
|
-
value +=
|
|
14366
|
-
|
|
14365
|
+
value += sep2 + indent.slice(trimIndent) + content;
|
|
14366
|
+
sep2 = "\n";
|
|
14367
14367
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
14368
|
-
if (
|
|
14369
|
-
|
|
14370
|
-
else if (!prevMoreIndented &&
|
|
14371
|
-
|
|
14372
|
-
value +=
|
|
14373
|
-
|
|
14368
|
+
if (sep2 === " ")
|
|
14369
|
+
sep2 = "\n";
|
|
14370
|
+
else if (!prevMoreIndented && sep2 === "\n")
|
|
14371
|
+
sep2 = "\n\n";
|
|
14372
|
+
value += sep2 + indent.slice(trimIndent) + content;
|
|
14373
|
+
sep2 = "\n";
|
|
14374
14374
|
prevMoreIndented = true;
|
|
14375
14375
|
} else if (content === "") {
|
|
14376
|
-
if (
|
|
14376
|
+
if (sep2 === "\n")
|
|
14377
14377
|
value += "\n";
|
|
14378
14378
|
else
|
|
14379
|
-
|
|
14379
|
+
sep2 = "\n";
|
|
14380
14380
|
} else {
|
|
14381
|
-
value +=
|
|
14382
|
-
|
|
14381
|
+
value += sep2 + content;
|
|
14382
|
+
sep2 = " ";
|
|
14383
14383
|
prevMoreIndented = false;
|
|
14384
14384
|
}
|
|
14385
14385
|
}
|
|
@@ -14561,25 +14561,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
14561
14561
|
if (!match)
|
|
14562
14562
|
return source;
|
|
14563
14563
|
let res = match[1];
|
|
14564
|
-
let
|
|
14564
|
+
let sep2 = " ";
|
|
14565
14565
|
let pos = first.lastIndex;
|
|
14566
14566
|
line.lastIndex = pos;
|
|
14567
14567
|
while (match = line.exec(source)) {
|
|
14568
14568
|
if (match[1] === "") {
|
|
14569
|
-
if (
|
|
14570
|
-
res +=
|
|
14569
|
+
if (sep2 === "\n")
|
|
14570
|
+
res += sep2;
|
|
14571
14571
|
else
|
|
14572
|
-
|
|
14572
|
+
sep2 = "\n";
|
|
14573
14573
|
} else {
|
|
14574
|
-
res +=
|
|
14575
|
-
|
|
14574
|
+
res += sep2 + match[1];
|
|
14575
|
+
sep2 = " ";
|
|
14576
14576
|
}
|
|
14577
14577
|
pos = line.lastIndex;
|
|
14578
14578
|
}
|
|
14579
14579
|
const last = /[ \t]*(.*)/sy;
|
|
14580
14580
|
last.lastIndex = pos;
|
|
14581
14581
|
match = last.exec(source);
|
|
14582
|
-
return res +
|
|
14582
|
+
return res + sep2 + (match?.[1] ?? "");
|
|
14583
14583
|
}
|
|
14584
14584
|
function doubleQuotedValue(source, onError) {
|
|
14585
14585
|
let res = "";
|
|
@@ -15389,14 +15389,14 @@ var require_cst_stringify = __commonJS({
|
|
|
15389
15389
|
}
|
|
15390
15390
|
}
|
|
15391
15391
|
}
|
|
15392
|
-
function stringifyItem({ start, key: key2, sep, value }) {
|
|
15392
|
+
function stringifyItem({ start, key: key2, sep: sep2, value }) {
|
|
15393
15393
|
let res = "";
|
|
15394
15394
|
for (const st of start)
|
|
15395
15395
|
res += st.source;
|
|
15396
15396
|
if (key2)
|
|
15397
15397
|
res += stringifyToken(key2);
|
|
15398
|
-
if (
|
|
15399
|
-
for (const st of
|
|
15398
|
+
if (sep2)
|
|
15399
|
+
for (const st of sep2)
|
|
15400
15400
|
res += st.source;
|
|
15401
15401
|
if (value)
|
|
15402
15402
|
res += stringifyToken(value);
|
|
@@ -16563,18 +16563,18 @@ var require_parser = __commonJS({
|
|
|
16563
16563
|
if (this.type === "map-value-ind") {
|
|
16564
16564
|
const prev = getPrevProps(this.peek(2));
|
|
16565
16565
|
const start = getFirstKeyStartProps(prev);
|
|
16566
|
-
let
|
|
16566
|
+
let sep2;
|
|
16567
16567
|
if (scalar.end) {
|
|
16568
|
-
|
|
16569
|
-
|
|
16568
|
+
sep2 = scalar.end;
|
|
16569
|
+
sep2.push(this.sourceToken);
|
|
16570
16570
|
delete scalar.end;
|
|
16571
16571
|
} else
|
|
16572
|
-
|
|
16572
|
+
sep2 = [this.sourceToken];
|
|
16573
16573
|
const map = {
|
|
16574
16574
|
type: "block-map",
|
|
16575
16575
|
offset: scalar.offset,
|
|
16576
16576
|
indent: scalar.indent,
|
|
16577
|
-
items: [{ start, key: scalar, sep }]
|
|
16577
|
+
items: [{ start, key: scalar, sep: sep2 }]
|
|
16578
16578
|
};
|
|
16579
16579
|
this.onKeyLine = true;
|
|
16580
16580
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -16727,15 +16727,15 @@ var require_parser = __commonJS({
|
|
|
16727
16727
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
16728
16728
|
const start2 = getFirstKeyStartProps(it.start);
|
|
16729
16729
|
const key2 = it.key;
|
|
16730
|
-
const
|
|
16731
|
-
|
|
16730
|
+
const sep2 = it.sep;
|
|
16731
|
+
sep2.push(this.sourceToken);
|
|
16732
16732
|
delete it.key;
|
|
16733
16733
|
delete it.sep;
|
|
16734
16734
|
this.stack.push({
|
|
16735
16735
|
type: "block-map",
|
|
16736
16736
|
offset: this.offset,
|
|
16737
16737
|
indent: this.indent,
|
|
16738
|
-
items: [{ start: start2, key: key2, sep }]
|
|
16738
|
+
items: [{ start: start2, key: key2, sep: sep2 }]
|
|
16739
16739
|
});
|
|
16740
16740
|
} else if (start.length > 0) {
|
|
16741
16741
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -16929,13 +16929,13 @@ var require_parser = __commonJS({
|
|
|
16929
16929
|
const prev = getPrevProps(parent);
|
|
16930
16930
|
const start = getFirstKeyStartProps(prev);
|
|
16931
16931
|
fixFlowSeqItems(fc);
|
|
16932
|
-
const
|
|
16933
|
-
|
|
16932
|
+
const sep2 = fc.end.splice(1, fc.end.length);
|
|
16933
|
+
sep2.push(this.sourceToken);
|
|
16934
16934
|
const map = {
|
|
16935
16935
|
type: "block-map",
|
|
16936
16936
|
offset: fc.offset,
|
|
16937
16937
|
indent: fc.indent,
|
|
16938
|
-
items: [{ start, key: fc, sep }]
|
|
16938
|
+
items: [{ start, key: fc, sep: sep2 }]
|
|
16939
16939
|
};
|
|
16940
16940
|
this.onKeyLine = true;
|
|
16941
16941
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -20283,16 +20283,18 @@ var require_data = __commonJS({
|
|
|
20283
20283
|
}
|
|
20284
20284
|
});
|
|
20285
20285
|
|
|
20286
|
-
// ../../node_modules/.pnpm/fast-uri@4.1.
|
|
20286
|
+
// ../../node_modules/.pnpm/fast-uri@4.1.4/node_modules/fast-uri/lib/utils.js
|
|
20287
20287
|
var require_utils = __commonJS({
|
|
20288
|
-
"../../node_modules/.pnpm/fast-uri@4.1.
|
|
20288
|
+
"../../node_modules/.pnpm/fast-uri@4.1.4/node_modules/fast-uri/lib/utils.js"(exports, module) {
|
|
20289
20289
|
"use strict";
|
|
20290
20290
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
20291
20291
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
20292
|
+
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
20292
20293
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
20293
20294
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
20294
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[
|
|
20295
|
-
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[
|
|
20295
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
20296
|
+
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
20297
|
+
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
20296
20298
|
function stringArrayToHexStripped(input) {
|
|
20297
20299
|
let acc = "";
|
|
20298
20300
|
let code = 0;
|
|
@@ -20317,91 +20319,110 @@ var require_utils = __commonJS({
|
|
|
20317
20319
|
}
|
|
20318
20320
|
return acc;
|
|
20319
20321
|
}
|
|
20322
|
+
var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
20323
|
+
var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
20324
|
+
var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
20320
20325
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20326
|
+
var nonSimpleDomainChars = RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
20327
|
+
var numericLastLabel = RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);
|
|
20328
|
+
function nonSimpleMailtoDomain(domain) {
|
|
20329
|
+
return nonSimpleDomainChars(domain) || numericLastLabel(domain);
|
|
20330
|
+
}
|
|
20331
|
+
function isZoneIdentifier(zone) {
|
|
20332
|
+
if (zone.length === 0) return false;
|
|
20333
|
+
for (let i = 0; i < zone.length; i++) {
|
|
20334
|
+
if (isZoneCharacter(zone[i])) continue;
|
|
20335
|
+
if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
|
|
20336
|
+
i += 2;
|
|
20337
|
+
continue;
|
|
20333
20338
|
}
|
|
20334
|
-
|
|
20339
|
+
return false;
|
|
20335
20340
|
}
|
|
20336
20341
|
return true;
|
|
20337
20342
|
}
|
|
20338
|
-
function
|
|
20339
|
-
let
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
let
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
}
|
|
20351
|
-
if (cursor === ":") {
|
|
20352
|
-
if (endipv6Encountered === true) {
|
|
20353
|
-
endIpv6 = true;
|
|
20354
|
-
}
|
|
20355
|
-
if (!consume(buffer, address, output)) {
|
|
20356
|
-
break;
|
|
20357
|
-
}
|
|
20358
|
-
if (++tokenCount > 7) {
|
|
20359
|
-
output.error = true;
|
|
20360
|
-
break;
|
|
20343
|
+
function compressIPv6ZeroRun(hextets) {
|
|
20344
|
+
let bestStart = -1;
|
|
20345
|
+
let bestLength = 0;
|
|
20346
|
+
let runStart = -1;
|
|
20347
|
+
let runLength = 0;
|
|
20348
|
+
for (let i = 0; i < hextets.length; i++) {
|
|
20349
|
+
if (hextets[i] === "0") {
|
|
20350
|
+
if (runStart === -1) runStart = i;
|
|
20351
|
+
runLength++;
|
|
20352
|
+
if (runLength > bestLength) {
|
|
20353
|
+
bestLength = runLength;
|
|
20354
|
+
bestStart = runStart;
|
|
20361
20355
|
}
|
|
20362
|
-
if (i > 0 && input[i - 1] === ":") {
|
|
20363
|
-
endipv6Encountered = true;
|
|
20364
|
-
}
|
|
20365
|
-
address.push(":");
|
|
20366
|
-
continue;
|
|
20367
|
-
} else if (cursor === "%") {
|
|
20368
|
-
if (!consume(buffer, address, output)) {
|
|
20369
|
-
break;
|
|
20370
|
-
}
|
|
20371
|
-
consume = consumeIsZone;
|
|
20372
20356
|
} else {
|
|
20373
|
-
|
|
20357
|
+
runStart = -1;
|
|
20358
|
+
runLength = 0;
|
|
20359
|
+
}
|
|
20360
|
+
}
|
|
20361
|
+
if (bestLength < 2) return hextets.join(":");
|
|
20362
|
+
const head = hextets.slice(0, bestStart).join(":");
|
|
20363
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
20364
|
+
return head + "::" + tail;
|
|
20365
|
+
}
|
|
20366
|
+
function normalizeIPv6Address(input) {
|
|
20367
|
+
const compression = input.indexOf("::");
|
|
20368
|
+
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
|
|
20369
|
+
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
20370
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
20371
|
+
if (compression !== -1) {
|
|
20372
|
+
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
20373
|
+
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
20374
|
+
}
|
|
20375
|
+
const parts = left.concat(right);
|
|
20376
|
+
let hextetCount = 0;
|
|
20377
|
+
for (let i = 0; i < parts.length; i++) {
|
|
20378
|
+
const part = parts[i];
|
|
20379
|
+
if (part === "") return void 0;
|
|
20380
|
+
if (part.indexOf(".") !== -1) {
|
|
20381
|
+
if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
20382
|
+
hextetCount += 2;
|
|
20374
20383
|
continue;
|
|
20375
20384
|
}
|
|
20385
|
+
if (!isHextet(part)) return void 0;
|
|
20386
|
+
parts[i] = parseInt(part, 16).toString(16);
|
|
20387
|
+
hextetCount++;
|
|
20376
20388
|
}
|
|
20377
|
-
if (
|
|
20378
|
-
if (
|
|
20379
|
-
|
|
20380
|
-
} else if (endIpv6) {
|
|
20381
|
-
address.push(buffer.join(""));
|
|
20382
|
-
} else {
|
|
20383
|
-
address.push(stringArrayToHexStripped(buffer));
|
|
20384
|
-
}
|
|
20389
|
+
if (compression === -1) {
|
|
20390
|
+
if (hextetCount !== 8) return void 0;
|
|
20391
|
+
return compressIPv6ZeroRun(parts);
|
|
20385
20392
|
}
|
|
20386
|
-
|
|
20387
|
-
|
|
20393
|
+
if (hextetCount >= 8) return void 0;
|
|
20394
|
+
const expanded = parts.slice(0, left.length);
|
|
20395
|
+
for (let i = hextetCount; i < 8; i++) expanded.push("0");
|
|
20396
|
+
for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
|
|
20397
|
+
return compressIPv6ZeroRun(expanded);
|
|
20388
20398
|
}
|
|
20389
20399
|
function normalizeIPv6(host) {
|
|
20390
|
-
|
|
20391
|
-
|
|
20392
|
-
}
|
|
20393
|
-
|
|
20394
|
-
if (
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20400
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
20401
|
+
const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
|
|
20402
|
+
if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
|
|
20403
|
+
let input = bracketed ? host.slice(1, -1) : host;
|
|
20404
|
+
if (bracketed && isIPvFuture(input)) {
|
|
20405
|
+
input = input.toLowerCase();
|
|
20406
|
+
return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
|
|
20407
|
+
}
|
|
20408
|
+
if (findToken(input, ":") < 2) {
|
|
20409
|
+
return { host, isIPV6: false, error: bracketed };
|
|
20410
|
+
}
|
|
20411
|
+
let zoneIdentifier = "";
|
|
20412
|
+
const zoneSeparator = input.indexOf("%");
|
|
20413
|
+
if (zoneSeparator !== -1) {
|
|
20414
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
20415
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
20416
|
+
if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
|
|
20417
|
+
input = input.slice(0, zoneSeparator);
|
|
20418
|
+
}
|
|
20419
|
+
const address = normalizeIPv6Address(input);
|
|
20420
|
+
if (address === void 0) return { host, isIPV6: false, error: true };
|
|
20421
|
+
return {
|
|
20422
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
20423
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
20424
|
+
isIPV6: true
|
|
20425
|
+
};
|
|
20405
20426
|
}
|
|
20406
20427
|
function findToken(str, token) {
|
|
20407
20428
|
let ind = 0;
|
|
@@ -20577,6 +20598,45 @@ var require_utils = __commonJS({
|
|
|
20577
20598
|
}
|
|
20578
20599
|
return output;
|
|
20579
20600
|
}
|
|
20601
|
+
function serializePathEncoding(input, pathNoScheme = false) {
|
|
20602
|
+
let output = "";
|
|
20603
|
+
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
20604
|
+
for (let i = 0; i < input.length; i++) {
|
|
20605
|
+
const ch = input[i];
|
|
20606
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
20607
|
+
const hex = input.slice(i + 1, i + 3);
|
|
20608
|
+
if (isHexPair(hex)) {
|
|
20609
|
+
output += "%" + hex.toUpperCase();
|
|
20610
|
+
i += 2;
|
|
20611
|
+
continue;
|
|
20612
|
+
}
|
|
20613
|
+
}
|
|
20614
|
+
if (ch === "/") {
|
|
20615
|
+
firstSegment = false;
|
|
20616
|
+
}
|
|
20617
|
+
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
|
|
20618
|
+
output += ch;
|
|
20619
|
+
} else {
|
|
20620
|
+
const code = input.charCodeAt(i);
|
|
20621
|
+
if (code < 128) {
|
|
20622
|
+
output += BYTE_HEX[code];
|
|
20623
|
+
} else if (code < 55296 || code > 57343) {
|
|
20624
|
+
output += percentEncodeNonAscii(code);
|
|
20625
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
20626
|
+
const low = input.charCodeAt(i + 1);
|
|
20627
|
+
if (low >= 56320 && low <= 57343) {
|
|
20628
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
20629
|
+
i++;
|
|
20630
|
+
} else {
|
|
20631
|
+
output += percentEncodeNonAscii(65533);
|
|
20632
|
+
}
|
|
20633
|
+
} else {
|
|
20634
|
+
output += percentEncodeNonAscii(65533);
|
|
20635
|
+
}
|
|
20636
|
+
}
|
|
20637
|
+
}
|
|
20638
|
+
return output;
|
|
20639
|
+
}
|
|
20580
20640
|
function normalizeQueryFragmentEncoding(input) {
|
|
20581
20641
|
let output = "";
|
|
20582
20642
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -20618,6 +20678,50 @@ var require_utils = __commonJS({
|
|
|
20618
20678
|
}
|
|
20619
20679
|
return output;
|
|
20620
20680
|
}
|
|
20681
|
+
function encodeComponent(input, isAllowed) {
|
|
20682
|
+
let output = "";
|
|
20683
|
+
for (let i = 0; i < input.length; i++) {
|
|
20684
|
+
const ch = input[i];
|
|
20685
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
20686
|
+
const hex = input.slice(i + 1, i + 3);
|
|
20687
|
+
if (isHexPair(hex)) {
|
|
20688
|
+
output += "%" + hex.toUpperCase();
|
|
20689
|
+
i += 2;
|
|
20690
|
+
continue;
|
|
20691
|
+
}
|
|
20692
|
+
}
|
|
20693
|
+
if (isAllowed(ch)) {
|
|
20694
|
+
output += ch;
|
|
20695
|
+
} else {
|
|
20696
|
+
const code = input.charCodeAt(i);
|
|
20697
|
+
if (code < 128) {
|
|
20698
|
+
output += BYTE_HEX[code];
|
|
20699
|
+
} else if (code < 55296 || code > 57343) {
|
|
20700
|
+
output += percentEncodeNonAscii(code);
|
|
20701
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
20702
|
+
const low = input.charCodeAt(i + 1);
|
|
20703
|
+
if (low >= 56320 && low <= 57343) {
|
|
20704
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
20705
|
+
i++;
|
|
20706
|
+
} else {
|
|
20707
|
+
output += percentEncodeNonAscii(65533);
|
|
20708
|
+
}
|
|
20709
|
+
} else {
|
|
20710
|
+
output += percentEncodeNonAscii(65533);
|
|
20711
|
+
}
|
|
20712
|
+
}
|
|
20713
|
+
}
|
|
20714
|
+
return output;
|
|
20715
|
+
}
|
|
20716
|
+
function encodeUserinfo(input) {
|
|
20717
|
+
return encodeComponent(input, isUserinfoCharacter);
|
|
20718
|
+
}
|
|
20719
|
+
function encodeQuery(input) {
|
|
20720
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
20721
|
+
}
|
|
20722
|
+
function encodeFragment(input) {
|
|
20723
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
20724
|
+
}
|
|
20621
20725
|
function escapePreservingEscapes(input) {
|
|
20622
20726
|
let output = "";
|
|
20623
20727
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -20652,14 +20756,18 @@ var require_utils = __commonJS({
|
|
|
20652
20756
|
function recomposeAuthority(component) {
|
|
20653
20757
|
const uriTokens = [];
|
|
20654
20758
|
if (component.userinfo !== void 0) {
|
|
20655
|
-
uriTokens.push(component.userinfo);
|
|
20759
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
20656
20760
|
uriTokens.push("@");
|
|
20657
20761
|
}
|
|
20658
20762
|
if (component.host !== void 0) {
|
|
20659
|
-
let host =
|
|
20763
|
+
let host = component.host;
|
|
20660
20764
|
if (!isIPv4(host)) {
|
|
20661
|
-
|
|
20662
|
-
if (ipV6res.isIPV6
|
|
20765
|
+
let ipV6res = normalizeIPv6(host);
|
|
20766
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
20767
|
+
host = normalizePercentEncoding(host, true);
|
|
20768
|
+
ipV6res = normalizeIPv6(host);
|
|
20769
|
+
}
|
|
20770
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
20663
20771
|
host = `[${ipV6res.escapedHost}]`;
|
|
20664
20772
|
} else {
|
|
20665
20773
|
host = reescapeHostDelimiters(host, false);
|
|
@@ -20668,18 +20776,29 @@ var require_utils = __commonJS({
|
|
|
20668
20776
|
uriTokens.push(host);
|
|
20669
20777
|
}
|
|
20670
20778
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
20779
|
+
const port = String(component.port);
|
|
20780
|
+
if (!isPort(port)) {
|
|
20781
|
+
throw new TypeError("URI port is malformed.");
|
|
20782
|
+
}
|
|
20671
20783
|
uriTokens.push(":");
|
|
20672
|
-
uriTokens.push(
|
|
20784
|
+
uriTokens.push(port);
|
|
20673
20785
|
}
|
|
20674
20786
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
20675
20787
|
}
|
|
20676
20788
|
module.exports = {
|
|
20789
|
+
BYTE_HEX,
|
|
20790
|
+
percentEncodeNonAscii,
|
|
20677
20791
|
nonSimpleDomain,
|
|
20792
|
+
nonSimpleMailtoDomain,
|
|
20678
20793
|
recomposeAuthority,
|
|
20679
20794
|
reescapeHostDelimiters,
|
|
20680
20795
|
normalizePercentEncoding,
|
|
20681
20796
|
normalizePathEncoding,
|
|
20797
|
+
serializePathEncoding,
|
|
20682
20798
|
normalizeQueryFragmentEncoding,
|
|
20799
|
+
encodeUserinfo,
|
|
20800
|
+
encodeQuery,
|
|
20801
|
+
encodeFragment,
|
|
20683
20802
|
escapePreservingEscapes,
|
|
20684
20803
|
removeDotSegments,
|
|
20685
20804
|
isIPv4,
|
|
@@ -20690,12 +20809,12 @@ var require_utils = __commonJS({
|
|
|
20690
20809
|
}
|
|
20691
20810
|
});
|
|
20692
20811
|
|
|
20693
|
-
// ../../node_modules/.pnpm/fast-uri@4.1.
|
|
20812
|
+
// ../../node_modules/.pnpm/fast-uri@4.1.4/node_modules/fast-uri/lib/schemes.js
|
|
20694
20813
|
var require_schemes = __commonJS({
|
|
20695
|
-
"../../node_modules/.pnpm/fast-uri@4.1.
|
|
20814
|
+
"../../node_modules/.pnpm/fast-uri@4.1.4/node_modules/fast-uri/lib/schemes.js"(exports, module) {
|
|
20696
20815
|
"use strict";
|
|
20697
|
-
var { isUUID } = require_utils();
|
|
20698
|
-
var URN_REG =
|
|
20816
|
+
var { isUUID, BYTE_HEX, percentEncodeNonAscii, nonSimpleMailtoDomain } = require_utils();
|
|
20817
|
+
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
20699
20818
|
var supportedSchemeNames = (
|
|
20700
20819
|
/** @type {const} */
|
|
20701
20820
|
[
|
|
@@ -20704,7 +20823,8 @@ var require_schemes = __commonJS({
|
|
|
20704
20823
|
"ws",
|
|
20705
20824
|
"wss",
|
|
20706
20825
|
"urn",
|
|
20707
|
-
"urn:uuid"
|
|
20826
|
+
"urn:uuid",
|
|
20827
|
+
"mailto"
|
|
20708
20828
|
]
|
|
20709
20829
|
);
|
|
20710
20830
|
function isValidSchemeName(name) {
|
|
@@ -20756,9 +20876,10 @@ var require_schemes = __commonJS({
|
|
|
20756
20876
|
wsComponent.secure = void 0;
|
|
20757
20877
|
}
|
|
20758
20878
|
if (wsComponent.resourceName) {
|
|
20759
|
-
const
|
|
20879
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
20880
|
+
const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
20760
20881
|
wsComponent.path = path && path !== "/" ? path : void 0;
|
|
20761
|
-
wsComponent.query =
|
|
20882
|
+
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
20762
20883
|
wsComponent.resourceName = void 0;
|
|
20763
20884
|
}
|
|
20764
20885
|
wsComponent.fragment = void 0;
|
|
@@ -20770,7 +20891,7 @@ var require_schemes = __commonJS({
|
|
|
20770
20891
|
return urnComponent;
|
|
20771
20892
|
}
|
|
20772
20893
|
const matches = urnComponent.path.match(URN_REG);
|
|
20773
|
-
if (matches) {
|
|
20894
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
20774
20895
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
20775
20896
|
urnComponent.nid = matches[1].toLowerCase();
|
|
20776
20897
|
urnComponent.nss = matches[2];
|
|
@@ -20870,6 +20991,226 @@ var require_schemes = __commonJS({
|
|
|
20870
20991
|
skipNormalize: true
|
|
20871
20992
|
}
|
|
20872
20993
|
);
|
|
20994
|
+
var LOCAL_PART_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=";
|
|
20995
|
+
var HFNAME_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@";
|
|
20996
|
+
var DTEXT_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";
|
|
20997
|
+
function allowSet(chars, allowNonAscii = false) {
|
|
20998
|
+
const table = new Uint8Array(128);
|
|
20999
|
+
for (let i = 0; i < chars.length; i++) {
|
|
21000
|
+
table[chars.charCodeAt(i)] = 1;
|
|
21001
|
+
}
|
|
21002
|
+
const escaped = chars.replace(/[\\\]^-]/gu, "\\$&");
|
|
21003
|
+
const cls = allowNonAscii ? `[${escaped}]|[^\\0-\\x7F\\uD800-\\uDFFF]` : `[${escaped}]`;
|
|
21004
|
+
return { all: new RegExp(`^(?:${cls})*$`, "u"), table, allowNonAscii };
|
|
21005
|
+
}
|
|
21006
|
+
var LOCAL_PART = allowSet(LOCAL_PART_ALLOWED);
|
|
21007
|
+
var HFNAME = allowSet(HFNAME_ALLOWED);
|
|
21008
|
+
var DTEXT = allowSet(DTEXT_ALLOWED);
|
|
21009
|
+
var DTEXT_IRI = allowSet(DTEXT_ALLOWED, true);
|
|
21010
|
+
var HEX_PAIR = /^[\da-f]{2}$/iu;
|
|
21011
|
+
var MAILTO_DOMAIN_LITERAL = /^\[[\x21-\x5A\x5E-\x7E]*\]$/u;
|
|
21012
|
+
var MAILTO_DOMAIN_ERROR = "URI mailto has an invalid recipient domain.";
|
|
21013
|
+
var HAS_SURROGATE = /[\uD800-\uDFFF]/u;
|
|
21014
|
+
function decodeHex(str) {
|
|
21015
|
+
if (typeof str !== "string" || str.indexOf("%") === -1) {
|
|
21016
|
+
return str;
|
|
21017
|
+
}
|
|
21018
|
+
try {
|
|
21019
|
+
return decodeURIComponent(str);
|
|
21020
|
+
} catch {
|
|
21021
|
+
return str;
|
|
21022
|
+
}
|
|
21023
|
+
}
|
|
21024
|
+
function replaceLoneSurrogates(input) {
|
|
21025
|
+
let result = "";
|
|
21026
|
+
for (let i = 0; i < input.length; i++) {
|
|
21027
|
+
const code = input.charCodeAt(i);
|
|
21028
|
+
if (code >= 55296 && code <= 56319 && i + 1 < input.length) {
|
|
21029
|
+
const low = input.charCodeAt(i + 1);
|
|
21030
|
+
if (low >= 56320 && low <= 57343) {
|
|
21031
|
+
result += input[i] + input[i + 1];
|
|
21032
|
+
i++;
|
|
21033
|
+
continue;
|
|
21034
|
+
}
|
|
21035
|
+
}
|
|
21036
|
+
result += code >= 55296 && code <= 57343 ? "\uFFFD" : input[i];
|
|
21037
|
+
}
|
|
21038
|
+
return result;
|
|
21039
|
+
}
|
|
21040
|
+
function encodeWithAllow(input, set) {
|
|
21041
|
+
if (set.all.test(input)) {
|
|
21042
|
+
return input;
|
|
21043
|
+
}
|
|
21044
|
+
const table = set.table;
|
|
21045
|
+
let result = "";
|
|
21046
|
+
for (let i = 0; i < input.length; i++) {
|
|
21047
|
+
const code = input.charCodeAt(i);
|
|
21048
|
+
if (code < 128) {
|
|
21049
|
+
if (table[code] === 1) {
|
|
21050
|
+
result += input[i];
|
|
21051
|
+
} else if (code === 37 && i + 2 < input.length && HEX_PAIR.test(input.slice(i + 1, i + 3))) {
|
|
21052
|
+
result += "%" + input.slice(i + 1, i + 3).toUpperCase();
|
|
21053
|
+
i += 2;
|
|
21054
|
+
} else {
|
|
21055
|
+
result += BYTE_HEX[code];
|
|
21056
|
+
}
|
|
21057
|
+
continue;
|
|
21058
|
+
}
|
|
21059
|
+
if (code < 55296 || code > 57343) {
|
|
21060
|
+
result += set.allowNonAscii ? input[i] : percentEncodeNonAscii(code);
|
|
21061
|
+
continue;
|
|
21062
|
+
}
|
|
21063
|
+
if (code <= 56319 && i + 1 < input.length) {
|
|
21064
|
+
const low = input.charCodeAt(i + 1);
|
|
21065
|
+
if (low >= 56320 && low <= 57343) {
|
|
21066
|
+
result += set.allowNonAscii ? input[i] + input[i + 1] : percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
21067
|
+
i++;
|
|
21068
|
+
continue;
|
|
21069
|
+
}
|
|
21070
|
+
}
|
|
21071
|
+
result += set.allowNonAscii ? "\uFFFD" : percentEncodeNonAscii(65533);
|
|
21072
|
+
}
|
|
21073
|
+
return result;
|
|
21074
|
+
}
|
|
21075
|
+
function mailtoNormalizeDomain(domain, options, component) {
|
|
21076
|
+
const normalizedDomain = String(domain).toLowerCase();
|
|
21077
|
+
if (MAILTO_DOMAIN_LITERAL.test(normalizedDomain)) {
|
|
21078
|
+
return normalizedDomain;
|
|
21079
|
+
}
|
|
21080
|
+
if (normalizedDomain !== "" && !nonSimpleMailtoDomain(normalizedDomain)) {
|
|
21081
|
+
return normalizedDomain;
|
|
21082
|
+
}
|
|
21083
|
+
try {
|
|
21084
|
+
const parsedDomain = new URL("http://" + normalizedDomain);
|
|
21085
|
+
if (parsedDomain.username || parsedDomain.password || parsedDomain.port || parsedDomain.pathname !== "/" || parsedDomain.search || parsedDomain.hash || !parsedDomain.hostname) {
|
|
21086
|
+
throw new Error(MAILTO_DOMAIN_ERROR);
|
|
21087
|
+
}
|
|
21088
|
+
return options && options.unicodeSupport ? normalizedDomain : parsedDomain.hostname;
|
|
21089
|
+
} catch {
|
|
21090
|
+
if (component) {
|
|
21091
|
+
component.error = component.error || MAILTO_DOMAIN_ERROR;
|
|
21092
|
+
}
|
|
21093
|
+
return normalizedDomain;
|
|
21094
|
+
}
|
|
21095
|
+
}
|
|
21096
|
+
function mailtoEncodeDomain(domain, options) {
|
|
21097
|
+
const set = options && options.unicodeSupport ? DTEXT_IRI : DTEXT;
|
|
21098
|
+
if (domain.length > 1 && domain[0] === "[" && domain[domain.length - 1] === "]") {
|
|
21099
|
+
return "[" + encodeWithAllow(domain.slice(1, -1), set) + "]";
|
|
21100
|
+
}
|
|
21101
|
+
return encodeWithAllow(domain, set);
|
|
21102
|
+
}
|
|
21103
|
+
function mailtoParse(component, options) {
|
|
21104
|
+
const mailtoComponent = component;
|
|
21105
|
+
let rawPath = mailtoComponent.path;
|
|
21106
|
+
let rawQuery = mailtoComponent.query;
|
|
21107
|
+
if (rawPath && HAS_SURROGATE.test(rawPath)) rawPath = replaceLoneSurrogates(rawPath);
|
|
21108
|
+
if (rawQuery && HAS_SURROGATE.test(rawQuery)) rawQuery = replaceLoneSurrogates(rawQuery);
|
|
21109
|
+
const to = rawPath ? rawPath.indexOf(",") === -1 ? [rawPath] : rawPath.split(",") : [];
|
|
21110
|
+
mailtoComponent.path = void 0;
|
|
21111
|
+
if (rawQuery) {
|
|
21112
|
+
let headers = null;
|
|
21113
|
+
let start = 0;
|
|
21114
|
+
while (start <= rawQuery.length) {
|
|
21115
|
+
let end = rawQuery.indexOf("&", start);
|
|
21116
|
+
if (end === -1) end = rawQuery.length;
|
|
21117
|
+
const token = rawQuery.slice(start, end);
|
|
21118
|
+
start = end + 1;
|
|
21119
|
+
const eqIdx = token.indexOf("=");
|
|
21120
|
+
if (eqIdx !== token.lastIndexOf("=")) {
|
|
21121
|
+
mailtoComponent.error = mailtoComponent.error || "URI mailto has malformed header fields.";
|
|
21122
|
+
continue;
|
|
21123
|
+
}
|
|
21124
|
+
const name = eqIdx === -1 ? token : token.slice(0, eqIdx);
|
|
21125
|
+
const value = eqIdx === -1 ? "" : token.slice(eqIdx + 1);
|
|
21126
|
+
if (name === "to") {
|
|
21127
|
+
const addrs = value.split(",");
|
|
21128
|
+
for (let j = 0; j < addrs.length; j++) to.push(addrs[j]);
|
|
21129
|
+
continue;
|
|
21130
|
+
}
|
|
21131
|
+
if (name === "subject") {
|
|
21132
|
+
mailtoComponent.subject = decodeHex(value);
|
|
21133
|
+
continue;
|
|
21134
|
+
}
|
|
21135
|
+
if (name === "body") {
|
|
21136
|
+
mailtoComponent.body = decodeHex(value);
|
|
21137
|
+
continue;
|
|
21138
|
+
}
|
|
21139
|
+
if (headers === null) headers = /** @type {Record<string,string>} */
|
|
21140
|
+
/* @__PURE__ */ Object.create(null);
|
|
21141
|
+
headers[decodeHex(name)] = decodeHex(value);
|
|
21142
|
+
}
|
|
21143
|
+
if (headers !== null) mailtoComponent.headers = headers;
|
|
21144
|
+
}
|
|
21145
|
+
mailtoComponent.query = void 0;
|
|
21146
|
+
for (let i = 0; i < to.length; i++) {
|
|
21147
|
+
const rawAddr = to[i];
|
|
21148
|
+
const atIdx = rawAddr.lastIndexOf("@");
|
|
21149
|
+
if (atIdx < 0) {
|
|
21150
|
+
mailtoComponent.error = mailtoComponent.error || MAILTO_DOMAIN_ERROR;
|
|
21151
|
+
to[i] = decodeHex(rawAddr);
|
|
21152
|
+
continue;
|
|
21153
|
+
}
|
|
21154
|
+
const local = decodeHex(rawAddr.slice(0, atIdx));
|
|
21155
|
+
const domain = mailtoNormalizeDomain(decodeHex(rawAddr.slice(atIdx + 1)), options, mailtoComponent);
|
|
21156
|
+
to[i] = local + "@" + domain;
|
|
21157
|
+
}
|
|
21158
|
+
if (to.length) mailtoComponent.to = to;
|
|
21159
|
+
return mailtoComponent;
|
|
21160
|
+
}
|
|
21161
|
+
function mailtoSerialize(component, options) {
|
|
21162
|
+
const mailtoComponent = component;
|
|
21163
|
+
const to = Array.isArray(mailtoComponent.to) ? mailtoComponent.to.slice() : [];
|
|
21164
|
+
if (to.length) {
|
|
21165
|
+
for (let i = 0; i < to.length; i++) {
|
|
21166
|
+
const addr = String(to[i]);
|
|
21167
|
+
const atIdx = addr.lastIndexOf("@");
|
|
21168
|
+
const rawLocal = atIdx >= 0 ? addr.slice(0, atIdx) : addr;
|
|
21169
|
+
const rawDomain = atIdx >= 0 ? addr.slice(atIdx + 1) : "";
|
|
21170
|
+
const local = encodeWithAllow(rawLocal, LOCAL_PART);
|
|
21171
|
+
const decodedDomain = decodeHex(rawDomain);
|
|
21172
|
+
const normalizedDomain = mailtoNormalizeDomain(decodedDomain, options);
|
|
21173
|
+
to[i] = local + "@" + mailtoEncodeDomain(normalizedDomain, options);
|
|
21174
|
+
}
|
|
21175
|
+
mailtoComponent.path = to.join(",");
|
|
21176
|
+
options.skipEscape = true;
|
|
21177
|
+
} else {
|
|
21178
|
+
mailtoComponent.path = void 0;
|
|
21179
|
+
}
|
|
21180
|
+
const headers = mailtoComponent.headers && typeof mailtoComponent.headers === "object" ? Object.assign(/* @__PURE__ */ Object.create(null), mailtoComponent.headers) : /* @__PURE__ */ Object.create(null);
|
|
21181
|
+
if (mailtoComponent.subject) headers.subject = mailtoComponent.subject;
|
|
21182
|
+
if (mailtoComponent.body) headers.body = mailtoComponent.body;
|
|
21183
|
+
mailtoComponent.headers = headers;
|
|
21184
|
+
let query = "";
|
|
21185
|
+
let count = 0;
|
|
21186
|
+
for (const name in headers) {
|
|
21187
|
+
if (count++ !== 0) query += "&";
|
|
21188
|
+
query += encodeWithAllow(name, HFNAME) + "=" + encodeWithAllow(String(headers[name]), HFNAME);
|
|
21189
|
+
}
|
|
21190
|
+
if (count !== 0) {
|
|
21191
|
+
mailtoComponent.query = query;
|
|
21192
|
+
} else {
|
|
21193
|
+
mailtoComponent.headers = void 0;
|
|
21194
|
+
}
|
|
21195
|
+
return mailtoComponent;
|
|
21196
|
+
}
|
|
21197
|
+
var mailto = (
|
|
21198
|
+
/** @type {SchemeHandler} */
|
|
21199
|
+
{
|
|
21200
|
+
scheme: "mailto",
|
|
21201
|
+
parse: mailtoParse,
|
|
21202
|
+
serialize: mailtoSerialize,
|
|
21203
|
+
domainHost: false,
|
|
21204
|
+
unicodeSupport: true,
|
|
21205
|
+
// `mailtoParse` re-derives every component from the raw path/query via
|
|
21206
|
+
// `decodeHex`, which subsumes the generic normalizers, so running them first
|
|
21207
|
+
// is wasted work (~28% of parsing a URI with header fields).
|
|
21208
|
+
skipNormalize: true,
|
|
21209
|
+
// A recipient list has no dot segments to remove, and `removeDotSegments`
|
|
21210
|
+
// would rewrite a "./"-prefixed local part.
|
|
21211
|
+
absolutePath: true
|
|
21212
|
+
}
|
|
21213
|
+
);
|
|
20873
21214
|
var SCHEMES = (
|
|
20874
21215
|
/** @type {Record<SchemeName, SchemeHandler>} */
|
|
20875
21216
|
{
|
|
@@ -20878,7 +21219,8 @@ var require_schemes = __commonJS({
|
|
|
20878
21219
|
ws,
|
|
20879
21220
|
wss,
|
|
20880
21221
|
urn,
|
|
20881
|
-
"urn:uuid": urnuuid
|
|
21222
|
+
"urn:uuid": urnuuid,
|
|
21223
|
+
mailto
|
|
20882
21224
|
}
|
|
20883
21225
|
);
|
|
20884
21226
|
Object.setPrototypeOf(SCHEMES, null);
|
|
@@ -20900,12 +21242,21 @@ var require_schemes = __commonJS({
|
|
|
20900
21242
|
}
|
|
20901
21243
|
});
|
|
20902
21244
|
|
|
20903
|
-
// ../../node_modules/.pnpm/fast-uri@4.1.
|
|
21245
|
+
// ../../node_modules/.pnpm/fast-uri@4.1.4/node_modules/fast-uri/index.js
|
|
20904
21246
|
var require_fast_uri = __commonJS({
|
|
20905
|
-
"../../node_modules/.pnpm/fast-uri@4.1.
|
|
21247
|
+
"../../node_modules/.pnpm/fast-uri@4.1.4/node_modules/fast-uri/index.js"(exports, module) {
|
|
20906
21248
|
"use strict";
|
|
20907
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, normalizeQueryFragmentEncoding,
|
|
21249
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
20908
21250
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
21251
|
+
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
21252
|
+
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
21253
|
+
function decodeValidScheme(scheme) {
|
|
21254
|
+
const decodedScheme = unescape(String(scheme));
|
|
21255
|
+
if (!VALID_SCHEME.test(decodedScheme)) {
|
|
21256
|
+
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
21257
|
+
}
|
|
21258
|
+
return decodedScheme;
|
|
21259
|
+
}
|
|
20909
21260
|
function normalize(uri, options) {
|
|
20910
21261
|
if (typeof uri === "string") {
|
|
20911
21262
|
uri = /** @type {T} */
|
|
@@ -20918,58 +21269,80 @@ var require_fast_uri = __commonJS({
|
|
|
20918
21269
|
}
|
|
20919
21270
|
function resolve2(baseURI, relativeURI, options) {
|
|
20920
21271
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
20921
|
-
const {
|
|
20922
|
-
|
|
20923
|
-
|
|
21272
|
+
const {
|
|
21273
|
+
parsed: baseParsed,
|
|
21274
|
+
malformedAuthorityOrPort: baseMalformed,
|
|
21275
|
+
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
21276
|
+
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
21277
|
+
malformedHost: baseMalformedHost,
|
|
21278
|
+
malformedScheme: baseMalformedScheme
|
|
21279
|
+
} = parseWithStatus(baseURI, schemelessOptions);
|
|
21280
|
+
const {
|
|
21281
|
+
parsed: relativeParsed,
|
|
21282
|
+
malformedAuthorityOrPort: relativeMalformed,
|
|
21283
|
+
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
21284
|
+
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
21285
|
+
malformedHost: relativeMalformedHost,
|
|
21286
|
+
malformedScheme: relativeMalformedScheme
|
|
21287
|
+
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
21288
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
20924
21289
|
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
20925
21290
|
}
|
|
20926
21291
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
21292
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
21293
|
+
const resolvedHost = resolved.host;
|
|
21294
|
+
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
21295
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
21296
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
|
|
21297
|
+
if (resolved.error && !encodedASCIIHost) {
|
|
21298
|
+
throw new Error(resolved.error);
|
|
21299
|
+
}
|
|
20927
21300
|
schemelessOptions.skipEscape = true;
|
|
20928
21301
|
return serialize(resolved, schemelessOptions);
|
|
20929
21302
|
}
|
|
20930
|
-
function resolveComponent(base,
|
|
21303
|
+
function resolveComponent(base, relative2, options, skipNormalization) {
|
|
20931
21304
|
const target = {};
|
|
20932
21305
|
if (!skipNormalization) {
|
|
20933
21306
|
base = parse(serialize(base, options), options);
|
|
20934
|
-
|
|
21307
|
+
relative2 = parse(serialize(relative2, options), options);
|
|
20935
21308
|
}
|
|
20936
21309
|
options = options || {};
|
|
20937
|
-
if (!options.tolerant &&
|
|
20938
|
-
target.scheme =
|
|
20939
|
-
target.userinfo =
|
|
20940
|
-
target.host =
|
|
20941
|
-
target.port =
|
|
20942
|
-
target.path = removeDotSegments(
|
|
20943
|
-
target.query =
|
|
21310
|
+
if (!options.tolerant && relative2.scheme) {
|
|
21311
|
+
target.scheme = relative2.scheme;
|
|
21312
|
+
target.userinfo = relative2.userinfo;
|
|
21313
|
+
target.host = relative2.host;
|
|
21314
|
+
target.port = relative2.port;
|
|
21315
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
21316
|
+
target.query = relative2.query;
|
|
20944
21317
|
} else {
|
|
20945
|
-
if (
|
|
20946
|
-
target.userinfo =
|
|
20947
|
-
target.host =
|
|
20948
|
-
target.port =
|
|
20949
|
-
target.path = removeDotSegments(
|
|
20950
|
-
target.query =
|
|
21318
|
+
if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
|
|
21319
|
+
target.userinfo = relative2.userinfo;
|
|
21320
|
+
target.host = relative2.host;
|
|
21321
|
+
target.port = relative2.port;
|
|
21322
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
21323
|
+
target.query = relative2.query;
|
|
20951
21324
|
} else {
|
|
20952
|
-
if (!
|
|
21325
|
+
if (!relative2.path) {
|
|
20953
21326
|
target.path = base.path;
|
|
20954
|
-
if (
|
|
20955
|
-
target.query =
|
|
21327
|
+
if (relative2.query !== void 0) {
|
|
21328
|
+
target.query = relative2.query;
|
|
20956
21329
|
} else {
|
|
20957
21330
|
target.query = base.query;
|
|
20958
21331
|
}
|
|
20959
21332
|
} else {
|
|
20960
|
-
if (
|
|
20961
|
-
target.path = removeDotSegments(
|
|
21333
|
+
if (relative2.path[0] === "/") {
|
|
21334
|
+
target.path = removeDotSegments(relative2.path);
|
|
20962
21335
|
} else {
|
|
20963
21336
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
20964
|
-
target.path = "/" +
|
|
21337
|
+
target.path = "/" + relative2.path;
|
|
20965
21338
|
} else if (!base.path) {
|
|
20966
|
-
target.path =
|
|
21339
|
+
target.path = relative2.path;
|
|
20967
21340
|
} else {
|
|
20968
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
21341
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
|
|
20969
21342
|
}
|
|
20970
21343
|
target.path = removeDotSegments(target.path);
|
|
20971
21344
|
}
|
|
20972
|
-
target.query =
|
|
21345
|
+
target.query = relative2.query;
|
|
20973
21346
|
}
|
|
20974
21347
|
target.userinfo = base.userinfo;
|
|
20975
21348
|
target.host = base.host;
|
|
@@ -20977,13 +21350,13 @@ var require_fast_uri = __commonJS({
|
|
|
20977
21350
|
}
|
|
20978
21351
|
target.scheme = base.scheme;
|
|
20979
21352
|
}
|
|
20980
|
-
target.fragment =
|
|
21353
|
+
target.fragment = relative2.fragment;
|
|
20981
21354
|
return target;
|
|
20982
21355
|
}
|
|
20983
21356
|
function equal(uriA, uriB, options) {
|
|
20984
21357
|
const normalizedA = normalizeComparableURI(uriA, options);
|
|
20985
21358
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
20986
|
-
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA
|
|
21359
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
20987
21360
|
}
|
|
20988
21361
|
function serialize(cmpts, opts) {
|
|
20989
21362
|
const component = {
|
|
@@ -21000,23 +21373,30 @@ var require_fast_uri = __commonJS({
|
|
|
21000
21373
|
reference: cmpts.reference,
|
|
21001
21374
|
resourceName: cmpts.resourceName,
|
|
21002
21375
|
secure: cmpts.secure,
|
|
21376
|
+
to: cmpts.to,
|
|
21377
|
+
subject: cmpts.subject,
|
|
21378
|
+
body: cmpts.body,
|
|
21379
|
+
headers: cmpts.headers,
|
|
21003
21380
|
error: ""
|
|
21004
21381
|
};
|
|
21005
21382
|
const options = Object.assign({}, opts);
|
|
21006
21383
|
const uriTokens = [];
|
|
21384
|
+
if (component.scheme) {
|
|
21385
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
21386
|
+
}
|
|
21007
21387
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
21008
21388
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
21389
|
+
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
21390
|
+
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
21009
21391
|
if (component.path !== void 0) {
|
|
21010
21392
|
if (!options.skipEscape) {
|
|
21011
|
-
component.path =
|
|
21012
|
-
if (component.scheme !== void 0) {
|
|
21013
|
-
component.path = component.path.split("%3A").join(":");
|
|
21014
|
-
}
|
|
21393
|
+
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
21015
21394
|
} else {
|
|
21016
21395
|
component.path = normalizePercentEncoding(component.path);
|
|
21017
21396
|
}
|
|
21018
21397
|
}
|
|
21019
21398
|
if (options.reference !== "suffix" && component.scheme) {
|
|
21399
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
21020
21400
|
uriTokens.push(component.scheme, ":");
|
|
21021
21401
|
}
|
|
21022
21402
|
const authority = recomposeAuthority(component);
|
|
@@ -21034,16 +21414,19 @@ var require_fast_uri = __commonJS({
|
|
|
21034
21414
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
21035
21415
|
s = removeDotSegments(s);
|
|
21036
21416
|
}
|
|
21417
|
+
if (pathNoScheme) {
|
|
21418
|
+
s = serializePathEncoding(s, true);
|
|
21419
|
+
}
|
|
21037
21420
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") {
|
|
21038
21421
|
s = "/%2F" + s.slice(2);
|
|
21039
21422
|
}
|
|
21040
21423
|
uriTokens.push(s);
|
|
21041
21424
|
}
|
|
21042
21425
|
if (component.query !== void 0) {
|
|
21043
|
-
uriTokens.push("?", component.query);
|
|
21426
|
+
uriTokens.push("?", encodeQuery(component.query));
|
|
21044
21427
|
}
|
|
21045
21428
|
if (component.fragment !== void 0) {
|
|
21046
|
-
uriTokens.push("#", component.fragment);
|
|
21429
|
+
uriTokens.push("#", encodeFragment(component.fragment));
|
|
21047
21430
|
}
|
|
21048
21431
|
return uriTokens.join("");
|
|
21049
21432
|
}
|
|
@@ -21059,6 +21442,36 @@ var require_fast_uri = __commonJS({
|
|
|
21059
21442
|
}
|
|
21060
21443
|
return void 0;
|
|
21061
21444
|
}
|
|
21445
|
+
function hasMalformedPercentEncoding(component) {
|
|
21446
|
+
if (component === void 0) return false;
|
|
21447
|
+
let percent = component.indexOf("%");
|
|
21448
|
+
while (percent !== -1) {
|
|
21449
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
|
|
21450
|
+
return true;
|
|
21451
|
+
}
|
|
21452
|
+
percent = component.indexOf("%", percent + 3);
|
|
21453
|
+
}
|
|
21454
|
+
return false;
|
|
21455
|
+
}
|
|
21456
|
+
function isIPLiteral(host) {
|
|
21457
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
21458
|
+
}
|
|
21459
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
21460
|
+
const host = matches[4];
|
|
21461
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
21462
|
+
}
|
|
21463
|
+
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
21464
|
+
const bracketedIPLiteral = parsed.host && parsed.host[0] === "[" && parsed.host[parsed.host.length - 1] === "]";
|
|
21465
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && !bracketedIPLiteral && nonSimpleDomain(parsed.host)) {
|
|
21466
|
+
try {
|
|
21467
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
21468
|
+
} catch (e) {
|
|
21469
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
21470
|
+
return true;
|
|
21471
|
+
}
|
|
21472
|
+
}
|
|
21473
|
+
return false;
|
|
21474
|
+
}
|
|
21062
21475
|
function parseWithStatus(uri, opts) {
|
|
21063
21476
|
const options = Object.assign({}, opts);
|
|
21064
21477
|
const parsed = {
|
|
@@ -21071,6 +21484,11 @@ var require_fast_uri = __commonJS({
|
|
|
21071
21484
|
fragment: void 0
|
|
21072
21485
|
};
|
|
21073
21486
|
let malformedAuthorityOrPort = false;
|
|
21487
|
+
let malformedPercentEncoding = false;
|
|
21488
|
+
let malformedSchemeSpecific = false;
|
|
21489
|
+
let malformedHost = false;
|
|
21490
|
+
let malformedIPLiteral = false;
|
|
21491
|
+
let malformedScheme = false;
|
|
21074
21492
|
let isIP = false;
|
|
21075
21493
|
if (options.reference === "suffix") {
|
|
21076
21494
|
if (options.scheme) {
|
|
@@ -21100,13 +21518,26 @@ var require_fast_uri = __commonJS({
|
|
|
21100
21518
|
}
|
|
21101
21519
|
const matches = uri.match(URI_PARSE);
|
|
21102
21520
|
if (matches) {
|
|
21103
|
-
parsed.scheme = matches[1]
|
|
21521
|
+
parsed.scheme = matches[1];
|
|
21104
21522
|
parsed.userinfo = matches[3];
|
|
21105
21523
|
parsed.host = matches[4];
|
|
21106
21524
|
parsed.port = parseInt(matches[5], 10);
|
|
21107
21525
|
parsed.path = matches[6] || "";
|
|
21108
21526
|
parsed.query = matches[7];
|
|
21109
21527
|
parsed.fragment = matches[8];
|
|
21528
|
+
if (parsed.scheme !== void 0) {
|
|
21529
|
+
const decodedScheme = unescape(parsed.scheme);
|
|
21530
|
+
if (VALID_SCHEME.test(decodedScheme)) {
|
|
21531
|
+
parsed.scheme = decodedScheme.toLowerCase();
|
|
21532
|
+
} else {
|
|
21533
|
+
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
21534
|
+
malformedScheme = true;
|
|
21535
|
+
}
|
|
21536
|
+
}
|
|
21537
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
21538
|
+
if (malformedPercentEncoding) {
|
|
21539
|
+
parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
21540
|
+
}
|
|
21110
21541
|
if (isNaN(parsed.port)) {
|
|
21111
21542
|
parsed.port = matches[5];
|
|
21112
21543
|
}
|
|
@@ -21118,9 +21549,16 @@ var require_fast_uri = __commonJS({
|
|
|
21118
21549
|
if (parsed.host) {
|
|
21119
21550
|
const ipv4result = isIPv4(parsed.host);
|
|
21120
21551
|
if (ipv4result === false) {
|
|
21552
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
21553
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
21121
21554
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
21122
|
-
|
|
21123
|
-
|
|
21555
|
+
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
21556
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
21557
|
+
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
21558
|
+
if (malformedIPLiteral) {
|
|
21559
|
+
parsed.error = parsed.error || "URI host is malformed.";
|
|
21560
|
+
malformedAuthorityOrPort = true;
|
|
21561
|
+
}
|
|
21124
21562
|
} else {
|
|
21125
21563
|
isIP = true;
|
|
21126
21564
|
}
|
|
@@ -21138,22 +21576,14 @@ var require_fast_uri = __commonJS({
|
|
|
21138
21576
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
21139
21577
|
}
|
|
21140
21578
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
21141
|
-
if (!
|
|
21142
|
-
|
|
21143
|
-
try {
|
|
21144
|
-
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
21145
|
-
} catch (e) {
|
|
21146
|
-
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
21147
|
-
}
|
|
21148
|
-
}
|
|
21579
|
+
if (!malformedIPLiteral) {
|
|
21580
|
+
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
21149
21581
|
}
|
|
21150
21582
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
21151
21583
|
if (uri.indexOf("%") !== -1) {
|
|
21152
|
-
if (parsed.
|
|
21153
|
-
parsed.
|
|
21154
|
-
|
|
21155
|
-
if (parsed.host !== void 0) {
|
|
21156
|
-
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
21584
|
+
if (parsed.host !== void 0 && !malformedIPLiteral) {
|
|
21585
|
+
const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
21586
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
21157
21587
|
}
|
|
21158
21588
|
}
|
|
21159
21589
|
if (parsed.path) {
|
|
@@ -21168,11 +21598,14 @@ var require_fast_uri = __commonJS({
|
|
|
21168
21598
|
}
|
|
21169
21599
|
if (schemeHandler && schemeHandler.parse) {
|
|
21170
21600
|
schemeHandler.parse(parsed, options);
|
|
21601
|
+
if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
|
|
21602
|
+
malformedSchemeSpecific = true;
|
|
21603
|
+
}
|
|
21171
21604
|
}
|
|
21172
21605
|
} else {
|
|
21173
21606
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
21174
21607
|
}
|
|
21175
|
-
return { parsed, malformedAuthorityOrPort };
|
|
21608
|
+
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
21176
21609
|
}
|
|
21177
21610
|
function parse(uri, opts) {
|
|
21178
21611
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -21181,20 +21614,28 @@ var require_fast_uri = __commonJS({
|
|
|
21181
21614
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
21182
21615
|
}
|
|
21183
21616
|
function normalizeStringWithStatus(uri, opts) {
|
|
21184
|
-
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
21617
|
+
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
21185
21618
|
return {
|
|
21186
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
21187
|
-
malformedAuthorityOrPort
|
|
21619
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
21620
|
+
malformedAuthorityOrPort,
|
|
21621
|
+
malformedPercentEncoding,
|
|
21622
|
+
malformedSchemeSpecific,
|
|
21623
|
+
malformedHost,
|
|
21624
|
+
malformedScheme
|
|
21188
21625
|
};
|
|
21189
21626
|
}
|
|
21190
21627
|
function normalizeComparableURI(uri, opts) {
|
|
21191
|
-
if (typeof uri
|
|
21192
|
-
|
|
21193
|
-
return malformedAuthorityOrPort ? void 0 : normalized;
|
|
21628
|
+
if (typeof uri !== "string" && typeof uri !== "object") {
|
|
21629
|
+
return void 0;
|
|
21194
21630
|
}
|
|
21195
|
-
|
|
21196
|
-
|
|
21631
|
+
let value;
|
|
21632
|
+
try {
|
|
21633
|
+
value = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
21634
|
+
} catch {
|
|
21635
|
+
return void 0;
|
|
21197
21636
|
}
|
|
21637
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
21638
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
21198
21639
|
}
|
|
21199
21640
|
var fastUri = {
|
|
21200
21641
|
SCHEMES,
|
|
@@ -24677,7 +25118,7 @@ function getWellformedEdit(textEdit) {
|
|
|
24677
25118
|
var import_yaml = __toESM(require_dist(), 1);
|
|
24678
25119
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
24679
25120
|
import { createRequire } from "node:module";
|
|
24680
|
-
import { dirname, join, resolve } from "node:path";
|
|
25121
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
24681
25122
|
import { fileURLToPath } from "node:url";
|
|
24682
25123
|
|
|
24683
25124
|
// src/coverage.ts
|
|
@@ -24794,6 +25235,7 @@ var DEFAULT_RULE_SEVERITY = {
|
|
|
24794
25235
|
"invalid-format": "error",
|
|
24795
25236
|
"invalid-reference": "error",
|
|
24796
25237
|
"unknown-casetype": "warning",
|
|
25238
|
+
"invalid-location": "error",
|
|
24797
25239
|
"parse-error": "error",
|
|
24798
25240
|
// A warning, not an error: a red test is a statement about the SCRIPT, and the
|
|
24799
25241
|
// write gate must not make a casetype unsaveable because its code is mid-fix.
|