Skip to content

Commit 6c088be

Browse files
committed
chore: add logger in next flight client entry plugin
1 parent 623cfdf commit 6c088be

File tree

1 file changed

+16
-2
lines changed
  • crates/rspack_plugin_next_flight_client_entry/src

1 file changed

+16
-2
lines changed

crates/rspack_plugin_next_flight_client_entry/src/lib.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ use rspack_core::{
3232
rspack_sources::{RawSource, SourceExt},
3333
ApplyContext, AssetInfo, BoxDependency, ChunkGraph, Compilation, CompilationAsset,
3434
CompilationProcessAssets, CompilerAfterEmit, CompilerFinishMake, CompilerOptions, Dependency,
35-
DependencyId, EntryDependency, EntryOptions, Module, ModuleGraph, ModuleId, ModuleIdentifier,
36-
NormalModule, Plugin, PluginContext, RuntimeSpec,
35+
DependencyId, EntryDependency, EntryOptions, Logger, Module, ModuleGraph, ModuleId,
36+
ModuleIdentifier, NormalModule, Plugin, PluginContext, RuntimeSpec,
3737
};
3838
use rspack_error::Result;
3939
use rspack_hook::{plugin, plugin_hook};
@@ -1386,13 +1386,21 @@ impl FlightClientEntryPlugin {
13861386

13871387
#[plugin_hook(CompilerFinishMake for FlightClientEntryPlugin)]
13881388
async fn finish_make(&self, compilation: &mut Compilation) -> Result<()> {
1389+
let logger = compilation.get_logger("rspack.FlightClientEntryPlugin");
1390+
1391+
let start = logger.time("create client entries");
13891392
self.create_client_entries(compilation).await?;
1393+
logger.time_end(start);
1394+
13901395
Ok(())
13911396
}
13921397

13931398
// Next.js uses the after compile hook, but after emit should achieve the same result
13941399
#[plugin_hook(CompilerAfterEmit for FlightClientEntryPlugin)]
13951400
async fn after_emit(&self, compilation: &mut Compilation) -> Result<()> {
1401+
let logger = compilation.get_logger("rspack.FlightClientEntryPlugin");
1402+
1403+
let start = logger.time("after emit");
13961404
let state = {
13971405
let module_graph = compilation.get_module_graph();
13981406
let mut plugin_state = self.plugin_state.lock().unwrap();
@@ -1531,13 +1539,19 @@ async fn after_emit(&self, compilation: &mut Compilation) -> Result<()> {
15311539

15321540
let state_cb = self.state_cb.as_ref();
15331541
state_cb(state).await?;
1542+
logger.time_end(start);
15341543

15351544
Ok(())
15361545
}
15371546

15381547
#[plugin_hook(CompilationProcessAssets for FlightClientEntryPlugin, stage = Compilation::PROCESS_ASSETS_STAGE_OPTIMIZE_HASH)]
15391548
async fn process_assets(&self, compilation: &mut Compilation) -> Result<()> {
1549+
let logger = compilation.get_logger("rspack.FlightClientEntryPlugin");
1550+
1551+
let start = logger.time("process assets");
15401552
self.create_action_assets(compilation);
1553+
logger.time_end(start);
1554+
15411555
Ok(())
15421556
}
15431557

0 commit comments

Comments
 (0)