2014-10-20 16:56:45 -04:00
|
|
|
/**
|
|
|
|
@overview
|
|
|
|
@author Michael Mathews <micmath@gmail.com>
|
2014-10-22 10:11:40 -04:00
|
|
|
@license Apache License 2.0 - See file 'LICENSE.md' in this project.
|
2014-10-20 16:56:45 -04:00
|
|
|
*/
|
2014-10-22 10:11:40 -04:00
|
|
|
'use strict';
|
2014-10-20 16:56:45 -04:00
|
|
|
|
|
|
|
/**
|
2014-10-22 10:11:40 -04:00
|
|
|
@module jsdoc/package
|
|
|
|
@see http://wiki.commonjs.org/wiki/Packages/1.0
|
2014-10-20 16:56:45 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class
|
|
|
|
@classdesc Represents a JavaScript package.
|
|
|
|
@param {string} json - The contents of package.json.
|
|
|
|
*/
|
|
|
|
exports.Package = function(json) {
|
2014-10-22 10:11:40 -04:00
|
|
|
json = json || '{}';
|
2014-10-20 16:56:45 -04:00
|
|
|
|
|
|
|
/** The source files associated with this package.
|
|
|
|
@type {Array<String>}
|
|
|
|
*/
|
|
|
|
this.files = [];
|
2014-10-22 10:11:40 -04:00
|
|
|
|
2014-10-20 16:56:45 -04:00
|
|
|
/** The kind of this package.
|
|
|
|
@readonly
|
|
|
|
@default
|
|
|
|
@type {string}
|
|
|
|
*/
|
|
|
|
this.kind = 'package';
|
2014-10-22 10:11:40 -04:00
|
|
|
|
2014-10-20 16:56:45 -04:00
|
|
|
json = JSON.parse(json);
|
2014-10-22 10:11:40 -04:00
|
|
|
|
2014-10-20 16:56:45 -04:00
|
|
|
/** The name of this package.
|
|
|
|
This value is found in the package.json file passed in as a command line option.
|
|
|
|
@type {string}
|
|
|
|
*/
|
|
|
|
this.name = json.name;
|
2014-10-22 10:11:40 -04:00
|
|
|
|
2014-10-20 16:56:45 -04:00
|
|
|
/** The longname of this package.
|
|
|
|
@type {string}
|
|
|
|
*/
|
|
|
|
this.longname = this.kind + ':' + this.name;
|
2014-10-22 10:11:40 -04:00
|
|
|
|
2014-10-20 16:56:45 -04:00
|
|
|
/** The description of this package.
|
|
|
|
@type {string}
|
|
|
|
*/
|
|
|
|
this.description = json.description;
|
2014-10-22 10:11:40 -04:00
|
|
|
|
2014-10-20 16:56:45 -04:00
|
|
|
/**
|
|
|
|
The hash summary of the source file.
|
|
|
|
@type {string}
|
|
|
|
@since 3.2.0
|
|
|
|
*/
|
|
|
|
this.version = json.version;
|
2014-10-22 10:11:40 -04:00
|
|
|
|
2014-10-20 16:56:45 -04:00
|
|
|
/**
|
|
|
|
* The licenses of this package.
|
|
|
|
* @type {Array<Object>}
|
|
|
|
* @example
|
|
|
|
* "licenses": [
|
|
|
|
* {
|
|
|
|
* "type": "GPLv2",
|
|
|
|
* "url": "http://www.example.com/licenses/gpl.html"
|
|
|
|
* }
|
|
|
|
* ]
|
|
|
|
*/
|
|
|
|
this.licenses = json.licenses;
|
|
|
|
};
|