typeson-registry 15.2.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.
package/README.md CHANGED
@@ -250,6 +250,7 @@ Note that the type name corresponds to the file name in the following manner:
250
250
  - `filelist` - HTML does not provide a means of creating a `FileList` object
251
251
  dynamically, so we polyfill one for revival. This method also sets `File`
252
252
  - `gpucompilationinfo` and `gpucompilationmessage`
253
+ - `gpupipelineerror`
253
254
  - `imagebitmap` - Has sync and async revivers. If `OffscreenCanvas` is not
254
255
  supported, the sync method does not produce a genuine `ImageBitmap`
255
256
  but instead produces a canvas element which can frequently be used in
@@ -272,6 +273,8 @@ Note that the type name corresponds to the file name in the following manner:
272
273
  only be revived for the current window session.
273
274
  - `set`
274
275
  - `symbol`
276
+ - `temporal` - Requires a global `Temporal` (native or polyfilled) for
277
+ revival; handles all eight `Temporal` classes
275
278
  - `typed-arrays-socketio.js` (`Int8Array`, `Uint8Array`, `Uint8ClampedArray`,
276
279
  `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`,
277
280
  `Float64Array`) - See
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@ import regexp from './types/regexp.js';
39
39
  import resurrectable from './types/resurrectable.js';
40
40
  import set from './types/set.js';
41
41
  import symbol from './types/symbol.js';
42
+ import temporal from './types/temporal.js';
42
43
  import typedArraysSocketio from './types/typed-arrays-socketio.js';
43
44
  import typedArrays from './types/typed-arrays.js';
44
45
  import undef from './types/undef.js';
@@ -56,5 +57,5 @@ import structuredCloningThrowing from './presets/structured-cloning-throwing.js'
56
57
  import structuredCloning from './presets/structured-cloning.js';
57
58
  import undefPreset from './presets/undef.js';
58
59
  import universal from './presets/universal.js';
59
- 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, 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 };
60
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;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;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
@@ -1731,6 +1731,62 @@ const symbol = {
1731
1731
  }
1732
1732
  };
1733
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
+
1734
1790
  // Support all kinds of typed arrays (views of ArrayBuffers)
1735
1791
 
1736
1792
  /**
@@ -2508,5 +2564,5 @@ const universal = [
2508
2564
  // built-in into ecmasript standard.
2509
2565
  ];
2510
2566
 
2511
- 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, 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 };
2512
2568
  //# sourceMappingURL=index.js.map