@@ -23,7 +23,7 @@ export default async function install(pkg: Package, logger?: Logger): Promise<In
2323 const tarball = useCache ( ) . path ( stowage )
2424 const shelf = tea_prefix . join ( pkg . project )
2525
26- logger ?. locking ( pkg )
26+ logger ?. locking ?. ( pkg )
2727 const { rid : fd } = await Deno . open ( shelf . mkdir ( 'p' ) . string )
2828 await flock ( fd , 'ex' )
2929
@@ -32,11 +32,11 @@ export default async function install(pkg: Package, logger?: Logger): Promise<In
3232 if ( already_installed ) {
3333 // some other tea instance installed us while we were waiting for the lock
3434 // or potentially we were already installed and the caller is naughty
35- logger ?. installed ( already_installed )
35+ logger ?. installed ?. ( already_installed )
3636 return already_installed
3737 }
3838
39- logger ?. downloading ( { pkg} )
39+ logger ?. downloading ?. ( { pkg} )
4040
4141 const tmpdir = Path . mktemp ( {
4242 dir : tea_prefix . join ( "local/tmp" ) . join ( pkg . project ) ,
@@ -58,13 +58,13 @@ export default async function install(pkg: Package, logger?: Logger): Promise<In
5858 src : url ,
5959 dst : tarball ,
6060 logger : info => {
61- logger ?. downloading ( { pkg, ...info } )
61+ logger ?. downloading ?. ( { pkg, ...info } )
6262 total ??= info . total
6363 }
6464 } , blob => {
6565 n += blob . length
6666 hasher . update ( blob )
67- logger ?. installing ( { pkg, progress : total ? n / total : total } )
67+ logger ?. installing ?. ( { pkg, progress : total ? n / total : total } )
6868 return writeAll ( untar . stdin , blob )
6969 } )
7070
@@ -89,14 +89,14 @@ export default async function install(pkg: Package, logger?: Logger): Promise<In
8989 const path = tmpdir . mv ( { to : shelf . join ( `v${ pkg . version } ` ) } )
9090 const install = { pkg, path }
9191
92- logger ?. installed ( install )
92+ logger ?. installed ?. ( install )
9393
9494 return install
9595 } catch ( err ) {
9696 tarball . rm ( ) //FIXME resumable downloads!
9797 throw err
9898 } finally {
99- logger ?. unlocking ( pkg )
99+ logger ?. unlocking ?. ( pkg )
100100 await flock ( fd , 'un' )
101101 Deno . close ( fd ) // docs aren't clear if we need to do this or not
102102 }
@@ -111,16 +111,16 @@ async function remote_SHA(url: URL) {
111111
112112
113113export interface Logger {
114- locking ( pkg : Package ) : void
114+ locking ? ( pkg : Package ) : void
115115 /// raw http info
116- downloading ( info : { pkg : Package , src ?: URL , dst ?: Path , rcvd ?: number , total ?: number } ) : void
116+ downloading ? ( info : { pkg : Package , src ?: URL , dst ?: Path , rcvd ?: number , total ?: number } ) : void
117117 /// we are simultaneously downloading and untarring the bottle
118118 /// the install progress here is proper and tied to download progress
119119 /// progress is a either a fraction between 0 and 1 or the number of bytes that have been untarred
120120 /// we try to give you the fraction as soon as possible, but you will need to deal with both formats
121- installing ( info : { pkg : Package , progress : number | undefined } ) : void
122- unlocking ( pkg : Package ) : void
123- installed ( installation : Installation ) : void
121+ installing ? ( info : { pkg : Package , progress : number | undefined } ) : void
122+ unlocking ? ( pkg : Package ) : void
123+ installed ? ( installation : Installation ) : void
124124}
125125
126126// deno-lint-ignore no-explicit-any
0 commit comments