typeson-registry 10.0.0 → 11.0.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 +0 -4
- package/dist/index.d.ts +1 -2
- package/dist/index.js +20 -17
- 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 +16 -12
- 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/polyfills/createObjectURL.d.ts.map +1 -1
- package/dist/presets/array-nonindex-keys.d.ts +1 -1
- package/dist/presets/builtin.d.ts +1 -1
- package/dist/presets/postmessage.d.ts +1 -1
- package/dist/presets/socketio.d.ts +1 -1
- package/dist/presets/sparse-undefined.d.ts +1 -1
- package/dist/presets/special-numbers.d.ts +1 -1
- package/dist/presets/structured-cloning-throwing.d.ts +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.d.ts +1 -1
- package/dist/presets/structured-cloning.umd.cjs +1 -1
- package/dist/presets/structured-cloning.umd.cjs.map +1 -1
- package/dist/presets/undef.d.ts +1 -1
- package/dist/presets/universal.d.ts +1 -1
- package/dist/types/arraybuffer.d.ts +1 -1
- package/dist/types/bigint-object.d.ts +1 -1
- package/dist/types/bigint.d.ts +1 -1
- package/dist/types/blob.d.ts +1 -1
- package/dist/types/blob.d.ts.map +1 -1
- package/dist/types/blob.umd.cjs +1 -1
- package/dist/types/blob.umd.cjs.map +1 -1
- package/dist/types/cloneable.d.ts +1 -1
- package/dist/types/cloneable.umd.cjs +1 -1
- package/dist/types/cloneable.umd.cjs.map +1 -1
- package/dist/types/cryptokey.d.ts +1 -1
- package/dist/types/cryptokey.d.ts.map +1 -1
- package/dist/types/cryptokey.umd.cjs.map +1 -1
- package/dist/types/dataview.d.ts +1 -1
- package/dist/types/date.d.ts +1 -1
- package/dist/types/domexception.d.ts +1 -1
- package/dist/types/dommatrix.d.ts +1 -1
- package/dist/types/dompoint.d.ts +1 -1
- package/dist/types/domquad.d.ts +1 -1
- package/dist/types/domrect.d.ts +1 -1
- package/dist/types/error.d.ts +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/file.d.ts +1 -1
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/file.umd.cjs +1 -1
- package/dist/types/file.umd.cjs.map +1 -1
- package/dist/types/filelist.d.ts +1 -1
- package/dist/types/filelist.umd.cjs +1 -1
- package/dist/types/filelist.umd.cjs.map +1 -1
- package/dist/types/imagebitmap.d.ts +1 -1
- package/dist/types/imagedata.d.ts +1 -1
- package/dist/types/infinity.d.ts +1 -1
- package/dist/types/intl-types.d.ts +3 -3
- package/dist/types/map.d.ts +1 -1
- package/dist/types/nan.d.ts +1 -1
- package/dist/types/negative-infinity.d.ts +1 -1
- package/dist/types/negative-zero.d.ts +1 -1
- package/dist/types/nonbuiltin-ignore.d.ts +1 -1
- package/dist/types/primitive-objects.d.ts +1 -1
- package/dist/types/regexp.d.ts +1 -1
- package/dist/types/resurrectable.d.ts +1 -1
- package/dist/types/resurrectable.umd.cjs +1 -1
- package/dist/types/resurrectable.umd.cjs.map +1 -1
- package/dist/types/set.d.ts +1 -1
- package/dist/types/typed-arrays-socketio.d.ts +1 -1
- package/dist/types/typed-arrays.d.ts +1 -1
- package/dist/types/undef.d.ts +1 -1
- package/dist/types/user-object.d.ts +1 -1
- package/dist/utils/generateUUID.d.ts.map +1 -1
- package/package.json +39 -39
- package/polyfills/createObjectURL.js +5 -9
- package/polyfills/createObjectURL.umd.cjs +1 -1
- package/polyfills/createObjectURL.umd.cjs.map +1 -1
- package/utils/generateUUID.js +1 -9
- package/tools/append-to-declaration-files.js +0 -13
package/README.md
CHANGED
|
@@ -50,10 +50,6 @@ The `imagedata` type requires a global `ImageData` polyfill (including an
|
|
|
50
50
|
You may wish to see our `test-environment.js` file for how some
|
|
51
51
|
polyfilling may be done (largely using `jsdom`).
|
|
52
52
|
|
|
53
|
-
The `cloneable` and `resurrectable` types (and the `createObjectURL`
|
|
54
|
-
polyill) each accept an optional global `performance` polyfill (through
|
|
55
|
-
the common file `utils/generateUUID.js`).
|
|
56
|
-
|
|
57
53
|
### Building files from Git clone (as opposed to npm installs)
|
|
58
54
|
|
|
59
55
|
If you have cloned the repo (and not the npm package), you must run
|
package/dist/index.d.ts
CHANGED
|
@@ -44,5 +44,4 @@ import structuredCloning from './presets/structured-cloning.js';
|
|
|
44
44
|
import undefPreset from './presets/undef.js';
|
|
45
45
|
import universal from './presets/universal.js';
|
|
46
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';
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -185,6 +185,11 @@ const bigint = {
|
|
|
185
185
|
* @param {ArrayBuffer} buf
|
|
186
186
|
* @returns {string}
|
|
187
187
|
*/
|
|
188
|
+
function arraybuffer2string (buf) {
|
|
189
|
+
return new Uint8Array(buf).reduce(
|
|
190
|
+
(s, byte) => s + String.fromCodePoint(byte), ''
|
|
191
|
+
);
|
|
192
|
+
}
|
|
188
193
|
|
|
189
194
|
/**
|
|
190
195
|
*
|
|
@@ -247,7 +252,7 @@ function string2arraybuffer (str) {
|
|
|
247
252
|
return array.buffer;
|
|
248
253
|
}
|
|
249
254
|
|
|
250
|
-
/* globals XMLHttpRequest,
|
|
255
|
+
/* globals XMLHttpRequest, FileReader */
|
|
251
256
|
|
|
252
257
|
/**
|
|
253
258
|
* @type {import('typeson').TypeSpecSet}
|
|
@@ -289,7 +294,9 @@ const blob = {
|
|
|
289
294
|
reader.addEventListener('load', () => {
|
|
290
295
|
resolve({
|
|
291
296
|
type: b.type,
|
|
292
|
-
stringContents:
|
|
297
|
+
stringContents: arraybuffer2string(
|
|
298
|
+
/** @type {ArrayBuffer} */ (reader.result)
|
|
299
|
+
)
|
|
293
300
|
});
|
|
294
301
|
});
|
|
295
302
|
// Seems not feasible to accurately simulate
|
|
@@ -297,14 +304,14 @@ const blob = {
|
|
|
297
304
|
reader.addEventListener('error', () => {
|
|
298
305
|
reject(reader.error);
|
|
299
306
|
});
|
|
300
|
-
|
|
307
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
308
|
+
// eslint-disable-next-line unicorn/prefer-blob-reading-methods -- Too new?
|
|
309
|
+
reader.readAsArrayBuffer(b);
|
|
301
310
|
});
|
|
302
311
|
}
|
|
303
312
|
}
|
|
304
313
|
};
|
|
305
314
|
|
|
306
|
-
// The `performance` global is optional
|
|
307
|
-
|
|
308
315
|
/**
|
|
309
316
|
* @todo We could use `import generateUUID from 'uuid/v4';` (but it needs
|
|
310
317
|
* crypto library, etc.; `rollup-plugin-node-builtins` doesn't recommend
|
|
@@ -314,13 +321,7 @@ const blob = {
|
|
|
314
321
|
*/
|
|
315
322
|
function generateUUID () { // Adapted from original: public domain/MIT: http://stackoverflow.com/a/8809472/271577
|
|
316
323
|
/* c8 ignore next */
|
|
317
|
-
let d = Date.now()
|
|
318
|
-
// use high-precision timer if available
|
|
319
|
-
/* c8 ignore next 4 */
|
|
320
|
-
(typeof performance !== 'undefined' &&
|
|
321
|
-
typeof performance.now === 'function'
|
|
322
|
-
? performance.now()
|
|
323
|
-
: 0);
|
|
324
|
+
let d = Date.now();
|
|
324
325
|
|
|
325
326
|
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
326
327
|
// eslint-disable-next-line no-use-extend-native/no-use-extend-native -- Need to update plugin
|
|
@@ -365,8 +366,6 @@ const cloneable = {
|
|
|
365
366
|
}
|
|
366
367
|
};
|
|
367
368
|
|
|
368
|
-
/* globals crypto */
|
|
369
|
-
|
|
370
369
|
/**
|
|
371
370
|
* @type {import('typeson').TypeSpecSet}
|
|
372
371
|
*/
|
|
@@ -811,7 +810,7 @@ function create$2 (Ctor) {
|
|
|
811
810
|
};
|
|
812
811
|
}
|
|
813
812
|
|
|
814
|
-
/* globals XMLHttpRequest,
|
|
813
|
+
/* globals XMLHttpRequest, FileReader */
|
|
815
814
|
|
|
816
815
|
/**
|
|
817
816
|
* @type {import('typeson').TypeSpecSet}
|
|
@@ -855,7 +854,9 @@ const file = {
|
|
|
855
854
|
reader.addEventListener('load', function () {
|
|
856
855
|
resolve({
|
|
857
856
|
type: f.type,
|
|
858
|
-
stringContents:
|
|
857
|
+
stringContents: arraybuffer2string(
|
|
858
|
+
/** @type {ArrayBuffer} */ (reader.result)
|
|
859
|
+
),
|
|
859
860
|
name: f.name,
|
|
860
861
|
lastModified: f.lastModified
|
|
861
862
|
});
|
|
@@ -865,7 +866,9 @@ const file = {
|
|
|
865
866
|
reader.addEventListener('error', function () {
|
|
866
867
|
reject(reader.error);
|
|
867
868
|
});
|
|
868
|
-
|
|
869
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
870
|
+
// eslint-disable-next-line unicorn/prefer-blob-reading-methods -- Too new?
|
|
871
|
+
reader.readAsArrayBuffer(f);
|
|
869
872
|
});
|
|
870
873
|
}
|
|
871
874
|
}
|