bitfab-cli 0.2.367 → 0.2.369

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/index.js +422 -138
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5093,15 +5093,34 @@ var require_data = __commonJS({
5093
5093
  }
5094
5094
  });
5095
5095
 
5096
- // ../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js
5096
+ // ../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js
5097
5097
  var require_utils = __commonJS({
5098
- "../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js"(exports, module) {
5098
+ "../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js"(exports, module) {
5099
5099
  "use strict";
5100
5100
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
5101
5101
  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);
5102
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
5102
5103
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
5103
5104
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
5104
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
5105
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
5106
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
5107
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
5108
+ var BYTE_HEX = new Array(256);
5109
+ {
5110
+ const HEX_DIGITS = "0123456789ABCDEF";
5111
+ for (let i = 0; i < 256; i++) {
5112
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
5113
+ }
5114
+ }
5115
+ function percentEncodeNonAscii(cp) {
5116
+ if (cp < 2048) {
5117
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
5118
+ }
5119
+ if (cp < 65536) {
5120
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5121
+ }
5122
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5123
+ }
5105
5124
  function stringArrayToHexStripped(input) {
5106
5125
  let acc = "";
5107
5126
  let code2 = 0;
@@ -5126,91 +5145,105 @@ var require_utils = __commonJS({
5126
5145
  }
5127
5146
  return acc;
5128
5147
  }
5148
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
5149
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
5150
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
5129
5151
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
5130
- function consumeIsZone(buffer) {
5131
- buffer.length = 0;
5132
- return true;
5133
- }
5134
- function consumeHextets(buffer, address, output) {
5135
- if (buffer.length) {
5136
- const hex3 = stringArrayToHexStripped(buffer);
5137
- if (hex3 !== "") {
5138
- address.push(hex3);
5139
- } else {
5140
- output.error = true;
5141
- return false;
5152
+ function isZoneIdentifier(zone) {
5153
+ if (zone.length === 0) return false;
5154
+ for (let i = 0; i < zone.length; i++) {
5155
+ if (isZoneCharacter(zone[i])) continue;
5156
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
5157
+ i += 2;
5158
+ continue;
5142
5159
  }
5143
- buffer.length = 0;
5160
+ return false;
5144
5161
  }
5145
5162
  return true;
5146
5163
  }
5147
- function getIPV6(input) {
5148
- let tokenCount = 0;
5149
- const output = { error: false, address: "", zone: "" };
5150
- const address = [];
5151
- const buffer = [];
5152
- let endipv6Encountered = false;
5153
- let endIpv6 = false;
5154
- let consume = consumeHextets;
5155
- for (let i = 0; i < input.length; i++) {
5156
- const cursor = input[i];
5157
- if (cursor === "[" || cursor === "]") {
5158
- continue;
5159
- }
5160
- if (cursor === ":") {
5161
- if (endipv6Encountered === true) {
5162
- endIpv6 = true;
5163
- }
5164
- if (!consume(buffer, address, output)) {
5165
- break;
5166
- }
5167
- if (++tokenCount > 7) {
5168
- output.error = true;
5169
- break;
5170
- }
5171
- if (i > 0 && input[i - 1] === ":") {
5172
- endipv6Encountered = true;
5173
- }
5174
- address.push(":");
5175
- continue;
5176
- } else if (cursor === "%") {
5177
- if (!consume(buffer, address, output)) {
5178
- break;
5164
+ function compressIPv6ZeroRun(hextets) {
5165
+ let bestStart = -1;
5166
+ let bestLength = 0;
5167
+ let runStart = -1;
5168
+ let runLength = 0;
5169
+ for (let i = 0; i < hextets.length; i++) {
5170
+ if (hextets[i] === "0") {
5171
+ if (runStart === -1) runStart = i;
5172
+ runLength++;
5173
+ if (runLength > bestLength) {
5174
+ bestLength = runLength;
5175
+ bestStart = runStart;
5179
5176
  }
5180
- consume = consumeIsZone;
5181
5177
  } else {
5182
- buffer.push(cursor);
5178
+ runStart = -1;
5179
+ runLength = 0;
5180
+ }
5181
+ }
5182
+ if (bestLength < 2) return hextets.join(":");
5183
+ const head = hextets.slice(0, bestStart).join(":");
5184
+ const tail = hextets.slice(bestStart + bestLength).join(":");
5185
+ return head + "::" + tail;
5186
+ }
5187
+ function normalizeIPv6Address(input) {
5188
+ const compression = input.indexOf("::");
5189
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
5190
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
5191
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
5192
+ if (compression !== -1) {
5193
+ if (left.length === 1 && left[0] === "") left.length = 0;
5194
+ if (right.length === 1 && right[0] === "") right.length = 0;
5195
+ }
5196
+ const parts = left.concat(right);
5197
+ let hextetCount = 0;
5198
+ for (let i = 0; i < parts.length; i++) {
5199
+ const part = parts[i];
5200
+ if (part === "") return void 0;
5201
+ if (part.indexOf(".") !== -1) {
5202
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
5203
+ hextetCount += 2;
5183
5204
  continue;
5184
5205
  }
5206
+ if (!isHextet(part)) return void 0;
5207
+ parts[i] = parseInt(part, 16).toString(16);
5208
+ hextetCount++;
5185
5209
  }
5186
- if (buffer.length) {
5187
- if (consume === consumeIsZone) {
5188
- output.zone = buffer.join("");
5189
- } else if (endIpv6) {
5190
- address.push(buffer.join(""));
5191
- } else {
5192
- address.push(stringArrayToHexStripped(buffer));
5193
- }
5210
+ if (compression === -1) {
5211
+ if (hextetCount !== 8) return void 0;
5212
+ return compressIPv6ZeroRun(parts);
5194
5213
  }
5195
- output.address = address.join("");
5196
- return output;
5214
+ if (hextetCount >= 8) return void 0;
5215
+ const expanded = parts.slice(0, left.length);
5216
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
5217
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
5218
+ return compressIPv6ZeroRun(expanded);
5197
5219
  }
5198
5220
  function normalizeIPv6(host) {
5199
- if (findToken(host, ":") < 2) {
5200
- return { host, isIPV6: false };
5201
- }
5202
- const ipv63 = getIPV6(host);
5203
- if (!ipv63.error) {
5204
- let newHost = ipv63.address;
5205
- let escapedHost = ipv63.address;
5206
- if (ipv63.zone) {
5207
- newHost += "%" + ipv63.zone;
5208
- escapedHost += "%25" + ipv63.zone;
5209
- }
5210
- return { host: newHost, isIPV6: true, escapedHost };
5211
- } else {
5212
- return { host, isIPV6: false };
5213
- }
5221
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
5222
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
5223
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
5224
+ let input = bracketed ? host.slice(1, -1) : host;
5225
+ if (bracketed && isIPvFuture(input)) {
5226
+ input = input.toLowerCase();
5227
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
5228
+ }
5229
+ if (findToken(input, ":") < 2) {
5230
+ return { host, isIPV6: false, error: bracketed };
5231
+ }
5232
+ let zoneIdentifier = "";
5233
+ const zoneSeparator = input.indexOf("%");
5234
+ if (zoneSeparator !== -1) {
5235
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
5236
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
5237
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
5238
+ input = input.slice(0, zoneSeparator);
5239
+ }
5240
+ const address = normalizeIPv6Address(input);
5241
+ if (address === void 0) return { host, isIPV6: false, error: true };
5242
+ return {
5243
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
5244
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
5245
+ isIPV6: true
5246
+ };
5214
5247
  }
5215
5248
  function findToken(str, token) {
5216
5249
  let ind = 0;
@@ -5329,7 +5362,8 @@ var require_utils = __commonJS({
5329
5362
  function normalizePathEncoding(input) {
5330
5363
  let output = "";
5331
5364
  for (let i = 0; i < input.length; i++) {
5332
- if (input[i] === "%" && i + 2 < input.length) {
5365
+ const ch = input[i];
5366
+ if (ch === "%" && i + 2 < input.length) {
5333
5367
  const hex3 = input.slice(i + 1, i + 3);
5334
5368
  if (isHexPair(hex3)) {
5335
5369
  const normalizedHex = hex3.toUpperCase();
@@ -5343,10 +5377,152 @@ var require_utils = __commonJS({
5343
5377
  continue;
5344
5378
  }
5345
5379
  }
5346
- if (isPathCharacter(input[i])) {
5347
- output += input[i];
5380
+ if (isPathCharacter(ch)) {
5381
+ output += ch;
5348
5382
  } else {
5349
- output += escape(input[i]);
5383
+ const code2 = input.charCodeAt(i);
5384
+ if (code2 < 128) {
5385
+ output += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
5386
+ } else if (code2 < 55296 || code2 > 57343) {
5387
+ output += percentEncodeNonAscii(code2);
5388
+ } else if (code2 <= 56319 && i + 1 < input.length) {
5389
+ const low = input.charCodeAt(i + 1);
5390
+ if (low >= 56320 && low <= 57343) {
5391
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
5392
+ i++;
5393
+ } else {
5394
+ output += percentEncodeNonAscii(65533);
5395
+ }
5396
+ } else {
5397
+ output += percentEncodeNonAscii(65533);
5398
+ }
5399
+ }
5400
+ }
5401
+ return output;
5402
+ }
5403
+ function serializePathEncoding(input, pathNoScheme = false) {
5404
+ let output = "";
5405
+ let firstSegment = pathNoScheme && input[0] !== "/";
5406
+ for (let i = 0; i < input.length; i++) {
5407
+ const ch = input[i];
5408
+ if (ch === "%" && i + 2 < input.length) {
5409
+ const hex3 = input.slice(i + 1, i + 3);
5410
+ if (isHexPair(hex3)) {
5411
+ output += "%" + hex3.toUpperCase();
5412
+ i += 2;
5413
+ continue;
5414
+ }
5415
+ }
5416
+ if (ch === "/") {
5417
+ firstSegment = false;
5418
+ }
5419
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
5420
+ output += ch;
5421
+ } else {
5422
+ const code2 = input.charCodeAt(i);
5423
+ if (code2 < 128) {
5424
+ output += BYTE_HEX[code2];
5425
+ } else if (code2 < 55296 || code2 > 57343) {
5426
+ output += percentEncodeNonAscii(code2);
5427
+ } else if (code2 <= 56319 && i + 1 < input.length) {
5428
+ const low = input.charCodeAt(i + 1);
5429
+ if (low >= 56320 && low <= 57343) {
5430
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
5431
+ i++;
5432
+ } else {
5433
+ output += percentEncodeNonAscii(65533);
5434
+ }
5435
+ } else {
5436
+ output += percentEncodeNonAscii(65533);
5437
+ }
5438
+ }
5439
+ }
5440
+ return output;
5441
+ }
5442
+ function encodeComponent(input, isAllowed) {
5443
+ let output = "";
5444
+ for (let i = 0; i < input.length; i++) {
5445
+ const ch = input[i];
5446
+ if (ch === "%" && i + 2 < input.length) {
5447
+ const hex3 = input.slice(i + 1, i + 3);
5448
+ if (isHexPair(hex3)) {
5449
+ output += "%" + hex3.toUpperCase();
5450
+ i += 2;
5451
+ continue;
5452
+ }
5453
+ }
5454
+ if (isAllowed(ch)) {
5455
+ output += ch;
5456
+ } else {
5457
+ const code2 = input.charCodeAt(i);
5458
+ if (code2 < 128) {
5459
+ output += BYTE_HEX[code2];
5460
+ } else if (code2 < 55296 || code2 > 57343) {
5461
+ output += percentEncodeNonAscii(code2);
5462
+ } else if (code2 <= 56319 && i + 1 < input.length) {
5463
+ const low = input.charCodeAt(i + 1);
5464
+ if (low >= 56320 && low <= 57343) {
5465
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
5466
+ i++;
5467
+ } else {
5468
+ output += percentEncodeNonAscii(65533);
5469
+ }
5470
+ } else {
5471
+ output += percentEncodeNonAscii(65533);
5472
+ }
5473
+ }
5474
+ }
5475
+ return output;
5476
+ }
5477
+ function encodeUserinfo(input) {
5478
+ return encodeComponent(input, isUserinfoCharacter);
5479
+ }
5480
+ function encodeQuery(input) {
5481
+ return encodeComponent(input, isQueryFragmentCharacter);
5482
+ }
5483
+ function encodeFragment(input) {
5484
+ return encodeComponent(input, isQueryFragmentCharacter);
5485
+ }
5486
+ function isEscapeSafe(cp) {
5487
+ return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
5488
+ }
5489
+ function normalizeQueryFragmentEncoding(input) {
5490
+ let output = "";
5491
+ for (let i = 0; i < input.length; i++) {
5492
+ const ch = input[i];
5493
+ if (ch === "%" && i + 2 < input.length) {
5494
+ const hex3 = input.slice(i + 1, i + 3);
5495
+ if (isHexPair(hex3)) {
5496
+ const normalizedHex = hex3.toUpperCase();
5497
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
5498
+ if (isUnreserved(decoded)) {
5499
+ output += decoded;
5500
+ } else {
5501
+ output += "%" + normalizedHex;
5502
+ }
5503
+ i += 2;
5504
+ continue;
5505
+ }
5506
+ }
5507
+ if (isQueryFragmentCharacter(ch)) {
5508
+ output += ch;
5509
+ } else {
5510
+ const code2 = input.charCodeAt(i);
5511
+ if (code2 < 128) {
5512
+ output += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
5513
+ } else if (code2 < 55296 || code2 > 57343) {
5514
+ output += percentEncodeNonAscii(code2);
5515
+ } else if (code2 <= 56319 && i + 1 < input.length) {
5516
+ const low = input.charCodeAt(i + 1);
5517
+ if (low >= 56320 && low <= 57343) {
5518
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
5519
+ i++;
5520
+ } else {
5521
+ output += percentEncodeNonAscii(65533);
5522
+ }
5523
+ } else {
5524
+ output += percentEncodeNonAscii(65533);
5525
+ }
5350
5526
  }
5351
5527
  }
5352
5528
  return output;
@@ -5369,14 +5545,18 @@ var require_utils = __commonJS({
5369
5545
  function recomposeAuthority(component) {
5370
5546
  const uriTokens = [];
5371
5547
  if (component.userinfo !== void 0) {
5372
- uriTokens.push(component.userinfo);
5548
+ uriTokens.push(encodeUserinfo(component.userinfo));
5373
5549
  uriTokens.push("@");
5374
5550
  }
5375
5551
  if (component.host !== void 0) {
5376
- let host = unescape(component.host);
5552
+ let host = component.host;
5377
5553
  if (!isIPv4(host)) {
5378
- const ipV6res = normalizeIPv6(host);
5379
- if (ipV6res.isIPV6 === true) {
5554
+ let ipV6res = normalizeIPv6(host);
5555
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
5556
+ host = normalizePercentEncoding(host, true);
5557
+ ipV6res = normalizeIPv6(host);
5558
+ }
5559
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
5380
5560
  host = `[${ipV6res.escapedHost}]`;
5381
5561
  } else {
5382
5562
  host = reescapeHostDelimiters(host, false);
@@ -5385,8 +5565,12 @@ var require_utils = __commonJS({
5385
5565
  uriTokens.push(host);
5386
5566
  }
5387
5567
  if (typeof component.port === "number" || typeof component.port === "string") {
5568
+ const port = String(component.port);
5569
+ if (!isPort(port)) {
5570
+ throw new TypeError("URI port is malformed.");
5571
+ }
5388
5572
  uriTokens.push(":");
5389
- uriTokens.push(String(component.port));
5573
+ uriTokens.push(port);
5390
5574
  }
5391
5575
  return uriTokens.length ? uriTokens.join("") : void 0;
5392
5576
  }
@@ -5396,6 +5580,11 @@ var require_utils = __commonJS({
5396
5580
  reescapeHostDelimiters,
5397
5581
  normalizePercentEncoding,
5398
5582
  normalizePathEncoding,
5583
+ serializePathEncoding,
5584
+ normalizeQueryFragmentEncoding,
5585
+ encodeUserinfo,
5586
+ encodeQuery,
5587
+ encodeFragment,
5399
5588
  escapePreservingEscapes,
5400
5589
  removeDotSegments,
5401
5590
  isIPv4,
@@ -5406,12 +5595,12 @@ var require_utils = __commonJS({
5406
5595
  }
5407
5596
  });
5408
5597
 
5409
- // ../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js
5598
+ // ../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js
5410
5599
  var require_schemes = __commonJS({
5411
- "../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js"(exports, module) {
5600
+ "../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js"(exports, module) {
5412
5601
  "use strict";
5413
5602
  var { isUUID } = require_utils();
5414
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5603
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
5415
5604
  var supportedSchemeNames = (
5416
5605
  /** @type {const} */
5417
5606
  [
@@ -5472,9 +5661,10 @@ var require_schemes = __commonJS({
5472
5661
  wsComponent.secure = void 0;
5473
5662
  }
5474
5663
  if (wsComponent.resourceName) {
5475
- const [path15, query] = wsComponent.resourceName.split("?");
5664
+ const queryIndex = wsComponent.resourceName.indexOf("?");
5665
+ const path15 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
5476
5666
  wsComponent.path = path15 && path15 !== "/" ? path15 : void 0;
5477
- wsComponent.query = query;
5667
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
5478
5668
  wsComponent.resourceName = void 0;
5479
5669
  }
5480
5670
  wsComponent.fragment = void 0;
@@ -5486,7 +5676,7 @@ var require_schemes = __commonJS({
5486
5676
  return urnComponent;
5487
5677
  }
5488
5678
  const matches = urnComponent.path.match(URN_REG);
5489
- if (matches) {
5679
+ if (matches && matches[0] === urnComponent.path) {
5490
5680
  const scheme = options.scheme || urnComponent.scheme || "urn";
5491
5681
  urnComponent.nid = matches[1].toLowerCase();
5492
5682
  urnComponent.nss = matches[2];
@@ -5616,12 +5806,21 @@ var require_schemes = __commonJS({
5616
5806
  }
5617
5807
  });
5618
5808
 
5619
- // ../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js
5809
+ // ../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js
5620
5810
  var require_fast_uri = __commonJS({
5621
- "../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js"(exports, module) {
5811
+ "../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js"(exports, module) {
5622
5812
  "use strict";
5623
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5813
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5624
5814
  var { SCHEMES, getSchemeHandler } = require_schemes();
5815
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
5816
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
5817
+ function decodeValidScheme(scheme) {
5818
+ const decodedScheme = unescape(String(scheme));
5819
+ if (!VALID_SCHEME.test(decodedScheme)) {
5820
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
5821
+ }
5822
+ return decodedScheme;
5823
+ }
5625
5824
  function normalize(uri, options) {
5626
5825
  if (typeof uri === "string") {
5627
5826
  uri = /** @type {T} */
@@ -5634,12 +5833,34 @@ var require_fast_uri = __commonJS({
5634
5833
  }
5635
5834
  function resolve5(baseURI, relativeURI, options) {
5636
5835
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
5637
- const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
5638
- const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
5639
- if (baseMalformed || relativeMalformed) {
5836
+ const {
5837
+ parsed: baseParsed,
5838
+ malformedAuthorityOrPort: baseMalformed,
5839
+ malformedPercentEncoding: baseMalformedPercentEncoding,
5840
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
5841
+ malformedHost: baseMalformedHost,
5842
+ malformedScheme: baseMalformedScheme
5843
+ } = parseWithStatus(baseURI, schemelessOptions);
5844
+ const {
5845
+ parsed: relativeParsed,
5846
+ malformedAuthorityOrPort: relativeMalformed,
5847
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
5848
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
5849
+ malformedHost: relativeMalformedHost,
5850
+ malformedScheme: relativeMalformedScheme
5851
+ } = parseWithStatus(relativeURI, schemelessOptions);
5852
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
5640
5853
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
5641
5854
  }
5642
5855
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
5856
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
5857
+ const resolvedHost = resolved.host;
5858
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
5859
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
5860
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
5861
+ if (resolved.error && !encodedASCIIHost) {
5862
+ throw new Error(resolved.error);
5863
+ }
5643
5864
  schemelessOptions.skipEscape = true;
5644
5865
  return serialize(resolved, schemelessOptions);
5645
5866
  }
@@ -5699,7 +5920,7 @@ var require_fast_uri = __commonJS({
5699
5920
  function equal(uriA, uriB, options) {
5700
5921
  const normalizedA = normalizeComparableURI(uriA, options);
5701
5922
  const normalizedB = normalizeComparableURI(uriB, options);
5702
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
5923
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
5703
5924
  }
5704
5925
  function serialize(cmpts, opts) {
5705
5926
  const component = {
@@ -5720,19 +5941,22 @@ var require_fast_uri = __commonJS({
5720
5941
  };
5721
5942
  const options = Object.assign({}, opts);
5722
5943
  const uriTokens = [];
5944
+ if (component.scheme) {
5945
+ component.scheme = decodeValidScheme(component.scheme);
5946
+ }
5723
5947
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
5724
5948
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
5949
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
5950
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
5725
5951
  if (component.path !== void 0) {
5726
5952
  if (!options.skipEscape) {
5727
- component.path = escapePreservingEscapes(component.path);
5728
- if (component.scheme !== void 0) {
5729
- component.path = component.path.split("%3A").join(":");
5730
- }
5953
+ component.path = serializePathEncoding(component.path, pathNoScheme);
5731
5954
  } else {
5732
5955
  component.path = normalizePercentEncoding(component.path);
5733
5956
  }
5734
5957
  }
5735
5958
  if (options.reference !== "suffix" && component.scheme) {
5959
+ component.scheme = decodeValidScheme(component.scheme);
5736
5960
  uriTokens.push(component.scheme, ":");
5737
5961
  }
5738
5962
  const authority = recomposeAuthority(component);
@@ -5750,16 +5974,19 @@ var require_fast_uri = __commonJS({
5750
5974
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5751
5975
  s2 = removeDotSegments(s2);
5752
5976
  }
5977
+ if (pathNoScheme) {
5978
+ s2 = serializePathEncoding(s2, true);
5979
+ }
5753
5980
  if (authority === void 0 && s2[0] === "/" && s2[1] === "/") {
5754
5981
  s2 = "/%2F" + s2.slice(2);
5755
5982
  }
5756
5983
  uriTokens.push(s2);
5757
5984
  }
5758
5985
  if (component.query !== void 0) {
5759
- uriTokens.push("?", component.query);
5986
+ uriTokens.push("?", encodeQuery(component.query));
5760
5987
  }
5761
5988
  if (component.fragment !== void 0) {
5762
- uriTokens.push("#", component.fragment);
5989
+ uriTokens.push("#", encodeFragment(component.fragment));
5763
5990
  }
5764
5991
  return uriTokens.join("");
5765
5992
  }
@@ -5775,6 +6002,35 @@ var require_fast_uri = __commonJS({
5775
6002
  }
5776
6003
  return void 0;
5777
6004
  }
6005
+ function hasMalformedPercentEncoding(component) {
6006
+ if (component === void 0) return false;
6007
+ let percent = component.indexOf("%");
6008
+ while (percent !== -1) {
6009
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
6010
+ return true;
6011
+ }
6012
+ percent = component.indexOf("%", percent + 3);
6013
+ }
6014
+ return false;
6015
+ }
6016
+ function isIPLiteral(host) {
6017
+ return host[0] === "[" && host[host.length - 1] === "]";
6018
+ }
6019
+ function hasMalformedComponentPercentEncoding(matches) {
6020
+ const host = matches[4];
6021
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
6022
+ }
6023
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
6024
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
6025
+ try {
6026
+ parsed.host = new URL("http://" + parsed.host).hostname;
6027
+ } catch (e) {
6028
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6029
+ return true;
6030
+ }
6031
+ }
6032
+ return false;
6033
+ }
5778
6034
  function parseWithStatus(uri, opts) {
5779
6035
  const options = Object.assign({}, opts);
5780
6036
  const parsed = {
@@ -5787,6 +6043,11 @@ var require_fast_uri = __commonJS({
5787
6043
  fragment: void 0
5788
6044
  };
5789
6045
  let malformedAuthorityOrPort = false;
6046
+ let malformedPercentEncoding = false;
6047
+ let malformedSchemeSpecific = false;
6048
+ let malformedHost = false;
6049
+ let malformedIPLiteral = false;
6050
+ let malformedScheme = false;
5790
6051
  let isIP = false;
5791
6052
  if (options.reference === "suffix") {
5792
6053
  if (options.scheme) {
@@ -5823,6 +6084,19 @@ var require_fast_uri = __commonJS({
5823
6084
  parsed.path = matches[6] || "";
5824
6085
  parsed.query = matches[7];
5825
6086
  parsed.fragment = matches[8];
6087
+ if (parsed.scheme !== void 0) {
6088
+ const decodedScheme = unescape(parsed.scheme);
6089
+ if (VALID_SCHEME.test(decodedScheme)) {
6090
+ parsed.scheme = decodedScheme.toLowerCase();
6091
+ } else {
6092
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
6093
+ malformedScheme = true;
6094
+ }
6095
+ }
6096
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
6097
+ if (malformedPercentEncoding) {
6098
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
6099
+ }
5826
6100
  if (isNaN(parsed.port)) {
5827
6101
  parsed.port = matches[5];
5828
6102
  }
@@ -5834,9 +6108,16 @@ var require_fast_uri = __commonJS({
5834
6108
  if (parsed.host) {
5835
6109
  const ipv4result = isIPv4(parsed.host);
5836
6110
  if (ipv4result === false) {
6111
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
6112
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
5837
6113
  const ipv6result = normalizeIPv6(parsed.host);
5838
- parsed.host = ipv6result.host.toLowerCase();
5839
- isIP = ipv6result.isIPV6;
6114
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
6115
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
6116
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
6117
+ if (malformedIPLiteral) {
6118
+ parsed.error = parsed.error || "URI host is malformed.";
6119
+ malformedAuthorityOrPort = true;
6120
+ }
5840
6121
  } else {
5841
6122
  isIP = true;
5842
6123
  }
@@ -5854,42 +6135,37 @@ var require_fast_uri = __commonJS({
5854
6135
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
5855
6136
  }
5856
6137
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
5857
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5858
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
5859
- try {
5860
- parsed.host = new URL("http://" + parsed.host).hostname;
5861
- } catch (e) {
5862
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
5863
- }
6138
+ if (!malformedIPLiteral) {
6139
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
6140
+ }
6141
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
6142
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
6143
+ if (!isIP) {
6144
+ host = normalizePercentEncoding(host.toLowerCase());
5864
6145
  }
6146
+ parsed.host = reescapeHostDelimiters(host, isIP);
5865
6147
  }
5866
6148
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
5867
- if (uri.indexOf("%") !== -1) {
5868
- if (parsed.scheme !== void 0) {
5869
- parsed.scheme = unescape(parsed.scheme);
5870
- }
5871
- if (parsed.host !== void 0) {
5872
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
5873
- }
5874
- }
5875
6149
  if (parsed.path) {
5876
6150
  parsed.path = normalizePathEncoding(parsed.path);
5877
6151
  }
6152
+ if (parsed.query) {
6153
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
6154
+ }
5878
6155
  if (parsed.fragment) {
5879
- try {
5880
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5881
- } catch {
5882
- parsed.error = parsed.error || "URI malformed";
5883
- }
6156
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
5884
6157
  }
5885
6158
  }
5886
6159
  if (schemeHandler && schemeHandler.parse) {
5887
6160
  schemeHandler.parse(parsed, options);
6161
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
6162
+ malformedSchemeSpecific = true;
6163
+ }
5888
6164
  }
5889
6165
  } else {
5890
6166
  parsed.error = parsed.error || "URI can not be parsed.";
5891
6167
  }
5892
- return { parsed, malformedAuthorityOrPort };
6168
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
5893
6169
  }
5894
6170
  function parse3(uri, opts) {
5895
6171
  return parseWithStatus(uri, opts).parsed;
@@ -5898,20 +6174,28 @@ var require_fast_uri = __commonJS({
5898
6174
  return normalizeStringWithStatus(uri, opts).normalized;
5899
6175
  }
5900
6176
  function normalizeStringWithStatus(uri, opts) {
5901
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
6177
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
5902
6178
  return {
5903
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
5904
- malformedAuthorityOrPort
6179
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
6180
+ malformedAuthorityOrPort,
6181
+ malformedPercentEncoding,
6182
+ malformedSchemeSpecific,
6183
+ malformedHost,
6184
+ malformedScheme
5905
6185
  };
5906
6186
  }
5907
6187
  function normalizeComparableURI(uri, opts) {
5908
- if (typeof uri === "string") {
5909
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
5910
- return malformedAuthorityOrPort ? void 0 : normalized;
6188
+ if (typeof uri !== "string" && typeof uri !== "object") {
6189
+ return void 0;
5911
6190
  }
5912
- if (typeof uri === "object") {
5913
- return serialize(uri, opts);
6191
+ let value;
6192
+ try {
6193
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
6194
+ } catch {
6195
+ return void 0;
5914
6196
  }
6197
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
6198
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
5915
6199
  }
5916
6200
  var fastUri = {
5917
6201
  SCHEMES,
@@ -24597,10 +24881,10 @@ var semver3 = __toESM(require_semver2(), 1);
24597
24881
 
24598
24882
  // ../bitfab-plugin-lib/dist/bakedSdkVersions.js
24599
24883
  var BAKED_SDK_VERSIONS = {
24600
- typescript: "0.57.6",
24601
- python: "0.57.7",
24602
- ruby: "0.57.6",
24603
- go: "0.57.6"
24884
+ typescript: "0.57.8",
24885
+ python: "0.57.9",
24886
+ ruby: "0.57.8",
24887
+ go: "0.57.8"
24604
24888
  };
24605
24889
 
24606
24890
  // ../bitfab-plugin-lib/dist/installedSdk.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitfab-cli",
3
- "version": "0.2.367",
3
+ "version": "0.2.369",
4
4
  "description": "Install and configure the Bitfab plugin in Claude Code, Codex, or Cursor, or the Bitfab skill pack in Amp (Alpha).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",