refactor(chat): point exports at dist and delete the prepack export swap - #68
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@coderabbitai full review This PR predates the CodeRabbit app being active here, so it has never been reviewed. It is also the one we intend to merge first and release on its own, because it changes how the package is published — so a review before merge is worth having. Worth particular attention:
Verified locally: |
|
✅ Action performedFull review finished. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🔇 Additional comments (6)
📝 WalkthroughWalkthroughThe package now exports built ChangesPackage export and resolution changes
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The package export and build changes are merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Closes CHAT-9. Points
exportspermanently at./distand deletes the prepack export swap.Why
exportspointed at./src/*.tsin the repo, so the docs app could consume package source with no build step, and aprepack/postpackpair swapped it to./distfor packing. npm builds the packument frompackage.jsonas it stands afterpostpack— which restored the source paths — so every published version advertises./src/*.tsfor all 11 subpaths, files the tarball does not ship. Still true on 0.1.2:Consumers were never affected — Node resolves against the
package.jsoninside the tarball, which always carried correct./distpaths. But the metadata reads exactly like a broken publish, and it already misled one debugging session into concluding the package was uninstallable.The deciding factor is that the mechanism has an expiry date regardless. npm warns:
What changed
exportsnow carries the./distmap withtypes/defaultconditions, permanently.publishConfigreduced to{"access":"public"};publishConfig.exportsdeleted.scripts/swap-exports.mjsdeleted,postpackremoved,prepackreduced tobun run build— the build must still run before packing.pathsentry intsconfig.jsonand a matchingturbopack.resolveAliasinnext.config.ts, each mapping the 11 subpaths topackages/chat/src. The alias entries are explicit rather than a wildcard, because Turbopack'sresolveAliasmatches request strings, not globs.scripts/smoke-dist.mjsnow readsexportsinstead ofpublishConfig.exports. This coupling was the one surprise: the smoke test added in fix(chat): add .js extensions to single-quoted dist specifiers #65 iterated the publish-only map, so deleting that key broke the build until it was repointed.tsconfig.demos.jsonneeded no change — it declares its ownpathstopackages/chat/distand does not extend the root config, so the portability gate still tests the built package rather than source.Relationship to #64
This supersedes #64, which repairs the swap by deferring the restore to
postpublish. That fix is correct, but it invests in the mechanism this PR deletes. If this lands, #64 should be closed unmerged — the packument comes out right because there is no swap left to leak.Verification
bun run build— 252 specifiers rewritten,smoke-distreports all 11 entries load under Nodepublint— clean, and no longer warns aboutpublishConfig.exportstsc --noEmitclean;tsc -p tsconfig.demos.json(portability gate) clean;scripts/audit-docs.mjsclean;biome checkcleannext buildgreen withpackages/chat/distdeleted entirely — the actual proof that the app still compiles package source with no build step, rather than silently resolving through a staledistTakes effect on the next publish. Packument entries are immutable, so 0.1.0–0.1.2 keep their stale metadata permanently; harmless, and not worth a release on its own.
Summary by CodeRabbit