Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@contractkit/core

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contractkit/core - npm Package Compare versions

Comparing version
0.15.0
to
0.15.1
+7
-7
.turbo/turbo-build$colon$ci.log
> @contractkit/core@0.15.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/contractkit
> @contractkit/core@0.15.1 build:ci /home/runner/work/ContractKit/ContractKit/packages/contractkit
> eslint --max-warnings=0 && pnpm run build
> @contractkit/core@0.15.0 build /home/runner/work/ContractKit/ContractKit/packages/contractkit
> @contractkit/core@0.15.1 build /home/runner/work/ContractKit/ContractKit/packages/contractkit
> tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration && cp src/contractkit.ohm dist/

@@ -14,7 +14,7 @@

ESM Build start
ESM dist/index.js 88.80 KB
ESM dist/index.js.map 210.61 KB
ESM ⚡️ Build success in 78ms
ESM dist/index.js 88.92 KB
ESM dist/index.js.map 211.24 KB
ESM ⚡️ Build success in 77ms
DTS Build start
DTS ⚡️ Build success in 1308ms
DTS dist/index.d.ts 31.44 KB
DTS ⚡️ Build success in 1201ms
DTS dist/index.d.ts 31.82 KB
> @contractkit/core@0.15.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/contractkit
> @contractkit/core@0.15.1 test:ci /home/runner/work/ContractKit/ContractKit/packages/contractkit
> vitest run --coverage

@@ -9,14 +9,14 @@

✓ tests/incremental.test.ts (16 tests) 16ms
✓ tests/apply-options-defaults.test.ts (12 tests) 121ms
✓ tests/validate-inheritance.test.ts (16 tests) 59ms
✓ tests/parser-ck.test.ts (170 tests) 538ms
✓ tests/diagnostics.test.ts (10 tests) 17ms
✓ tests/apply-variable-substitution.test.ts (10 tests) 55ms
✓ tests/validate-discriminated.test.ts (5 tests) 30ms
✓ tests/incremental.test.ts (18 tests) 17ms
✓ tests/apply-options-defaults.test.ts (12 tests) 115ms
✓ tests/validate-inheritance.test.ts (16 tests) 73ms
✓ tests/parser-ck.test.ts (170 tests) 542ms
✓ tests/diagnostics.test.ts (10 tests) 15ms
✓ tests/apply-variable-substitution.test.ts (10 tests) 56ms
✓ tests/validate-discriminated.test.ts (5 tests) 28ms
 Test Files  7 passed (7)
 Tests  239 passed (239)
 Start at  11:09:03
 Duration  2.12s (transform 488ms, setup 0ms, import 2.79s, tests 835ms, environment 1ms)
 Tests  241 passed (241)
 Start at  11:16:31
 Duration  2.07s (transform 389ms, setup 0ms, import 2.71s, tests 847ms, environment 1ms)

@@ -27,3 +27,3 @@  % Coverage report from v8

-------------------|---------|----------|---------|---------|-------------------
All files | 84.72 | 73.15 | 89.34 | 87.15 |
All files | 84.77 | 73.3 | 89.34 | 87.18 |
...ns-defaults.ts | 98 | 95.34 | 100 | 100 | 67,93

@@ -35,3 +35,3 @@ ...ubstitution.ts | 97.56 | 94.87 | 100 | 100 | 26,55

grammar.ts | 75 | 100 | 100 | 75 | 23-24
incremental.ts | 98.48 | 92.85 | 100 | 100 | 76-77,81
incremental.ts | 98.57 | 93.47 | 100 | 100 | 76-77,81
parser.ts | 100 | 66.66 | 100 | 100 | 25-26

@@ -38,0 +38,0 @@ semantics.ts | 92.55 | 79.37 | 92.52 | 95.5 | ...1200,1220-1224

# @contractkit/core
## 0.15.1
### Patch Changes
- 130d53b: Fix `stableStringify` (and therefore `hashFingerprint` / `runIncrementalCodegen`) crashing with "Do not know how to serialize a BigInt" when an AST payload contains a `bigint` default or literal. Bigints now serialize as a tagged string `"<bigint:VALUE>"` so they're stable in fingerprints and distinguishable from plain strings. `undefined` is also normalized to `null` so `{a: undefined}` and `{}` don't collide.
## 0.15.0

@@ -4,0 +10,0 @@

@@ -358,3 +358,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -361,0 +361,0 @@ <script src="prettify.js"></script>

@@ -316,3 +316,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -319,0 +319,0 @@ <script src="prettify.js"></script>

@@ -1114,3 +1114,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -1117,0 +1117,0 @@ <script src="prettify.js"></script>

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1778152145409" clover="3.2.0">
<project timestamp="1778152145409" name="All files">
<metrics statements="1059" coveredstatements="923" conditionals="719" coveredconditionals="526" methods="197" coveredmethods="176" elements="1975" coveredelements="1625" complexity="0" loc="1059" ncloc="1059" packages="1" files="12" classes="12"/>
<coverage generated="1778152593980" clover="3.2.0">
<project timestamp="1778152593980" name="All files">
<metrics statements="1061" coveredstatements="925" conditionals="723" coveredconditionals="530" methods="197" coveredmethods="176" elements="1981" coveredelements="1631" complexity="0" loc="1061" ncloc="1061" packages="1" files="12" classes="12"/>
<file name="apply-options-defaults.ts" path="/home/runner/work/ContractKit/ContractKit/packages/contractkit/src/apply-options-defaults.ts">

@@ -125,3 +125,3 @@ <metrics statements="38" coveredstatements="38" conditionals="43" coveredconditionals="41" methods="9" coveredmethods="9"/>

<file name="incremental.ts" path="/home/runner/work/ContractKit/ContractKit/packages/contractkit/src/incremental.ts">
<metrics statements="55" coveredstatements="55" conditionals="42" coveredconditionals="39" methods="10" coveredmethods="10"/>
<metrics statements="57" coveredstatements="57" conditionals="46" coveredconditionals="43" methods="10" coveredmethods="10"/>
<line num="7" count="1" type="stmt"/>

@@ -148,36 +148,38 @@ <line num="62" count="9" type="stmt"/>

<line num="98" count="4" type="stmt"/>
<line num="103" count="22" type="cond" truecount="4" falsecount="0"/>
<line num="104" count="7" type="cond" truecount="2" falsecount="0"/>
<line num="105" count="6" type="stmt"/>
<line num="106" count="10" type="stmt"/>
<line num="138" count="13" type="stmt"/>
<line num="139" count="13" type="stmt"/>
<line num="140" count="13" type="stmt"/>
<line num="141" count="13" type="stmt"/>
<line num="142" count="13" type="stmt"/>
<line num="144" count="13" type="cond" truecount="2" falsecount="0"/>
<line num="146" count="13" type="stmt"/>
<line num="147" count="2" type="stmt"/>
<line num="148" count="2" type="stmt"/>
<line num="112" count="29" type="cond" truecount="2" falsecount="0"/>
<line num="113" count="28" type="cond" truecount="2" falsecount="0"/>
<line num="114" count="25" type="cond" truecount="4" falsecount="0"/>
<line num="115" count="9" type="cond" truecount="2" falsecount="0"/>
<line num="116" count="8" type="stmt"/>
<line num="117" count="12" type="stmt"/>
<line num="149" count="13" type="stmt"/>
<line num="150" count="13" type="stmt"/>
<line num="151" count="13" type="stmt"/>
<line num="152" count="14" type="cond" truecount="2" falsecount="0"/>
<line num="154" count="14" type="cond" truecount="4" falsecount="0"/>
<line num="156" count="14" type="cond" truecount="2" falsecount="0"/>
<line num="157" count="3" type="stmt"/>
<line num="158" count="3" type="stmt"/>
<line num="159" count="3" type="stmt"/>
<line num="160" count="3" type="stmt"/>
<line num="163" count="11" type="stmt"/>
<line num="164" count="11" type="stmt"/>
<line num="165" count="11" type="stmt"/>
<line num="166" count="11" type="stmt"/>
<line num="167" count="11" type="stmt"/>
<line num="168" count="11" type="stmt"/>
<line num="170" count="11" type="stmt"/>
<line num="173" count="13" type="stmt"/>
<line num="174" count="13" type="stmt"/>
<line num="175" count="13" type="stmt"/>
<line num="181" count="13" type="stmt"/>
<line num="183" count="14" type="stmt"/>
<line num="152" count="13" type="stmt"/>
<line num="153" count="13" type="stmt"/>
<line num="155" count="13" type="cond" truecount="2" falsecount="0"/>
<line num="157" count="13" type="stmt"/>
<line num="158" count="2" type="stmt"/>
<line num="159" count="2" type="stmt"/>
<line num="162" count="13" type="stmt"/>
<line num="163" count="14" type="cond" truecount="2" falsecount="0"/>
<line num="165" count="14" type="cond" truecount="4" falsecount="0"/>
<line num="167" count="14" type="cond" truecount="2" falsecount="0"/>
<line num="168" count="3" type="stmt"/>
<line num="169" count="3" type="stmt"/>
<line num="170" count="3" type="stmt"/>
<line num="171" count="3" type="stmt"/>
<line num="174" count="11" type="stmt"/>
<line num="175" count="11" type="stmt"/>
<line num="176" count="11" type="stmt"/>
<line num="177" count="11" type="stmt"/>
<line num="178" count="11" type="stmt"/>
<line num="179" count="11" type="stmt"/>
<line num="181" count="11" type="stmt"/>
<line num="184" count="13" type="stmt"/>
<line num="185" count="13" type="stmt"/>
<line num="186" count="13" type="stmt"/>
<line num="192" count="13" type="stmt"/>
<line num="194" count="14" type="stmt"/>
<line num="195" count="13" type="stmt"/>
</file>

@@ -184,0 +186,0 @@ <file name="parser.ts" path="/home/runner/work/ContractKit/ContractKit/packages/contractkit/src/parser.ts">

@@ -145,3 +145,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -148,0 +148,0 @@ <script src="prettify.js"></script>

@@ -187,3 +187,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -190,0 +190,0 @@ <script src="prettify.js"></script>

@@ -154,3 +154,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -157,0 +157,0 @@ <script src="prettify.js"></script>

@@ -26,5 +26,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">98.48% </span>
<span class="strong">98.57% </span>
<span class="quiet">Statements</span>
<span class='fraction'>65/66</span>
<span class='fraction'>69/70</span>
</div>

@@ -34,5 +34,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">92.85% </span>
<span class="strong">93.47% </span>
<span class="quiet">Branches</span>
<span class='fraction'>39/42</span>
<span class='fraction'>43/46</span>
</div>

@@ -51,3 +51,3 @@

<span class="quiet">Lines</span>
<span class='fraction'>55/55</span>
<span class='fraction'>57/57</span>
</div>

@@ -254,3 +254,14 @@

<a name='L185'></a><a href='#L185'>185</a>
<a name='L186'></a><a href='#L186'>186</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<a name='L186'></a><a href='#L186'>186</a>
<a name='L187'></a><a href='#L187'>187</a>
<a name='L188'></a><a href='#L188'>188</a>
<a name='L189'></a><a href='#L189'>189</a>
<a name='L190'></a><a href='#L190'>190</a>
<a name='L191'></a><a href='#L191'>191</a>
<a name='L192'></a><a href='#L192'>192</a>
<a name='L193'></a><a href='#L193'>193</a>
<a name='L194'></a><a href='#L194'>194</a>
<a name='L195'></a><a href='#L195'>195</a>
<a name='L196'></a><a href='#L196'>196</a>
<a name='L197'></a><a href='#L197'>197</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>

@@ -357,6 +368,2 @@ <span class="cline-any cline-neutral">&nbsp;</span>

<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-neutral">&nbsp;</span>

@@ -371,2 +378,8 @@ <span class="cline-any cline-neutral">&nbsp;</span>

<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">29x</span>
<span class="cline-any cline-yes">28x</span>
<span class="cline-any cline-yes">25x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-neutral">&nbsp;</span>

@@ -394,2 +407,11 @@ <span class="cline-any cline-neutral">&nbsp;</span>

<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>

@@ -543,4 +565,15 @@ <span class="cline-any cline-yes">13x</span>

&nbsp;
/** JSON.stringify variant that sorts object keys recursively, so structurally equivalent values always serialize identically. */
/**
* JSON.stringify variant that sorts object keys recursively, so structurally
* equivalent values always serialize identically.
*
* Handles `bigint` values (which native `JSON.stringify` rejects) by emitting
* them as a tagged string `"&lt;bigint:VALUE&gt;"`. Tagging — rather than coercing to
* a plain string or number — keeps `1n` and `"1"` distinguishable in fingerprints.
* `undefined` is normalized to `null` (stable) instead of being dropped (which
* would make `{a: undefined}` and `{}` collide).
*/
export function stableStringify(value: unknown): string {
if (value === undefined) return 'null';
if (typeof value === 'bigint') return JSON.stringify(`&lt;bigint:${value.toString()}&gt;`);
if (value === null || typeof value !== 'object') return JSON.stringify(value);

@@ -636,3 +669,3 @@ if (Array.isArray(value)) return '[' + value.map(stableStringify).join(',') + ']';

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -639,0 +672,0 @@ <script src="prettify.js"></script>

@@ -26,5 +26,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">84.72% </span>
<span class="strong">84.77% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1054/1244</span>
<span class='fraction'>1058/1248</span>
</div>

@@ -34,5 +34,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">73.15% </span>
<span class="strong">73.3% </span>
<span class="quiet">Branches</span>
<span class='fraction'>526/719</span>
<span class='fraction'>530/723</span>
</div>

@@ -49,5 +49,5 @@

<div class='fl pad1y space-right2'>
<span class="strong">87.15% </span>
<span class="strong">87.18% </span>
<span class="quiet">Lines</span>
<span class='fraction'>923/1059</span>
<span class='fraction'>925/1061</span>
</div>

@@ -176,13 +176,13 @@

<td class="file high" data-value="incremental.ts"><a href="incremental.ts.html">incremental.ts</a></td>
<td data-value="98.48" class="pic high">
<td data-value="98.57" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 98%"></div><div class="cover-empty" style="width: 2%"></div></div>
</td>
<td data-value="98.48" class="pct high">98.48%</td>
<td data-value="66" class="abs high">65/66</td>
<td data-value="92.85" class="pct high">92.85%</td>
<td data-value="42" class="abs high">39/42</td>
<td data-value="98.57" class="pct high">98.57%</td>
<td data-value="70" class="abs high">69/70</td>
<td data-value="93.47" class="pct high">93.47%</td>
<td data-value="46" class="abs high">43/46</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="10" class="abs high">10/10</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="55" class="abs high">55/55</td>
<td data-value="57" class="abs high">57/57</td>
</tr>

@@ -273,3 +273,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -276,0 +276,0 @@ <script src="prettify.js"></script>

@@ -169,3 +169,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -172,0 +172,0 @@ <script src="prettify.js"></script>

@@ -667,3 +667,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -670,0 +670,0 @@ <script src="prettify.js"></script>

@@ -763,3 +763,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -766,0 +766,0 @@ <script src="prettify.js"></script>

@@ -718,3 +718,3 @@

<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2026-05-07T11:09:05.393Z
at 2026-05-07T11:16:33.959Z
</div>

@@ -721,0 +721,0 @@ <script src="prettify.js"></script>

@@ -62,3 +62,12 @@ /**

export declare function hashFingerprint(value: unknown): string;
/** JSON.stringify variant that sorts object keys recursively, so structurally equivalent values always serialize identically. */
/**
* JSON.stringify variant that sorts object keys recursively, so structurally
* equivalent values always serialize identically.
*
* Handles `bigint` values (which native `JSON.stringify` rejects) by emitting
* them as a tagged string `"<bigint:VALUE>"`. Tagging — rather than coercing to
* a plain string or number — keeps `1n` and `"1"` distinguishable in fingerprints.
* `undefined` is normalized to `null` (stable) instead of being dropped (which
* would make `{a: undefined}` and `{}` collide).
*/
export declare function stableStringify(value: unknown): string;

@@ -65,0 +74,0 @@ /**

@@ -1,1 +0,1 @@

{"version":3,"file":"incremental.d.ts","sourceRoot":"","sources":["../src/incremental.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,yGAAyG;AACzG,MAAM,WAAW,qBAAqB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,0GAA0G;AAC1G,MAAM,WAAW,qBAAqB;IAClC,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,6HAA6H;IAC7H,KAAK,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG,cAAc,EAAE,MAAM,CAAC;IACvB,kJAAkJ;IAClJ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;CAChD;AAED,mIAAmI;AACnI,MAAM,WAAW,eAAe;IAC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C,KAAK,EAAE,OAAO,GAAG,MAAM,CAOtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,mBAAmB,CAAC;IAClC,4FAA4F;IAC5F,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACrC,+CAA+C;IAC/C,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,uJAAuJ;IACvJ,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;CACjD,GAAG,iBAAiB,CAgDpB"}
{
"name": "@contractkit/core",
"version": "0.15.0",
"version": "0.15.1",
"description": "Core DSL compiler library: grammar-driven parser, codegen, and validation",

@@ -35,4 +35,4 @@ "author": {

"devDependencies": {
"@repo/config-eslint": "0.3.1",
"@repo/config-typescript": "0.1.0"
"@repo/config-typescript": "0.1.0",
"@repo/config-eslint": "0.3.1"
},

@@ -39,0 +39,0 @@ "scripts": {

@@ -101,4 +101,15 @@ import { createHash } from 'node:crypto';

/** JSON.stringify variant that sorts object keys recursively, so structurally equivalent values always serialize identically. */
/**
* JSON.stringify variant that sorts object keys recursively, so structurally
* equivalent values always serialize identically.
*
* Handles `bigint` values (which native `JSON.stringify` rejects) by emitting
* them as a tagged string `"<bigint:VALUE>"`. Tagging — rather than coercing to
* a plain string or number — keeps `1n` and `"1"` distinguishable in fingerprints.
* `undefined` is normalized to `null` (stable) instead of being dropped (which
* would make `{a: undefined}` and `{}` collide).
*/
export function stableStringify(value: unknown): string {
if (value === undefined) return 'null';
if (typeof value === 'bigint') return JSON.stringify(`<bigint:${value.toString()}>`);
if (value === null || typeof value !== 'object') return JSON.stringify(value);

@@ -105,0 +116,0 @@ if (Array.isArray(value)) return '[' + value.map(stableStringify).join(',') + ']';

@@ -37,2 +37,15 @@ import { describe, it, expect } from 'vitest';

});
it('serializes bigint values as a tagged string', () => {
// Native JSON.stringify throws "Do not know how to serialize a BigInt" — our
// wrapper has to handle them so AST nodes carrying bigint defaults can be hashed.
expect(stableStringify(1n)).toBe('"<bigint:1>"');
expect(stableStringify({ default: 42n })).toBe('{"default":"<bigint:42>"}');
// 1n and "1" must hash differently — keep the tag distinguishable.
expect(stableStringify(1n)).not.toBe(stableStringify('1'));
});
it('treats undefined as null so its presence is fingerprinted', () => {
expect(stableStringify({ a: undefined })).toBe('{"a":null}');
});
});

@@ -39,0 +52,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display