module: expose `resolveLoadAndCache` API
Opening as draft as I'd like to get some feedback on the API design first. /cc @nodejs/loaders
Use case for this is to get "final" format of the module that would result from importing a specific specifier. The cache part is primordial as otherwise you'd have no guarantee that the result would be accurate (if there's a user loader involved, we have no reason to believe it would be stable over time). However, caching a call that's sometimes async, sometimes sync is more or less impossible in JS, and on top of that there are loaders out there that rely on resolve NOT being cached (e.g the test runner .mock util), so instead I decided it'd be more useful to provide a way to skip the resolve call.
Review requested:
- [ ] @nodejs/loaders
Codecov Report
:x: Patch coverage is 89.58333% with 5 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 90.21%. Comparing base (c712dd2) to head (434cbf2).
:warning: Report is 1622 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| lib/internal/modules/helpers.js | 87.17% | 5 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #55756 +/- ##
==========================================
+ Coverage 89.66% 90.21% +0.55%
==========================================
Files 630 630
Lines 186389 186437 +48
Branches 36286 36612 +326
==========================================
+ Hits 167124 168198 +1074
+ Misses 12049 11060 -989
+ Partials 7216 7179 -37
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| lib/module.js | 100.00% <100.00%> (ΓΈ) |
|
| lib/internal/modules/helpers.js | 97.87% <87.17%> (-0.05%) |
:arrow_down: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.