Skip to content

Commit 3e1cda8

Browse files
fixup: pjson.name is optional
1 parent bf5265d commit 3e1cda8

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

doc/api/module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ added: REPLACEME
229229
* `everything` {boolean} Whether to return the full contents of the found package.json
230230
* Returns: {Object | undefined}
231231
* data: {Object}
232-
* name: {string}
232+
* name: {string | undefined}
233233
* type: {string | undefined}
234234
* exports: string | string\[] | Record\<string, unknown> | undefined
235235
* imports: string | string\[] | Record\<string, unknown> | undefined

lib/internal/modules/package_json_reader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function deserializePackageJSON(path, contents) {
5252
return {
5353
data: {
5454
__proto__: null,
55-
name,
55+
...(name !== null && { name }),
5656
...(main != null && { main }),
5757
...(type != null && { type }),
5858
...(plainImports != null && {

typings/internalBinding/modules.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type PackageType = 'commonjs' | 'module' | 'none'
22
export type RecognizedPackageConfig = {
3-
name: string
3+
name?: string
44
main?: any
55
type: PackageType
66
exports?: string | string[] | Record<string, unknown>

0 commit comments

Comments
 (0)