@@ -79,7 +79,6 @@ export class Application implements ServerApplication {
7979 readonly importMap : ImportMap
8080 readonly ready : Promise < void >
8181
82- #dirs: Map < string , string > = new Map ( )
8382 #modules: Map < string , Module > = new Map ( )
8483 #pageRouting: Routing = new Routing ( { } )
8584 #apiRouting: Routing = new Routing ( { } )
@@ -122,7 +121,8 @@ export class Application implements ServerApplication {
122121
123122 // inject env variables
124123 Deno . env . set ( 'ALEPH_VERSION' , VERSION )
125- Deno . env . set ( 'BUILD_MODE' , this . mode )
124+ Deno . env . set ( 'ALEPH_BUILD_MODE' , this . mode )
125+ Deno . env . set ( 'ALEPH_FRAMEWORK' , this . framework )
126126
127127 // inject browser navigator polyfill
128128 Object . assign ( ( globalThis as any ) . navigator , {
@@ -195,12 +195,12 @@ export class Application implements ServerApplication {
195195 }
196196
197197 // init framework
198- const { init } = await import ( `../framework/${ this . config . framework } /init.ts` )
198+ const { init } = await import ( `../framework/${ this . framework } /init.ts` )
199199 await init ( this )
200200
201201 // import framework renderer
202202 if ( this . config . ssr ) {
203- const { jsFile } = await this . compile ( `${ alephPkgUri } /framework/${ this . config . framework } /renderer.ts` )
203+ const { jsFile } = await this . compile ( `${ alephPkgUri } /framework/${ this . framework } /renderer.ts` )
204204 const { render } = await import ( `file://${ jsFile } ` )
205205 if ( util . isFunction ( render ) ) {
206206 this . #renderer. setFrameworkRenderer ( { render } )
@@ -210,7 +210,7 @@ export class Application implements ServerApplication {
210210 log . info ( 'Compiling...' )
211211
212212 // pre-compile framework modules
213- await this . compile ( `${ alephPkgUri } /framework/${ this . config . framework } /bootstrap.ts` )
213+ await this . compile ( `${ alephPkgUri } /framework/${ this . framework } /bootstrap.ts` )
214214 if ( this . isDev ) {
215215 await this . compile ( `${ alephPkgUri } /framework/core/hmr.ts` )
216216 await this . compile ( `${ alephPkgUri } /framework/core/nomodule.ts` )
@@ -405,16 +405,20 @@ export class Application implements ServerApplication {
405405 return this . mode === 'development'
406406 }
407407
408+ get framework ( ) {
409+ return this . config . framework
410+ }
411+
408412 get srcDir ( ) {
409- return this . getDir ( 'src' , ( ) => join ( this . workingDir , this . config . srcDir ) )
413+ return join ( this . workingDir , this . config . srcDir )
410414 }
411415
412416 get outputDir ( ) {
413- return this . getDir ( 'output' , ( ) => join ( this . workingDir , this . config . outputDir ) )
417+ return join ( this . workingDir , this . config . outputDir )
414418 }
415419
416420 get buildDir ( ) {
417- return this . getDir ( 'build' , ( ) => join ( this . workingDir , '.aleph' , this . mode ) )
421+ return join ( this . workingDir , '.aleph' , this . mode )
418422 }
419423
420424 get loaders ( ) {
@@ -757,16 +761,6 @@ export class Application implements ServerApplication {
757761 log . info ( `Done in ${ Math . round ( performance . now ( ) - start ) } ms` )
758762 }
759763
760- private getDir ( name : string , init : ( ) => string ) {
761- if ( this . #dirs. has ( name ) ) {
762- return this . #dirs. get ( name ) !
763- }
764-
765- const dir = init ( )
766- this . #dirs. set ( name , dir )
767- return dir
768- }
769-
770764 private createRouteUpdate ( url : string ) : [ string , string , { isIndex ?: boolean , useDeno ?: boolean } ] {
771765 const isBuiltinModule = moduleExts . some ( ext => url . endsWith ( '.' + ext ) )
772766 let pagePath = isBuiltinModule ? toPagePath ( url ) : util . trimSuffix ( url , '/pages' )
@@ -1231,7 +1225,7 @@ export class Application implements ServerApplication {
12311225
12321226 // add framwork bootstrap module as shared entry
12331227 entryMods . set (
1234- [ `${ getAlephPkgUri ( ) } /framework/${ this . config . framework } /bootstrap.ts` ] ,
1228+ [ `${ getAlephPkgUri ( ) } /framework/${ this . framework } /bootstrap.ts` ] ,
12351229 true
12361230 )
12371231
0 commit comments