Repository navigation
fix(trace): resolve traceInclude packages under minimal conditions (#57) - #58
Conversation
…57) `traceInclude` resolution used the caller's raw `conditions` (e.g. Nitro's `["node"]`), which silently dropped packages whose `exports` are keyed only by `import`/`require` — with no top-level `default` or `./package.json` export (e.g. `sharp`). Resolve with a permissive superset of the caller's conditions instead; since `traceInclude` only needs to locate a package to copy it, widening conditions never changes runtime behaviour. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughModifies ChangestraceInclude Resolution Fix
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
==========================================
+ Coverage 79.54% 80.13% +0.58%
==========================================
Files 5 5
Lines 577 579 +2
Branches 167 168 +1
==========================================
+ Hits 459 464 +5
+ Misses 85 84 -1
+ Partials 33 31 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Fixes #57.
traceIncludepackage resolution used the caller's rawconditions(e.g. Nitro's["node"]). Packages whoseexportsmap is keyed only byimport/require— with no top-leveldefaultor./package.jsonexport (e.g.sharp) — match none of those keys, soresolveModulePathreturnsundefinedand the<name>/package.jsonfallback also fails (such packages rarely exposepackage.jsonviaexports). The package was then silently dropped from the trace.The fix resolves
traceIncludenames with a permissive superset of the caller's conditions (import/require/defaultadded). SincetraceIncludeonly needs to locate a package in order to copy it wholesale, widening conditions here never changes downstream runtime behaviour.Test plan
Added a regression test (
test/trace.test.ts) with a new fixture@fixture/conditional-exportswhoseexportsare keyed only byimport/require. It is force-included withconditions: ["node"], and the test asserts both the package and its transitively-traced runtime dependency are copied. The test fails onmain(package dropped) and passes with the fix.Full suite: 41/41 passing; typecheck and lint clean.
🤖 Generated with Claude Code
Summary by CodeRabbit