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

refactor: merge binding crates into rspack_binding_values #8761

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pnpm-lock.yaml
/crates/node_binding
/crates/rspack_ast_viewer
/crates/rspack_base64
/crates/rspack_binding_options
/crates/rspack_core
/crates/rspack_core/src/compiler/make @jerrykingxyz
/crates/rspack_error
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ jobs:

- name: Run test
# reason for excluding https://github.com/napi-rs/napi-rs/issues/2200
run: cargo test --workspace --exclude rspack_binding_options --exclude rspack_node -- --nocapture
run: cargo test --workspace --exclude rspack_node -- --nocapture

rust_test_miri:
name: Rust test miri
Expand Down Expand Up @@ -350,7 +350,7 @@ jobs:
env:
MIRIFLAGS: -Zmiri-tree-borrows -Zmiri-disable-isolation
# reason for excluding https://github.com/napi-rs/napi-rs/issues/2200
run: cargo miri test --workspace --exclude rspack_binding_options --exclude rspack_node -- --nocapture
run: cargo miri test --workspace --exclude rspack_node -- --nocapture

run_rust_benchmark:
name: Run rust benchmark
Expand Down
29 changes: 4 additions & 25 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ rspack_allocator = { version = "0.2.0", path = "crates/rsp
rspack_ast = { version = "0.2.0", path = "crates/rspack_ast" }
rspack_base64 = { version = "0.2.0", path = "crates/rspack_base64" }
rspack_binding = { version = "0.2.0", path = "crates/rspack_binding" }
rspack_binding_options = { version = "0.2.0", path = "crates/rspack_binding_options" }
rspack_binding_values = { version = "0.2.0", path = "crates/rspack_binding_values" }
rspack_builtin = { version = "0.2.0", path = "crates/rspack_builtin" }
rspack_cacheable = { version = "0.2.0", path = "crates/rspack_cacheable" }
Expand Down
4 changes: 1 addition & 3 deletions crates/node_binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ version = "0.2.0"
crate-type = ["cdylib"]

[features]
default = []
plugin = ["rspack_binding_options/plugin"]
plugin = ["rspack_binding_values/plugin"]

[dependencies]
ropey = { workspace = true }
rspack_allocator = { workspace = true }
rspack_binding_options = { workspace = true }
rspack_binding_values = { workspace = true }
rspack_collections = { workspace = true }
rspack_core = { workspace = true }
Expand Down
4 changes: 1 addition & 3 deletions crates/node_binding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::sync::{Arc, Mutex};

use compiler::{Compiler, CompilerState, CompilerStateGuard};
use napi::bindgen_prelude::*;
use rspack_binding_options::BuiltinPlugin;
use rspack_core::{Compilation, PluginExt};
use rspack_error::Diagnostic;
use rspack_fs::IntermediateFileSystem;
Expand All @@ -25,7 +24,6 @@ mod resolver_factory;
pub use diagnostic::*;
use plugins::*;
use resolver_factory::*;
use rspack_binding_options::*;
use rspack_binding_values::*;
use rspack_tracing::chrome::FlushGuard;

Expand Down Expand Up @@ -84,7 +82,7 @@ impl Rspack {
compiler_path,
compiler_options,
plugins,
rspack_binding_options::buildtime_plugins::buildtime_plugins(),
rspack_binding_values::buildtime_plugins::buildtime_plugins(),
Some(Arc::new(NodeFileSystem::new(output_filesystem).map_err(
|e| Error::from_reason(format!("Failed to create writable filesystem: {e}",)),
)?)),
Expand Down
83 changes: 0 additions & 83 deletions crates/rspack_binding_options/Cargo.toml

This file was deleted.

22 changes: 0 additions & 22 deletions crates/rspack_binding_options/LICENSE

This file was deleted.

7 changes: 0 additions & 7 deletions crates/rspack_binding_options/src/lib.rs

This file was deleted.

95 changes: 79 additions & 16 deletions crates/rspack_binding_values/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,83 @@ license = "MIT"
name = "rspack_binding_values"
repository = "https://github.com/web-infra-dev/rspack"
version = "0.2.0"

[features]
plugin = ["rspack_loader_swc/plugin"]

[package.metadata.cargo-shear]
ignored = ["tracing"]

[dependencies]
cow-utils = { workspace = true }
futures = { workspace = true }
heck = { workspace = true }
napi = { workspace = true, features = ["async", "tokio_rt", "serde-json", "anyhow"] }
napi-derive = { workspace = true }
rspack_collections = { workspace = true }
rspack_core = { workspace = true }
rspack_error = { workspace = true }
rspack_napi = { workspace = true }
rspack_plugin_html = { workspace = true }
rspack_plugin_runtime = { workspace = true }
rspack_regex = { workspace = true }
rspack_util = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
async-trait = { workspace = true }
cow-utils = { workspace = true }
derive_more = { workspace = true, features = ["debug"] }
futures = { workspace = true }
glob = { workspace = true }
heck = { workspace = true }
napi = { workspace = true, features = ["async", "tokio_rt", "serde-json", "anyhow"] }
napi-derive = { workspace = true }
pollster = { workspace = true }
rspack_cacheable = { workspace = true }
rspack_collections = { workspace = true }
rspack_core = { workspace = true }
rspack_error = { workspace = true }
rspack_hook = { workspace = true }
rspack_ids = { workspace = true }
rspack_napi = { workspace = true }
rspack_napi_macros = { workspace = true }
rspack_paths = { workspace = true }
rspack_regex = { workspace = true }
rspack_util = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
swc_core = { workspace = true, default-features = false, features = ["ecma_transforms_react"] }
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros", "test-util", "parking_lot"] }
tracing = { workspace = true }


rspack_loader_lightningcss = { workspace = true }
rspack_loader_preact_refresh = { workspace = true }
rspack_loader_react_refresh = { workspace = true }
rspack_loader_runner = { workspace = true }
rspack_loader_swc = { workspace = true }
rspack_loader_testing = { workspace = true }
rspack_plugin_asset = { workspace = true }
rspack_plugin_banner = { workspace = true }
rspack_plugin_context_replacement = { workspace = true }
rspack_plugin_copy = { workspace = true }
rspack_plugin_css = { workspace = true }
rspack_plugin_devtool = { workspace = true }
rspack_plugin_dll = { workspace = true }
rspack_plugin_dynamic_entry = { workspace = true }
rspack_plugin_ensure_chunk_conditions = { workspace = true }
rspack_plugin_entry = { workspace = true }
rspack_plugin_externals = { workspace = true }
rspack_plugin_extract_css = { workspace = true }
rspack_plugin_hmr = { workspace = true }
rspack_plugin_html = { workspace = true }
rspack_plugin_ignore = { workspace = true }
rspack_plugin_javascript = { workspace = true }
rspack_plugin_json = { workspace = true }
rspack_plugin_lazy_compilation = { workspace = true }
rspack_plugin_library = { workspace = true }
rspack_plugin_lightning_css_minimizer = { workspace = true }
rspack_plugin_limit_chunk_count = { workspace = true }
rspack_plugin_merge_duplicate_chunks = { workspace = true }
rspack_plugin_mf = { workspace = true }
rspack_plugin_no_emit_on_errors = { workspace = true }
rspack_plugin_progress = { workspace = true }
rspack_plugin_real_content_hash = { workspace = true }
rspack_plugin_remove_duplicate_modules = { workspace = true }
rspack_plugin_remove_empty_chunks = { workspace = true }
rspack_plugin_runtime = { workspace = true }
rspack_plugin_runtime_chunk = { workspace = true }
rspack_plugin_schemes = { workspace = true }
rspack_plugin_size_limits = { workspace = true }
rspack_plugin_split_chunks = { workspace = true }
rspack_plugin_swc_js_minimizer = { workspace = true }
rspack_plugin_warn_sensitive_module = { workspace = true }
rspack_plugin_wasm = { workspace = true }
rspack_plugin_web_worker_template = { workspace = true }
rspack_plugin_worker = { workspace = true }
7 changes: 7 additions & 0 deletions crates/rspack_binding_values/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![feature(let_chains)]
#![feature(try_blocks)]

mod asset;
mod asset_condition;
mod chunk;
Expand All @@ -19,6 +21,8 @@ mod module_graph;
mod normal_module_factory;
mod options;
mod path_data;
mod plugins;
mod raw_options;
mod resolver;
mod resource_data;
mod rspack_error;
Expand Down Expand Up @@ -46,6 +50,9 @@ pub use module_graph::*;
pub use normal_module_factory::*;
pub use options::*;
pub use path_data::*;
pub use plugins::buildtime_plugins;
pub(crate) use plugins::*;
pub use raw_options::*;
pub use resolver::*;
pub use resource_data::*;
pub use rspack_error::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use std::collections::HashMap;

use napi::bindgen_prelude::*;
use napi_derive::napi;
use rspack_binding_values::{JsModuleWrapper, JsResourceData, JsRspackError};
use rspack_core::{LoaderContext, RunnerContext};
use rspack_error::error;
use rspack_loader_runner::{LoaderItem, State as LoaderState};
use rspack_napi::threadsafe_js_value_ref::ThreadsafeJsValueRef;

use crate::{JsModuleWrapper, JsResourceData, JsRspackError};

#[napi(object)]
pub struct JsLoaderItem {
pub request: String,
Expand Down
Loading
Loading