@dxos/hypercore 0.7.5-labs.5f04cf6 → 0.7.5-labs.8a82073
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/dist/lib/browser/index.mjs +157 -154
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1 -1
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +2 -2
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -15
|
@@ -48,8 +48,8 @@ var require_last_one_wins = __commonJS({
|
|
|
48
48
|
var callback = null;
|
|
49
49
|
var callbacks = null;
|
|
50
50
|
var next = null;
|
|
51
|
-
return function(
|
|
52
|
-
next =
|
|
51
|
+
return function(val, cb) {
|
|
52
|
+
next = val;
|
|
53
53
|
update(cb || noop);
|
|
54
54
|
};
|
|
55
55
|
function update(cb) {
|
|
@@ -58,10 +58,10 @@ var require_last_one_wins = __commonJS({
|
|
|
58
58
|
pending.push(cb);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
var
|
|
61
|
+
var val = next;
|
|
62
62
|
next = null;
|
|
63
63
|
callback = cb;
|
|
64
|
-
work(
|
|
64
|
+
work(val, done);
|
|
65
65
|
}
|
|
66
66
|
function done(err) {
|
|
67
67
|
var cb = callback;
|
|
@@ -452,19 +452,19 @@ var require_codecs = __commonJS({
|
|
|
452
452
|
return JSON.parse(buf.toString());
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
|
-
function encodeJSON(
|
|
456
|
-
return Buffer.from(JSON.stringify(
|
|
455
|
+
function encodeJSON(val) {
|
|
456
|
+
return Buffer.from(JSON.stringify(val));
|
|
457
457
|
}
|
|
458
|
-
function encodeNDJSON(
|
|
459
|
-
return Buffer.from(JSON.stringify(
|
|
458
|
+
function encodeNDJSON(val) {
|
|
459
|
+
return Buffer.from(JSON.stringify(val) + "\n");
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
function createString(type) {
|
|
463
463
|
return {
|
|
464
464
|
name: type,
|
|
465
|
-
encode: function encodeString(
|
|
466
|
-
if (typeof
|
|
467
|
-
return Buffer.from(
|
|
465
|
+
encode: function encodeString(val) {
|
|
466
|
+
if (typeof val !== "string") val = val.toString();
|
|
467
|
+
return Buffer.from(val, type);
|
|
468
468
|
},
|
|
469
469
|
decode: function decodeString(buf) {
|
|
470
470
|
return buf.toString(type);
|
|
@@ -501,27 +501,27 @@ var require_atomic_batcher = __commonJS({
|
|
|
501
501
|
running = true;
|
|
502
502
|
run(nextBatch, done);
|
|
503
503
|
}
|
|
504
|
-
function append(
|
|
504
|
+
function append(val, cb) {
|
|
505
505
|
if (running) {
|
|
506
506
|
if (!pendingBatch) {
|
|
507
507
|
pendingBatch = [];
|
|
508
508
|
pendingCallbacks = [];
|
|
509
509
|
}
|
|
510
|
-
pushAll(pendingBatch,
|
|
510
|
+
pushAll(pendingBatch, val);
|
|
511
511
|
if (cb) pendingCallbacks.push(cb);
|
|
512
512
|
} else {
|
|
513
513
|
if (cb) callbacks = [cb];
|
|
514
514
|
running = true;
|
|
515
|
-
run(Array.isArray(
|
|
515
|
+
run(Array.isArray(val) ? val : [val], done);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
function pushAll(list,
|
|
520
|
-
if (Array.isArray(
|
|
521
|
-
else list.push(
|
|
519
|
+
function pushAll(list, val) {
|
|
520
|
+
if (Array.isArray(val)) pushArray(list, val);
|
|
521
|
+
else list.push(val);
|
|
522
522
|
}
|
|
523
|
-
function pushArray(list,
|
|
524
|
-
for (var i = 0; i <
|
|
523
|
+
function pushArray(list, val) {
|
|
524
|
+
for (var i = 0; i < val.length; i++) list.push(val[i]);
|
|
525
525
|
}
|
|
526
526
|
function callAll(list, err) {
|
|
527
527
|
for (var i = 0; i < list.length; i++) list[i](err);
|
|
@@ -1435,21 +1435,21 @@ var require_buffer_fill = __commonJS({
|
|
|
1435
1435
|
return false;
|
|
1436
1436
|
}
|
|
1437
1437
|
}();
|
|
1438
|
-
function isSingleByte(
|
|
1439
|
-
return
|
|
1438
|
+
function isSingleByte(val) {
|
|
1439
|
+
return val.length === 1 && val.charCodeAt(0) < 256;
|
|
1440
1440
|
}
|
|
1441
|
-
function fillWithNumber(buffer,
|
|
1441
|
+
function fillWithNumber(buffer, val, start, end) {
|
|
1442
1442
|
if (start < 0 || end > buffer.length) {
|
|
1443
1443
|
throw new RangeError("Out of range index");
|
|
1444
1444
|
}
|
|
1445
1445
|
start = start >>> 0;
|
|
1446
1446
|
end = end === void 0 ? buffer.length : end >>> 0;
|
|
1447
1447
|
if (end > start) {
|
|
1448
|
-
buffer.fill(
|
|
1448
|
+
buffer.fill(val, start, end);
|
|
1449
1449
|
}
|
|
1450
1450
|
return buffer;
|
|
1451
1451
|
}
|
|
1452
|
-
function fillWithBuffer(buffer,
|
|
1452
|
+
function fillWithBuffer(buffer, val, start, end) {
|
|
1453
1453
|
if (start < 0 || end > buffer.length) {
|
|
1454
1454
|
throw new RangeError("Out of range index");
|
|
1455
1455
|
}
|
|
@@ -1459,24 +1459,24 @@ var require_buffer_fill = __commonJS({
|
|
|
1459
1459
|
start = start >>> 0;
|
|
1460
1460
|
end = end === void 0 ? buffer.length : end >>> 0;
|
|
1461
1461
|
var pos = start;
|
|
1462
|
-
var len =
|
|
1462
|
+
var len = val.length;
|
|
1463
1463
|
while (pos <= end - len) {
|
|
1464
|
-
|
|
1464
|
+
val.copy(buffer, pos);
|
|
1465
1465
|
pos += len;
|
|
1466
1466
|
}
|
|
1467
1467
|
if (pos !== end) {
|
|
1468
|
-
|
|
1468
|
+
val.copy(buffer, pos, 0, end - pos);
|
|
1469
1469
|
}
|
|
1470
1470
|
return buffer;
|
|
1471
1471
|
}
|
|
1472
|
-
function fill(buffer,
|
|
1472
|
+
function fill(buffer, val, start, end, encoding) {
|
|
1473
1473
|
if (hasFullSupport) {
|
|
1474
|
-
return buffer.fill(
|
|
1474
|
+
return buffer.fill(val, start, end, encoding);
|
|
1475
1475
|
}
|
|
1476
|
-
if (typeof
|
|
1477
|
-
return fillWithNumber(buffer,
|
|
1476
|
+
if (typeof val === "number") {
|
|
1477
|
+
return fillWithNumber(buffer, val, start, end);
|
|
1478
1478
|
}
|
|
1479
|
-
if (typeof
|
|
1479
|
+
if (typeof val === "string") {
|
|
1480
1480
|
if (typeof start === "string") {
|
|
1481
1481
|
encoding = start;
|
|
1482
1482
|
start = 0;
|
|
@@ -1494,16 +1494,16 @@ var require_buffer_fill = __commonJS({
|
|
|
1494
1494
|
if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
|
|
1495
1495
|
throw new TypeError("Unknown encoding: " + encoding);
|
|
1496
1496
|
}
|
|
1497
|
-
if (
|
|
1497
|
+
if (val === "") {
|
|
1498
1498
|
return fillWithNumber(buffer, 0, start, end);
|
|
1499
1499
|
}
|
|
1500
|
-
if (isSingleByte(
|
|
1501
|
-
return fillWithNumber(buffer,
|
|
1500
|
+
if (isSingleByte(val)) {
|
|
1501
|
+
return fillWithNumber(buffer, val.charCodeAt(0), start, end);
|
|
1502
1502
|
}
|
|
1503
|
-
|
|
1503
|
+
val = new Buffer(val, encoding);
|
|
1504
1504
|
}
|
|
1505
|
-
if (Buffer.isBuffer(
|
|
1506
|
-
return fillWithBuffer(buffer,
|
|
1505
|
+
if (Buffer.isBuffer(val)) {
|
|
1506
|
+
return fillWithBuffer(buffer, val, start, end);
|
|
1507
1507
|
}
|
|
1508
1508
|
return fillWithNumber(buffer, 0, start, end);
|
|
1509
1509
|
}
|
|
@@ -1637,15 +1637,15 @@ var require_hypercore_cache = __commonJS({
|
|
|
1637
1637
|
}
|
|
1638
1638
|
_del(namespace, key) {
|
|
1639
1639
|
const prefixedKey = this._prefix(namespace, key);
|
|
1640
|
-
let
|
|
1641
|
-
if (
|
|
1640
|
+
let val = this._stale && this._stale.get(prefixedKey);
|
|
1641
|
+
if (val) {
|
|
1642
1642
|
this._stale.delete(prefixedKey);
|
|
1643
|
-
this._staleByteSize -= this.estimateSize(
|
|
1643
|
+
this._staleByteSize -= this.estimateSize(val);
|
|
1644
1644
|
}
|
|
1645
|
-
|
|
1646
|
-
if (
|
|
1645
|
+
val = this._fresh.get(prefixedKey);
|
|
1646
|
+
if (val) {
|
|
1647
1647
|
this._fresh.delete(prefixedKey);
|
|
1648
|
-
this._freshByteSize -= this.estimateSize(
|
|
1648
|
+
this._freshByteSize -= this.estimateSize(val);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
1651
|
get byteSize() {
|
|
@@ -1840,9 +1840,9 @@ var require_storage = __commonJS({
|
|
|
1840
1840
|
var hash = buf.slice(0, 32);
|
|
1841
1841
|
var size = uint64be.decode(buf, 32);
|
|
1842
1842
|
if (!size && isBlank(hash)) return cb(new Error("No node found"));
|
|
1843
|
-
var
|
|
1844
|
-
if (self.treeCache) self.treeCache.set(index,
|
|
1845
|
-
cb(null,
|
|
1843
|
+
var val = new Node(index, self.treeCache ? copyMaybe(hash, 40) : hash, size, null);
|
|
1844
|
+
if (self.treeCache) self.treeCache.set(index, val);
|
|
1845
|
+
cb(null, val);
|
|
1846
1846
|
});
|
|
1847
1847
|
};
|
|
1848
1848
|
Storage.prototype.putNodeBatch = function(index, nodes, cb) {
|
|
@@ -2244,10 +2244,10 @@ var require_nanoguard = __commonJS({
|
|
|
2244
2244
|
wait() {
|
|
2245
2245
|
this._tick++;
|
|
2246
2246
|
}
|
|
2247
|
-
continue(cb, err,
|
|
2247
|
+
continue(cb, err, val) {
|
|
2248
2248
|
if (this._tick === 1) process.nextTick(continueNT, this);
|
|
2249
2249
|
else this._tick--;
|
|
2250
|
-
if (cb) cb(err,
|
|
2250
|
+
if (cb) cb(err, val);
|
|
2251
2251
|
}
|
|
2252
2252
|
waitAndContinue() {
|
|
2253
2253
|
let once = false;
|
|
@@ -2259,10 +2259,10 @@ var require_nanoguard = __commonJS({
|
|
|
2259
2259
|
return true;
|
|
2260
2260
|
};
|
|
2261
2261
|
}
|
|
2262
|
-
continueSync(cb, err,
|
|
2262
|
+
continueSync(cb, err, val) {
|
|
2263
2263
|
if (--this._tick) return;
|
|
2264
2264
|
while (this._fns !== null && this._fns.length) this._ready(this._fns.pop());
|
|
2265
|
-
if (cb) cb(err,
|
|
2265
|
+
if (cb) cb(err, val);
|
|
2266
2266
|
}
|
|
2267
2267
|
destroy() {
|
|
2268
2268
|
const fns = this._fns;
|
|
@@ -3798,9 +3798,9 @@ var require_signed_varint = __commonJS({
|
|
|
3798
3798
|
}
|
|
3799
3799
|
});
|
|
3800
3800
|
|
|
3801
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3801
|
+
// node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/ascii.js
|
|
3802
3802
|
var require_ascii = __commonJS({
|
|
3803
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3803
|
+
"node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/ascii.js"(exports, module) {
|
|
3804
3804
|
function byteLength(string) {
|
|
3805
3805
|
return string.length;
|
|
3806
3806
|
}
|
|
@@ -3827,9 +3827,9 @@ var require_ascii = __commonJS({
|
|
|
3827
3827
|
}
|
|
3828
3828
|
});
|
|
3829
3829
|
|
|
3830
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3830
|
+
// node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/base64.js
|
|
3831
3831
|
var require_base64 = __commonJS({
|
|
3832
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3832
|
+
"node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/base64.js"(exports, module) {
|
|
3833
3833
|
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3834
3834
|
var codes = new Uint8Array(256);
|
|
3835
3835
|
for (let i = 0; i < alphabet.length; i++) {
|
|
@@ -3864,7 +3864,7 @@ var require_base64 = __commonJS({
|
|
|
3864
3864
|
}
|
|
3865
3865
|
function write(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3866
3866
|
const len = Math.min(length, buffer.byteLength - offset);
|
|
3867
|
-
for (let i = 0, j = 0;
|
|
3867
|
+
for (let i = 0, j = 0; j < len; i += 4) {
|
|
3868
3868
|
const a = codes[string.charCodeAt(i)];
|
|
3869
3869
|
const b = codes[string.charCodeAt(i + 1)];
|
|
3870
3870
|
const c = codes[string.charCodeAt(i + 2)];
|
|
@@ -3883,9 +3883,9 @@ var require_base64 = __commonJS({
|
|
|
3883
3883
|
}
|
|
3884
3884
|
});
|
|
3885
3885
|
|
|
3886
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3886
|
+
// node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/hex.js
|
|
3887
3887
|
var require_hex = __commonJS({
|
|
3888
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3888
|
+
"node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/hex.js"(exports, module) {
|
|
3889
3889
|
function byteLength(string) {
|
|
3890
3890
|
return string.length >>> 1;
|
|
3891
3891
|
}
|
|
@@ -3927,9 +3927,9 @@ var require_hex = __commonJS({
|
|
|
3927
3927
|
}
|
|
3928
3928
|
});
|
|
3929
3929
|
|
|
3930
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3930
|
+
// node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf8.js
|
|
3931
3931
|
var require_utf8 = __commonJS({
|
|
3932
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3932
|
+
"node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf8.js"(exports, module) {
|
|
3933
3933
|
function byteLength(string) {
|
|
3934
3934
|
let length = 0;
|
|
3935
3935
|
for (let i = 0, n = string.length; i < n; i++) {
|
|
@@ -4047,9 +4047,9 @@ var require_utf8 = __commonJS({
|
|
|
4047
4047
|
}
|
|
4048
4048
|
});
|
|
4049
4049
|
|
|
4050
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
4050
|
+
// node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf16le.js
|
|
4051
4051
|
var require_utf16le = __commonJS({
|
|
4052
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
4052
|
+
"node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf16le.js"(exports, module) {
|
|
4053
4053
|
function byteLength(string) {
|
|
4054
4054
|
return string.length * 2;
|
|
4055
4055
|
}
|
|
@@ -4082,9 +4082,9 @@ var require_utf16le = __commonJS({
|
|
|
4082
4082
|
}
|
|
4083
4083
|
});
|
|
4084
4084
|
|
|
4085
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
4085
|
+
// node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/browser.js
|
|
4086
4086
|
var require_browser2 = __commonJS({
|
|
4087
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
4087
|
+
"node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/browser.js"(exports, module) {
|
|
4088
4088
|
var ascii = require_ascii();
|
|
4089
4089
|
var base64 = require_base64();
|
|
4090
4090
|
var hex = require_hex();
|
|
@@ -4125,7 +4125,7 @@ var require_browser2 = __commonJS({
|
|
|
4125
4125
|
}
|
|
4126
4126
|
function alloc(size, fill2, encoding) {
|
|
4127
4127
|
const buffer = new Uint8Array(size);
|
|
4128
|
-
if (fill2 !== void 0)
|
|
4128
|
+
if (fill2 !== void 0) exports.fill(buffer, fill2, 0, buffer.byteLength, encoding);
|
|
4129
4129
|
return buffer;
|
|
4130
4130
|
}
|
|
4131
4131
|
function allocUnsafe(size) {
|
|
@@ -4161,13 +4161,16 @@ var require_browser2 = __commonJS({
|
|
|
4161
4161
|
totalLength = buffers.reduce((len, buffer) => len + buffer.byteLength, 0);
|
|
4162
4162
|
}
|
|
4163
4163
|
const result = new Uint8Array(totalLength);
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4164
|
+
let offset = 0;
|
|
4165
|
+
for (const buffer of buffers) {
|
|
4166
|
+
if (offset + buffer.byteLength > result.byteLength) {
|
|
4167
|
+
const sub = buffer.subarray(0, result.byteLength - offset);
|
|
4168
|
+
result.set(sub, offset);
|
|
4169
|
+
return result;
|
|
4170
|
+
}
|
|
4171
|
+
result.set(buffer, offset);
|
|
4172
|
+
offset += buffer.byteLength;
|
|
4173
|
+
}
|
|
4171
4174
|
return result;
|
|
4172
4175
|
}
|
|
4173
4176
|
function copy(source, target, targetStart = 0, start = 0, end = source.byteLength) {
|
|
@@ -4215,9 +4218,9 @@ var require_browser2 = __commonJS({
|
|
|
4215
4218
|
encoding = end;
|
|
4216
4219
|
end = buffer.byteLength;
|
|
4217
4220
|
}
|
|
4218
|
-
} else if (typeof
|
|
4221
|
+
} else if (typeof value === "number") {
|
|
4219
4222
|
value = value & 255;
|
|
4220
|
-
} else if (typeof
|
|
4223
|
+
} else if (typeof value === "boolean") {
|
|
4221
4224
|
value = +value;
|
|
4222
4225
|
}
|
|
4223
4226
|
if (offset < 0 || buffer.byteLength < offset || buffer.byteLength < end) {
|
|
@@ -4443,7 +4446,7 @@ var require_browser2 = __commonJS({
|
|
|
4443
4446
|
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4444
4447
|
return view.getInt32(offset, true);
|
|
4445
4448
|
}
|
|
4446
|
-
module.exports = {
|
|
4449
|
+
module.exports = exports = {
|
|
4447
4450
|
isBuffer,
|
|
4448
4451
|
isEncoding,
|
|
4449
4452
|
alloc,
|
|
@@ -4511,13 +4514,13 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4511
4514
|
};
|
|
4512
4515
|
exports.bytes = encoder(
|
|
4513
4516
|
2,
|
|
4514
|
-
function encode(
|
|
4517
|
+
function encode(val, buffer, offset) {
|
|
4515
4518
|
var oldOffset = offset;
|
|
4516
|
-
var len = bufferLength(
|
|
4519
|
+
var len = bufferLength(val);
|
|
4517
4520
|
varint.encode(len, buffer, offset);
|
|
4518
4521
|
offset += varint.encode.bytes;
|
|
4519
|
-
if (b4a.isBuffer(
|
|
4520
|
-
else b4a.write(buffer,
|
|
4522
|
+
if (b4a.isBuffer(val)) b4a.copy(val, buffer, offset);
|
|
4523
|
+
else b4a.write(buffer, val, offset, len);
|
|
4521
4524
|
offset += len;
|
|
4522
4525
|
encode.bytes = offset - oldOffset;
|
|
4523
4526
|
return buffer;
|
|
@@ -4526,24 +4529,24 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4526
4529
|
var oldOffset = offset;
|
|
4527
4530
|
var len = varint.decode(buffer, offset);
|
|
4528
4531
|
offset += varint.decode.bytes;
|
|
4529
|
-
var
|
|
4530
|
-
offset +=
|
|
4532
|
+
var val = buffer.subarray(offset, offset + len);
|
|
4533
|
+
offset += val.length;
|
|
4531
4534
|
decode.bytes = offset - oldOffset;
|
|
4532
|
-
return
|
|
4535
|
+
return val;
|
|
4533
4536
|
},
|
|
4534
|
-
function encodingLength(
|
|
4535
|
-
var len = bufferLength(
|
|
4537
|
+
function encodingLength(val) {
|
|
4538
|
+
var len = bufferLength(val);
|
|
4536
4539
|
return varint.encodingLength(len) + len;
|
|
4537
4540
|
}
|
|
4538
4541
|
);
|
|
4539
4542
|
exports.string = encoder(
|
|
4540
4543
|
2,
|
|
4541
|
-
function encode(
|
|
4544
|
+
function encode(val, buffer, offset) {
|
|
4542
4545
|
var oldOffset = offset;
|
|
4543
|
-
var len = b4a.byteLength(
|
|
4546
|
+
var len = b4a.byteLength(val);
|
|
4544
4547
|
varint.encode(len, buffer, offset, "utf-8");
|
|
4545
4548
|
offset += varint.encode.bytes;
|
|
4546
|
-
b4a.write(buffer,
|
|
4549
|
+
b4a.write(buffer, val, offset, len);
|
|
4547
4550
|
offset += len;
|
|
4548
4551
|
encode.bytes = offset - oldOffset;
|
|
4549
4552
|
return buffer;
|
|
@@ -4552,20 +4555,20 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4552
4555
|
var oldOffset = offset;
|
|
4553
4556
|
var len = varint.decode(buffer, offset);
|
|
4554
4557
|
offset += varint.decode.bytes;
|
|
4555
|
-
var
|
|
4558
|
+
var val = b4a.toString(buffer, "utf-8", offset, offset + len);
|
|
4556
4559
|
offset += len;
|
|
4557
4560
|
decode.bytes = offset - oldOffset;
|
|
4558
|
-
return
|
|
4561
|
+
return val;
|
|
4559
4562
|
},
|
|
4560
|
-
function encodingLength(
|
|
4561
|
-
var len = b4a.byteLength(
|
|
4563
|
+
function encodingLength(val) {
|
|
4564
|
+
var len = b4a.byteLength(val);
|
|
4562
4565
|
return varint.encodingLength(len) + len;
|
|
4563
4566
|
}
|
|
4564
4567
|
);
|
|
4565
4568
|
exports.bool = encoder(
|
|
4566
4569
|
0,
|
|
4567
|
-
function encode(
|
|
4568
|
-
buffer[offset] =
|
|
4570
|
+
function encode(val, buffer, offset) {
|
|
4571
|
+
buffer[offset] = val ? 1 : 0;
|
|
4569
4572
|
encode.bytes = 1;
|
|
4570
4573
|
return buffer;
|
|
4571
4574
|
},
|
|
@@ -4580,26 +4583,26 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4580
4583
|
);
|
|
4581
4584
|
exports.int32 = encoder(
|
|
4582
4585
|
0,
|
|
4583
|
-
function encode(
|
|
4584
|
-
varint.encode(
|
|
4586
|
+
function encode(val, buffer, offset) {
|
|
4587
|
+
varint.encode(val < 0 ? val + 4294967296 : val, buffer, offset);
|
|
4585
4588
|
encode.bytes = varint.encode.bytes;
|
|
4586
4589
|
return buffer;
|
|
4587
4590
|
},
|
|
4588
4591
|
function decode(buffer, offset) {
|
|
4589
|
-
var
|
|
4592
|
+
var val = varint.decode(buffer, offset);
|
|
4590
4593
|
decode.bytes = varint.decode.bytes;
|
|
4591
|
-
return
|
|
4594
|
+
return val > 2147483647 ? val - 4294967296 : val;
|
|
4592
4595
|
},
|
|
4593
|
-
function encodingLength(
|
|
4594
|
-
return varint.encodingLength(
|
|
4596
|
+
function encodingLength(val) {
|
|
4597
|
+
return varint.encodingLength(val < 0 ? val + 4294967296 : val);
|
|
4595
4598
|
}
|
|
4596
4599
|
);
|
|
4597
4600
|
exports.int64 = encoder(
|
|
4598
4601
|
0,
|
|
4599
|
-
function encode(
|
|
4600
|
-
if (
|
|
4602
|
+
function encode(val, buffer, offset) {
|
|
4603
|
+
if (val < 0) {
|
|
4601
4604
|
var last = offset + 9;
|
|
4602
|
-
varint.encode(
|
|
4605
|
+
varint.encode(val * -1, buffer, offset);
|
|
4603
4606
|
offset += varint.encode.bytes - 1;
|
|
4604
4607
|
buffer[offset] = buffer[offset] | 128;
|
|
4605
4608
|
while (offset < last - 1) {
|
|
@@ -4609,29 +4612,29 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4609
4612
|
buffer[last] = 1;
|
|
4610
4613
|
encode.bytes = 10;
|
|
4611
4614
|
} else {
|
|
4612
|
-
varint.encode(
|
|
4615
|
+
varint.encode(val, buffer, offset);
|
|
4613
4616
|
encode.bytes = varint.encode.bytes;
|
|
4614
4617
|
}
|
|
4615
4618
|
return buffer;
|
|
4616
4619
|
},
|
|
4617
4620
|
function decode(buffer, offset) {
|
|
4618
|
-
var
|
|
4619
|
-
if (
|
|
4621
|
+
var val = varint.decode(buffer, offset);
|
|
4622
|
+
if (val >= Math.pow(2, 63)) {
|
|
4620
4623
|
var limit = 9;
|
|
4621
4624
|
while (buffer[offset + limit - 1] === 255) limit--;
|
|
4622
4625
|
limit = limit || 9;
|
|
4623
4626
|
var subset = b4a.allocUnsafe(limit);
|
|
4624
4627
|
b4a.copy(buffer, subset, 0, offset, offset + limit);
|
|
4625
4628
|
subset[limit - 1] = subset[limit - 1] & 127;
|
|
4626
|
-
|
|
4629
|
+
val = -1 * varint.decode(subset, 0);
|
|
4627
4630
|
decode.bytes = 10;
|
|
4628
4631
|
} else {
|
|
4629
4632
|
decode.bytes = varint.decode.bytes;
|
|
4630
4633
|
}
|
|
4631
|
-
return
|
|
4634
|
+
return val;
|
|
4632
4635
|
},
|
|
4633
|
-
function encodingLength(
|
|
4634
|
-
return
|
|
4636
|
+
function encodingLength(val) {
|
|
4637
|
+
return val < 0 ? 10 : varint.encodingLength(val);
|
|
4635
4638
|
}
|
|
4636
4639
|
);
|
|
4637
4640
|
exports.sint32 = exports.sint64 = encoder(
|
|
@@ -4648,15 +4651,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4648
4651
|
);
|
|
4649
4652
|
exports.fixed64 = exports.sfixed64 = encoder(
|
|
4650
4653
|
1,
|
|
4651
|
-
function encode(
|
|
4652
|
-
b4a.copy(
|
|
4654
|
+
function encode(val, buffer, offset) {
|
|
4655
|
+
b4a.copy(val, buffer, offset);
|
|
4653
4656
|
encode.bytes = 8;
|
|
4654
4657
|
return buffer;
|
|
4655
4658
|
},
|
|
4656
4659
|
function decode(buffer, offset) {
|
|
4657
|
-
var
|
|
4660
|
+
var val = buffer.subarray(offset, offset + 8);
|
|
4658
4661
|
decode.bytes = 8;
|
|
4659
|
-
return
|
|
4662
|
+
return val;
|
|
4660
4663
|
},
|
|
4661
4664
|
function encodingLength() {
|
|
4662
4665
|
return 8;
|
|
@@ -4664,15 +4667,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4664
4667
|
);
|
|
4665
4668
|
exports.double = encoder(
|
|
4666
4669
|
1,
|
|
4667
|
-
function encode(
|
|
4668
|
-
b4a.writeDoubleLE(buffer,
|
|
4670
|
+
function encode(val, buffer, offset) {
|
|
4671
|
+
b4a.writeDoubleLE(buffer, val, offset);
|
|
4669
4672
|
encode.bytes = 8;
|
|
4670
4673
|
return buffer;
|
|
4671
4674
|
},
|
|
4672
4675
|
function decode(buffer, offset) {
|
|
4673
|
-
var
|
|
4676
|
+
var val = b4a.readDoubleLE(buffer, offset);
|
|
4674
4677
|
decode.bytes = 8;
|
|
4675
|
-
return
|
|
4678
|
+
return val;
|
|
4676
4679
|
},
|
|
4677
4680
|
function encodingLength() {
|
|
4678
4681
|
return 8;
|
|
@@ -4680,15 +4683,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4680
4683
|
);
|
|
4681
4684
|
exports.fixed32 = encoder(
|
|
4682
4685
|
5,
|
|
4683
|
-
function encode(
|
|
4684
|
-
b4a.writeUInt32LE(buffer,
|
|
4686
|
+
function encode(val, buffer, offset) {
|
|
4687
|
+
b4a.writeUInt32LE(buffer, val, offset);
|
|
4685
4688
|
encode.bytes = 4;
|
|
4686
4689
|
return buffer;
|
|
4687
4690
|
},
|
|
4688
4691
|
function decode(buffer, offset) {
|
|
4689
|
-
var
|
|
4692
|
+
var val = b4a.readUInt32LE(buffer, offset);
|
|
4690
4693
|
decode.bytes = 4;
|
|
4691
|
-
return
|
|
4694
|
+
return val;
|
|
4692
4695
|
},
|
|
4693
4696
|
function encodingLength() {
|
|
4694
4697
|
return 4;
|
|
@@ -4696,15 +4699,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4696
4699
|
);
|
|
4697
4700
|
exports.sfixed32 = encoder(
|
|
4698
4701
|
5,
|
|
4699
|
-
function encode(
|
|
4700
|
-
b4a.writeInt32LE(buffer,
|
|
4702
|
+
function encode(val, buffer, offset) {
|
|
4703
|
+
b4a.writeInt32LE(buffer, val, offset);
|
|
4701
4704
|
encode.bytes = 4;
|
|
4702
4705
|
return buffer;
|
|
4703
4706
|
},
|
|
4704
4707
|
function decode(buffer, offset) {
|
|
4705
|
-
var
|
|
4708
|
+
var val = b4a.readInt32LE(buffer, offset);
|
|
4706
4709
|
decode.bytes = 4;
|
|
4707
|
-
return
|
|
4710
|
+
return val;
|
|
4708
4711
|
},
|
|
4709
4712
|
function encodingLength() {
|
|
4710
4713
|
return 4;
|
|
@@ -4712,15 +4715,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4712
4715
|
);
|
|
4713
4716
|
exports.float = encoder(
|
|
4714
4717
|
5,
|
|
4715
|
-
function encode(
|
|
4716
|
-
b4a.writeFloatLE(buffer,
|
|
4718
|
+
function encode(val, buffer, offset) {
|
|
4719
|
+
b4a.writeFloatLE(buffer, val, offset);
|
|
4717
4720
|
encode.bytes = 4;
|
|
4718
4721
|
return buffer;
|
|
4719
4722
|
},
|
|
4720
4723
|
function decode(buffer, offset) {
|
|
4721
|
-
var
|
|
4724
|
+
var val = b4a.readFloatLE(buffer, offset);
|
|
4722
4725
|
decode.bytes = 4;
|
|
4723
|
-
return
|
|
4726
|
+
return val;
|
|
4724
4727
|
},
|
|
4725
4728
|
function encodingLength() {
|
|
4726
4729
|
return 4;
|
|
@@ -4735,8 +4738,8 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4735
4738
|
encodingLength
|
|
4736
4739
|
};
|
|
4737
4740
|
}
|
|
4738
|
-
function bufferLength(
|
|
4739
|
-
return b4a.isBuffer(
|
|
4741
|
+
function bufferLength(val) {
|
|
4742
|
+
return b4a.isBuffer(val) ? val.length : b4a.byteLength(val);
|
|
4740
4743
|
}
|
|
4741
4744
|
}
|
|
4742
4745
|
});
|
|
@@ -5841,8 +5844,8 @@ var require_messages = __commonJS({
|
|
|
5841
5844
|
}
|
|
5842
5845
|
}
|
|
5843
5846
|
}
|
|
5844
|
-
function defined(
|
|
5845
|
-
return
|
|
5847
|
+
function defined(val) {
|
|
5848
|
+
return val !== null && val !== void 0 && (typeof val !== "number" || !isNaN(val));
|
|
5846
5849
|
}
|
|
5847
5850
|
}
|
|
5848
5851
|
});
|
|
@@ -6862,16 +6865,16 @@ var require_ms = __commonJS({
|
|
|
6862
6865
|
var d = h * 24;
|
|
6863
6866
|
var w = d * 7;
|
|
6864
6867
|
var y = d * 365.25;
|
|
6865
|
-
module.exports = function(
|
|
6868
|
+
module.exports = function(val, options) {
|
|
6866
6869
|
options = options || {};
|
|
6867
|
-
var type = typeof
|
|
6868
|
-
if (type === "string" &&
|
|
6869
|
-
return parse(
|
|
6870
|
-
} else if (type === "number" && isFinite(
|
|
6871
|
-
return options.long ? fmtLong(
|
|
6870
|
+
var type = typeof val;
|
|
6871
|
+
if (type === "string" && val.length > 0) {
|
|
6872
|
+
return parse(val);
|
|
6873
|
+
} else if (type === "number" && isFinite(val)) {
|
|
6874
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
6872
6875
|
}
|
|
6873
6876
|
throw new Error(
|
|
6874
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(
|
|
6877
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
6875
6878
|
);
|
|
6876
6879
|
};
|
|
6877
6880
|
function parse(str) {
|
|
@@ -7024,8 +7027,8 @@ var require_common = __commonJS({
|
|
|
7024
7027
|
index++;
|
|
7025
7028
|
const formatter = createDebug.formatters[format];
|
|
7026
7029
|
if (typeof formatter === "function") {
|
|
7027
|
-
const
|
|
7028
|
-
match = formatter.call(self,
|
|
7030
|
+
const val = args[index];
|
|
7031
|
+
match = formatter.call(self, val);
|
|
7029
7032
|
args.splice(index, 1);
|
|
7030
7033
|
index--;
|
|
7031
7034
|
}
|
|
@@ -7116,11 +7119,11 @@ var require_common = __commonJS({
|
|
|
7116
7119
|
function toNamespace(regexp) {
|
|
7117
7120
|
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
7118
7121
|
}
|
|
7119
|
-
function coerce(
|
|
7120
|
-
if (
|
|
7121
|
-
return
|
|
7122
|
+
function coerce(val) {
|
|
7123
|
+
if (val instanceof Error) {
|
|
7124
|
+
return val.stack || val.message;
|
|
7122
7125
|
}
|
|
7123
|
-
return
|
|
7126
|
+
return val;
|
|
7124
7127
|
}
|
|
7125
7128
|
function destroy() {
|
|
7126
7129
|
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
@@ -7858,11 +7861,11 @@ var require_fast_bitfield = __commonJS({
|
|
|
7858
7861
|
iterator() {
|
|
7859
7862
|
return new Iterator(this);
|
|
7860
7863
|
}
|
|
7861
|
-
fill(
|
|
7864
|
+
fill(val, start, end) {
|
|
7862
7865
|
if (!start) start = 0;
|
|
7863
|
-
if (
|
|
7864
|
-
if (
|
|
7865
|
-
this._fillBuffer(
|
|
7866
|
+
if (val === true) return this._fillBit(true, start, end === 0 ? end : end || this.length);
|
|
7867
|
+
if (val === false) return this._fillBit(false, start, end === 0 ? end : end || this.length);
|
|
7868
|
+
this._fillBuffer(val, start, end === 0 ? end : end || start + 8 * val.length);
|
|
7866
7869
|
}
|
|
7867
7870
|
grow() {
|
|
7868
7871
|
if (this._page.level === 3) throw new Error("Cannot grow beyond " + this.length);
|
|
@@ -8823,7 +8826,7 @@ var require_emitter = __commonJS({
|
|
|
8823
8826
|
this.actives++;
|
|
8824
8827
|
return true;
|
|
8825
8828
|
};
|
|
8826
|
-
Nanoresource.prototype.inactive = function(cb, err,
|
|
8829
|
+
Nanoresource.prototype.inactive = function(cb, err, val) {
|
|
8827
8830
|
if (!--this.actives) {
|
|
8828
8831
|
const queue = this[preclosing];
|
|
8829
8832
|
if (queue) {
|
|
@@ -8831,7 +8834,7 @@ var require_emitter = __commonJS({
|
|
|
8831
8834
|
while (queue.length) this.close(queue.shift());
|
|
8832
8835
|
}
|
|
8833
8836
|
}
|
|
8834
|
-
if (cb) cb(err,
|
|
8837
|
+
if (cb) cb(err, val);
|
|
8835
8838
|
};
|
|
8836
8839
|
Nanoresource.prototype.close = function(allowActive, cb) {
|
|
8837
8840
|
if (typeof allowActive === "function") return this.close(false, allowActive);
|
|
@@ -10316,10 +10319,10 @@ var require_hypercore = __commonJS({
|
|
|
10316
10319
|
err.code = "ETIMEDOUT";
|
|
10317
10320
|
cb(err);
|
|
10318
10321
|
}
|
|
10319
|
-
function done(err,
|
|
10322
|
+
function done(err, val) {
|
|
10320
10323
|
if (failed) return;
|
|
10321
10324
|
clearTimeout(id);
|
|
10322
|
-
cb(err,
|
|
10325
|
+
cb(err, val);
|
|
10323
10326
|
}
|
|
10324
10327
|
}
|
|
10325
10328
|
function toWantRange(i) {
|