@@ -25,8 +25,8 @@ import { Analyzer } from './analyzer.ts'
25
25
import { cache } from './cache.ts'
26
26
import { defaultConfig , fixConfig , getDefaultImportMap , loadConfig , loadImportMap } from './config.ts'
27
27
import {
28
- checkDenoVersion , clearBuildCache , decoder , encoder , getAlephPkgUri ,
29
- getSourceType , isLocalhostUrl , loadPlugin , moduleExclude , toLocalPath , toRelativePath ,
28
+ checkDenoVersion , clearBuildCache , decoder , encoder , formatBytesWithColor , getAlephPkgUri ,
29
+ getSourceType , isLocalhostUrl , moduleExclude , toLocalPath , toRelativePath ,
30
30
} from './helper.ts'
31
31
import { getContentType } from './mime.ts'
32
32
import { buildHtml , Renderer } from './renderer.ts'
@@ -1534,26 +1534,35 @@ export class Aleph implements IAleph {
1534
1534
}
1535
1535
1536
1536
// render route pages
1537
+ let pageIndex = 0
1537
1538
const req = new Request ( 'http://localhost/' )
1538
1539
await Promise . all ( Array . from ( paths ) . map ( loc => ( [ loc , ...locales . map ( locale => ( { ...loc , pathname : '/' + locale + loc . pathname } ) ) ] ) ) . flat ( ) . map ( async ( { pathname, search } ) => {
1539
1540
if ( this . #isSSRable( pathname ) ) {
1540
1541
const [ router , nestedModules ] = this . #pageRouting. createRouter ( { pathname, search } )
1541
1542
if ( router . routePath !== '' ) {
1543
+ const ms = new Measure ( )
1542
1544
const href = router . toString ( )
1543
1545
const [ html , data ] = await this . #renderPage( req , router , nestedModules )
1544
- await ensureTextFile ( join ( outputDir , pathname , 'index.html' + ( search || '' ) ) , html )
1545
- if ( data ) {
1546
- const dataFile = join (
1547
- outputDir ,
1548
- `_aleph/data/${ util . btoaUrl ( href ) } .json`
1549
- )
1550
- await ensureTextFile ( dataFile , JSON . stringify ( data ) )
1546
+ await Promise . all ( [
1547
+ ensureTextFile ( join ( outputDir , pathname , 'index.html' + ( search || '' ) ) , html ) ,
1548
+ data ? ensureTextFile ( join ( outputDir , `_aleph/data/${ util . btoaUrl ( href ) } .json` ) , JSON . stringify ( data ) ) : Promise . resolve ( )
1549
+ ] )
1550
+ ms . stop ( `SSR ${ href } (${ formatBytesWithColor ( html . length ) } )` )
1551
+ if ( pageIndex == 0 ) {
1552
+ console . log ( '▲ SSG' )
1553
+ }
1554
+ if ( pageIndex <= 20 ) {
1555
+ console . log ( ' ' , href , dim ( '•' ) , formatBytesWithColor ( html . length ) )
1551
1556
}
1552
- log . debug ( 'SSR' , href , dim ( '• ' + util . formatBytes ( html . length ) ) )
1557
+ pageIndex ++
1553
1558
}
1554
1559
}
1555
1560
} ) )
1556
1561
1562
+ if ( pageIndex > 20 ) {
1563
+ console . log ( ` ... total ${ pageIndex } pages` )
1564
+ }
1565
+
1557
1566
// render 404 page
1558
1567
{
1559
1568
const [ router , nestedModules ] = this . #pageRouting. createRouter ( { pathname : '/404' } )
0 commit comments