@@ -33,8 +33,8 @@ interface RenderResult {
33
33
body : string
34
34
}
35
35
36
- export interface AlephEnv {
37
- [ key : string ] : string
36
+ export interface AlephRuntime {
37
+ env : Record < string , string >
38
38
__version : string
39
39
__appRoot : string
40
40
__buildID : string
@@ -402,12 +402,12 @@ export default class Project {
402
402
}
403
403
404
404
Object . assign ( globalThis , {
405
- ALEPH_ENV : {
406
- ... this . config . env ,
405
+ ALEPH : {
406
+ env : this . config . env ,
407
407
__version : version ,
408
408
__appRoot : this . appRoot ,
409
409
__buildID : this . buildID ,
410
- } as AlephEnv ,
410
+ } as AlephRuntime ,
411
411
document : new Document ( ) ,
412
412
innerWidth : 1920 ,
413
413
innerHeight : 1080 ,
@@ -632,25 +632,25 @@ export default class Project {
632
632
} ) )
633
633
if ( this . #modules. has ( '/data.js' ) ) {
634
634
const { id, url, hash } = this . #modules. get ( '/data.js' ) !
635
- const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { url , hash } ) => ( { url , hash } ) )
635
+ const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { async , ... rest } ) => rest )
636
636
config . staticDataModule = { id, hash, asyncDeps }
637
637
deps . push ( { url, hash } )
638
638
}
639
639
if ( this . #modules. has ( '/app.js' ) ) {
640
640
const { id, url, hash } = this . #modules. get ( '/app.js' ) !
641
- const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { url , hash } ) => ( { url , hash } ) )
641
+ const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { async , ... rest } ) => rest )
642
642
config . customAppModule = { id, hash, asyncDeps }
643
643
deps . push ( { url, hash } )
644
644
}
645
645
if ( this . #modules. has ( '/404.js' ) ) {
646
646
const { id, url, hash } = this . #modules. get ( '/404.js' ) !
647
- const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { url , hash } ) => ( { url , hash } ) )
647
+ const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { async , ... rest } ) => rest )
648
648
config . custom404Module = { id : '/404.js' , hash, asyncDeps }
649
649
deps . push ( { url, hash } )
650
650
}
651
651
this . #pageModules. forEach ( ( { moduleID } , pagePath ) => {
652
652
const { id, url, hash } = this . #modules. get ( moduleID ) !
653
- const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { url , hash } ) => ( { url , hash } ) )
653
+ const asyncDeps = this . _lookupStyleDeps ( id ) . filter ( ( { async } ) => ! ! async ) . map ( ( { async , ... rest } ) => rest )
654
654
config . routing [ pagePath ] = { id, hash, asyncDeps }
655
655
deps . push ( { url, hash } )
656
656
} )
@@ -664,6 +664,13 @@ export default class Project {
664
664
module . jsFile = path . join ( this . buildDir , `main.${ module . hash . slice ( 0 , hashShort ) } .js` )
665
665
module . deps = deps
666
666
667
+ if ( this . #modules. has ( module . id ) ) {
668
+ const prevHash = this . #modules. get ( module . id ) ! . hash
669
+ try {
670
+ await Deno . remove ( path . join ( this . buildDir , `main.${ prevHash . slice ( 0 , hashShort ) } .js` ) )
671
+ } catch ( e ) { }
672
+ }
673
+
667
674
await Promise . all ( [
668
675
writeTextFile ( module . jsFile , module . jsContent ) ,
669
676
writeTextFile ( path . join ( this . buildDir , 'main.meta.json' ) , JSON . stringify ( {
@@ -940,6 +947,12 @@ export default class Project {
940
947
}
941
948
942
949
if ( fsync ) {
950
+ if ( mod . jsFile != "" ) {
951
+ try {
952
+ await Deno . remove ( mod . jsFile )
953
+ await Deno . remove ( mod . jsFile + '.map' )
954
+ } catch ( e ) { }
955
+ }
943
956
mod . jsFile = path . join ( saveDir , name + ( mod . isRemote ? '' : `.${ mod . hash . slice ( 0 , hashShort ) } ` ) ) + '.js'
944
957
await Promise . all ( [
945
958
writeTextFile ( metaFile , JSON . stringify ( {
0 commit comments