fix(bazel): self-anchoring svelte-package wrapper so build works as an external RBE module (TIN-1721) [0.3.1] - #14
Merged
Jess Sullivan (Jesssullivan) merged 2 commits intoJul 5, 2026
Conversation
added 2 commits
July 5, 2026 15:32
The raw svelte_package.svelte_package_binary resolved `-i src` relative to process.cwd(), which rules_js leaves at $(BINDIR) with no chdir. That works when stores is the ROOT package (standalone `bazel build //:pkg`, src at $(BINDIR)/src) but breaks when stores is consumed as an EXTERNAL registry module under RBE: src lands at $(BINDIR)/external/<repo>+/src while cwd stays $(BINDIR), so `-i src` misses and the package build fails. Replace the generated binary with a thin js_binary wrapper (build-svelte.mjs) that chdir's to its own copied-to-bin package dir via import.meta.url before delegating to @sveltejs/package, so `-i src` / `-o dist` resolve correctly in both the root and external-module layouts. A data-URL module hook pins the `typescript` resolution to the sandboxed toolchain copy. Bump 0.3.0 -> 0.3.1 (MODULE.bazel, BUILD.bazel npm_package, package.json). Gate: `bazelisk build //:pkg --config=ci` -> Build completed successfully (639 actions); wrapper action `JsRunBinary dist` runs, pkg assembled.
The raw svelte_package_binary was replaced by the js_binary wrapper; its @sveltejs/package bin loader is no longer referenced.
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.
Root cause
tinyland-storesbuilds green standalone but fails as an external Bazel registry module under RBE:svelte_package -i srcresolves relative toprocess.cwd(), which rules_js leaves at$(BINDIR)with no chdir. As the root package,srcsits at$(BINDIR)/src(works). As an external registry dep under the un-vendored tinyland.dev//:app_node_build(--noremote_local_fallback),srclands at$(BINDIR)/external/tummycrypt_tinyland_stores+/srcwhile cwd stays$(BINDIR)→-i srcmisses → 'src does not exist' (GF run 28750623854 — the sole remaining TIN-1721 un-vendoring blocker).Fix
Replace the raw
svelte_package.svelte_package_binarywith a thinjs_binaryover a new self-anchoringbuild-svelte.mjswrapper thatprocess.chdir()s to its own copied-to-bin package dir (viaimport.meta.url) before delegating to@sveltejs/package, so-i src/-o distresolve in BOTH the root and external-module layouts. A resolve hook pinstypescriptto the sandboxed toolchain copy. Mirrors the mothership's in-treebuild-svelte.mjs+ composables' proven wrapper (composables builds green as a registry module in the same graph). Version 0.3.0 → 0.3.1 (MODULE.bazel, BUILD npm_package, package.json).Validation
Standalone gate green:
bazelisk build //:pkg --config=ci→ Build completed successfully, 639 actions (confirms no regression to the root-package path). The external-module fix is validated by the tinyland.dev #616 un-vendored RBE proof re-dispatch after registry promotion of 0.3.1 (the layout that can't be reproduced on a single-machine build). Tag v0.3.1 + bazel-registry promotion are the follow-ups.