-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
module: expose getPackageJSON utility
#55229
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
Closed
JakobJingleheimer
wants to merge
37
commits into
nodejs:main
from
JakobJingleheimer:feat/module-utils-getFullPJSON
Closed
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
48ab696
module: expose `getPackageJSON` utility
JakobJingleheimer dcddd1e
fixup: convert `path_value` to string before fn casting to path
JakobJingleheimer 98c72f4
fixup: remove obsolete reference to `findNearestPackageJSON`
JakobJingleheimer d4ede54
fixup: add some tests cases
JakobJingleheimer 92f2c62
feat: adjust `getNearestParentPackageJSON().path` to pjsonPath
JakobJingleheimer b83707b
feat: conditionally include non-required fields only when they exist
JakobJingleheimer e0beefa
fixup: remove unnecessary `JSON.parse()` (it's already parsed)
JakobJingleheimer 6e715ec
test: add more cases
JakobJingleheimer 458dcca
fix: provide missing `pjsonPath` for `GetNearestRawParentPackageJSON`
JakobJingleheimer 903d201
fix: correct internal bindings type decs
JakobJingleheimer b567e9a
fixup: remove unnecessary string manipulation
JakobJingleheimer ed4db64
fixup: de-lint
JakobJingleheimer 9a4b1d1
this is awful. why does anyone want this lint rule
JakobJingleheimer c23c8f1
fixup: correct yaml version needle
JakobJingleheimer c865d55
fixup: americanize name
JakobJingleheimer a9bf393
fixup: mangle md
JakobJingleheimer 190e315
fixup: mangle c++ code
JakobJingleheimer a9e3ded
fixup: specific → nondescript to satisfy linting
JakobJingleheimer 926b2b0
fixup: correct return dec in md
JakobJingleheimer 485b1e3
fixup: remove temp fields & correct type decs
JakobJingleheimer f824ce9
fixup: wordsmith doc & expand examples
JakobJingleheimer 7deeb7f
fixup: leverage validate* utils
JakobJingleheimer cf49f71
fixup: `ToString` → `ToStringView `
JakobJingleheimer 358486c
fixup: support file URL strings, update arg name, add test case
JakobJingleheimer d9bdf23
fixup: damn this limited docs types validator
JakobJingleheimer bf5265d
fixup: require url → internal/url
JakobJingleheimer 3e1cda8
fixup: pjson.name is optional
JakobJingleheimer da29815
fixup: remove unnecessary cost for default value object instantiation
JakobJingleheimer b531497
fixup: throw on relative `statLocation` with remediation instructions
JakobJingleheimer eef2b60
fixup: add test-case for require() resolving via package.json
JakobJingleheimer 395cfa6
fixup: update consumption of `readPackage` & `read()`
JakobJingleheimer 841848f
Revert "fixup: update consumption of `readPackage` & `read()`"
JakobJingleheimer 945c207
fixus: restore return signature of jpsonReader.read
JakobJingleheimer 4adac4c
fixup: null proto for read return
JakobJingleheimer 0064379
fixup: `!== null` → `!= null`
JakobJingleheimer eed739c
fixup: spread with `__proto__: null`
JakobJingleheimer 864b98a
fixup: add `exists` to `DeserializedPackageConfig`
JakobJingleheimer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fixup: throw on relative
statLocation with remediation instructions
- Loading branch information
commit b5314979498275d7cea1e3cc1c88c2f6645d6a15
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"name": "package-with-sub-package"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| const { getPackageJSON } = require('node:module'); | ||
| const { resolve } = require('node:path'); | ||
|
|
||
| module.exports = getPackageJSON(resolve(__dirname, '..')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"name": "sub-package", "type": "commonjs"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { getPackageJSON } from 'node:module'; | ||
|
|
||
| export default getPackageJSON(import.meta.resolve('..')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"name": "sub-package", "type": "module"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.