Skip to content

Commit

Permalink
fixup: pjson.name is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer committed Oct 6, 2024
1 parent bf5265d commit 3e1cda8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/api/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ added: REPLACEME
* `everything` {boolean} Whether to return the full contents of the found package.json
* Returns: {Object | undefined}
* data: {Object}
* name: {string}
* name: {string | undefined}
* type: {string | undefined}
* exports: string | string\[] | Record\<string, unknown> | undefined
* imports: string | string\[] | Record\<string, unknown> | undefined
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/package_json_reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function deserializePackageJSON(path, contents) {
return {
data: {
__proto__: null,
name,
...(name !== null && { name }),
...(main != null && { main }),
...(type != null && { type }),
...(plainImports != null && {
Expand Down
2 changes: 1 addition & 1 deletion typings/internalBinding/modules.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type PackageType = 'commonjs' | 'module' | 'none'
export type RecognizedPackageConfig = {
name: string
name?: string
main?: any
type: PackageType
exports?: string | string[] | Record<string, unknown>
Expand Down

0 comments on commit 3e1cda8

Please sign in to comment.