@@ -69,10 +69,12 @@ export class EntryPointManifest {
69
69
const startTime = Date . now ( ) ;
70
70
71
71
const entryPoints : EntryPointWithDependencies [ ] = [ ] ;
72
- for ( const [ packagePath , entryPointPath , dependencyPaths , missingPaths , deepImportPaths ] of
73
- entryPointPaths ) {
74
- const result =
75
- getEntryPointInfo ( this . fs , this . config , this . logger , packagePath , entryPointPath ) ;
72
+ for ( const
73
+ [ packagePath , entryPointPath , dependencyPaths = [ ] , missingPaths = [ ] ,
74
+ deepImportPaths = [ ] ] of entryPointPaths ) {
75
+ const result = getEntryPointInfo (
76
+ this . fs , this . config , this . logger , this . fs . resolve ( basePath , packagePath ) ,
77
+ this . fs . resolve ( basePath , entryPointPath ) ) ;
76
78
if ( result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT ) {
77
79
throw new Error ( `The entry-point manifest at ${
78
80
manifestPath } contained an invalid pair of package paths: [${ packagePath } , ${
@@ -122,14 +124,27 @@ export class EntryPointManifest {
122
124
ngccVersion : NGCC_VERSION ,
123
125
configFileHash : this . config . hash ,
124
126
lockFileHash : lockFileHash ,
125
- entryPointPaths : entryPoints . map (
126
- e =>
127
- [ e . entryPoint . package ,
128
- e . entryPoint . path ,
129
- Array . from ( e . depInfo . dependencies ) ,
130
- Array . from ( e . depInfo . missing ) ,
131
- Array . from ( e . depInfo . deepImports ) ,
132
- ] ) ,
127
+ entryPointPaths : entryPoints . map ( e => {
128
+ const entryPointPaths : EntryPointPaths = [
129
+ this . fs . relative ( basePath , e . entryPoint . package ) ,
130
+ this . fs . relative ( basePath , e . entryPoint . path ) ,
131
+ ] ;
132
+ // Only add depInfo arrays if needed.
133
+ if ( e . depInfo . dependencies . size > 0 ) {
134
+ entryPointPaths [ 2 ] = Array . from ( e . depInfo . dependencies ) ;
135
+ } else if ( e . depInfo . missing . size > 0 || e . depInfo . deepImports . size > 0 ) {
136
+ entryPointPaths [ 2 ] = [ ] ;
137
+ }
138
+ if ( e . depInfo . missing . size > 0 ) {
139
+ entryPointPaths [ 3 ] = Array . from ( e . depInfo . missing ) ;
140
+ } else if ( e . depInfo . deepImports . size > 0 ) {
141
+ entryPointPaths [ 3 ] = [ ] ;
142
+ }
143
+ if ( e . depInfo . deepImports . size > 0 ) {
144
+ entryPointPaths [ 4 ] = Array . from ( e . depInfo . deepImports ) ;
145
+ }
146
+ return entryPointPaths ;
147
+ } ) ,
133
148
} ;
134
149
this . fs . writeFile ( this . getEntryPointManifestPath ( basePath ) , JSON . stringify ( manifest ) ) ;
135
150
}
@@ -156,24 +171,29 @@ export class EntryPointManifest {
156
171
* current manifest file.
157
172
*
158
173
* It always returns `null` from the `readEntryPointsUsingManifest()` method, which forces a new
159
- * manifest to be created, which will overwrite the current file when `writeEntryPointManifest()` is
160
- * called.
174
+ * manifest to be created, which will overwrite the current file when `writeEntryPointManifest()`
175
+ * is called.
161
176
*/
162
177
export class InvalidatingEntryPointManifest extends EntryPointManifest {
163
178
readEntryPointsUsingManifest ( _basePath : AbsoluteFsPath ) : EntryPointWithDependencies [ ] | null {
164
179
return null ;
165
180
}
166
181
}
167
182
183
+ export type EntryPointPaths = [
184
+ string ,
185
+ string ,
186
+ Array < AbsoluteFsPath > ?,
187
+ Array < AbsoluteFsPath | PathSegment > ?,
188
+ Array < AbsoluteFsPath > ?,
189
+ ] ;
190
+
168
191
/**
169
192
* The JSON format of the manifest file that is written to disk.
170
193
*/
171
194
export interface EntryPointManifestFile {
172
195
ngccVersion : string ;
173
196
configFileHash : string ;
174
197
lockFileHash : string ;
175
- entryPointPaths : Array < [
176
- AbsoluteFsPath , AbsoluteFsPath , AbsoluteFsPath [ ] , ( AbsoluteFsPath | PathSegment ) [ ] ,
177
- AbsoluteFsPath [ ]
178
- ] > ;
198
+ entryPointPaths : EntryPointPaths [ ] ;
179
199
}
0 commit comments