VYPR
High severityOSV Advisory· Published Jan 22, 2026· Updated Jan 22, 2026

seroval affected by Denial of Service via RegExp serialization

CVE-2026-23956

Description

seroval facilitates JS value stringification, including complex structures beyond JSON.stringify capabilities. In versions 1.4.0 and below, overriding RegExp serialization with extremely large patterns can exhaust JavaScript runtime memory during deserialization. Additionally, overriding RegExp serialization with patterns that trigger catastrophic backtracking can lead to ReDoS (Regular Expression Denial of Service). This issue has been fixed in version 1.4.1.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
serovalnpm
>= 0.2.0, < 1.4.11.4.1

Affected products

1

Patches

1
ce9408ebc873

`1.4.1` and `1.4.2`

https://github.com/lxsmnsyc/serovalAlexis H. MunsayacJan 21, 2026via ghsa
67 files changed · +1105 763
  • benchmark/CHANGELOG.md+16 0 modified
    @@ -1,5 +1,21 @@
     # seroval-benchmarks
     
    +## 1.3.6
    +
    +### Patch Changes
    +
    +- Updated dependencies
    +  - seroval@1.4.2
    +  - seroval-plugins@1.4.2
    +
    +## 1.3.5
    +
    +### Patch Changes
    +
    +- Updated dependencies [3995cc1]
    +  - seroval-plugins@1.4.1
    +  - seroval@1.4.1
    +
     ## 1.3.4
     
     ### Patch Changes
    
  • benchmark/package.json+1 1 modified
    @@ -43,5 +43,5 @@
       "typesVersions": {
         "*": {}
       },
    -  "version": "1.3.4"
    +  "version": "1.3.6"
     }
    
  • docs/compatibility.md+4 1 modified
    @@ -53,6 +53,8 @@ By default, all feature flags are enabled. The following are the feature flags a
       - Affects `Iterable`, `Error`, `AggregateError` and `Object.create(null)`
     - [`BigIntTypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array)
       - Disables serialization of `BigInt64Array` and `BigUint64Array`
    +- `RegExp`
    +  - Disables serialization (and deserialization) of `RegExp`
     
     ## Supported Types
     
    @@ -75,7 +77,7 @@ By default, all feature flags are enabled. The following are the feature flags a
     | `Array`                                                                                                                                                  | ✅         | ✅         | ✅         |
     | sparse (holey) `Arrays`                                                                                                                                  | ✅         | ✅         | ✅         |
     | `Object`                                                                                                                                                 | ✅         | ✅         | ✅         |
    -| `RegExp`                                                                                                                                                 | ✅         | ✅         | ✅         |
    +| `RegExp`                                                                                                                                                 | ❓[^6]     | ❓[^6]     | ❓[^6]     |
     | `Date`                                                                                                                                                   | ✅         | ✅         | ✅         |
     | `Map`                                                                                                                                                    | ✅         | ✅         | ✅         |
     | `Set`                                                                                                                                                    | ✅         | ✅         | ✅         |
    @@ -133,3 +135,4 @@ By default, all feature flags are enabled. The following are the feature flags a
     [^3]: `Feature.AggregateError` must be enabled, otherwise `AggregateError` is serialized into an `Error` instance.
     [^4]: `FormData` is partially supported if it doesn't contain any `Blob` or `File` instances.
     [^5]: Due to the nature of `Blob` and `File` being an async type (in that it returns a `Promise`-based serializable data) while having a sync constructor, it cannot be represented in a way that the type is consistent to its original declaration.
    +[^6]: `Feature.RegExp` must be enabled, otherwise throws an `SerovalUnsupportedTypeError` and `SerovalUnsupportedNodeError`.
    
  • packages/plugins/CHANGELOG.md+8 0 modified
    @@ -1,5 +1,13 @@
     # seroval-plugins
     
    +## 1.4.2
    +
    +## 1.4.1
    +
    +### Patch Changes
    +
    +- 3995cc1: security enhancements
    +
     ## 1.4.0
     
     ### Minor Changes
    
  • packages/plugins/package.json+2 2 modified
    @@ -1,7 +1,7 @@
     {
       "name": "seroval-plugins",
       "type": "module",
    -  "version": "1.4.0",
    +  "version": "1.4.2",
       "files": [
         "dist",
         "web"
    @@ -17,7 +17,7 @@
         "@types/node": "^24.10.0",
         "@vitest/ui": "^4.0.6",
         "pridepack": "2.6.4",
    -    "seroval": "1.4.0",
    +    "seroval": "1.4.2",
         "tslib": "^2.8.1",
         "typescript": "^5.9.3",
         "vitest": "^4.0.6"
    
  • packages/plugins/tests/web/__snapshots__/abort-signal.test.ts.snap+4 4 modified
    @@ -94,10 +94,10 @@ exports[`AbortSignal > toCrossJSONStream > supports future AbortSignal 1`] = `"{
     
     exports[`AbortSignal > toCrossJSONStream > supports future AbortSignal 2`] = `"{"t":25,"i":2,"s":{"controller":{"t":4,"i":1},"reason":{"t":1,"s":"aborted!"}},"c":"seroval-plugins/web/AbortSignalAbort"}"`;
     
    -exports[`AbortSignal > toJSON > supports aborted AbortSignal 1`] = `"{"t":{"t":25,"i":0,"s":{"type":1,"reason":{"t":1,"s":"aborted!"}},"c":"seroval-plugins/web/AbortSignal"},"f":31,"m":[]}"`;
    +exports[`AbortSignal > toJSON > supports aborted AbortSignal 1`] = `"{"t":{"t":25,"i":0,"s":{"type":1,"reason":{"t":1,"s":"aborted!"}},"c":"seroval-plugins/web/AbortSignal"},"f":63,"m":[]}"`;
     
    -exports[`AbortSignal > toJSON > supports future AbortSignal 1`] = `"{"t":{"t":25,"i":0,"s":{"type":0},"c":"seroval-plugins/web/AbortSignal"},"f":31,"m":[]}"`;
    +exports[`AbortSignal > toJSON > supports future AbortSignal 1`] = `"{"t":{"t":25,"i":0,"s":{"type":0},"c":"seroval-plugins/web/AbortSignal"},"f":63,"m":[]}"`;
     
    -exports[`AbortSignal > toJSONAsync > supports aborted AbortSignal 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":1,"reason":{"t":1,"s":"aborted!"}},"c":"seroval-plugins/web/AbortSignal"}},"f":31,"m":[]}"`;
    +exports[`AbortSignal > toJSONAsync > supports aborted AbortSignal 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":1,"reason":{"t":1,"s":"aborted!"}},"c":"seroval-plugins/web/AbortSignal"}},"f":63,"m":[]}"`;
     
    -exports[`AbortSignal > toJSONAsync > supports future AbortSignal 1`] = `"{"t":{"t":25,"i":0,"s":{"type":1,"reason":{"t":1,"s":"aborted!"}},"c":"seroval-plugins/web/AbortSignal"},"f":31,"m":[]}"`;
    +exports[`AbortSignal > toJSONAsync > supports future AbortSignal 1`] = `"{"t":{"t":25,"i":0,"s":{"type":1,"reason":{"t":1,"s":"aborted!"}},"c":"seroval-plugins/web/AbortSignal"},"f":63,"m":[]}"`;
    
  • packages/plugins/tests/web/__snapshots__/blob.test.ts.snap+11 8 modified
    @@ -1,38 +1,41 @@
     // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
     
     exports[`Blob > crossSerializeAsync > scoped > supports Blob 1`] = `
    -"($R=>$R[0]=Promise.resolve($R[1]=new Blob([$R[2]=($R[3]=(length, b64) => {
    +"($R=>$R[0]=Promise.resolve($R[1]=new Blob([$R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],{type:"text/plain"})))($R["example"])"
    +})("SGVsbG8gV29ybGQ=")],{type:"text/plain"})))($R["example"])"
     `;
     
     exports[`Blob > crossSerializeAsync > supports Blob 1`] = `
    -"$R[0]=new Blob([$R[1]=($R[2]=(length, b64) => {
    +"$R[0]=new Blob([$R[1]=($R[2]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],{type:"text/plain"})"
    +})("SGVsbG8gV29ybGQ=")],{type:"text/plain"})"
     `;
     
     exports[`Blob > serializeAsync > supports Blob 1`] = `
    -"new Blob([((length, b64) => {
    +"new Blob([((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],{type:"text/plain"})"
    +})("SGVsbG8gV29ybGQ=")],{type:"text/plain"})"
     `;
     
    -exports[`Blob > toCrossJSONAsync > supports Blob 1`] = `"{"t":25,"i":0,"s":{"type":{"t":1,"s":"text/plain"},"buffer":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQ=","l":11,"f":{"t":26,"i":2,"s":5}}},"c":"seroval-plugins/web/Blob"}"`;
    +exports[`Blob > toCrossJSONAsync > supports Blob 1`] = `"{"t":25,"i":0,"s":{"type":{"t":1,"s":"text/plain"},"buffer":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQ=","f":{"t":26,"i":2,"s":5}}},"c":"seroval-plugins/web/Blob"}"`;
     
    -exports[`Blob > toJSONAsync > supports Blob 1`] = `"{"t":{"t":25,"i":0,"s":{"type":{"t":1,"s":"text/plain"},"buffer":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQ=","l":11,"f":{"t":26,"i":2,"s":5}}},"c":"seroval-plugins/web/Blob"},"f":31,"m":[]}"`;
    +exports[`Blob > toJSONAsync > supports Blob 1`] = `"{"t":{"t":25,"i":0,"s":{"type":{"t":1,"s":"text/plain"},"buffer":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQ=","f":{"t":26,"i":2,"s":5}}},"c":"seroval-plugins/web/Blob"},"f":63,"m":[]}"`;
    
  • packages/plugins/tests/web/__snapshots__/custom-event.test.ts.snap+5 5 modified
    @@ -58,14 +58,14 @@ exports[`CustomEvent > serialize > supports CustomEvent 1`] = `"((h,j)=>(j=new C
     
     exports[`CustomEvent > serializeAsync > supports CustomEvent 1`] = `"((h,j)=>(j=Promise.resolve(new CustomEvent("example",{detail:h={},bubbles:!1,cancelable:!1,composed:!1})),h.self=h,j))()"`;
     
    -exports[`CustomEvent > toCrossJSON > supports CustomEvent 1`] = `"{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":2,"p":{"k":["self"],"v":[{"t":4,"i":2}],"s":1},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":4},"o":0}},"c":"seroval-plugins/web/CustomEvent"}"`;
    +exports[`CustomEvent > toCrossJSON > supports CustomEvent 1`] = `"{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":2,"p":{"k":["self"],"v":[{"t":4,"i":2}]},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/CustomEvent"}"`;
     
    -exports[`CustomEvent > toCrossJSONAsync > supports CustomEvent 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":3,"p":{"k":["self"],"v":[{"t":4,"i":3}],"s":1},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":4},"o":0}},"c":"seroval-plugins/web/CustomEvent"}}"`;
    +exports[`CustomEvent > toCrossJSONAsync > supports CustomEvent 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":3,"p":{"k":["self"],"v":[{"t":4,"i":3}]},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/CustomEvent"}}"`;
     
     exports[`CustomEvent > toCrossJSONStream > supports CustomEvent 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`CustomEvent > toCrossJSONStream > supports CustomEvent 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":25,"i":3,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":4,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":5,"p":{"k":["self"],"v":[{"t":4,"i":5}],"s":1},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":4},"o":0}},"c":"seroval-plugins/web/CustomEvent"}]}"`;
    +exports[`CustomEvent > toCrossJSONStream > supports CustomEvent 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":25,"i":3,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":4,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":5,"p":{"k":["self"],"v":[{"t":4,"i":5}]},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/CustomEvent"}]}"`;
     
    -exports[`CustomEvent > toJSON > supports CustomEvent 1`] = `"{"t":{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":2,"p":{"k":["self"],"v":[{"t":4,"i":2}],"s":1},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":4},"o":0}},"c":"seroval-plugins/web/CustomEvent"},"f":31,"m":[2]}"`;
    +exports[`CustomEvent > toJSON > supports CustomEvent 1`] = `"{"t":{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":2,"p":{"k":["self"],"v":[{"t":4,"i":2}]},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/CustomEvent"},"f":63,"m":[2]}"`;
     
    -exports[`CustomEvent > toJSONAsync > supports CustomEvent 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":3,"p":{"k":["self"],"v":[{"t":4,"i":3}],"s":1},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":4},"o":0}},"c":"seroval-plugins/web/CustomEvent"}},"f":31,"m":[3]}"`;
    +exports[`CustomEvent > toJSONAsync > supports CustomEvent 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["detail","bubbles","cancelable","composed"],"v":[{"t":10,"i":3,"p":{"k":["self"],"v":[{"t":4,"i":3}]},"o":0},{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/CustomEvent"}},"f":63,"m":[3]}"`;
    
  • packages/plugins/tests/web/__snapshots__/dom-exception.test.ts.snap+2 2 modified
    @@ -66,6 +66,6 @@ exports[`DOMException > toCrossJSONStream > supports DOMException 1`] = `"{"t":2
     
     exports[`DOMException > toCrossJSONStream > supports DOMException 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":25,"i":3,"s":{"name":{"t":1,"s":"Example"},"message":{"t":1,"s":"This is an example message."}},"c":"seroval-plugins/web/DOMException"}]}"`;
     
    -exports[`DOMException > toJSON > supports DOMException 1`] = `"{"t":{"t":25,"i":0,"s":{"name":{"t":1,"s":"Example"},"message":{"t":1,"s":"This is an example message."}},"c":"seroval-plugins/web/DOMException"},"f":31,"m":[]}"`;
    +exports[`DOMException > toJSON > supports DOMException 1`] = `"{"t":{"t":25,"i":0,"s":{"name":{"t":1,"s":"Example"},"message":{"t":1,"s":"This is an example message."}},"c":"seroval-plugins/web/DOMException"},"f":63,"m":[]}"`;
     
    -exports[`DOMException > toJSONAsync > supports DOMException 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"name":{"t":1,"s":"Example"},"message":{"t":1,"s":"This is an example message."}},"c":"seroval-plugins/web/DOMException"}},"f":31,"m":[]}"`;
    +exports[`DOMException > toJSONAsync > supports DOMException 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"name":{"t":1,"s":"Example"},"message":{"t":1,"s":"This is an example message."}},"c":"seroval-plugins/web/DOMException"}},"f":63,"m":[]}"`;
    
  • packages/plugins/tests/web/__snapshots__/event.test.ts.snap+5 5 modified
    @@ -58,14 +58,14 @@ exports[`Event > serialize > supports Event 1`] = `"new Event("example",{bubbles
     
     exports[`Event > serializeAsync > supports Event 1`] = `"Promise.resolve(new Event("example",{bubbles:!1,cancelable:!1,composed:!1}))"`;
     
    -exports[`Event > toCrossJSON > supports Event 1`] = `"{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":3},"o":0}},"c":"seroval-plugins/web/Event"}"`;
    +exports[`Event > toCrossJSON > supports Event 1`] = `"{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/Event"}"`;
     
    -exports[`Event > toCrossJSONAsync > supports Event 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":3},"o":0}},"c":"seroval-plugins/web/Event"}}"`;
    +exports[`Event > toCrossJSONAsync > supports Event 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/Event"}}"`;
     
     exports[`Event > toCrossJSONStream > supports Event 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`Event > toCrossJSONStream > supports Event 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":5,"s":2},{"t":25,"i":3,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":4,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":3},"o":0}},"c":"seroval-plugins/web/Event"}]}"`;
    +exports[`Event > toCrossJSONStream > supports Event 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":5,"s":2},{"t":25,"i":3,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":4,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/Event"}]}"`;
     
    -exports[`Event > toJSON > supports Event 1`] = `"{"t":{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":3},"o":0}},"c":"seroval-plugins/web/Event"},"f":31,"m":[]}"`;
    +exports[`Event > toJSON > supports Event 1`] = `"{"t":{"t":25,"i":0,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":1,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/Event"},"f":63,"m":[]}"`;
     
    -exports[`Event > toJSONAsync > supports Event 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}],"s":3},"o":0}},"c":"seroval-plugins/web/Event"}},"f":31,"m":[]}"`;
    +exports[`Event > toJSONAsync > supports Event 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"type":{"t":1,"s":"example"},"options":{"t":10,"i":2,"p":{"k":["bubbles","cancelable","composed"],"v":[{"t":2,"s":3},{"t":2,"s":3},{"t":2,"s":3}]},"o":0}},"c":"seroval-plugins/web/Event"}},"f":63,"m":[]}"`;
    
  • packages/plugins/tests/web/__snapshots__/file.test.ts.snap+11 8 modified
    @@ -1,38 +1,41 @@
     // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
     
     exports[`File > crossSerializeAsync > scoped > supports File 1`] = `
    -"($R=>$R[0]=new File([$R[2]=($R[3]=(length, b64) => {
    +"($R=>$R[0]=new File([$R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],"hello.txt",$R[1]={type:"text/plain",lastModified:1681027542680}))($R["example"])"
    +})("SGVsbG8gV29ybGQ=")],"hello.txt",$R[1]={type:"text/plain",lastModified:1681027542680}))($R["example"])"
     `;
     
     exports[`File > crossSerializeAsync > supports File 1`] = `
    -"$R[0]=new File([$R[2]=($R[3]=(length, b64) => {
    +"$R[0]=new File([$R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],"hello.txt",$R[1]={type:"text/plain",lastModified:1681027542680})"
    +})("SGVsbG8gV29ybGQ=")],"hello.txt",$R[1]={type:"text/plain",lastModified:1681027542680})"
     `;
     
     exports[`File > serializeAsync > supports File 1`] = `
    -"new File([((length, b64) => {
    +"new File([((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],"hello.txt",{type:"text/plain",lastModified:1681027542680})"
    +})("SGVsbG8gV29ybGQ=")],"hello.txt",{type:"text/plain",lastModified:1681027542680})"
     `;
     
    -exports[`File > toCrossJSONAsync > supports File 1`] = `"{"t":25,"i":0,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":1,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}],"s":2},"o":0},"buffer":{"t":19,"i":2,"s":"SGVsbG8gV29ybGQ=","l":11,"f":{"t":26,"i":3,"s":5}}},"c":"seroval-plugins/web/File"}"`;
    +exports[`File > toCrossJSONAsync > supports File 1`] = `"{"t":25,"i":0,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":1,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}]},"o":0},"buffer":{"t":19,"i":2,"s":"SGVsbG8gV29ybGQ=","f":{"t":26,"i":3,"s":5}}},"c":"seroval-plugins/web/File"}"`;
     
    -exports[`File > toJSONAsync > supports File 1`] = `"{"t":{"t":25,"i":0,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":1,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}],"s":2},"o":0},"buffer":{"t":19,"i":2,"s":"SGVsbG8gV29ybGQ=","l":11,"f":{"t":26,"i":3,"s":5}}},"c":"seroval-plugins/web/File"},"f":31,"m":[]}"`;
    +exports[`File > toJSONAsync > supports File 1`] = `"{"t":{"t":25,"i":0,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":1,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}]},"o":0},"buffer":{"t":19,"i":2,"s":"SGVsbG8gV29ybGQ=","f":{"t":26,"i":3,"s":5}}},"c":"seroval-plugins/web/File"},"f":63,"m":[]}"`;
    
  • packages/plugins/tests/web/__snapshots__/form-data.test.ts.snap+14 11 modified
    @@ -27,14 +27,15 @@ exports[`FormData > crossSerializeAsync > scoped > supports FormData 1`] = `
         f.append(t[0], t[1]);
       };
       return f;
    -})($R[2]=[$R[3]=["hello-world",$R[4]=new File([$R[6]=($R[7]=(length, b64) => {
    +})($R[2]=[$R[3]=["hello-world",$R[4]=new File([$R[6]=($R[7]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],"hello.txt",$R[5]={type:"text/plain",lastModified:1681027542680})],$R[8]=["foo-bar",$R[9]=new File([$R[11]=$R[7](7,"Rm9vIEJhcg==")],"foo-bar.txt",$R[10]={type:"text/plain",lastModified:1681027542680})]]))($R["example"])"
    +})("SGVsbG8gV29ybGQ=")],"hello.txt",$R[5]={type:"text/plain",lastModified:1681027542680})],$R[8]=["foo-bar",$R[9]=new File([$R[11]=$R[7]("Rm9vIEJhcg==")],"foo-bar.txt",$R[10]={type:"text/plain",lastModified:1681027542680})]]))($R["example"])"
     `;
     
     exports[`FormData > crossSerializeAsync > supports FormData 1`] = `
    @@ -44,14 +45,15 @@ exports[`FormData > crossSerializeAsync > supports FormData 1`] = `
         f.append(t[0], t[1]);
       };
       return f;
    -})($R[2]=[$R[3]=["hello-world",$R[4]=new File([$R[6]=($R[7]=(length, b64) => {
    +})($R[2]=[$R[3]=["hello-world",$R[4]=new File([$R[6]=($R[7]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],"hello.txt",$R[5]={type:"text/plain",lastModified:1681027542680})],$R[8]=["foo-bar",$R[9]=new File([$R[11]=$R[7](7,"Rm9vIEJhcg==")],"foo-bar.txt",$R[10]={type:"text/plain",lastModified:1681027542680})]])"
    +})("SGVsbG8gV29ybGQ=")],"hello.txt",$R[5]={type:"text/plain",lastModified:1681027542680})],$R[8]=["foo-bar",$R[9]=new File([$R[11]=$R[7]("Rm9vIEJhcg==")],"foo-bar.txt",$R[10]={type:"text/plain",lastModified:1681027542680})]])"
     `;
     
     exports[`FormData > crossSerializeStream > scoped > supports FormData 1`] = `
    @@ -129,24 +131,25 @@ exports[`FormData > serializeAsync > supports FormData 1`] = `
         f.append(t[0], t[1]);
       };
       return f;
    -})([["hello-world",new File([(h=(length, b64) => {
    +})([["hello-world",new File([(h=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(11,"SGVsbG8gV29ybGQ=")],"hello.txt",{type:"text/plain",lastModified:1681027542680})],["foo-bar",new File([h(7,"Rm9vIEJhcg==")],"foo-bar.txt",{type:"text/plain",lastModified:1681027542680})]]))()"
    +})("SGVsbG8gV29ybGQ=")],"hello.txt",{type:"text/plain",lastModified:1681027542680})],["foo-bar",new File([h("Rm9vIEJhcg==")],"foo-bar.txt",{type:"text/plain",lastModified:1681027542680})]]))()"
     `;
     
    -exports[`FormData > toCrossJSON > supports FormData 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"l":2,"a":[{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"hello"},{"t":1,"s":"world"}],"o":0},{"t":9,"i":4,"l":2,"a":[{"t":1,"s":"foo"},{"t":1,"s":"bar"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"}"`;
    +exports[`FormData > toCrossJSON > supports FormData 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"a":[{"t":9,"i":3,"a":[{"t":1,"s":"hello"},{"t":1,"s":"world"}],"o":0},{"t":9,"i":4,"a":[{"t":1,"s":"foo"},{"t":1,"s":"bar"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"}"`;
     
    -exports[`FormData > toCrossJSONAsync > supports FormData 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"l":2,"a":[{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"hello-world"},{"t":25,"i":4,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":5,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}],"s":2},"o":0},"buffer":{"t":19,"i":6,"s":"SGVsbG8gV29ybGQ=","l":11,"f":{"t":26,"i":7,"s":5}}},"c":"seroval-plugins/web/File"}],"o":0},{"t":9,"i":8,"l":2,"a":[{"t":1,"s":"foo-bar"},{"t":25,"i":9,"s":{"name":{"t":1,"s":"foo-bar.txt"},"options":{"t":10,"i":10,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}],"s":2},"o":0},"buffer":{"t":19,"i":11,"s":"Rm9vIEJhcg==","l":7,"f":{"t":4,"i":7}}},"c":"seroval-plugins/web/File"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"}"`;
    +exports[`FormData > toCrossJSONAsync > supports FormData 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"a":[{"t":9,"i":3,"a":[{"t":1,"s":"hello-world"},{"t":25,"i":4,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":5,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}]},"o":0},"buffer":{"t":19,"i":6,"s":"SGVsbG8gV29ybGQ=","f":{"t":26,"i":7,"s":5}}},"c":"seroval-plugins/web/File"}],"o":0},{"t":9,"i":8,"a":[{"t":1,"s":"foo-bar"},{"t":25,"i":9,"s":{"name":{"t":1,"s":"foo-bar.txt"},"options":{"t":10,"i":10,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}]},"o":0},"buffer":{"t":19,"i":11,"s":"Rm9vIEJhcg==","f":{"t":4,"i":7}}},"c":"seroval-plugins/web/File"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"}"`;
     
     exports[`FormData > toCrossJSONStream > supports FormData 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`FormData > toCrossJSONStream > supports FormData 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":25,"i":3,"s":{"factory":{"t":25,"i":4,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":5,"l":2,"a":[{"t":9,"i":6,"l":2,"a":[{"t":1,"s":"hello"},{"t":1,"s":"world"}],"o":0},{"t":9,"i":7,"l":2,"a":[{"t":1,"s":"foo"},{"t":1,"s":"bar"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"}]}"`;
    +exports[`FormData > toCrossJSONStream > supports FormData 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":25,"i":3,"s":{"factory":{"t":25,"i":4,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":5,"a":[{"t":9,"i":6,"a":[{"t":1,"s":"hello"},{"t":1,"s":"world"}],"o":0},{"t":9,"i":7,"a":[{"t":1,"s":"foo"},{"t":1,"s":"bar"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"}]}"`;
     
    -exports[`FormData > toJSON > supports FormData 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"l":2,"a":[{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"hello"},{"t":1,"s":"world"}],"o":0},{"t":9,"i":4,"l":2,"a":[{"t":1,"s":"foo"},{"t":1,"s":"bar"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"},"f":31,"m":[]}"`;
    +exports[`FormData > toJSON > supports FormData 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"a":[{"t":9,"i":3,"a":[{"t":1,"s":"hello"},{"t":1,"s":"world"}],"o":0},{"t":9,"i":4,"a":[{"t":1,"s":"foo"},{"t":1,"s":"bar"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"},"f":63,"m":[]}"`;
     
    -exports[`FormData > toJSONAsync > supports FormData 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"l":2,"a":[{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"hello-world"},{"t":25,"i":4,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":5,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}],"s":2},"o":0},"buffer":{"t":19,"i":6,"s":"SGVsbG8gV29ybGQ=","l":11,"f":{"t":26,"i":7,"s":5}}},"c":"seroval-plugins/web/File"}],"o":0},{"t":9,"i":8,"l":2,"a":[{"t":1,"s":"foo-bar"},{"t":25,"i":9,"s":{"name":{"t":1,"s":"foo-bar.txt"},"options":{"t":10,"i":10,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}],"s":2},"o":0},"buffer":{"t":19,"i":11,"s":"Rm9vIEJhcg==","l":7,"f":{"t":4,"i":7}}},"c":"seroval-plugins/web/File"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"},"f":31,"m":[7]}"`;
    +exports[`FormData > toJSONAsync > supports FormData 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/FormDataFactory"},"entries":{"t":9,"i":2,"a":[{"t":9,"i":3,"a":[{"t":1,"s":"hello-world"},{"t":25,"i":4,"s":{"name":{"t":1,"s":"hello.txt"},"options":{"t":10,"i":5,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}]},"o":0},"buffer":{"t":19,"i":6,"s":"SGVsbG8gV29ybGQ=","f":{"t":26,"i":7,"s":5}}},"c":"seroval-plugins/web/File"}],"o":0},{"t":9,"i":8,"a":[{"t":1,"s":"foo-bar"},{"t":25,"i":9,"s":{"name":{"t":1,"s":"foo-bar.txt"},"options":{"t":10,"i":10,"p":{"k":["type","lastModified"],"v":[{"t":1,"s":"text/plain"},{"t":0,"s":1681027542680}]},"o":0},"buffer":{"t":19,"i":11,"s":"Rm9vIEJhcg==","f":{"t":4,"i":7}}},"c":"seroval-plugins/web/File"}],"o":0}],"o":0}},"c":"seroval-plugins/web/FormData"},"f":63,"m":[7]}"`;
    
  • packages/plugins/tests/web/__snapshots__/headers.test.ts.snap+5 5 modified
    @@ -58,14 +58,14 @@ exports[`Headers > serialize > supports Headers 1`] = `"new Headers([["content-e
     
     exports[`Headers > serializeAsync > supports Headers 1`] = `"Promise.resolve(new Headers([["content-encoding","gzip"],["content-type","text/plain"]]))"`;
     
    -exports[`Headers > toCrossJSON > supports Headers 1`] = `"{"t":25,"i":0,"s":{"t":9,"i":1,"l":2,"a":[{"t":9,"i":2,"l":2,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}"`;
    +exports[`Headers > toCrossJSON > supports Headers 1`] = `"{"t":25,"i":0,"s":{"t":9,"i":1,"a":[{"t":9,"i":2,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":3,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}"`;
     
    -exports[`Headers > toCrossJSONAsync > supports Headers 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":9,"i":2,"l":2,"a":[{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":4,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}}"`;
    +exports[`Headers > toCrossJSONAsync > supports Headers 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":9,"i":2,"a":[{"t":9,"i":3,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":4,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}}"`;
     
     exports[`Headers > toCrossJSONStream > supports Headers 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`Headers > toCrossJSONStream > supports Headers 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":7,"s":2},{"t":25,"i":3,"s":{"t":9,"i":4,"l":2,"a":[{"t":9,"i":5,"l":2,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":6,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}]}"`;
    +exports[`Headers > toCrossJSONStream > supports Headers 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":7,"s":2},{"t":25,"i":3,"s":{"t":9,"i":4,"a":[{"t":9,"i":5,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":6,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}]}"`;
     
    -exports[`Headers > toJSON > supports Headers 1`] = `"{"t":{"t":25,"i":0,"s":{"t":9,"i":1,"l":2,"a":[{"t":9,"i":2,"l":2,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},"f":31,"m":[]}"`;
    +exports[`Headers > toJSON > supports Headers 1`] = `"{"t":{"t":25,"i":0,"s":{"t":9,"i":1,"a":[{"t":9,"i":2,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":3,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},"f":63,"m":[]}"`;
     
    -exports[`Headers > toJSONAsync > supports Headers 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":9,"i":2,"l":2,"a":[{"t":9,"i":3,"l":2,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":4,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}},"f":31,"m":[]}"`;
    +exports[`Headers > toJSONAsync > supports Headers 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":9,"i":2,"a":[{"t":9,"i":3,"a":[{"t":1,"s":"content-encoding"},{"t":1,"s":"gzip"}],"o":0},{"t":9,"i":4,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"}},"f":63,"m":[]}"`;
    
  • packages/plugins/tests/web/__snapshots__/readable-stream.test.ts.snap+4 4 modified
    @@ -904,7 +904,7 @@ exports[`ReadableStream > serializeAsync > supports ReadableStream errors 2`] =
     
     exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[{"t":32,"i":2,"f":{"t":1,"s":"foo"}},{"t":32,"i":2,"f":{"t":1,"s":"bar"}},{"t":32,"i":2,"f":{"t":1,"s":"baz"}},{"t":34,"i":2,"f":{"t":2,"s":1}}],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"}"`;
     
    -exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[{"t":33,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"}"`;
    +exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[{"t":33,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}}],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"}"`;
     
     exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 2`] = `[Error: Oops!]`;
     
    @@ -920,10 +920,10 @@ exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 5`] = `"{"
     
     exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 1`] = `"{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"}"`;
     
    -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 2`] = `"{"t":33,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}"`;
    +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 2`] = `"{"t":33,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}}"`;
     
    -exports[`ReadableStream > toJSONAsync > supports ReadableStream 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[{"t":32,"i":2,"f":{"t":1,"s":"foo"}},{"t":32,"i":2,"f":{"t":1,"s":"bar"}},{"t":32,"i":2,"f":{"t":1,"s":"baz"}},{"t":34,"i":2,"f":{"t":2,"s":1}}],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},"f":31,"m":[2]}"`;
    +exports[`ReadableStream > toJSONAsync > supports ReadableStream 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[{"t":32,"i":2,"f":{"t":1,"s":"foo"}},{"t":32,"i":2,"f":{"t":1,"s":"bar"}},{"t":32,"i":2,"f":{"t":1,"s":"baz"}},{"t":34,"i":2,"f":{"t":2,"s":1}}],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},"f":63,"m":[2]}"`;
     
    -exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[{"t":33,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},"f":31,"m":[2]}"`;
    +exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 1`] = `"{"t":{"t":25,"i":0,"s":{"factory":{"t":25,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":2,"a":[{"t":33,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}}],"f":{"t":26,"i":3,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},"f":63,"m":[2]}"`;
     
     exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 2`] = `[Error: Oops!]`;
    
  • packages/plugins/tests/web/__snapshots__/request.test.ts.snap+23 17 modified
    @@ -1,36 +1,39 @@
     // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
     
     exports[`Request > crossSerializeAsync > scoped > supports Request 1`] = `
    -"($R=>$R[0]=new Request("http://localhost:3000/",$R[1]={body:$R[2]=($R[3]=(length, b64) => {
    +"($R=>$R[0]=new Request("http://localhost:3000/",$R[1]={body:$R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""}))($R["example"])"
    +})("SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""}))($R["example"])"
     `;
     
     exports[`Request > crossSerializeAsync > supports Request 1`] = `
    -"$R[0]=new Request("http://localhost:3000/",$R[1]={body:$R[2]=($R[3]=(length, b64) => {
    +"$R[0]=new Request("http://localhost:3000/",$R[1]={body:$R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""})"
    +})("SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""})"
     `;
     
     exports[`Request > crossSerializeAsync > supports already read Request 1`] = `
    -"$R[0]=new Request("http://localhost:3000/",$R[1]={body:$R[2]=($R[3]=(length, b64) => {
    +"$R[0]=new Request("http://localhost:3000/",$R[1]={body:$R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""})"
    +})("SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""})"
     `;
     
     exports[`Request > crossSerializeStream > scoped > supports Request 1`] = `
    @@ -122,14 +125,15 @@ exports[`Request > crossSerializeStream > scoped > supports Request 1`] = `
     `;
     
     exports[`Request > crossSerializeStream > scoped > supports Request 2`] = `
    -"($R=>$R[4].next($R[9]=new Uint8Array($R[10]=($R[11]=(length, b64) => {
    +"($R=>$R[4].next($R[9]=new Uint8Array($R[10]=($R[11]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),0,12)))($R["example"])"
    +})("SGVsbG8gV29ybGQh"),0,12)))($R["example"])"
     `;
     
     exports[`Request > crossSerializeStream > scoped > supports Request 3`] = `"($R=>$R[4].return(void 0))($R["example"])"`;
    @@ -223,39 +227,41 @@ exports[`Request > crossSerializeStream > supports Request 1`] = `
     `;
     
     exports[`Request > crossSerializeStream > supports Request 2`] = `
    -"$R[4].next($R[9]=new Uint8Array($R[10]=($R[11]=(length, b64) => {
    +"$R[4].next($R[9]=new Uint8Array($R[10]=($R[11]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),0,12))"
    +})("SGVsbG8gV29ybGQh"),0,12))"
     `;
     
     exports[`Request > crossSerializeStream > supports Request 3`] = `"$R[4].return(void 0)"`;
     
     exports[`Request > serializeAsync > supports Request 1`] = `
    -"new Request("http://localhost:3000/",{body:((length, b64) => {
    +"new Request("http://localhost:3000/",{body:((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:new Headers([["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""})"
    +})("SGVsbG8gV29ybGQh"),cache:"default",credentials:"same-origin",headers:new Headers([["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""})"
     `;
     
     exports[`Request > serializeAsync > supports already read Request 1`] = `"new Request("http://localhost:3000/",{body:null,cache:"default",credentials:"same-origin",headers:new Headers([["content-type","text/plain;charset=UTF-8"]]),integrity:"",keepalive:!1,method:"POST",mode:"cors",redirect:"follow",referrer:"about:client",referrerPolicy:""})"`;
     
    -exports[`Request > toCrossJSONStream > supports Request 1`] = `"{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":25,"i":2,"s":{"factory":{"t":25,"i":3,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":6,"s":{"t":9,"i":7,"l":1,"a":[{"t":9,"i":8,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}],"s":11},"o":0}},"c":"seroval-plugins/web/Request"}"`;
    +exports[`Request > toCrossJSONStream > supports Request 1`] = `"{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":25,"i":2,"s":{"factory":{"t":25,"i":3,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":6,"s":{"t":9,"i":7,"a":[{"t":9,"i":8,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Request"}"`;
     
    -exports[`Request > toCrossJSONStream > supports Request 2`] = `"{"t":32,"i":4,"f":{"t":15,"i":9,"l":12,"c":"Uint8Array","f":{"t":19,"i":10,"s":"SGVsbG8gV29ybGQh","l":12,"f":{"t":26,"i":11,"s":5}},"b":0}}"`;
    +exports[`Request > toCrossJSONStream > supports Request 2`] = `"{"t":32,"i":4,"f":{"t":15,"i":9,"c":"Uint8Array","f":{"t":19,"i":10,"s":"SGVsbG8gV29ybGQh","f":{"t":26,"i":11,"s":5}},"b":0,"l":12}}"`;
     
     exports[`Request > toCrossJSONStream > supports Request 3`] = `"{"t":34,"i":4,"f":{"t":2,"s":1}}"`;
     
    -exports[`Request > toJSONAsync > supports Request 1`] = `"{"t":{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":19,"i":2,"s":"SGVsbG8gV29ybGQh","l":12,"f":{"t":26,"i":3,"s":5}},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":4,"s":{"t":9,"i":5,"l":1,"a":[{"t":9,"i":6,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}],"s":11},"o":0}},"c":"seroval-plugins/web/Request"},"f":31,"m":[]}"`;
    +exports[`Request > toJSONAsync > supports Request 1`] = `"{"t":{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":19,"i":2,"s":"SGVsbG8gV29ybGQh","f":{"t":26,"i":3,"s":5}},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":4,"s":{"t":9,"i":5,"a":[{"t":9,"i":6,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Request"},"f":63,"m":[]}"`;
     
    -exports[`Request > toJSONAsync > supports Request 2`] = `"{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":19,"i":2,"s":"SGVsbG8gV29ybGQh","l":12,"f":{"t":26,"i":3,"s":5}},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":4,"s":{"t":9,"i":5,"l":1,"a":[{"t":9,"i":6,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}],"s":11},"o":0}},"c":"seroval-plugins/web/Request"}"`;
    +exports[`Request > toJSONAsync > supports Request 2`] = `"{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":19,"i":2,"s":"SGVsbG8gV29ybGQh","f":{"t":26,"i":3,"s":5}},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":4,"s":{"t":9,"i":5,"a":[{"t":9,"i":6,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Request"}"`;
     
    -exports[`Request > toJSONAsync > supports already read Request 1`] = `"{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":2,"s":0},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":2,"s":{"t":9,"i":3,"l":1,"a":[{"t":9,"i":4,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}],"s":11},"o":0}},"c":"seroval-plugins/web/Request"}"`;
    +exports[`Request > toJSONAsync > supports already read Request 1`] = `"{"t":25,"i":0,"s":{"url":{"t":1,"s":"http://localhost:3000/"},"options":{"t":10,"i":1,"p":{"k":["body","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy"],"v":[{"t":2,"s":0},{"t":1,"s":"default"},{"t":1,"s":"same-origin"},{"t":25,"i":2,"s":{"t":9,"i":3,"a":[{"t":9,"i":4,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":1,"s":""},{"t":2,"s":3},{"t":1,"s":"POST"},{"t":1,"s":"cors"},{"t":1,"s":"follow"},{"t":1,"s":"about:client"},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Request"}"`;
    
  • packages/plugins/tests/web/__snapshots__/response.test.ts.snap+21 16 modified
    @@ -1,25 +1,27 @@
     // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
     
     exports[`Response > crossSerializeAsync > scoped > supports Response 1`] = `
    -"($R=>$R[0]=new Response($R[1]=($R[2]=(length, b64) => {
    +"($R=>$R[0]=new Response($R[1]=($R[2]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),$R[3]={headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),status:200,statusText:""}))($R["example"])"
    +})("SGVsbG8gV29ybGQh"),$R[3]={headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),status:200,statusText:""}))($R["example"])"
     `;
     
     exports[`Response > crossSerializeAsync > supports Response 1`] = `
    -"$R[0]=new Response($R[1]=($R[2]=(length, b64) => {
    +"$R[0]=new Response($R[1]=($R[2]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),$R[3]={headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),status:200,statusText:""})"
    +})("SGVsbG8gV29ybGQh"),$R[3]={headers:$R[4]=new Headers($R[5]=[$R[6]=["content-type","text/plain;charset=UTF-8"]]),status:200,statusText:""})"
     `;
     
     exports[`Response > crossSerializeStream > scoped > supports Response 1`] = `
    @@ -111,14 +113,15 @@ exports[`Response > crossSerializeStream > scoped > supports Response 1`] = `
     `;
     
     exports[`Response > crossSerializeStream > scoped > supports Response 2`] = `
    -"($R=>$R[3].next($R[9]=new Uint8Array($R[10]=($R[11]=(length, b64) => {
    +"($R=>$R[3].next($R[9]=new Uint8Array($R[10]=($R[11]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),0,12)))($R["example"])"
    +})("SGVsbG8gV29ybGQh"),0,12)))($R["example"])"
     `;
     
     exports[`Response > crossSerializeStream > scoped > supports Response 3`] = `"($R=>$R[3].return(void 0))($R["example"])"`;
    @@ -212,41 +215,43 @@ exports[`Response > crossSerializeStream > supports Response 1`] = `
     `;
     
     exports[`Response > crossSerializeStream > supports Response 2`] = `
    -"$R[3].next($R[9]=new Uint8Array($R[10]=($R[11]=(length, b64) => {
    +"$R[3].next($R[9]=new Uint8Array($R[10]=($R[11]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),0,12))"
    +})("SGVsbG8gV29ybGQh"),0,12))"
     `;
     
     exports[`Response > crossSerializeStream > supports Response 3`] = `"$R[3].return(void 0)"`;
     
     exports[`Response > crossSerializeStream > supports already read Response 1`] = `"$R[0]=new Response(null,$R[1]={headers:$R[2]=new Headers($R[3]=[$R[4]=["content-type","text/plain;charset=UTF-8"]]),status:200,statusText:""})"`;
     
     exports[`Response > serializeAsync > supports Response 1`] = `
    -"new Response(((length, b64) => {
    +"new Response(((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(12,"SGVsbG8gV29ybGQh"),{headers:new Headers([["content-type","text/plain;charset=UTF-8"]]),status:200,statusText:""})"
    +})("SGVsbG8gV29ybGQh"),{headers:new Headers([["content-type","text/plain;charset=UTF-8"]]),status:200,statusText:""})"
     `;
     
    -exports[`Response > supports already read Response 1`] = `"{"t":25,"i":0,"s":{"body":{"t":2,"s":0},"options":{"t":10,"i":1,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":2,"s":{"t":9,"i":3,"l":1,"a":[{"t":9,"i":4,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}],"s":3},"o":0}},"c":"seroval-plugins/web/Response"}"`;
    +exports[`Response > supports already read Response 1`] = `"{"t":25,"i":0,"s":{"body":{"t":2,"s":0},"options":{"t":10,"i":1,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":2,"s":{"t":9,"i":3,"a":[{"t":9,"i":4,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Response"}"`;
     
    -exports[`Response > toCrossJSONStream > supports Response 1`] = `"{"t":25,"i":0,"s":{"body":{"t":25,"i":1,"s":{"factory":{"t":25,"i":2,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":3,"a":[],"f":{"t":26,"i":4,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},"options":{"t":10,"i":5,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":6,"s":{"t":9,"i":7,"l":1,"a":[{"t":9,"i":8,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}],"s":3},"o":0}},"c":"seroval-plugins/web/Response"}"`;
    +exports[`Response > toCrossJSONStream > supports Response 1`] = `"{"t":25,"i":0,"s":{"body":{"t":25,"i":1,"s":{"factory":{"t":25,"i":2,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":31,"i":3,"a":[],"f":{"t":26,"i":4,"s":4}}},"c":"seroval/plugins/web/ReadableStream"},"options":{"t":10,"i":5,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":6,"s":{"t":9,"i":7,"a":[{"t":9,"i":8,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Response"}"`;
     
    -exports[`Response > toCrossJSONStream > supports Response 2`] = `"{"t":32,"i":3,"f":{"t":15,"i":9,"l":12,"c":"Uint8Array","f":{"t":19,"i":10,"s":"SGVsbG8gV29ybGQh","l":12,"f":{"t":26,"i":11,"s":5}},"b":0}}"`;
    +exports[`Response > toCrossJSONStream > supports Response 2`] = `"{"t":32,"i":3,"f":{"t":15,"i":9,"c":"Uint8Array","f":{"t":19,"i":10,"s":"SGVsbG8gV29ybGQh","f":{"t":26,"i":11,"s":5}},"b":0,"l":12}}"`;
     
     exports[`Response > toCrossJSONStream > supports Response 3`] = `"{"t":34,"i":3,"f":{"t":2,"s":1}}"`;
     
    -exports[`Response > toJSONAsync > supports Response 1`] = `"{"t":{"t":25,"i":0,"s":{"body":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQh","l":12,"f":{"t":26,"i":2,"s":5}},"options":{"t":10,"i":3,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":4,"s":{"t":9,"i":5,"l":1,"a":[{"t":9,"i":6,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}],"s":3},"o":0}},"c":"seroval-plugins/web/Response"},"f":31,"m":[]}"`;
    +exports[`Response > toJSONAsync > supports Response 1`] = `"{"t":{"t":25,"i":0,"s":{"body":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQh","f":{"t":26,"i":2,"s":5}},"options":{"t":10,"i":3,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":4,"s":{"t":9,"i":5,"a":[{"t":9,"i":6,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Response"},"f":63,"m":[]}"`;
     
    -exports[`Response > toJSONAsync > supports Response 2`] = `"{"t":25,"i":0,"s":{"body":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQh","l":12,"f":{"t":26,"i":2,"s":5}},"options":{"t":10,"i":3,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":4,"s":{"t":9,"i":5,"l":1,"a":[{"t":9,"i":6,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}],"s":3},"o":0}},"c":"seroval-plugins/web/Response"}"`;
    +exports[`Response > toJSONAsync > supports Response 2`] = `"{"t":25,"i":0,"s":{"body":{"t":19,"i":1,"s":"SGVsbG8gV29ybGQh","f":{"t":26,"i":2,"s":5}},"options":{"t":10,"i":3,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":4,"s":{"t":9,"i":5,"a":[{"t":9,"i":6,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Response"}"`;
     
    -exports[`Response > toJSONAsync > supports already read Response 1`] = `"{"t":{"t":25,"i":0,"s":{"body":{"t":2,"s":0},"options":{"t":10,"i":1,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":2,"s":{"t":9,"i":3,"l":1,"a":[{"t":9,"i":4,"l":2,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}],"s":3},"o":0}},"c":"seroval-plugins/web/Response"},"f":31,"m":[]}"`;
    +exports[`Response > toJSONAsync > supports already read Response 1`] = `"{"t":{"t":25,"i":0,"s":{"body":{"t":2,"s":0},"options":{"t":10,"i":1,"p":{"k":["headers","status","statusText"],"v":[{"t":25,"i":2,"s":{"t":9,"i":3,"a":[{"t":9,"i":4,"a":[{"t":1,"s":"content-type"},{"t":1,"s":"text/plain;charset=UTF-8"}],"o":0}],"o":0},"c":"seroval-plugins/web/Headers"},{"t":0,"s":200},{"t":1,"s":""}]},"o":0}},"c":"seroval-plugins/web/Response"},"f":63,"m":[]}"`;
    
  • packages/plugins/tests/web/__snapshots__/url-search-params.test.ts.snap+2 2 modified
    @@ -62,10 +62,10 @@ exports[`URLSearchParams > toCrossJSONStream > supports URLSearchParams 1`] = `"
     
     exports[`URLSearchParams > toCrossJSONStream > supports URLSearchParams 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":25,"i":3,"s":{"t":1,"s":"hello=world&foo=bar"},"c":"seroval-plugins/web/URLSearchParams"}]}"`;
     
    -exports[`URLSearchParams > toJSON > supports URLSearchParams 1`] = `"{"t":{"t":25,"i":0,"s":{"t":1,"s":"hello=world&foo=bar"},"c":"seroval-plugins/web/URLSearchParams"},"f":31,"m":[]}"`;
    +exports[`URLSearchParams > toJSON > supports URLSearchParams 1`] = `"{"t":{"t":25,"i":0,"s":{"t":1,"s":"hello=world&foo=bar"},"c":"seroval-plugins/web/URLSearchParams"},"f":63,"m":[]}"`;
     
     exports[`URLSearchParams > toJSON > supports URLSearchParams 2`] = `"{"t":25,"i":0,"s":{"t":1,"s":"hello=world&foo=bar"},"c":"seroval-plugins/web/URLSearchParams"}"`;
     
    -exports[`URLSearchParams > toJSONAsync > supports URLSearchParams 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"hello=world&foo=bar"},"c":"seroval-plugins/web/URLSearchParams"}},"f":31,"m":[]}"`;
    +exports[`URLSearchParams > toJSONAsync > supports URLSearchParams 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"hello=world&foo=bar"},"c":"seroval-plugins/web/URLSearchParams"}},"f":63,"m":[]}"`;
     
     exports[`URLSearchParams > toJSONAsync > supports URLSearchParams 2`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"hello=world&foo=bar"},"c":"seroval-plugins/web/URLSearchParams"}}"`;
    
  • packages/plugins/tests/web/__snapshots__/url.test.ts.snap+2 2 modified
    @@ -62,10 +62,10 @@ exports[`URL > toCrossJSONStream > supports URL 1`] = `"{"t":22,"i":0,"s":1,"f":
     
     exports[`URL > toCrossJSONStream > supports URL 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":25,"i":3,"s":{"t":1,"s":"https://github.com/lxsmnsyc/seroval?hello=world"},"c":"seroval-plugins/web/URL"}]}"`;
     
    -exports[`URL > toJSON > supports URL 1`] = `"{"t":{"t":25,"i":0,"s":{"t":1,"s":"https://github.com/lxsmnsyc/seroval?hello=world"},"c":"seroval-plugins/web/URL"},"f":31,"m":[]}"`;
    +exports[`URL > toJSON > supports URL 1`] = `"{"t":{"t":25,"i":0,"s":{"t":1,"s":"https://github.com/lxsmnsyc/seroval?hello=world"},"c":"seroval-plugins/web/URL"},"f":63,"m":[]}"`;
     
     exports[`URL > toJSON > supports URL 2`] = `"{"t":25,"i":0,"s":{"t":1,"s":"https://github.com/lxsmnsyc/seroval?hello=world"},"c":"seroval-plugins/web/URL"}"`;
     
    -exports[`URL > toJSONAsync > supports URL 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"https://github.com/lxsmnsyc/seroval?hello=world"},"c":"seroval-plugins/web/URL"}},"f":31,"m":[]}"`;
    +exports[`URL > toJSONAsync > supports URL 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"https://github.com/lxsmnsyc/seroval?hello=world"},"c":"seroval-plugins/web/URL"}},"f":63,"m":[]}"`;
     
     exports[`URL > toJSONAsync > supports URL 2`] = `"{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"https://github.com/lxsmnsyc/seroval?hello=world"},"c":"seroval-plugins/web/URL"}}"`;
    
  • packages/seroval/CHANGELOG.md+12 0 modified
    @@ -1,5 +1,17 @@
     # seroval
     
    +## 1.4.2
    +
    +### Patch Changes
    +
    +- fix byte lengths
    +
    +## 1.4.1
    +
    +### Patch Changes
    +
    +- 3995cc1: security enhancements
    +
     ## 1.4.0
     
     ### Minor Changes
    
  • packages/seroval/foo.js+0 11 removed
    @@ -1,11 +0,0 @@
    -import { fromJSON, toJSONAsync } from "./dist/esm/development/index.mjs";
    -
    -const p = Promise.resolve('hello');
    -
    -const json = await toJSONAsync([p, p]);
    -
    -console.log(json);
    -
    -const reconst = fromJSON(json);
    -
    -console.log(reconst, reconst[0] === reconst[1]);
    \ No newline at end of file
    
  • packages/seroval/package.json+1 1 modified
    @@ -1,7 +1,7 @@
     {
       "name": "seroval",
       "type": "module",
    -  "version": "1.4.0",
    +  "version": "1.4.2",
       "files": [
         "dist",
         "src"
    
  • packages/seroval/src/core/base-primitives.ts+17 18 modified
    @@ -153,7 +153,6 @@ export function createRegExpNode(
         SerovalNodeType.RegExp,
         id,
         NIL,
    -    NIL,
         serializeString(current.source),
         current.flags,
         NIL,
    @@ -162,6 +161,7 @@ export function createRegExpNode(
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -214,7 +214,6 @@ export function createPluginNode(
         SerovalNodeType.Plugin,
         id,
         value,
    -    NIL,
         serializeString(tag),
         NIL,
         NIL,
    @@ -223,19 +222,19 @@ export function createPluginNode(
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
     export function createArrayNode(
       id: number,
       current: unknown[],
    -  parsedItems: SerovalNode[],
    +  parsedItems: SerovalArrayNode['a'],
     ): SerovalArrayNode {
       return createSerovalNode(
         SerovalNodeType.Array,
         id,
         NIL,
    -    current.length,
         NIL,
         NIL,
         NIL,
    @@ -244,6 +243,7 @@ export function createArrayNode(
         NIL,
         NIL,
         getObjectFlag(current),
    +    NIL,
       );
     }
     
    @@ -260,10 +260,10 @@ export function createBoxedNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         boxed,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -276,7 +276,6 @@ export function createTypedArrayNode(
         SerovalNodeType.TypedArray,
         id,
         NIL,
    -    current.length,
         current.constructor.name,
         NIL,
         NIL,
    @@ -285,6 +284,7 @@ export function createTypedArrayNode(
         buffer,
         current.byteOffset,
         NIL,
    +    current.length,
       );
     }
     
    @@ -297,7 +297,6 @@ export function createBigIntTypedArrayNode(
         SerovalNodeType.BigIntTypedArray,
         id,
         NIL,
    -    current.length,
         current.constructor.name,
         NIL,
         NIL,
    @@ -306,6 +305,7 @@ export function createBigIntTypedArrayNode(
         buffer,
         current.byteOffset,
         NIL,
    +    current.byteLength,
       );
     }
     
    @@ -318,7 +318,6 @@ export function createDataViewNode(
         SerovalNodeType.DataView,
         id,
         NIL,
    -    current.byteLength,
         NIL,
         NIL,
         NIL,
    @@ -327,6 +326,7 @@ export function createDataViewNode(
         buffer,
         current.byteOffset,
         NIL,
    +    current.byteLength,
       );
     }
     
    @@ -340,14 +340,14 @@ export function createErrorNode(
         id,
         getErrorConstructor(current),
         NIL,
    -    NIL,
         serializeString(current.message),
         options,
         NIL,
         NIL,
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -361,27 +361,25 @@ export function createAggregateErrorNode(
         id,
         getErrorConstructor(current),
         NIL,
    -    NIL,
         serializeString(current.message),
         options,
         NIL,
         NIL,
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
     export function createSetNode(
       id: number,
    -  size: number,
       items: SerovalNode[],
     ): SerovalSetNode {
       return createSerovalNode(
         SerovalNodeType.Set,
         id,
         NIL,
    -    size,
         NIL,
         NIL,
         NIL,
    @@ -390,6 +388,7 @@ export function createSetNode(
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -405,11 +404,11 @@ export function createIteratorFactoryInstanceNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         [factory, items],
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -425,11 +424,11 @@ export function createAsyncIteratorFactoryInstanceNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         [factory, items],
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -446,11 +445,11 @@ export function createStreamConstructorNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         sequence,
         factory,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -467,10 +466,10 @@ export function createStreamNextNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         parsed,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -487,10 +486,10 @@ export function createStreamThrowNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         parsed,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -507,9 +506,9 @@ export function createStreamReturnNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         parsed,
         NIL,
         NIL,
    +    NIL,
       );
     }
    
  • packages/seroval/src/core/compat.ts+3 1 modified
    @@ -11,11 +11,13 @@ export enum Feature {
       ErrorPrototypeStack = 0x04,
       ObjectAssign = 0x08,
       BigIntTypedArray = 0x10,
    +  RegExp = 0x20,
     }
     
     export const ALL_ENABLED =
       Feature.AggregateError |
       Feature.ArrowFunction |
       Feature.ErrorPrototypeStack |
       Feature.ObjectAssign |
    -  Feature.BigIntTypedArray;
    +  Feature.BigIntTypedArray |
    +  Feature.RegExp;
    
  • packages/seroval/src/core/constants.ts+18 4 modified
    @@ -1,4 +1,18 @@
    -import { SYM_ASYNC_ITERATOR, SYM_HAS_INSTANCE, SYM_IS_CONCAT_SPREADABLE, SYM_ITERATOR, SYM_MATCH, SYM_MATCH_ALL, SYM_REPLACE, SYM_SEARCH, SYM_SPECIES, SYM_SPLIT, SYM_TO_PRIMITIVE, SYM_TO_STRING_TAG, SYM_UNSCOPABLES } from "./symbols";
    +import {
    +  SYM_ASYNC_ITERATOR,
    +  SYM_HAS_INSTANCE,
    +  SYM_IS_CONCAT_SPREADABLE,
    +  SYM_ITERATOR,
    +  SYM_MATCH,
    +  SYM_MATCH_ALL,
    +  SYM_REPLACE,
    +  SYM_SEARCH,
    +  SYM_SPECIES,
    +  SYM_SPLIT,
    +  SYM_TO_PRIMITIVE,
    +  SYM_TO_STRING_TAG,
    +  SYM_UNSCOPABLES,
    +} from './symbols';
     
     export const enum SerovalConstant {
       Null = 0,
    @@ -133,10 +147,12 @@ export const CONSTANT_STRING: Record<SerovalConstant, string> = {
       [SerovalConstant.Nan]: '0/0',
     };
     
    +export const NIL = void 0;
    +
     export const CONSTANT_VAL: Record<SerovalConstant, unknown> = {
       [SerovalConstant.True]: true,
       [SerovalConstant.False]: false,
    -  [SerovalConstant.Undefined]: undefined,
    +  [SerovalConstant.Undefined]: NIL,
       [SerovalConstant.Null]: null,
       [SerovalConstant.NegZero]: -0,
       [SerovalConstant.Inf]: Number.POSITIVE_INFINITY,
    @@ -183,5 +199,3 @@ export const ERROR_CONSTRUCTOR: Record<ErrorConstructorTag, ErrorConstructors> =
         [ErrorConstructorTag.TypeError]: TypeError,
         [ErrorConstructorTag.URIError]: URIError,
       };
    -
    -export const NIL = undefined;
    
  • packages/seroval/src/core/constructors.ts+2 1 modified
    @@ -256,8 +256,9 @@ export const ASYNC_ITERATOR_CONSTRUCTOR =
     export const SERIALIZED_ASYNC_ITERATOR_CONSTRUCTOR =
       /* @__PURE__ */ ASYNC_ITERATOR_CONSTRUCTOR.toString();
     
    -export const ARRAY_BUFFER_CONSTRUCTOR = (length: number, b64: string) => {
    +export const ARRAY_BUFFER_CONSTRUCTOR = (b64: string) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
    
  • packages/seroval/src/core/context/async-parser.ts+102 50 modified
    @@ -101,45 +101,53 @@ export function createAsyncParserContext(
     }
     
     export class AsyncParsePluginContext {
    -  constructor(private _p: AsyncParserContext) {}
    +  constructor(
    +    private _p: AsyncParserContext,
    +    private depth: number,
    +  ) {}
     
       parse<T>(current: T): Promise<SerovalNode> {
    -    return parseAsync(this._p, current);
    +    return parseAsync(this._p, this.depth, current);
       }
     }
     
     async function parseItems(
       ctx: AsyncParserContext,
    +  depth: number,
       current: unknown[],
    -): Promise<SerovalNode[]> {
    -  const nodes = [];
    +): Promise<(SerovalNode | 0)[]> {
    +  const nodes: (SerovalNode | 0)[] = [];
       for (let i = 0, len = current.length; i < len; i++) {
         // For consistency in holes
         if (i in current) {
    -      nodes[i] = await parseAsync(ctx, current[i]);
    +      nodes[i] = await parseAsync(ctx, depth, current[i]);
    +    } else {
    +      nodes[i] = 0;
         }
       }
       return nodes;
     }
     
     async function parseArray(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: unknown[],
     ): Promise<SerovalArrayNode> {
    -  return createArrayNode(id, current, await parseItems(ctx, current));
    +  return createArrayNode(id, current, await parseItems(ctx, depth, current));
     }
     
     async function parseProperties(
       ctx: AsyncParserContext,
    +  depth: number,
       properties: Record<string | symbol, unknown>,
     ): Promise<SerovalObjectRecordNode> {
       const entries = Object.entries(properties);
       const keyNodes: SerovalObjectRecordKey[] = [];
       const valueNodes: SerovalNode[] = [];
       for (let i = 0, len = entries.length; i < len; i++) {
         keyNodes.push(serializeString(entries[i][0]));
    -    valueNodes.push(await parseAsync(ctx, entries[i][1]));
    +    valueNodes.push(await parseAsync(ctx, depth, entries[i][1]));
       }
       // Check special properties
       if (SYM_ITERATOR in properties) {
    @@ -149,6 +157,7 @@ async function parseProperties(
             parseIteratorFactory(ctx.base),
             await parseAsync(
               ctx,
    +          depth,
               iteratorToSequence(properties as unknown as Iterable<unknown>),
             ),
           ),
    @@ -161,6 +170,7 @@ async function parseProperties(
             parseAsyncIteratorFactory(ctx.base),
             await parseAsync(
               ctx,
    +          depth,
               createStreamFromAsyncIterable(
                 properties as unknown as AsyncIterable<unknown>,
               ),
    @@ -181,12 +191,12 @@ async function parseProperties(
       return {
         k: keyNodes,
         v: valueNodes,
    -    s: keyNodes.length,
       };
     }
     
     async function parsePlainObject(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: Record<string, unknown>,
       empty: boolean,
    @@ -195,105 +205,118 @@ async function parsePlainObject(
         id,
         current,
         empty,
    -    await parseProperties(ctx, current),
    +    await parseProperties(ctx, depth, current),
       );
     }
     
     // TODO: check if parseBoxedSync can be used
     async function parseBoxed(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: object,
     ): Promise<SerovalBoxedNode> {
    -  return createBoxedNode(id, await parseAsync(ctx, current.valueOf()));
    +  return createBoxedNode(id, await parseAsync(ctx, depth, current.valueOf()));
     }
     
     async function parseTypedArray(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: TypedArrayValue,
     ): Promise<SerovalTypedArrayNode> {
       return createTypedArrayNode(
         id,
         current,
    -    await parseAsync(ctx, current.buffer),
    +    await parseAsync(ctx, depth, current.buffer),
       );
     }
     
     async function parseBigIntTypedArray(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: BigIntTypedArrayValue,
     ): Promise<SerovalBigIntTypedArrayNode> {
       return createBigIntTypedArrayNode(
         id,
         current,
    -    await parseAsync(ctx, current.buffer),
    +    await parseAsync(ctx, depth, current.buffer),
       );
     }
     
     async function parseDataView(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: DataView,
     ): Promise<SerovalDataViewNode> {
    -  return createDataViewNode(id, current, await parseAsync(ctx, current.buffer));
    +  return createDataViewNode(
    +    id,
    +    current,
    +    await parseAsync(ctx, depth, current.buffer),
    +  );
     }
     
     async function parseError(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: Error,
     ): Promise<SerovalErrorNode> {
       const options = getErrorOptions(current, ctx.base.features);
       return createErrorNode(
         id,
         current,
    -    options ? await parseProperties(ctx, options) : NIL,
    +    options ? await parseProperties(ctx, depth, options) : NIL,
       );
     }
     
     async function parseAggregateError(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: AggregateError,
     ): Promise<SerovalAggregateErrorNode> {
       const options = getErrorOptions(current, ctx.base.features);
       return createAggregateErrorNode(
         id,
         current,
    -    options ? await parseProperties(ctx, options) : NIL,
    +    options ? await parseProperties(ctx, depth, options) : NIL,
       );
     }
     
     async function parseMap(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: Map<unknown, unknown>,
     ): Promise<SerovalMapNode> {
       const keyNodes: SerovalNode[] = [];
       const valueNodes: SerovalNode[] = [];
       for (const [key, value] of current.entries()) {
    -    keyNodes.push(await parseAsync(ctx, key));
    -    valueNodes.push(await parseAsync(ctx, value));
    +    keyNodes.push(await parseAsync(ctx, depth, key));
    +    valueNodes.push(await parseAsync(ctx, depth, value));
       }
    -  return createMapNode(ctx.base, id, keyNodes, valueNodes, current.size);
    +  return createMapNode(ctx.base, id, keyNodes, valueNodes);
     }
     
     async function parseSet(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: Set<unknown>,
     ): Promise<SerovalSetNode> {
       const items: SerovalNode[] = [];
       for (const item of current.keys()) {
    -    items.push(await parseAsync(ctx, item));
    +    items.push(await parseAsync(ctx, depth, item));
       }
    -  return createSetNode(id, current.size, items);
    +  return createSetNode(id, items);
     }
     
     async function parsePlugin(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: unknown,
     ): Promise<SerovalPluginNode | undefined> {
    @@ -302,15 +325,16 @@ async function parsePlugin(
         for (let i = 0, len = currentPlugins.length; i < len; i++) {
           const plugin = currentPlugins[i];
           if (plugin.parse.async && plugin.test(current)) {
    -        if (ctx.child == null) {
    -          ctx.child = new AsyncParsePluginContext(ctx);
    -        }
             return createPluginNode(
               id,
               plugin.tag,
    -          await plugin.parse.async(current, ctx.child, {
    -            id,
    -          }),
    +          await plugin.parse.async(
    +            current,
    +            new AsyncParsePluginContext(ctx, depth),
    +            {
    +              id,
    +            },
    +          ),
             );
           }
         }
    @@ -320,6 +344,7 @@ async function parsePlugin(
     
     async function parsePromise(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: Promise<unknown>,
     ): Promise<SerovalPromiseNode> {
    @@ -334,15 +359,16 @@ async function parsePromise(
         NIL,
         NIL,
         NIL,
    +    await parseAsync(ctx, depth, result),
         NIL,
    -    await parseAsync(ctx, result),
         NIL,
         NIL,
       );
     }
     
     function parseStreamHandle<T>(
       this: AsyncParserContext,
    +  depth: number,
       id: number,
       current: Stream<T>,
       resolve: (value: SerovalNode[] | PromiseLike<SerovalNode[]>) => void,
    @@ -353,7 +379,7 @@ function parseStreamHandle<T>(
       const cleanup = current.on({
         next: value => {
           markParserRef(this.base, id);
    -      parseAsync(this, value).then(
    +      parseAsync(this, depth, value).then(
             data => {
               sequence.push(createStreamNextNode(id, data));
             },
    @@ -365,7 +391,7 @@ function parseStreamHandle<T>(
         },
         throw: value => {
           markParserRef(this.base, id);
    -      parseAsync(this, value).then(
    +      parseAsync(this, depth, value).then(
             data => {
               sequence.push(createStreamThrowNode(id, data));
               resolve(sequence);
    @@ -379,7 +405,7 @@ function parseStreamHandle<T>(
         },
         return: value => {
           markParserRef(this.base, id);
    -      parseAsync(this, value).then(
    +      parseAsync(this, depth, value).then(
             data => {
               sequence.push(createStreamReturnNode(id, data));
               resolve(sequence);
    @@ -396,70 +422,75 @@ function parseStreamHandle<T>(
     
     async function parseStream(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: Stream<unknown>,
     ): Promise<SerovalStreamConstructorNode> {
       return createStreamConstructorNode(
         id,
         parseSpecialReference(ctx.base, SpecialReference.StreamConstructor),
    -    await new Promise<SerovalNode[]>(parseStreamHandle.bind(ctx, id, current)),
    +    await new Promise<SerovalNode[]>(
    +      parseStreamHandle.bind(ctx, depth, id, current),
    +    ),
       );
     }
     
     export async function parseObjectAsync(
       ctx: AsyncParserContext,
    +  depth: number,
       id: number,
       current: object,
     ): Promise<SerovalNode> {
       if (Array.isArray(current)) {
    -    return parseArray(ctx, id, current);
    +    return parseArray(ctx, depth, id, current);
       }
       if (isStream(current)) {
    -    return parseStream(ctx, id, current);
    +    return parseStream(ctx, depth, id, current);
       }
       const currentClass = current.constructor;
       if (currentClass === OpaqueReference) {
         return parseAsync(
           ctx,
    +      depth,
           (current as OpaqueReference<unknown, unknown>).replacement,
         );
       }
    -  const parsed = await parsePlugin(ctx, id, current);
    +  const parsed = await parsePlugin(ctx, depth, id, current);
       if (parsed) {
         return parsed;
       }
       switch (currentClass) {
         case Object:
           return parsePlainObject(
             ctx,
    +        depth,
             id,
             current as Record<string, unknown>,
             false,
           );
         case NIL:
           return parsePlainObject(
             ctx,
    +        depth,
             id,
             current as Record<string, unknown>,
             true,
           );
         case Date:
           return createDateNode(id, current as unknown as Date);
    -    case RegExp:
    -      return createRegExpNode(id, current as unknown as RegExp);
         case Error:
         case EvalError:
         case RangeError:
         case ReferenceError:
         case SyntaxError:
         case TypeError:
         case URIError:
    -      return parseError(ctx, id, current as unknown as Error);
    +      return parseError(ctx, depth, id, current as unknown as Error);
         case Number:
         case Boolean:
         case String:
         case BigInt:
    -      return parseBoxed(ctx, id, current);
    +      return parseBoxed(ctx, depth, id, current);
         case ArrayBuffer:
           return createArrayBufferNode(
             ctx.base,
    @@ -475,28 +506,42 @@ export async function parseObjectAsync(
         case Uint8ClampedArray:
         case Float32Array:
         case Float64Array:
    -      return parseTypedArray(ctx, id, current as unknown as TypedArrayValue);
    +      return parseTypedArray(
    +        ctx,
    +        depth,
    +        id,
    +        current as unknown as TypedArrayValue,
    +      );
         case DataView:
    -      return parseDataView(ctx, id, current as unknown as DataView);
    +      return parseDataView(ctx, depth, id, current as unknown as DataView);
         case Map:
    -      return parseMap(ctx, id, current as unknown as Map<unknown, unknown>);
    +      return parseMap(
    +        ctx,
    +        depth,
    +        id,
    +        current as unknown as Map<unknown, unknown>,
    +      );
         case Set:
    -      return parseSet(ctx, id, current as unknown as Set<unknown>);
    +      return parseSet(ctx, depth, id, current as unknown as Set<unknown>);
         default:
           break;
       }
       // Promises
       if (currentClass === Promise || current instanceof Promise) {
    -    return parsePromise(ctx, id, current as unknown as Promise<unknown>);
    +    return parsePromise(ctx, depth, id, current as unknown as Promise<unknown>);
       }
       const currentFeatures = ctx.base.features;
    +  if (currentFeatures & Feature.RegExp && currentClass === RegExp) {
    +    return createRegExpNode(id, current as unknown as RegExp);
    +  }
       // BigInt Typed Arrays
       if (currentFeatures & Feature.BigIntTypedArray) {
         switch (currentClass) {
           case BigInt64Array:
           case BigUint64Array:
             return parseBigIntTypedArray(
               ctx,
    +          depth,
               id,
               current as unknown as BigIntTypedArrayValue,
             );
    @@ -509,30 +554,36 @@ export async function parseObjectAsync(
         typeof AggregateError !== 'undefined' &&
         (currentClass === AggregateError || current instanceof AggregateError)
       ) {
    -    return parseAggregateError(ctx, id, current as unknown as AggregateError);
    +    return parseAggregateError(
    +      ctx,
    +      depth,
    +      id,
    +      current as unknown as AggregateError,
    +    );
       }
       // Slow path. We only need to handle Errors and Iterators
       // since they have very broad implementations.
       if (current instanceof Error) {
    -    return parseError(ctx, id, current);
    +    return parseError(ctx, depth, id, current);
       }
       // Generator functions don't have a global constructor
       // despite existing
       if (SYM_ITERATOR in current || SYM_ASYNC_ITERATOR in current) {
    -    return parsePlainObject(ctx, id, current, !!currentClass);
    +    return parsePlainObject(ctx, depth, id, current, !!currentClass);
       }
       throw new SerovalUnsupportedTypeError(current);
     }
     
     export async function parseFunctionAsync(
       ctx: AsyncParserContext,
    +  depth: number,
       current: unknown,
     ): Promise<SerovalNode> {
       const ref = getReferenceNode(ctx.base, current);
       if (ref.type !== ParserNodeType.Fresh) {
         return ref.value;
       }
    -  const plugin = await parsePlugin(ctx, ref.value, current);
    +  const plugin = await parsePlugin(ctx, depth, ref.value, current);
       if (plugin) {
         return plugin;
       }
    @@ -541,6 +592,7 @@ export async function parseFunctionAsync(
     
     export async function parseAsync<T>(
       ctx: AsyncParserContext,
    +  depth: number,
       current: T,
     ): Promise<SerovalNode> {
       switch (typeof current) {
    @@ -558,15 +610,15 @@ export async function parseAsync<T>(
           if (current) {
             const ref = getReferenceNode(ctx.base, current);
             return ref.type === 0
    -          ? await parseObjectAsync(ctx, ref.value, current as object)
    +          ? await parseObjectAsync(ctx, depth + 1, ref.value, current as object)
               : ref.value;
           }
           return NULL_NODE;
         }
         case 'symbol':
           return parseWellKnownSymbol(ctx.base, current);
         case 'function':
    -      return parseFunctionAsync(ctx, current);
    +      return parseFunctionAsync(ctx, depth, current);
         default:
           throw new SerovalUnsupportedTypeError(current);
       }
    @@ -577,7 +629,7 @@ export async function parseTopAsync<T>(
       current: T,
     ): Promise<SerovalNode> {
       try {
    -    return await parseAsync(ctx, current);
    +    return await parseAsync(ctx, 0, current);
       } catch (error) {
         throw error instanceof SerovalParserError
           ? error
    
  • packages/seroval/src/core/context/deserializer.ts+269 105 modified
    @@ -1,6 +1,8 @@
    +import { ALL_ENABLED, Feature } from '../compat';
     import {
       CONSTANT_VAL,
       ERROR_CONSTRUCTOR,
    +  NIL,
       SerovalNodeType,
       SerovalObjectFlags,
       SYMBOL_REF,
    @@ -11,7 +13,9 @@ import {
       type PromiseConstructorResolver,
     } from '../constructors';
     import {
    +  SerovalDepthLimitError,
       SerovalDeserializationError,
    +  SerovalMalformedNodeError,
       SerovalMissingInstanceError,
       SerovalMissingPluginError,
       SerovalUnsupportedNodeError,
    @@ -20,8 +24,14 @@ import type { PluginAccessOptions } from '../plugin';
     import { SerovalMode } from '../plugin';
     import { getReference } from '../reference';
     import type { Stream } from '../stream';
    -import { createStream, streamToAsyncIterable } from '../stream';
    +import { createStream, isStream, streamToAsyncIterable } from '../stream';
     import { deserializeString } from '../string';
    +import {
    +  SYM_ASYNC_ITERATOR,
    +  SYM_IS_CONCAT_SPREADABLE,
    +  SYM_ITERATOR,
    +  SYM_TO_STRING_TAG,
    +} from '../symbols';
     import type {
       SerovalAggregateErrorNode,
       SerovalArrayBufferNode,
    @@ -39,7 +49,6 @@ import type {
       SerovalNode,
       SerovalNullConstructorNode,
       SerovalObjectNode,
    -  SerovalObjectRecordKey,
       SerovalObjectRecordNode,
       SerovalPluginNode,
       SerovalPromiseConstructorNode,
    @@ -63,6 +72,10 @@ import type {
     } from '../utils/typed-array';
     import { getTypedArrayConstructor } from '../utils/typed-array';
     
    +const MAX_BASE64_LENGTH = 1_000_000; // ~0.75MB decoded
    +const MAX_BIGINT_LENGTH = 10_000;
    +const MAX_REGEXP_SOURCE_LENGTH = 20_000;
    +
     function applyObjectFlag(obj: unknown, flag: SerovalObjectFlags): unknown {
       switch (flag) {
         case SerovalObjectFlags.Frozen:
    @@ -81,6 +94,9 @@ type AssignableNode = SerovalAggregateErrorNode | SerovalErrorNode;
     
     export interface BaseDeserializerContextOptions extends PluginAccessOptions {
       refs?: Map<number, unknown>;
    +  features?: number;
    +  disabledFeatures?: number;
    +  depthLimit?: number;
     }
     
     export interface BaseDeserializerContext extends PluginAccessOptions {
    @@ -89,8 +105,12 @@ export interface BaseDeserializerContext extends PluginAccessOptions {
        * Mapping ids to values
        */
       refs: Map<number, unknown>;
    +  features: number;
    +  depthLimit: number;
     }
     
    +const DEFAULT_DEPTH_LIMIT = 1000;
    +
     export function createBaseDeserializerContext(
       mode: SerovalMode,
       options: BaseDeserializerContextOptions,
    @@ -99,6 +119,8 @@ export function createBaseDeserializerContext(
         mode,
         plugins: options.plugins,
         refs: options.refs || new Map(),
    +    features: options.features ?? ALL_ENABLED ^ (options.disabledFeatures || 0),
    +    depthLimit: options.depthLimit || DEFAULT_DEPTH_LIMIT,
       };
     }
     
    @@ -124,7 +146,7 @@ export function createVanillaDeserializerContext(
       return {
         mode: SerovalMode.Vanilla,
         base: createBaseDeserializerContext(SerovalMode.Vanilla, options),
    -    child: undefined,
    +    child: NIL,
         state: {
           marked: new Set(options.markedRefs),
         },
    @@ -145,7 +167,7 @@ export function createCrossDeserializerContext(
       return {
         mode: SerovalMode.Cross,
         base: createBaseDeserializerContext(SerovalMode.Cross, options),
    -    child: undefined,
    +    child: NIL,
       };
     }
     
    @@ -154,10 +176,25 @@ type DeserializerContext =
       | CrossDeserializerContext;
     
     export class DeserializePluginContext {
    -  constructor(private _p: DeserializerContext) {}
    +  constructor(
    +    private _p: DeserializerContext,
    +    private depth: number,
    +  ) {}
     
       deserialize<T>(node: SerovalNode): T {
    -    return deserialize(this._p, node) as T;
    +    return deserialize(this._p, this.depth, node) as T;
    +  }
    +}
    +
    +function guardIndexedValue(ctx: BaseDeserializerContext, id: number): void {
    +  if (id < 0 || !Number.isFinite(id) || !Number.isInteger(id)) {
    +    throw new SerovalMalformedNodeError({
    +      t: SerovalNodeType.IndexedValue,
    +      i: id,
    +    } as SerovalNode);
    +  }
    +  if (ctx.refs.has(id)) {
    +    throw new Error('Conflicted ref id: ' + id);
       }
     }
     
    @@ -166,6 +203,7 @@ function assignIndexedValueVanilla<T>(
       id: number,
       value: T,
     ): T {
    +  guardIndexedValue(ctx.base, id);
       if (ctx.state.marked.has(id)) {
         ctx.base.refs.set(id, value);
       }
    @@ -177,9 +215,8 @@ function assignIndexedValueCross<T>(
       id: number,
       value: T,
     ): T {
    -  if (!ctx.base.refs.has(id)) {
    -    ctx.base.refs.set(id, value);
    -  }
    +  guardIndexedValue(ctx.base, id);
    +  ctx.base.refs.set(id, value);
       return value;
     }
     
    @@ -193,6 +230,16 @@ function assignIndexedValue<T>(
         : assignIndexedValueCross(ctx, id, value);
     }
     
    +function deserializeKnownValue<
    +  T extends Record<string, unknown>,
    +  K extends keyof T,
    +>(node: SerovalNode, record: T, key: K): T[K] {
    +  if (Object.hasOwn(record, key)) {
    +    return record[key];
    +  }
    +  throw new SerovalMalformedNodeError(node);
    +}
    +
     function deserializeReference(
       ctx: DeserializerContext,
       node: SerovalReferenceNode,
    @@ -206,48 +253,116 @@ function deserializeReference(
     
     function deserializeArray(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalArrayNode,
     ): unknown[] {
    -  const len = node.l;
    +  const items = node.a;
    +  const len = items.length;
       const result: unknown[] = assignIndexedValue(
         ctx,
         node.i,
         new Array<unknown>(len),
       );
    -  let item: SerovalNode | undefined;
    -  for (let i = 0; i < len; i++) {
    -    item = node.a[i];
    +  for (let i = 0, item: SerovalNode | 0; i < len; i++) {
    +    item = items[i];
         if (item) {
    -      result[i] = deserialize(ctx, item);
    +      result[i] = deserialize(ctx, depth, item);
         }
       }
       applyObjectFlag(result, node.o);
       return result;
     }
     
    +function isValidKey(key: string): boolean {
    +  switch (key) {
    +    case 'constructor':
    +    case '__proto__':
    +    case 'prototype':
    +    case '__defineGetter__':
    +    case '__defineSetter__':
    +    case '__lookupGetter__':
    +    case '__lookupSetter__':
    +      // case 'then':
    +      return false;
    +    default:
    +      return true;
    +  }
    +}
    +
    +function isValidSymbol(symbol: symbol): boolean {
    +  switch (symbol) {
    +    case SYM_ASYNC_ITERATOR:
    +    case SYM_IS_CONCAT_SPREADABLE:
    +    case SYM_TO_STRING_TAG:
    +    case SYM_ITERATOR:
    +      return true;
    +    default:
    +      return false;
    +  }
    +}
    +
    +function assignStringProperty(
    +  object: Record<string | symbol, unknown>,
    +  key: string,
    +  value: unknown,
    +): void {
    +  if (isValidKey(key)) {
    +    object[key] = value;
    +  } else {
    +    Object.defineProperty(object, key, {
    +      value,
    +      configurable: true,
    +      enumerable: true,
    +      writable: true,
    +    });
    +  }
    +}
    +
    +function assignProperty(
    +  ctx: DeserializerContext,
    +  depth: number,
    +  object: Record<string | symbol, unknown>,
    +  key: string | SerovalNode,
    +  value: SerovalNode,
    +): void {
    +  if (typeof key === 'string') {
    +    assignStringProperty(object, key, deserialize(ctx, depth, value));
    +  } else {
    +    const actual = deserialize(ctx, depth, key);
    +    switch (typeof actual) {
    +      case 'string':
    +        assignStringProperty(object, actual, deserialize(ctx, depth, value));
    +        break;
    +      case 'symbol':
    +        if (isValidSymbol(actual)) {
    +          object[actual] = deserialize(ctx, depth, value);
    +        }
    +        break;
    +      default:
    +        throw new SerovalMalformedNodeError(key);
    +    }
    +  }
    +}
    +
     function deserializeProperties(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalObjectRecordNode,
       result: Record<string | symbol, unknown>,
     ): Record<string | symbol, unknown> {
    -  const len = node.s;
    -  if (len) {
    -    const keys = node.k;
    -    const vals = node.v;
    -    for (let i = 0, key: SerovalObjectRecordKey; i < len; i++) {
    -      key = keys[i];
    -      if (typeof key === 'string') {
    -        result[deserializeString(key)] = deserialize(ctx, vals[i]);
    -      } else {
    -        result[deserialize(ctx, key) as symbol] = deserialize(ctx, vals[i]);
    -      }
    +  const keys = node.k;
    +  const len = keys.length;
    +  if (len > 0) {
    +    for (let i = 0, vals = node.v, len = keys.length; i < len; i++) {
    +      assignProperty(ctx, depth, result, keys[i], vals[i]);
         }
       }
       return result;
     }
     
     function deserializeObject(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalObjectNode | SerovalNullConstructorNode,
     ): Record<string, unknown> {
       const result = assignIndexedValue(
    @@ -258,7 +373,7 @@ function deserializeObject(
           unknown
         >,
       );
    -  deserializeProperties(ctx, node.p, result);
    +  deserializeProperties(ctx, depth, node.p, result);
       applyObjectFlag(result, node.o);
       return result;
     }
    @@ -274,34 +389,43 @@ function deserializeRegExp(
       ctx: DeserializerContext,
       node: SerovalRegExpNode,
     ): RegExp {
    -  return assignIndexedValue(
    -    ctx,
    -    node.i,
    -    new RegExp(deserializeString(node.c), node.m),
    -  );
    +  if (ctx.base.features & Feature.RegExp) {
    +    const source = deserializeString(node.c);
    +    if (source.length > MAX_REGEXP_SOURCE_LENGTH) {
    +      throw new SerovalMalformedNodeError(node);
    +    }
    +    return assignIndexedValue(ctx, node.i, new RegExp(source, node.m));
    +  }
    +  throw new SerovalUnsupportedNodeError(node);
     }
     
     function deserializeSet(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalSetNode,
     ): Set<unknown> {
       const result = assignIndexedValue(ctx, node.i, new Set<unknown>());
    -  const items = node.a;
    -  for (let i = 0, len = node.l; i < len; i++) {
    -    result.add(deserialize(ctx, items[i]));
    +  for (let i = 0, items = node.a, len = items.length; i < len; i++) {
    +    result.add(deserialize(ctx, depth, items[i]));
       }
       return result;
     }
     
     function deserializeMap(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalMapNode,
     ): Map<unknown, unknown> {
       const result = assignIndexedValue(ctx, node.i, new Map<unknown, unknown>());
    -  const keys = node.e.k;
    -  const vals = node.e.v;
    -  for (let i = 0, len = node.e.s; i < len; i++) {
    -    result.set(deserialize(ctx, keys[i]), deserialize(ctx, vals[i]));
    +  for (
    +    let i = 0, keys = node.e.k, vals = node.e.v, len = keys.length;
    +    i < len;
    +    i++
    +  ) {
    +    result.set(
    +      deserialize(ctx, depth, keys[i]),
    +      deserialize(ctx, depth, vals[i]),
    +    );
       }
       return result;
     }
    @@ -310,55 +434,70 @@ function deserializeArrayBuffer(
       ctx: DeserializerContext,
       node: SerovalArrayBufferNode,
     ): ArrayBuffer {
    +  if (node.s.length > MAX_BASE64_LENGTH) {
    +    throw new SerovalMalformedNodeError(node);
    +  }
       const result = assignIndexedValue(
         ctx,
         node.i,
    -    ARRAY_BUFFER_CONSTRUCTOR(node.l, deserializeString(node.s)),
    +    ARRAY_BUFFER_CONSTRUCTOR(deserializeString(node.s)),
       );
       return result;
     }
     
     function deserializeTypedArray(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalTypedArrayNode | SerovalBigIntTypedArrayNode,
     ): TypedArrayValue | BigIntTypedArrayValue {
       const construct = getTypedArrayConstructor(node.c) as Int8ArrayConstructor;
    -  const source = deserialize(ctx, node.f) as ArrayBuffer;
    +  const source = deserialize(ctx, depth, node.f) as ArrayBuffer;
    +  const offset = node.b ?? 0;
    +  if (offset < 0 || offset > source.byteLength) {
    +    throw new SerovalMalformedNodeError(node);
    +  }
       const result = assignIndexedValue(
         ctx,
         node.i,
    -    new construct(source, node.b, node.l),
    +    new construct(source, offset, node.l),
       );
       return result;
     }
     
     function deserializeDataView(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalDataViewNode,
     ): DataView {
    -  const source = deserialize(ctx, node.f) as ArrayBuffer;
    +  const source = deserialize(ctx, depth, node.f) as ArrayBuffer;
    +  const offset = node.b ?? 0;
    +  if (offset < 0 || offset > source.byteLength) {
    +    throw new SerovalMalformedNodeError(node);
    +  }
       const result = assignIndexedValue(
         ctx,
         node.i,
    -    new DataView(source, node.b, node.l),
    +    new DataView(source, offset, node.l),
       );
       return result;
     }
     
     function deserializeDictionary<T extends AssignableValue>(
       ctx: DeserializerContext,
    +  depth: number,
       node: AssignableNode,
       result: T,
     ): T {
       if (node.p) {
    -    const fields = deserializeProperties(ctx, node.p, {});
    -    Object.assign(result, fields);
    +    const fields = deserializeProperties(ctx, depth, node.p, {});
    +    Object.defineProperties(result, Object.getOwnPropertyDescriptors(fields));
       }
       return result;
     }
     
     function deserializeAggregateError(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalAggregateErrorNode,
     ): AggregateError {
       // Serialize the required arguments
    @@ -370,29 +509,31 @@ function deserializeAggregateError(
       // `AggregateError` might've been extended
       // either through class or custom properties
       // Make sure to assign extra properties
    -  return deserializeDictionary(ctx, node, result);
    +  return deserializeDictionary(ctx, depth, node, result);
     }
     
     function deserializeError(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalErrorNode,
     ): Error {
    -  const construct = ERROR_CONSTRUCTOR[node.s];
    +  const construct = deserializeKnownValue(node, ERROR_CONSTRUCTOR, node.s);
       const result = assignIndexedValue(
         ctx,
         node.i,
         new construct(deserializeString(node.m)),
       );
    -  return deserializeDictionary(ctx, node, result);
    +  return deserializeDictionary(ctx, depth, node, result);
     }
     
     function deserializePromise(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalPromiseNode,
     ): Promise<unknown> {
       const deferred = PROMISE_CONSTRUCTOR();
       const result = assignIndexedValue(ctx, node.i, deferred.p);
    -  const deserialized = deserialize(ctx, node.f);
    +  const deserialized = deserialize(ctx, depth, node.f);
       if (node.s) {
         deferred.s(deserialized);
       } else {
    @@ -403,14 +544,20 @@ function deserializePromise(
     
     function deserializeBoxed(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalBoxedNode,
     ): unknown {
    -  // biome-ignore lint/style/useConsistentBuiltinInstantiation: intended
    -  return assignIndexedValue(ctx, node.i, Object(deserialize(ctx, node.f)));
    +  return assignIndexedValue(
    +    ctx,
    +    node.i,
    +    // biome-ignore lint/style/useConsistentBuiltinInstantiation: intended
    +    Object(deserialize(ctx, depth, node.f)),
    +  );
     }
     
     function deserializePlugin(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalPluginNode,
     ): unknown {
       const currentPlugins = ctx.base.plugins;
    @@ -419,13 +566,10 @@ function deserializePlugin(
         for (let i = 0, len = currentPlugins.length; i < len; i++) {
           const plugin = currentPlugins[i];
           if (plugin.tag === tag) {
    -        if (ctx.child == null) {
    -          ctx.child = new DeserializePluginContext(ctx);
    -        }
             return assignIndexedValue(
               ctx,
               node.i,
    -          plugin.deserialize(node.s, ctx.child, {
    +          plugin.deserialize(node.s, new DeserializePluginContext(ctx, depth), {
                 id: node.i,
               }),
             );
    @@ -448,186 +592,206 @@ function deserializePromiseConstructor(
     
     function deserializePromiseResolve(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalPromiseResolveNode,
     ): unknown {
       const deferred = ctx.base.refs.get(node.i) as
         | PromiseConstructorResolver
         | undefined;
       if (deferred) {
    -    deferred.s(deserialize(ctx, node.a[1]));
    -    return undefined;
    +    deferred.s(deserialize(ctx, depth, node.a[1]));
    +    return NIL;
       }
       throw new SerovalMissingInstanceError('Promise');
     }
     
     function deserializePromiseReject(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalPromiseRejectNode,
     ): unknown {
       const deferred = ctx.base.refs.get(node.i) as
         | PromiseConstructorResolver
         | undefined;
       if (deferred) {
    -    deferred.f(deserialize(ctx, node.a[1]));
    -    return undefined;
    +    deferred.f(deserialize(ctx, depth, node.a[1]));
    +    return NIL;
       }
       throw new SerovalMissingInstanceError('Promise');
     }
     
     function deserializeIteratorFactoryInstance(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalIteratorFactoryInstanceNode,
     ): unknown {
    -  deserialize(ctx, node.a[0]);
    -  const source = deserialize(ctx, node.a[1]);
    +  deserialize(ctx, depth, node.a[0]);
    +  const source = deserialize(ctx, depth, node.a[1]);
       return sequenceToIterator(source as Sequence);
     }
     
     function deserializeAsyncIteratorFactoryInstance(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalAsyncIteratorFactoryInstanceNode,
     ): unknown {
    -  deserialize(ctx, node.a[0]);
    -  const source = deserialize(ctx, node.a[1]);
    +  deserialize(ctx, depth, node.a[0]);
    +  const source = deserialize(ctx, depth, node.a[1]);
       return streamToAsyncIterable(source as Stream<any>);
     }
     
     function deserializeStreamConstructor(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalStreamConstructorNode,
     ): unknown {
       const result = assignIndexedValue(ctx, node.i, createStream());
    -  const len = node.a.length;
    +  const items = node.a;
    +  const len = items.length;
       if (len) {
         for (let i = 0; i < len; i++) {
    -      deserialize(ctx, node.a[i]);
    +      deserialize(ctx, depth, items[i]);
         }
       }
       return result;
     }
     
     function deserializeStreamNext(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalStreamNextNode,
     ): unknown {
       const deferred = ctx.base.refs.get(node.i) as Stream<unknown> | undefined;
    -  if (deferred) {
    -    deferred.next(deserialize(ctx, node.f));
    -    return undefined;
    +  if (deferred && isStream(deferred)) {
    +    deferred.next(deserialize(ctx, depth, node.f));
    +    return NIL;
       }
       throw new SerovalMissingInstanceError('Stream');
     }
     
     function deserializeStreamThrow(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalStreamThrowNode,
     ): unknown {
       const deferred = ctx.base.refs.get(node.i) as Stream<unknown> | undefined;
    -  if (deferred) {
    -    deferred.throw(deserialize(ctx, node.f));
    -    return undefined;
    +  if (deferred && isStream(deferred)) {
    +    deferred.throw(deserialize(ctx, depth, node.f));
    +    return NIL;
       }
       throw new SerovalMissingInstanceError('Stream');
     }
     
     function deserializeStreamReturn(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalStreamReturnNode,
     ): unknown {
       const deferred = ctx.base.refs.get(node.i) as Stream<unknown> | undefined;
    -  if (deferred) {
    -    deferred.return(deserialize(ctx, node.f));
    -    return undefined;
    +  if (deferred && isStream(deferred)) {
    +    deferred.return(deserialize(ctx, depth, node.f));
    +    return NIL;
       }
       throw new SerovalMissingInstanceError('Stream');
     }
     
     function deserializeIteratorFactory(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalIteratorFactoryNode,
     ): unknown {
    -  deserialize(ctx, node.f);
    -  return undefined;
    +  deserialize(ctx, depth, node.f);
    +  return NIL;
     }
     
     function deserializeAsyncIteratorFactory(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalAsyncIteratorFactoryNode,
     ): unknown {
    -  deserialize(ctx, node.a[1]);
    -  return undefined;
    +  deserialize(ctx, depth, node.a[1]);
    +  return NIL;
     }
    -export function deserialize(
    +
    +function deserialize(
       ctx: DeserializerContext,
    +  depth: number,
       node: SerovalNode,
     ): unknown {
    +  if (depth > ctx.base.depthLimit) {
    +    throw new SerovalDepthLimitError(ctx.base.depthLimit);
    +  }
    +  depth += 1;
       switch (node.t) {
         case SerovalNodeType.Constant:
    -      return CONSTANT_VAL[node.s];
    +      return deserializeKnownValue(node, CONSTANT_VAL, node.s);
         case SerovalNodeType.Number:
    -      return node.s;
    +      return Number(node.s);
         case SerovalNodeType.String:
    -      return deserializeString(node.s);
    +      return deserializeString(String(node.s));
         case SerovalNodeType.BigInt:
    +      if (String(node.s).length > MAX_BIGINT_LENGTH) {
    +        throw new SerovalMalformedNodeError(node);
    +      }
           return BigInt(node.s);
         case SerovalNodeType.IndexedValue:
           return ctx.base.refs.get(node.i);
         case SerovalNodeType.Reference:
           return deserializeReference(ctx, node);
         case SerovalNodeType.Array:
    -      return deserializeArray(ctx, node);
    +      return deserializeArray(ctx, depth, node);
         case SerovalNodeType.Object:
         case SerovalNodeType.NullConstructor:
    -      return deserializeObject(ctx, node);
    +      return deserializeObject(ctx, depth, node);
         case SerovalNodeType.Date:
           return deserializeDate(ctx, node);
         case SerovalNodeType.RegExp:
           return deserializeRegExp(ctx, node);
         case SerovalNodeType.Set:
    -      return deserializeSet(ctx, node);
    +      return deserializeSet(ctx, depth, node);
         case SerovalNodeType.Map:
    -      return deserializeMap(ctx, node);
    +      return deserializeMap(ctx, depth, node);
         case SerovalNodeType.ArrayBuffer:
           return deserializeArrayBuffer(ctx, node);
         case SerovalNodeType.BigIntTypedArray:
         case SerovalNodeType.TypedArray:
    -      return deserializeTypedArray(ctx, node);
    +      return deserializeTypedArray(ctx, depth, node);
         case SerovalNodeType.DataView:
    -      return deserializeDataView(ctx, node);
    +      return deserializeDataView(ctx, depth, node);
         case SerovalNodeType.AggregateError:
    -      return deserializeAggregateError(ctx, node);
    +      return deserializeAggregateError(ctx, depth, node);
         case SerovalNodeType.Error:
    -      return deserializeError(ctx, node);
    +      return deserializeError(ctx, depth, node);
         case SerovalNodeType.Promise:
    -      return deserializePromise(ctx, node);
    +      return deserializePromise(ctx, depth, node);
         case SerovalNodeType.WKSymbol:
    -      return SYMBOL_REF[node.s];
    +      return deserializeKnownValue(node, SYMBOL_REF, node.s);
         case SerovalNodeType.Boxed:
    -      return deserializeBoxed(ctx, node);
    +      return deserializeBoxed(ctx, depth, node);
         case SerovalNodeType.Plugin:
    -      return deserializePlugin(ctx, node);
    +      return deserializePlugin(ctx, depth, node);
         case SerovalNodeType.PromiseConstructor:
           return deserializePromiseConstructor(ctx, node);
         case SerovalNodeType.PromiseSuccess:
    -      return deserializePromiseResolve(ctx, node);
    +      return deserializePromiseResolve(ctx, depth, node);
         case SerovalNodeType.PromiseFailure:
    -      return deserializePromiseReject(ctx, node);
    +      return deserializePromiseReject(ctx, depth, node);
         case SerovalNodeType.IteratorFactoryInstance:
    -      return deserializeIteratorFactoryInstance(ctx, node);
    +      return deserializeIteratorFactoryInstance(ctx, depth, node);
         case SerovalNodeType.AsyncIteratorFactoryInstance:
    -      return deserializeAsyncIteratorFactoryInstance(ctx, node);
    +      return deserializeAsyncIteratorFactoryInstance(ctx, depth, node);
         case SerovalNodeType.StreamConstructor:
    -      return deserializeStreamConstructor(ctx, node);
    +      return deserializeStreamConstructor(ctx, depth, node);
         case SerovalNodeType.StreamNext:
    -      return deserializeStreamNext(ctx, node);
    +      return deserializeStreamNext(ctx, depth, node);
         case SerovalNodeType.StreamThrow:
    -      return deserializeStreamThrow(ctx, node);
    +      return deserializeStreamThrow(ctx, depth, node);
         case SerovalNodeType.StreamReturn:
    -      return deserializeStreamReturn(ctx, node);
    +      return deserializeStreamReturn(ctx, depth, node);
         case SerovalNodeType.IteratorFactory:
    -      return deserializeIteratorFactory(ctx, node);
    +      return deserializeIteratorFactory(ctx, depth, node);
         case SerovalNodeType.AsyncIteratorFactory:
    -      return deserializeAsyncIteratorFactory(ctx, node);
    +      return deserializeAsyncIteratorFactory(ctx, depth, node);
         // case SerovalNodeType.SpecialReference:
         default:
           throw new SerovalUnsupportedNodeError(node);
    @@ -639,7 +803,7 @@ export function deserializeTop(
       node: SerovalNode,
     ): unknown {
       try {
    -    return deserialize(ctx, node);
    +    return deserialize(ctx, 0, node);
       } catch (error) {
         throw new SerovalDeserializationError(error);
       }
    
  • packages/seroval/src/core/context/parser.ts+12 10 modified
    @@ -38,6 +38,7 @@ import { getObjectFlag } from '../utils/get-object-flag';
     export interface BaseParserContextOptions extends PluginAccessOptions {
       disabledFeatures?: number;
       refs?: Map<unknown, number>;
    +  depthLimit?: number;
     }
     
     export const enum ParserNodeType {
    @@ -71,6 +72,8 @@ export interface BaseParserContext extends PluginAccessOptions {
       refs: Map<unknown, number>;
     
       features: number;
    +
    +  depthLimit: number;
     }
     
     export function createBaseParserContext(
    @@ -83,6 +86,7 @@ export function createBaseParserContext(
         marked: new Set(),
         features: ALL_ENABLED ^ (options.disabledFeatures || 0),
         refs: options.refs || new Map(),
    +    depthLimit: options.depthLimit || 1000,
       };
     }
     
    @@ -206,10 +210,10 @@ export function parseIteratorFactory(
         NIL,
         NIL,
         NIL,
    -    NIL,
         parseWellKnownSymbol(ctx, SYM_ITERATOR),
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -228,14 +232,14 @@ export function parseAsyncIteratorFactory(
         NIL,
         NIL,
         NIL,
    -    NIL,
         [
           parseSpecialReference(ctx, SpecialReference.PromiseConstructor),
           parseWellKnownSymbol(ctx, SYM_ASYNC_ITERATOR),
         ],
         NIL,
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -251,13 +255,13 @@ export function createObjectNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         record,
         NIL,
         NIL,
         NIL,
         NIL,
         getObjectFlag(current),
    +    NIL,
       );
     }
     
    @@ -266,7 +270,6 @@ export function createMapNode(
       id: number,
       k: SerovalNode[],
       v: SerovalNode[],
    -  s: number,
     ): SerovalMapNode {
       return createSerovalNode(
         SerovalNodeType.Map,
    @@ -275,12 +278,12 @@ export function createMapNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
    -    { k, v, s },
    +    { k, v },
         NIL,
         parseSpecialReference(ctx, SpecialReference.MapSentinel),
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -298,10 +301,10 @@ export function createPromiseConstructorNode(
         NIL,
         NIL,
         NIL,
    -    NIL,
         parseSpecialReference(ctx, SpecialReference.PromiseConstructor),
         NIL,
         NIL,
    +    NIL,
       );
     }
     
    @@ -311,16 +314,14 @@ export function createArrayBufferNode(
       current: ArrayBuffer,
     ): SerovalArrayBufferNode {
       const bytes = new Uint8Array(current);
    -  const len = bytes.length;
       let result = '';
    -  for (let i = 0; i < len; i++) {
    +  for (let i = 0, len = bytes.length; i < len; i++) {
         result += String.fromCharCode(bytes[i]);
       }
       return createSerovalNode(
         SerovalNodeType.ArrayBuffer,
         id,
         serializeString(btoa(result)),
    -    len,
         NIL,
         NIL,
         NIL,
    @@ -329,5 +330,6 @@ export function createArrayBufferNode(
         parseSpecialReference(ctx, SpecialReference.ArrayBufferConstructor),
         NIL,
         NIL,
    +    NIL,
       );
     }
    
  • packages/seroval/src/core/context/serializer.ts+31 36 modified
    @@ -282,7 +282,7 @@ export function createVanillaSerializerContext(
         mode: SerovalMode.Vanilla,
         base: createBaseSerializerContext(SerovalMode.Vanilla, options),
         state: createVanillaSerializerState(),
    -    child: undefined,
    +    child: NIL,
       };
     }
     
    @@ -306,7 +306,7 @@ export function createCrossSerializerContext(
         mode: SerovalMode.Cross,
         base: createBaseSerializerContext(SerovalMode.Cross, options),
         state: options,
    -    child: undefined,
    +    child: NIL,
       };
     }
     
    @@ -531,7 +531,7 @@ function serializeReference(node: SerovalReferenceNode): string {
     function serializeArrayItem(
       ctx: SerializerContext,
       id: number,
    -  item: SerovalNode | undefined,
    +  item: SerovalNode | 0,
       index: number,
     ): string {
       // Check if index is a hole
    @@ -557,15 +557,16 @@ function serializeArray(
       node: SerovalArrayNode,
     ): string {
       const id = node.i;
    -  if (node.l) {
    +  const list = node.a;
    +  const len = list.length;
    +  if (len > 0) {
         ctx.base.stack.push(id);
    -    const list = node.a;
         let values = serializeArrayItem(ctx, id, list[0], 0);
         // This is different than Map and Set
         // because we also need to serialize
         // the holes of the Array
         let isHoley = values === '';
    -    for (let i = 1, len = node.l, item: string; i < len; i++) {
    +    for (let i = 1, item: string; i < len; i++) {
           item = serializeArrayItem(ctx, id, list[i], i);
           values += ',' + item;
           isHoley = item === '';
    @@ -625,9 +626,9 @@ function serializeProperties(
       source: SerovalNodeWithProperties,
       record: SerovalObjectRecordNode,
     ): string {
    -  const len = record.s;
    -  if (len) {
    -    const keys = record.k;
    +  const keys = record.k;
    +  const len = keys.length;
    +  if (len > 0) {
         const values = record.v;
         ctx.base.stack.push(source.i);
         let result = serializeProperty(ctx, source, keys[0], values[0]);
    @@ -742,10 +743,10 @@ function serializeAssignments(
       source: SerovalNodeWithProperties,
       node: SerovalObjectRecordNode,
     ): string | undefined {
    -  const len = node.s;
    -  if (len) {
    +  const keys = node.k;
    +  const len = keys.length;
    +  if (len > 0) {
         const mainAssignments: Assignment[] = [];
    -    const keys = node.k;
         const values = node.v;
         ctx.base.stack.push(source.i);
         for (let i = 0; i < len; i++) {
    @@ -796,8 +797,14 @@ function serializeDate(node: SerovalDateNode): string {
       return 'new Date("' + node.s + '")';
     }
     
    -function serializeRegExp(node: SerovalRegExpNode): string {
    -  return '/' + node.c + '/' + node.m;
    +function serializeRegExp(
    +  ctx: SerializerContext,
    +  node: SerovalRegExpNode,
    +): string {
    +  if (ctx.base.features & Feature.RegExp) {
    +    return '/' + node.c + '/' + node.m;
    +  }
    +  throw new SerovalUnsupportedNodeError(node);
     }
     
     function serializeSetItem(
    @@ -820,10 +827,10 @@ function serializeSetItem(
     
     function serializeSet(ctx: SerializerContext, node: SerovalSetNode): string {
       let serialized = SET_CONSTRUCTOR;
    -  const size = node.l;
    +  const items = node.a;
    +  const size = items.length;
       const id = node.i;
    -  if (size) {
    -    const items = node.a;
    +  if (size > 0) {
         ctx.base.stack.push(id);
         let result = serializeSetItem(ctx, id, items[0]);
         for (let i = 1, item = result; i < size; i++) {
    @@ -913,13 +920,13 @@ function serializeMapEntry(
     
     function serializeMap(ctx: SerializerContext, node: SerovalMapNode): string {
       let serialized = MAP_CONSTRUCTOR;
    -  const size = node.e.s;
    +  const keys = node.e.k;
    +  const size = keys.length;
       const id = node.i;
       const sentinel = node.f;
       const sentinelId = getRefParam(ctx, sentinel.i);
       const base = ctx.base;
    -  if (size) {
    -    const keys = node.e.k;
    +  if (size > 0) {
         const vals = node.e.v;
         base.stack.push(id);
         let result = serializeMapEntry(ctx, id, keys[0], vals[0], sentinelId);
    @@ -946,33 +953,21 @@ function serializeArrayBuffer(
       ctx: SerializerContext,
       node: SerovalArrayBufferNode,
     ): string {
    -  return getConstructor(ctx, node.f) + '(' + node.l + ',"' + node.s + '")';
    +  return getConstructor(ctx, node.f) + '("' + node.s + '")';
     }
     
     function serializeTypedArray(
       ctx: SerializerContext,
       node: SerovalTypedArrayNode | SerovalBigIntTypedArrayNode,
     ): string {
    -  return (
    -    'new ' +
    -    node.c +
    -    '(' +
    -    serialize(ctx, node.f) +
    -    ',' +
    -    node.b +
    -    ',' +
    -    node.l +
    -    ')'
    -  );
    +  return 'new ' + node.c + '(' + serialize(ctx, node.f) + ',' + node.b + ',' + node.l + ')';
     }
     
     function serializeDataView(
       ctx: SerializerContext,
       node: SerovalDataViewNode,
     ): string {
    -  return (
    -    'new DataView(' + serialize(ctx, node.f) + ',' + node.b + ',' + node.l + ')'
    -  );
    +  return 'new DataView(' + serialize(ctx, node.f) + ',' + node.b + ',' + node.l + ')';
     }
     
     function serializeAggregateError(
    @@ -1262,7 +1257,7 @@ function serializeAssignable(
         case SerovalNodeType.Date:
           return serializeDate(node);
         case SerovalNodeType.RegExp:
    -      return serializeRegExp(node);
    +      return serializeRegExp(ctx, node);
         case SerovalNodeType.Set:
           return serializeSet(ctx, node);
         case SerovalNodeType.Map:
    
  • packages/seroval/src/core/context/sync-parser.ts+149 75 modified
    @@ -22,7 +22,11 @@ import {
     } from '../base-primitives';
     import { Feature } from '../compat';
     import { NIL, SerovalNodeType } from '../constants';
    -import { SerovalParserError, SerovalUnsupportedTypeError } from '../errors';
    +import {
    +  SerovalDepthLimitError,
    +  SerovalParserError,
    +  SerovalUnsupportedTypeError,
    +} from '../errors';
     import { FALSE_NODE, NULL_NODE, TRUE_NODE, UNDEFINED_NODE } from '../literals';
     import { createSerovalNode } from '../node';
     import { OpaqueReference } from '../opaque-reference';
    @@ -103,15 +107,18 @@ export function createSyncParserContext(
       return {
         type: ParserMode.Sync,
         base: createBaseParserContext(mode, options),
    -    child: undefined,
    +    child: NIL,
       };
     }
     
     export class SyncParsePluginContext {
    -  constructor(private _p: SyncParserContext) {}
    +  constructor(
    +    private _p: SyncParserContext,
    +    private depth: number,
    +  ) {}
     
       parse<T>(current: T): SerovalNode {
    -    return parseSOS(this._p, current);
    +    return parseSOS(this._p, this.depth, current);
       }
     }
     
    @@ -124,18 +131,20 @@ export interface StreamParserContextOptions extends SyncParserContextOptions {
     export interface StreamParserContext {
       type: ParserMode.Stream;
       base: BaseParserContext;
    -  child: StreamParsePluginContext | undefined;
       state: StreamParserState;
     }
     export class StreamParsePluginContext {
    -  constructor(private _p: StreamParserContext) {}
    +  constructor(
    +    private _p: StreamParserContext,
    +    private depth: number,
    +  ) {}
     
       parse<T>(current: T): SerovalNode {
    -    return parseSOS(this._p, current);
    +    return parseSOS(this._p, this.depth, current);
       }
     
       parseWithError<T>(current: T): SerovalNode | undefined {
    -    return parseWithError(this._p, current);
    +    return parseWithError(this._p, this.depth, current);
       }
     
       isAlive(): boolean {
    @@ -194,41 +203,48 @@ export function createStreamParserContext(
       return {
         type: ParserMode.Stream,
         base: createBaseParserContext(SerovalMode.Cross, options),
    -    child: undefined,
         state: createStreamParserState(options),
       };
     }
     
     type SOSParserContext = SyncParserContext | StreamParserContext;
     
    -function parseItems(ctx: SOSParserContext, current: unknown[]): SerovalNode[] {
    -  const nodes = [];
    +function parseItems(
    +  ctx: SOSParserContext,
    +  depth: number,
    +  current: unknown[],
    +): (SerovalNode | 0)[] {
    +  const nodes: (SerovalNode | 0)[] = [];
       for (let i = 0, len = current.length; i < len; i++) {
         if (i in current) {
    -      nodes[i] = parseSOS(ctx, current[i]);
    +      nodes[i] = parseSOS(ctx, depth, current[i]);
    +    } else {
    +      nodes[i] = 0;
         }
       }
       return nodes;
     }
     
     function parseArray(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: unknown[],
     ): SerovalArrayNode {
    -  return createArrayNode(id, current, parseItems(ctx, current));
    +  return createArrayNode(id, current, parseItems(ctx, depth, current));
     }
     
     function parseProperties(
       ctx: SOSParserContext,
    +  depth: number,
       properties: Record<string | symbol, unknown>,
     ): SerovalObjectRecordNode {
       const entries = Object.entries(properties);
       const keyNodes: SerovalObjectRecordKey[] = [];
       const valueNodes: SerovalNode[] = [];
       for (let i = 0, len = entries.length; i < len; i++) {
         keyNodes.push(serializeString(entries[i][0]));
    -    valueNodes.push(parseSOS(ctx, entries[i][1]));
    +    valueNodes.push(parseSOS(ctx, depth, entries[i][1]));
       }
       // Check special properties, symbols in this case
       if (SYM_ITERATOR in properties) {
    @@ -238,6 +254,7 @@ function parseProperties(
             parseIteratorFactory(ctx.base),
             parseSOS(
               ctx,
    +          depth,
               iteratorToSequence(properties as unknown as Iterable<unknown>),
             ),
           ),
    @@ -250,6 +267,7 @@ function parseProperties(
             parseAsyncIteratorFactory(ctx.base),
             parseSOS(
               ctx,
    +          depth,
               ctx.type === ParserMode.Sync
                 ? createStream()
                 : createStreamFromAsyncIterable(
    @@ -272,105 +290,127 @@ function parseProperties(
       return {
         k: keyNodes,
         v: valueNodes,
    -    s: keyNodes.length,
       };
     }
     
     function parsePlainObject(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: Record<string, unknown>,
       empty: boolean,
     ): ObjectLikeNode {
    -  return createObjectNode(id, current, empty, parseProperties(ctx, current));
    +  return createObjectNode(
    +    id,
    +    current,
    +    empty,
    +    parseProperties(ctx, depth, current),
    +  );
     }
     
     function parseBoxed(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: object,
     ): SerovalBoxedNode {
    -  return createBoxedNode(id, parseSOS(ctx, current.valueOf()));
    +  return createBoxedNode(id, parseSOS(ctx, depth, current.valueOf()));
     }
     
     function parseTypedArray(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: TypedArrayValue,
     ): SerovalTypedArrayNode {
    -  return createTypedArrayNode(id, current, parseSOS(ctx, current.buffer));
    +  return createTypedArrayNode(
    +    id,
    +    current,
    +    parseSOS(ctx, depth, current.buffer),
    +  );
     }
     
     function parseBigIntTypedArray(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: BigIntTypedArrayValue,
     ): SerovalBigIntTypedArrayNode {
    -  return createBigIntTypedArrayNode(id, current, parseSOS(ctx, current.buffer));
    +  return createBigIntTypedArrayNode(
    +    id,
    +    current,
    +    parseSOS(ctx, depth, current.buffer),
    +  );
     }
     
     function parseDataView(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: DataView,
     ): SerovalDataViewNode {
    -  return createDataViewNode(id, current, parseSOS(ctx, current.buffer));
    +  return createDataViewNode(id, current, parseSOS(ctx, depth, current.buffer));
     }
     
     function parseError(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: Error,
     ): SerovalErrorNode {
       const options = getErrorOptions(current, ctx.base.features);
       return createErrorNode(
         id,
         current,
    -    options ? parseProperties(ctx, options) : NIL,
    +    options ? parseProperties(ctx, depth, options) : NIL,
       );
     }
     
     function parseAggregateError(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: AggregateError,
     ): SerovalAggregateErrorNode {
       const options = getErrorOptions(current, ctx.base.features);
       return createAggregateErrorNode(
         id,
         current,
    -    options ? parseProperties(ctx, options) : NIL,
    +    options ? parseProperties(ctx, depth, options) : NIL,
       );
     }
     
     function parseMap(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: Map<unknown, unknown>,
     ): SerovalMapNode {
       const keyNodes: SerovalNode[] = [];
       const valueNodes: SerovalNode[] = [];
       for (const [key, value] of current.entries()) {
    -    keyNodes.push(parseSOS(ctx, key));
    -    valueNodes.push(parseSOS(ctx, value));
    +    keyNodes.push(parseSOS(ctx, depth, key));
    +    valueNodes.push(parseSOS(ctx, depth, value));
       }
    -  return createMapNode(ctx.base, id, keyNodes, valueNodes, current.size);
    +  return createMapNode(ctx.base, id, keyNodes, valueNodes);
     }
     
     function parseSet(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: Set<unknown>,
     ): SerovalSetNode {
       const items: SerovalNode[] = [];
       for (const item of current.keys()) {
    -    items.push(parseSOS(ctx, item));
    +    items.push(parseSOS(ctx, depth, item));
       }
    -  return createSetNode(id, current.size, items);
    +  return createSetNode(id, items);
     }
     
     function parseStream(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: Stream<unknown>,
     ): SerovalNode {
    @@ -386,15 +426,15 @@ function parseStream(
       current.on({
         next: value => {
           if (ctx.state.alive) {
    -        const parsed = parseWithError(ctx, value);
    +        const parsed = parseWithError(ctx, depth, value);
             if (parsed) {
               onParse(ctx, createStreamNextNode(id, parsed));
             }
           }
         },
         throw: value => {
           if (ctx.state.alive) {
    -        const parsed = parseWithError(ctx, value);
    +        const parsed = parseWithError(ctx, depth, value);
             if (parsed) {
               onParse(ctx, createStreamThrowNode(id, parsed));
             }
    @@ -403,7 +443,7 @@ function parseStream(
         },
         return: value => {
           if (ctx.state.alive) {
    -        const parsed = parseWithError(ctx, value);
    +        const parsed = parseWithError(ctx, depth, value);
             if (parsed) {
               onParse(ctx, createStreamReturnNode(id, parsed));
             }
    @@ -417,10 +457,11 @@ function parseStream(
     function handlePromiseSuccess(
       this: StreamParserContext,
       id: number,
    +  depth: number,
       data: unknown,
     ): void {
       if (this.state.alive) {
    -    const parsed = parseWithError(this, data);
    +    const parsed = parseWithError(this, depth, data);
         if (parsed) {
           onParse(
             this,
    @@ -432,14 +473,14 @@ function handlePromiseSuccess(
               NIL,
               NIL,
               NIL,
    -          NIL,
               [
                 parseSpecialReference(this.base, SpecialReference.PromiseSuccess),
                 parsed,
               ],
               NIL,
               NIL,
               NIL,
    +          NIL,
             ),
           );
         }
    @@ -450,10 +491,11 @@ function handlePromiseSuccess(
     function handlePromiseFailure(
       this: StreamParserContext,
       id: number,
    +  depth: number,
       data: unknown,
     ): void {
       if (this.state.alive) {
    -    const parsed = parseWithError(this, data);
    +    const parsed = parseWithError(this, depth, data);
         if (parsed) {
           onParse(
             this,
    @@ -465,14 +507,14 @@ function handlePromiseFailure(
               NIL,
               NIL,
               NIL,
    -          NIL,
               [
                 parseSpecialReference(this.base, SpecialReference.PromiseFailure),
                 parsed,
               ],
               NIL,
               NIL,
               NIL,
    +          NIL,
             ),
           );
         }
    @@ -482,6 +524,7 @@ function handlePromiseFailure(
     
     function parsePromise(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: Promise<unknown>,
     ): SerovalPromiseConstructorNode {
    @@ -490,77 +533,75 @@ function parsePromise(
       if (ctx.type === ParserMode.Stream) {
         pushPendingState(ctx);
         current.then(
    -      handlePromiseSuccess.bind(ctx, resolver),
    -      handlePromiseFailure.bind(ctx, resolver),
    +      handlePromiseSuccess.bind(ctx, resolver, depth),
    +      handlePromiseFailure.bind(ctx, resolver, depth),
         );
       }
       return createPromiseConstructorNode(ctx.base, id, resolver);
     }
     
     function parsePluginSync(
       ctx: SyncParserContext,
    +  depth: number,
       id: number,
       current: unknown,
       currentPlugins: Plugin<any, any>[],
     ): SerovalPluginNode | undefined {
       for (let i = 0, len = currentPlugins.length; i < len; i++) {
         const plugin = currentPlugins[i];
         if (plugin.parse.sync && plugin.test(current)) {
    -      if (ctx.child == null) {
    -        ctx.child = new SyncParsePluginContext(ctx);
    -      }
           return createPluginNode(
             id,
             plugin.tag,
    -        plugin.parse.sync(current, ctx.child, {
    +        plugin.parse.sync(current, new SyncParsePluginContext(ctx, depth), {
               id,
             }),
           );
         }
       }
    -  return undefined;
    +  return NIL;
     }
     
     function parsePluginStream(
       ctx: StreamParserContext,
    +  depth: number,
       id: number,
       current: unknown,
       currentPlugins: Plugin<any, any>[],
     ): SerovalPluginNode | undefined {
       for (let i = 0, len = currentPlugins.length; i < len; i++) {
         const plugin = currentPlugins[i];
         if (plugin.parse.stream && plugin.test(current)) {
    -      if (ctx.child == null) {
    -        ctx.child = new StreamParsePluginContext(ctx);
    -      }
           return createPluginNode(
             id,
             plugin.tag,
    -        plugin.parse.stream(current, ctx.child, {
    +        plugin.parse.stream(current, new StreamParsePluginContext(ctx, depth), {
               id,
             }),
           );
         }
       }
    -  return undefined;
    +  return NIL;
     }
     
     function parsePlugin(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: unknown,
     ): SerovalPluginNode | undefined {
       const currentPlugins = ctx.base.plugins;
       if (currentPlugins) {
         return ctx.type === ParserMode.Sync
    -      ? parsePluginSync(ctx, id, current, currentPlugins)
    -      : parsePluginStream(ctx, id, current, currentPlugins);
    +      ? parsePluginSync(ctx, depth, id, current, currentPlugins)
    +      : parsePluginStream(ctx, depth, id, current, currentPlugins);
       }
    -  return undefined;
    +  return NIL;
     }
     
     function parseObjectPhase2(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: object,
       currentClass: unknown,
    @@ -569,34 +610,34 @@ function parseObjectPhase2(
         case Object:
           return parsePlainObject(
             ctx,
    +        depth,
             id,
             current as Record<string, unknown>,
             false,
           );
    -    case undefined:
    +    case NIL:
           return parsePlainObject(
             ctx,
    +        depth,
             id,
             current as Record<string, unknown>,
             true,
           );
         case Date:
           return createDateNode(id, current as unknown as Date);
    -    case RegExp:
    -      return createRegExpNode(id, current as unknown as RegExp);
         case Error:
         case EvalError:
         case RangeError:
         case ReferenceError:
         case SyntaxError:
         case TypeError:
         case URIError:
    -      return parseError(ctx, id, current as unknown as Error);
    +      return parseError(ctx, depth, id, current as unknown as Error);
         case Number:
         case Boolean:
         case String:
         case BigInt:
    -      return parseBoxed(ctx, id, current);
    +      return parseBoxed(ctx, depth, id, current);
         case ArrayBuffer:
           return createArrayBufferNode(
             ctx.base,
    @@ -612,28 +653,42 @@ function parseObjectPhase2(
         case Uint8ClampedArray:
         case Float32Array:
         case Float64Array:
    -      return parseTypedArray(ctx, id, current as unknown as TypedArrayValue);
    +      return parseTypedArray(
    +        ctx,
    +        depth,
    +        id,
    +        current as unknown as TypedArrayValue,
    +      );
         case DataView:
    -      return parseDataView(ctx, id, current as unknown as DataView);
    +      return parseDataView(ctx, depth, id, current as unknown as DataView);
         case Map:
    -      return parseMap(ctx, id, current as unknown as Map<unknown, unknown>);
    +      return parseMap(
    +        ctx,
    +        depth,
    +        id,
    +        current as unknown as Map<unknown, unknown>,
    +      );
         case Set:
    -      return parseSet(ctx, id, current as unknown as Set<unknown>);
    +      return parseSet(ctx, depth, id, current as unknown as Set<unknown>);
         default:
           break;
       }
       // Promises
       if (currentClass === Promise || current instanceof Promise) {
    -    return parsePromise(ctx, id, current as unknown as Promise<unknown>);
    +    return parsePromise(ctx, depth, id, current as unknown as Promise<unknown>);
       }
       const currentFeatures = ctx.base.features;
    +  if (currentFeatures & Feature.RegExp && currentClass === RegExp) {
    +    return createRegExpNode(id, current as unknown as RegExp);
    +  }
       // BigInt Typed Arrays
       if (currentFeatures & Feature.BigIntTypedArray) {
         switch (currentClass) {
           case BigInt64Array:
           case BigUint64Array:
             return parseBigIntTypedArray(
               ctx,
    +          depth,
               id,
               current as unknown as BigIntTypedArrayValue,
             );
    @@ -646,59 +701,77 @@ function parseObjectPhase2(
         typeof AggregateError !== 'undefined' &&
         (currentClass === AggregateError || current instanceof AggregateError)
       ) {
    -    return parseAggregateError(ctx, id, current as unknown as AggregateError);
    +    return parseAggregateError(
    +      ctx,
    +      depth,
    +      id,
    +      current as unknown as AggregateError,
    +    );
       }
       // Slow path. We only need to handle Errors and Iterators
       // since they have very broad implementations.
       if (current instanceof Error) {
    -    return parseError(ctx, id, current);
    +    return parseError(ctx, depth, id, current);
       }
       // Generator functions don't have a global constructor
       // despite existing
       if (SYM_ITERATOR in current || SYM_ASYNC_ITERATOR in current) {
    -    return parsePlainObject(ctx, id, current, !!currentClass);
    +    return parsePlainObject(ctx, depth, id, current, !!currentClass);
       }
       throw new SerovalUnsupportedTypeError(current);
     }
     
     function parseObject(
       ctx: SOSParserContext,
    +  depth: number,
       id: number,
       current: object,
     ): SerovalNode {
       if (Array.isArray(current)) {
    -    return parseArray(ctx, id, current);
    +    return parseArray(ctx, depth, id, current);
       }
       if (isStream(current)) {
    -    return parseStream(ctx, id, current);
    +    return parseStream(ctx, depth, id, current);
       }
       const currentClass = current.constructor;
       if (currentClass === OpaqueReference) {
         return parseSOS(
           ctx,
    +      depth,
           (current as OpaqueReference<unknown, unknown>).replacement,
         );
       }
    -  const parsed = parsePlugin(ctx, id, current);
    +  const parsed = parsePlugin(ctx, depth, id, current);
       if (parsed) {
         return parsed;
       }
    -  return parseObjectPhase2(ctx, id, current, currentClass);
    +  return parseObjectPhase2(ctx, depth, id, current, currentClass);
     }
     
    -function parseFunction(ctx: SOSParserContext, current: unknown): SerovalNode {
    +function parseFunction(
    +  ctx: SOSParserContext,
    +  depth: number,
    +  current: unknown,
    +): SerovalNode {
       const ref = getReferenceNode(ctx.base, current);
       if (ref.type !== ParserNodeType.Fresh) {
         return ref.value;
       }
    -  const plugin = parsePlugin(ctx, ref.value, current);
    +  const plugin = parsePlugin(ctx, depth, ref.value, current);
       if (plugin) {
         return plugin;
       }
       throw new SerovalUnsupportedTypeError(current);
     }
     
    -export function parseSOS<T>(ctx: SOSParserContext, current: T): SerovalNode {
    +export function parseSOS<T>(
    +  ctx: SOSParserContext,
    +  depth: number,
    +  current: T,
    +): SerovalNode {
    +  if (depth >= ctx.base.depthLimit) {
    +    throw new SerovalDepthLimitError(ctx.base.depthLimit);
    +  }
       switch (typeof current) {
         case 'boolean':
           return current ? TRUE_NODE : FALSE_NODE;
    @@ -714,15 +787,15 @@ export function parseSOS<T>(ctx: SOSParserContext, current: T): SerovalNode {
           if (current) {
             const ref = getReferenceNode(ctx.base, current);
             return ref.type === ParserNodeType.Fresh
    -          ? parseObject(ctx, ref.value, current as object)
    +          ? parseObject(ctx, depth + 1, ref.value, current as object)
               : ref.value;
           }
           return NULL_NODE;
         }
         case 'symbol':
           return parseWellKnownSymbol(ctx.base, current);
         case 'function': {
    -      return parseFunction(ctx, current);
    +      return parseFunction(ctx, depth, current);
         }
         default:
           throw new SerovalUnsupportedTypeError(current);
    @@ -731,7 +804,7 @@ export function parseSOS<T>(ctx: SOSParserContext, current: T): SerovalNode {
     
     export function parseTop<T>(ctx: SyncParserContext, current: T): SerovalNode {
       try {
    -    return parseSOS(ctx, current);
    +    return parseSOS(ctx, 0, current);
       } catch (error) {
         throw error instanceof SerovalParserError
           ? error
    @@ -787,12 +860,13 @@ function popPendingState(ctx: StreamParserContext): void {
       }
     }
     
    -export function parseWithError<T>(
    +function parseWithError<T>(
       ctx: StreamParserContext,
    +  depth: number,
       current: T,
     ): SerovalNode | undefined {
       try {
    -    return parseSOS(ctx, current);
    +    return parseSOS(ctx, depth, current);
       } catch (err) {
         onError(ctx, err);
         return NIL;
    @@ -803,7 +877,7 @@ export function startStreamParse<T>(
       ctx: StreamParserContext,
       current: T,
     ): void {
    -  const parsed = parseWithError(ctx, current);
    +  const parsed = parseWithError(ctx, 0, current);
       if (parsed) {
         onParseInternal(ctx, parsed, true);
         ctx.state.initial = false;
    
  • packages/seroval/src/core/cross/index.ts+2 0 modified
    @@ -181,6 +181,8 @@ export function fromCrossJSON<T>(
       const ctx = createCrossDeserializerContext({
         plugins,
         refs: options.refs,
    +    features: options.features,
    +    disabledFeatures: options.disabledFeatures,
       });
       return deserializeTop(ctx, source) as T;
     }
    
  • packages/seroval/src/core/errors.ts+33 0 modified
    @@ -78,6 +78,9 @@ const enum SpecificErrorCodes {
       MissingReference = 5,
       MissingReferenceForId = 6,
       UnknownTypedArray = 7,
    +  MalformedNode = 8,
    +  ConflictedNodeId = 9,
    +  DepthLimit = 10,
     }
     
     function getSpecificErrorMessage(code: SpecificErrorCodes): string {
    @@ -161,3 +164,33 @@ export class SerovalUnknownTypedArrayError extends Error {
         );
       }
     }
    +
    +export class SerovalMalformedNodeError extends Error {
    +  constructor(node: SerovalNode) {
    +    super(
    +      import.meta.env.PROD
    +        ? getSpecificErrorMessage(SpecificErrorCodes.MalformedNode)
    +        : 'Malformed node type "' + node.t + '".',
    +    );
    +  }
    +}
    +
    +export class SerovalConflictedNodeIdError extends Error {
    +  constructor(node: SerovalNode) {
    +    super(
    +      import.meta.env.PROD
    +        ? getSpecificErrorMessage(SpecificErrorCodes.ConflictedNodeId)
    +        : 'Conflicted node id "' + node.i + '".',
    +    );
    +  }
    +}
    +
    +export class SerovalDepthLimitError extends Error {
    +  constructor(limit: number) {
    +    super(
    +      import.meta.env.PROD
    +        ? getSpecificErrorMessage(SpecificErrorCodes.ConflictedNodeId)
    +        : 'Depth limit of ' + limit + ' reached',
    +    );
    +  }
    +}
    
  • packages/seroval/src/core/node.ts+2 2 modified
    @@ -13,7 +13,6 @@ export function createSerovalNode<
       t: T,
       i: N['i'],
       s: N['s'],
    -  l: N['l'],
       c: N['c'],
       m: N['m'],
       p: N['p'],
    @@ -22,12 +21,12 @@ export function createSerovalNode<
       f: N['f'],
       b: N['b'],
       o: N['o'],
    +  l: N['l'],
     ): N {
       return {
         t,
         i,
         s,
    -    l,
         c,
         m,
         p,
    @@ -36,5 +35,6 @@ export function createSerovalNode<
         f,
         b,
         o,
    +    l,
       } as N;
     }
    
  • packages/seroval/src/core/string.ts+3 1 modified
    @@ -1,3 +1,5 @@
    +import { NIL } from './constants';
    +
     export function serializeChar(str: string): string | undefined {
       switch (str) {
         case '"':
    @@ -21,7 +23,7 @@ export function serializeChar(str: string): string | undefined {
         case '\u2029':
           return '\\u2029';
         default:
    -      return undefined;
    +      return NIL;
       }
     }
     
    
  • packages/seroval/src/core/tree/index.ts+10 1 modified
    @@ -18,6 +18,7 @@ import {
       SerovalMode,
     } from '../plugin';
     import type { SerovalNode } from '../types';
    +import { ALL_ENABLED } from '../compat';
     export type SyncParserContextOptions = Omit<BaseParserContextOptions, 'refs'>;
     export type AsyncParserContextOptions = Omit<BaseParserContextOptions, 'refs'>;
     
    @@ -67,6 +68,10 @@ export interface SerovalJSON {
       m: number[];
     }
     
    +export interface FromJSONOptions extends PluginAccessOptions {
    +  disabledFeatures?: number;
    +}
    +
     export function toJSON<T>(
       source: T,
       options: SyncParserContextOptions = {},
    @@ -114,12 +119,16 @@ export function compileJSON(
     
     export function fromJSON<T>(
       source: SerovalJSON,
    -  options: PluginAccessOptions = {},
    +  options: FromJSONOptions = {},
     ): T {
       const plugins = resolvePlugins(options.plugins);
    +  const disabledFeatures = options.disabledFeatures || 0;
    +  const sourceFeatures = source.f ?? ALL_ENABLED;
       const ctx = createVanillaDeserializerContext({
         plugins,
         markedRefs: source.m,
    +    features: sourceFeatures & ~disabledFeatures,
    +    disabledFeatures,
       });
       return deserializeTop(ctx, source.t) as T;
     }
    
  • packages/seroval/src/core/types.ts+10 19 modified
    @@ -14,8 +14,6 @@ export interface SerovalBaseNode {
       i: number | undefined;
       // Serialized value
       s: unknown;
    -  // size/length
    -  l: number | undefined;
       // Constructor name / RegExp source
       c: string | undefined;
       // message/flags
    @@ -25,27 +23,27 @@ export interface SerovalBaseNode {
       // entries (for Map, etc.)
       e: SerovalMapRecordNode | undefined;
       // array of nodes
    -  a: (SerovalNode | undefined)[] | undefined;
    +  a: (SerovalNode | 0)[] | undefined;
       // fulfilled node
       f: SerovalNode | undefined;
       // byte offset/object flags
       b: number | undefined;
       // object flag
       o: SerovalObjectFlags | undefined;
    +  // length
    +  l: number | undefined;
     }
     
     export type SerovalObjectRecordKey = string | SerovalNode;
     
     export interface SerovalObjectRecordNode {
       k: SerovalObjectRecordKey[];
       v: SerovalNode[];
    -  s: number;
     }
     
     export interface SerovalMapRecordNode {
       k: SerovalNode[];
       v: SerovalNode[];
    -  s: number;
     }
     
     export interface SerovalNumberNode extends SerovalBaseNode {
    @@ -104,38 +102,35 @@ export interface SerovalArrayBufferNode extends SerovalBaseNode {
       i: number;
       // byte string
       s: string;
    -  // length
    -  l: number;
       // array buffer constructor
       f: SerovalNodeWithID;
     }
     
    -
     export interface SerovalTypedArrayNode extends SerovalBaseNode {
       t: SerovalNodeType.TypedArray;
       // id
       i: number;
    -  // length
    -  l: number;
       // TypedArray Constructor
       c: string;
       // ArrayBuffer reference
       f: SerovalNode;
       // Byte Offset
       b: number;
    +  // length
    +  l: number;
     }
     
     export interface SerovalBigIntTypedArrayNode extends SerovalBaseNode {
       t: SerovalNodeType.BigIntTypedArray;
       i: number;
    -  // length
    -  l: number;
       // TypedArray Constructor
       c: string;
       // ArrayBuffer reference
       f: SerovalNode;
       // Byte Offset
       b: number;
    +  // length
    +  l: number;
     }
     
     export type SerovalSemiPrimitiveNode =
    @@ -149,8 +144,6 @@ export interface SerovalSetNode extends SerovalBaseNode {
       t: SerovalNodeType.Set;
       // id
       i: number;
    -  // Size of Set
    -  l: number;
       // Items in Set (as array)
       a: SerovalNode[];
     }
    @@ -165,10 +158,8 @@ export interface SerovalMapNode extends SerovalBaseNode {
     
     export interface SerovalArrayNode extends SerovalBaseNode {
       t: SerovalNodeType.Array;
    -  // size of array
    -  l: number;
       // items
    -  a: (SerovalNode | undefined)[];
    +  a: (SerovalNode | 0)[];
       i: number;
       o: SerovalObjectFlags;
     }
    @@ -233,12 +224,12 @@ export interface SerovalReferenceNode extends SerovalBaseNode {
     export interface SerovalDataViewNode extends SerovalBaseNode {
       t: SerovalNodeType.DataView;
       i: number;
    -  // byte length
    -  l: number;
       // reference to array buffer
       f: SerovalNode;
       // byte offset
       b: number;
    +  // byte length
    +  l: number;
     }
     
     export interface SerovalBoxedNode extends SerovalBaseNode {
    
  • packages/seroval/test.js+0 34 removed
    @@ -1,34 +0,0 @@
    -import { serialize } from './dist/esm/development/index.mjs';
    -
    -function example() {
    -  return new Set([
    -    {
    -      id: 1,
    -      first_name: 'Jimmy',
    -      last_name: 'Hansen',
    -      email: 'jhansen0@skyrock.com',
    -      gender: 'Male',
    -      ip_address: '166.6.70.130',
    -    },
    -    {
    -      id: 1,
    -      first_name: 'Judy',
    -      last_name: 'Cook',
    -      email: 'jcook0@themeforest.net',
    -      gender: 'Female',
    -      ip_address: '171.246.40.83',
    -    },
    -    {
    -      id: 2,
    -      first_name: 'Anne',
    -      last_name: 'Thomas',
    -      email: 'athomas1@usda.gov',
    -      gender: 'Female',
    -      ip_address: '158.159.200.150',
    -    },
    -  ]);
    -}
    -
    -for (let i = 0; i < 10000; i++) {
    -  serialize(example());
    -}
    
  • packages/seroval/test/__snapshots__/array.test.ts.snap+10 10 modified
    @@ -120,28 +120,28 @@ exports[`arrays > serializeAsync > supports Arrays 1`] = `"Promise.resolve([1,2,
     
     exports[`arrays > serializeAsync > supports self recursion 1`] = `"(h=>h=[Promise.resolve().then(()=>h),Promise.resolve().then(()=>h)])()"`;
     
    -exports[`arrays > toCrossJSON > supports Arrays 1`] = `"{"t":9,"i":0,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}"`;
    +exports[`arrays > toCrossJSON > supports Arrays 1`] = `"{"t":9,"i":0,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}"`;
     
    -exports[`arrays > toCrossJSON > supports self recursion 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":4,"i":0},{"t":4,"i":0}],"o":0}"`;
    +exports[`arrays > toCrossJSON > supports self recursion 1`] = `"{"t":9,"i":0,"a":[{"t":4,"i":0},{"t":4,"i":0}],"o":0}"`;
     
    -exports[`arrays > toCrossJSONAsync > supports Arrays 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}}"`;
    +exports[`arrays > toCrossJSONAsync > supports Arrays 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}}"`;
     
    -exports[`arrays > toCrossJSONAsync > supports self recursion 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"o":0}"`;
    +exports[`arrays > toCrossJSONAsync > supports self recursion 1`] = `"{"t":9,"i":0,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"o":0}"`;
     
     exports[`arrays > toCrossJSONStream > supports Arrays 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`arrays > toCrossJSONStream > supports Arrays 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":9,"i":3,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}]}"`;
    +exports[`arrays > toCrossJSONStream > supports Arrays 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":9,"i":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}]}"`;
     
    -exports[`arrays > toCrossJSONStream > supports self recursion 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}],"o":0}"`;
    +exports[`arrays > toCrossJSONStream > supports self recursion 1`] = `"{"t":9,"i":0,"a":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}],"o":0}"`;
     
     exports[`arrays > toCrossJSONStream > supports self recursion 2`] = `"{"t":23,"i":2,"a":[{"t":26,"i":6,"s":2},{"t":4,"i":0}]}"`;
     
     exports[`arrays > toCrossJSONStream > supports self recursion 3`] = `"{"t":23,"i":5,"a":[{"t":4,"i":6},{"t":4,"i":0}]}"`;
     
    -exports[`arrays > toJSON > supports Arrays 1`] = `"{"t":{"t":9,"i":0,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0},"f":31,"m":[]}"`;
    +exports[`arrays > toJSON > supports Arrays 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0},"f":63,"m":[]}"`;
     
    -exports[`arrays > toJSON > supports self recursion 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":4,"i":0},{"t":4,"i":0}],"o":0},"f":31,"m":[0]}"`;
    +exports[`arrays > toJSON > supports self recursion 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":4,"i":0},{"t":4,"i":0}],"o":0},"f":63,"m":[0]}"`;
     
    -exports[`arrays > toJSONAsync > supports Arrays 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}},"f":31,"m":[]}"`;
    +exports[`arrays > toJSONAsync > supports Arrays 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}],"o":0}},"f":63,"m":[]}"`;
     
    -exports[`arrays > toJSONAsync > supports self recursion 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"o":0},"f":31,"m":[0]}"`;
    +exports[`arrays > toJSONAsync > supports self recursion 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"o":0},"f":63,"m":[0]}"`;
    
  • packages/seroval/test/__snapshots__/async-iterable.test.ts.snap+3 3 modified
    @@ -816,9 +816,9 @@ exports[`AsyncIterable > serializeAsync > supports AsyncIterables 1`] = `
     })(),k.next(1),k.next(2),k.next(3),k.return(void 0),k))}))()"
     `;
     
    -exports[`AsyncIterable > toCrossJSONAsync > supports AsyncIterables 1`] = `"{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":0}],"v":[{"t":1,"s":"Hello World"},{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":2},"o":0}"`;
    +exports[`AsyncIterable > toCrossJSONAsync > supports AsyncIterables 1`] = `"{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":0}],"v":[{"t":1,"s":"Hello World"},{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":0}"`;
     
    -exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 1`] = `"{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":0}],"v":[{"t":1,"s":"Hello World"},{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}],"s":2},"o":0}"`;
    +exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 1`] = `"{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":0}],"v":[{"t":1,"s":"Hello World"},{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}]},"o":0}"`;
     
     exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 2`] = `"{"t":32,"i":4,"f":{"t":0,"s":1}}"`;
     
    @@ -828,4 +828,4 @@ exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 4`] = `"{"t
     
     exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 5`] = `"{"t":34,"i":4,"f":{"t":2,"s":1}}"`;
     
    -exports[`AsyncIterable > toJSONAsync > supports AsyncIterables 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":0}],"v":[{"t":1,"s":"Hello World"},{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":2},"o":0},"f":31,"m":[1,4]}"`;
    +exports[`AsyncIterable > toJSONAsync > supports AsyncIterables 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":0}],"v":[{"t":1,"s":"Hello World"},{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":0},"f":63,"m":[1,4]}"`;
    
  • packages/seroval/test/__snapshots__/bigint.test.ts.snap+2 2 modified
    @@ -39,6 +39,6 @@ exports[`bigint > toCrossJSONStream > supports bigint 1`] = `"{"t":22,"i":0,"s":
     
     exports[`bigint > toCrossJSONStream > supports bigint 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":3,"s":2},{"t":3,"s":"9007199254740991"}]}"`;
     
    -exports[`bigint > toJSON > supports bigint 1`] = `"{"t":{"t":3,"s":"9007199254740991"},"f":31,"m":[]}"`;
    +exports[`bigint > toJSON > supports bigint 1`] = `"{"t":{"t":3,"s":"9007199254740991"},"f":63,"m":[]}"`;
     
    -exports[`bigint > toJSONAsync > supports bigint 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":3,"s":"9007199254740991"}},"f":31,"m":[]}"`;
    +exports[`bigint > toJSONAsync > supports bigint 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":3,"s":"9007199254740991"}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/boolean.test.ts.snap+4 4 modified
    @@ -70,10 +70,10 @@ exports[`boolean > toCrossJSONStream > supports true value 1`] = `"{"t":22,"i":0
     
     exports[`boolean > toCrossJSONStream > supports true value 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":3,"s":2},{"t":2,"s":2}]}"`;
     
    -exports[`boolean > toJSON > supports boolean 1`] = `"{"t":{"t":2,"s":2},"f":31,"m":[]}"`;
    +exports[`boolean > toJSON > supports boolean 1`] = `"{"t":{"t":2,"s":2},"f":63,"m":[]}"`;
     
    -exports[`boolean > toJSON > supports boolean 2`] = `"{"t":{"t":2,"s":3},"f":31,"m":[]}"`;
    +exports[`boolean > toJSON > supports boolean 2`] = `"{"t":{"t":2,"s":3},"f":63,"m":[]}"`;
     
    -exports[`boolean > toJSONAsync > supports boolean 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":2}},"f":31,"m":[]}"`;
    +exports[`boolean > toJSONAsync > supports boolean 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":2}},"f":63,"m":[]}"`;
     
    -exports[`boolean > toJSONAsync > supports boolean 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":3}},"f":31,"m":[]}"`;
    +exports[`boolean > toJSONAsync > supports boolean 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":3}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/boxed-bigint.test.ts.snap+2 2 modified
    @@ -66,6 +66,6 @@ exports[`boxed bigint > toCrossJSONStream > supports boxed bigint 1`] = `"{"t":2
     
     exports[`boxed bigint > toCrossJSONStream > supports boxed bigint 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":21,"i":3,"f":{"t":3,"s":"9007199254740991"}}]}"`;
     
    -exports[`boxed bigint > toJSON > supports boxed bigint 1`] = `"{"t":{"t":21,"i":0,"f":{"t":3,"s":"9007199254740991"}},"f":31,"m":[]}"`;
    +exports[`boxed bigint > toJSON > supports boxed bigint 1`] = `"{"t":{"t":21,"i":0,"f":{"t":3,"s":"9007199254740991"}},"f":63,"m":[]}"`;
     
    -exports[`boxed bigint > toJSONAsync > supports boxed bigint 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":3,"s":"9007199254740991"}}},"f":31,"m":[]}"`;
    +exports[`boxed bigint > toJSONAsync > supports boxed bigint 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":3,"s":"9007199254740991"}}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/boxed-boolean.test.ts.snap+4 4 modified
    @@ -124,10 +124,10 @@ exports[`boxed boolean > toCrossJSONStream > supports boxed true 1`] = `"{"t":22
     
     exports[`boxed boolean > toCrossJSONStream > supports boxed true 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":21,"i":3,"f":{"t":2,"s":2}}]}"`;
     
    -exports[`boxed boolean > toJSON > supports boolean 1`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":2}},"f":31,"m":[]}"`;
    +exports[`boxed boolean > toJSON > supports boolean 1`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":2}},"f":63,"m":[]}"`;
     
    -exports[`boxed boolean > toJSON > supports boolean 2`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":3}},"f":31,"m":[]}"`;
    +exports[`boxed boolean > toJSON > supports boolean 2`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":3}},"f":63,"m":[]}"`;
     
    -exports[`boxed boolean > toJSONAsync > supports boolean 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":2}}},"f":31,"m":[]}"`;
    +exports[`boxed boolean > toJSONAsync > supports boolean 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":2}}},"f":63,"m":[]}"`;
     
    -exports[`boxed boolean > toJSONAsync > supports boolean 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":3}}},"f":31,"m":[]}"`;
    +exports[`boxed boolean > toJSONAsync > supports boolean 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":3}}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/boxed-number.test.ts.snap+10 10 modified
    @@ -310,22 +310,22 @@ exports[`boxed number > toCrossJSONStream > supports boxed numbers 1`] = `"{"t":
     
     exports[`boxed number > toCrossJSONStream > supports boxed numbers 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":21,"i":3,"f":{"t":0,"s":3735928559}}]}"`;
     
    -exports[`boxed number > toJSON > supports boxed numbers 1`] = `"{"t":{"t":21,"i":0,"f":{"t":0,"s":3735928559}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSON > supports boxed numbers 1`] = `"{"t":{"t":21,"i":0,"f":{"t":0,"s":3735928559}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSON > supports boxed numbers 2`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":7}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSON > supports boxed numbers 2`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":7}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSON > supports boxed numbers 3`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":5}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSON > supports boxed numbers 3`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":5}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSON > supports boxed numbers 4`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":6}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSON > supports boxed numbers 4`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":6}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSON > supports boxed numbers 5`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":4}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSON > supports boxed numbers 5`] = `"{"t":{"t":21,"i":0,"f":{"t":2,"s":4}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSONAsync > supports boxed numbers 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":0,"s":3735928559}}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSONAsync > supports boxed numbers 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":0,"s":3735928559}}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSONAsync > supports boxed numbers 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":7}}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSONAsync > supports boxed numbers 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":7}}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSONAsync > supports boxed numbers 3`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":5}}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSONAsync > supports boxed numbers 3`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":5}}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSONAsync > supports boxed numbers 4`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":6}}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSONAsync > supports boxed numbers 4`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":6}}},"f":63,"m":[]}"`;
     
    -exports[`boxed number > toJSONAsync > supports boxed numbers 5`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":4}}},"f":31,"m":[]}"`;
    +exports[`boxed number > toJSONAsync > supports boxed numbers 5`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":2,"s":4}}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/boxed-string.test.ts.snap+4 4 modified
    @@ -132,10 +132,10 @@ exports[`boxed string > toCrossJSONStream > supports boxed strings 1`] = `"{"t":
     
     exports[`boxed string > toCrossJSONStream > supports boxed strings 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":21,"i":3,"f":{"t":1,"s":"\\\\\\"hello\\\\\\""}}]}"`;
     
    -exports[`boxed string > toJSON > supports boxed strings 1`] = `"{"t":{"t":21,"i":0,"f":{"t":1,"s":"\\\\\\"hello\\\\\\""}},"f":31,"m":[]}"`;
    +exports[`boxed string > toJSON > supports boxed strings 1`] = `"{"t":{"t":21,"i":0,"f":{"t":1,"s":"\\\\\\"hello\\\\\\""}},"f":63,"m":[]}"`;
     
    -exports[`boxed string > toJSON > supports boxed strings 2`] = `"{"t":{"t":21,"i":0,"f":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"}},"f":31,"m":[]}"`;
    +exports[`boxed string > toJSON > supports boxed strings 2`] = `"{"t":{"t":21,"i":0,"f":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"}},"f":63,"m":[]}"`;
     
    -exports[`boxed string > toJSONAsync > supports boxed strings 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":1,"s":"\\\\\\"hello\\\\\\""}}},"f":31,"m":[]}"`;
    +exports[`boxed string > toJSONAsync > supports boxed strings 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":1,"s":"\\\\\\"hello\\\\\\""}}},"f":63,"m":[]}"`;
     
    -exports[`boxed string > toJSONAsync > supports boxed strings 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"}}},"f":31,"m":[]}"`;
    +exports[`boxed string > toJSONAsync > supports boxed strings 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":21,"i":1,"f":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"}}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/data-view.test.ts.snap+29 21 modified
    @@ -1,47 +1,51 @@
     // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
     
     exports[`DataView > crossSerialize > scoped > supports DataView 1`] = `
    -"($R=>$R[0]=new DataView($R[1]=($R[2]=(length, b64) => {
    +"($R=>$R[0]=new DataView($R[1]=($R[2]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16))($R["example"])"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16))($R["example"])"
     `;
     
     exports[`DataView > crossSerialize > supports DataView 1`] = `
    -"$R[0]=new DataView($R[1]=($R[2]=(length, b64) => {
    +"$R[0]=new DataView($R[1]=($R[2]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16)"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16)"
     `;
     
     exports[`DataView > crossSerializeAsync > scoped > supports DataView 1`] = `
    -"($R=>$R[0]=Promise.resolve($R[1]=new DataView($R[2]=($R[3]=(length, b64) => {
    +"($R=>$R[0]=Promise.resolve($R[1]=new DataView($R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16)))($R["example"])"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16)))($R["example"])"
     `;
     
     exports[`DataView > crossSerializeAsync > supports DataView 1`] = `
    -"$R[0]=Promise.resolve($R[1]=new DataView($R[2]=($R[3]=(length, b64) => {
    +"$R[0]=Promise.resolve($R[1]=new DataView($R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16))"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16))"
     `;
     
     exports[`DataView > crossSerializeStream > scoped > supports DataView 1`] = `
    @@ -64,14 +68,15 @@ exports[`DataView > crossSerializeStream > scoped > supports DataView 2`] = `
       resolver.s(data);
       resolver.p.s = 1;
       resolver.p.v = data;
    -})($R[1],$R[3]=new DataView($R[4]=($R[5]=(length, b64) => {
    +})($R[1],$R[3]=new DataView($R[4]=($R[5]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16)))($R["example"])"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16)))($R["example"])"
     `;
     
     exports[`DataView > crossSerializeStream > supports DataView 1`] = `
    @@ -94,46 +99,49 @@ exports[`DataView > crossSerializeStream > supports DataView 2`] = `
       resolver.s(data);
       resolver.p.s = 1;
       resolver.p.v = data;
    -})($R[1],$R[3]=new DataView($R[4]=($R[5]=(length, b64) => {
    +})($R[1],$R[3]=new DataView($R[4]=($R[5]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16))"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16))"
     `;
     
     exports[`DataView > serialize > supports DataView 1`] = `
    -"new DataView(((length, b64) => {
    +"new DataView(((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16)"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16)"
     `;
     
     exports[`DataView > serializeAsync > supports DataView 1`] = `
    -"Promise.resolve(new DataView(((length, b64) => {
    +"Promise.resolve(new DataView(((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"AAAqAAAAAAAAAAAAAAAAAA=="),0,16))"
    +})("AAAqAAAAAAAAAAAAAAAAAA=="),0,16))"
     `;
     
    -exports[`DataView > toCrossJSON > supports DataView 1`] = `"{"t":20,"i":0,"l":16,"f":{"t":19,"i":1,"s":"AAAqAAAAAAAAAAAAAAAAAA==","l":16,"f":{"t":26,"i":2,"s":5}},"b":0}"`;
    +exports[`DataView > toCrossJSON > supports DataView 1`] = `"{"t":20,"i":0,"f":{"t":19,"i":1,"s":"AAAqAAAAAAAAAAAAAAAAAA==","f":{"t":26,"i":2,"s":5}},"b":0,"l":16}"`;
     
    -exports[`DataView > toCrossJSONAsync > supports DataView 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":20,"i":1,"l":16,"f":{"t":19,"i":2,"s":"AAAqAAAAAAAAAAAAAAAAAA==","l":16,"f":{"t":26,"i":3,"s":5}},"b":0}}"`;
    +exports[`DataView > toCrossJSONAsync > supports DataView 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":20,"i":1,"f":{"t":19,"i":2,"s":"AAAqAAAAAAAAAAAAAAAAAA==","f":{"t":26,"i":3,"s":5}},"b":0,"l":16}}"`;
     
     exports[`DataView > toCrossJSONStream > supports DataView 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`DataView > toCrossJSONStream > supports DataView 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":20,"i":3,"l":16,"f":{"t":19,"i":4,"s":"AAAqAAAAAAAAAAAAAAAAAA==","l":16,"f":{"t":26,"i":5,"s":5}},"b":0}]}"`;
    +exports[`DataView > toCrossJSONStream > supports DataView 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":20,"i":3,"f":{"t":19,"i":4,"s":"AAAqAAAAAAAAAAAAAAAAAA==","f":{"t":26,"i":5,"s":5}},"b":0,"l":16}]}"`;
     
    -exports[`DataView > toJSON > supports DataView 1`] = `"{"t":{"t":20,"i":0,"l":16,"f":{"t":19,"i":1,"s":"AAAqAAAAAAAAAAAAAAAAAA==","l":16,"f":{"t":26,"i":2,"s":5}},"b":0},"f":31,"m":[]}"`;
    +exports[`DataView > toJSON > supports DataView 1`] = `"{"t":{"t":20,"i":0,"f":{"t":19,"i":1,"s":"AAAqAAAAAAAAAAAAAAAAAA==","f":{"t":26,"i":2,"s":5}},"b":0,"l":16},"f":63,"m":[]}"`;
     
    -exports[`DataView > toJSONAsync > supports DataView 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":20,"i":1,"l":16,"f":{"t":19,"i":2,"s":"AAAqAAAAAAAAAAAAAAAAAA==","l":16,"f":{"t":26,"i":3,"s":5}},"b":0}},"f":31,"m":[]}"`;
    +exports[`DataView > toJSONAsync > supports DataView 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":20,"i":1,"f":{"t":19,"i":2,"s":"AAAqAAAAAAAAAAAAAAAAAA==","f":{"t":26,"i":3,"s":5}},"b":0,"l":16}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/date.test.ts.snap+2 2 modified
    @@ -66,6 +66,6 @@ exports[`Date > toCrossJSONStream > supports Date 1`] = `"{"t":22,"i":0,"s":1,"f
     
     exports[`Date > toCrossJSONStream > supports Date 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":5,"i":3,"s":"2023-03-14T11:16:24.879Z"}]}"`;
     
    -exports[`Date > toJSON > supports Date 1`] = `"{"t":{"t":5,"i":0,"s":"2023-03-14T11:16:24.879Z"},"f":31,"m":[]}"`;
    +exports[`Date > toJSON > supports Date 1`] = `"{"t":{"t":5,"i":0,"s":"2023-03-14T11:16:24.879Z"},"f":63,"m":[]}"`;
     
    -exports[`Date > toJSONAsync > supports Date 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":5,"i":1,"s":"2023-03-14T11:16:24.879Z"}},"f":31,"m":[]}"`;
    +exports[`Date > toJSONAsync > supports Date 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":5,"i":1,"s":"2023-03-14T11:16:24.879Z"}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/error.test.ts.snap+16 16 modified
    @@ -178,40 +178,40 @@ exports[`Error > serializeAsync > supports Error.prototype.name 1`] = `"Promise.
     
     exports[`Error > serializeAsync > supports other Error classes 1`] = `"Promise.resolve(Object.assign(new ReferenceError("A"),{stack:""}))"`;
     
    -exports[`Error > toCrossJSON > supports Error.prototype.cause 1`] = `"{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":13,"i":1,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}],"s":2}}"`;
    +exports[`Error > toCrossJSON > supports Error.prototype.cause 1`] = `"{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":13,"i":1,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}]}}"`;
     
    -exports[`Error > toCrossJSON > supports Error.prototype.name 1`] = `"{"t":13,"i":0,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}],"s":2}}"`;
    +exports[`Error > toCrossJSON > supports Error.prototype.name 1`] = `"{"t":13,"i":0,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}]}}"`;
     
    -exports[`Error > toCrossJSON > supports other Error classes 1`] = `"{"t":13,"i":0,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}"`;
    +exports[`Error > toCrossJSON > supports other Error classes 1`] = `"{"t":13,"i":0,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}"`;
     
    -exports[`Error > toCrossJSONAsync > supports Error.prototype.cause 1`] = `"{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":12,"i":1,"s":1,"f":{"t":13,"i":2,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}],"s":2}}"`;
    +exports[`Error > toCrossJSONAsync > supports Error.prototype.cause 1`] = `"{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":12,"i":1,"s":1,"f":{"t":13,"i":2,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}}]}}"`;
     
    -exports[`Error > toCrossJSONAsync > supports Error.prototype.name 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}],"s":2}}}"`;
    +exports[`Error > toCrossJSONAsync > supports Error.prototype.name 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}]}}}"`;
     
    -exports[`Error > toCrossJSONAsync > supports other Error classes 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}"`;
    +exports[`Error > toCrossJSONAsync > supports other Error classes 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}}"`;
     
     exports[`Error > toCrossJSONStream > supports Error.prototype.cause 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`Error > toCrossJSONStream > supports Error.prototype.cause 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":13,"i":3,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":22,"i":4,"s":5,"f":{"t":4,"i":2}}],"s":2}}]}"`;
    +exports[`Error > toCrossJSONStream > supports Error.prototype.cause 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":13,"i":3,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":22,"i":4,"s":5,"f":{"t":4,"i":2}}]}}]}"`;
     
    -exports[`Error > toCrossJSONStream > supports Error.prototype.cause 3`] = `"{"t":23,"i":5,"a":[{"t":4,"i":6},{"t":13,"i":7,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}]}"`;
    +exports[`Error > toCrossJSONStream > supports Error.prototype.cause 3`] = `"{"t":23,"i":5,"a":[{"t":4,"i":6},{"t":13,"i":7,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}]}"`;
     
     exports[`Error > toCrossJSONStream > supports Error.prototype.name 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`Error > toCrossJSONStream > supports Error.prototype.name 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":13,"i":3,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}],"s":2}}]}"`;
    +exports[`Error > toCrossJSONStream > supports Error.prototype.name 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":13,"i":3,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}]}}]}"`;
     
     exports[`Error > toCrossJSONStream > supports other Error classes 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`Error > toCrossJSONStream > supports other Error classes 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":13,"i":3,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}]}"`;
    +exports[`Error > toCrossJSONStream > supports other Error classes 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":13,"i":3,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}]}"`;
     
    -exports[`Error > toJSON > supports Error.prototype.cause 1`] = `"{"t":{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":13,"i":1,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}],"s":2}},"f":31,"m":[]}"`;
    +exports[`Error > toJSON > supports Error.prototype.cause 1`] = `"{"t":{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":13,"i":1,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}]}},"f":63,"m":[]}"`;
     
    -exports[`Error > toJSON > supports Error.prototype.name 1`] = `"{"t":{"t":13,"i":0,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}],"s":2}},"f":31,"m":[]}"`;
    +exports[`Error > toJSON > supports Error.prototype.name 1`] = `"{"t":{"t":13,"i":0,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}]}},"f":63,"m":[]}"`;
     
    -exports[`Error > toJSON > supports other Error classes 1`] = `"{"t":{"t":13,"i":0,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}},"f":31,"m":[]}"`;
    +exports[`Error > toJSON > supports other Error classes 1`] = `"{"t":{"t":13,"i":0,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}},"f":63,"m":[]}"`;
     
    -exports[`Error > toJSONAsync > supports Error.prototype.cause 1`] = `"{"t":{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":12,"i":1,"s":1,"f":{"t":13,"i":2,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}],"s":2}},"f":31,"m":[]}"`;
    +exports[`Error > toJSONAsync > supports Error.prototype.cause 1`] = `"{"t":{"t":13,"i":0,"s":0,"m":"B","p":{"k":["stack","cause"],"v":[{"t":1,"s":""},{"t":12,"i":1,"s":1,"f":{"t":13,"i":2,"s":0,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}}]}},"f":63,"m":[]}"`;
     
    -exports[`Error > toJSONAsync > supports Error.prototype.name 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}],"s":2}}},"f":31,"m":[]}"`;
    +exports[`Error > toJSONAsync > supports Error.prototype.name 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":0,"m":"A","p":{"k":["name","stack"],"v":[{"t":1,"s":"ExampleError"},{"t":1,"s":""}]}}},"f":63,"m":[]}"`;
     
    -exports[`Error > toJSONAsync > supports other Error classes 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}},"f":31,"m":[]}"`;
    +exports[`Error > toJSONAsync > supports other Error classes 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":13,"i":1,"s":3,"m":"A","p":{"k":["stack"],"v":[{"t":1,"s":""}]}}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/frozen-object.test.ts.snap+18 18 modified
    @@ -1190,25 +1190,25 @@ exports[`frozen object > serializeAsync > supports Symbol.iterator 1`] = `
     
     exports[`frozen object > serializeAsync > supports self-recursion 1`] = `"(h=>(h={a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)},Object.freeze(h),h))()"`;
     
    -exports[`frozen object > toCrossJSON > supports Objects 1`] = `"{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":3}"`;
    +exports[`frozen object > toCrossJSON > supports Objects 1`] = `"{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":3}"`;
     
    -exports[`frozen object > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":3}"`;
    +exports[`frozen object > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":3}"`;
     
    -exports[`frozen object > toCrossJSON > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":3}"`;
    +exports[`frozen object > toCrossJSON > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":3}"`;
     
    -exports[`frozen object > toCrossJSONAsync > supports Objects 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":3}}"`;
    +exports[`frozen object > toCrossJSONAsync > supports Objects 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":3}}"`;
     
    -exports[`frozen object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":3}"`;
    +exports[`frozen object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":3}"`;
     
    -exports[`frozen object > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":3}}"`;
    +exports[`frozen object > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":3}}"`;
     
    -exports[`frozen object > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":3}"`;
    +exports[`frozen object > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":3}"`;
     
     exports[`frozen object > toCrossJSONStream > supports Objects 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`frozen object > toCrossJSONStream > supports Objects 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":10,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":3}]}"`;
    +exports[`frozen object > toCrossJSONStream > supports Objects 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":10,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":3}]}"`;
     
    -exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":3}"`;
    +exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}]},"o":3}"`;
     
     exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{"t":32,"i":4,"f":{"t":0,"s":1}}"`;
     
    @@ -1220,24 +1220,24 @@ exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 5`] =
     
     exports[`frozen object > toCrossJSONStream > supports Symbol.iterator 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`frozen object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":3}]}"`;
    +exports[`frozen object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":3}]}"`;
     
    -exports[`frozen object > toCrossJSONStream > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}],"s":2},"o":3}"`;
    +exports[`frozen object > toCrossJSONStream > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}]},"o":3}"`;
     
     exports[`frozen object > toCrossJSONStream > supports self-recursion 2`] = `"{"t":23,"i":2,"a":[{"t":26,"i":6,"s":2},{"t":4,"i":0}]}"`;
     
     exports[`frozen object > toCrossJSONStream > supports self-recursion 3`] = `"{"t":23,"i":5,"a":[{"t":4,"i":6},{"t":4,"i":0}]}"`;
     
    -exports[`frozen object > toJSON > supports Objects 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":3},"f":31,"m":[]}"`;
    +exports[`frozen object > toJSON > supports Objects 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":3},"f":63,"m":[]}"`;
     
    -exports[`frozen object > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":3},"f":31,"m":[1]}"`;
    +exports[`frozen object > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":3},"f":63,"m":[1]}"`;
     
    -exports[`frozen object > toJSON > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":3},"f":31,"m":[0]}"`;
    +exports[`frozen object > toJSON > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":3},"f":63,"m":[0]}"`;
     
    -exports[`frozen object > toJSONAsync > supports Objects 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":3}},"f":31,"m":[]}"`;
    +exports[`frozen object > toJSONAsync > supports Objects 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":3}},"f":63,"m":[]}"`;
     
    -exports[`frozen object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":3},"f":31,"m":[1,4]}"`;
    +exports[`frozen object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":3},"f":63,"m":[1,4]}"`;
     
    -exports[`frozen object > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":3}},"f":31,"m":[2]}"`;
    +exports[`frozen object > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":3}},"f":63,"m":[2]}"`;
     
    -exports[`frozen object > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":3},"f":31,"m":[0]}"`;
    +exports[`frozen object > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":3},"f":63,"m":[0]}"`;
    
  • packages/seroval/test/__snapshots__/iterable.test.ts.snap+5 5 modified
    @@ -254,14 +254,14 @@ exports[`Iterable > serializeAsync > supports Iterables 1`] = `
     })(h))({v:[1,2,3,void 0],t:-1,d:3})}))()"
     `;
     
    -exports[`Iterable > toCrossJSON > supports Iterables 1`] = `"{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":2},"o":0}"`;
    +exports[`Iterable > toCrossJSON > supports Iterables 1`] = `"{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}"`;
     
    -exports[`Iterable > toCrossJSONAsync > supports Iterables 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["title",{"t":17,"i":2,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":2},"o":0}}"`;
    +exports[`Iterable > toCrossJSONAsync > supports Iterables 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["title",{"t":17,"i":2,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}}"`;
     
     exports[`Iterable > toCrossJSONStream > supports Iterables 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`Iterable > toCrossJSONStream > supports Iterables 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":["title",{"t":17,"i":4,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":2},"o":0}]}"`;
    +exports[`Iterable > toCrossJSONStream > supports Iterables 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":["title",{"t":17,"i":4,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}]}"`;
     
    -exports[`Iterable > toJSON > supports Iterables 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":2},"o":0},"f":31,"m":[1]}"`;
    +exports[`Iterable > toJSON > supports Iterables 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["title",{"t":17,"i":1,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0},"f":63,"m":[1]}"`;
     
    -exports[`Iterable > toJSONAsync > supports Iterables 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["title",{"t":17,"i":2,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":2},"o":0}},"f":31,"m":[2]}"`;
    +exports[`Iterable > toJSONAsync > supports Iterables 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["title",{"t":17,"i":2,"s":3}],"v":[{"t":1,"s":"Hello World"},{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}},"f":63,"m":[2]}"`;
    
  • packages/seroval/test/__snapshots__/map.test.ts.snap+10 10 modified
    @@ -89,7 +89,7 @@ exports[`Map > crossSerializeStream > supports Map 2`] = `
     
     exports[`Map > crossSerializeStream > supports Map 3`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`Map > crossSerializeStream > supports Map 4`] = `"{"t":23,"i":1,"a":[{"t":26,"i":5,"s":2},{"t":8,"i":3,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}],"s":2},"f":{"t":26,"i":4,"s":0}}]}"`;
    +exports[`Map > crossSerializeStream > supports Map 4`] = `"{"t":23,"i":1,"a":[{"t":26,"i":5,"s":2},{"t":8,"i":3,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}]},"f":{"t":26,"i":4,"s":0}}]}"`;
     
     exports[`Map > crossSerializeStream > supports self-recursion 1`] = `
     "$R[0]=($R[6]=[],new Map([[$R[1]=($R[2]=($R[3]=() => {
    @@ -116,7 +116,7 @@ exports[`Map > crossSerializeStream > supports self-recursion 2`] = `
     
     exports[`Map > crossSerializeStream > supports self-recursion 3`] = `"$R[7]($R[5],$R[0])"`;
     
    -exports[`Map > crossSerializeStream > supports self-recursion 4`] = `"{"t":8,"i":0,"e":{"k":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}}],"v":[{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}],"s":1},"f":{"t":26,"i":6,"s":0}}"`;
    +exports[`Map > crossSerializeStream > supports self-recursion 4`] = `"{"t":8,"i":0,"e":{"k":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}}],"v":[{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}]},"f":{"t":26,"i":6,"s":0}}"`;
     
     exports[`Map > crossSerializeStream > supports self-recursion 5`] = `"{"t":23,"i":2,"a":[{"t":26,"i":7,"s":2},{"t":4,"i":0}]}"`;
     
    @@ -130,18 +130,18 @@ exports[`Map > serializeAsync > supports Map 1`] = `"(h=>Promise.resolve((h=[],n
     
     exports[`Map > serializeAsync > supports self-recursion 1`] = `"((h,j)=>j=(h=[],new Map([[Promise.resolve().then(()=>j),Promise.resolve().then(()=>j)]])))()"`;
     
    -exports[`Map > toCrossJSON > supports Map 1`] = `"{"t":8,"i":0,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}],"s":2},"f":{"t":26,"i":1,"s":0}}"`;
    +exports[`Map > toCrossJSON > supports Map 1`] = `"{"t":8,"i":0,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}]},"f":{"t":26,"i":1,"s":0}}"`;
     
    -exports[`Map > toCrossJSON > supports self-recursion 1`] = `"{"t":8,"i":0,"e":{"k":[{"t":4,"i":0}],"v":[{"t":4,"i":0}],"s":1},"f":{"t":26,"i":1,"s":0}}"`;
    +exports[`Map > toCrossJSON > supports self-recursion 1`] = `"{"t":8,"i":0,"e":{"k":[{"t":4,"i":0}],"v":[{"t":4,"i":0}]},"f":{"t":26,"i":1,"s":0}}"`;
     
    -exports[`Map > toCrossJSONAsync > supports Map 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":8,"i":1,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}],"s":2},"f":{"t":26,"i":2,"s":0}}}"`;
    +exports[`Map > toCrossJSONAsync > supports Map 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":8,"i":1,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}]},"f":{"t":26,"i":2,"s":0}}}"`;
     
    -exports[`Map > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":8,"i":0,"e":{"k":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}],"v":[{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":1},"f":{"t":26,"i":3,"s":0}}"`;
    +exports[`Map > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":8,"i":0,"e":{"k":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}],"v":[{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"f":{"t":26,"i":3,"s":0}}"`;
     
    -exports[`Map > toJSON > supports Map 1`] = `"{"t":{"t":8,"i":0,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}],"s":2},"f":{"t":26,"i":1,"s":0}},"f":31,"m":[]}"`;
    +exports[`Map > toJSON > supports Map 1`] = `"{"t":{"t":8,"i":0,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}]},"f":{"t":26,"i":1,"s":0}},"f":63,"m":[]}"`;
     
    -exports[`Map > toJSON > supports self-recursion 1`] = `"{"t":{"t":8,"i":0,"e":{"k":[{"t":4,"i":0}],"v":[{"t":4,"i":0}],"s":1},"f":{"t":26,"i":1,"s":0}},"f":31,"m":[0]}"`;
    +exports[`Map > toJSON > supports self-recursion 1`] = `"{"t":{"t":8,"i":0,"e":{"k":[{"t":4,"i":0}],"v":[{"t":4,"i":0}]},"f":{"t":26,"i":1,"s":0}},"f":63,"m":[0]}"`;
     
    -exports[`Map > toJSONAsync > supports Map 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":8,"i":1,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}],"s":2},"f":{"t":26,"i":2,"s":0}}},"f":31,"m":[]}"`;
    +exports[`Map > toJSONAsync > supports Map 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":8,"i":1,"e":{"k":[{"t":0,"s":1},{"t":0,"s":3}],"v":[{"t":0,"s":2},{"t":0,"s":4}]},"f":{"t":26,"i":2,"s":0}}},"f":63,"m":[]}"`;
     
    -exports[`Map > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":8,"i":0,"e":{"k":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}],"v":[{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":1},"f":{"t":26,"i":3,"s":0}},"f":31,"m":[0]}"`;
    +exports[`Map > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":8,"i":0,"e":{"k":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}],"v":[{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"f":{"t":26,"i":3,"s":0}},"f":63,"m":[0]}"`;
    
  • packages/seroval/test/__snapshots__/mutual-cycle.test.ts.snap+15 15 modified
    @@ -186,44 +186,44 @@ exports[`mutual cyclic references > serializeAsync > supports Arrays and Objects
     
     exports[`mutual cyclic references > serializeAsync > supports Objects and Objects 1`] = `"((h,j)=>[h={0:Promise.resolve(j={0:Promise.resolve().then(()=>h)})},j])()"`;
     
    -exports[`mutual cyclic references > toCrossJSON > supports Arrays and Arrays 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":9,"i":2,"l":1,"a":[{"t":4,"i":1}],"o":0}],"o":0},{"t":4,"i":2}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSON > supports Arrays and Arrays 1`] = `"{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":9,"i":2,"a":[{"t":4,"i":1}],"o":0}],"o":0},{"t":4,"i":2}],"o":0}"`;
     
    -exports[`mutual cyclic references > toCrossJSON > supports Arrays and Objects 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}],"s":1},"o":0}],"o":0},{"t":4,"i":2}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSON > supports Arrays and Objects 1`] = `"{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}]},"o":0}],"o":0},{"t":4,"i":2}],"o":0}"`;
     
    -exports[`mutual cyclic references > toCrossJSON > supports Objects and Objects 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}],"s":1},"o":0}],"s":1},"o":0},{"t":4,"i":2}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSON > supports Objects and Objects 1`] = `"{"t":9,"i":0,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}]},"o":0}]},"o":0},{"t":4,"i":2}],"o":0}"`;
     
    -exports[`mutual cyclic references > toCrossJSONAsync > supports Arrays and Arrays 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":9,"i":3,"l":1,"a":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"o":0}}],"o":0},{"t":4,"i":3}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSONAsync > supports Arrays and Arrays 1`] = `"{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":9,"i":3,"a":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"o":0}}],"o":0},{"t":4,"i":3}],"o":0}"`;
     
    -exports[`mutual cyclic references > toCrossJSONAsync > supports Arrays and Objects 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"s":1},"o":0}}],"o":0},{"t":4,"i":3}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSONAsync > supports Arrays and Objects 1`] = `"{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}]},"o":0}}],"o":0},{"t":4,"i":3}],"o":0}"`;
     
    -exports[`mutual cyclic references > toCrossJSONAsync > supports Objects and Objects 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"s":1},"o":0}}],"s":1},"o":0},{"t":4,"i":3}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSONAsync > supports Objects and Objects 1`] = `"{"t":9,"i":0,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}]},"o":0}}]},"o":0},{"t":4,"i":3}],"o":0}"`;
     
    -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":22,"i":2,"s":3,"f":{"t":26,"i":4,"s":1}}],"o":0},{"t":9,"i":5,"l":1,"a":[{"t":22,"i":6,"s":7,"f":{"t":4,"i":4}}],"o":0}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 1`] = `"{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":22,"i":2,"s":3,"f":{"t":26,"i":4,"s":1}}],"o":0},{"t":9,"i":5,"a":[{"t":22,"i":6,"s":7,"f":{"t":4,"i":4}}],"o":0}],"o":0}"`;
     
     exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 2`] = `"{"t":23,"i":3,"a":[{"t":26,"i":8,"s":2},{"t":4,"i":5}]}"`;
     
     exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 3`] = `"{"t":23,"i":7,"a":[{"t":4,"i":8},{"t":4,"i":1}]}"`;
     
    -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":22,"i":2,"s":3,"f":{"t":26,"i":4,"s":1}}],"o":0},{"t":10,"i":5,"p":{"k":["0"],"v":[{"t":22,"i":6,"s":7,"f":{"t":4,"i":4}}],"s":1},"o":0}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 1`] = `"{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":22,"i":2,"s":3,"f":{"t":26,"i":4,"s":1}}],"o":0},{"t":10,"i":5,"p":{"k":["0"],"v":[{"t":22,"i":6,"s":7,"f":{"t":4,"i":4}}]},"o":0}],"o":0}"`;
     
     exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 2`] = `"{"t":23,"i":3,"a":[{"t":26,"i":8,"s":2},{"t":4,"i":5}]}"`;
     
     exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 3`] = `"{"t":23,"i":7,"a":[{"t":4,"i":8},{"t":4,"i":1}]}"`;
     
    -exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 1`] = `"{"t":9,"i":0,"l":2,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":22,"i":2,"s":3,"f":{"t":26,"i":4,"s":1}}],"s":1},"o":0},{"t":10,"i":5,"p":{"k":["0"],"v":[{"t":22,"i":6,"s":7,"f":{"t":4,"i":4}}],"s":1},"o":0}],"o":0}"`;
    +exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 1`] = `"{"t":9,"i":0,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":22,"i":2,"s":3,"f":{"t":26,"i":4,"s":1}}]},"o":0},{"t":10,"i":5,"p":{"k":["0"],"v":[{"t":22,"i":6,"s":7,"f":{"t":4,"i":4}}]},"o":0}],"o":0}"`;
     
     exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 2`] = `"{"t":23,"i":3,"a":[{"t":26,"i":8,"s":2},{"t":4,"i":5}]}"`;
     
     exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 3`] = `"{"t":23,"i":7,"a":[{"t":4,"i":8},{"t":4,"i":1}]}"`;
     
    -exports[`mutual cyclic references > toJSON > supports Arrays and Arrays 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":9,"i":2,"l":1,"a":[{"t":4,"i":1}],"o":0}],"o":0},{"t":4,"i":2}],"o":0},"f":31,"m":[1,2]}"`;
    +exports[`mutual cyclic references > toJSON > supports Arrays and Arrays 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":9,"i":2,"a":[{"t":4,"i":1}],"o":0}],"o":0},{"t":4,"i":2}],"o":0},"f":63,"m":[1,2]}"`;
     
    -exports[`mutual cyclic references > toJSON > supports Arrays and Objects 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}],"s":1},"o":0}],"o":0},{"t":4,"i":2}],"o":0},"f":31,"m":[1,2]}"`;
    +exports[`mutual cyclic references > toJSON > supports Arrays and Objects 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}]},"o":0}],"o":0},{"t":4,"i":2}],"o":0},"f":63,"m":[1,2]}"`;
     
    -exports[`mutual cyclic references > toJSON > supports Objects and Objects 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}],"s":1},"o":0}],"s":1},"o":0},{"t":4,"i":2}],"o":0},"f":31,"m":[1,2]}"`;
    +exports[`mutual cyclic references > toJSON > supports Objects and Objects 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":10,"i":2,"p":{"k":["0"],"v":[{"t":4,"i":1}]},"o":0}]},"o":0},{"t":4,"i":2}],"o":0},"f":63,"m":[1,2]}"`;
     
    -exports[`mutual cyclic references > toJSONAsync > supports Arrays and Arrays 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":9,"i":3,"l":1,"a":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"o":0}}],"o":0},{"t":4,"i":3}],"o":0},"f":31,"m":[1,3]}"`;
    +exports[`mutual cyclic references > toJSONAsync > supports Arrays and Arrays 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":9,"i":3,"a":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"o":0}}],"o":0},{"t":4,"i":3}],"o":0},"f":63,"m":[1,3]}"`;
     
    -exports[`mutual cyclic references > toJSONAsync > supports Arrays and Objects 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":9,"i":1,"l":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"s":1},"o":0}}],"o":0},{"t":4,"i":3}],"o":0},"f":31,"m":[1,3]}"`;
    +exports[`mutual cyclic references > toJSONAsync > supports Arrays and Objects 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":9,"i":1,"a":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}]},"o":0}}],"o":0},{"t":4,"i":3}],"o":0},"f":63,"m":[1,3]}"`;
     
    -exports[`mutual cyclic references > toJSONAsync > supports Objects and Objects 1`] = `"{"t":{"t":9,"i":0,"l":2,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}],"s":1},"o":0}}],"s":1},"o":0},{"t":4,"i":3}],"o":0},"f":31,"m":[1,3]}"`;
    +exports[`mutual cyclic references > toJSONAsync > supports Objects and Objects 1`] = `"{"t":{"t":9,"i":0,"a":[{"t":10,"i":1,"p":{"k":["0"],"v":[{"t":12,"i":2,"s":1,"f":{"t":10,"i":3,"p":{"k":["0"],"v":[{"t":12,"i":4,"s":1,"f":{"t":4,"i":1}}]},"o":0}}]},"o":0},{"t":4,"i":3}],"o":0},"f":63,"m":[1,3]}"`;
    
  • packages/seroval/test/__snapshots__/null-constructor.test.ts.snap+19 19 modified
    @@ -2,7 +2,7 @@
     
     exports[`null-constructor > compat > should use manual assignment instead of Object.assign 1`] = `"(h=>h=(h=Object.create(null),h.example="valid identifier",h["%example"]="invalid identifier",h["0x1"]="hexadecimal",h["0b1"]="binary",h["0o1"]="octal",h["1_000"]="numeric separator",h[1.7976931348623157e+308]="exponentiation",h))()"`;
     
    -exports[`null-constructor > compat#toJSON > should use manual assignment instead of Object.assign 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0},"f":23,"m":[]}"`;
    +exports[`null-constructor > compat#toJSON > should use manual assignment instead of Object.assign 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0},"f":55,"m":[]}"`;
     
     exports[`null-constructor > compat#toJSON > should use manual assignment instead of Object.assign 2`] = `"(h=>h=(h=Object.create(null),h.example="valid identifier",h["%example"]="invalid identifier",h["0x1"]="hexadecimal",h["0b1"]="binary",h["0o1"]="octal",h["1_000"]="numeric separator",h[1.7976931348623157e+308]="exponentiation",h))()"`;
     
    @@ -1196,25 +1196,25 @@ exports[`null-constructor > serializeAsync > supports Symbol.iterator 1`] = `
     
     exports[`null-constructor > serializeAsync > supports self-recursion 1`] = `"(h=>h=Object.assign(Object.create(null),{a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)}))()"`;
     
    -exports[`null-constructor > toCrossJSON > supports Object.create(null) 1`] = `"{"t":11,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}"`;
    +exports[`null-constructor > toCrossJSON > supports Object.create(null) 1`] = `"{"t":11,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}"`;
     
    -exports[`null-constructor > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}"`;
    +exports[`null-constructor > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}"`;
     
    -exports[`null-constructor > toCrossJSON > supports self-recursion 1`] = `"{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":0}"`;
    +exports[`null-constructor > toCrossJSON > supports self-recursion 1`] = `"{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":0}"`;
     
    -exports[`null-constructor > toCrossJSONAsync > supports Object.create(null) 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}}"`;
    +exports[`null-constructor > toCrossJSONAsync > supports Object.create(null) 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}}"`;
     
    -exports[`null-constructor > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":0}"`;
    +exports[`null-constructor > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":0}"`;
     
    -exports[`null-constructor > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}}"`;
    +exports[`null-constructor > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}}"`;
     
    -exports[`null-constructor > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":0}"`;
    +exports[`null-constructor > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":0}"`;
     
     exports[`null-constructor > toCrossJSONStream > supports Object.create(null) 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`null-constructor > toCrossJSONStream > supports Object.create(null) 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":11,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}]}"`;
    +exports[`null-constructor > toCrossJSONStream > supports Object.create(null) 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":11,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}]}"`;
     
    -exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":0}"`;
    +exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}]},"o":0}"`;
     
     exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{"t":32,"i":4,"f":{"t":0,"s":1}}"`;
     
    @@ -1226,24 +1226,24 @@ exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 5`
     
     exports[`null-constructor > toCrossJSONStream > supports Symbol.iterator 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`null-constructor > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":11,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}]}"`;
    +exports[`null-constructor > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":11,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}]}"`;
     
    -exports[`null-constructor > toCrossJSONStream > supports self-recursion 1`] = `"{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}],"s":2},"o":0}"`;
    +exports[`null-constructor > toCrossJSONStream > supports self-recursion 1`] = `"{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}]},"o":0}"`;
     
     exports[`null-constructor > toCrossJSONStream > supports self-recursion 2`] = `"{"t":23,"i":2,"a":[{"t":26,"i":6,"s":2},{"t":4,"i":0}]}"`;
     
     exports[`null-constructor > toCrossJSONStream > supports self-recursion 3`] = `"{"t":23,"i":5,"a":[{"t":4,"i":6},{"t":4,"i":0}]}"`;
     
    -exports[`null-constructor > toJSON > supports Object.create(null) 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0},"f":31,"m":[]}"`;
    +exports[`null-constructor > toJSON > supports Object.create(null) 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0},"f":63,"m":[]}"`;
     
    -exports[`null-constructor > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0},"f":31,"m":[1]}"`;
    +exports[`null-constructor > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0},"f":63,"m":[1]}"`;
     
    -exports[`null-constructor > toJSON > supports self-recursion 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":0},"f":31,"m":[0]}"`;
    +exports[`null-constructor > toJSON > supports self-recursion 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":0},"f":63,"m":[0]}"`;
     
    -exports[`null-constructor > toJSONAsync > supports Object.create(null) 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}},"f":31,"m":[]}"`;
    +exports[`null-constructor > toJSONAsync > supports Object.create(null) 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}},"f":63,"m":[]}"`;
     
    -exports[`null-constructor > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":0},"f":31,"m":[1,4]}"`;
    +exports[`null-constructor > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":11,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":0},"f":63,"m":[1,4]}"`;
     
    -exports[`null-constructor > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}},"f":31,"m":[2]}"`;
    +exports[`null-constructor > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":11,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}},"f":63,"m":[2]}"`;
     
    -exports[`null-constructor > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":0},"f":31,"m":[0]}"`;
    +exports[`null-constructor > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":11,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":0},"f":63,"m":[0]}"`;
    
  • packages/seroval/test/__snapshots__/number.test.ts.snap+10 10 modified
    @@ -175,22 +175,22 @@ exports[`number > toCrossJSONStream > supports numbers 1`] = `"{"t":22,"i":0,"s"
     
     exports[`number > toCrossJSONStream > supports numbers 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":3,"s":2},{"t":0,"s":3735928559}]}"`;
     
    -exports[`number > toJSON > supports numbers 1`] = `"{"t":{"t":0,"s":3735928559},"f":31,"m":[]}"`;
    +exports[`number > toJSON > supports numbers 1`] = `"{"t":{"t":0,"s":3735928559},"f":63,"m":[]}"`;
     
    -exports[`number > toJSON > supports numbers 2`] = `"{"t":{"t":2,"s":7},"f":31,"m":[]}"`;
    +exports[`number > toJSON > supports numbers 2`] = `"{"t":{"t":2,"s":7},"f":63,"m":[]}"`;
     
    -exports[`number > toJSON > supports numbers 3`] = `"{"t":{"t":2,"s":5},"f":31,"m":[]}"`;
    +exports[`number > toJSON > supports numbers 3`] = `"{"t":{"t":2,"s":5},"f":63,"m":[]}"`;
     
    -exports[`number > toJSON > supports numbers 4`] = `"{"t":{"t":2,"s":6},"f":31,"m":[]}"`;
    +exports[`number > toJSON > supports numbers 4`] = `"{"t":{"t":2,"s":6},"f":63,"m":[]}"`;
     
    -exports[`number > toJSON > supports numbers 5`] = `"{"t":{"t":2,"s":4},"f":31,"m":[]}"`;
    +exports[`number > toJSON > supports numbers 5`] = `"{"t":{"t":2,"s":4},"f":63,"m":[]}"`;
     
    -exports[`number > toJSONAsync > supports numbers 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":0,"s":3735928559}},"f":31,"m":[]}"`;
    +exports[`number > toJSONAsync > supports numbers 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":0,"s":3735928559}},"f":63,"m":[]}"`;
     
    -exports[`number > toJSONAsync > supports numbers 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":7}},"f":31,"m":[]}"`;
    +exports[`number > toJSONAsync > supports numbers 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":7}},"f":63,"m":[]}"`;
     
    -exports[`number > toJSONAsync > supports numbers 3`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":5}},"f":31,"m":[]}"`;
    +exports[`number > toJSONAsync > supports numbers 3`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":5}},"f":63,"m":[]}"`;
     
    -exports[`number > toJSONAsync > supports numbers 4`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":6}},"f":31,"m":[]}"`;
    +exports[`number > toJSONAsync > supports numbers 4`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":6}},"f":63,"m":[]}"`;
     
    -exports[`number > toJSONAsync > supports numbers 5`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":4}},"f":31,"m":[]}"`;
    +exports[`number > toJSONAsync > supports numbers 5`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":2,"s":4}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/object.test.ts.snap+19 19 modified
    @@ -2,7 +2,7 @@
     
     exports[`objects > compat > should use manual assignment instead of Object.assign 1`] = `"({example:"valid identifier","%example":"invalid identifier","0x1":"hexadecimal","0b1":"binary","0o1":"octal","1_000":"numeric separator",1.7976931348623157e+308:"exponentiation"})"`;
     
    -exports[`objects > compat#toJSON > should use manual assignment instead of Object.assign 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0},"f":23,"m":[]}"`;
    +exports[`objects > compat#toJSON > should use manual assignment instead of Object.assign 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0},"f":55,"m":[]}"`;
     
     exports[`objects > compat#toJSON > should use manual assignment instead of Object.assign 2`] = `"({example:"valid identifier","%example":"invalid identifier","0x1":"hexadecimal","0b1":"binary","0o1":"octal","1_000":"numeric separator",1.7976931348623157e+308:"exponentiation"})"`;
     
    @@ -1196,25 +1196,25 @@ exports[`objects > serializeAsync > supports Symbol.iterator 1`] = `
     
     exports[`objects > serializeAsync > supports self-recursion 1`] = `"(h=>h={a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)})()"`;
     
    -exports[`objects > toCrossJSON > supports Objects 1`] = `"{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}"`;
    +exports[`objects > toCrossJSON > supports Objects 1`] = `"{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}"`;
     
    -exports[`objects > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}"`;
    +exports[`objects > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}"`;
     
    -exports[`objects > toCrossJSON > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":0}"`;
    +exports[`objects > toCrossJSON > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":0}"`;
     
    -exports[`objects > toCrossJSONAsync > supports Objects 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}}"`;
    +exports[`objects > toCrossJSONAsync > supports Objects 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}}"`;
     
    -exports[`objects > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":0}"`;
    +exports[`objects > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":0}"`;
     
    -exports[`objects > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}}"`;
    +exports[`objects > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}}"`;
     
    -exports[`objects > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":0}"`;
    +exports[`objects > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":0}"`;
     
     exports[`objects > toCrossJSONStream > supports Objects 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`objects > toCrossJSONStream > supports Objects 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":10,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}]}"`;
    +exports[`objects > toCrossJSONStream > supports Objects 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":10,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}]}"`;
     
    -exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":0}"`;
    +exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}]},"o":0}"`;
     
     exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{"t":32,"i":4,"f":{"t":0,"s":1}}"`;
     
    @@ -1226,24 +1226,24 @@ exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{"t
     
     exports[`objects > toCrossJSONStream > supports Symbol.iterator 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`objects > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}]}"`;
    +exports[`objects > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}]}"`;
     
    -exports[`objects > toCrossJSONStream > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}],"s":2},"o":0}"`;
    +exports[`objects > toCrossJSONStream > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}]},"o":0}"`;
     
     exports[`objects > toCrossJSONStream > supports self-recursion 2`] = `"{"t":23,"i":2,"a":[{"t":26,"i":6,"s":2},{"t":4,"i":0}]}"`;
     
     exports[`objects > toCrossJSONStream > supports self-recursion 3`] = `"{"t":23,"i":5,"a":[{"t":4,"i":6},{"t":4,"i":0}]}"`;
     
    -exports[`objects > toJSON > supports Objects 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0},"f":31,"m":[]}"`;
    +exports[`objects > toJSON > supports Objects 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0},"f":63,"m":[]}"`;
     
    -exports[`objects > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0},"f":31,"m":[1]}"`;
    +exports[`objects > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0},"f":63,"m":[1]}"`;
     
    -exports[`objects > toJSON > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":0},"f":31,"m":[0]}"`;
    +exports[`objects > toJSON > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":0},"f":63,"m":[0]}"`;
     
    -exports[`objects > toJSONAsync > supports Objects 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":0}},"f":31,"m":[]}"`;
    +exports[`objects > toJSONAsync > supports Objects 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":0}},"f":63,"m":[]}"`;
     
    -exports[`objects > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":0},"f":31,"m":[1,4]}"`;
    +exports[`objects > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":0},"f":63,"m":[1,4]}"`;
     
    -exports[`objects > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":0}},"f":31,"m":[2]}"`;
    +exports[`objects > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":0}},"f":63,"m":[2]}"`;
     
    -exports[`objects > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":0},"f":31,"m":[0]}"`;
    +exports[`objects > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":0},"f":63,"m":[0]}"`;
    
  • packages/seroval/test/__snapshots__/opaque-reference.test.ts.snap+10 10 modified
    @@ -32,22 +32,22 @@ exports[`OpaqueReference > serializeAsync > supports OpaqueReference 1`] = `"({t
     
     exports[`OpaqueReference > serializeAsync > supports OpaqueReference with replacement 1`] = `"({transparent:"This is transparent",opaque:"This is a dummy value."})"`;
     
    -exports[`OpaqueReference > toCrossJSON > supports OpaqueReference 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}],"s":2},"o":0}"`;
    +exports[`OpaqueReference > toCrossJSON > supports OpaqueReference 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}]},"o":0}"`;
     
    -exports[`OpaqueReference > toCrossJSON > supports OpaqueReference with replacement 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}],"s":2},"o":0}"`;
    +exports[`OpaqueReference > toCrossJSON > supports OpaqueReference with replacement 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}]},"o":0}"`;
     
    -exports[`OpaqueReference > toCrossJSONAsync > supports OpaqueReference 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}],"s":2},"o":0}"`;
    +exports[`OpaqueReference > toCrossJSONAsync > supports OpaqueReference 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}]},"o":0}"`;
     
    -exports[`OpaqueReference > toCrossJSONAsync > supports OpaqueReference with replacement 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}],"s":2},"o":0}"`;
    +exports[`OpaqueReference > toCrossJSONAsync > supports OpaqueReference with replacement 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}]},"o":0}"`;
     
    -exports[`OpaqueReference > toCrossJSONStream > supports OpaqueReference 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}],"s":2},"o":0}"`;
    +exports[`OpaqueReference > toCrossJSONStream > supports OpaqueReference 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}]},"o":0}"`;
     
    -exports[`OpaqueReference > toCrossJSONStream > supports OpaqueReference with replacement 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}],"s":2},"o":0}"`;
    +exports[`OpaqueReference > toCrossJSONStream > supports OpaqueReference with replacement 1`] = `"{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}]},"o":0}"`;
     
    -exports[`OpaqueReference > toJSON > supports OpaqueReference 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}],"s":2},"o":0},"f":31,"m":[]}"`;
    +exports[`OpaqueReference > toJSON > supports OpaqueReference 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}]},"o":0},"f":63,"m":[]}"`;
     
    -exports[`OpaqueReference > toJSON > supports OpaqueReference with replacement 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}],"s":2},"o":0},"f":31,"m":[]}"`;
    +exports[`OpaqueReference > toJSON > supports OpaqueReference with replacement 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}]},"o":0},"f":63,"m":[]}"`;
     
    -exports[`OpaqueReference > toJSONAsync > supports OpaqueReference 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}],"s":2},"o":0},"f":31,"m":[]}"`;
    +exports[`OpaqueReference > toJSONAsync > supports OpaqueReference 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":2,"s":1}]},"o":0},"f":63,"m":[]}"`;
     
    -exports[`OpaqueReference > toJSONAsync > supports OpaqueReference with replacement 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}],"s":2},"o":0},"f":31,"m":[]}"`;
    +exports[`OpaqueReference > toJSONAsync > supports OpaqueReference with replacement 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["transparent","opaque"],"v":[{"t":1,"s":"This is transparent"},{"t":1,"s":"This is a dummy value."}]},"o":0},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/plugin.test.ts.snap+2 2 modified
    @@ -22,6 +22,6 @@ exports[`Plugin > toCrossJSONAsync > supports Plugin 1`] = `"{"t":12,"i":0,"s":1
     
     exports[`Plugin > toCrossJSONStream > supports Plugin 1`] = `"{"t":25,"i":0,"s":{"t":1,"s":"SGVsbG8sIFdvcmxkIQ=="},"c":"Buffer"}"`;
     
    -exports[`Plugin > toJSON > supports Plugin 1`] = `"{"t":{"t":25,"i":0,"s":{"t":1,"s":"SGVsbG8sIFdvcmxkIQ=="},"c":"Buffer"},"f":31,"m":[]}"`;
    +exports[`Plugin > toJSON > supports Plugin 1`] = `"{"t":{"t":25,"i":0,"s":{"t":1,"s":"SGVsbG8sIFdvcmxkIQ=="},"c":"Buffer"},"f":63,"m":[]}"`;
     
    -exports[`Plugin > toJSONAsync > supports Plugin 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"SGVsbG8sIFdvcmxkIQ=="},"c":"Buffer"}},"f":31,"m":[]}"`;
    +exports[`Plugin > toJSONAsync > supports Plugin 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":25,"i":1,"s":{"t":1,"s":"SGVsbG8sIFdvcmxkIQ=="},"c":"Buffer"}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/reference.test.ts.snap+2 2 modified
    @@ -66,6 +66,6 @@ exports[`Reference > toCrossJSONStream > supports Reference 1`] = `"{"t":22,"i":
     
     exports[`Reference > toCrossJSONStream > supports Reference 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":18,"i":3,"s":"example"}]}"`;
     
    -exports[`Reference > toJSON > supports Reference 1`] = `"{"t":{"t":18,"i":0,"s":"example"},"f":31,"m":[]}"`;
    +exports[`Reference > toJSON > supports Reference 1`] = `"{"t":{"t":18,"i":0,"s":"example"},"f":63,"m":[]}"`;
     
    -exports[`Reference > toJSONAsync > supports Reference 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":18,"i":1,"s":"example"}},"f":31,"m":[]}"`;
    +exports[`Reference > toJSONAsync > supports Reference 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":18,"i":1,"s":"example"}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/regexp.test.ts.snap+2 2 modified
    @@ -66,6 +66,6 @@ exports[`RegExp > toCrossJSONStream > supports RegExp 1`] = `"{"t":22,"i":0,"s":
     
     exports[`RegExp > toCrossJSONStream > supports RegExp 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":6,"i":3,"c":"[a-z0-9]+","m":"i"}]}"`;
     
    -exports[`RegExp > toJSON > supports RegExp 1`] = `"{"t":{"t":6,"i":0,"c":"[a-z0-9]+","m":"i"},"f":31,"m":[]}"`;
    +exports[`RegExp > toJSON > supports RegExp 1`] = `"{"t":{"t":6,"i":0,"c":"[a-z0-9]+","m":"i"},"f":63,"m":[]}"`;
     
    -exports[`RegExp > toJSONAsync > supports RegExp 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":6,"i":1,"c":"[a-z0-9]+","m":"i"}},"f":31,"m":[]}"`;
    +exports[`RegExp > toJSONAsync > supports RegExp 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":6,"i":1,"c":"[a-z0-9]+","m":"i"}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/sealed-object.test.ts.snap+18 18 modified
    @@ -1190,25 +1190,25 @@ exports[`sealed object > serializeAsync > supports Symbol.iterator 1`] = `
     
     exports[`sealed object > serializeAsync > supports self-recursion 1`] = `"(h=>(h={a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)},Object.seal(h),h))()"`;
     
    -exports[`sealed object > toCrossJSON > supports Objects 1`] = `"{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":2}"`;
    +exports[`sealed object > toCrossJSON > supports Objects 1`] = `"{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":2}"`;
     
    -exports[`sealed object > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":2}"`;
    +exports[`sealed object > toCrossJSON > supports Symbol.iterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":2}"`;
     
    -exports[`sealed object > toCrossJSON > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":2}"`;
    +exports[`sealed object > toCrossJSON > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":2}"`;
     
    -exports[`sealed object > toCrossJSONAsync > supports Objects 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":2}}"`;
    +exports[`sealed object > toCrossJSONAsync > supports Objects 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":2}}"`;
     
    -exports[`sealed object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":2}"`;
    +exports[`sealed object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":2}"`;
     
    -exports[`sealed object > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":2}}"`;
    +exports[`sealed object > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":2}}"`;
     
    -exports[`sealed object > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":2}"`;
    +exports[`sealed object > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":2}"`;
     
     exports[`sealed object > toCrossJSONStream > supports Objects 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`sealed object > toCrossJSONStream > supports Objects 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":10,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":2}]}"`;
    +exports[`sealed object > toCrossJSONStream > supports Objects 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":10,"i":3,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":2}]}"`;
     
    -exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":2}"`;
    +exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[],"f":{"t":26,"i":5,"s":4}}]}]},"o":2}"`;
     
     exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{"t":32,"i":4,"f":{"t":0,"s":1}}"`;
     
    @@ -1220,24 +1220,24 @@ exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 5`] =
     
     exports[`sealed object > toCrossJSONStream > supports Symbol.iterator 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`sealed object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":2}]}"`;
    +exports[`sealed object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":8,"s":2},{"t":10,"i":3,"p":{"k":[{"t":17,"i":4,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":5,"f":{"t":4,"i":4}},{"t":10,"i":6,"p":{"k":["v","t","d"],"v":[{"t":9,"i":7,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":2}]}"`;
     
    -exports[`sealed object > toCrossJSONStream > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}],"s":2},"o":2}"`;
    +exports[`sealed object > toCrossJSONStream > supports self-recursion 1`] = `"{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":22,"i":1,"s":2,"f":{"t":26,"i":3,"s":1}},{"t":22,"i":4,"s":5,"f":{"t":4,"i":3}}]},"o":2}"`;
     
     exports[`sealed object > toCrossJSONStream > supports self-recursion 2`] = `"{"t":23,"i":2,"a":[{"t":26,"i":6,"s":2},{"t":4,"i":0}]}"`;
     
     exports[`sealed object > toCrossJSONStream > supports self-recursion 3`] = `"{"t":23,"i":5,"a":[{"t":4,"i":6},{"t":4,"i":0}]}"`;
     
    -exports[`sealed object > toJSON > supports Objects 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":2},"f":31,"m":[]}"`;
    +exports[`sealed object > toJSON > supports Objects 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":2},"f":63,"m":[]}"`;
     
    -exports[`sealed object > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":2},"f":31,"m":[1]}"`;
    +exports[`sealed object > toJSON > supports Symbol.iterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":2,"f":{"t":4,"i":1}},{"t":10,"i":3,"p":{"k":["v","t","d"],"v":[{"t":9,"i":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":2},"f":63,"m":[1]}"`;
     
    -exports[`sealed object > toJSON > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}],"s":2},"o":2},"f":31,"m":[0]}"`;
    +exports[`sealed object > toJSON > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":4,"i":0},{"t":4,"i":0}]},"o":2},"f":63,"m":[0]}"`;
     
    -exports[`sealed object > toJSONAsync > supports Objects 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}],"s":7},"o":2}},"f":31,"m":[]}"`;
    +exports[`sealed object > toJSONAsync > supports Objects 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":["example","%example","0x1","0b1","0o1","1_000","1.7976931348623157e+308"],"v":[{"t":1,"s":"valid identifier"},{"t":1,"s":"invalid identifier"},{"t":1,"s":"hexadecimal"},{"t":1,"s":"binary"},{"t":1,"s":"octal"},{"t":1,"s":"numeric separator"},{"t":1,"s":"exponentiation"}]},"o":2}},"f":63,"m":[]}"`;
     
    -exports[`sealed object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}],"s":1},"o":2},"f":31,"m":[1,4]}"`;
    +exports[`sealed object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{"t":{"t":10,"i":0,"p":{"k":[{"t":17,"i":1,"s":0}],"v":[{"t":30,"a":[{"t":29,"i":2,"a":[{"t":26,"i":3,"s":1},{"t":4,"i":1}]},{"t":31,"i":4,"a":[{"t":32,"i":4,"f":{"t":0,"s":1}},{"t":32,"i":4,"f":{"t":0,"s":2}},{"t":32,"i":4,"f":{"t":0,"s":3}},{"t":34,"i":4,"f":{"t":2,"s":1}}],"f":{"t":26,"i":5,"s":4}}]}]},"o":2},"f":63,"m":[1,4]}"`;
     
    -exports[`sealed object > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"l":4,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}],"s":3},"o":0}]}],"s":1},"o":2}},"f":31,"m":[2]}"`;
    +exports[`sealed object > toJSONAsync > supports Symbol.iterator 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":10,"i":1,"p":{"k":[{"t":17,"i":2,"s":3}],"v":[{"t":28,"a":[{"t":27,"i":3,"f":{"t":4,"i":2}},{"t":10,"i":4,"p":{"k":["v","t","d"],"v":[{"t":9,"i":5,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3},{"t":2,"s":1}],"o":0},{"t":0,"s":-1},{"t":0,"s":3}]},"o":0}]}]},"o":2}},"f":63,"m":[2]}"`;
     
    -exports[`sealed object > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}],"s":2},"o":2},"f":31,"m":[0]}"`;
    +exports[`sealed object > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":10,"i":0,"p":{"k":["a","b"],"v":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}},{"t":12,"i":2,"s":1,"f":{"t":4,"i":0}}]},"o":2},"f":63,"m":[0]}"`;
    
  • packages/seroval/test/__snapshots__/set.test.ts.snap+8 8 modified
    @@ -116,18 +116,18 @@ exports[`Set > serializeAsync > supports Set 1`] = `"Promise.resolve(new Set([1,
     
     exports[`Set > serializeAsync > supports self-recursion 1`] = `"(h=>h=new Set([Promise.resolve().then(()=>h)]))()"`;
     
    -exports[`Set > toCrossJSON > supports Set 1`] = `"{"t":7,"i":0,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]}"`;
    +exports[`Set > toCrossJSON > supports Set 1`] = `"{"t":7,"i":0,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]}"`;
     
    -exports[`Set > toCrossJSON > supports self-recursion 1`] = `"{"t":7,"i":0,"l":1,"a":[{"t":4,"i":0}]}"`;
    +exports[`Set > toCrossJSON > supports self-recursion 1`] = `"{"t":7,"i":0,"a":[{"t":4,"i":0}]}"`;
     
    -exports[`Set > toCrossJSONAsync > supports Set 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":7,"i":1,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]}}"`;
    +exports[`Set > toCrossJSONAsync > supports Set 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":7,"i":1,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]}}"`;
     
    -exports[`Set > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":7,"i":0,"l":1,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}]}"`;
    +exports[`Set > toCrossJSONAsync > supports self-recursion 1`] = `"{"t":7,"i":0,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}]}"`;
     
    -exports[`Set > toJSON > supports Set 1`] = `"{"t":{"t":7,"i":0,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]},"f":31,"m":[]}"`;
    +exports[`Set > toJSON > supports Set 1`] = `"{"t":{"t":7,"i":0,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]},"f":63,"m":[]}"`;
     
    -exports[`Set > toJSON > supports self-recursion 1`] = `"{"t":{"t":7,"i":0,"l":1,"a":[{"t":4,"i":0}]},"f":31,"m":[0]}"`;
    +exports[`Set > toJSON > supports self-recursion 1`] = `"{"t":{"t":7,"i":0,"a":[{"t":4,"i":0}]},"f":63,"m":[0]}"`;
     
    -exports[`Set > toJSONAsync > supports Set 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":7,"i":1,"l":3,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]}},"f":31,"m":[]}"`;
    +exports[`Set > toJSONAsync > supports Set 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":7,"i":1,"a":[{"t":0,"s":1},{"t":0,"s":2},{"t":0,"s":3}]}},"f":63,"m":[]}"`;
     
    -exports[`Set > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":7,"i":0,"l":1,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}]},"f":31,"m":[0]}"`;
    +exports[`Set > toJSONAsync > supports self-recursion 1`] = `"{"t":{"t":7,"i":0,"a":[{"t":12,"i":1,"s":1,"f":{"t":4,"i":0}}]},"f":63,"m":[0]}"`;
    
  • packages/seroval/test/__snapshots__/sparse-array.test.ts.snap+5 5 modified
    @@ -58,14 +58,14 @@ exports[`sparse arrays > serialize > supports sparse arrays 1`] = `"[,,,,,,,,,,]
     
     exports[`sparse arrays > serializeAsync > supports sparse arrays 1`] = `"Promise.resolve([,,,,,,,,,,])"`;
     
    -exports[`sparse arrays > toCrossJSON > supports sparse arrays 1`] = `"{"t":9,"i":0,"l":10,"a":[],"o":0}"`;
    +exports[`sparse arrays > toCrossJSON > supports sparse arrays 1`] = `"{"t":9,"i":0,"a":[0,0,0,0,0,0,0,0,0,0],"o":0}"`;
     
    -exports[`sparse arrays > toCrossJSONAsync > supports sparse arrays 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"l":10,"a":[],"o":0}}"`;
    +exports[`sparse arrays > toCrossJSONAsync > supports sparse arrays 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"a":[0,0,0,0,0,0,0,0,0,0],"o":0}}"`;
     
     exports[`sparse arrays > toCrossJSONStream > supports sparse arrays 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`sparse arrays > toCrossJSONStream > supports sparse arrays 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":9,"i":3,"l":10,"a":[],"o":0}]}"`;
    +exports[`sparse arrays > toCrossJSONStream > supports sparse arrays 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":9,"i":3,"a":[0,0,0,0,0,0,0,0,0,0],"o":0}]}"`;
     
    -exports[`sparse arrays > toJSON > supports sparse arrays 1`] = `"{"t":{"t":9,"i":0,"l":10,"a":[],"o":0},"f":31,"m":[]}"`;
    +exports[`sparse arrays > toJSON > supports sparse arrays 1`] = `"{"t":{"t":9,"i":0,"a":[0,0,0,0,0,0,0,0,0,0],"o":0},"f":63,"m":[]}"`;
     
    -exports[`sparse arrays > toJSONAsync > supports sparse arrays 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"l":10,"a":[],"o":0}},"f":31,"m":[]}"`;
    +exports[`sparse arrays > toJSONAsync > supports sparse arrays 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":9,"i":1,"a":[0,0,0,0,0,0,0,0,0,0],"o":0}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/string.test.ts.snap+4 4 modified
    @@ -78,10 +78,10 @@ exports[`string > toCrossJSONStream > supports strings 1`] = `"{"t":22,"i":0,"s"
     
     exports[`string > toCrossJSONStream > supports strings 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":3,"s":2},{"t":1,"s":"\\\\\\"hello\\\\\\""}]}"`;
     
    -exports[`string > toJSON > supports strings 1`] = `"{"t":{"t":1,"s":"\\\\\\"hello\\\\\\""},"f":31,"m":[]}"`;
    +exports[`string > toJSON > supports strings 1`] = `"{"t":{"t":1,"s":"\\\\\\"hello\\\\\\""},"f":63,"m":[]}"`;
     
    -exports[`string > toJSON > supports strings 2`] = `"{"t":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"},"f":31,"m":[]}"`;
    +exports[`string > toJSON > supports strings 2`] = `"{"t":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"},"f":63,"m":[]}"`;
     
    -exports[`string > toJSONAsync > supports strings 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":1,"s":"\\\\\\"hello\\\\\\""}},"f":31,"m":[]}"`;
    +exports[`string > toJSONAsync > supports strings 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":1,"s":"\\\\\\"hello\\\\\\""}},"f":63,"m":[]}"`;
     
    -exports[`string > toJSONAsync > supports strings 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"}},"f":31,"m":[]}"`;
    +exports[`string > toJSONAsync > supports strings 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":1,"s":"\\\\x3Cscript>\\\\x3C/script>"}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/typed-array.test.ts.snap+29 21 modified
    @@ -1,47 +1,51 @@
     // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
     
     exports[`typed arrays > crossSerialize > scoped > supports typed arrays 1`] = `
    -"($R=>$R[0]=new Uint32Array($R[1]=($R[2]=(length, b64) => {
    +"($R=>$R[0]=new Uint32Array($R[1]=($R[2]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4))($R["example"])"
    +})("/////////////////////w=="),0,4))($R["example"])"
     `;
     
     exports[`typed arrays > crossSerialize > supports typed arrays 1`] = `
    -"$R[0]=new Uint32Array($R[1]=($R[2]=(length, b64) => {
    +"$R[0]=new Uint32Array($R[1]=($R[2]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4)"
    +})("/////////////////////w=="),0,4)"
     `;
     
     exports[`typed arrays > crossSerializeAsync > scoped > supports typed arrays 1`] = `
    -"($R=>$R[0]=Promise.resolve($R[1]=new Uint32Array($R[2]=($R[3]=(length, b64) => {
    +"($R=>$R[0]=Promise.resolve($R[1]=new Uint32Array($R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4)))($R["example"])"
    +})("/////////////////////w=="),0,4)))($R["example"])"
     `;
     
     exports[`typed arrays > crossSerializeAsync > supports typed arrays 1`] = `
    -"$R[0]=Promise.resolve($R[1]=new Uint32Array($R[2]=($R[3]=(length, b64) => {
    +"$R[0]=Promise.resolve($R[1]=new Uint32Array($R[2]=($R[3]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4))"
    +})("/////////////////////w=="),0,4))"
     `;
     
     exports[`typed arrays > crossSerializeStream > scoped > supports typed arrays 1`] = `
    @@ -64,14 +68,15 @@ exports[`typed arrays > crossSerializeStream > scoped > supports typed arrays 2`
       resolver.s(data);
       resolver.p.s = 1;
       resolver.p.v = data;
    -})($R[1],$R[3]=new Uint32Array($R[4]=($R[5]=(length, b64) => {
    +})($R[1],$R[3]=new Uint32Array($R[4]=($R[5]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4)))($R["example"])"
    +})("/////////////////////w=="),0,4)))($R["example"])"
     `;
     
     exports[`typed arrays > crossSerializeStream > supports typed arrays 1`] = `
    @@ -94,46 +99,49 @@ exports[`typed arrays > crossSerializeStream > supports typed arrays 2`] = `
       resolver.s(data);
       resolver.p.s = 1;
       resolver.p.v = data;
    -})($R[1],$R[3]=new Uint32Array($R[4]=($R[5]=(length, b64) => {
    +})($R[1],$R[3]=new Uint32Array($R[4]=($R[5]=(b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4))"
    +})("/////////////////////w=="),0,4))"
     `;
     
     exports[`typed arrays > serialize > supports typed arrays 1`] = `
    -"new Uint32Array(((length, b64) => {
    +"new Uint32Array(((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4)"
    +})("/////////////////////w=="),0,4)"
     `;
     
     exports[`typed arrays > serializeAsync > supports typed arrays 1`] = `
    -"Promise.resolve(new Uint32Array(((length, b64) => {
    +"Promise.resolve(new Uint32Array(((b64) => {
       const decoded = atob(b64);
    +  const length = decoded.length;
       const arr = new Uint8Array(length);
       for (let i = 0; i < length; i++) {
         arr[i] = decoded.charCodeAt(i);
       };
       return arr.buffer;
    -})(16,"/////////////////////w=="),0,4))"
    +})("/////////////////////w=="),0,4))"
     `;
     
    -exports[`typed arrays > toCrossJSON > supports typed arrays 1`] = `"{"t":15,"i":0,"l":4,"c":"Uint32Array","f":{"t":19,"i":1,"s":"/////////////////////w==","l":16,"f":{"t":26,"i":2,"s":5}},"b":0}"`;
    +exports[`typed arrays > toCrossJSON > supports typed arrays 1`] = `"{"t":15,"i":0,"c":"Uint32Array","f":{"t":19,"i":1,"s":"/////////////////////w==","f":{"t":26,"i":2,"s":5}},"b":0,"l":4}"`;
     
    -exports[`typed arrays > toCrossJSONAsync > supports typed arrays 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":15,"i":1,"l":4,"c":"Uint32Array","f":{"t":19,"i":2,"s":"/////////////////////w==","l":16,"f":{"t":26,"i":3,"s":5}},"b":0}}"`;
    +exports[`typed arrays > toCrossJSONAsync > supports typed arrays 1`] = `"{"t":12,"i":0,"s":1,"f":{"t":15,"i":1,"c":"Uint32Array","f":{"t":19,"i":2,"s":"/////////////////////w==","f":{"t":26,"i":3,"s":5}},"b":0,"l":4}}"`;
     
     exports[`typed arrays > toCrossJSONStream > supports typed arrays 1`] = `"{"t":22,"i":0,"s":1,"f":{"t":26,"i":2,"s":1}}"`;
     
    -exports[`typed arrays > toCrossJSONStream > supports typed arrays 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":15,"i":3,"l":4,"c":"Uint32Array","f":{"t":19,"i":4,"s":"/////////////////////w==","l":16,"f":{"t":26,"i":5,"s":5}},"b":0}]}"`;
    +exports[`typed arrays > toCrossJSONStream > supports typed arrays 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":6,"s":2},{"t":15,"i":3,"c":"Uint32Array","f":{"t":19,"i":4,"s":"/////////////////////w==","f":{"t":26,"i":5,"s":5}},"b":0,"l":4}]}"`;
     
    -exports[`typed arrays > toJSON > supports typed arrays 1`] = `"{"t":{"t":15,"i":0,"l":4,"c":"Uint32Array","f":{"t":19,"i":1,"s":"/////////////////////w==","l":16,"f":{"t":26,"i":2,"s":5}},"b":0},"f":31,"m":[]}"`;
    +exports[`typed arrays > toJSON > supports typed arrays 1`] = `"{"t":{"t":15,"i":0,"c":"Uint32Array","f":{"t":19,"i":1,"s":"/////////////////////w==","f":{"t":26,"i":2,"s":5}},"b":0,"l":4},"f":63,"m":[]}"`;
     
    -exports[`typed arrays > toJSONAsync > supports typed arrays 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":15,"i":1,"l":4,"c":"Uint32Array","f":{"t":19,"i":2,"s":"/////////////////////w==","l":16,"f":{"t":26,"i":3,"s":5}},"b":0}},"f":31,"m":[]}"`;
    +exports[`typed arrays > toJSONAsync > supports typed arrays 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":15,"i":1,"c":"Uint32Array","f":{"t":19,"i":2,"s":"/////////////////////w==","f":{"t":26,"i":3,"s":5}},"b":0,"l":4}},"f":63,"m":[]}"`;
    
  • packages/seroval/test/__snapshots__/wk-symbols.test.ts.snap+26 26 modified
    @@ -858,54 +858,54 @@ exports[`well-known symbols > toCrossJSONStream > supports Symbol.unscopables 1`
     
     exports[`well-known symbols > toCrossJSONStream > supports Symbol.unscopables 2`] = `"{"t":23,"i":1,"a":[{"t":26,"i":4,"s":2},{"t":17,"i":3,"s":12}]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 1`] = `"{"t":{"t":17,"i":0,"s":0},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 1`] = `"{"t":{"t":17,"i":0,"s":0},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 2`] = `"{"t":{"t":17,"i":0,"s":1},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 2`] = `"{"t":{"t":17,"i":0,"s":1},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 3`] = `"{"t":{"t":17,"i":0,"s":2},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 3`] = `"{"t":{"t":17,"i":0,"s":2},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 4`] = `"{"t":{"t":17,"i":0,"s":3},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 4`] = `"{"t":{"t":17,"i":0,"s":3},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 5`] = `"{"t":{"t":17,"i":0,"s":4},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 5`] = `"{"t":{"t":17,"i":0,"s":4},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 6`] = `"{"t":{"t":17,"i":0,"s":5},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 6`] = `"{"t":{"t":17,"i":0,"s":5},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 7`] = `"{"t":{"t":17,"i":0,"s":6},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 7`] = `"{"t":{"t":17,"i":0,"s":6},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 8`] = `"{"t":{"t":17,"i":0,"s":7},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 8`] = `"{"t":{"t":17,"i":0,"s":7},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 9`] = `"{"t":{"t":17,"i":0,"s":8},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 9`] = `"{"t":{"t":17,"i":0,"s":8},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 10`] = `"{"t":{"t":17,"i":0,"s":9},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 10`] = `"{"t":{"t":17,"i":0,"s":9},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 11`] = `"{"t":{"t":17,"i":0,"s":10},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 11`] = `"{"t":{"t":17,"i":0,"s":10},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 12`] = `"{"t":{"t":17,"i":0,"s":11},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 12`] = `"{"t":{"t":17,"i":0,"s":11},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSON > supports well-known symbols 13`] = `"{"t":{"t":17,"i":0,"s":12},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSON > supports well-known symbols 13`] = `"{"t":{"t":17,"i":0,"s":12},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":0}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 1`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":0}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":1}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 2`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":1}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 3`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":2}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 3`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":2}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 4`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":3}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 4`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":3}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 5`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":4}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 5`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":4}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 6`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":5}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 6`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":5}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 7`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":6}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 7`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":6}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 8`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":7}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 8`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":7}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 9`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":8}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 9`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":8}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 10`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":9}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 10`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":9}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 11`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":10}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 11`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":10}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 12`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":11}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 12`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":11}},"f":63,"m":[]}"`;
     
    -exports[`well-known symbols > toJSONAsync > supports well-known symbols 13`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":12}},"f":31,"m":[]}"`;
    +exports[`well-known symbols > toJSONAsync > supports well-known symbols 13`] = `"{"t":{"t":12,"i":0,"s":1,"f":{"t":17,"i":1,"s":12}},"f":63,"m":[]}"`;
    
  • packages/seroval/theory.js+0 28 removed
    @@ -1,28 +0,0 @@
    -import { toCrossJSONStream, fromCrossJSON, crossSerializeStream } from "./dist/esm/development/index.mjs";
    -
    -const delay = (delay, value) => new Promise((resolve) => {
    -  setTimeout(() => resolve(value), delay)
    -})
    -
    -const bla = {
    -  a: 'Hello',
    -  b: delay(1000, "World"),
    -  c: delay(2000, "Bla"),
    -  d: delay(3000, {
    -    e: 2500
    -  })
    -}
    -
    -const refs = new Map();
    -
    -toCrossJSONStream(bla, {
    -  onParse(node, initial) {
    -    console.log(fromCrossJSON(node, { refs }))
    -  }
    -});
    -
    -// crossSerializeStream(bla, {
    -//   onSerialize(node) {
    -//     console.log(node);
    -//   }
    -// })
    \ No newline at end of file
    
  • pnpm-lock.yaml+1 1 modified
    @@ -82,7 +82,7 @@ importers:
             specifier: 2.6.4
             version: 2.6.4(tslib@2.8.1)(typescript@5.9.3)
           seroval:
    -        specifier: 1.3.2
    +        specifier: 1.4.0
             version: link:../seroval
           tslib:
             specifier: ^2.8.1
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

4

News mentions

0

No linked articles in our index yet.