File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55//! - `VITE_LOG_OUTPUT`: Output format — `"chrome-json"` for Chrome DevTools timeline,
66//! `"readable"` for pretty-printed output, or default stdout.
77
8- use std:: any:: Any ;
9- use std:: sync:: atomic:: AtomicBool ;
8+ use std:: { any:: Any , sync:: atomic:: AtomicBool } ;
109
1110use tracing_chrome:: ChromeLayerBuilder ;
1211use tracing_subscriber:: {
@@ -44,19 +43,16 @@ pub fn init_tracing() -> Option<Box<dyn Any + Send>> {
4443 . with_targets ( [ ( "tokenize" , LevelFilter :: OFF ) , ( "parse" , LevelFilter :: OFF ) ] )
4544 } ;
4645
47- let output_mode = std :: env :: var ( env_vars :: VITE_LOG_OUTPUT )
48- . unwrap_or_else ( |_| "stdout" . to_string ( ) ) ;
46+ let output_mode =
47+ std :: env :: var ( env_vars :: VITE_LOG_OUTPUT ) . unwrap_or_else ( |_| "stdout" . to_string ( ) ) ;
4948
5049 match output_mode. as_str ( ) {
5150 "chrome-json" => {
5251 let ( chrome_layer, guard) = ChromeLayerBuilder :: new ( )
5352 . trace_style ( tracing_chrome:: TraceStyle :: Async )
5453 . include_args ( true )
5554 . build ( ) ;
56- tracing_subscriber:: registry ( )
57- . with ( targets)
58- . with ( chrome_layer)
59- . init ( ) ;
55+ tracing_subscriber:: registry ( ) . with ( targets) . with ( chrome_layer) . init ( ) ;
6056 Some ( Box :: new ( guard) )
6157 }
6258 "readable" => {
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ fn create_vite_config_resolver(
9898 Arc :: new ( move |package_path : String | {
9999 let tsf = tsf. clone ( ) ;
100100 Box :: pin ( async move {
101- let _span = tracing:: debug_span !( "js_resolve_vite_config" ) . entered ( ) ;
101+ tracing:: debug !( "js_resolve_vite_config: start" ) ;
102102 let promise: Promise < String > = tsf
103103 . call_async ( Ok ( package_path) )
104104 . await
@@ -120,7 +120,7 @@ fn create_vite_config_resolver(
120120/// and process JavaScript callbacks (via ThreadsafeFunction).
121121#[ napi]
122122pub async fn run ( options : CliOptions ) -> Result < i32 > {
123- let _span = tracing:: debug_span !( "napi_run" ) . entered ( ) ;
123+ tracing:: debug !( "napi_run: start" ) ;
124124 // Use provided cwd or current directory
125125 let mut cwd = current_dir ( ) ?;
126126 if let Some ( options_cwd) = options. cwd {
Original file line number Diff line number Diff line change @@ -46,8 +46,10 @@ if (command === 'create') {
4646} else {
4747 // All other commands — delegate to Rust core via NAPI binding
4848 if ( process . env . VITE_LOG ) {
49+ const processUptime = ( process . uptime ( ) * 1000 ) . toFixed ( 2 ) ;
50+ const jsModuleLoad = ( performance . now ( ) - jsStartTime ) . toFixed ( 2 ) ;
4951 console . log (
50- `[vite-plus] JS startup : ${ ( performance . now ( ) - jsStartTime ) . toFixed ( 2 ) } ms` ,
52+ `[vite-plus] process uptime : ${ processUptime } ms, JS module load: ${ jsModuleLoad } ms` ,
5153 ) ;
5254 }
5355 run ( {
You can’t perform that action at this time.
0 commit comments