Repository navigation
fix(core): reject numeric source export conditions - #2053
Open
lanqing431 wants to merge 1 commit into
Open
lanqing431 wants to merge 1 commit into
lanqing431 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Motivation
With
exports.source: "0", Rslib builds successfully but writes a numeric condition key topackage.json. Node.js then rejects the generated exports withERR_INVALID_PACKAGE_CONFIG, even on a normal import that would have used the fallback.Changes
Reject condition keys that Node's package exports resolver rejects before writing the generated metadata. The error identifies
exports.sourceand gives an example of a valid name. Regression cases cover zero, fractional keys, and the numeric boundary while preserving valid custom conditions.Validation:
pnpm build,pnpm check,pnpm check-spell, 269 unit tests, 436 integration tests, and 7 browser E2E tests passed on Windows. A real CLI build now rejects invalid keys without rewriting the manifest, and packages with valid keys still load in Node.js. The separate cross-platform executable suite timed out in two cases while downloading Node archives.