typeson-registry 11.0.2 → 11.1.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
@@ -257,10 +257,12 @@ Note that the type name corresponds to the file name in the following manner:
257
257
  - `nonBuiltInIgnore` - For roughly detecting non-builtin objects and to avoid
258
258
  adding them as properties
259
259
  - `primitive-objects.js` (`StringObject`, `BooleanObject`, `NumberObject`)
260
+ - `promise`
260
261
  - `regexp`
261
262
  - `resurrectable` - Resurrects any non-array object, function, or symbol; can
262
263
  only be revived for the current window session.
263
264
  - `set`
265
+ - `symbol`
264
266
  - `typed-arrays-socketio.js` (`Int8Array`, `Uint8Array`, `Uint8ClampedArray`,
265
267
  `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`,
266
268
  `Float64Array`) - See
package/dist/index.d.ts CHANGED
@@ -26,9 +26,11 @@ import negativeInfinity from './types/negative-infinity.js';
26
26
  import negativeZero from './types/negative-zero.js';
27
27
  import nonbuiltinIgnore from './types/nonbuiltin-ignore.js';
28
28
  import primitiveObjects from './types/primitive-objects.js';
29
+ import promise from './types/promise.js';
29
30
  import regexp from './types/regexp.js';
30
31
  import resurrectable from './types/resurrectable.js';
31
32
  import set from './types/set.js';
33
+ import symbol from './types/symbol.js';
32
34
  import typedArraysSocketio from './types/typed-arrays-socketio.js';
33
35
  import typedArrays from './types/typed-arrays.js';
34
36
  import undef from './types/undef.js';
@@ -43,6 +45,5 @@ import structuredCloningThrowing from './presets/structured-cloning-throwing.js'
43
45
  import structuredCloning from './presets/structured-cloning.js';
44
46
  import undefPreset from './presets/undef.js';
45
47
  import universal from './presets/universal.js';
46
- export { arraybuffer, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, error, errors, file, filelist, imagebitmap, imagedata, infinity, intlTypes, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, primitiveObjects, regexp, resurrectable, set, typedArraysSocketio, typedArrays, undef, userObject, arrayNonindexKeys, builtin, postmessage, socketio, sparseUndefined, specialNumbers, structuredCloningThrowing, structuredCloning, undefPreset, universal };
47
- //# sourceMappingURL=index.d.ts.map
48
- export type * from 'typeson';
48
+ export { arraybuffer, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, error, errors, file, filelist, imagebitmap, imagedata, infinity, intlTypes, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, primitiveObjects, promise, regexp, resurrectable, set, symbol, typedArraysSocketio, typedArrays, undef, userObject, arrayNonindexKeys, builtin, postmessage, socketio, sparseUndefined, specialNumbers, structuredCloningThrowing, structuredCloning, undefPreset, universal };
49
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";wBAGwB,wBAAwB;yBACvB,0BAA0B;mBAChC,mBAAmB;iBACrB,iBAAiB;sBACZ,sBAAsB;sBACtB,sBAAsB;qBACvB,qBAAqB;iBACzB,iBAAiB;yBACT,yBAAyB;sBAC5B,sBAAsB;qBACvB,qBAAqB;oBACtB,oBAAoB;oBACpB,oBAAoB;kBACtB,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;mBACxC,mBAAmB;0BACZ,0BAA0B;gBACpC,gBAAgB;gCACA,kCAAkC;wBAC1C,yBAAyB;kBAC/B,kBAAkB;uBACb,wBAAwB;8BAGjB,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;yBACvB,0BAA0B;mBAChC,mBAAmB;iBACrB,iBAAiB;sBACZ,sBAAsB;sBACtB,sBAAsB;qBACvB,qBAAqB;iBACzB,iBAAiB;yBACT,yBAAyB;sBAC5B,sBAAsB;qBACvB,qBAAqB;oBACtB,oBAAoB;oBACpB,oBAAoB;kBACtB,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;mBACrB,mBAAmB;0BACZ,0BAA0B;gBACpC,gBAAgB;mBACb,mBAAmB;gCACN,kCAAkC;wBAC1C,yBAAyB;kBAC/B,kBAAkB;uBACb,wBAAwB;8BAGjB,kCAAkC;oBAC5C,sBAAsB;wBAClB,0BAA0B;qBAC7B,uBAAuB;4BAChB,+BAA+B;2BAChC,8BAA8B;sCAErD,0CAA0C;8BAChB,iCAAiC;wBACvC,oBAAoB;sBACtB,wBAAwB"}
package/dist/index.js CHANGED
@@ -1198,6 +1198,35 @@ const primitiveObjects = {
1198
1198
  }
1199
1199
  };
1200
1200
 
1201
+ /**
1202
+ * @type {import('typeson').TypeSpecSet}
1203
+ */
1204
+ const promise = {
1205
+ promise: {
1206
+ test (x) {
1207
+ return toStringTag(x) === 'Promise';
1208
+ },
1209
+ replaceAsync (prom) {
1210
+ return new e(async (resolve) => {
1211
+ try {
1212
+ resolve({
1213
+ value: await prom
1214
+ });
1215
+ } catch (error) {
1216
+ resolve({
1217
+ error
1218
+ });
1219
+ }
1220
+ });
1221
+ },
1222
+ revive (o) {
1223
+ return o.error
1224
+ ? Promise.reject(o.error)
1225
+ : Promise.resolve(o.value);
1226
+ }
1227
+ }
1228
+ };
1229
+
1201
1230
  /**
1202
1231
  * @type {import('typeson').TypeSpecSet}
1203
1232
  */
@@ -1265,6 +1294,26 @@ const set = {
1265
1294
  }
1266
1295
  };
1267
1296
 
1297
+ /**
1298
+ * @type {import('typeson').TypeSpecSet}
1299
+ */
1300
+ const symbol = {
1301
+ symbol: {
1302
+ test (x) {
1303
+ return typeof x === 'symbol';
1304
+ },
1305
+ replace (sym) {
1306
+ return {
1307
+ global: Symbol.keyFor(sym) !== undefined,
1308
+ sym: String(sym).slice(7, -1)
1309
+ };
1310
+ },
1311
+ revive (o) {
1312
+ return o.global ? Symbol.for(o.sym) : Symbol(o.sym);
1313
+ }
1314
+ }
1315
+ };
1316
+
1268
1317
  // Support all kinds of typed arrays (views of ArrayBuffers)
1269
1318
 
1270
1319
  /**
@@ -1787,5 +1836,5 @@ const universal = [
1787
1836
  // built-in into ecmasript standard.
1788
1837
  ];
1789
1838
 
1790
- export { u as JSON_TYPES, c as Typeson, e as TypesonPromise, s as Undefined, arrayNonindexKeys, arraybuffer, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, hasConstructorOf, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, regexp, resurrectable, set, setAtKeyPath, socketio, sparseUndefined, specialNumbers, expObj as structuredCloning, structuredCloningThrowing, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject };
1839
+ export { u as JSON_TYPES, c as Typeson, e as TypesonPromise, s as Undefined, arrayNonindexKeys, arraybuffer, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, hasConstructorOf, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, promise, 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 };
1791
1840
  //# sourceMappingURL=index.js.map