typeson-registry 13.2.1 → 14.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.
Files changed (97) hide show
  1. package/README.md +14 -2
  2. package/dist/index.d.cts +3 -0
  3. package/dist/index.d.cts.map +1 -0
  4. package/dist/index.d.ts +6 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +165 -4
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.min.js +2 -2
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/index.umd.cjs +248 -3
  11. package/dist/index.umd.cjs.map +1 -1
  12. package/dist/index.umd.min.cjs +2 -2
  13. package/dist/index.umd.min.cjs.map +1 -1
  14. package/dist/polyfills/AudioData.d.ts +70 -0
  15. package/dist/polyfills/AudioData.d.ts.map +1 -0
  16. package/dist/polyfills/DOMMatrix.d.ts +43 -0
  17. package/dist/polyfills/DOMMatrix.d.ts.map +1 -0
  18. package/dist/polyfills/DOMMatrixReadOnly.d.ts +43 -0
  19. package/dist/polyfills/DOMMatrixReadOnly.d.ts.map +1 -0
  20. package/dist/polyfills/DOMPoint.d.ts +21 -0
  21. package/dist/polyfills/DOMPoint.d.ts.map +1 -0
  22. package/dist/polyfills/DOMPointReadOnly.d.ts +21 -0
  23. package/dist/polyfills/DOMPointReadOnly.d.ts.map +1 -0
  24. package/dist/polyfills/DOMQuad.d.ts +22 -0
  25. package/dist/polyfills/DOMQuad.d.ts.map +1 -0
  26. package/dist/polyfills/DOMRect.d.ts +25 -0
  27. package/dist/polyfills/DOMRect.d.ts.map +1 -0
  28. package/dist/polyfills/DOMRectReadOnly.d.ts +25 -0
  29. package/dist/polyfills/DOMRectReadOnly.d.ts.map +1 -0
  30. package/dist/polyfills/EncodedAudioChunk.d.ts +40 -0
  31. package/dist/polyfills/EncodedAudioChunk.d.ts.map +1 -0
  32. package/dist/polyfills/EncodedVideoChunk.d.ts +40 -0
  33. package/dist/polyfills/EncodedVideoChunk.d.ts.map +1 -0
  34. package/dist/polyfills/FileList.d.ts +21 -0
  35. package/dist/polyfills/FileList.d.ts.map +1 -0
  36. package/dist/polyfills/QuotaExceededError.d.ts +28 -0
  37. package/dist/polyfills/QuotaExceededError.d.ts.map +1 -0
  38. package/dist/polyfills/URL.d.ts +25 -0
  39. package/dist/polyfills/URL.d.ts.map +1 -0
  40. package/dist/polyfills/VideoFrame.d.ts +142 -0
  41. package/dist/polyfills/VideoFrame.d.ts.map +1 -0
  42. package/dist/polyfills/WebTransportError.d.ts +32 -0
  43. package/dist/polyfills/WebTransportError.d.ts.map +1 -0
  44. package/dist/polyfills/createImageBitmap.d.ts +14 -0
  45. package/dist/polyfills/createImageBitmap.d.ts.map +1 -0
  46. package/dist/polyfills/index.d.cts +3 -0
  47. package/dist/polyfills/index.d.cts.map +1 -0
  48. package/dist/polyfills/index.d.ts +16 -0
  49. package/dist/polyfills/index.d.ts.map +1 -0
  50. package/dist/presets/postmessage.d.ts.map +1 -1
  51. package/dist/presets/postmessage.umd.cjs.map +1 -1
  52. package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
  53. package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
  54. package/dist/presets/structured-cloning.d.ts.map +1 -1
  55. package/dist/presets/structured-cloning.umd.cjs +1 -1
  56. package/dist/presets/structured-cloning.umd.cjs.map +1 -1
  57. package/dist/types/encodedaudiochunk.d.ts +6 -0
  58. package/dist/types/encodedaudiochunk.d.ts.map +1 -0
  59. package/dist/types/encodedaudiochunk.umd.cjs +2 -0
  60. package/dist/types/encodedaudiochunk.umd.cjs.map +1 -0
  61. package/dist/types/encodedvideochunk.d.ts +6 -0
  62. package/dist/types/encodedvideochunk.d.ts.map +1 -0
  63. package/dist/types/encodedvideochunk.umd.cjs +2 -0
  64. package/dist/types/encodedvideochunk.umd.cjs.map +1 -0
  65. package/dist/types/quotaexceedederror.d.ts +6 -0
  66. package/dist/types/quotaexceedederror.d.ts.map +1 -0
  67. package/dist/types/quotaexceedederror.umd.cjs +2 -0
  68. package/dist/types/quotaexceedederror.umd.cjs.map +1 -0
  69. package/dist/types/videoframe.d.ts +6 -0
  70. package/dist/types/videoframe.d.ts.map +1 -0
  71. package/dist/types/videoframe.umd.cjs +4 -0
  72. package/dist/types/videoframe.umd.cjs.map +1 -0
  73. package/dist/types/webtransporterror.d.ts +6 -0
  74. package/dist/types/webtransporterror.d.ts.map +1 -0
  75. package/dist/types/webtransporterror.umd.cjs +2 -0
  76. package/dist/types/webtransporterror.umd.cjs.map +1 -0
  77. package/package.json +16 -8
  78. package/polyfills/AudioData.js +173 -0
  79. package/polyfills/DOMMatrix.js +55 -0
  80. package/polyfills/DOMMatrixReadOnly.js +55 -0
  81. package/polyfills/DOMPoint.js +29 -0
  82. package/polyfills/DOMPointReadOnly.js +30 -0
  83. package/polyfills/DOMQuad.js +31 -0
  84. package/polyfills/DOMRect.js +31 -0
  85. package/polyfills/DOMRectReadOnly.js +31 -0
  86. package/polyfills/EncodedAudioChunk.js +74 -0
  87. package/polyfills/EncodedVideoChunk.js +74 -0
  88. package/polyfills/FileList.js +51 -0
  89. package/polyfills/QuotaExceededError.js +53 -0
  90. package/polyfills/VideoFrame.js +350 -0
  91. package/polyfills/WebTransportError.js +44 -0
  92. package/polyfills/createImageBitmap.js +22 -0
  93. package/polyfills/{createObjectURL.cjs → index.cjs} +1474 -4
  94. package/polyfills/index.cjs.map +1 -0
  95. package/polyfills/index.js +15 -0
  96. package/polyfills/createObjectURL.cjs.map +0 -1
  97. /package/polyfills/{createObjectURL.js → URL.js} +0 -0
@@ -1769,6 +1769,84 @@
1769
1769
  };
1770
1770
  }
1771
1771
 
1772
+ /* globals EncodedAudioChunk -- Polyfills */
1773
+
1774
+ /**
1775
+ * @type {import('typeson').TypeSpecSet}
1776
+ */
1777
+ var encodedaudiochunk = {
1778
+ encodedaudiochunk: {
1779
+ test: function test(x) {
1780
+ return toStringTag(x) === 'EncodedAudioChunk';
1781
+ },
1782
+ replace: function replace(chunk) {
1783
+ var type = chunk.type,
1784
+ timestamp = chunk.timestamp,
1785
+ duration = chunk.duration,
1786
+ byteLength = chunk.byteLength;
1787
+ var data = new ArrayBuffer(byteLength);
1788
+ chunk.copyTo(data);
1789
+ return {
1790
+ type: type,
1791
+ timestamp: timestamp,
1792
+ duration: duration,
1793
+ data: data
1794
+ };
1795
+ },
1796
+ revive: function revive(_ref) {
1797
+ var type = _ref.type,
1798
+ timestamp = _ref.timestamp,
1799
+ duration = _ref.duration,
1800
+ data = _ref.data;
1801
+ return new EncodedAudioChunk({
1802
+ type: type,
1803
+ timestamp: timestamp,
1804
+ duration: duration,
1805
+ data: new Uint8Array(data)
1806
+ });
1807
+ }
1808
+ }
1809
+ };
1810
+
1811
+ /* globals EncodedVideoChunk -- Polyfills */
1812
+
1813
+ /**
1814
+ * @type {import('typeson').TypeSpecSet}
1815
+ */
1816
+ var encodedvideochunk = {
1817
+ encodedvideochunk: {
1818
+ test: function test(x) {
1819
+ return toStringTag(x) === 'EncodedVideoChunk';
1820
+ },
1821
+ replace: function replace(chunk) {
1822
+ var type = chunk.type,
1823
+ timestamp = chunk.timestamp,
1824
+ duration = chunk.duration,
1825
+ byteLength = chunk.byteLength;
1826
+ var data = new ArrayBuffer(byteLength);
1827
+ chunk.copyTo(data);
1828
+ return {
1829
+ type: type,
1830
+ timestamp: timestamp,
1831
+ duration: duration,
1832
+ data: data
1833
+ };
1834
+ },
1835
+ revive: function revive(_ref) {
1836
+ var type = _ref.type,
1837
+ timestamp = _ref.timestamp,
1838
+ duration = _ref.duration,
1839
+ data = _ref.data;
1840
+ return new EncodedVideoChunk({
1841
+ type: type,
1842
+ timestamp: timestamp,
1843
+ duration: duration,
1844
+ data: new Uint8Array(data)
1845
+ });
1846
+ }
1847
+ }
1848
+ };
1849
+
1772
1850
  /**
1773
1851
  * @type {import('typeson').TypeSpecSet}
1774
1852
  */
@@ -2401,6 +2479,41 @@
2401
2479
  }
2402
2480
  };
2403
2481
 
2482
+ /**
2483
+ * @type {import('typeson').TypeSpecSet}
2484
+ */
2485
+ var quotaexceedederror = {
2486
+ quotaexceedederror: {
2487
+ test: function test(x) {
2488
+ return toStringTag(x) === 'QuotaExceededError';
2489
+ },
2490
+ replace: function replace(_ref) {
2491
+ var message = _ref.message,
2492
+ quota = _ref.quota,
2493
+ requested = _ref.requested;
2494
+ return {
2495
+ message: message,
2496
+ quota: quota,
2497
+ requested: requested
2498
+ };
2499
+ },
2500
+ revive: function revive(_ref2) {
2501
+ var message = _ref2.message,
2502
+ quota = _ref2.quota,
2503
+ requested = _ref2.requested;
2504
+ /** @type {{quota?: number, requested?: number}} */
2505
+ var options = {};
2506
+ if (quota !== null && quota !== undefined) {
2507
+ options.quota = quota;
2508
+ }
2509
+ if (requested !== null && requested !== undefined) {
2510
+ options.requested = requested;
2511
+ }
2512
+ return new QuotaExceededError(message, options);
2513
+ }
2514
+ }
2515
+ };
2516
+
2404
2517
  /**
2405
2518
  * @type {import('typeson').TypeSpecSet}
2406
2519
  */
@@ -2668,6 +2781,127 @@
2668
2781
  }
2669
2782
  };
2670
2783
 
2784
+ /**
2785
+ * @type {import('typeson').TypeSpecSet}
2786
+ */
2787
+ var videoframe = {
2788
+ videoframe: {
2789
+ test: function test(x) {
2790
+ return toStringTag(x) === 'VideoFrame';
2791
+ },
2792
+ replaceAsync: function replaceAsync(frame) {
2793
+ return new TypesonPromise(/*#__PURE__*/function () {
2794
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(resolve, reject) {
2795
+ var format, codedWidth, codedHeight, timestamp, duration, visibleRect, displayWidth, displayHeight, colorSpace, data, _t;
2796
+ return _regenerator().w(function (_context) {
2797
+ while (1) switch (_context.p = _context.n) {
2798
+ case 0:
2799
+ _context.p = 0;
2800
+ format = frame.format, codedWidth = frame.codedWidth, codedHeight = frame.codedHeight, timestamp = frame.timestamp, duration = frame.duration, visibleRect = frame.visibleRect, displayWidth = frame.displayWidth, displayHeight = frame.displayHeight, colorSpace = frame.colorSpace;
2801
+ data = new ArrayBuffer(frame.allocationSize());
2802
+ _context.n = 1;
2803
+ return frame.copyTo(data);
2804
+ case 1:
2805
+ resolve({
2806
+ format: format,
2807
+ codedWidth: codedWidth,
2808
+ codedHeight: codedHeight,
2809
+ timestamp: timestamp,
2810
+ duration: duration,
2811
+ visibleRect: {
2812
+ x: visibleRect.x,
2813
+ y: visibleRect.y,
2814
+ width: visibleRect.width,
2815
+ height: visibleRect.height
2816
+ },
2817
+ displayWidth: displayWidth,
2818
+ displayHeight: displayHeight,
2819
+ colorSpace: {
2820
+ primaries: colorSpace.primaries,
2821
+ transfer: colorSpace.transfer,
2822
+ matrix: colorSpace.matrix,
2823
+ fullRange: colorSpace.fullRange
2824
+ },
2825
+ data: data
2826
+ });
2827
+ /* c8 ignore next 3 -- How to simulate? */
2828
+ _context.n = 3;
2829
+ break;
2830
+ case 2:
2831
+ _context.p = 2;
2832
+ _t = _context.v;
2833
+ reject(_t);
2834
+ case 3:
2835
+ return _context.a(2);
2836
+ }
2837
+ }, _callee, null, [[0, 2]]);
2838
+ }));
2839
+ return function (_x, _x2) {
2840
+ return _ref.apply(this, arguments);
2841
+ };
2842
+ }());
2843
+ },
2844
+ revive: function revive(_ref2) {
2845
+ var format = _ref2.format,
2846
+ codedWidth = _ref2.codedWidth,
2847
+ codedHeight = _ref2.codedHeight,
2848
+ timestamp = _ref2.timestamp,
2849
+ duration = _ref2.duration,
2850
+ visibleRect = _ref2.visibleRect,
2851
+ displayWidth = _ref2.displayWidth,
2852
+ displayHeight = _ref2.displayHeight,
2853
+ colorSpace = _ref2.colorSpace,
2854
+ data = _ref2.data;
2855
+ return new VideoFrame(new Uint8Array(data), {
2856
+ format: format,
2857
+ codedWidth: codedWidth,
2858
+ codedHeight: codedHeight,
2859
+ timestamp: timestamp,
2860
+ duration: duration,
2861
+ visibleRect: visibleRect,
2862
+ displayWidth: displayWidth,
2863
+ displayHeight: displayHeight,
2864
+ colorSpace: colorSpace
2865
+ });
2866
+ }
2867
+ }
2868
+ };
2869
+
2870
+ /* globals WebTransportError -- Newer API */
2871
+
2872
+ /**
2873
+ * @type {import('typeson').TypeSpecSet}
2874
+ */
2875
+ var webtransporterror = {
2876
+ webtransporterror: {
2877
+ test: function test(x) {
2878
+ return toStringTag(x) === 'WebTransportError';
2879
+ },
2880
+ // Note that we can't support the `source` property (defaults
2881
+ // to `stream` instead of `session`)
2882
+ replace: function replace(_ref) {
2883
+ var message = _ref.message,
2884
+ streamErrorCode = _ref.streamErrorCode;
2885
+ return {
2886
+ message: message,
2887
+ streamErrorCode: streamErrorCode
2888
+ };
2889
+ },
2890
+ revive: function revive(_ref2) {
2891
+ var message = _ref2.message,
2892
+ streamErrorCode = _ref2.streamErrorCode;
2893
+ // TS lib still models the older two-argument
2894
+ // `(message, options)` form; browsers implement a single
2895
+ // `init` object (which also carries `message`).
2896
+ // @ts-expect-error - More recent API
2897
+ return new WebTransportError({
2898
+ message: message,
2899
+ streamErrorCode: streamErrorCode
2900
+ });
2901
+ }
2902
+ }
2903
+ };
2904
+
2671
2905
  /**
2672
2906
  * @type {import('typeson').Preset}
2673
2907
  */
@@ -2783,8 +3017,9 @@
2783
3017
  DOM types. Therefore, only types that are not included in the structured clone
2784
3018
  algorithm need to be registered, which is:
2785
3019
 
2786
- * Error
2787
- * Specific Errors like SyntaxError, TypeError, etc.
3020
+ * Error (now included in structured cloning)
3021
+ * Specific Errors like SyntaxError, TypeError, etc. (now included in structured
3022
+ * cloning)
2788
3023
  * Any custom type you want to send across window- or worker boundraries
2789
3024
 
2790
3025
  This preset will only include the Error types and you can register your
@@ -2862,11 +3097,16 @@
2862
3097
  typeof crypto !== 'undefined' ? cryptokey : [], /* c8 ignore next */
2863
3098
  typeof BigInt !== 'undefined' ? [bigint, bigintObject] : [], /* c8 ignore next */
2864
3099
  typeof DOMException !== 'undefined' ? domexception : [], /* c8 ignore next */
3100
+ typeof QuotaExceededError !== 'undefined' ? quotaexceedederror : [], /* c8 ignore next */
3101
+ typeof WebTransportError !== 'undefined' ? webtransporterror : [], /* c8 ignore next */
2865
3102
  typeof DOMRect !== 'undefined' ? domrect : [], /* c8 ignore next */
2866
3103
  typeof DOMPoint !== 'undefined' ? dompoint : [], /* c8 ignore next */
2867
3104
  typeof DOMQuad !== 'undefined' ? domquad : [], /* c8 ignore next */
2868
3105
  typeof DOMMatrix !== 'undefined' ? dommatrix : [], /* c8 ignore next */
2869
- typeof AudioData !== 'undefined' ? audiodata : []);
3106
+ typeof AudioData !== 'undefined' ? audiodata : [], /* c8 ignore next */
3107
+ typeof EncodedAudioChunk !== 'undefined' ? encodedaudiochunk : [], /* c8 ignore next */
3108
+ typeof EncodedVideoChunk !== 'undefined' ? encodedvideochunk : [], /* c8 ignore next */
3109
+ typeof VideoFrame !== 'undefined' ? videoframe : []);
2870
3110
 
2871
3111
  /**
2872
3112
  * @param {BufferSource} buffer
@@ -2995,6 +3235,8 @@
2995
3235
  exports.dompoint = dompoint;
2996
3236
  exports.domquad = domquad;
2997
3237
  exports.domrect = domrect;
3238
+ exports.encodedaudiochunk = encodedaudiochunk;
3239
+ exports.encodedvideochunk = encodedvideochunk;
2998
3240
  exports.error = error;
2999
3241
  exports.errors = errors;
3000
3242
  exports.escapeKeyPathComponent = escapeKeyPathComponent;
@@ -3019,6 +3261,7 @@
3019
3261
  exports.postmessage = postmessage;
3020
3262
  exports.primitiveObjects = primitiveObjects;
3021
3263
  exports.promise = promise;
3264
+ exports.quotaexceedederror = quotaexceedederror;
3022
3265
  exports.regexp = regexp;
3023
3266
  exports.resurrectable = resurrectable;
3024
3267
  exports.set = set;
@@ -3037,6 +3280,8 @@
3037
3280
  exports.unescapeKeyPathComponent = unescapeKeyPathComponent;
3038
3281
  exports.universal = universal;
3039
3282
  exports.userObject = userObject;
3283
+ exports.videoframe = videoframe;
3284
+ exports.webtransporterror = webtransporterror;
3040
3285
 
3041
3286
  }));
3042
3287
  //# sourceMappingURL=index.umd.cjs.map