mirror of
https://github.com/morluto/rea.git
synced 2026-10-22 13:52:32 -05:00
* fix(javascript): honor package exports condition order Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(javascript): resolve exports against Node's full condition set The declared-order fix selected targets against {default, import|require}, but Node's active set for the resolver that owns installed packages also includes "node" and "node-addons". Ordering only means something against the full active set, so a package declaring {"node", "import"} resolved to the wrong target, and a package declaring only {"import"} reported no target where Node resolves ./node.cjs. Nested condition objects and fallback arrays are also valid Node targets. They are now flattened in Node's own order: a condition object stops at its first active key, so a null or unmatched nested target ends the search, while an array skips the entries it cannot resolve and concatenates the rest. Node does not fall through a target whose file is absent, so the first flattened target stands and its absence is reported rather than skipped. A valid exports map that matches no active condition is reported as external with the declared condition names, and one that selects an unsupported nested or array target no longer borrows the "not valid package JSON" reason. The differential test installs a real package and resolves the same bare specifier through Node and through REA, mirroring file presence between the filesystem and the inventory. 18 of the 25 cases fail without this change. * style: apply Prettier to the conditional exports differential test --------- Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>