typeson-registry 11.0.2 → 11.1.1
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/README.md +2 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -13
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.cjs +109 -27
- package/dist/index.umd.cjs.map +1 -1
- package/dist/index.umd.min.cjs +1 -1
- package/dist/index.umd.min.cjs.map +1 -1
- package/dist/presets/builtin.umd.cjs +1 -1
- package/dist/presets/builtin.umd.cjs.map +1 -1
- package/dist/presets/socketio.umd.cjs +1 -1
- package/dist/presets/socketio.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
- package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning.umd.cjs +1 -1
- package/dist/presets/structured-cloning.umd.cjs.map +1 -1
- package/dist/presets/universal.umd.cjs +1 -1
- package/dist/presets/universal.umd.cjs.map +1 -1
- package/dist/types/arraybuffer.d.ts.map +1 -1
- package/dist/types/arraybuffer.umd.cjs +1 -1
- package/dist/types/arraybuffer.umd.cjs.map +1 -1
- package/dist/types/cloneable.umd.cjs.map +1 -1
- package/dist/types/dataview.d.ts.map +1 -1
- package/dist/types/dataview.umd.cjs +1 -1
- package/dist/types/dataview.umd.cjs.map +1 -1
- package/dist/types/promise.d.ts +6 -0
- package/dist/types/promise.d.ts.map +1 -0
- package/dist/types/promise.umd.cjs +2 -0
- package/dist/types/promise.umd.cjs.map +1 -0
- package/dist/types/resurrectable.umd.cjs.map +1 -1
- package/dist/types/symbol.d.ts +6 -0
- package/dist/types/symbol.d.ts.map +1 -0
- package/dist/types/symbol.umd.cjs +2 -0
- package/dist/types/symbol.umd.cjs.map +1 -0
- package/dist/types/typed-arrays.umd.cjs +1 -1
- package/dist/types/typed-arrays.umd.cjs.map +1 -1
- package/package.json +8 -8
- package/polyfills/createObjectURL.umd.cjs.map +1 -1
- package/utils/generateUUID.js +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1295,7 +1295,8 @@
|
|
|
1295
1295
|
stateObj.buffers.push(b);
|
|
1296
1296
|
return {
|
|
1297
1297
|
s: encode(b),
|
|
1298
|
-
maxByteLength: b.maxByteLength
|
|
1298
|
+
maxByteLength: b.maxByteLength,
|
|
1299
|
+
resizable: b.resizable
|
|
1299
1300
|
};
|
|
1300
1301
|
},
|
|
1301
1302
|
revive: function revive(b64,
|
|
@@ -1314,9 +1315,11 @@
|
|
|
1314
1315
|
*/
|
|
1315
1316
|
b64.index];
|
|
1316
1317
|
}
|
|
1317
|
-
var buffer = decode(
|
|
1318
|
+
var buffer = decode(/** @type {string} */b64.s, b64.resizable
|
|
1319
|
+
// todo[engine:node@>20]: Remove comment
|
|
1320
|
+
/* c8 ignore next -- Node >= 20 */ ? {
|
|
1318
1321
|
maxByteLength: b64.maxByteLength
|
|
1319
|
-
});
|
|
1322
|
+
} : undefined);
|
|
1320
1323
|
stateObj.buffers.push(buffer);
|
|
1321
1324
|
return buffer;
|
|
1322
1325
|
}
|
|
@@ -1335,7 +1338,7 @@
|
|
|
1335
1338
|
},
|
|
1336
1339
|
replace: String,
|
|
1337
1340
|
revive: function revive(s) {
|
|
1338
|
-
return new Object(BigInt(
|
|
1341
|
+
return new Object(BigInt(/** @type {string} */s));
|
|
1339
1342
|
}
|
|
1340
1343
|
}
|
|
1341
1344
|
};
|
|
@@ -1352,7 +1355,7 @@
|
|
|
1352
1355
|
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
1353
1356
|
// eslint-disable-next-line unicorn/prefer-native-coercion-functions -- Clearer
|
|
1354
1357
|
revive: function revive(s) {
|
|
1355
|
-
return BigInt(
|
|
1358
|
+
return BigInt(/** @type {string} */s);
|
|
1356
1359
|
}
|
|
1357
1360
|
}
|
|
1358
1361
|
};
|
|
@@ -1456,8 +1459,8 @@
|
|
|
1456
1459
|
};
|
|
1457
1460
|
},
|
|
1458
1461
|
revive: function revive(obj) {
|
|
1459
|
-
var type = (
|
|
1460
|
-
stringContents = (
|
|
1462
|
+
var type = (/** @type {{type: string, stringContents: string}} */obj).type,
|
|
1463
|
+
stringContents = (/** @type {{type: string, stringContents: string}} */obj).stringContents;
|
|
1461
1464
|
return new Blob([string2arraybuffer(stringContents)], {
|
|
1462
1465
|
type: type
|
|
1463
1466
|
});
|
|
@@ -1474,7 +1477,7 @@
|
|
|
1474
1477
|
reader.addEventListener('load', function () {
|
|
1475
1478
|
resolve({
|
|
1476
1479
|
type: b.type,
|
|
1477
|
-
stringContents: arraybuffer2string(
|
|
1480
|
+
stringContents: arraybuffer2string(/** @type {ArrayBuffer} */reader.result)
|
|
1478
1481
|
});
|
|
1479
1482
|
});
|
|
1480
1483
|
// Seems not feasible to accurately simulate
|
|
@@ -1502,11 +1505,11 @@
|
|
|
1502
1505
|
/* c8 ignore next */
|
|
1503
1506
|
var d = Date.now();
|
|
1504
1507
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replaceAll(/[xy]/g, function (c) {
|
|
1505
|
-
/* eslint-disable no-bitwise -- Convenient */
|
|
1508
|
+
/* eslint-disable no-bitwise, sonarjs/pseudo-random -- Convenient */
|
|
1506
1509
|
var r = Math.trunc((d + Math.random() * 16) % 16);
|
|
1507
1510
|
d = Math.floor(d / 16);
|
|
1508
1511
|
return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
|
|
1509
|
-
/* eslint-enable no-bitwise -- Convenient */
|
|
1512
|
+
/* eslint-enable no-bitwise, sonarjs/pseudo-random -- Convenient */
|
|
1510
1513
|
});
|
|
1511
1514
|
}
|
|
1512
1515
|
|
|
@@ -1533,8 +1536,8 @@
|
|
|
1533
1536
|
};
|
|
1534
1537
|
},
|
|
1535
1538
|
revive: function revive(obj) {
|
|
1536
|
-
var uuid = (
|
|
1537
|
-
encapsulated = (
|
|
1539
|
+
var uuid = (/** @type {{uuid: string, encapsulated: any}} */obj).uuid,
|
|
1540
|
+
encapsulated = (/** @type {{uuid: string, encapsulated: any}} */obj).encapsulated;
|
|
1538
1541
|
return cloneableObjectsByUUID[uuid][Symbol["for"]('cloneRevive')](encapsulated);
|
|
1539
1542
|
}
|
|
1540
1543
|
}
|
|
@@ -1548,10 +1551,10 @@
|
|
|
1548
1551
|
test: function test(x) {
|
|
1549
1552
|
return toStringTag(x) === 'CryptoKey' && x.extractable;
|
|
1550
1553
|
},
|
|
1551
|
-
replaceAsync: function replaceAsync(
|
|
1554
|
+
replaceAsync: function replaceAsync(/** @type {CryptoKey} */
|
|
1552
1555
|
key) {
|
|
1553
|
-
return new e(
|
|
1554
|
-
var _ref = _asyncToGenerator(
|
|
1556
|
+
return new e(/*#__PURE__*/function () {
|
|
1557
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
|
|
1555
1558
|
var jwk;
|
|
1556
1559
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1557
1560
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -1651,6 +1654,7 @@
|
|
|
1651
1654
|
return {
|
|
1652
1655
|
encoded: encode(buffer),
|
|
1653
1656
|
maxByteLength: buffer.maxByteLength,
|
|
1657
|
+
resizable: buffer.resizable,
|
|
1654
1658
|
byteOffset: byteOffset,
|
|
1655
1659
|
byteLength: byteLength
|
|
1656
1660
|
};
|
|
@@ -1669,15 +1673,18 @@
|
|
|
1669
1673
|
byteLength = b64Obj.byteLength,
|
|
1670
1674
|
encoded = b64Obj.encoded,
|
|
1671
1675
|
index = b64Obj.index,
|
|
1672
|
-
maxByteLength = b64Obj.maxByteLength
|
|
1676
|
+
maxByteLength = b64Obj.maxByteLength,
|
|
1677
|
+
resizable = b64Obj.resizable;
|
|
1673
1678
|
var buffer;
|
|
1674
1679
|
if ('index' in b64Obj) {
|
|
1675
1680
|
buffer = stateObj.buffers[index];
|
|
1676
1681
|
} else {
|
|
1677
|
-
buffer = decode(encoded,
|
|
1678
|
-
|
|
1682
|
+
buffer = decode(encoded,
|
|
1683
|
+
// todo[engine:node@>20]: Remove comment
|
|
1684
|
+
/* c8 ignore next 3 -- Depends on Node version */
|
|
1685
|
+
resizable ? {
|
|
1679
1686
|
maxByteLength: maxByteLength
|
|
1680
|
-
});
|
|
1687
|
+
} : maxByteLength);
|
|
1681
1688
|
stateObj.buffers.push(buffer);
|
|
1682
1689
|
}
|
|
1683
1690
|
return new DataView(buffer, byteOffset, byteLength);
|
|
@@ -2042,7 +2049,7 @@
|
|
|
2042
2049
|
* columnNumber?: import('typeson').Integer
|
|
2043
2050
|
* }}
|
|
2044
2051
|
*/
|
|
2045
|
-
isAggregateError ? new (
|
|
2052
|
+
isAggregateError ? new (/** @type {AggregateErrorConstructor} */
|
|
2046
2053
|
Ctor)(obj.errors, obj.message) : new (
|
|
2047
2054
|
/**
|
|
2048
2055
|
* @type {TypeErrorConstructor|RangeErrorConstructor|
|
|
@@ -2113,7 +2120,7 @@
|
|
|
2113
2120
|
reader.addEventListener('load', function () {
|
|
2114
2121
|
resolve({
|
|
2115
2122
|
type: f.type,
|
|
2116
|
-
stringContents: arraybuffer2string(
|
|
2123
|
+
stringContents: arraybuffer2string(/** @type {ArrayBuffer} */reader.result),
|
|
2117
2124
|
name: f.name,
|
|
2118
2125
|
lastModified: f.lastModified
|
|
2119
2126
|
});
|
|
@@ -2244,8 +2251,8 @@
|
|
|
2244
2251
|
ctx.drawImage(img, 0, 0);
|
|
2245
2252
|
});
|
|
2246
2253
|
img.src = o.dataURL;
|
|
2247
|
-
return new e(
|
|
2248
|
-
var _ref = _asyncToGenerator(
|
|
2254
|
+
return new e(/*#__PURE__*/function () {
|
|
2255
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
|
|
2249
2256
|
var resp;
|
|
2250
2257
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2251
2258
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -2495,6 +2502,55 @@
|
|
|
2495
2502
|
}
|
|
2496
2503
|
};
|
|
2497
2504
|
|
|
2505
|
+
/**
|
|
2506
|
+
* @type {import('typeson').TypeSpecSet}
|
|
2507
|
+
*/
|
|
2508
|
+
var promise = {
|
|
2509
|
+
promise: {
|
|
2510
|
+
test: function test(x) {
|
|
2511
|
+
return toStringTag(x) === 'Promise';
|
|
2512
|
+
},
|
|
2513
|
+
replaceAsync: function replaceAsync(prom) {
|
|
2514
|
+
return new e(/*#__PURE__*/function () {
|
|
2515
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) {
|
|
2516
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2517
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2518
|
+
case 0:
|
|
2519
|
+
_context.prev = 0;
|
|
2520
|
+
_context.t0 = resolve;
|
|
2521
|
+
_context.next = 4;
|
|
2522
|
+
return prom;
|
|
2523
|
+
case 4:
|
|
2524
|
+
_context.t1 = _context.sent;
|
|
2525
|
+
_context.t2 = {
|
|
2526
|
+
value: _context.t1
|
|
2527
|
+
};
|
|
2528
|
+
(0, _context.t0)(_context.t2);
|
|
2529
|
+
_context.next = 12;
|
|
2530
|
+
break;
|
|
2531
|
+
case 9:
|
|
2532
|
+
_context.prev = 9;
|
|
2533
|
+
_context.t3 = _context["catch"](0);
|
|
2534
|
+
resolve({
|
|
2535
|
+
error: _context.t3
|
|
2536
|
+
});
|
|
2537
|
+
case 12:
|
|
2538
|
+
case "end":
|
|
2539
|
+
return _context.stop();
|
|
2540
|
+
}
|
|
2541
|
+
}, _callee, null, [[0, 9]]);
|
|
2542
|
+
}));
|
|
2543
|
+
return function (_x) {
|
|
2544
|
+
return _ref.apply(this, arguments);
|
|
2545
|
+
};
|
|
2546
|
+
}());
|
|
2547
|
+
},
|
|
2548
|
+
revive: function revive(o) {
|
|
2549
|
+
return o.error ? Promise.reject(o.error) : Promise.resolve(o.value);
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
};
|
|
2553
|
+
|
|
2498
2554
|
/**
|
|
2499
2555
|
* @type {import('typeson').TypeSpecSet}
|
|
2500
2556
|
*/
|
|
@@ -2558,6 +2614,26 @@
|
|
|
2558
2614
|
}
|
|
2559
2615
|
};
|
|
2560
2616
|
|
|
2617
|
+
/**
|
|
2618
|
+
* @type {import('typeson').TypeSpecSet}
|
|
2619
|
+
*/
|
|
2620
|
+
var symbol = {
|
|
2621
|
+
symbol: {
|
|
2622
|
+
test: function test(x) {
|
|
2623
|
+
return _typeof$1(x) === 'symbol';
|
|
2624
|
+
},
|
|
2625
|
+
replace: function replace(sym) {
|
|
2626
|
+
return {
|
|
2627
|
+
global: Symbol.keyFor(sym) !== undefined,
|
|
2628
|
+
sym: String(sym).slice(7, -1)
|
|
2629
|
+
};
|
|
2630
|
+
},
|
|
2631
|
+
revive: function revive(o) {
|
|
2632
|
+
return o.global ? Symbol["for"](o.sym) : Symbol(o.sym);
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
};
|
|
2636
|
+
|
|
2561
2637
|
// Support all kinds of typed arrays (views of ArrayBuffers)
|
|
2562
2638
|
|
|
2563
2639
|
/**
|
|
@@ -2659,6 +2735,7 @@
|
|
|
2659
2735
|
stateObj.buffers.push(buffer);
|
|
2660
2736
|
return {
|
|
2661
2737
|
maxByteLength: buffer.maxByteLength,
|
|
2738
|
+
resizable: buffer.resizable,
|
|
2662
2739
|
encoded: encode(buffer),
|
|
2663
2740
|
byteOffset: byteOffset,
|
|
2664
2741
|
length: l
|
|
@@ -2678,15 +2755,18 @@
|
|
|
2678
2755
|
len = b64Obj.length,
|
|
2679
2756
|
encoded = b64Obj.encoded,
|
|
2680
2757
|
index = b64Obj.index,
|
|
2681
|
-
maxByteLength = b64Obj.maxByteLength
|
|
2758
|
+
maxByteLength = b64Obj.maxByteLength,
|
|
2759
|
+
resizable = b64Obj.resizable;
|
|
2682
2760
|
var buffer;
|
|
2683
2761
|
if ('index' in b64Obj) {
|
|
2684
2762
|
buffer = stateObj.buffers[index];
|
|
2685
2763
|
} else {
|
|
2686
|
-
buffer = decode(encoded,
|
|
2687
|
-
|
|
2764
|
+
buffer = decode(encoded,
|
|
2765
|
+
// todo[engine:node@>20]: Remove comment
|
|
2766
|
+
/* c8 ignore next 3 -- Depends on Node version */
|
|
2767
|
+
resizable ? {
|
|
2688
2768
|
maxByteLength: maxByteLength
|
|
2689
|
-
});
|
|
2769
|
+
} : undefined);
|
|
2690
2770
|
stateObj.buffers.push(buffer);
|
|
2691
2771
|
}
|
|
2692
2772
|
return new TypedArray(buffer, byteOffset, len);
|
|
@@ -3061,6 +3141,7 @@
|
|
|
3061
3141
|
exports.nonbuiltinIgnore = nonbuiltinIgnore;
|
|
3062
3142
|
exports.postmessage = postmessage;
|
|
3063
3143
|
exports.primitiveObjects = primitiveObjects;
|
|
3144
|
+
exports.promise = promise;
|
|
3064
3145
|
exports.regexp = regexp;
|
|
3065
3146
|
exports.resurrectable = resurrectable;
|
|
3066
3147
|
exports.set = set;
|
|
@@ -3070,6 +3151,7 @@
|
|
|
3070
3151
|
exports.specialNumbers = specialNumbers;
|
|
3071
3152
|
exports.structuredCloning = expObj;
|
|
3072
3153
|
exports.structuredCloningThrowing = structuredCloningThrowing;
|
|
3154
|
+
exports.symbol = symbol;
|
|
3073
3155
|
exports.toStringTag = toStringTag;
|
|
3074
3156
|
exports.typedArrays = typedArrays;
|
|
3075
3157
|
exports.typedArraysSocketio = typedArraysSocketIO;
|