Skip to content

feat(Resolver): allow optional resolveContext on resolve()#536

Merged
alexander-akait merged 6 commits intomainfrom
claude/resolver-optional-context-JqGad
Apr 17, 2026
Merged

feat(Resolver): allow optional resolveContext on resolve()#536
alexander-akait merged 6 commits intomainfrom
claude/resolver-optional-context-JqGad

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

Match resolveSync/resolvePromise by letting callers invoke
Resolver#resolve without a resolveContext. A callback passed in the
4th position is now treated as the callback, and missing/null
resolveContext falls back to an empty object. Tightens argument
validation with consistent typeof/null checks and throws a TypeError
when the callback is missing.

claude added 3 commits April 17, 2026 16:26
Match resolveSync/resolvePromise by letting callers invoke
Resolver#resolve without a resolveContext. A callback passed in the
4th position is now treated as the callback, and missing/null
resolveContext falls back to an empty object. Tightens argument
validation with consistent typeof/null checks and throws a TypeError
when the callback is missing.
Expose the two public call signatures as @overload JSDoc blocks so
the generated TypeScript declarations emit a real overload set
(callback-in-fourth-position vs. full resolveContext + callback)
instead of a union parameter.
…Promise

When the first argument is a string, treat it as the path and shift
the remaining arguments. This matches the existing behavior of the
top-level resolve/resolveSync/resolvePromise helpers in lib/index.js.
Additional JSDoc @overload blocks expose the four (resolve) / two
(resolveSync, resolvePromise) valid call signatures, so the generated
TypeScript declarations reflect the new optional context.
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 17, 2026

CLA Not Signed

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 17, 2026

⚠️ No Changeset found

Latest commit: 51a5ed5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 1 package
Name Type
enhanced-resolve Minor

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.45%. Comparing base (48a71c8) to head (51a5ed5).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #536      +/-   ##
==========================================
- Coverage   96.58%   96.45%   -0.14%     
==========================================
  Files          50       50              
  Lines        2665     2678      +13     
  Branches      812      814       +2     
==========================================
+ Hits         2574     2583       +9     
- Misses         76       80       +4     
  Partials       15       15              
Flag Coverage Δ
integration 96.45% <100.00%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 17, 2026

Merging this PR will not alter performance

✅ 67 untouched benchmarks


Comparing claude/resolver-optional-context-JqGad (51a5ed5) with main (c37eebe)

Open in CodSpeed

alexander-akait and others added 3 commits April 17, 2026 21:02
resolveSync and resolvePromise now delegate directly to resolve()
without pre-shifting arguments. resolve() handles both call styles:
the user-facing 3/4-arg form (callback in the former resolveContext
or request slot) and the 5-arg delegate form where the callback is
already in place.
Reorder `!x || typeof x !== "object"` so the cheap falsy check
short-circuits before the typeof, and add short comments explaining
why the shift block and the 4-arg fall-through exist.
@alexander-akait alexander-akait merged commit 8710f19 into main Apr 17, 2026
32 of 34 checks passed
@alexander-akait alexander-akait deleted the claude/resolver-optional-context-JqGad branch April 17, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants