diff --git a/packages/yew-macro/Cargo.toml b/packages/yew-macro/Cargo.toml
index 85fb249eff4..45aa3a314a1 100644
--- a/packages/yew-macro/Cargo.toml
+++ b/packages/yew-macro/Cargo.toml
@@ -34,5 +34,4 @@ yew = { path = "../yew" }
[build-dependencies]
[features]
-doc_test = []
lints = []
diff --git a/packages/yew-router/Cargo.toml b/packages/yew-router/Cargo.toml
index 739f58f53e5..200f02e2d01 100644
--- a/packages/yew-router/Cargo.toml
+++ b/packages/yew-router/Cargo.toml
@@ -11,9 +11,6 @@ description = "A router implementation for the Yew framework"
repository = "https://github.com/yewstack/yew"
rust-version = "1.56.0"
-[features]
-wasm_test = []
-
[dependencies]
yew = { version = "0.19.3", path = "../yew", default-features= false }
yew-router-macro = { version = "0.16.0", path = "../yew-router-macro" }
diff --git a/packages/yew/Cargo.toml b/packages/yew/Cargo.toml
index f7f4705cca9..491a44695dd 100644
--- a/packages/yew/Cargo.toml
+++ b/packages/yew/Cargo.toml
@@ -87,17 +87,16 @@ features = [
]
[features]
-ssr = ["futures", "html-escape"]
+# TODO: `dep:` syntax only supported with MSRV 1.60, would be more precise
+# tokio = ["dep:tokio"]
+ssr = ["futures", "html-escape"] # dep:html-escape
csr = []
hydration = ["csr"]
-trace_hydration = ["hydration"]
-doc_test = ["csr", "hydration", "ssr"]
-wasm_test = ["csr", "hydration", "ssr"]
default = []
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { version = "1.15.0", features = ["full"] }
[package.metadata.docs.rs]
-features = ["doc_test"]
+all-features = true
rustdoc-args = ["--cfg", "documenting"]
diff --git a/packages/yew/Makefile.toml b/packages/yew/Makefile.toml
index 6dc84597086..02cf9062616 100644
--- a/packages/yew/Makefile.toml
+++ b/packages/yew/Makefile.toml
@@ -10,7 +10,7 @@ args = [
"--headless",
"--",
"--features",
- "wasm_test"
+ "csr,hydration,ssr",
]
[tasks.ssr-test]
@@ -18,6 +18,7 @@ command = "cargo"
args = ["test", "ssr_tests", "--features", "ssr"]
[tasks.test]
+args = ["test", "--all-targets", "--all-features"]
dependencies = ["native-test", "wasm-test"]
[tasks.clippy-feature-soundness]
diff --git a/packages/yew/src/app_handle.rs b/packages/yew/src/app_handle.rs
index de429705b06..1ed40396c0b 100644
--- a/packages/yew/src/app_handle.rs
+++ b/packages/yew/src/app_handle.rs
@@ -9,8 +9,8 @@ use crate::dom_bundle::BSubtree;
use crate::html::{BaseComponent, NodeRef, Scope, Scoped};
/// An instance of an application.
-#[derive(Debug)]
#[cfg_attr(documenting, doc(cfg(feature = "csr")))]
+#[derive(Debug)]
pub struct AppHandle
{
/// `Scope` holder
pub(crate) scope: Scope,
diff --git a/packages/yew/src/dom_bundle/bcomp.rs b/packages/yew/src/dom_bundle/bcomp.rs
index b1f4502a306..fb7dec3ba97 100644
--- a/packages/yew/src/dom_bundle/bcomp.rs
+++ b/packages/yew/src/dom_bundle/bcomp.rs
@@ -176,7 +176,7 @@ mod feat_hydration {
}
}
-#[cfg(feature = "wasm_test")]
+#[cfg(target_arch = "wasm32")]
#[cfg(test)]
mod tests {
use std::ops::Deref;
@@ -481,7 +481,7 @@ mod tests {
}
}
-#[cfg(feature = "wasm_test")]
+#[cfg(target_arch = "wasm32")]
#[cfg(test)]
mod layout_tests {
extern crate self as yew;
diff --git a/packages/yew/src/dom_bundle/blist.rs b/packages/yew/src/dom_bundle/blist.rs
index 721c5423168..1d41e5dd0a2 100644
--- a/packages/yew/src/dom_bundle/blist.rs
+++ b/packages/yew/src/dom_bundle/blist.rs
@@ -504,11 +504,11 @@ mod feat_hydration {
}
}
-#[cfg(all(test, feature = "wasm_test"))]
+#[cfg(target_arch = "wasm32")]
+#[cfg(test)]
mod layout_tests {
extern crate self as yew;
- #[cfg(feature = "wasm_test")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use crate::html;
@@ -581,11 +581,11 @@ mod layout_tests {
}
}
-#[cfg(all(test, feature = "wasm_test"))]
+#[cfg(target_arch = "wasm32")]
+#[cfg(test)]
mod layout_tests_keys {
extern crate self as yew;
- #[cfg(feature = "wasm_test")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use web_sys::Node;
diff --git a/packages/yew/src/dom_bundle/bnode.rs b/packages/yew/src/dom_bundle/bnode.rs
index c5bdd950694..104e803a494 100644
--- a/packages/yew/src/dom_bundle/bnode.rs
+++ b/packages/yew/src/dom_bundle/bnode.rs
@@ -291,9 +291,9 @@ mod feat_hydration {
}
}
-#[cfg(all(test, feature = "wasm_test"))]
+#[cfg(target_arch = "wasm32")]
+#[cfg(test)]
mod layout_tests {
- #[cfg(feature = "wasm_test")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use super::*;
diff --git a/packages/yew/src/dom_bundle/bportal.rs b/packages/yew/src/dom_bundle/bportal.rs
index 1e53d87371d..669ff6ad2af 100644
--- a/packages/yew/src/dom_bundle/bportal.rs
+++ b/packages/yew/src/dom_bundle/bportal.rs
@@ -118,11 +118,11 @@ impl BPortal {
}
}
-#[cfg(all(test, feature = "wasm_test"))]
+#[cfg(target_arch = "wasm32")]
+#[cfg(test)]
mod layout_tests {
extern crate self as yew;
- #[cfg(feature = "wasm_test")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use yew::virtual_dom::VPortal;
diff --git a/packages/yew/src/dom_bundle/btag/listeners.rs b/packages/yew/src/dom_bundle/btag/listeners.rs
index 1d6dd283a86..55d708af39b 100644
--- a/packages/yew/src/dom_bundle/btag/listeners.rs
+++ b/packages/yew/src/dom_bundle/btag/listeners.rs
@@ -196,7 +196,7 @@ impl Registry {
}
}
-#[cfg(feature = "wasm_test")]
+#[cfg(target_arch = "wasm32")]
#[cfg(test)]
mod tests {
use std::marker::PhantomData;
diff --git a/packages/yew/src/dom_bundle/btag/mod.rs b/packages/yew/src/dom_bundle/btag/mod.rs
index 9645123029f..d96bb364aeb 100644
--- a/packages/yew/src/dom_bundle/btag/mod.rs
+++ b/packages/yew/src/dom_bundle/btag/mod.rs
@@ -265,13 +265,13 @@ impl BTag {
self.key.as_ref()
}
- #[cfg(feature = "wasm_test")]
+ #[cfg(target_arch = "wasm32")]
#[cfg(test)]
fn reference(&self) -> &Element {
&self.reference
}
- #[cfg(feature = "wasm_test")]
+ #[cfg(target_arch = "wasm32")]
#[cfg(test)]
fn children(&self) -> &[BNode] {
match &self.inner {
@@ -280,7 +280,7 @@ impl BTag {
}
}
- #[cfg(feature = "wasm_test")]
+ #[cfg(target_arch = "wasm32")]
#[cfg(test)]
fn tag(&self) -> &str {
match &self.inner {
@@ -383,7 +383,7 @@ mod feat_hydration {
}
}
-#[cfg(feature = "wasm_test")]
+#[cfg(target_arch = "wasm32")]
#[cfg(test)]
mod tests {
use gloo_utils::document;
@@ -975,11 +975,11 @@ mod tests {
}
}
-#[cfg(all(test, feature = "wasm_test"))]
+#[cfg(target_arch = "wasm32")]
+#[cfg(test)]
mod layout_tests {
extern crate self as yew;
- #[cfg(feature = "wasm_test")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use crate::html;
diff --git a/packages/yew/src/dom_bundle/btext.rs b/packages/yew/src/dom_bundle/btext.rs
index 73b7d6230cc..7e6e0f1a908 100644
--- a/packages/yew/src/dom_bundle/btext.rs
+++ b/packages/yew/src/dom_bundle/btext.rs
@@ -157,12 +157,12 @@ mod feat_hydration {
mod test {
extern crate self as yew;
- #[cfg(feature = "wasm_test")]
+ #[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use crate::html;
- #[cfg(feature = "wasm_test")]
+ #[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser);
#[test]
@@ -177,11 +177,11 @@ mod test {
}
}
-#[cfg(all(test, feature = "wasm_test"))]
+#[cfg(target_arch = "wasm32")]
+#[cfg(test)]
mod layout_tests {
extern crate self as yew;
- #[cfg(feature = "wasm_test")]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use crate::html;
diff --git a/packages/yew/src/dom_bundle/fragment.rs b/packages/yew/src/dom_bundle/fragment.rs
index 6055ecab570..ccc9037044f 100644
--- a/packages/yew/src/dom_bundle/fragment.rs
+++ b/packages/yew/src/dom_bundle/fragment.rs
@@ -3,13 +3,13 @@ use std::ops::{Deref, DerefMut};
use web_sys::{Element, Node};
-use super::BSubtree;
+use crate::dom_bundle::BSubtree;
use crate::html::NodeRef;
use crate::virtual_dom::Collectable;
/// A Hydration Fragment
#[derive(Default, Debug, Clone, PartialEq, Eq)]
-pub(crate) struct Fragment(VecDeque);
+pub struct Fragment(VecDeque);
impl Deref for Fragment {
type Target = VecDeque;
diff --git a/packages/yew/src/dom_bundle/mod.rs b/packages/yew/src/dom_bundle/mod.rs
index aff317c277f..a8cac1c900d 100644
--- a/packages/yew/src/dom_bundle/mod.rs
+++ b/packages/yew/src/dom_bundle/mod.rs
@@ -19,9 +19,6 @@ mod btag;
mod btext;
mod subtree_root;
-#[cfg(feature = "hydration")]
-mod fragment;
-
mod traits;
mod utils;
@@ -32,16 +29,9 @@ use bportal::BPortal;
use bsuspense::BSuspense;
use btag::{BTag, Registry};
use btext::BText;
-#[cfg(feature = "hydration")]
-pub(crate) use fragment::Fragment;
-pub use subtree_root::set_event_bubbling;
-pub(crate) use subtree_root::BSubtree;
use subtree_root::EventDescriptor;
-#[cfg(feature = "hydration")]
-use traits::Hydratable;
+pub use subtree_root::{set_event_bubbling, BSubtree};
use traits::{Reconcilable, ReconcileTarget};
-#[cfg(feature = "hydration")]
-use utils::node_type_str;
use utils::{insert_node, test_log};
/// A Bundle.
@@ -84,9 +74,15 @@ impl Bundle {
}
#[cfg(feature = "hydration")]
+#[path = "."]
mod feat_hydration {
- use super::*;
+ pub(super) use super::traits::Hydratable;
+ pub(super) use super::utils::node_type_str;
+ #[path = "./fragment.rs"]
+ mod fragment;
+ pub use fragment::Fragment;
+ use super::*;
impl Bundle {
/// Creates a bundle by hydrating a virtual dom layout.
pub fn hydrate(
@@ -101,3 +97,5 @@ mod feat_hydration {
}
}
}
+#[cfg(feature = "hydration")]
+pub(crate) use feat_hydration::*;
diff --git a/packages/yew/src/dom_bundle/utils.rs b/packages/yew/src/dom_bundle/utils.rs
index 8f0eb44f79e..f4973dad37a 100644
--- a/packages/yew/src/dom_bundle/utils.rs
+++ b/packages/yew/src/dom_bundle/utils.rs
@@ -13,13 +13,13 @@ pub(super) fn insert_node(node: &Node, parent: &Element, next_sibling: Option<&N
};
}
-#[cfg(all(test, feature = "wasm_test", verbose_tests))]
+#[cfg(all(test, target_arch = "wasm32", verbose_tests))]
macro_rules! test_log {
($fmt:literal, $($arg:expr),* $(,)?) => {
::wasm_bindgen_test::console_log!(concat!("\t ", $fmt), $($arg),*);
};
}
-#[cfg(not(all(test, feature = "wasm_test", verbose_tests)))]
+#[cfg(not(all(test, target_arch = "wasm32", verbose_tests)))]
macro_rules! test_log {
($fmt:literal, $($arg:expr),* $(,)?) => {
// Only type-check the format expression, do not run any side effects
diff --git a/packages/yew/src/html/component/lifecycle.rs b/packages/yew/src/html/component/lifecycle.rs
index 517c123d341..991b4cc28dc 100644
--- a/packages/yew/src/html/component/lifecycle.rs
+++ b/packages/yew/src/html/component/lifecycle.rs
@@ -400,8 +400,6 @@ impl Runnable for UpdateRunner {
pub(crate) struct DestroyRunner {
pub state: Shared