typeson-registry 14.7.0 → 15.0.0
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/index.js +50 -61
- 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 +49 -60
- 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/polyfills/SyncBlobFile.d.ts.map +1 -1
- package/dist/polyfills/URL.d.ts.map +1 -1
- package/dist/polyfills/buildCanvasPolyfills.d.ts +78 -0
- package/dist/polyfills/buildCanvasPolyfills.d.ts.map +1 -0
- package/dist/polyfills/buildFileList.d.ts +21 -0
- package/dist/polyfills/buildFileList.d.ts.map +1 -0
- package/dist/polyfills/index.d.ts +2 -1
- package/dist/presets/builtin.umd.cjs +1 -1
- package/dist/presets/builtin.umd.cjs.map +1 -1
- package/dist/presets/postmessage.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-for-storage.umd.cjs +1 -1
- package/dist/presets/structured-cloning-for-storage.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/blob.d.ts.map +1 -1
- package/dist/types/blob.umd.cjs.map +1 -1
- package/dist/types/cloneable.umd.cjs.map +1 -1
- package/dist/types/cryptokey.umd.cjs.map +1 -1
- package/dist/types/date.d.ts.map +1 -1
- package/dist/types/date.umd.cjs +1 -1
- package/dist/types/date.umd.cjs.map +1 -1
- package/dist/types/dommatrix.umd.cjs.map +1 -1
- package/dist/types/dompoint.umd.cjs.map +1 -1
- package/dist/types/domrect.umd.cjs.map +1 -1
- package/dist/types/errors.umd.cjs.map +1 -1
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/file.umd.cjs.map +1 -1
- package/dist/types/filelist.d.ts.map +1 -1
- package/dist/types/filelist.umd.cjs.map +1 -1
- package/dist/types/imagebitmap.umd.cjs.map +1 -1
- package/dist/types/primitive-objects.d.ts.map +1 -1
- package/dist/types/primitive-objects.umd.cjs.map +1 -1
- package/dist/types/resurrectable.umd.cjs.map +1 -1
- package/dist/types/typed-arrays-socketio.umd.cjs.map +1 -1
- package/dist/types/typed-arrays.umd.cjs.map +1 -1
- package/dist/utils/generateUUID.d.ts.map +1 -1
- package/package.json +32 -34
- package/polyfills/SyncBlobFile.js +1 -4
- package/polyfills/URL.js +2 -5
- package/polyfills/buildCanvasPolyfills.js +246 -0
- package/polyfills/buildFileList.js +74 -0
- package/polyfills/index.cjs +564 -185
- package/polyfills/index.cjs.map +1 -1
- package/polyfills/index.js +2 -1
- package/utils/generateUUID.js +0 -1
- package/polyfills/FileList.js +0 -51
- package/polyfills/createImageBitmap.js +0 -20
package/dist/index.js
CHANGED
|
@@ -332,8 +332,7 @@ const blob = {
|
|
|
332
332
|
req.open('GET', URL.createObjectURL(b), false); // Sync
|
|
333
333
|
req.send();
|
|
334
334
|
|
|
335
|
-
|
|
336
|
-
/* c8 ignore next 3 */
|
|
335
|
+
/* c8 ignore next 3 -- Seems not feasible to accurately simulate */
|
|
337
336
|
if (req.status !== 200 && req.status !== 0) {
|
|
338
337
|
throw new Error('Bad Blob access: ' + req.status);
|
|
339
338
|
}
|
|
@@ -365,8 +364,8 @@ const blob = {
|
|
|
365
364
|
)
|
|
366
365
|
});
|
|
367
366
|
});
|
|
368
|
-
//
|
|
369
|
-
/* c8 ignore next 3 */
|
|
367
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
368
|
+
/* c8 ignore next 3 -- Seems not feasible to accurately simulate */
|
|
370
369
|
reader.addEventListener('error', () => {
|
|
371
370
|
reject(reader.error);
|
|
372
371
|
});
|
|
@@ -386,7 +385,6 @@ const blob = {
|
|
|
386
385
|
* @returns {string}
|
|
387
386
|
*/
|
|
388
387
|
function generateUUID () { // Adapted from original: public domain/MIT: https://stackoverflow.com/a/8809472/271577
|
|
389
|
-
/* c8 ignore next */
|
|
390
388
|
let d = Date.now();
|
|
391
389
|
|
|
392
390
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replaceAll(/[xy]/gu, function (c) {
|
|
@@ -447,8 +445,8 @@ const cryptokey = {
|
|
|
447
445
|
let jwk;
|
|
448
446
|
try {
|
|
449
447
|
jwk = await crypto.subtle.exportKey('jwk', key);
|
|
450
|
-
//
|
|
451
|
-
/* c8 ignore next 4 */
|
|
448
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
449
|
+
/* c8 ignore next 4 -- Our format should be valid and our key extractable */
|
|
452
450
|
} catch (err) {
|
|
453
451
|
reject(err);
|
|
454
452
|
return;
|
|
@@ -550,16 +548,10 @@ const date = {
|
|
|
550
548
|
test (x) { return toStringTag(x) === 'Date'; },
|
|
551
549
|
replace (dt) {
|
|
552
550
|
const time = dt.getTime();
|
|
553
|
-
|
|
554
|
-
return 'NaN';
|
|
555
|
-
}
|
|
556
|
-
return time;
|
|
551
|
+
return Number.isNaN(time) ? 'NaN' : time;
|
|
557
552
|
},
|
|
558
553
|
revive (time) {
|
|
559
|
-
|
|
560
|
-
return new Date(NaN);
|
|
561
|
-
}
|
|
562
|
-
return new Date(time);
|
|
554
|
+
return new Date(time === 'NaN' ? NaN : time);
|
|
563
555
|
}
|
|
564
556
|
}
|
|
565
557
|
};
|
|
@@ -591,11 +583,11 @@ const domexception = {
|
|
|
591
583
|
*/
|
|
592
584
|
const dommatrix = {};
|
|
593
585
|
|
|
594
|
-
/* c8 ignore next */
|
|
586
|
+
/* c8 ignore next -- Later support */
|
|
595
587
|
if (typeof DOMMatrix !== 'undefined') {
|
|
596
588
|
create$5(DOMMatrix);
|
|
597
589
|
}
|
|
598
|
-
/* c8 ignore next */
|
|
590
|
+
/* c8 ignore next -- Later support */
|
|
599
591
|
if (typeof DOMMatrixReadOnly !== 'undefined') {
|
|
600
592
|
create$5(DOMMatrixReadOnly);
|
|
601
593
|
}
|
|
@@ -658,11 +650,11 @@ function create$5 (Ctor) {
|
|
|
658
650
|
*/
|
|
659
651
|
const dompoint = {};
|
|
660
652
|
|
|
661
|
-
/* c8 ignore next */
|
|
653
|
+
/* c8 ignore next -- Later support */
|
|
662
654
|
if (typeof DOMPoint !== 'undefined') {
|
|
663
655
|
create$4(DOMPoint);
|
|
664
656
|
}
|
|
665
|
-
/* c8 ignore next */
|
|
657
|
+
/* c8 ignore next -- Later support */
|
|
666
658
|
if (typeof DOMPointReadOnly !== 'undefined') {
|
|
667
659
|
create$4(DOMPointReadOnly);
|
|
668
660
|
}
|
|
@@ -717,11 +709,11 @@ const domquad = {
|
|
|
717
709
|
*/
|
|
718
710
|
const domrect = {};
|
|
719
711
|
|
|
720
|
-
/* c8 ignore next */
|
|
712
|
+
/* c8 ignore next -- Later support */
|
|
721
713
|
if (typeof DOMRect !== 'undefined') {
|
|
722
714
|
create$3(DOMRect);
|
|
723
715
|
}
|
|
724
|
-
/* c8 ignore next */
|
|
716
|
+
/* c8 ignore next -- Later support */
|
|
725
717
|
if (typeof DOMRectReadOnly !== 'undefined') {
|
|
726
718
|
create$3(DOMRectReadOnly);
|
|
727
719
|
}
|
|
@@ -861,12 +853,12 @@ const errors = {};
|
|
|
861
853
|
EvalError, URIError
|
|
862
854
|
].forEach((error) => create$2(error));
|
|
863
855
|
|
|
864
|
-
/* c8 ignore next 3 */
|
|
856
|
+
/* c8 ignore next 3 -- Later support */
|
|
865
857
|
if (typeof AggregateError !== 'undefined') {
|
|
866
858
|
create$2(AggregateError);
|
|
867
859
|
}
|
|
868
860
|
|
|
869
|
-
/* c8 ignore next 5 */
|
|
861
|
+
/* c8 ignore next 5 -- Non-standard */
|
|
870
862
|
// @ts-expect-error Non-standard
|
|
871
863
|
if (typeof InternalError === 'function') {
|
|
872
864
|
// @ts-expect-error Non-standard
|
|
@@ -951,8 +943,7 @@ const file = {
|
|
|
951
943
|
req.open('GET', URL.createObjectURL(f), false); // Sync
|
|
952
944
|
req.send();
|
|
953
945
|
|
|
954
|
-
|
|
955
|
-
/* c8 ignore next 3 */
|
|
946
|
+
/* c8 ignore next 3 -- Seems not feasible to accurately simulate */
|
|
956
947
|
if (req.status !== 200 && req.status !== 0) {
|
|
957
948
|
throw new Error('Bad File access: ' + req.status);
|
|
958
949
|
}
|
|
@@ -988,8 +979,8 @@ const file = {
|
|
|
988
979
|
lastModified: f.lastModified
|
|
989
980
|
});
|
|
990
981
|
});
|
|
991
|
-
//
|
|
992
|
-
/* c8 ignore next 3 */
|
|
982
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
983
|
+
/* c8 ignore next 3 -- Seems not feasible to accurately simulate */
|
|
993
984
|
reader.addEventListener('error', function () {
|
|
994
985
|
reject(reader.error);
|
|
995
986
|
});
|
|
@@ -1045,6 +1036,7 @@ const filelist = {
|
|
|
1045
1036
|
}
|
|
1046
1037
|
}
|
|
1047
1038
|
|
|
1039
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
1048
1040
|
// @ts-ignore Override API
|
|
1049
1041
|
return new FileList(o);
|
|
1050
1042
|
}
|
|
@@ -1146,7 +1138,7 @@ const imagebitmap = {
|
|
|
1146
1138
|
try {
|
|
1147
1139
|
const resp = await createImageBitmap(canvas);
|
|
1148
1140
|
resolve(resp);
|
|
1149
|
-
/* c8 ignore next 3 */
|
|
1141
|
+
/* c8 ignore next 3 -- How to simulate? */
|
|
1150
1142
|
} catch (err) {
|
|
1151
1143
|
reject(err);
|
|
1152
1144
|
}
|
|
@@ -1410,10 +1402,7 @@ const primitiveObjects = {
|
|
|
1410
1402
|
if (n === '-Infinity') {
|
|
1411
1403
|
return new Number(-Infinity);
|
|
1412
1404
|
}
|
|
1413
|
-
|
|
1414
|
-
return new Number(-0);
|
|
1415
|
-
}
|
|
1416
|
-
return new Number(n);
|
|
1405
|
+
return new Number(n === '-0' ? -0 : n);
|
|
1417
1406
|
}
|
|
1418
1407
|
}
|
|
1419
1408
|
};
|
|
@@ -1648,11 +1637,11 @@ if (typeof Int8Array === 'function') {
|
|
|
1648
1637
|
Float64Array,
|
|
1649
1638
|
...(typeof BigInt64Array === 'function'
|
|
1650
1639
|
? [BigInt64Array, BigUint64Array]
|
|
1651
|
-
/* c8 ignore next */
|
|
1640
|
+
/* c8 ignore next -- Later support */
|
|
1652
1641
|
: []),
|
|
1653
1642
|
...(typeof Float16Array === 'function'
|
|
1654
1643
|
? [Float16Array]
|
|
1655
|
-
/* c8 ignore next */
|
|
1644
|
+
/* c8 ignore next -- Later support */
|
|
1656
1645
|
: [])
|
|
1657
1646
|
].forEach((TypedArray) => create$1(TypedArray));
|
|
1658
1647
|
}
|
|
@@ -1756,11 +1745,11 @@ if (typeof Int8Array === 'function') {
|
|
|
1756
1745
|
Float64Array,
|
|
1757
1746
|
...(typeof BigInt64Array === 'function'
|
|
1758
1747
|
? [BigInt64Array, BigUint64Array]
|
|
1759
|
-
/* c8 ignore next */
|
|
1748
|
+
/* c8 ignore next -- Later support */
|
|
1760
1749
|
: []),
|
|
1761
1750
|
...(typeof Float16Array === 'function'
|
|
1762
1751
|
? [Float16Array]
|
|
1763
|
-
/* c8 ignore next */
|
|
1752
|
+
/* c8 ignore next -- Later support */
|
|
1764
1753
|
: [])
|
|
1765
1754
|
].forEach((TypedArray) => create(TypedArray));
|
|
1766
1755
|
}
|
|
@@ -2014,20 +2003,20 @@ const expObj$1 = [
|
|
|
2014
2003
|
date, error, errors, regexp
|
|
2015
2004
|
].concat(
|
|
2016
2005
|
// ES2015 (ES6)
|
|
2017
|
-
/* c8 ignore next */
|
|
2006
|
+
/* c8 ignore next -- ES6+ */
|
|
2018
2007
|
typeof Map === 'function' ? map : [],
|
|
2019
|
-
/* c8 ignore next */
|
|
2008
|
+
/* c8 ignore next -- ES6+ */
|
|
2020
2009
|
typeof Set === 'function' ? set : [],
|
|
2021
|
-
/* c8 ignore next */
|
|
2010
|
+
/* c8 ignore next -- Later support */
|
|
2022
2011
|
typeof ArrayBuffer === 'function' ? arraybuffer : [],
|
|
2023
|
-
/* c8 ignore next */
|
|
2012
|
+
/* c8 ignore next -- Later support */
|
|
2024
2013
|
typeof Uint8Array === 'function' ? typedArrays : [],
|
|
2025
|
-
/* c8 ignore next */
|
|
2014
|
+
/* c8 ignore next -- Later support */
|
|
2026
2015
|
typeof DataView === 'function' ? dataview : [],
|
|
2027
|
-
/* c8 ignore next */
|
|
2016
|
+
/* c8 ignore next -- Later support */
|
|
2028
2017
|
typeof Intl !== 'undefined' ? intlTypes : [],
|
|
2029
2018
|
|
|
2030
|
-
/* c8 ignore next */
|
|
2019
|
+
/* c8 ignore next -- Later support */
|
|
2031
2020
|
typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []
|
|
2032
2021
|
);
|
|
2033
2022
|
|
|
@@ -2117,41 +2106,41 @@ const expObj = [
|
|
|
2117
2106
|
errors
|
|
2118
2107
|
].concat(
|
|
2119
2108
|
// ES2015 (ES6)
|
|
2120
|
-
/* c8 ignore next */
|
|
2109
|
+
/* c8 ignore next -- ES6+ */
|
|
2121
2110
|
typeof Map === 'function' ? map : [],
|
|
2122
|
-
/* c8 ignore next */
|
|
2111
|
+
/* c8 ignore next -- ES6+ */
|
|
2123
2112
|
typeof Set === 'function' ? set : [],
|
|
2124
|
-
/* c8 ignore next */
|
|
2113
|
+
/* c8 ignore next -- Later support */
|
|
2125
2114
|
typeof ArrayBuffer === 'function' ? arraybuffer : [],
|
|
2126
|
-
/* c8 ignore next */
|
|
2115
|
+
/* c8 ignore next -- Later support */
|
|
2127
2116
|
typeof Uint8Array === 'function' ? typedArrays : [],
|
|
2128
|
-
/* c8 ignore next */
|
|
2117
|
+
/* c8 ignore next -- Later support */
|
|
2129
2118
|
typeof DataView === 'function' ? dataview : [],
|
|
2130
|
-
/* c8 ignore next */
|
|
2119
|
+
/* c8 ignore next -- Later support */
|
|
2131
2120
|
typeof crypto !== 'undefined' ? cryptokey : [],
|
|
2132
|
-
/* c8 ignore next */
|
|
2121
|
+
/* c8 ignore next -- Later support */
|
|
2133
2122
|
typeof BigInt !== 'undefined' ? [bigint, bigintObject] : [],
|
|
2134
|
-
/* c8 ignore next */
|
|
2123
|
+
/* c8 ignore next -- Later support */
|
|
2135
2124
|
typeof DOMException !== 'undefined' ? domexception : [],
|
|
2136
|
-
/* c8 ignore next */
|
|
2125
|
+
/* c8 ignore next -- Later support */
|
|
2137
2126
|
typeof QuotaExceededError !== 'undefined' ? quotaexceedederror : [],
|
|
2138
|
-
/* c8 ignore next */
|
|
2127
|
+
/* c8 ignore next -- Later support */
|
|
2139
2128
|
typeof WebTransportError !== 'undefined' ? webtransporterror : [],
|
|
2140
|
-
/* c8 ignore next */
|
|
2129
|
+
/* c8 ignore next -- Later support */
|
|
2141
2130
|
typeof DOMRect !== 'undefined' ? domrect : [],
|
|
2142
|
-
/* c8 ignore next */
|
|
2131
|
+
/* c8 ignore next -- Later support */
|
|
2143
2132
|
typeof DOMPoint !== 'undefined' ? dompoint : [],
|
|
2144
|
-
/* c8 ignore next */
|
|
2133
|
+
/* c8 ignore next -- Later support */
|
|
2145
2134
|
typeof DOMQuad !== 'undefined' ? domquad : [],
|
|
2146
|
-
/* c8 ignore next */
|
|
2135
|
+
/* c8 ignore next -- Later support */
|
|
2147
2136
|
typeof DOMMatrix !== 'undefined' ? dommatrix : [],
|
|
2148
|
-
/* c8 ignore next */
|
|
2137
|
+
/* c8 ignore next -- Later support */
|
|
2149
2138
|
typeof AudioData !== 'undefined' ? audiodata : [],
|
|
2150
|
-
/* c8 ignore next */
|
|
2139
|
+
/* c8 ignore next -- Later support */
|
|
2151
2140
|
typeof EncodedAudioChunk !== 'undefined' ? encodedaudiochunk : [],
|
|
2152
|
-
/* c8 ignore next */
|
|
2141
|
+
/* c8 ignore next -- Later support */
|
|
2153
2142
|
typeof EncodedVideoChunk !== 'undefined' ? encodedvideochunk : [],
|
|
2154
|
-
/* c8 ignore next */
|
|
2143
|
+
/* c8 ignore next -- Later support */
|
|
2155
2144
|
typeof VideoFrame !== 'undefined' ? videoframe : []
|
|
2156
2145
|
);
|
|
2157
2146
|
|