Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 171 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ async-trait = "0.1.83"
tokio = { version = "1.41.0", features = ["full"] }
anyhow = { version = "1.0.92" }
rustc-hash = { version = "1.1.0" }
tracing = { version = "0.1.40" }
tracing = { version = "0.1.40" }
once_cell = { version = "1.19.0" }
napi = { package = "napi-h", version = "=2.16.1" }
napi-build = { version = "2" }
13 changes: 7 additions & 6 deletions crates/demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ version = "0.1.0"
edition = "2021"

[dependencies]
rswebpack_error = { version = "0.1.0", path = "../rswebpack_error" }
rswebpack_macros = { version = "0.1.0", path = "../rswebpack_macros" }
rswebpack_hook = { version = "0.1.0", path = "../rswebpack_hook" }
rswebpack_core = { version = "0.1.0", path = "../rswebpack_core" }
tokio = {workspace = true}
tracing = { workspace = true}
rswebpack_error = { version = "0.1.0", path = "../rswebpack_error" }
rswebpack_macros = { version = "0.1.0", path = "../rswebpack_macros" }
rswebpack_hook = { version = "0.1.0", path = "../rswebpack_hook" }
rswebpack_binding = { version = "0.1.0", path = "../rswebpack_binding" }
rswebpack_core = { version = "0.1.0", path = "../rswebpack_core" }
tokio = {workspace = true}
tracing = { workspace = true}
10 changes: 8 additions & 2 deletions crates/demo/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@

use rswebpack_core::compiler::Compiler;
use rswebpack_core::config::{Config, Output};
use rswebpack_core::hooks::BeforeRun;
use rswebpack_core::hooks::{BeforeRun, BeforeRunHook};
use rswebpack_core::plugin::{ApplyContext, Plugin, PluginContext};
use rswebpack_error::Result;
use rswebpack_hook::{Hook, Interceptor};
use rswebpack_macros::{plugin, plugin_hook};

#[plugin]
struct BeforeRunHookTap;

#[plugin_hook(BeforeRun for BeforeRunHookTap)]
fn before_run(&self, compiler: &mut Compiler) -> Result<()> {
async fn before_run(&self, compiler: &mut Compiler) -> Result<()> {
println!("Root is {}", compiler.root);
Ok(())
}
Expand All @@ -19,6 +21,10 @@ struct TestPlugin;

impl Plugin for TestPlugin {
fn apply(&self, _ctx: PluginContext<&mut ApplyContext>) -> Result<()> {
// _ctx.context
// .compiler_hooks
// .before_run
// .intercept(RegisterBeforeRunTaps::new(RegisterBeforeRunTaps::, NonSkippableRegisters::default()));
_ctx.context
.compiler_hooks
.before_run
Expand Down
Loading