@@ -86,7 +86,7 @@ export interface RunPlatformResult {
86
86
/**
87
87
* Run resource generation for the given platform.
88
88
*/
89
- export async function run ( platform : Platform , resourcesDirectory : string , options : Readonly < RunPlatformOptions > , errstream ? : NodeJS . WritableStream ) : Promise < RunPlatformResult > {
89
+ export async function run ( platform : Platform , resourcesDirectory : string , options : Readonly < RunPlatformOptions > , errstream : NodeJS . WritableStream | null ) : Promise < RunPlatformResult > {
90
90
debug ( 'Running %s platform with options: %O' , platform , options ) ;
91
91
92
92
const resources : GeneratedResource [ ] = [ ] ;
@@ -124,7 +124,7 @@ export async function run(platform: Platform, resourcesDirectory: string, option
124
124
* If there are no options given for this resource or if the source images are
125
125
* not suitable, this function resolves with `undefined`.
126
126
*/
127
- export async function safelyGenerateSimpleResources ( type : ResourceType . ICON | ResourceType . SPLASH , platform : Platform , resourcesDirectory : string , options ? : Readonly < SimpleResourceOptions > , errstream ? : NodeJS . WritableStream ) : Promise < SimpleResourceResult | undefined > {
127
+ export async function safelyGenerateSimpleResources ( type : ResourceType . ICON | ResourceType . SPLASH , platform : Platform , resourcesDirectory : string , options : Readonly < SimpleResourceOptions > | undefined , errstream : NodeJS . WritableStream | null ) : Promise < SimpleResourceResult | undefined > {
128
128
if ( ! options ) {
129
129
return ;
130
130
}
@@ -149,7 +149,7 @@ export async function safelyGenerateSimpleResources(type: ResourceType.ICON | Re
149
149
* If there are no options given for this resource, this function resolves
150
150
* with `undefined`.
151
151
*/
152
- export async function generateSimpleResources ( type : ResourceType . ICON | ResourceType . SPLASH , platform : Platform , resourcesDirectory : string , options ? : Readonly < SimpleResourceOptions > , errstream ? : NodeJS . WritableStream ) : Promise < SimpleResourceResult | undefined > {
152
+ export async function generateSimpleResources ( type : ResourceType . ICON | ResourceType . SPLASH , platform : Platform , resourcesDirectory : string , options : Readonly < SimpleResourceOptions > | undefined , errstream : NodeJS . WritableStream | null ) : Promise < SimpleResourceResult | undefined > {
153
153
if ( ! options ) {
154
154
return ;
155
155
}
@@ -199,7 +199,7 @@ export function combineTransformFunctions(transformations: readonly TransformFun
199
199
* If there are no options given for this resource or if the platform or
200
200
* source images are not suitable, this function resolves with `undefined`.
201
201
*/
202
- export async function safelyGenerateAdaptiveIconResources ( platform : Platform , resourcesDirectory : string , options ? : Readonly < AdaptiveIconResourceOptions > , errstream ? : NodeJS . WritableStream ) : Promise < RunPlatformResult | undefined > {
202
+ export async function safelyGenerateAdaptiveIconResources ( platform : Platform , resourcesDirectory : string , options : Readonly < AdaptiveIconResourceOptions > | undefined , errstream : NodeJS . WritableStream | null ) : Promise < RunPlatformResult | undefined > {
203
203
if ( ! options || platform !== Platform . ANDROID ) {
204
204
return ;
205
205
}
@@ -218,7 +218,7 @@ export async function safelyGenerateAdaptiveIconResources(platform: Platform, re
218
218
/**
219
219
* Generate Android Adaptive Icons.
220
220
*/
221
- export async function generateAdaptiveIconResources ( resourcesDirectory : string , options : Readonly < AdaptiveIconResourceOptions > , errstream ? : NodeJS . WritableStream ) : Promise < RunPlatformResult > {
221
+ export async function generateAdaptiveIconResources ( resourcesDirectory : string , options : Readonly < AdaptiveIconResourceOptions > , errstream : NodeJS . WritableStream | null ) : Promise < RunPlatformResult > {
222
222
if ( options . foreground . sources . length === 0 || options . background . sources . length === 0 ) {
223
223
throw new BadInputError ( 'Adaptive icons require sources for both foreground and background.' ) ;
224
224
}
@@ -271,7 +271,7 @@ export async function consolidateAdaptiveIconResources(foregrounds: readonly Gen
271
271
/**
272
272
* Generate the foreground of Adaptive Icons.
273
273
*/
274
- export async function generateAdaptiveIconResourcesPortion ( resourcesDirectory : string , type : ResourceKey . FOREGROUND | ResourceKey . BACKGROUND , sources : readonly ( string | ImageSource ) [ ] , transform : TransformFunction = ( image , pipeline ) => pipeline , errstream ? : NodeJS . WritableStream ) : Promise < SimpleResourceResult > {
274
+ export async function generateAdaptiveIconResourcesPortion ( resourcesDirectory : string , type : ResourceKey . FOREGROUND | ResourceKey . BACKGROUND , sources : readonly ( string | ImageSource ) [ ] , transform : TransformFunction = ( image , pipeline ) => pipeline , errstream : NodeJS . WritableStream | null ) : Promise < SimpleResourceResult > {
275
275
const source = await resolveSourceImage ( Platform . ANDROID , ResourceType . ADAPTIVE_ICON , sources . map ( s => imageSourceToPath ( s ) ) , errstream ) ;
276
276
277
277
return {
@@ -280,7 +280,7 @@ export async function generateAdaptiveIconResourcesPortion(resourcesDirectory: s
280
280
} ;
281
281
}
282
282
283
- export async function generateAdaptiveIconResourcesPortionFromImageSource ( resourcesDirectory : string , type : ResourceKey . FOREGROUND | ResourceKey . BACKGROUND , source : ResolvedImageSource , transform : TransformFunction = ( image , pipeline ) => pipeline , errstream ? : NodeJS . WritableStream ) : Promise < GeneratedResource [ ] > {
283
+ export async function generateAdaptiveIconResourcesPortionFromImageSource ( resourcesDirectory : string , type : ResourceKey . FOREGROUND | ResourceKey . BACKGROUND , source : ResolvedImageSource , transform : TransformFunction = ( image , pipeline ) => pipeline , errstream : NodeJS . WritableStream | null ) : Promise < GeneratedResource [ ] > {
284
284
debug ( 'Using %O for %s source image for %s' , source . image . src , ResourceType . ADAPTIVE_ICON , Platform . ANDROID ) ;
285
285
286
286
const config = getResourcesConfig ( Platform . ANDROID , ResourceType . ADAPTIVE_ICON ) ;
@@ -302,7 +302,7 @@ export async function generateAdaptiveIconResourcesPortionFromImageSource(resour
302
302
return resources ;
303
303
}
304
304
305
- export async function generateImageResource ( type : ResourceType , platform : Platform , resourcesDirectory : string , config : ResourcesTypeConfig < ResourceKeyValues , ResourceKey > , image : ImageSourceData , schema : ResourceKeyValues & ImageSchema , transform : TransformFunction = ( image , pipeline ) => pipeline , errstream ? : NodeJS . WritableStream ) : Promise < GeneratedResource > {
305
+ export async function generateImageResource ( type : ResourceType , platform : Platform , resourcesDirectory : string , config : ResourcesTypeConfig < ResourceKeyValues , ResourceKey > , image : ImageSourceData , schema : ResourceKeyValues & ImageSchema , transform : TransformFunction = ( image , pipeline ) => pipeline , errstream : NodeJS . WritableStream | null ) : Promise < GeneratedResource > {
306
306
const { pipeline, metadata } = image ;
307
307
const { src, format, width, height } = schema ;
308
308
const { nodeName, nodeAttributes, indexAttribute, includedResources } = config . configXml ;
@@ -336,13 +336,13 @@ export function imageSourceToPath(source: string | ImageSource): string {
336
336
return typeof source === 'string' ? source : source . src ;
337
337
}
338
338
339
- export async function resolveSource ( platform : Platform , type : ResourceType , name : string , sources : readonly ( string | ImageSource | ColorSource ) [ ] , errstream ? : NodeJS . WritableStream ) : Promise < ResolvedSource > {
339
+ export async function resolveSource ( platform : Platform , type : ResourceType , name : string , sources : readonly ( string | ImageSource | ColorSource ) [ ] , errstream : NodeJS . WritableStream | null ) : Promise < ResolvedSource > {
340
340
for ( const source of sources ) {
341
341
if ( typeof source === 'string' || source . type === SourceType . RASTER ) {
342
342
const src = imageSourceToPath ( source ) ;
343
343
344
344
try {
345
- return await readSourceImage ( platform , type , src ) ;
345
+ return await readSourceImage ( platform , type , src , errstream ) ;
346
346
} catch ( e ) {
347
347
debugSourceImage ( src , e , errstream ) ;
348
348
}
0 commit comments