build(bin): embed sourcemaps in the compiled binary - #1213
Open
TheGreatAxios wants to merge 2 commits into
Open
TheGreatAxios wants to merge 2 commits into
TheGreatAxios wants to merge 2 commits into
Conversation
Crash stacks from the standalone binary pointed at minified frames with no source mapping, leaving production failures unactionable. An embedded sourcemap restores file-and-line stacks at a small size cost.
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.
What
Adds
--sourcemapto thebuild:binBun compile flags (--compile --minify --sourcemap), so crash stacks from the standalone binary resolve tosrc/*.tsfile-and-line instead of minified frames.Measurements (darwin arm64, same worktree install, 1168 modules both sides)
--sourcemap)dist/corbitssize./dist/corbits --helpmedian (5x,/usr/bin/time -preal)Startup holds within run-to-run noise (machine variance dominates, ranges overlap); size growth is modest. No rollback trigger met.
Rollback decision (per brief protocol)
--bytecodewas tried first (--compile --minify --sourcemap --bytecode) and rolled back:bun buildexits 1 witherror: "await" can only be used inside an "async" function at src/index.ts:151:18— Bun bytecode compilation does not accept the entry point's top-level await, and refactoring the entry is out of scope for this change. Kept--sourcemap, dropped--bytecode, re-measured above. No >2x bloat, no codesign breakage (codesign -vpasses), no platform build failure with the shipped flags.Sourcemap packaging
src/config/index.ts:965,src/index.ts:39/117/151even with no sidecar present.dist/corbits.mapsidecar next to the binary; it is not needed at runtime (binary runs clean and maps stacks without it).scripts/release.shcompile_bincopies only the binary file into each tarball, neverdist/*.map.scripts/release.shcompile_binnow carries--sourcemaptoo (--compile --target=… --minify --sourcemap, no--bytecode), so release binaries carry the embedded map.bash -nsyntax check passes.Verification
bun run checkgreen in the worktree (lint, typecheck, dead-exports, build, projects-dir-guard; 8595 pass, 0 fail).--helplaunch clean; forced error exits with mappedsrc/*.tsstack.Fixes CL-9018