Skip to content

build(runtime): take the Node-only modules out of the default build - #503

Merged
x-ror merged 1 commit into
masterfrom
build/exclude-node-modules
Nov 18, 2026
Merged

x-ror merged 1 commit into
masterfrom
build/exclude-node-modules

Conversation

@x-ror

@x-ror x-ror commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What changed

LAVA_NODE_MODULES (#config, default false) decides whether the Node-only subsystems are part of the build: node:sqlite, node:fs, node:os, node:net, node:http, node:https, node:dns, node:tty (and node:dns/promises, internal/http/*, internal/os/*).

With it off:

  • their bindings objects are never created (install_internal_modules);
  • the loader's compile refuses their ids (builtin_compile_cb), so require of one is MODULE_NOT_FOUND.

NODE_MODULES=1 ./scripts/build.sh builds them back in unchanged. Nothing is deleted: this is the owner's call to exclude them while the engine core for Larva is built, keeping the way back to full Node parity.

Still in the default build: the web surface (fetch, URL, streams, encoding, timers), Buffer, events/stream/util/path/assert, and the CommonJS loader.

CI

The Linux (full build + tests) and Mutation gate jobs now run only from workflow_dispatch (Actions → CI → Run workflow). Tests are paused for this phase on the owner's instruction. Type-check, format and lint still run on every push and PR.

Not verified, not done

  • No test suite or gate was run, and no test pins the off state. Checked by hand only: make check passes on all three targets with the define off, odin check passes with it on, and one lava eval per build confirmed the eight modules are MODULE_NOT_FOUND when off and that fs and sqlite load when on.
  • With the default build, the oracle suites for the excluded modules cannot pass. Run them with NODE_MODULES=1.
  • libsqlite3 is still linked: pkg/std/sqlite is still imported.
  • The excluded modules' JS is still embedded in the binary, only unreachable.
  • node:crypto stays in: it loads at start-up and Blob needs randomUUID from it.
  • /pr-gate was not run.

Size

bin/lava, -o:speed, this machine: 2,036,720 bytes with the modules, 1,860,880 without (one build of each).

Reuse verdict (§2)

No new low-level code: one #config constant, a when block around existing registrations, and an id check in the compile callback.

Node parity

A declared §1 deviation while the define is off: the default build is not a Node-compatible runtime. Unpinned by a test, as above.

🤖 Generated with Claude Code

LAVA_NODE_MODULES (#config, default false) decides whether node:sqlite, node:fs,
node:os, node:net, node:http, node:https, node:dns and node:tty are part of the
build. With it off their bindings objects are never created and the loader's
compile refuses their ids, so `require` of one is MODULE_NOT_FOUND.
`NODE_MODULES=1 ./scripts/build.sh` builds them back in unchanged; nothing is
deleted.

CI: the test and mutation jobs run only from workflow_dispatch while tests are
paused. Type-check and lint still run on every push and PR.

Not done here: libsqlite3 is still linked (pkg/std/sqlite is still imported),
the excluded modules' sources are still embedded, and node:crypto stays in
because it loads at start-up.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@x-ror
x-ror merged commit 0f7715a into master Nov 18, 2026
6 checks passed
@x-ror
x-ror deleted the build/exclude-node-modules branch November 18, 2026 21:14
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