Repository navigation
v0.7.0
Minor changes
-
cca58f9: JSON input with a lone surrogate escape is rejected.
JSON.parseaccepts"\ud800", half of a UTF-16 surrogate pair escaped without its other half, and kgdiff used to carry it through ids and labels into its diffs and deltas; such text is not Unicode, and the Rust implementation (RFC 0002) cannot hold it.parseGraphnow throwsinvalid-inputfor one in JSON and JSON-LD, located at the escape (Invalid JSON on line 6, column 35: the escape \ud83d is a lone surrogate (half of a UTF-16 pair), which kgdiff does not accept.), and so does a JSON-LD context text adocumentLoaderreturns;kgdiff applyrefuses a delta that has one. Escaped surrogate pairs ("😀") read as before.@kgdiff/cli·@kgdiff/formats -
d01c4e0: Matching gives the same result in every JavaScript engine. Its neighbour and key weights (
1 / log₂(2 + degree),1 / log₂(1 + postings)) now use alog₂built from exactly rounded operations only, the one the layout already used, instead ofMath.log2, which engines may approximate differently: V8 ports FreeBSD'se_log2.c, while an engine that calls the platform's C library gets that library's rounding (Apple's differs from V8 on 439 of the integers up to 2,000,000). A diff computed in a browser, as the playground does, now equals the CLI's whatever the engine. The newlog₂differs from V8's by one unit in the last place on about 2% of integers; no match, suggestion or score changes in the conformance corpus, the example datasets or 144 synthetic diffs, but a score that sits exactly on a rounding boundary or a tie can move. The function is exported aslog2, and@kgdiff/layoutuses it from core.@kgdiff/core -
7586808: Reports open the same way whatever Unicode version the browser has.
diffFromJSONtakes the labels, aliases and types of a document's snapshots as written instead of composing them to NFC again with the runtime's ICU, and the content hashes in the delta check that text: a report made with Node 24 (Unicode 17) no longer fails to open in a browser with older tables when a label holds a character whose composition changed in between, and a snapshot whose text was edited or is not in NFC is still rejected. To restore a label it left out without Unicode tables either, kgdiff JSON (diffs, graphs and deltas) now leaves an edge label out only when it equalspredicateLabel(predicate)before its NFC step; a predicate whose readable part is written decomposed keeps its label in the document. A diff written by an earlier version for such a predicate, with that label left out, no longer opens: write it again.normalizecomposes API input to NFC as before.@kgdiff/core·@kgdiff/viewer -
cca58f9: Numbers beyond the range of a double in JSON graphs are kept instead of lost. JSON may write
1e400, whichJSON.parsereads asInfinity; the JSON reader used to drop such a number without a word (an attribute ormetamember disappeared, an array item becamenull), so a diff could report nothing for a value that changed, or a change that did not happen. It now keeps the value as the string"Infinity"or"-Infinity", asnormalizekeeps a non-finite number an API caller passes, and reports how many with ajson-non-finitewarning (ParseWarningCode), in every JSON dialect.@kgdiff/formats -
9ebb278:
layoutFromJSONreads version 2 of the layout document, which kgdiff's Rust layout engine will write. Version 2 is version 1's members plusgenerator, a non-empty string such as"kgdiff-layout/1"that names the engine generation that computed the positions. It becomes the new optionalLayoutResult.generator. Positions read from either version are valid pins for anchored layouts andextendLayout. A version 2 document without ageneratoris rejected (invalid-input), and versions other than 1 and 2 are rejected as before (unsupported-version).layoutToJSONstill writes version 1, so a layout read from version 2 is written back as version 1 without itsgenerator. Types:LayoutJSONis now the union of the documentslayoutFromJSONreads,LayoutJSONV1 | LayoutJSONV2, andlayoutToJSONreturnsLayoutJSONV1. Code that relied onLayoutJSON['version']being1should useLayoutJSONV1. ThroughReportPayload.layout(aLayoutJSON), the viewer opens reports whose layout is version 2.@kgdiff/layout -
e510258: Report payloads may leave their layout out.
ReportPayload.layoutis optional: a payload without one (the member left out) is laid out in the browser when the viewer reads it, withlayoutDiff's default options, so an application that computed a diff itself can show it by passing itsdiff.v1JSON as a payload. The ESM build imports the compute module on demand for it; the standalone viewer takes it from the@kgdiff/viewer/standalone/computeadd-on (globalThis.KgdiffCompute), and without the add-on shows an error that says what is missing instead of failing to read the layout. The diff engine never runs for a payload, and payloads with a layout open exactly as before, without loading the compute module. Alayoutthat is present but not an object (null, for instance) is rejected. The CLI keeps writing the layout into its reports.@kgdiff/viewer
Every package is at 0.7.0: @kgdiff/cli · @kgdiff/core · @kgdiff/formats · @kgdiff/layout · @kgdiff/scene · @kgdiff/renderer · @kgdiff/viewer · @kgdiff/g6.
GitHub Action: uses: iiwish/kgdiff@v0.7.0.