typeson-registry 14.6.0 → 14.7.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 +101 -19
- 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 +103 -23
- 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/createImageBitmap.d.ts +3 -10
- package/dist/polyfills/createImageBitmap.d.ts.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.d.ts.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/types/imagebitmap.d.ts.map +1 -1
- package/dist/types/imagebitmap.umd.cjs +1 -1
- package/dist/types/imagebitmap.umd.cjs.map +1 -1
- package/dist/types/proto.d.ts +6 -0
- package/dist/types/proto.d.ts.map +1 -0
- package/dist/types/proto.umd.cjs +2 -0
- package/dist/types/proto.umd.cjs.map +1 -0
- package/dist/types/quotaexceedederror.d.ts.map +1 -1
- package/dist/types/quotaexceedederror.umd.cjs +1 -1
- package/dist/types/quotaexceedederror.umd.cjs.map +1 -1
- package/dist/types/webtransporterror.d.ts.map +1 -1
- package/dist/types/webtransporterror.umd.cjs +1 -1
- package/dist/types/webtransporterror.umd.cjs.map +1 -1
- package/package.json +25 -22
- package/polyfills/createImageBitmap.js +8 -10
- package/polyfills/index.cjs +7 -9
- package/polyfills/index.cjs.map +1 -1
package/dist/index.js
CHANGED
|
@@ -1072,8 +1072,7 @@ const idbkeyrange = {
|
|
|
1072
1072
|
};
|
|
1073
1073
|
|
|
1074
1074
|
/* globals document, OffscreenCanvas, createImageBitmap -- Polyfills */
|
|
1075
|
-
// `ImageBitmap`
|
|
1076
|
-
// same-domain (or CORS)
|
|
1075
|
+
// `ImageBitmap` can only work same-domain (or CORS) in the browser
|
|
1077
1076
|
|
|
1078
1077
|
|
|
1079
1078
|
/**
|
|
@@ -1082,10 +1081,7 @@ const idbkeyrange = {
|
|
|
1082
1081
|
const imagebitmap = {
|
|
1083
1082
|
imagebitmap: {
|
|
1084
1083
|
test (x) {
|
|
1085
|
-
return toStringTag(x) === 'ImageBitmap'
|
|
1086
|
-
// In Node, our polyfill sets the dataset on a canvas
|
|
1087
|
-
// element as JSDom no longer allows overriding toStringTag
|
|
1088
|
-
(x && x.dataset && x.dataset.toStringTag === 'ImageBitmap');
|
|
1084
|
+
return toStringTag(x) === 'ImageBitmap';
|
|
1089
1085
|
},
|
|
1090
1086
|
replace (bm) {
|
|
1091
1087
|
const canvas = document.createElement('canvas');
|
|
@@ -1099,8 +1095,8 @@ const imagebitmap = {
|
|
|
1099
1095
|
},
|
|
1100
1096
|
revive (o) {
|
|
1101
1097
|
const canvas = typeof OffscreenCanvas === 'undefined'
|
|
1098
|
+
/* c8 ignore next -- Older environments */
|
|
1102
1099
|
? document.createElement('canvas')
|
|
1103
|
-
/* c8 ignore next -- Browser only */
|
|
1104
1100
|
: new OffscreenCanvas(o.width, o.height);
|
|
1105
1101
|
/*
|
|
1106
1102
|
var req = new XMLHttpRequest();
|
|
@@ -1117,14 +1113,19 @@ const imagebitmap = {
|
|
|
1117
1113
|
const img = document.createElement('img');
|
|
1118
1114
|
// The onload is needed by some browsers per https://stackoverflow.com/a/4776378/271577
|
|
1119
1115
|
img.addEventListener('load', function () {
|
|
1120
|
-
|
|
1116
|
+
try {
|
|
1117
|
+
ctx.drawImage(img, 0, 0);
|
|
1118
|
+
} catch {
|
|
1119
|
+
// Issues on Node
|
|
1120
|
+
}
|
|
1121
1121
|
});
|
|
1122
1122
|
img.src = o.dataURL;
|
|
1123
|
+
|
|
1123
1124
|
// Works in contexts allowing an `ImageBitmap` (We might use
|
|
1124
1125
|
// `OffscreenCanvas.transferToBitmap` when supported)
|
|
1125
1126
|
return typeof OffscreenCanvas === 'undefined'
|
|
1127
|
+
/* c8 ignore next 3 -- Older environments */
|
|
1126
1128
|
? canvas
|
|
1127
|
-
/* c8 ignore next 3 -- Browser only */
|
|
1128
1129
|
: /** @type {OffscreenCanvas} */ (
|
|
1129
1130
|
canvas
|
|
1130
1131
|
).transferToImageBitmap();
|
|
@@ -1452,10 +1453,18 @@ const promise = {
|
|
|
1452
1453
|
const quotaexceedederror = {
|
|
1453
1454
|
quotaexceedederror: {
|
|
1454
1455
|
test (x) { return toStringTag(x) === 'QuotaExceededError'; },
|
|
1455
|
-
replace ({
|
|
1456
|
-
|
|
1456
|
+
replace ({
|
|
1457
|
+
message, quota, requested,
|
|
1458
|
+
cause, stack, fileName, lineNumber, columnNumber
|
|
1459
|
+
}) {
|
|
1460
|
+
return {
|
|
1461
|
+
message, quota, requested,
|
|
1462
|
+
cause, stack, fileName, lineNumber, columnNumber
|
|
1463
|
+
};
|
|
1457
1464
|
},
|
|
1458
|
-
revive (
|
|
1465
|
+
revive (obj) {
|
|
1466
|
+
const {message, quota, requested} = obj;
|
|
1467
|
+
|
|
1459
1468
|
/** @type {{quota?: number, requested?: number}} */
|
|
1460
1469
|
const options = {};
|
|
1461
1470
|
if (quota !== null && quota !== undefined) {
|
|
@@ -1464,7 +1473,26 @@ const quotaexceedederror = {
|
|
|
1464
1473
|
if (requested !== null && requested !== undefined) {
|
|
1465
1474
|
options.requested = requested;
|
|
1466
1475
|
}
|
|
1467
|
-
|
|
1476
|
+
const e = /**
|
|
1477
|
+
* @type {{
|
|
1478
|
+
* name: string,
|
|
1479
|
+
* cause: Error,
|
|
1480
|
+
* stack: string,
|
|
1481
|
+
* fileName?: string,
|
|
1482
|
+
* lineNumber?: import('typeson').Integer,
|
|
1483
|
+
* columnNumber?: import('typeson').Integer
|
|
1484
|
+
* }}
|
|
1485
|
+
*/ (
|
|
1486
|
+
new QuotaExceededError(message, options)
|
|
1487
|
+
);
|
|
1488
|
+
|
|
1489
|
+
e.cause = obj.cause;
|
|
1490
|
+
e.stack = obj.stack;
|
|
1491
|
+
e.fileName = obj.fileName;
|
|
1492
|
+
e.lineNumber = obj.lineNumber;
|
|
1493
|
+
e.columnNumber = obj.columnNumber;
|
|
1494
|
+
|
|
1495
|
+
return e;
|
|
1468
1496
|
}
|
|
1469
1497
|
}
|
|
1470
1498
|
};
|
|
@@ -1844,15 +1872,41 @@ const webtransporterror = {
|
|
|
1844
1872
|
test (x) { return toStringTag(x) === 'WebTransportError'; },
|
|
1845
1873
|
// Note that we can't support the `source` property (defaults
|
|
1846
1874
|
// to `stream` instead of `session`)
|
|
1847
|
-
replace ({
|
|
1848
|
-
|
|
1875
|
+
replace ({
|
|
1876
|
+
message, streamErrorCode,
|
|
1877
|
+
cause, stack, fileName, lineNumber, columnNumber
|
|
1878
|
+
}) {
|
|
1879
|
+
return {
|
|
1880
|
+
message, streamErrorCode,
|
|
1881
|
+
cause, stack, fileName, lineNumber, columnNumber
|
|
1882
|
+
};
|
|
1849
1883
|
},
|
|
1850
|
-
revive (
|
|
1884
|
+
revive (obj) {
|
|
1885
|
+
const {message, streamErrorCode} = obj;
|
|
1851
1886
|
// TS lib still models the older two-argument
|
|
1852
1887
|
// `(message, options)` form; browsers implement a single
|
|
1853
1888
|
// `init` object (which also carries `message`).
|
|
1854
|
-
|
|
1855
|
-
|
|
1889
|
+
const e = /**
|
|
1890
|
+
* @type {{
|
|
1891
|
+
* name: string,
|
|
1892
|
+
* cause: Error,
|
|
1893
|
+
* stack: string,
|
|
1894
|
+
* fileName?: string,
|
|
1895
|
+
* lineNumber?: import('typeson').Integer,
|
|
1896
|
+
* columnNumber?: import('typeson').Integer
|
|
1897
|
+
* }}
|
|
1898
|
+
*/ (
|
|
1899
|
+
// @ts-expect-error - More recent API
|
|
1900
|
+
new WebTransportError({message, streamErrorCode})
|
|
1901
|
+
);
|
|
1902
|
+
|
|
1903
|
+
e.cause = obj.cause;
|
|
1904
|
+
e.stack = obj.stack;
|
|
1905
|
+
e.fileName = obj.fileName;
|
|
1906
|
+
e.lineNumber = obj.lineNumber;
|
|
1907
|
+
e.columnNumber = obj.columnNumber;
|
|
1908
|
+
|
|
1909
|
+
return e;
|
|
1856
1910
|
}
|
|
1857
1911
|
}
|
|
1858
1912
|
};
|
|
@@ -2176,12 +2230,40 @@ const structuredCloningThrowing = expObj.concat({
|
|
|
2176
2230
|
// WeakSet instances have an extra slot ([[WeakSetData]])
|
|
2177
2231
|
// but not throwing in Chrome `postMessage`
|
|
2178
2232
|
'WeakSet',
|
|
2233
|
+
// WeakRef instances have an extra slot
|
|
2234
|
+
// ([[WeakRefTarget]])
|
|
2235
|
+
'WeakRef',
|
|
2236
|
+
// FinalizationRegistry instances have extra internal
|
|
2237
|
+
// slots (e.g., [[Cells]])
|
|
2238
|
+
'FinalizationRegistry',
|
|
2239
|
+
// Generator objects have an extra slot
|
|
2240
|
+
// ([[GeneratorState]])
|
|
2241
|
+
'Generator',
|
|
2242
|
+
// Async generator objects have an extra slot
|
|
2243
|
+
// ([[AsyncGeneratorState]])
|
|
2244
|
+
'AsyncGenerator',
|
|
2245
|
+
// Built-in iterator result objects have internal slots
|
|
2246
|
+
// tied to the collection/string being iterated
|
|
2247
|
+
'String Iterator', 'Array Iterator',
|
|
2248
|
+
'Map Iterator', 'Set Iterator', 'RegExp String Iterator',
|
|
2249
|
+
// `Intl` objects (e.g., `Intl.Collator`) all have
|
|
2250
|
+
// internal slots and are not structured-cloneable
|
|
2251
|
+
'Intl.Collator', 'Intl.DateTimeFormat',
|
|
2252
|
+
'Intl.DisplayNames', 'Intl.DurationFormat',
|
|
2253
|
+
'Intl.ListFormat', 'Intl.Locale', 'Intl.NumberFormat',
|
|
2254
|
+
'Intl.PluralRules', 'Intl.RelativeTimeFormat',
|
|
2255
|
+
'Intl.Segmenter',
|
|
2179
2256
|
|
|
2180
2257
|
// HTML-SPECIFIC
|
|
2181
2258
|
'Event',
|
|
2182
2259
|
// Also in Node `worker_threads` (currently experimental)
|
|
2183
2260
|
'MessageChannel',
|
|
2184
|
-
'MessagePort'
|
|
2261
|
+
'MessagePort',
|
|
2262
|
+
// Streams are Transferable but not Serializable, so
|
|
2263
|
+
// cloning them (as opposed to transferring) throws
|
|
2264
|
+
'ReadableStream', 'WritableStream', 'TransformStream',
|
|
2265
|
+
// Also Transferable but not Serializable
|
|
2266
|
+
'OffscreenCanvas'
|
|
2185
2267
|
].includes(stringTag) ||
|
|
2186
2268
|
// Node's native `worker_threads` `MessageChannel`/
|
|
2187
2269
|
// `MessagePort` don't set `Symbol.toStringTag` per
|