typeson-registry 13.2.0 → 13.2.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.
@@ -2040,7 +2040,7 @@
2040
2040
  return 'FileList';
2041
2041
  }
2042
2042
  }]);
2043
- }();
2043
+ }(); // @ts-ignore Override API
2044
2044
  return new FileList(o);
2045
2045
  }
2046
2046
  }
@@ -2868,6 +2868,33 @@
2868
2868
  typeof DOMMatrix !== 'undefined' ? dommatrix : [], /* c8 ignore next */
2869
2869
  typeof AudioData !== 'undefined' ? audiodata : []);
2870
2870
 
2871
+ /**
2872
+ * @param {BufferSource} buffer
2873
+ * @returns {boolean}
2874
+ */
2875
+ function isBufferDetached(buffer) {
2876
+ // Use the standard property if available
2877
+ // @ts-expect-error - More recent API
2878
+ if (typeof buffer.detached === 'boolean') {
2879
+ // @ts-expect-error - More recent API
2880
+ return buffer.detached;
2881
+ }
2882
+ /* c8 ignore next 14 -- Older browsers */
2883
+
2884
+ // Fallback check via byteLength and constructor test
2885
+ if (buffer.byteLength !== 0) {
2886
+ return false;
2887
+ }
2888
+ try {
2889
+ // @ts-expect-error Ok
2890
+ // eslint-disable-next-line no-new -- Throwaway
2891
+ new Uint8Array(buffer);
2892
+ return false;
2893
+ } catch (_unused) {
2894
+ return true;
2895
+ }
2896
+ }
2897
+
2871
2898
  /**
2872
2899
  * @type {import('typeson').Preset}
2873
2900
  */
@@ -2875,13 +2902,11 @@
2875
2902
  checkDataCloneException: {
2876
2903
  test: function test(val) {
2877
2904
  // Should also throw with:
2878
- // 1. `IsDetachedBuffer` (a process not called within the
2879
- // ECMAScript spec)
2880
- // 2. `IsCallable` (covered by `typeof === 'function'` or a
2905
+ // 1. `IsCallable` (covered by `typeof === 'function'` or a
2881
2906
  // function's `toStringTag`)
2882
- // 3. internal slots besides [[Prototype]] or [[Extensible]] (e.g.,
2907
+ // 2. internal slots besides [[Prototype]] or [[Extensible]] (e.g.,
2883
2908
  // [[PromiseState]] or [[WeakMapData]])
2884
- // 4. exotic object (e.g., `Proxy`) (unless an `%ObjectPrototype%`
2909
+ // 3. exotic object (e.g., `Proxy`) (unless an `%ObjectPrototype%`
2885
2910
  // intrinsic object) (which does not have default
2886
2911
  // behavior for one or more of the essential internal methods
2887
2912
  // that are limited to the following for non-function objects
@@ -2917,7 +2942,10 @@
2917
2942
  // HTML-SPECIFIC
2918
2943
  'Event',
2919
2944
  // Also in Node `worker_threads` (currently experimental)
2920
- 'MessageChannel'].includes(stringTag) || (
2945
+ 'MessageChannel'].includes(stringTag) ||
2946
+ // 1. `IsDetachedBuffer` (a process not called within the
2947
+ // ECMAScript spec)
2948
+ ['ArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array'].includes(stringTag) && isBufferDetached(val) || (
2921
2949
  /*
2922
2950
  // isClosed is no longer documented
2923
2951
  ((stringTag === 'Blob' || stringTag === 'File') &&