Skip to content

Commit

Permalink
Add target request
Browse files Browse the repository at this point in the history
  • Loading branch information
MonicaOlejniczak committed Jun 20, 2024
1 parent bfd336a commit 2e49b4e
Show file tree
Hide file tree
Showing 22 changed files with 1,452 additions and 152 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions crates/parcel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ parcel-resolver = { path = "../../packages/utils/node-resolver-rs" }
anyhow = "1.0.82"
dyn-hash = "0.x"
petgraph = "0.x"
serde = { version = "1.0.200", features = ["derive"] }
serde-bool = "0.1.3"
serde_json = "1.0.116"
xxhash-rust = { version = "0.8.2", features = ["xxh3"] }
num_cpus = "1.16.0"
12 changes: 6 additions & 6 deletions crates/parcel/src/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ mod tests {
use std::sync::Arc;

use parcel_config::parcel_config_fixtures::default_config;
use parcel_core::plugin::PluginConfig;
use parcel_core::config_loader::ConfigLoader;
use parcel_core::plugin::PluginLogger;
use parcel_core::plugin::PluginOptions;
use parcel_filesystem::in_memory_file_system::InMemoryFileSystem;
Expand All @@ -230,11 +230,11 @@ mod tests {

fn make_test_plugin_context() -> PluginContext {
PluginContext {
config: PluginConfig::new(
Arc::new(InMemoryFileSystem::default()),
PathBuf::default(),
PathBuf::default(),
),
config: ConfigLoader {
fs: Arc::new(InMemoryFileSystem::default()),
project_root: PathBuf::default(),
search_path: PathBuf::default(),
},
options: Arc::new(PluginOptions::default()),
logger: PluginLogger::default(),
}
Expand Down
3 changes: 1 addition & 2 deletions crates/parcel/src/request_tracker/request.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::fmt::Debug;
use std::hash::DefaultHasher;
use std::hash::Hash;
use std::hash::Hasher;

Expand Down Expand Up @@ -46,7 +45,7 @@ pub type RunRequestError = anyhow::Error;

pub trait Request<T: Clone>: DynHash {
fn id(&self) -> u64 {
let mut hasher = DefaultHasher::default();
let mut hasher = parcel_core::hash::IdentifierHasher::default();
std::any::type_name::<Self>().hash(&mut hasher);
self.dyn_hash(&mut hasher);
hasher.finish()
Expand Down
1 change: 1 addition & 0 deletions crates/parcel/src/requests.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
mod asset_request;
mod path_request;
mod target_request;
13 changes: 1 addition & 12 deletions crates/parcel/src/requests/path_request.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::hash::Hash;
use std::hash::Hasher;
use std::path::PathBuf;
use std::sync::Arc;

Expand Down Expand Up @@ -42,16 +41,6 @@ pub enum PathResolution {

// TODO tracing, dev deps
impl Request<PathResolution> for PathRequest {
fn id(&self) -> u64 {
let mut hasher = parcel_core::hash::IdentifierHasher::default();

self.dependency.hash(&mut hasher);
self.named_pipelines.hash(&mut hasher);
self.resolvers.hash(&mut hasher);

hasher.finish()
}

fn run(
&self,
request_context: RunRequestContext<PathResolution>,
Expand Down Expand Up @@ -190,7 +179,7 @@ mod tests {
}

impl Hash for ResolvedResolverPlugin {
fn hash<H: Hasher>(&self, _state: &mut H) {}
fn hash<H: std::hash::Hasher>(&self, _state: &mut H) {}
}

impl ResolverPlugin for ResolvedResolverPlugin {
Expand Down
Loading

0 comments on commit 2e49b4e

Please sign in to comment.