Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugins): make rust plugin stage compatible with webpack #7942

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
88 changes: 44 additions & 44 deletions crates/node_binding/src/plugins/interceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ use rspack_plugin_javascript::{JavascriptModulesChunkHash, JavascriptModulesChun
#[napi(object)]
pub struct JsTap {
pub function: JsFunction,
pub stage: i32,
pub stage: f64,
}

pub struct ThreadsafeJsTap<T: 'static, R> {
pub function: ThreadsafeFunction<T, R>,
pub stage: i32,
pub stage: f64,
}

impl<T: 'static, R> Clone for ThreadsafeJsTap<T, R> {
Expand Down Expand Up @@ -242,7 +242,7 @@ macro_rules! define_register {
#[derive(Clone)]
struct $tap_name {
function: ThreadsafeFunction<$arg, $ret>,
stage: i32,
stage: f64,
}

impl $tap_name {
Expand Down Expand Up @@ -907,7 +907,7 @@ impl CompilerThisCompilation for CompilerThisCompilationTap {
self.function.call_with_sync(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -923,7 +923,7 @@ impl CompilerCompilation for CompilerCompilationTap {
self.function.call_with_sync(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -935,7 +935,7 @@ impl CompilerMake for CompilerMakeTap {
self.function.call_with_promise(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -947,7 +947,7 @@ impl CompilerFinishMake for CompilerFinishMakeTap {
self.function.call_with_promise(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -959,7 +959,7 @@ impl CompilerShouldEmit for CompilerShouldEmitTap {
self.function.call_with_sync(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -970,7 +970,7 @@ impl CompilerEmit for CompilerEmitTap {
self.function.call_with_promise(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -981,7 +981,7 @@ impl CompilerAfterEmit for CompilerAfterEmitTap {
self.function.call_with_promise(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1004,7 +1004,7 @@ impl CompilerAssetEmitted for CompilerAssetEmittedTap {
.await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1018,7 +1018,7 @@ impl CompilationBuildModule for CompilationBuildModuleTap {
.await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1032,7 +1032,7 @@ impl CompilationStillValidModule for CompilationStillValidModuleTap {
.await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1046,7 +1046,7 @@ impl CompilationSucceedModule for CompilationSucceedModuleTap {
.await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1068,7 +1068,7 @@ impl CompilationExecuteModule for CompilationExecuteModuleTap {
})
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1080,7 +1080,7 @@ impl CompilationFinishModules for CompilationFinishModulesTap {
self.function.call_with_promise(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1091,7 +1091,7 @@ impl CompilationOptimizeModules for CompilationOptimizeModulesTap {
self.function.call_with_sync(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1102,7 +1102,7 @@ impl CompilationAfterOptimizeModules for CompilationAfterOptimizeModulesTap {
self.function.call_with_sync(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1113,7 +1113,7 @@ impl CompilationOptimizeTree for CompilationOptimizeTreeTap {
self.function.call_with_promise(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1124,7 +1124,7 @@ impl CompilationOptimizeChunkModules for CompilationOptimizeChunkModulesTap {
self.function.call_with_promise(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1151,7 +1151,7 @@ impl CompilationAdditionalTreeRuntimeRequirements
Ok(())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand Down Expand Up @@ -1182,7 +1182,7 @@ impl CompilationRuntimeRequirementInTree for CompilationRuntimeRequirementInTree
Ok(None)
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand Down Expand Up @@ -1229,7 +1229,7 @@ impl CompilationRuntimeModule for CompilationRuntimeModuleTap {
Ok(())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1248,7 +1248,7 @@ impl CompilationChunkHash for CompilationChunkHashTap {
Ok(())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1265,7 +1265,7 @@ impl CompilationChunkAsset for CompilationChunkAssetTap {
.await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1277,7 +1277,7 @@ impl CompilationProcessAssets for CompilationProcessAssetsTap {
self.function.call_with_promise(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1289,7 +1289,7 @@ impl CompilationAfterProcessAssets for CompilationAfterProcessAssetsTap {
self.function.call_with_sync(compilation).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1300,7 +1300,7 @@ impl CompilationSeal for CompilationSealTap {
self.function.call_with_sync(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1311,7 +1311,7 @@ impl CompilationAfterSeal for CompilationAfterSealTap {
self.function.call_with_promise(()).await
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand Down Expand Up @@ -1344,7 +1344,7 @@ impl NormalModuleFactoryBeforeResolve for NormalModuleFactoryBeforeResolveTap {
}
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand Down Expand Up @@ -1381,7 +1381,7 @@ impl NormalModuleFactoryFactorize for NormalModuleFactoryFactorizeTap {
}
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand Down Expand Up @@ -1418,7 +1418,7 @@ impl NormalModuleFactoryResolve for NormalModuleFactoryResolveTap {
}
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1445,7 +1445,7 @@ impl NormalModuleFactoryResolveForScheme for NormalModuleFactoryResolveForScheme
Ok(bail)
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand Down Expand Up @@ -1520,7 +1520,7 @@ impl NormalModuleFactoryAfterResolve for NormalModuleFactoryAfterResolveTap {
}
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1545,7 +1545,7 @@ impl NormalModuleFactoryCreateModule for NormalModuleFactoryCreateModuleTap {
Ok(None)
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1568,7 +1568,7 @@ impl ContextModuleFactoryBeforeResolve for ContextModuleFactoryBeforeResolveTap
}
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1588,7 +1588,7 @@ impl ContextModuleFactoryAfterResolve for ContextModuleFactoryAfterResolveTap {
}
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1607,7 +1607,7 @@ impl JavascriptModulesChunkHash for JavascriptModulesChunkHashTap {
Ok(())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1625,7 +1625,7 @@ impl HtmlPluginBeforeAssetTagGeneration for HtmlPluginBeforeAssetTagGenerationTa
Ok(result.into())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1640,7 +1640,7 @@ impl HtmlPluginAlterAssetTags for HtmlPluginAlterAssetTagsTap {
Ok(result.into())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1658,7 +1658,7 @@ impl HtmlPluginAlterAssetTagGroups for HtmlPluginAlterAssetTagGroupsTap {
Ok(result.into())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1676,7 +1676,7 @@ impl HtmlPluginAfterTemplateExecution for HtmlPluginAfterTemplateExecutionTap {
Ok(result.into())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1691,7 +1691,7 @@ impl HtmlPluginBeforeEmit for HtmlPluginBeforeEmitTap {
Ok(result.into())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Expand All @@ -1706,7 +1706,7 @@ impl HtmlPluginAfterEmit for HtmlPluginAfterEmitTap {
Ok(result.into())
}

fn stage(&self) -> i32 {
fn stage(&self) -> f64 {
self.stage
}
}
Loading