CodeSampleX

サンプル

superjson 2.2.6: Observe how superjson's metadata format versioning (meta.v), deduplication mode, in-place deserialization, and registry keying alter serialization behavior silently across boundaries

検証済みサンプル — npm superjson 2.2.6: Observe how superjson's metadata format versioning (meta.v), deduplication mode, in-place deserialization, and registry…

sha256:e6cb64b107388f3fa051f1da09fd44d009cf211ada6b133e516d380c798ce68a

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 node linux x64 node node npm

検証実行環境

環境 コントラクト ステージ 実行日
node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-16
node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-18

ケース

HOW
ゴール
Observe how superjson's metadata format versioning (meta.v), deduplication mode, in-place deserialization, and registry keying alter serialization behavior silently across boundaries
パッケージ
シンボル
  • superjson.serialize
  • superjson.deserialize
  • superjson.stringify
  • superjson.parse
  • superjson.registerSymbol
  • superjson.registerClass
  • superjson.registerCustom
  • SuperJSON
  • SuperJSONResult.meta
環境
node
作成日
2026-08-16T06:23:09Z

コントラクト

  1. assert meta.v is 1 in modern superjson and escapes dots with backslashes so dotted keys round-trip intact
  2. assert unversioned or legacy meta.v < 1 payloads silently misroute dotted paths to nested sibling properties, leaving the top-level key as a string and creating an Invalid Date without throwing
  3. assert deserialize defaults to inPlace: false via a deep clone leaving the input payload untouched, whereas inPlace: true directly mutates payload.json into live runtime objects
  4. assert parse uses inPlace: true internally on the parsed JSON tree rather than cloning
  5. assert dedupe: false preserves full duplicate structures in json while annotating referential equalities, allowing non-superjson consumers to read the payload
  6. assert dedupe: true replaces duplicate object instances with null in json, causing silent data loss for plain JSON consumers while superjson restores referential equality
  7. assert circular references write null at the cycle point and restore referential equality on deserialization in both modes
  8. assert registerSymbol without an explicit identifier keys by description, so registering two distinct symbols with identical descriptions silently causes the second to overwrite the first upon deserialization
  9. assert registerClass with allowProps silently strips any unlisted properties from the serialized JSON payload
  10. assert registerCustom does not recursively walk the returned structure, treating its output as a terminal leaf and leaving inner types unannotated
  11. assert superjson strictly forbids prototype pollution keys (__proto__, constructor, prototype) by throwing during serialization, unlike standard JSON.stringify

ファイル

  • NOTES.md
  • csx.json
  • package-lock.json
  • package.json
  • src/boundaries.mjs
  • test/contract.mjs

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed