refactor(chat): point exports at dist and delete the prepack export swap - #68
Open
rpvilo wants to merge 1 commit into
Open
refactor(chat): point exports at dist and delete the prepack export swap#68rpvilo wants to merge 1 commit into
rpvilo wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
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.