new Package(json)
Information about a JavaScript package. JSDoc can extract package information from
`package.json` files that follow the
[npm specification](https://www.npmjs.org/doc/files/package.json.html).
**Note**: JSDoc does not validate or normalize the contents of `package.json` files. If your
`package.json` file does not follow the npm specification, some properties of the `Package`
object may not use the format documented here.
Parameters:
Name | Type | Description |
---|---|---|
json |
string | The contents of the `package.json` file. |
- Source:
Members
author :module:jsdoc/package.Package~PersonInfo|string
The author of this package. Contains either a
PersonInfo object or a string with
information about the author.
Type:
- Since:
- 3.3.0
- Source:
bugs :string|module:jsdoc/package.Package~BugInfo
Information about where to report bugs in the project. May contain a URL, a string, or an
object with more detailed information.
Type:
- string | module:jsdoc/package.Package~BugInfo
- Since:
- 3.3.0
- Source:
contributors :Array.<(module:jsdoc/package.Package~PersonInfo|string)>
The contributors to this package.
Type:
- Array.<(module:jsdoc/package.Package~PersonInfo|string)>
- Since:
- 3.3.0
- Source:
dependencies :Object
The dependencies for this package.
Type:
- Object
- Since:
- 3.3.0
- Source:
description :string
A brief description of the package.
Type:
- string
- Source:
devDependencies :Object
The development dependencies for this package.
Type:
- Object
- Since:
- 3.3.0
- Source:
engines :Object
The JavaScript engines that this package supports. Each key is a string that identifies
the engine (for example, `node`). Each value is a
[semver](https://www.npmjs.org/doc/misc/semver.html)-compliant version number for the
engine.
Type:
- Object
- Since:
- 3.3.0
- Source:
files :Array.<string>
The source files associated with the package.
New `Package` objects always contain an empty array, regardless of whether the `package.json`
file includes a `files` property.
After JSDoc parses your input files, it sets this property to a list of paths to your input
files.
Type:
- Array.<string>
- Source:
homepage :string
The URL for the package's homepage.
Type:
- string
- Since:
- 3.3.0
- Source:
keywords :Array.<string>
Keywords to help users find the package.
Type:
- Array.<string>
- Since:
- 3.3.0
- Source:
(readonly) kind :string
The string identifier that is shared by all `Package` objects.
Type:
- string
- Default Value:
- package
- Source:
licenses :Array.<module:jsdoc/package.Package~LicenseInfo>
The licenses used by this package. Combines information from the `package.json` file's
`license` property and the deprecated `licenses` property.
Type:
- Source:
longname :string
The unique longname for this `Package` object.
Type:
- string
- Source:
main :string
The module ID that provides the primary entry point to the package. For example, if your
package is a CommonJS module, and the value of this property is `foo`, users should be
able to load your module with `require('foo')`.
Type:
- string
- Since:
- 3.3.0
- Source:
name :string
The package name.
Type:
- string
- Source:
repository :module:jsdoc/package.Package~RepositoryInfo
The version-control repository for the package.
Type:
- Since:
- 3.3.0
- Source:
version :string
The [semver](https://www.npmjs.org/doc/misc/semver.html)-compliant version number of the
package.
Type:
- string
- Since:
- 3.2.0
- Source:
Type Definitions
BugInfo
Information about where to report bugs in the package.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
email |
string | The email address for reporting bugs. |
url |
string | The URL for reporting bugs. |
- Source:
LicenseInfo
Information about a package's software license.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
type |
string | An identifier for the type of license. |
url |
string | The URL for the complete text of the license. |
- Source:
PersonInfo
Information about a package author or contributor.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
name |
string | The person's full name. |
email |
string | The person's email address. |
url |
string | The URL of the person's website. |
- Source:
RepositoryInfo
Information about a package's version-control repository.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
type |
string | The type of version-control system that the repository uses (for example, `git` or `svn`). |
url |
string | The URL for the repository. |
- Source: