test: validate exports map paths in package test#28245
Merged
carlosmiei merged 7 commits intoccxt:masterfrom Mar 30, 2026
Merged
test: validate exports map paths in package test#28245carlosmiei merged 7 commits intoccxt:masterfrom
carlosmiei merged 7 commits intoccxt:masterfrom
Conversation
Add test-exports.mjs that verifies all file paths in package.json "exports" map exist in the packed tarball. This would have caught the broken CJS types export (ccxt#28229) where require.types pointed to index.d.ts which was excluded by .npmignore.
Add dist/ccxt.d.cts so CJS consumers using moduleResolution node16/nodenext get proper type resolution instead of TS1479 errors. Update package test to include a tsc type-check step for CJS types.
Move CJS type declaration generation into rollup.config.js instead of manually committing the file, consistent with how dist/cjs/package.json is already generated.
… checks Expand package test coverage to include ESM type-checking with node16, bundler moduleResolution for Vite/Next.js/webpack users, and destructured CJS require imports.
Place CJS type declaration at the package root instead of dist/, avoiding the unnecessary ../js/ relative path. Update .npmignore, package.json exports map, and rollup config accordingly.
Keep the CJS type declaration filename consistent with the original index.d.ts convention.
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
test-exports.mjstoutils/package-test/that validates all file paths inpackage.json"exports"map exist in the installed (packed) tarballutils/package-test.shalongside the existing ESM/CJS runtime testsThis would have caught the broken CJS types export fixed in #28229, where
require.typespointed toindex.d.tswhich was excluded by.npmignore.Test plan
require.typespoints to./index.d.ts(not in tarball):[Exports] MISSING: exports...require.types -> ./index.d.tsrequire.typespoints to./js/ccxt.d.ts(in tarball):[Exports] All paths valid