Skip to content
Open
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
2 changes: 1 addition & 1 deletion examples/directives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ log = "0.4.22"
console_log = "1.0"
console_error_panic_hook = "0.1.7"
web-sys = { version = "0.3.70", features = ["Clipboard", "Navigator"] }
wasm-bindgen = "0.2.93"

[dev-dependencies]
wasm-bindgen-test = "0.3.42"
wasm-bindgen = "0.2.93"
web-sys = { version = "0.3.70", features = ["NodeList"] }
2 changes: 1 addition & 1 deletion examples/directives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl From<()> for Amount {
}

pub fn add_dot(el: Element, amount: Amount) {
use leptos::wasm_bindgen::JsCast;
use wasm_bindgen::JsCast;
let el = el.unchecked_into::<web_sys::HtmlElement>();

let handle = el.clone().on(click, move |_| {
Expand Down
2 changes: 1 addition & 1 deletion examples/js-framework-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ leptos = { path = "../../leptos", features = ["csr"] } # for actual benchmarking
getrandom = { version = "0.2.15", features = ["js"] }
rand = { version = "0.8.5", features = ["small_rng"] }
console_error_panic_hook = "0.1.7"
wasm-bindgen = "0.2"

[dev-dependencies]
wasm-bindgen = "0.2"
wasm-bindgen-test = "0.3.42"
web-sys = "0.3"
5 changes: 2 additions & 3 deletions examples/js-framework-benchmark/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use js_framework_benchmark_leptos::App;
use leptos::{
leptos_dom::helpers::document, mount::mount_to, wasm_bindgen::JsCast,
};
use leptos::{leptos_dom::helpers::document, mount::mount_to};
use wasm_bindgen::JsCast;

pub fn main() {
console_error_panic_hook::set_once();
Expand Down
29 changes: 16 additions & 13 deletions leptos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,20 @@ pub mod task {
};
}

// these reexports are used in islands
#[cfg(feature = "islands")]
// Re-exports used in macros. Don't use these directly in your code.
#[doc(hidden)]
pub use serde;
#[cfg(feature = "islands")]
#[doc(hidden)]
pub use serde_json;
#[cfg(feature = "tracing")]
#[doc(hidden)]
pub use tracing;
#[doc(hidden)]
pub use wasm_bindgen;
#[doc(hidden)]
pub use web_sys;
pub mod __reexports {
#[cfg(feature = "islands")]
#[doc(hidden)]
pub use serde;
#[cfg(feature = "islands")]
#[doc(hidden)]
pub use serde_json;
#[cfg(feature = "tracing")]
#[doc(hidden)]
pub use tracing;
#[doc(hidden)]
pub use wasm_bindgen;
#[doc(hidden)]
pub use web_sys;
}
8 changes: 4 additions & 4 deletions leptos_dom/src/macro_helpers/tracing_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use wasm_bindgen::UnwrapThrowExt;
/// Use for tracing property
macro_rules! tracing_props {
() => {
::leptos::tracing::span!(
::leptos::tracing::Level::TRACE,
::leptos::__reexports::tracing::span!(
::leptos::__reexports::tracing::Level::TRACE,
"leptos_dom::tracing_props",
props = String::from("[]")
);
Expand All @@ -23,8 +23,8 @@ macro_rules! tracing_props {
)*
props.pop();
props.push(']');
::leptos::tracing::span!(
::leptos::tracing::Level::TRACE,
::leptos::__reexports::tracing::span!(
::leptos::__reexports::tracing::Level::TRACE,
"leptos_dom::tracing_props",
props
);
Expand Down
20 changes: 10 additions & 10 deletions leptos_macro/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl ToTokens for Model {
let props_serializer = if is_island_with_other_props {
let fields = prop_serializer_fields(vis, props);
quote! {
#[derive(::leptos::serde::Deserialize)]
#[derive(::leptos::__reexports::serde::Deserialize)]
#vis struct #props_serialized_name {
#fields
}
Expand Down Expand Up @@ -241,7 +241,7 @@ impl ToTokens for Model {
*
* However, until https://github.com/tokio-rs/tracing/pull/1819 is merged
* (?), you can't provide an alternate path for `tracing` (for example,
* ::leptos::tracing), which means that if you're going to use the macro
* ::leptos::__reexports::tracing), which means that if you're going to use the macro
* you *must* have `tracing` in your Cargo.toml.
*
* Including the feature-check here causes cargo warnings on
Expand All @@ -255,7 +255,7 @@ impl ToTokens for Model {
let instrument = cfg!(feature = "trace-components").then(|| quote! {
#[cfg_attr(
feature = "tracing",
::leptos::tracing::instrument(level = "info", name = #trace_name, skip_all)
::leptos::__reexports::tracing::instrument(level = "info", name = #trace_name, skip_all)
)]
});

Expand All @@ -265,7 +265,7 @@ impl ToTokens for Model {
#instrument
},
quote! {
let __span = ::leptos::tracing::Span::current();
let __span = ::leptos::__reexports::tracing::Span::current();
},
quote! {
#[cfg(debug_assertions)]
Expand Down Expand Up @@ -299,7 +299,7 @@ impl ToTokens for Model {

let island_serialize_props = if is_island_with_other_props {
quote! {
let _leptos_ser_props = ::leptos::serde_json::to_string(&props).expect("couldn't serialize island props");
let _leptos_ser_props = ::leptos::__reexports::serde_json::to_string(&props).expect("couldn't serialize island props");
}
} else {
quote! {}
Expand Down Expand Up @@ -521,8 +521,8 @@ impl ToTokens for Model {
};
let deserialize_island_props = if is_island_with_other_props {
quote! {
let props = el.dataset().get(::leptos::wasm_bindgen::intern("props"))
.and_then(|data| ::leptos::serde_json::from_str::<#props_serialized_name>(&data).ok())
let props = el.dataset().get(::leptos::__reexports::wasm_bindgen::intern("props"))
.and_then(|data| ::leptos::__reexports::serde_json::from_str::<#props_serialized_name>(&data).ok())
.expect("could not deserialize props");
}
} else {
Expand All @@ -531,9 +531,9 @@ impl ToTokens for Model {

let hydrate_fn_name = hydrate_fn_name.as_ref().unwrap();
quote! {
#[::leptos::wasm_bindgen::prelude::wasm_bindgen(wasm_bindgen = ::leptos::wasm_bindgen)]
#[::leptos::__reexports::wasm_bindgen::prelude::wasm_bindgen(wasm_bindgen = ::leptos::__reexports::wasm_bindgen)]
#[allow(non_snake_case)]
pub fn #hydrate_fn_name(el: ::leptos::web_sys::HtmlElement) {
pub fn #hydrate_fn_name(el: ::leptos::__reexports::web_sys::HtmlElement) {
#deserialize_island_props
let island = #name(#island_props);
let state = island.hydrate_from_position::<true>(&el, ::leptos::tachys::view::Position::Current);
Expand All @@ -546,7 +546,7 @@ impl ToTokens for Model {
};

let props_derive_serialize = if is_island_with_other_props {
quote! { , ::leptos::serde::Serialize }
quote! { , ::leptos::__reexports::serde::Serialize }
} else {
quote! {}
};
Expand Down
Loading