Closed rcj-siteimprove closed 1 month ago
Latest commit: 15e945477834fbbe0c1f2b06eaec0584cacd3675
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
!pr extract
@Jym77, apparently crypto
is not available as a global variable in Node 18, only after 19 making the tests fail for that version and not the others. It's possible to run the node 18 tests with the flag . Otherwise we need to import it everywhere we use it. Not sure if that will break something else. What do you think we should do?--experimental-global-webcrypto
, but I'm not sure if that is something we want to do
Edit: the flag mentioned doesn't seem to work anyway, so it seems we need to import crypto.
@Jym77, apparently
crypto
is not available as a global variable in Node 18, only after 19 making the tests fail for that version and not the others. ~It's possible to run the node 18 tests with the flag--experimental-global-webcrypto
, but I'm not sure if that is something we want to do~. Otherwise we need to import it everywhere we use it. Not sure if that will break something else. What do you think we should do?Edit: the flag mentioned doesn't seem to work anyway, so it seems we need to import crypto.
18 is already in LTS mode: https://nodejs.org/en/about/previous-releases
Maybe we can just move on and switch to supporting 20+ (update the actions to use 20, 22 instead of 18, 20). This does require a breaking changeset, though…
!pr extract
We introduce a verbosity option for JSON serialization of tree nodes in general and in particular for DOM tree nodes. The purpose is to avoid redundant serialization of the same nodes over and over again when they are referenced multiple times. This is for instance the case in the result of an audit where the same DOM node might be the target of many different rules. We enable this by generating a random UUID on construction of each DOM node, which we call a
serializationId
.Serializing with
Minimal
orLow
verbosity will then only output theserializationId
and the type.Serializing with
Medium
verbosity or not supplying a verbosity will result in an output containing all properties except theserializationId
- the same as the output before verbosity was introduced. This makes the change backwards compatible as doing nothing will get you the same result as before.Serializing with
High
verbosity will result in an output with all properties and theserializationId
. This option is meant to be used for, and is necessary for, establishing the map from ID to fully serialized DOM node. It's the callers responsibility to do this and to look up the nodes by ID when the full object needs to be reconstructed from theserializationId
.Additionally, we now depend on
crypto
to be present globally, meaning that we are no longer compatible with Node 18.