feat: add bun module#1
Open
TomChv wants to merge 1 commit into
Open
Conversation
TomChv
marked this pull request as ready for review
July 20, 2026 10:26
24 tasks
TomChv
force-pushed
the
feat/add-bun-module
branch
6 times, most recently
from
July 20, 2026 16:27
50aa649 to
4e6aaf3
Compare
A Dagger module for Bun, written in Dang, modeling the toolchain as an object graph (Bun -> BunProject) instead of wrapping the CLI. Design: design/bun-module.md. - Checks: test, audit, install-check (bun install --frozen-lockfile), plus the workspace-wide *-all variants. - Build: bundle -> Directory, compile -> File (cross-compile via --target). - Primitives: install(ctr, musl), base, container, installed; dependency cache as a cacheVolume. A pinned version drives the oven/bun image and the copied binary (glibc by default, musl for alpine targets). - No @generate/@up, and no lint/format/typecheck: Bun ships none of those, so they are delegated to specialized modules (Biome/oxlint, Prettier/dprint, tsc). - Discovery (dagger/dagger#13688) uses github.com/dagger/polyfill's findConfigDirs on package.json (cwd-aware). A monorepo's members are enumerated individually and each installs at its enclosing workspace root, keyed on the `workspaces` field (not bun.lock, so it works even without a committed lockfile); the root is dropped; from a subdirectory the verbs act on only the projects beneath it. - e2e module under .dagger/modules/e2e (12 checks) drives the module against a fixture and in-memory workspaces; validated on engine v1.0.0-beta.7. Signed-off-by: Tom Chauveau <tom@dagger.io>
TomChv
force-pushed
the
feat/add-bun-module
branch
from
July 20, 2026 16:35
4e6aaf3 to
7faf2c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Dagger module for Bun, written in Dang,
modeled on
dagger/deno. It models a Bun projectas a typed object graph and maps Bun's toolchain onto Dagger's first-class verbs
rather than wrapping the
bunCLI.Design rationale:
design/bun-module.md.Object graph
Bun— the pinned toolchain:version,base,install(ctr, musl), andlockfile-keyed discovery (
projects,project --path).BunProject— a single project; cascadessource → container → installedandcarries the verbs.
Verb mapping
The defining constraint: Bun ships no linter, formatter, or typechecker (it
transpiles TypeScript by stripping types), so this module implements only the
verbs Bun actually owns and delegates the rest.
@check):test(bun test),audit(bun audit),install-check(bun install --frozen-lockfile), plus workspace-widetest-all/audit-all/install-check-all.bundle → Directory!,compile → File!(cross-compile via--target); entrypoint defaults frompackage.jsonmain.install(ctr, musl),base,container,installed; theinstall cache is a
cacheVolumeon~/.bun/install/cache.@generate/@up, by design — Bun has no idempotent no-argnormalization and no guessable server entrypoint; dependency mutations
(
add/update) and dev servers are intentionally not modeled (see design doc).Lint/format/typecheck are delegated to specialized modules (Biome/oxlint/ESLint,
Prettier/dprint,
tsc), shown in the README's extension example.Validation
.dagger/modules/e2einstalls this module as a dependency and drives it against ahellofixture plus in-memory workspaces for the failure paths.dagger --x-release=v1.0.0-beta.7 check→ 12 checks pass (clean-project,compile, bundle, discovery fan-out, subdir-scope, subdir-enclosing, workspace, workspace-subdir,
failing-test, install-into-container, project-lookup).
Discovery keys on
package.json+ itsworkspacesfield, so a monorepo'smembers are enumerated individually (a Bun workspace has one root
bun.lock, solockfile-keying only found the root); each member installs at its workspace root so
workspace:*cross-deps resolve. It is also cwd-aware, a faithful implementation ofdagger/dagger#13688 —
(parentConfigDir + descendantConfigDirs)— so from asubdirectory the verbs act on the project you're in, shadowing farther-up
projects and skipping siblings. Verified against a real 4-member monorepo repro.
Verified against real images:
bunis at/usr/local/bin/bun, glibc onoven/bun:<v>and musl on-alpine(soinstall(musl:)copies the matchingbuild); targets need a C++ runtime (
libstdc++), whichdebian:stable-slimhasand bare
alpinedoes not.