typeson-registry 11.0.2 → 11.1.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.
- package/README.md +2 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -13
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.cjs +109 -27
- package/dist/index.umd.cjs.map +1 -1
- package/dist/index.umd.min.cjs +1 -1
- package/dist/index.umd.min.cjs.map +1 -1
- package/dist/presets/builtin.umd.cjs +1 -1
- package/dist/presets/builtin.umd.cjs.map +1 -1
- package/dist/presets/socketio.umd.cjs +1 -1
- package/dist/presets/socketio.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
- package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning.umd.cjs +1 -1
- package/dist/presets/structured-cloning.umd.cjs.map +1 -1
- package/dist/presets/universal.umd.cjs +1 -1
- package/dist/presets/universal.umd.cjs.map +1 -1
- package/dist/types/arraybuffer.d.ts.map +1 -1
- package/dist/types/arraybuffer.umd.cjs +1 -1
- package/dist/types/arraybuffer.umd.cjs.map +1 -1
- package/dist/types/cloneable.umd.cjs.map +1 -1
- package/dist/types/dataview.d.ts.map +1 -1
- package/dist/types/dataview.umd.cjs +1 -1
- package/dist/types/dataview.umd.cjs.map +1 -1
- package/dist/types/promise.d.ts +6 -0
- package/dist/types/promise.d.ts.map +1 -0
- package/dist/types/promise.umd.cjs +2 -0
- package/dist/types/promise.umd.cjs.map +1 -0
- package/dist/types/resurrectable.umd.cjs.map +1 -1
- package/dist/types/symbol.d.ts +6 -0
- package/dist/types/symbol.d.ts.map +1 -0
- package/dist/types/symbol.umd.cjs +2 -0
- package/dist/types/symbol.umd.cjs.map +1 -0
- package/dist/types/typed-arrays.umd.cjs +1 -1
- package/dist/types/typed-arrays.umd.cjs.map +1 -1
- package/package.json +8 -8
- package/polyfills/createObjectURL.umd.cjs.map +1 -1
- package/utils/generateUUID.js +2 -2
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
@@ -113,7 +113,8 @@ const arraybuffer = {
|
|
|
113
113
|
stateObj.buffers.push(b);
|
|
114
114
|
return {
|
|
115
115
|
s: encode(b),
|
|
116
|
-
maxByteLength: b.maxByteLength
|
|
116
|
+
maxByteLength: b.maxByteLength,
|
|
117
|
+
resizable: b.resizable
|
|
117
118
|
};
|
|
118
119
|
},
|
|
119
120
|
revive (
|
|
@@ -137,7 +138,11 @@ const arraybuffer = {
|
|
|
137
138
|
}
|
|
138
139
|
const buffer = decode(
|
|
139
140
|
/** @type {string} */ (b64.s),
|
|
140
|
-
|
|
141
|
+
b64.resizable
|
|
142
|
+
// todo[engine:node@>20]: Remove comment
|
|
143
|
+
/* c8 ignore next -- Node >= 20 */
|
|
144
|
+
? {maxByteLength: b64.maxByteLength}
|
|
145
|
+
: undefined
|
|
141
146
|
);
|
|
142
147
|
stateObj.buffers.push(buffer);
|
|
143
148
|
return buffer;
|
|
@@ -323,11 +328,11 @@ function generateUUID () { // Adapted from original: public domain/MIT: http://
|
|
|
323
328
|
let d = Date.now();
|
|
324
329
|
|
|
325
330
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replaceAll(/[xy]/gu, function (c) {
|
|
326
|
-
/* eslint-disable no-bitwise -- Convenient */
|
|
331
|
+
/* eslint-disable no-bitwise, sonarjs/pseudo-random -- Convenient */
|
|
327
332
|
const r = Math.trunc((d + (Math.random() * 16)) % 16);
|
|
328
333
|
d = Math.floor(d / 16);
|
|
329
334
|
return (c === 'x' ? r : ((r & 0x3) | 0x8)).toString(16);
|
|
330
|
-
/* eslint-enable no-bitwise -- Convenient */
|
|
335
|
+
/* eslint-enable no-bitwise, sonarjs/pseudo-random -- Convenient */
|
|
331
336
|
});
|
|
332
337
|
}
|
|
333
338
|
|
|
@@ -437,6 +442,7 @@ const dataview = {
|
|
|
437
442
|
return {
|
|
438
443
|
encoded: encode(buffer),
|
|
439
444
|
maxByteLength: buffer.maxByteLength,
|
|
445
|
+
resizable: buffer.resizable,
|
|
440
446
|
byteOffset,
|
|
441
447
|
byteLength
|
|
442
448
|
};
|
|
@@ -454,7 +460,8 @@ const dataview = {
|
|
|
454
460
|
stateObj.buffers = [];
|
|
455
461
|
}
|
|
456
462
|
const {
|
|
457
|
-
byteOffset, byteLength, encoded, index, maxByteLength
|
|
463
|
+
byteOffset, byteLength, encoded, index, maxByteLength,
|
|
464
|
+
resizable
|
|
458
465
|
} = b64Obj;
|
|
459
466
|
let buffer;
|
|
460
467
|
if ('index' in b64Obj) {
|
|
@@ -462,10 +469,11 @@ const dataview = {
|
|
|
462
469
|
} else {
|
|
463
470
|
buffer = decode(
|
|
464
471
|
encoded,
|
|
472
|
+
// todo[engine:node@>20]: Remove comment
|
|
465
473
|
/* c8 ignore next 3 -- Depends on Node version */
|
|
466
|
-
|
|
467
|
-
? maxByteLength
|
|
468
|
-
:
|
|
474
|
+
resizable
|
|
475
|
+
? {maxByteLength}
|
|
476
|
+
: maxByteLength
|
|
469
477
|
);
|
|
470
478
|
stateObj.buffers.push(buffer);
|
|
471
479
|
}
|
|
@@ -1198,6 +1206,35 @@ const primitiveObjects = {
|
|
|
1198
1206
|
}
|
|
1199
1207
|
};
|
|
1200
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* @type {import('typeson').TypeSpecSet}
|
|
1211
|
+
*/
|
|
1212
|
+
const promise = {
|
|
1213
|
+
promise: {
|
|
1214
|
+
test (x) {
|
|
1215
|
+
return toStringTag(x) === 'Promise';
|
|
1216
|
+
},
|
|
1217
|
+
replaceAsync (prom) {
|
|
1218
|
+
return new e(async (resolve) => {
|
|
1219
|
+
try {
|
|
1220
|
+
resolve({
|
|
1221
|
+
value: await prom
|
|
1222
|
+
});
|
|
1223
|
+
} catch (error) {
|
|
1224
|
+
resolve({
|
|
1225
|
+
error
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
},
|
|
1230
|
+
revive (o) {
|
|
1231
|
+
return o.error
|
|
1232
|
+
? Promise.reject(o.error)
|
|
1233
|
+
: Promise.resolve(o.value);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1201
1238
|
/**
|
|
1202
1239
|
* @type {import('typeson').TypeSpecSet}
|
|
1203
1240
|
*/
|
|
@@ -1265,6 +1302,26 @@ const set = {
|
|
|
1265
1302
|
}
|
|
1266
1303
|
};
|
|
1267
1304
|
|
|
1305
|
+
/**
|
|
1306
|
+
* @type {import('typeson').TypeSpecSet}
|
|
1307
|
+
*/
|
|
1308
|
+
const symbol = {
|
|
1309
|
+
symbol: {
|
|
1310
|
+
test (x) {
|
|
1311
|
+
return typeof x === 'symbol';
|
|
1312
|
+
},
|
|
1313
|
+
replace (sym) {
|
|
1314
|
+
return {
|
|
1315
|
+
global: Symbol.keyFor(sym) !== undefined,
|
|
1316
|
+
sym: String(sym).slice(7, -1)
|
|
1317
|
+
};
|
|
1318
|
+
},
|
|
1319
|
+
revive (o) {
|
|
1320
|
+
return o.global ? Symbol.for(o.sym) : Symbol(o.sym);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1268
1325
|
// Support all kinds of typed arrays (views of ArrayBuffers)
|
|
1269
1326
|
|
|
1270
1327
|
/**
|
|
@@ -1374,6 +1431,7 @@ function create (TypedArray) {
|
|
|
1374
1431
|
stateObj.buffers.push(buffer);
|
|
1375
1432
|
return {
|
|
1376
1433
|
maxByteLength: buffer.maxByteLength,
|
|
1434
|
+
resizable: buffer.resizable,
|
|
1377
1435
|
encoded: encode(buffer),
|
|
1378
1436
|
byteOffset,
|
|
1379
1437
|
length: l
|
|
@@ -1392,7 +1450,8 @@ function create (TypedArray) {
|
|
|
1392
1450
|
stateObj.buffers = [];
|
|
1393
1451
|
}
|
|
1394
1452
|
const {
|
|
1395
|
-
byteOffset, length: len, encoded, index, maxByteLength
|
|
1453
|
+
byteOffset, length: len, encoded, index, maxByteLength,
|
|
1454
|
+
resizable
|
|
1396
1455
|
} = b64Obj;
|
|
1397
1456
|
let buffer;
|
|
1398
1457
|
if ('index' in b64Obj) {
|
|
@@ -1400,10 +1459,11 @@ function create (TypedArray) {
|
|
|
1400
1459
|
} else {
|
|
1401
1460
|
buffer = decode(
|
|
1402
1461
|
encoded,
|
|
1462
|
+
// todo[engine:node@>20]: Remove comment
|
|
1403
1463
|
/* c8 ignore next 3 -- Depends on Node version */
|
|
1404
|
-
|
|
1405
|
-
?
|
|
1406
|
-
:
|
|
1464
|
+
resizable
|
|
1465
|
+
? {maxByteLength}
|
|
1466
|
+
: undefined
|
|
1407
1467
|
);
|
|
1408
1468
|
stateObj.buffers.push(buffer);
|
|
1409
1469
|
}
|
|
@@ -1787,5 +1847,5 @@ const universal = [
|
|
|
1787
1847
|
// built-in into ecmasript standard.
|
|
1788
1848
|
];
|
|
1789
1849
|
|
|
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 };
|
|
1850
|
+
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
1851
|
//# sourceMappingURL=index.js.map
|