Skip to content

Conversation

@JakobJingleheimer
Copy link
Member

#55229 was too controversial, so back to the original idea from #55173.

Closes #55229

@JakobJingleheimer JakobJingleheimer added the semver-minor PRs that contain new features and should be released in the next minor version. label Oct 16, 2024
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Oct 16, 2024
@JakobJingleheimer JakobJingleheimer added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Oct 16, 2024
@ljharb
Copy link
Member

ljharb commented Oct 16, 2024

so is this basically just https://www.npmjs.com/package/find-pkg / https://www.npmjs.com/package/pkg-up / https://www.npmjs.com/package/package-up ?

@JakobJingleheimer
Copy link
Member Author

JakobJingleheimer commented Oct 16, 2024

"Just" seems a little dismissive 😕

The first package was last updated 7 years ago (so it may well be outdated, plus its cited limitations).

The second package is deprecated.

The third is maybe similar/close; it appears to only do direct path manipulation and won't respect module resolution (ex from a loader hook), which this does respect.

Edit: looking closer, the third package has several limitations that this does not, such how it handles relative search (cwd vs current module location) and, AFAICS, it does not handle node_modules.

This package is also leveraging/mirroring node's internals, so it will behave exactly as node is doing internally (whereas userland may not, and would have to re-invent the wheel to do so).

@ljharb
Copy link
Member

ljharb commented Oct 16, 2024

apologies, you're right, a better way to phrase it is "is this the same capability as these packages".

Certainly doing this internally in node is better for tons of reasons, and I'm glad you're adding it :-) I wanted to confirm what the semantics were, is all.

@JakobJingleheimer
Copy link
Member Author

I wanted to confirm what the semantics were, is all.

Ah, yes then 🙂

@JakobJingleheimer
Copy link
Member Author

The markdown linter is complaining about a codeblock that has no language. It's a directory listing—language is not applicable (it just needs the default codeblock treatment).

Can I disable the rule for that block?

@ljharb
Copy link
Member

ljharb commented Oct 16, 2024

can you tag it as sh?

@codecov
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 98.80478% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.41%. Comparing base (53b1050) to head (ba9acf9).
Report is 686 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/modules/package_json_reader.js 99.08% 2 Missing ⚠️
lib/internal/modules/cjs/loader.js 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55412      +/-   ##
==========================================
- Coverage   88.42%   88.41%   -0.01%     
==========================================
  Files         654      654              
  Lines      187552   187657     +105     
  Branches    36087    36117      +30     
==========================================
+ Hits       165839   165919      +80     
- Misses      14950    14972      +22     
- Partials     6763     6766       +3     
Files with missing lines Coverage Δ
lib/internal/modules/esm/resolve.js 96.17% <100.00%> (-0.16%) ⬇️
lib/module.js 100.00% <100.00%> (ø)
lib/internal/modules/cjs/loader.js 97.59% <90.90%> (-0.06%) ⬇️
lib/internal/modules/package_json_reader.js 99.40% <99.08%> (-0.60%) ⬇️

... and 34 files with indirect coverage changes

@JakobJingleheimer
Copy link
Member Author

can you tag it as sh?

That could hack around it, but it would enable shell syntax highlighting. There should be no syntax highlighting.

@targos
Copy link
Member

targos commented Oct 17, 2024

What about text? It's already used in many places of the docs.

@JakobJingleheimer
Copy link
Member Author

What about text? It's already used in many places of the docs.

Huzzah! perfect. I didn't know that was an option. Thanks!

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@JakobJingleheimer JakobJingleheimer added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 17, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 17, 2024
@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported-to-v22.x PRs backported to the v22.x-staging branch. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants