mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
39 lines
787 B
JavaScript
39 lines
787 B
JavaScript
'use strict';
|
|
|
|
function ModuleDescriptor(fields) {
|
|
if (!fields.id) {
|
|
throw new Error('Missing required fields id');
|
|
}
|
|
this.id = fields.id;
|
|
|
|
if (!fields.path) {
|
|
throw new Error('Missing required fields path');
|
|
}
|
|
this.path = fields.path;
|
|
|
|
if (!fields.dependencies) {
|
|
throw new Error('Missing required fields dependencies');
|
|
}
|
|
this.dependencies = fields.dependencies;
|
|
|
|
this.resolveDependency = fields.resolveDependency;
|
|
|
|
this.entry = fields.entry || false;
|
|
|
|
this.isPolyfill = fields.isPolyfill || false;
|
|
|
|
this.isAsset = fields.isAsset || false;
|
|
|
|
this._fields = fields;
|
|
}
|
|
|
|
ModuleDescriptor.prototype.toJSON = function() {
|
|
return {
|
|
id: this.id,
|
|
path: this.path,
|
|
dependencies: this.dependencies
|
|
};
|
|
};
|
|
|
|
module.exports = ModuleDescriptor;
|