typeson-registry 14.2.1 → 14.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.
package/dist/index.d.ts CHANGED
@@ -47,9 +47,10 @@ import postmessage from './presets/postmessage.js';
47
47
  import socketio from './presets/socketio.js';
48
48
  import sparseUndefined from './presets/sparse-undefined.js';
49
49
  import specialNumbers from './presets/special-numbers.js';
50
+ import structuredCloningForStorage from './presets/structured-cloning-for-storage.js';
50
51
  import structuredCloningThrowing from './presets/structured-cloning-throwing.js';
51
52
  import structuredCloning from './presets/structured-cloning.js';
52
53
  import undefPreset from './presets/undef.js';
53
54
  import universal from './presets/universal.js';
54
- export { arraybuffer, audiodata, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, file, filelist, 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, structuredCloningThrowing, structuredCloning, undefPreset, universal };
55
+ export { arraybuffer, audiodata, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, file, filelist, 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 };
55
56
  //# 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;wBAClB,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;sCAErD,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;wBAClB,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"}
package/dist/index.js CHANGED
@@ -2114,8 +2114,25 @@ const structuredCloningThrowing = expObj.concat({
2114
2114
  // HTML-SPECIFIC
2115
2115
  'Event',
2116
2116
  // Also in Node `worker_threads` (currently experimental)
2117
- 'MessageChannel'
2117
+ 'MessageChannel',
2118
+ 'MessagePort'
2118
2119
  ].includes(stringTag) ||
2120
+ // Node's native `worker_threads` `MessageChannel`/
2121
+ // `MessagePort` don't set `Symbol.toStringTag` per
2122
+ // https://github.com/nodejs/node/issues/65527
2123
+ // (verified directly:
2124
+ // `{}.toString.call(new MessageChannel())` is
2125
+ // `"[object Object]"`, and `.port1`'s is
2126
+ // `"[object EventTarget]"`, its own base class), so the
2127
+ // `stringTag` check above can't catch them there; a real
2128
+ // browser's `MessagePort`/`MessageChannel` already match
2129
+ // via `stringTag` (or, for `MessagePort`, would need its
2130
+ // own `stringTag` entry if ever seen failing to match) --
2131
+ // this is purely a fallback for environments (like Node)
2132
+ // that don't set the tag.
2133
+ (val && val.constructor && [
2134
+ 'MessageChannel', 'MessagePort'
2135
+ ].includes(val.constructor.name)) ||
2119
2136
  // 1. `IsDetachedBuffer` (a process not called within the
2120
2137
  // ECMAScript spec)
2121
2138
  ([
@@ -2153,6 +2170,29 @@ const structuredCloningThrowing = expObj.concat({
2153
2170
  }
2154
2171
  });
2155
2172
 
2173
+ /**
2174
+ * @type {import('typeson').Preset}
2175
+ */
2176
+ const structuredCloningForStorage = structuredCloningThrowing.concat({
2177
+ checkSharedArrayBufferException: {
2178
+ test (val) {
2179
+ // Per https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer ,
2180
+ // `SharedArrayBuffer` is a structured-cloneable *transferable*
2181
+ // type only for `postMessage`-style contexts (with
2182
+ // `crossOriginIsolated`); storage-oriented consumers of the
2183
+ // structured clone algorithm (e.g. IndexedDB) reject it
2184
+ // outright instead, so this isn't part of the more general
2185
+ // `structuredCloningThrowing` preset this one builds on.
2186
+ if (({}.toString.call(val).slice(8, -1)) === 'SharedArrayBuffer') {
2187
+ throw new DOMException(
2188
+ 'The object cannot be cloned.', 'DataCloneError'
2189
+ );
2190
+ }
2191
+ return false;
2192
+ }
2193
+ }
2194
+ });
2195
+
2156
2196
  /**
2157
2197
  * @type {import('typeson').Preset}
2158
2198
  */
@@ -2170,5 +2210,5 @@ const universal = [
2170
2210
  // built-in into ecmasript standard.
2171
2211
  ];
2172
2212
 
2173
- export { i$1 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, hasConstructorOf, 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, structuredCloningThrowing, symbol, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject, videoframe, webtransporterror };
2213
+ export { i$1 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, hasConstructorOf, 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 };
2174
2214
  //# sourceMappingURL=index.js.map