Skip to content

d2dagre: use native Go Dagro port - #2819

Merged
alixander merged 3 commits into
masterfrom
agent/use-dagro
Aug 8, 2026
Merged

d2dagre: use native Go Dagro port#2819
alixander merged 3 commits into
masterfrom
agent/use-dagro

Conversation

@alixander

@alixander alixander commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace the embedded Dagre JavaScript bundle and Goja execution with the native Go Dagro module
  • preserve D2's existing graph construction, label sizing, parent ordering, multiedge naming, and route post-processing
  • remove the JavaScript assets, embedding code, and release-build workaround
  • update layout documentation, plugin help, attribution, and the release changelog
  • ship the Dagro/Dagre/Graphlib MIT notice in native, MSI, and npm/WASM artifacts, and include D2's MPL in the npm package

Why

D2's default Dagre layout currently embeds Dagre 0.8.5 as JavaScript and creates a JavaScript VM for every layout. Dagro is a behavior-compatible Go port of that exact implementation, allowing D2 to use a native Go layout path without changing diagram output.

Impact

Existing Dagre layout behavior is preserved. All 313 stored Dagre board JSON and SVG fixtures pass exactly; no goldens were updated.

Screenshots are not applicable because the expected and produced SVGs are byte-for-byte unchanged.

Dependency

Uses Dagro v0.1.0, released from merged PR d2lang/dagro#1.

Validation

  • go test ./d2layouts/d2dagrelayout -count=1
  • go vet ./d2layouts/d2dagrelayout
  • GOOS=js GOARCH=wasm go build -o /dev/null ./d2js
  • go test ./e2etests -run '^TestE2E$' -count=1 with board and SVG checks enabled
  • host macOS and cross-compiled Windows release archives contain the byte-identical third-party notice
  • npm pack --dry-run --json includes both LICENSE.txt and THIRD_PARTY_NOTICES.txt; publish staging also verifies their packed bytes
  • release shell syntax and the WiX source validate locally
  • Dagro differential, race, and vet suites in Port Dagre 0.8.5 to Go dagro#1

@alixander
alixander marked this pull request as ready for review August 8, 2026 18:06
@alixander
alixander merged commit 4e2abf0 into master Aug 8, 2026
6 checks passed
@alixander
alixander deleted the agent/use-dagro branch August 8, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant