Skip to content

Commit da54db8

Browse files
committed
moved DependencyGraph into core with pub(crate)
1 parent ce353f6 commit da54db8

6 files changed

Lines changed: 14 additions & 16 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/wasm-pkg-common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ tokio = { workspace = true, optional = true, features = ["fs"] }
3131
toml = { workspace = true, optional = true }
3232
thiserror = { workspace = true }
3333
tracing.workspace = true
34-
petgraph.workspace = true
3534

3635
[dev-dependencies]
3736
tokio = { workspace = true, features = ["macros", "rt"] }

crates/wasm-pkg-common/src/registry.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use http::uri::Authority;
2-
use petgraph::{acyclic::Acyclic, graph::DiGraph};
32
use serde::{Deserialize, Serialize};
43

54
use crate::Error;
@@ -56,6 +55,3 @@ impl TryFrom<String> for Registry {
5655
Ok(Self(value.try_into()?))
5756
}
5857
}
59-
60-
/// Graph of publishable packages with the [`petgraph::Direction`] edges describing the dependency direction.
61-
pub type DependencyGraph<N> = Acyclic<DiGraph<N, petgraph::Direction>>;

crates/wasm-pkg-core/src/resolver.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ use std::{
1212
use anyhow::{bail, Context, Result};
1313
use futures_util::TryStreamExt;
1414
use indexmap::{IndexMap, IndexSet};
15-
use petgraph::{graph::NodeIndex, Direction};
15+
use petgraph::{
16+
acyclic::Acyclic,
17+
graph::{DiGraph, NodeIndex},
18+
Direction,
19+
};
1620
use semver::{Comparator, Op, Version, VersionReq};
1721
use tokio::io::{AsyncRead, AsyncReadExt};
1822
use wasm_pkg_client::{
1923
caching::{CachingClient, FileCache},
2024
Client, Config, ContentDigest, Error as WasmPkgError, PackageRef, Release, VersionInfo,
2125
};
22-
use wasm_pkg_common::{package::PackageSpec, registry::DependencyGraph};
26+
use wasm_pkg_common::package::PackageSpec;
2327
use wit_component::DecodedWasm;
2428
use wit_parser::{PackageId, PackageName, Resolve, UnresolvedPackageGroup, WorldId};
2529

@@ -840,6 +844,9 @@ fn visit<'a>(
840844
Ok(())
841845
}
842846

847+
/// Graph of publishable packages with the [`petgraph::Direction`] edges describing the dependency direction.
848+
pub(crate) type DependencyGraph<N> = Acyclic<DiGraph<N, petgraph::Direction>>;
849+
843850
/// Mapping of [`PackageRef`]s to the respective index inside the dependency graph.
844851
pub type LocalPackageIndex = HashMap<PackageRef, (NodeIndex, PathBuf)>;
845852

crates/wasm-pkg-core/src/wit.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ use wasm_pkg_client::{
1414
caching::{CachingClient, FileCache},
1515
PackageRef,
1616
};
17-
use wasm_pkg_common::{package::PackageSpec, registry::DependencyGraph};
17+
use wasm_pkg_common::package::PackageSpec;
1818
use wit_component::WitPrinter;
1919
use wit_parser::{PackageId, PackageName, Resolve};
2020

2121
use crate::{
2222
config::Config,
2323
lock::LockFile,
2424
resolver::{
25-
DecodedDependency, Dependency, DependencyResolution, DependencyResolutionMap,
26-
DependencyResolver, LocalPackageIndex, LocalResolution, RegistryPackage,
25+
DecodedDependency, Dependency, DependencyGraph, DependencyResolution,
26+
DependencyResolutionMap, DependencyResolver, LocalPackageIndex, LocalResolution,
27+
RegistryPackage,
2728
},
2829
};
2930

crates/wkg/tests/e2e.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,7 @@ async fn publish_multiple_transitive_local_packages() {
100100
// copy the transitive-local fixtures from wasm-pkg-core into a temp dir
101101
let temp_dir = tempfile::tempdir().expect("Failed to create tempdir");
102102
let src_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
103-
.join("..")
104-
.join("wasm-pkg-core")
105-
.join("tests")
106-
.join("fixtures")
107-
.join("transitive-local");
103+
.join("../wasm-pkg-core/tests/fixtures/transitive-local");
108104
let fixture_root = temp_dir.path().join("transitive-local");
109105
copy_dir(&src_root, &fixture_root).await.unwrap();
110106

0 commit comments

Comments
 (0)