typeson-registry 15.1.0 → 15.3.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.
Files changed (34) hide show
  1. package/README.md +6 -1
  2. package/dist/index.d.ts +3 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +107 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/dist/index.umd.cjs +126 -1
  9. package/dist/index.umd.cjs.map +1 -1
  10. package/dist/index.umd.min.cjs +1 -1
  11. package/dist/index.umd.min.cjs.map +1 -1
  12. package/dist/polyfills/GPUPipelineError.d.ts +26 -0
  13. package/dist/polyfills/GPUPipelineError.d.ts.map +1 -0
  14. package/dist/polyfills/index.d.ts +1 -0
  15. package/dist/presets/structured-cloning-for-storage.umd.cjs +1 -1
  16. package/dist/presets/structured-cloning-for-storage.umd.cjs.map +1 -1
  17. package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
  18. package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
  19. package/dist/presets/structured-cloning.d.ts.map +1 -1
  20. package/dist/presets/structured-cloning.umd.cjs +1 -1
  21. package/dist/presets/structured-cloning.umd.cjs.map +1 -1
  22. package/dist/types/gpupipelineerror.d.ts +6 -0
  23. package/dist/types/gpupipelineerror.d.ts.map +1 -0
  24. package/dist/types/gpupipelineerror.umd.cjs +2 -0
  25. package/dist/types/gpupipelineerror.umd.cjs.map +1 -0
  26. package/dist/types/temporal.d.ts +6 -0
  27. package/dist/types/temporal.d.ts.map +1 -0
  28. package/dist/types/temporal.umd.cjs +2 -0
  29. package/dist/types/temporal.umd.cjs.map +1 -0
  30. package/package.json +10 -9
  31. package/polyfills/GPUPipelineError.js +42 -0
  32. package/polyfills/index.cjs +50 -10
  33. package/polyfills/index.cjs.map +1 -1
  34. package/polyfills/index.js +1 -0
package/README.md CHANGED
@@ -33,7 +33,8 @@ URL.createObjectURL = createObjectURL;
33
33
  We have not added `jsdom` as a dependency, but it is required if this
34
34
  polyfill is used.
35
35
 
36
- Also exported: `QuotaExceededError`, `WebTransportError`, `AudioData`, `EncodedAudioChunk`,
36
+ Also exported: `QuotaExceededError`, `WebTransportError`, `GPUPipelineError`,
37
+ `AudioData`, `EncodedAudioChunk`,
37
38
  `EncodedVideoChunk`, `VideoFrame`, `DOMRect`,
38
39
  `DOMRectReadOnly`, `DOMPoint`, `DOMPointReadOnly`, `DOMQuad`, `DOMMatrix`, `DOMMatrixReadOnly`,
39
40
  `createImageBitmap`, `createObjectURL`, `revokeObjectURL`, `xmlHttpRequestOverrideMimeType`
@@ -248,6 +249,8 @@ Note that the type name corresponds to the file name in the following manner:
248
249
  via deprecated means)
249
250
  - `filelist` - HTML does not provide a means of creating a `FileList` object
250
251
  dynamically, so we polyfill one for revival. This method also sets `File`
252
+ - `gpucompilationinfo` and `gpucompilationmessage`
253
+ - `gpupipelineerror`
251
254
  - `imagebitmap` - Has sync and async revivers. If `OffscreenCanvas` is not
252
255
  supported, the sync method does not produce a genuine `ImageBitmap`
253
256
  but instead produces a canvas element which can frequently be used in
@@ -270,6 +273,8 @@ Note that the type name corresponds to the file name in the following manner:
270
273
  only be revived for the current window session.
271
274
  - `set`
272
275
  - `symbol`
276
+ - `temporal` - Requires a global `Temporal` (native or polyfilled) for
277
+ revival; handles all eight `Temporal` classes
273
278
  - `typed-arrays-socketio.js` (`Int8Array`, `Uint8Array`, `Uint8ClampedArray`,
274
279
  `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`,
275
280
  `Float64Array`) - See
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ import file from './types/file.js';
21
21
  import filelist from './types/filelist.js';
22
22
  import gpucompilationinfo from './types/gpucompilationinfo.js';
23
23
  import gpucompilationmessage from './types/gpucompilationmessage.js';
24
+ import gpupipelineerror from './types/gpupipelineerror.js';
24
25
  import idbkeyrange from './types/idbkeyrange.js';
25
26
  import imagebitmap from './types/imagebitmap.js';
26
27
  import imagedata from './types/imagedata.js';
@@ -38,6 +39,7 @@ import regexp from './types/regexp.js';
38
39
  import resurrectable from './types/resurrectable.js';
39
40
  import set from './types/set.js';
40
41
  import symbol from './types/symbol.js';
42
+ import temporal from './types/temporal.js';
41
43
  import typedArraysSocketio from './types/typed-arrays-socketio.js';
42
44
  import typedArrays from './types/typed-arrays.js';
43
45
  import undef from './types/undef.js';
@@ -55,5 +57,5 @@ import structuredCloningThrowing from './presets/structured-cloning-throwing.js'
55
57
  import structuredCloning from './presets/structured-cloning.js';
56
58
  import undefPreset from './presets/undef.js';
57
59
  import universal from './presets/universal.js';
58
- export { arraybuffer, audiodata, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, file, filelist, gpucompilationinfo, gpucompilationmessage, idbkeyrange, imagebitmap, imagedata, infinity, intlTypes, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, symbol, typedArraysSocketio, typedArrays, undef, userObject, videoframe, webtransporterror, arrayNonindexKeys, builtin, postmessage, socketio, sparseUndefined, specialNumbers, structuredCloningForStorage, structuredCloningThrowing, structuredCloning, undefPreset, universal };
60
+ export { arraybuffer, audiodata, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, file, filelist, gpucompilationinfo, gpucompilationmessage, gpupipelineerror, idbkeyrange, imagebitmap, imagedata, infinity, intlTypes, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, symbol, temporal, typedArraysSocketio, typedArrays, undef, userObject, videoframe, webtransporterror, arrayNonindexKeys, builtin, postmessage, socketio, sparseUndefined, specialNumbers, structuredCloningForStorage, structuredCloningThrowing, structuredCloning, undefPreset, universal };
59
61
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";wBAGwB,wBAAwB;sBAC1B,sBAAsB;yBACnB,0BAA0B;mBAChC,mBAAmB;iBACrB,iBAAiB;sBACZ,sBAAsB;sBACtB,sBAAsB;qBACvB,qBAAqB;iBACzB,iBAAiB;yBACT,yBAAyB;sBAC5B,sBAAsB;qBACvB,qBAAqB;oBACtB,oBAAoB;oBACpB,oBAAoB;8BACV,8BAA8B;8BAC9B,8BAA8B;kBAC1C,kBAAkB;mBACjB,mBAAmB;iBACrB,iBAAiB;qBACb,qBAAqB;+BACX,+BAA+B;kCAC5B,kCAAkC;wBAC5C,wBAAwB;wBACxB,wBAAwB;sBAC1B,sBAAsB;qBACvB,qBAAqB;sBACpB,uBAAuB;gBAC7B,gBAAgB;gBAChB,gBAAgB;6BACH,8BAA8B;yBAClC,0BAA0B;6BACtB,8BAA8B;6BAC9B,8BAA8B;oBACvC,oBAAoB;+BACT,+BAA+B;mBAC3C,mBAAmB;0BACZ,0BAA0B;gBACpC,gBAAgB;mBACb,mBAAmB;gCACN,kCAAkC;wBAC1C,yBAAyB;kBAC/B,kBAAkB;uBACb,wBAAwB;uBACxB,uBAAuB;8BAChB,8BAA8B;8BAG9B,kCAAkC;oBAC5C,sBAAsB;wBAClB,0BAA0B;qBAC7B,uBAAuB;4BAChB,+BAA+B;2BAChC,8BAA8B;wCAErD,6CAA6C;sCAE7C,0CAA0C;8BAChB,iCAAiC;wBACvC,oBAAoB;sBACtB,wBAAwB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";wBAGwB,wBAAwB;sBAC1B,sBAAsB;yBACnB,0BAA0B;mBAChC,mBAAmB;iBACrB,iBAAiB;sBACZ,sBAAsB;sBACtB,sBAAsB;qBACvB,qBAAqB;iBACzB,iBAAiB;yBACT,yBAAyB;sBAC5B,sBAAsB;qBACvB,qBAAqB;oBACtB,oBAAoB;oBACpB,oBAAoB;8BACV,8BAA8B;8BAC9B,8BAA8B;kBAC1C,kBAAkB;mBACjB,mBAAmB;iBACrB,iBAAiB;qBACb,qBAAqB;+BACX,+BAA+B;kCAC5B,kCAAkC;6BACvC,6BAA6B;wBAClC,wBAAwB;wBACxB,wBAAwB;sBAC1B,sBAAsB;qBACvB,qBAAqB;sBACpB,uBAAuB;gBAC7B,gBAAgB;gBAChB,gBAAgB;6BACH,8BAA8B;yBAClC,0BAA0B;6BACtB,8BAA8B;6BAC9B,8BAA8B;oBACvC,oBAAoB;+BACT,+BAA+B;mBAC3C,mBAAmB;0BACZ,0BAA0B;gBACpC,gBAAgB;mBACb,mBAAmB;qBACjB,qBAAqB;gCACV,kCAAkC;wBAC1C,yBAAyB;kBAC/B,kBAAkB;uBACb,wBAAwB;uBACxB,uBAAuB;8BAChB,8BAA8B;8BAG9B,kCAAkC;oBAC5C,sBAAsB;wBAClB,0BAA0B;qBAC7B,uBAAuB;4BAChB,+BAA+B;2BAChC,8BAA8B;wCAErD,6CAA6C;sCAE7C,0CAA0C;8BAChB,iCAAiC;wBACvC,oBAAoB;sBACtB,wBAAwB"}
package/dist/index.js CHANGED
@@ -1151,6 +1151,53 @@ const gpucompilationmessage = {
1151
1151
  }
1152
1152
  };
1153
1153
 
1154
+ /* globals GPUPipelineError -- Newer API */
1155
+
1156
+ /**
1157
+ * @type {import('typeson').TypeSpecSet}
1158
+ */
1159
+ const gpupipelineerror = {
1160
+ gpupipelineerror: {
1161
+ test (x) { return toStringTag(x) === 'GPUPipelineError'; },
1162
+ // Note that we can't support the `source` property (defaults
1163
+ // to `stream` instead of `session`)
1164
+ replace ({
1165
+ message, reason,
1166
+ cause, stack, fileName, lineNumber, columnNumber
1167
+ }) {
1168
+ return {
1169
+ message, reason,
1170
+ cause, stack, fileName, lineNumber, columnNumber
1171
+ };
1172
+ },
1173
+ revive (obj) {
1174
+ const {message, reason} = obj;
1175
+ // TS lib still models the older two-argument
1176
+ // `(message, options)` form; browsers implement a single
1177
+ // `init` object (which also carries `message`).
1178
+ const e = /**
1179
+ * @type {{
1180
+ * name: string,
1181
+ * cause: Error,
1182
+ * stack: string,
1183
+ * fileName?: string,
1184
+ * lineNumber?: import('typeson').Integer,
1185
+ * columnNumber?: import('typeson').Integer
1186
+ * }}
1187
+ */
1188
+ (new GPUPipelineError(message, {reason}));
1189
+
1190
+ e.cause = obj.cause;
1191
+ e.stack = obj.stack;
1192
+ e.fileName = obj.fileName;
1193
+ e.lineNumber = obj.lineNumber;
1194
+ e.columnNumber = obj.columnNumber;
1195
+
1196
+ return e;
1197
+ }
1198
+ }
1199
+ };
1200
+
1154
1201
  /* globals IDBKeyRange -- Polyfill needed */
1155
1202
 
1156
1203
 
@@ -1684,6 +1731,62 @@ const symbol = {
1684
1731
  }
1685
1732
  };
1686
1733
 
1734
+ /**
1735
+ * @template {{toJSON: () => string}} T
1736
+ * @param {string} name
1737
+ * @param {(json: string) => T} from
1738
+ * @returns {import('typeson').TypeSpecSet[string]}
1739
+ */
1740
+ const buildSpec = (name, from) => {
1741
+ return {
1742
+ /**
1743
+ * @param {unknown} x
1744
+ * @returns {boolean}
1745
+ */
1746
+ test (x) { return toStringTag(x) === `Temporal.${name}`; },
1747
+ /**
1748
+ * @param {T} t
1749
+ * @returns {string}
1750
+ */
1751
+ replace (t) { return t.toJSON(); },
1752
+ /**
1753
+ * @param {string} json
1754
+ * @returns {T}
1755
+ */
1756
+ revive (json) { return from(json); }
1757
+ };
1758
+ };
1759
+
1760
+ /**
1761
+ * @type {import('typeson').TypeSpecSet}
1762
+ */
1763
+ const temporal = {
1764
+ temporalDuration: buildSpec(
1765
+ 'Duration', (json) => Temporal.Duration.from(json)
1766
+ ),
1767
+ temporalInstant: buildSpec(
1768
+ 'Instant', (json) => Temporal.Instant.from(json)
1769
+ ),
1770
+ temporalPlainDate: buildSpec(
1771
+ 'PlainDate', (json) => Temporal.PlainDate.from(json)
1772
+ ),
1773
+ temporalPlainDateTime: buildSpec(
1774
+ 'PlainDateTime', (json) => Temporal.PlainDateTime.from(json)
1775
+ ),
1776
+ temporalPlainMonthDay: buildSpec(
1777
+ 'PlainMonthDay', (json) => Temporal.PlainMonthDay.from(json)
1778
+ ),
1779
+ temporalPlainTime: buildSpec(
1780
+ 'PlainTime', (json) => Temporal.PlainTime.from(json)
1781
+ ),
1782
+ temporalPlainYearMonth: buildSpec(
1783
+ 'PlainYearMonth', (json) => Temporal.PlainYearMonth.from(json)
1784
+ ),
1785
+ temporalZonedDateTime: buildSpec(
1786
+ 'ZonedDateTime', (json) => Temporal.ZonedDateTime.from(json)
1787
+ )
1788
+ };
1789
+
1687
1790
  // Support all kinds of typed arrays (views of ArrayBuffers)
1688
1791
 
1689
1792
  /**
@@ -2253,7 +2356,9 @@ const expObj = [
2253
2356
  /* c8 ignore next -- Later support */
2254
2357
  typeof GPUCompilationInfo !== 'undefined' ? gpucompilationinfo : [],
2255
2358
  /* c8 ignore next -- Later support */
2256
- typeof GPUCompilationMessage !== 'undefined' ? gpucompilationmessage : []
2359
+ typeof GPUCompilationMessage !== 'undefined' ? gpucompilationmessage : [],
2360
+ /* c8 ignore next -- Later support */
2361
+ typeof GPUPipelineError !== 'undefined' ? gpupipelineerror : []
2257
2362
  );
2258
2363
 
2259
2364
  /**
@@ -2459,5 +2564,5 @@ const universal = [
2459
2564
  // built-in into ecmasript standard.
2460
2565
  ];
2461
2566
 
2462
- export { c as JSON_TYPES, Typeson, TypesonPromise, Undefined, arrayNonindexKeys, arraybuffer, audiodata, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, gpucompilationinfo, gpucompilationmessage, hasConstructorOf, idbkeyrange, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, setAtKeyPath, socketio, sparseUndefined, specialNumbers, expObj as structuredCloning, structuredCloningForStorage, structuredCloningThrowing, symbol, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject, videoframe, webtransporterror };
2567
+ export { c as JSON_TYPES, Typeson, TypesonPromise, Undefined, arrayNonindexKeys, arraybuffer, audiodata, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, gpucompilationinfo, gpucompilationmessage, gpupipelineerror, hasConstructorOf, idbkeyrange, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, setAtKeyPath, socketio, sparseUndefined, specialNumbers, expObj as structuredCloning, structuredCloningForStorage, structuredCloningThrowing, symbol, temporal, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject, videoframe, webtransporterror };
2463
2568
  //# sourceMappingURL=index.js.map