We ought to give a careful review of our compliance with the Structured Cloning Algorithm (to the extent it is possible):
[x] Although typeson-registry already has ImageData support, it ought to have tests added it to it for Node (probably using node-canvas).
[x] ImageBitmap is not currently supported in our typeson-registry dependency despite it being supported in the Structured Cloning Algorithm. (Since the ImageBitmap object doesn't expose its
underlying "bitmap data", one could try using the map to add to a canvas and then retrieve the data; for Node, we also ought to implement a polyfill for createImageBitmap). See also https://github.com/Automattic/node-canvas/issues/876
[x] Add note to README about types available through typeson-registry and what is not possible for us to implement (e.g., more fail-safe object detection)
[ ] Explore edge cases of normal object/array cloning (such as empty sparse arrays which seemed to be converted to an empty non-sparse array in Chrome).
[ ] Query W3C about async cloning and sync reporting
[ ] Complete browser testing (in my fork, master branch) of typeson-registry as important toward ensuring proper support
[ ] Confirm the special requirements of Map/Set cloning are being met in typeson-registry
[ ] One particular issue surfacing in tests (keypath-exceptions.js and bindings-inject-key.js) relate to how cloning should not trigger access on the prototype (it seems JSON.parse as used by typeson on which we are relying (as well as eval on which it is supposed to rely), as well as even Array.prototype.push at least in Chrome, access the prototype, at least in console). This may be near impossible to completely fix (though probably ok enough for the tests) as the prototype will be triggered any time our own chain of code accesses an array!
[ ] Chrome does not object to cloning of Intl.Collator, Intl.DateTimeFormat, and Intl.NumberFormat, but it also does not preserve their info as does typeson-registry's intl-types preset (on which the registry's 'structured-cloning' preset and in turn our library relies). Some preserving is not possible in JS anyways. We should probably revise the registry's structured-cloning not to rely on that type (unless Chrome is behaving against spec).
Some properties may not be indicated for cloning per the algorithm (except the whitelisted ones).
We ought to give a careful review of our compliance with the Structured Cloning Algorithm (to the extent it is possible):
typeson-registry
already hasImageData
support, it ought to have tests added it to it for Node (probably usingnode-canvas
).ImageBitmap
is not currently supported in ourtypeson-registry
dependency despite it being supported in the Structured Cloning Algorithm. (Since theImageBitmap
object doesn't expose its underlying "bitmap data", one could try using the map to add to a canvas and then retrieve the data; for Node, we also ought to implement a polyfill forcreateImageBitmap
). See also https://github.com/Automattic/node-canvas/issues/876typeson-registry
and what is not possible for us to implement (e.g., more fail-safe object detection)master
branch) of typeson-registry as important toward ensuring proper supportMap
/Set
cloning are being met in typeson-registrykeypath-exceptions.js
andbindings-inject-key.js
) relate to how cloning should not trigger access on the prototype (it seemsJSON.parse
as used bytypeson
on which we are relying (as well aseval
on which it is supposed to rely), as well as evenArray.prototype.push
at least in Chrome, access the prototype, at least in console). This may be near impossible to completely fix (though probably ok enough for the tests) as the prototype will be triggered any time our own chain of code accesses an array!Intl.Collator
,Intl.DateTimeFormat
, andIntl.NumberFormat
, but it also does not preserve their info as does typeson-registry'sintl-types
preset (on which the registry's 'structured-cloning' preset and in turn our library relies). Some preserving is not possible in JS anyways. We should probably revise the registry's structured-cloning not to rely on that type (unless Chrome is behaving against spec).