Skip to content

Commit a5a651e

Browse files
branchseerclaude
andcommitted
fix: resolve Send bounds and formatting issues
- Use tracing::debug! events instead of spans in Send-required contexts (NAPI run function and vite config resolver) - Fix cargo fmt formatting in tracing.rs - Add process.uptime() to JS startup timing for absolute timeline Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b241e19 commit a5a651e

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

crates/vite_shared/src/tracing.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
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

1110
use tracing_chrome::ChromeLayerBuilder;
1211
use 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" => {

packages/cli/binding/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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]
122122
pub 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 {

packages/cli/src/bin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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({

0 commit comments

Comments
 (0)