Skip to content

fix(plugin): strip bun's bundle path comments so the tarball verifies - #7

Merged
JeffreyJYZ merged 3 commits into
mainfrom
fix/deterministic-bundle
Nov 8, 2026
Merged

JeffreyJYZ merged 3 commits into
mainfrom
fix/deterministic-bundle

Conversation

@jyzbot

@jyzbot jyzbot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

What

The plugin build now strips bun's // <module path> comments from dist/, so a published tarball is a function of the source alone.

Why

verify-release.ts 0.5.23 reported:

latest=0.5.23 version=yes tarball=200 sha1=a0179ce4… MISMATCH
served bytes do not match the local pack — do not install

The tarballs differ only in those comments: bun writes // node_modules/zod/v4/core/core.js in a bun-workspace install and // ../node_modules/.bun/zod@4.1.8/node_modules/zod/v4/core/core.js in CI's npm install. Removing them from both sides makes dist/index.js identical, and dist/tui.js already was.

So the published 0.5.23 is sound — but every future release would have failed the same check, and the bundle was also leaking an install path.

Verification

  • bun run build now ends with stripped bundle path comments in 1 file(s); grep -c '^// .*node_modules/' dist/index.js dist/tui.js returns 0 for both.
  • bun test 246 pass / 0 fail.
  • Comment-stripped diff of the published 0.5.23 tarball against a local pack is empty for both bundles.

Note

verify-release.ts 0.5.23 still reports MISMATCH by design: that tarball was built before this change. The next release (0.5.24) should verify clean, which is the real proof this works.

bun build writes `// <module path>` above every inlined module, and the
path depends on the install: a bun workspace shows
`node_modules/zod/...` while CI shows
`../node_modules/.bun/zod@4.1.8/node_modules/zod/...`. The code is
byte-identical, but verify-release.ts hashes the tarball, so a healthy
publish read as "served bytes do not match the local pack — do not
install".

The build now drops those comments, which also stops the bundle leaking
an install path.
@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cmdcode-tools-site Ready Ready Preview Nov 6, 2026 10:41am UTC

@JeffreyJYZ
JeffreyJYZ merged commit c2851b8 into main Nov 8, 2026
10 checks passed

This branch was successfully deployed

1 active deployment
Preview — c2851b8f Deployed Nov 6, 2026 by vercel[bot]
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.

2 participants