88 */
99'use strict' ;
1010
11- var Promise = require ( 'bluebird' ) ;
12- var isAbsolutePath = require ( 'absolute-path' ) ;
13-
1411function ModuleDescriptor ( fields ) {
1512 if ( ! fields . id ) {
1613 throw new Error ( 'Missing required fields id' ) ;
@@ -20,13 +17,17 @@ function ModuleDescriptor(fields) {
2017 if ( ! fields . path ) {
2118 throw new Error ( 'Missing required fields path' ) ;
2219 }
23- if ( ! isAbsolutePath ( fields . path ) ) {
24- throw new Error ( 'Expected absolute path but found: ' + fields . path ) ;
25- }
2620 this . path = fields . path ;
2721
22+ if ( ! fields . dependencies ) {
23+ throw new Error ( 'Missing required fields dependencies' ) ;
24+ }
2825 this . dependencies = fields . dependencies ;
2926
27+ this . resolveDependency = fields . resolveDependency ;
28+
29+ this . entry = fields . entry || false ;
30+
3031 this . isPolyfill = fields . isPolyfill || false ;
3132
3233 this . isAsset_DEPRECATED = fields . isAsset_DEPRECATED || false ;
@@ -49,30 +50,12 @@ function ModuleDescriptor(fields) {
4950 this . _fields = fields ;
5051}
5152
52- ModuleDescriptor . prototype . loadDependencies = function ( loader ) {
53- if ( ! this . dependencies ) {
54- if ( this . _loadingDependencies ) {
55- return this . _loadingDependencies ;
56- }
57-
58- var self = this ;
59- this . _loadingDependencies = loader ( this ) . then ( function ( dependencies ) {
60- self . dependencies = dependencies ;
61- } ) ;
62- return this . _loadingDependencies ;
63- }
64-
65- return Promise . resolve ( this . dependencies ) ;
66- } ;
67-
6853ModuleDescriptor . prototype . toJSON = function ( ) {
69- var ret = { } ;
70- Object . keys ( this ) . forEach ( function ( prop ) {
71- if ( prop [ 0 ] !== '_' && typeof this [ prop ] !== 'function' ) {
72- ret [ prop ] = this [ prop ] ;
73- }
74- } , this ) ;
75- return ret ;
54+ return {
55+ id : this . id ,
56+ path : this . path ,
57+ dependencies : this . dependencies
58+ } ;
7659} ;
7760
7861module . exports = ModuleDescriptor ;
0 commit comments