omni-dsh-plugins 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/dist/bin.js +409 -126
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -6534,9 +6534,28 @@ var require_utils = __commonJS({
6534
6534
  "use strict";
6535
6535
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
6536
6536
  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);
6537
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
6537
6538
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
6538
6539
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
6539
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
6540
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
6541
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
6542
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
6543
+ var BYTE_HEX = new Array(256);
6544
+ {
6545
+ const HEX_DIGITS = "0123456789ABCDEF";
6546
+ for (let i = 0; i < 256; i++) {
6547
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
6548
+ }
6549
+ }
6550
+ function percentEncodeNonAscii(cp2) {
6551
+ if (cp2 < 2048) {
6552
+ return BYTE_HEX[192 | cp2 >> 6] + BYTE_HEX[128 | cp2 & 63];
6553
+ }
6554
+ if (cp2 < 65536) {
6555
+ return BYTE_HEX[224 | cp2 >> 12] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
6556
+ }
6557
+ return BYTE_HEX[240 | cp2 >> 18] + BYTE_HEX[128 | cp2 >> 12 & 63] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
6558
+ }
6540
6559
  function stringArrayToHexStripped(input) {
6541
6560
  let acc = "";
6542
6561
  let code = 0;
@@ -6561,91 +6580,105 @@ var require_utils = __commonJS({
6561
6580
  }
6562
6581
  return acc;
6563
6582
  }
6583
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
6584
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
6585
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
6564
6586
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
6565
- function consumeIsZone(buffer) {
6566
- buffer.length = 0;
6567
- return true;
6568
- }
6569
- function consumeHextets(buffer, address, output) {
6570
- if (buffer.length) {
6571
- const hex = stringArrayToHexStripped(buffer);
6572
- if (hex !== "") {
6573
- address.push(hex);
6574
- } else {
6575
- output.error = true;
6576
- return false;
6587
+ function isZoneIdentifier(zone) {
6588
+ if (zone.length === 0) return false;
6589
+ for (let i = 0; i < zone.length; i++) {
6590
+ if (isZoneCharacter(zone[i])) continue;
6591
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
6592
+ i += 2;
6593
+ continue;
6577
6594
  }
6578
- buffer.length = 0;
6595
+ return false;
6579
6596
  }
6580
6597
  return true;
6581
6598
  }
6582
- function getIPV6(input) {
6583
- let tokenCount = 0;
6584
- const output = { error: false, address: "", zone: "" };
6585
- const address = [];
6586
- const buffer = [];
6587
- let endipv6Encountered = false;
6588
- let endIpv6 = false;
6589
- let consume = consumeHextets;
6590
- for (let i = 0; i < input.length; i++) {
6591
- const cursor = input[i];
6592
- if (cursor === "[" || cursor === "]") {
6593
- continue;
6594
- }
6595
- if (cursor === ":") {
6596
- if (endipv6Encountered === true) {
6597
- endIpv6 = true;
6598
- }
6599
- if (!consume(buffer, address, output)) {
6600
- break;
6599
+ function compressIPv6ZeroRun(hextets) {
6600
+ let bestStart = -1;
6601
+ let bestLength = 0;
6602
+ let runStart = -1;
6603
+ let runLength = 0;
6604
+ for (let i = 0; i < hextets.length; i++) {
6605
+ if (hextets[i] === "0") {
6606
+ if (runStart === -1) runStart = i;
6607
+ runLength++;
6608
+ if (runLength > bestLength) {
6609
+ bestLength = runLength;
6610
+ bestStart = runStart;
6601
6611
  }
6602
- if (++tokenCount > 7) {
6603
- output.error = true;
6604
- break;
6605
- }
6606
- if (i > 0 && input[i - 1] === ":") {
6607
- endipv6Encountered = true;
6608
- }
6609
- address.push(":");
6610
- continue;
6611
- } else if (cursor === "%") {
6612
- if (!consume(buffer, address, output)) {
6613
- break;
6614
- }
6615
- consume = consumeIsZone;
6616
6612
  } else {
6617
- buffer.push(cursor);
6613
+ runStart = -1;
6614
+ runLength = 0;
6615
+ }
6616
+ }
6617
+ if (bestLength < 2) return hextets.join(":");
6618
+ const head = hextets.slice(0, bestStart).join(":");
6619
+ const tail = hextets.slice(bestStart + bestLength).join(":");
6620
+ return head + "::" + tail;
6621
+ }
6622
+ function normalizeIPv6Address(input) {
6623
+ const compression = input.indexOf("::");
6624
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
6625
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
6626
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
6627
+ if (compression !== -1) {
6628
+ if (left.length === 1 && left[0] === "") left.length = 0;
6629
+ if (right.length === 1 && right[0] === "") right.length = 0;
6630
+ }
6631
+ const parts = left.concat(right);
6632
+ let hextetCount = 0;
6633
+ for (let i = 0; i < parts.length; i++) {
6634
+ const part = parts[i];
6635
+ if (part === "") return void 0;
6636
+ if (part.indexOf(".") !== -1) {
6637
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
6638
+ hextetCount += 2;
6618
6639
  continue;
6619
6640
  }
6641
+ if (!isHextet(part)) return void 0;
6642
+ parts[i] = parseInt(part, 16).toString(16);
6643
+ hextetCount++;
6620
6644
  }
6621
- if (buffer.length) {
6622
- if (consume === consumeIsZone) {
6623
- output.zone = buffer.join("");
6624
- } else if (endIpv6) {
6625
- address.push(buffer.join(""));
6626
- } else {
6627
- address.push(stringArrayToHexStripped(buffer));
6628
- }
6645
+ if (compression === -1) {
6646
+ if (hextetCount !== 8) return void 0;
6647
+ return compressIPv6ZeroRun(parts);
6629
6648
  }
6630
- output.address = address.join("");
6631
- return output;
6649
+ if (hextetCount >= 8) return void 0;
6650
+ const expanded = parts.slice(0, left.length);
6651
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
6652
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
6653
+ return compressIPv6ZeroRun(expanded);
6632
6654
  }
6633
6655
  function normalizeIPv6(host) {
6634
- if (findToken(host, ":") < 2) {
6635
- return { host, isIPV6: false };
6636
- }
6637
- const ipv6 = getIPV6(host);
6638
- if (!ipv6.error) {
6639
- let newHost = ipv6.address;
6640
- let escapedHost = ipv6.address;
6641
- if (ipv6.zone) {
6642
- newHost += "%" + ipv6.zone;
6643
- escapedHost += "%25" + ipv6.zone;
6644
- }
6645
- return { host: newHost, isIPV6: true, escapedHost };
6646
- } else {
6647
- return { host, isIPV6: false };
6648
- }
6656
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
6657
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
6658
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
6659
+ let input = bracketed ? host.slice(1, -1) : host;
6660
+ if (bracketed && isIPvFuture(input)) {
6661
+ input = input.toLowerCase();
6662
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
6663
+ }
6664
+ if (findToken(input, ":") < 2) {
6665
+ return { host, isIPV6: false, error: bracketed };
6666
+ }
6667
+ let zoneIdentifier = "";
6668
+ const zoneSeparator = input.indexOf("%");
6669
+ if (zoneSeparator !== -1) {
6670
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
6671
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
6672
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
6673
+ input = input.slice(0, zoneSeparator);
6674
+ }
6675
+ const address = normalizeIPv6Address(input);
6676
+ if (address === void 0) return { host, isIPV6: false, error: true };
6677
+ return {
6678
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
6679
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
6680
+ isIPV6: true
6681
+ };
6649
6682
  }
6650
6683
  function findToken(str, token) {
6651
6684
  let ind = 0;
@@ -6764,7 +6797,8 @@ var require_utils = __commonJS({
6764
6797
  function normalizePathEncoding(input) {
6765
6798
  let output = "";
6766
6799
  for (let i = 0; i < input.length; i++) {
6767
- if (input[i] === "%" && i + 2 < input.length) {
6800
+ const ch = input[i];
6801
+ if (ch === "%" && i + 2 < input.length) {
6768
6802
  const hex = input.slice(i + 1, i + 3);
6769
6803
  if (isHexPair(hex)) {
6770
6804
  const normalizedHex = hex.toUpperCase();
@@ -6778,10 +6812,152 @@ var require_utils = __commonJS({
6778
6812
  continue;
6779
6813
  }
6780
6814
  }
6781
- if (isPathCharacter(input[i])) {
6782
- output += input[i];
6815
+ if (isPathCharacter(ch)) {
6816
+ output += ch;
6817
+ } else {
6818
+ const code = input.charCodeAt(i);
6819
+ if (code < 128) {
6820
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
6821
+ } else if (code < 55296 || code > 57343) {
6822
+ output += percentEncodeNonAscii(code);
6823
+ } else if (code <= 56319 && i + 1 < input.length) {
6824
+ const low = input.charCodeAt(i + 1);
6825
+ if (low >= 56320 && low <= 57343) {
6826
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
6827
+ i++;
6828
+ } else {
6829
+ output += percentEncodeNonAscii(65533);
6830
+ }
6831
+ } else {
6832
+ output += percentEncodeNonAscii(65533);
6833
+ }
6834
+ }
6835
+ }
6836
+ return output;
6837
+ }
6838
+ function serializePathEncoding(input, pathNoScheme = false) {
6839
+ let output = "";
6840
+ let firstSegment = pathNoScheme && input[0] !== "/";
6841
+ for (let i = 0; i < input.length; i++) {
6842
+ const ch = input[i];
6843
+ if (ch === "%" && i + 2 < input.length) {
6844
+ const hex = input.slice(i + 1, i + 3);
6845
+ if (isHexPair(hex)) {
6846
+ output += "%" + hex.toUpperCase();
6847
+ i += 2;
6848
+ continue;
6849
+ }
6850
+ }
6851
+ if (ch === "/") {
6852
+ firstSegment = false;
6853
+ }
6854
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
6855
+ output += ch;
6856
+ } else {
6857
+ const code = input.charCodeAt(i);
6858
+ if (code < 128) {
6859
+ output += BYTE_HEX[code];
6860
+ } else if (code < 55296 || code > 57343) {
6861
+ output += percentEncodeNonAscii(code);
6862
+ } else if (code <= 56319 && i + 1 < input.length) {
6863
+ const low = input.charCodeAt(i + 1);
6864
+ if (low >= 56320 && low <= 57343) {
6865
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
6866
+ i++;
6867
+ } else {
6868
+ output += percentEncodeNonAscii(65533);
6869
+ }
6870
+ } else {
6871
+ output += percentEncodeNonAscii(65533);
6872
+ }
6873
+ }
6874
+ }
6875
+ return output;
6876
+ }
6877
+ function encodeComponent(input, isAllowed) {
6878
+ let output = "";
6879
+ for (let i = 0; i < input.length; i++) {
6880
+ const ch = input[i];
6881
+ if (ch === "%" && i + 2 < input.length) {
6882
+ const hex = input.slice(i + 1, i + 3);
6883
+ if (isHexPair(hex)) {
6884
+ output += "%" + hex.toUpperCase();
6885
+ i += 2;
6886
+ continue;
6887
+ }
6888
+ }
6889
+ if (isAllowed(ch)) {
6890
+ output += ch;
6891
+ } else {
6892
+ const code = input.charCodeAt(i);
6893
+ if (code < 128) {
6894
+ output += BYTE_HEX[code];
6895
+ } else if (code < 55296 || code > 57343) {
6896
+ output += percentEncodeNonAscii(code);
6897
+ } else if (code <= 56319 && i + 1 < input.length) {
6898
+ const low = input.charCodeAt(i + 1);
6899
+ if (low >= 56320 && low <= 57343) {
6900
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
6901
+ i++;
6902
+ } else {
6903
+ output += percentEncodeNonAscii(65533);
6904
+ }
6905
+ } else {
6906
+ output += percentEncodeNonAscii(65533);
6907
+ }
6908
+ }
6909
+ }
6910
+ return output;
6911
+ }
6912
+ function encodeUserinfo(input) {
6913
+ return encodeComponent(input, isUserinfoCharacter);
6914
+ }
6915
+ function encodeQuery(input) {
6916
+ return encodeComponent(input, isQueryFragmentCharacter);
6917
+ }
6918
+ function encodeFragment(input) {
6919
+ return encodeComponent(input, isQueryFragmentCharacter);
6920
+ }
6921
+ function isEscapeSafe(cp2) {
6922
+ return cp2 >= 48 && cp2 <= 57 || cp2 >= 65 && cp2 <= 90 || cp2 >= 97 && cp2 <= 122 || cp2 === 42 || cp2 === 43 || cp2 === 45 || cp2 === 46 || cp2 === 47 || cp2 === 64 || cp2 === 95;
6923
+ }
6924
+ function normalizeQueryFragmentEncoding(input) {
6925
+ let output = "";
6926
+ for (let i = 0; i < input.length; i++) {
6927
+ const ch = input[i];
6928
+ if (ch === "%" && i + 2 < input.length) {
6929
+ const hex = input.slice(i + 1, i + 3);
6930
+ if (isHexPair(hex)) {
6931
+ const normalizedHex = hex.toUpperCase();
6932
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
6933
+ if (isUnreserved(decoded)) {
6934
+ output += decoded;
6935
+ } else {
6936
+ output += "%" + normalizedHex;
6937
+ }
6938
+ i += 2;
6939
+ continue;
6940
+ }
6941
+ }
6942
+ if (isQueryFragmentCharacter(ch)) {
6943
+ output += ch;
6783
6944
  } else {
6784
- output += escape(input[i]);
6945
+ const code = input.charCodeAt(i);
6946
+ if (code < 128) {
6947
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
6948
+ } else if (code < 55296 || code > 57343) {
6949
+ output += percentEncodeNonAscii(code);
6950
+ } else if (code <= 56319 && i + 1 < input.length) {
6951
+ const low = input.charCodeAt(i + 1);
6952
+ if (low >= 56320 && low <= 57343) {
6953
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
6954
+ i++;
6955
+ } else {
6956
+ output += percentEncodeNonAscii(65533);
6957
+ }
6958
+ } else {
6959
+ output += percentEncodeNonAscii(65533);
6960
+ }
6785
6961
  }
6786
6962
  }
6787
6963
  return output;
@@ -6804,14 +6980,18 @@ var require_utils = __commonJS({
6804
6980
  function recomposeAuthority(component) {
6805
6981
  const uriTokens = [];
6806
6982
  if (component.userinfo !== void 0) {
6807
- uriTokens.push(component.userinfo);
6983
+ uriTokens.push(encodeUserinfo(component.userinfo));
6808
6984
  uriTokens.push("@");
6809
6985
  }
6810
6986
  if (component.host !== void 0) {
6811
- let host = unescape(component.host);
6987
+ let host = component.host;
6812
6988
  if (!isIPv4(host)) {
6813
- const ipV6res = normalizeIPv6(host);
6814
- if (ipV6res.isIPV6 === true) {
6989
+ let ipV6res = normalizeIPv6(host);
6990
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
6991
+ host = normalizePercentEncoding(host, true);
6992
+ ipV6res = normalizeIPv6(host);
6993
+ }
6994
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
6815
6995
  host = `[${ipV6res.escapedHost}]`;
6816
6996
  } else {
6817
6997
  host = reescapeHostDelimiters(host, false);
@@ -6820,8 +7000,12 @@ var require_utils = __commonJS({
6820
7000
  uriTokens.push(host);
6821
7001
  }
6822
7002
  if (typeof component.port === "number" || typeof component.port === "string") {
7003
+ const port = String(component.port);
7004
+ if (!isPort(port)) {
7005
+ throw new TypeError("URI port is malformed.");
7006
+ }
6823
7007
  uriTokens.push(":");
6824
- uriTokens.push(String(component.port));
7008
+ uriTokens.push(port);
6825
7009
  }
6826
7010
  return uriTokens.length ? uriTokens.join("") : void 0;
6827
7011
  }
@@ -6831,6 +7015,11 @@ var require_utils = __commonJS({
6831
7015
  reescapeHostDelimiters,
6832
7016
  normalizePercentEncoding,
6833
7017
  normalizePathEncoding,
7018
+ serializePathEncoding,
7019
+ normalizeQueryFragmentEncoding,
7020
+ encodeUserinfo,
7021
+ encodeQuery,
7022
+ encodeFragment,
6834
7023
  escapePreservingEscapes,
6835
7024
  removeDotSegments,
6836
7025
  isIPv4,
@@ -6846,7 +7035,7 @@ var require_schemes = __commonJS({
6846
7035
  "node_modules/fast-uri/lib/schemes.js"(exports, module) {
6847
7036
  "use strict";
6848
7037
  var { isUUID } = require_utils();
6849
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
7038
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
6850
7039
  var supportedSchemeNames = (
6851
7040
  /** @type {const} */
6852
7041
  [
@@ -6907,9 +7096,10 @@ var require_schemes = __commonJS({
6907
7096
  wsComponent.secure = void 0;
6908
7097
  }
6909
7098
  if (wsComponent.resourceName) {
6910
- const [path, query] = wsComponent.resourceName.split("?");
7099
+ const queryIndex = wsComponent.resourceName.indexOf("?");
7100
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
6911
7101
  wsComponent.path = path && path !== "/" ? path : void 0;
6912
- wsComponent.query = query;
7102
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
6913
7103
  wsComponent.resourceName = void 0;
6914
7104
  }
6915
7105
  wsComponent.fragment = void 0;
@@ -6921,7 +7111,7 @@ var require_schemes = __commonJS({
6921
7111
  return urnComponent;
6922
7112
  }
6923
7113
  const matches = urnComponent.path.match(URN_REG);
6924
- if (matches) {
7114
+ if (matches && matches[0] === urnComponent.path) {
6925
7115
  const scheme = options.scheme || urnComponent.scheme || "urn";
6926
7116
  urnComponent.nid = matches[1].toLowerCase();
6927
7117
  urnComponent.nss = matches[2];
@@ -7055,8 +7245,17 @@ var require_schemes = __commonJS({
7055
7245
  var require_fast_uri = __commonJS({
7056
7246
  "node_modules/fast-uri/index.js"(exports, module) {
7057
7247
  "use strict";
7058
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
7248
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
7059
7249
  var { SCHEMES, getSchemeHandler } = require_schemes();
7250
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
7251
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
7252
+ function decodeValidScheme(scheme) {
7253
+ const decodedScheme = unescape(String(scheme));
7254
+ if (!VALID_SCHEME.test(decodedScheme)) {
7255
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
7256
+ }
7257
+ return decodedScheme;
7258
+ }
7060
7259
  function normalize(uri, options) {
7061
7260
  if (typeof uri === "string") {
7062
7261
  uri = /** @type {T} */
@@ -7069,12 +7268,34 @@ var require_fast_uri = __commonJS({
7069
7268
  }
7070
7269
  function resolve9(baseURI, relativeURI, options) {
7071
7270
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
7072
- const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
7073
- const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
7074
- if (baseMalformed || relativeMalformed) {
7271
+ const {
7272
+ parsed: baseParsed,
7273
+ malformedAuthorityOrPort: baseMalformed,
7274
+ malformedPercentEncoding: baseMalformedPercentEncoding,
7275
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
7276
+ malformedHost: baseMalformedHost,
7277
+ malformedScheme: baseMalformedScheme
7278
+ } = parseWithStatus(baseURI, schemelessOptions);
7279
+ const {
7280
+ parsed: relativeParsed,
7281
+ malformedAuthorityOrPort: relativeMalformed,
7282
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
7283
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
7284
+ malformedHost: relativeMalformedHost,
7285
+ malformedScheme: relativeMalformedScheme
7286
+ } = parseWithStatus(relativeURI, schemelessOptions);
7287
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
7075
7288
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
7076
7289
  }
7077
7290
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
7291
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
7292
+ const resolvedHost = resolved.host;
7293
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
7294
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
7295
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
7296
+ if (resolved.error && !encodedASCIIHost) {
7297
+ throw new Error(resolved.error);
7298
+ }
7078
7299
  schemelessOptions.skipEscape = true;
7079
7300
  return serialize(resolved, schemelessOptions);
7080
7301
  }
@@ -7134,7 +7355,7 @@ var require_fast_uri = __commonJS({
7134
7355
  function equal(uriA, uriB, options) {
7135
7356
  const normalizedA = normalizeComparableURI(uriA, options);
7136
7357
  const normalizedB = normalizeComparableURI(uriB, options);
7137
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
7358
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
7138
7359
  }
7139
7360
  function serialize(cmpts, opts) {
7140
7361
  const component = {
@@ -7155,19 +7376,22 @@ var require_fast_uri = __commonJS({
7155
7376
  };
7156
7377
  const options = Object.assign({}, opts);
7157
7378
  const uriTokens = [];
7379
+ if (component.scheme) {
7380
+ component.scheme = decodeValidScheme(component.scheme);
7381
+ }
7158
7382
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
7159
7383
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
7384
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
7385
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
7160
7386
  if (component.path !== void 0) {
7161
7387
  if (!options.skipEscape) {
7162
- component.path = escapePreservingEscapes(component.path);
7163
- if (component.scheme !== void 0) {
7164
- component.path = component.path.split("%3A").join(":");
7165
- }
7388
+ component.path = serializePathEncoding(component.path, pathNoScheme);
7166
7389
  } else {
7167
7390
  component.path = normalizePercentEncoding(component.path);
7168
7391
  }
7169
7392
  }
7170
7393
  if (options.reference !== "suffix" && component.scheme) {
7394
+ component.scheme = decodeValidScheme(component.scheme);
7171
7395
  uriTokens.push(component.scheme, ":");
7172
7396
  }
7173
7397
  const authority = recomposeAuthority(component);
@@ -7185,16 +7409,19 @@ var require_fast_uri = __commonJS({
7185
7409
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
7186
7410
  s = removeDotSegments(s);
7187
7411
  }
7412
+ if (pathNoScheme) {
7413
+ s = serializePathEncoding(s, true);
7414
+ }
7188
7415
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
7189
7416
  s = "/%2F" + s.slice(2);
7190
7417
  }
7191
7418
  uriTokens.push(s);
7192
7419
  }
7193
7420
  if (component.query !== void 0) {
7194
- uriTokens.push("?", component.query);
7421
+ uriTokens.push("?", encodeQuery(component.query));
7195
7422
  }
7196
7423
  if (component.fragment !== void 0) {
7197
- uriTokens.push("#", component.fragment);
7424
+ uriTokens.push("#", encodeFragment(component.fragment));
7198
7425
  }
7199
7426
  return uriTokens.join("");
7200
7427
  }
@@ -7210,6 +7437,35 @@ var require_fast_uri = __commonJS({
7210
7437
  }
7211
7438
  return void 0;
7212
7439
  }
7440
+ function hasMalformedPercentEncoding(component) {
7441
+ if (component === void 0) return false;
7442
+ let percent = component.indexOf("%");
7443
+ while (percent !== -1) {
7444
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
7445
+ return true;
7446
+ }
7447
+ percent = component.indexOf("%", percent + 3);
7448
+ }
7449
+ return false;
7450
+ }
7451
+ function isIPLiteral(host) {
7452
+ return host[0] === "[" && host[host.length - 1] === "]";
7453
+ }
7454
+ function hasMalformedComponentPercentEncoding(matches) {
7455
+ const host = matches[4];
7456
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
7457
+ }
7458
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
7459
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
7460
+ try {
7461
+ parsed.host = new URL("http://" + parsed.host).hostname;
7462
+ } catch (e) {
7463
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
7464
+ return true;
7465
+ }
7466
+ }
7467
+ return false;
7468
+ }
7213
7469
  function parseWithStatus(uri, opts) {
7214
7470
  const options = Object.assign({}, opts);
7215
7471
  const parsed = {
@@ -7222,6 +7478,11 @@ var require_fast_uri = __commonJS({
7222
7478
  fragment: void 0
7223
7479
  };
7224
7480
  let malformedAuthorityOrPort = false;
7481
+ let malformedPercentEncoding = false;
7482
+ let malformedSchemeSpecific = false;
7483
+ let malformedHost = false;
7484
+ let malformedIPLiteral = false;
7485
+ let malformedScheme = false;
7225
7486
  let isIP = false;
7226
7487
  if (options.reference === "suffix") {
7227
7488
  if (options.scheme) {
@@ -7258,6 +7519,19 @@ var require_fast_uri = __commonJS({
7258
7519
  parsed.path = matches[6] || "";
7259
7520
  parsed.query = matches[7];
7260
7521
  parsed.fragment = matches[8];
7522
+ if (parsed.scheme !== void 0) {
7523
+ const decodedScheme = unescape(parsed.scheme);
7524
+ if (VALID_SCHEME.test(decodedScheme)) {
7525
+ parsed.scheme = decodedScheme.toLowerCase();
7526
+ } else {
7527
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
7528
+ malformedScheme = true;
7529
+ }
7530
+ }
7531
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
7532
+ if (malformedPercentEncoding) {
7533
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
7534
+ }
7261
7535
  if (isNaN(parsed.port)) {
7262
7536
  parsed.port = matches[5];
7263
7537
  }
@@ -7269,9 +7543,16 @@ var require_fast_uri = __commonJS({
7269
7543
  if (parsed.host) {
7270
7544
  const ipv4result = isIPv4(parsed.host);
7271
7545
  if (ipv4result === false) {
7546
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
7547
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
7272
7548
  const ipv6result = normalizeIPv6(parsed.host);
7273
- parsed.host = ipv6result.host.toLowerCase();
7274
- isIP = ipv6result.isIPV6;
7549
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
7550
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
7551
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
7552
+ if (malformedIPLiteral) {
7553
+ parsed.error = parsed.error || "URI host is malformed.";
7554
+ malformedAuthorityOrPort = true;
7555
+ }
7275
7556
  } else {
7276
7557
  isIP = true;
7277
7558
  }
@@ -7289,42 +7570,36 @@ var require_fast_uri = __commonJS({
7289
7570
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
7290
7571
  }
7291
7572
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
7292
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
7293
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
7294
- try {
7295
- parsed.host = new URL("http://" + parsed.host).hostname;
7296
- } catch (e) {
7297
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
7298
- }
7299
- }
7573
+ if (!malformedIPLiteral) {
7574
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
7300
7575
  }
7301
7576
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
7302
7577
  if (uri.indexOf("%") !== -1) {
7303
- if (parsed.scheme !== void 0) {
7304
- parsed.scheme = unescape(parsed.scheme);
7305
- }
7306
- if (parsed.host !== void 0) {
7307
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
7578
+ if (parsed.host !== void 0 && !malformedIPLiteral) {
7579
+ const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
7580
+ parsed.host = reescapeHostDelimiters(host, isIP);
7308
7581
  }
7309
7582
  }
7310
7583
  if (parsed.path) {
7311
7584
  parsed.path = normalizePathEncoding(parsed.path);
7312
7585
  }
7586
+ if (parsed.query) {
7587
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
7588
+ }
7313
7589
  if (parsed.fragment) {
7314
- try {
7315
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
7316
- } catch {
7317
- parsed.error = parsed.error || "URI malformed";
7318
- }
7590
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
7319
7591
  }
7320
7592
  }
7321
7593
  if (schemeHandler && schemeHandler.parse) {
7322
7594
  schemeHandler.parse(parsed, options);
7595
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
7596
+ malformedSchemeSpecific = true;
7597
+ }
7323
7598
  }
7324
7599
  } else {
7325
7600
  parsed.error = parsed.error || "URI can not be parsed.";
7326
7601
  }
7327
- return { parsed, malformedAuthorityOrPort };
7602
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
7328
7603
  }
7329
7604
  function parse(uri, opts) {
7330
7605
  return parseWithStatus(uri, opts).parsed;
@@ -7333,20 +7608,28 @@ var require_fast_uri = __commonJS({
7333
7608
  return normalizeStringWithStatus(uri, opts).normalized;
7334
7609
  }
7335
7610
  function normalizeStringWithStatus(uri, opts) {
7336
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
7611
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
7337
7612
  return {
7338
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
7339
- malformedAuthorityOrPort
7613
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
7614
+ malformedAuthorityOrPort,
7615
+ malformedPercentEncoding,
7616
+ malformedSchemeSpecific,
7617
+ malformedHost,
7618
+ malformedScheme
7340
7619
  };
7341
7620
  }
7342
7621
  function normalizeComparableURI(uri, opts) {
7343
- if (typeof uri === "string") {
7344
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
7345
- return malformedAuthorityOrPort ? void 0 : normalized;
7622
+ if (typeof uri !== "string" && typeof uri !== "object") {
7623
+ return void 0;
7346
7624
  }
7347
- if (typeof uri === "object") {
7348
- return serialize(uri, opts);
7625
+ let value;
7626
+ try {
7627
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
7628
+ } catch {
7629
+ return void 0;
7349
7630
  }
7631
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
7632
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
7350
7633
  }
7351
7634
  var fastUri = {
7352
7635
  SCHEMES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-dsh-plugins",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Unofficial catalog and safe installer for DeepSeek Harness plugins",
5
5
  "type": "module",
6
6
  "license": "MIT",