- Repository:
tevm/compiler– Rust + N-API bridge exposing Foundry's compiler to JS/Bun/WASI. Core exports:Compiler,Ast,Contract,CompileOutput. - Primary goal: keep the TypeScript-facing API reliable, accurately documented, and paired with real build/test coverage. Most changes require touching Rust + TS glue.
- Assess
- Run
pnpm nx graph --focus=compilerwhen you need project dependencies. - Read
libs/compiler/src/**/*.rsalongsidebuild/index.d.tsto understand the surface area impacted by any change.
- Run
- Modify
- Prefer
pnpm nx run compiler:buildto compile bindings;post-buildcopies curated.d.tsfiles and regeneratesbuild/llms.txt. - Keep
.d.tsupdates manual—src/types/**/*.d.tsare authoritative. Never auto-generate replacements. - Maintain parity between Rust structs/enums and their JS-facing equivalents. Update
postbuild-generate-docs.jsoutput when signatures shift.
- Prefer
- Verify
- Run targeted tests:
pnpm nx run compiler:test:rust,:test:js, and:test:typecheck. - For project-aware workflows, clone fixtures under
libs/compiler/test/fixturesinstead of hitting external networks. - Confirm
Compiler.installSolcVersionpaths succeed when new solc ranges are introduced.
- Run targeted tests:
- Rust edition 2021,
cargo fmtenforced. - Use Biome for JS/TS formatting and linting (
pnpm nx run compiler:lint:js). - Maintain exhaustive error messages—surfaced through N-API as
Errorobjects with actionable guidance. - New features must include Bun tests or TypeScript type assertions inside
libs/compiler/test.
- Install deps:
pnpm install - Build:
pnpm nx run compiler:build - Post-build verification:
pnpm nx run compiler:post-build - Full test matrix:
pnpm nx run compiler:test - Update workspace graph:
pnpm nx graph --focus=compiler
- Production builds use
pnpm nx run compiler:build --configuration=production. - Always run
post-buildbefore publishing to ensure curated.d.tsandllms.txtare in sync. - Platform binaries live under
libs/compiler/build/npm/**; keep them version-aligned with the Rust crate.