@@ -260,6 +260,18 @@ export class Project {
260
260
return [ status , data ]
261
261
}
262
262
263
+ getPreloadScripts ( baseUrl : string ) {
264
+ const scripts = [
265
+ '-/deno.land/x/aleph/aleph.js' ,
266
+ '-/deno.land/x/aleph/context.js' ,
267
+ '-/deno.land/x/aleph/error.js' ,
268
+ '-/deno.land/x/aleph/events.js' ,
269
+ '-/deno.land/x/aleph/routing.js,' ,
270
+ '-/deno.land/x/aleph/util.js'
271
+ ]
272
+ return scripts . map ( src => ( { src : `${ baseUrl } ${ src } ` , type : 'module' , preload : true } ) )
273
+ }
274
+
263
275
async getPageHtml ( loc : { pathname : string , search ?: string } ) : Promise < [ number , string , Record < string , string > | null ] > {
264
276
if ( ! this . isSSRable ( loc . pathname ) ) {
265
277
const [ url ] = this . #routing. createRouter ( loc )
@@ -275,11 +287,7 @@ export class Project {
275
287
scripts : [
276
288
data ? { type : 'application/json' , innerText : JSON . stringify ( data ) , id : 'ssr-data' } : '' ,
277
289
{ src : util . cleanPath ( `${ baseUrl } /_aleph/main.${ mainModule . hash . slice ( 0 , hashShort ) } .js` ) , type : 'module' } ,
278
- { src : util . cleanPath ( `${ baseUrl } /_aleph/-/deno.land/x/aleph/nomodule.js${ this . isDev ? '?dev' : '' } ` ) , nomodule : true } ,
279
- { src : util . cleanPath ( `${ baseUrl } /_aleph/-/deno.land/x/aleph/error.js` ) , type : 'module' , preload : true } ,
280
- { src : util . cleanPath ( `${ baseUrl } /_aleph/-/deno.land/x/aleph/aleph.js` ) , type : 'module' , preload : true } ,
281
- { src : util . cleanPath ( `${ baseUrl } /_aleph/-/deno.land/x/aleph/context.js` ) , type : 'module' , preload : true } ,
282
- { src : util . cleanPath ( `${ baseUrl } /_aleph/-/deno.land/x/aleph/events.js` ) , type : 'module' , preload : true } ,
290
+ ...this . getPreloadScripts ( baseUrl ) ,
283
291
...scripts
284
292
] ,
285
293
body,
@@ -297,6 +305,7 @@ export class Project {
297
305
scripts : [
298
306
{ src : util . cleanPath ( `${ baseUrl } /_aleph/main.${ mainModule . hash . slice ( 0 , hashShort ) } .js` ) , type : 'module' } ,
299
307
{ src : util . cleanPath ( `${ baseUrl } /_aleph/-/deno.land/x/aleph/nomodule.js${ this . isDev ? '?dev' : '' } ` ) , nomodule : true } ,
308
+ ...this . getPreloadScripts ( baseUrl )
300
309
] ,
301
310
head : customLoading ?. head || [ ] ,
302
311
body : `<main>${ customLoading ?. body || '' } </main>` ,
@@ -383,6 +392,7 @@ export class Project {
383
392
data ? { type : 'application/json' , innerText : JSON . stringify ( data ) , id : 'ssr-data' } : '' ,
384
393
{ src : util . cleanPath ( `${ baseUrl } /_aleph/main.${ mainModule . hash . slice ( 0 , hashShort ) } .js` ) , type : 'module' } ,
385
394
{ src : util . cleanPath ( `${ baseUrl } /_aleph/-/deno.land/x/aleph/nomodule.js${ this . isDev ? '?dev' : '' } ` ) , nomodule : true } ,
395
+ ...this . getPreloadScripts ( baseUrl ) ,
386
396
...scripts
387
397
] ,
388
398
body,
0 commit comments