fix(build-manifest): import compiled JS from dist/clis/ instead of raw TS#926
Merged
fix(build-manifest): import compiled JS from dist/clis/ instead of raw TS#926
Conversation
…w TS Node's type stripping does not rewrite '.js' → '.ts' in import specifiers, so dynamically importing .ts source files fails whenever they contain relative imports like './utils.js'. Switch to scanning dist/clis/ for compiled .js files after tsc runs. This eliminates all 268 "Cannot find module" warnings and increases manifest entries from 254 to 532 (previously half were silently skipped).
The runtime resolves BUILTIN_CLIS to dist/clis/ (relative to dist/src/main.js), so discoverClis() looks for manifest at dist/cli-manifest.json. Previously it was written to the package root where the runtime never found it — manifest was effectively unused, always falling through to filesystem scanning.
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.
Summary
build-manifestwas dynamically importing.tssource files fromclis/, but Node's type stripping doesn't rewrite.js→.tsin import specifiers, causing "Cannot find module" for any adapter with relative imports (./utils.js,./shared.js)dist/clis/(compiled JS) instead ofclis/(raw TS) aftertscrunsclis/ifdist/clis/doesn't existsourceFilein manifest correctly maps back to the original.tspathTest plan
npm run build— zero warnings, 532 entries (was 254)vitest run src/build-manifest— 4/4 tests passsourceFilepaths (.tsnot.js)