File tree Expand file tree Collapse file tree 3 files changed +50
-3
lines changed
Expand file tree Collapse file tree 3 files changed +50
-3
lines changed Original file line number Diff line number Diff line change 11import { filePathToRoutingPath } from "@/build/filepath-to-routing-path" ;
22import { get_user_pranx_config , load_user_pranx_config } from "@/config/index" ;
3+ import { log_routes_simple } from "@/log/log-routes-simple.js" ;
34import { logger } from "@/log/logger.js" ;
45import { measureTime } from "@/utils/time-perf" ;
56import fse from "fs-extra" ;
@@ -24,7 +25,6 @@ import {
2425 SITE_MANIFEST_OUTPUT_PATH ,
2526} from "../build/constants.js" ;
2627import { generate_html_template } from "../build/generate_html_template.js" ;
27- import { log_routes_tree } from "../log/log_routes_tree.js" ;
2828
2929export async function build ( ) {
3030 logger . log ( kleur . bold ( ) . magenta ( "Pranx Build\n" ) ) ;
@@ -335,7 +335,7 @@ export async function build() {
335335
336336 const BUILD_TIME = measureTime ( "build_measure_time" ) ;
337337
338- log_routes_tree ( server_site_manifest . routes ) ;
338+ log_routes_simple ( server_site_manifest . routes ) ;
339339
340340 logger . success ( `Project builded in ${ BUILD_TIME } ms\n` ) ;
341341}
Original file line number Diff line number Diff line change 1+ import kleur from "kleur" ;
2+ import type { ServerManifestRoute } from "types" ;
3+ import { logger } from "./logger" ;
4+
5+ type LogRouteKind = "static" | "static-dynamic" | "server-side" ;
6+
7+ const ICONS = {
8+ server : ( ) => kleur . yellow ( "λ" ) ,
9+ static : ( ) => kleur . white ( "○" ) ,
10+ staticDyn : ( ) => kleur . white ( "●" ) ,
11+ folder : ( ) => kleur . white ( "┬" ) ,
12+ } ;
13+
14+ const getKindIcon = ( kind : LogRouteKind ) =>
15+ kind === "server-side" ? ICONS . server ( ) : kind === "static" ? ICONS . static ( ) : ICONS . staticDyn ( ) ;
16+
17+ export function log_routes_simple ( input_routes : ServerManifestRoute [ ] ) {
18+ logger . log ( kleur . bold ( ) . blue ( ) . underline ( "Routes" ) ) ;
19+ logger . log ( "." ) ;
20+
21+ let index = 0 ;
22+ for ( const r of input_routes ) {
23+ if ( r . static_generated_routes . length > 0 ) {
24+ for ( const sr of r . static_generated_routes ) {
25+ logger . log ( `├─ ${ getKindIcon ( "static-dynamic" ) } ${ sr . path } ` ) ;
26+ }
27+ index ++ ;
28+ continue ;
29+ }
30+
31+ if ( index === input_routes . length - 1 ) {
32+ logger . log ( `└─ ${ getKindIcon ( r . rendering_kind ) } ${ r . path } ` ) ;
33+ continue ;
34+ }
35+ logger . log ( `├─ ${ getKindIcon ( r . rendering_kind ) } ${ r . path } ` ) ;
36+
37+ // "└─" : "├─";
38+ // "│ "
39+
40+ index ++ ;
41+ }
42+
43+ logger . log ( "" ) ;
44+ logger . log ( `${ ICONS . server ( ) } Server-side` ) ;
45+ logger . log ( `${ ICONS . static ( ) } Static` ) ;
46+ logger . log ( `${ ICONS . staticDyn ( ) } Static with dynamic params\n` ) ;
47+ }
Original file line number Diff line number Diff line change 1- /** biome-ignore-all lint/style/noNonNullAssertion: <explanation > */
1+ /** biome-ignore-all lint/style/noNonNullAssertion: <> */
22import kleur from "kleur" ;
33import type { ServerManifestRoute } from "types" ;
44import { logger } from "./logger" ;
You can’t perform that action at this time.
0 commit comments