-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: add findPackageJSON
util
#55412
module: add findPackageJSON
util
#55412
Conversation
Review requested:
|
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 ? |
"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). |
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. |
Ah, yes then 🙂 |
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? |
can you tag it as |
Codecov ReportAttention: Patch coverage is
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
|
That could hack around it, but it would enable shell syntax highlighting. There should be no syntax highlighting. |
What about |
Huzzah! perfect. I didn't know that was an option. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What happens if a non-file URL is passed? Does it throw an error, or an assertion? |
Yes, somewhere further along it complains when the scheme is disallowed. |
Landed in e312d60 |
getNearestParentPackageJSONType(path: string): PackageConfig['type'] | ||
getPackageScopeConfig(path: string): SerializedPackageConfig | undefined | ||
getPackageJSONScripts(): string | undefined | ||
flushCompileCache(keepDeserializedCache?: boolean): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why flushCompileCache
is deleted ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird. I didn't delete it
PR-URL: #55412 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Notable changes: doc: * move typescript support to active development (Marco Ippolito) nodejs#55536 * add jazelly to collaborators (Jason Zhang) nodejs#55531 fs: * (SEMVER-MINOR) make `dirent.path` writable (Antoine du Hamel) nodejs#55547 http: * (SEMVER-MINOR) add diagnostic channel `http.client.request.created` (Marco Ippolito) nodejs#55586 module: * (SEMVER-MINOR) add `findPackageJSON` util (Jacob Smith) nodejs#55412 * (SEMVER-MINOR) add module.stripTypeScriptTypes (Marco Ippolito) nodejs#55282 PR-URL: TODO
PR-URL: nodejs#55412 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Notable changes: crypto: * update root certificates to NSS 3.104 (Richard Lau) #55681 doc: * move typescript support to active development (Marco Ippolito) #55536 * add jazelly to collaborators (Jason Zhang) #55531 fs: * (SEMVER-MINOR) make `dirent.path` writable (Antoine du Hamel) #55547 http: * (SEMVER-MINOR) add diagnostic channel `http.client.request.created` (Marco Ippolito) #55586 module: * (SEMVER-MINOR) add `findPackageJSON` util (Jacob Smith) #55412 * (SEMVER-MINOR) add module.stripTypeScriptTypes (Marco Ippolito) #55282 tools: * fix root certificate updater (Richard Lau) #55681 PR-URL: TODO
Notable changes: crypto: * update root certificates to NSS 3.104 (Richard Lau) #55681 doc: * move typescript support to active development (Marco Ippolito) #55536 * add jazelly to collaborators (Jason Zhang) #55531 fs: * (SEMVER-MINOR) make `dirent.path` writable (Antoine du Hamel) #55547 http: * (SEMVER-MINOR) add diagnostic channel `http.client.request.created` (Marco Ippolito) #55586 module: * (SEMVER-MINOR) add `findPackageJSON` util (Jacob Smith) #55412 * (SEMVER-MINOR) add `module.stripTypeScriptTypes` (Marco Ippolito) #55282 PR-URL: #55741
Notable changes: crypto: * update root certificates to NSS 3.104 (Richard Lau) #55681 doc: * move typescript support to active development (Marco Ippolito) #55536 * add jazelly to collaborators (Jason Zhang) #55531 fs: * (SEMVER-MINOR) make `dirent.path` writable (Antoine du Hamel) #55547 http: * (SEMVER-MINOR) add diagnostic channel `http.client.request.created` (Marco Ippolito) #55586 module: * (SEMVER-MINOR) add `findPackageJSON` util (Jacob Smith) #55412 * (SEMVER-MINOR) add `module.stripTypeScriptTypes` (Marco Ippolito) #55282 PR-URL: #55741
Notable changes: crypto: * update root certificates to NSS 3.104 (Richard Lau) #55681 doc: * move typescript support to active development (Marco Ippolito) #55536 * add jazelly to collaborators (Jason Zhang) #55531 fs: * (SEMVER-MINOR) make `dirent.path` writable (Antoine du Hamel) #55547 http: * (SEMVER-MINOR) add diagnostic channel `http.client.request.created` (Marco Ippolito) #55586 module: * (SEMVER-MINOR) add `findPackageJSON` util (Jacob Smith) #55412 * (SEMVER-MINOR) add `module.stripTypeScriptTypes` (Marco Ippolito) #55282 PR-URL: #55741
Notable changes: crypto: * update root certificates to NSS 3.104 (Richard Lau) #55681 doc: * move typescript support to active development (Marco Ippolito) #55536 * add jazelly to collaborators (Jason Zhang) #55531 fs: * (SEMVER-MINOR) make `dirent.path` writable (Antoine du Hamel) #55547 http: * (SEMVER-MINOR) add diagnostic channel `http.client.request.created` (Marco Ippolito) #55586 module: * (SEMVER-MINOR) add `findPackageJSON` util (Jacob Smith) #55412 * (SEMVER-MINOR) add `module.stripTypeScriptTypes` (Marco Ippolito) #55282 PR-URL: #55741
Notable changes: crypto: * update root certificates to NSS 3.104 (Richard Lau) #55681 doc: * move typescript support to active development (Marco Ippolito) #55536 * add jazelly to collaborators (Jason Zhang) #55531 fs: * (SEMVER-MINOR) make `dirent.path` writable (Antoine du Hamel) #55547 http: * (SEMVER-MINOR) add diagnostic channel `http.client.request.created` (Marco Ippolito) #55586 module: * (SEMVER-MINOR) add `findPackageJSON` util (Jacob Smith) #55412 * (SEMVER-MINOR) add `module.stripTypeScriptTypes` (Marco Ippolito) #55282 PR-URL: #55741
#55229 was too controversial, so back to the original idea from #55173.
Closes #55229