Visitar URL original
module: fix async resolution error within the sync `findPackageJSON` by JakobJingleheimer · Pull Request #56382 · nodejs/node · GitHub
The Wayback Machine - https://web.archive.org/web/20241230071514/https://github.com/nodejs/node/pull/56382
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: fix async resolution error within the sync findPackageJSON #56382

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JakobJingleheimer
Copy link
Member

Resolves #55822 (that merely sweeps the problem under the rug).

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@JakobJingleheimer JakobJingleheimer marked this pull request as draft December 28, 2024 14:57
@nodejs-github-bot nodejs-github-bot added module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Dec 28, 2024
Copy link

codecov bot commented Dec 28, 2024 •

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.55%. Comparing base (91c6b8a) to head (a7b91e3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #56382      +/-   ##
==========================================
+ Coverage   88.53%   88.55%   +0.01%     
==========================================
  Files         657      657              
  Lines      190689   190696       +7     
  Branches    36597    36602       +5     
==========================================
+ Hits       168826   168865      +39     
+ Misses      15030    15017      -13     
+ Partials     6833     6814      -19     
Files with missing lines Coverage Δ
lib/internal/modules/package_json_reader.js 99.39% <100.00%> (+0.01%) ⬆️

... and 36 files with indirect coverage changes

// (possibly piggyback on `allowImportMetaResolve`)
// 2a. When inside, use the default resolve
// (I think it's impossible to use the chain because of re-entry & a deadlock from atomics).
// 2b. When outside, use cascadedLoader.resolveSync (not implemented yet, but the pieces exist).
resolvedTarget = cascadedLoader.resolve(specifier, `${parentURL}`, pjsonImportAttributes).url;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resolvedTarget = cascadedLoader.resolve(specifier, `${parentURL}`, pjsonImportAttributes).url;
resolvedTarget = cascadedLoader.resolveSync(specifier, `${parentURL}`, pjsonImportAttributes).url;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants