remove wasm-bindgen cache (we use sledgehammer)

This commit is contained in:
Evan Almloff committed 2024-01-06 16:56:07 -06:00
1 parent 65c0d213e3
commit 44ccdba0fe
4 files changed
+2 -321

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ dioxus-interpreter-js = { workspace = true, features = [
] } ] }
js-sys = "0.3.56" js-sys = "0.3.56"
wasm-bindgen = { workspace = true, features = ["enable-interning"] } wasm-bindgen = { workspace = true }
wasm-bindgen-futures = "0.4.29" wasm-bindgen-futures = "0.4.29"
tracing = { workspace = true } tracing = { workspace = true }
rustc-hash = { workspace = true } rustc-hash = { workspace = true }
-300
View File
@@ -1,300 +0,0 @@
pub static BUILTIN_INTERNED_STRINGS: &[&str] = &[
// Important tags to dioxus
"dioxus-id",
"dioxus",
"dioxus-event-click", // todo: more events
"click",
// All the HTML Tags
"a",
"abbr",
"address",
"area",
"article",
"aside",
"audio",
"b",
"base",
"bdi",
"bdo",
"big",
"blockquote",
"body",
"br",
"button",
"canvas",
"caption",
"cite",
"code",
"col",
"colgroup",
"command",
"data",
"datalist",
"dd",
"del",
"details",
"dfn",
"dialog",
"div",
"dl",
"dt",
"em",
"embed",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hr",
"html",
"i",
"iframe",
"img",
"input",
"ins",
"kbd",
"keygen",
"label",
"legend",
"li",
"link",
"main",
"map",
"mark",
"menu",
"menuitem",
"meta",
"meter",
"nav",
"noscript",
"object",
"ol",
"optgroup",
"option",
"output",
"p",
"param",
"picture",
"pre",
"progress",
"q",
"rp",
"rt",
"ruby",
"s",
"samp",
"script",
"section",
"select",
"small",
"source",
"span",
"strong",
"style",
"sub",
"summary",
"sup",
"table",
"tbody",
"td",
"textarea",
"tfoot",
"th",
"thead",
"time",
"title",
"tr",
"track",
"u",
"ul",
"var",
"video",
"wbr",
// All the event handlers
"Attribute",
"accept",
"accept-charset",
"accesskey",
"action",
"alt",
"async",
"autocomplete",
"autofocus",
"autoplay",
"charset",
"checked",
"cite",
"class",
"cols",
"colspan",
"content",
"contenteditable",
"controls",
"coords",
"data",
"data-*",
"datetime",
"default",
"defer",
"dir",
"dirname",
"disabled",
"download",
"draggable",
"enctype",
"for",
"form",
"formaction",
"headers",
"height",
"hidden",
"high",
"href",
"hreflang",
"http-equiv",
"id",
"ismap",
"kind",
"label",
"lang",
"list",
"loop",
"low",
"max",
"maxlength",
"media",
"method",
"min",
"multiple",
"muted",
"name",
"novalidate",
"onabort",
"onafterprint",
"onbeforeprint",
"onbeforeunload",
"onblur",
"oncanplay",
"oncanplaythrough",
"onchange",
"onclick",
"oncontextmenu",
"oncopy",
"oncuechange",
"oncut",
"ondoubleclick",
"ondrag",
"ondragend",
"ondragenter",
"ondragleave",
"ondragover",
"ondragstart",
"ondrop",
"ondurationchange",
"onemptied",
"onended",
"onerror",
"onfocus",
"onfocusout",
"onfocusin",
"onhashchange",
"oninput",
"oninvalid",
"onkeydown",
"onkeypress",
"onkeyup",
"onload",
"onloadeddata",
"onloadedmetadata",
"onloadstart",
"onmousedown",
"onmousemove",
"onmouseout",
"onmouseover",
"onmouseup",
"onmousewheel",
"onoffline",
"ononline",
"onpageshow",
"onpaste",
"onpause",
"onplay",
"onplaying",
"onprogress",
"onratechange",
"onreset",
"onresize",
"onscroll",
"onsearch",
"onseeked",
"onseeking",
"onselect",
"onstalled",
"onsubmit",
"onsuspend",
"ontimeupdate",
"ontoggle",
"onunload",
"onvolumechange",
"onwaiting",
"onwheel",
"open",
"optimum",
"pattern",
"placeholder",
"poster",
"preload",
"readonly",
"rel",
"required",
"reversed",
"rows",
"rowspan",
"sandbox",
"scope",
"selected",
"shape",
"size",
"sizes",
"span",
"spellcheck",
"src",
"srcdoc",
"srclang",
"srcset",
"start",
"step",
"style",
"tabindex",
"target",
"title",
"translate",
"type",
"usemap",
"value",
"width",
"wrap",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
];
-11
View File
@@ -11,7 +11,6 @@ pub struct Config {
#[cfg(feature = "hydrate")] #[cfg(feature = "hydrate")]
pub(crate) hydrate: bool, pub(crate) hydrate: bool,
pub(crate) rootname: String, pub(crate) rootname: String,
pub(crate) cached_strings: Vec<String>,
pub(crate) default_panic_hook: bool, pub(crate) default_panic_hook: bool,
} }
@@ -21,7 +20,6 @@ impl Default for Config {
#[cfg(feature = "hydrate")] #[cfg(feature = "hydrate")]
hydrate: false, hydrate: false,
rootname: "main".to_string(), rootname: "main".to_string(),
cached_strings: Vec::new(),
default_panic_hook: true, default_panic_hook: true,
} }
} }
@@ -55,15 +53,6 @@ impl Config {
self self
} }
/// Sets a string cache for wasm bindgen to [intern](https://docs.rs/wasm-bindgen/0.2.84/wasm_bindgen/fn.intern.html). This can help reduce the time it takes for wasm bindgen to pass
/// strings from rust to javascript. This can significantly improve pefromance when passing strings to javascript, but can have a negative impact on startup time.
///
/// > Currently this cache is only used when creating static elements and attributes.
pub fn with_string_cache(mut self, cache: Vec<String>) -> Self {
self.cached_strings = cache;
self
}
/// Set whether or not Dioxus should use the built-in panic hook or defer to your own. /// Set whether or not Dioxus should use the built-in panic hook or defer to your own.
/// ///
/// The panic hook is set to true normally so even the simplest apps have helpful error messages. /// The panic hook is set to true normally so even the simplest apps have helpful error messages.
+1 -9
View File
@@ -66,7 +66,6 @@ use futures_util::{
pin_mut, FutureExt, StreamExt, pin_mut, FutureExt, StreamExt,
}; };
mod cache;
mod cfg; mod cfg;
mod dom; mod dom;
#[cfg(feature = "eval")] #[cfg(feature = "eval")]
@@ -107,7 +106,7 @@ mod rehydrate;
/// } /// }
/// ``` /// ```
pub fn launch(root_component: fn(()) -> Element) { pub fn launch(root_component: fn(()) -> Element) {
launch_with_props( root_component, (), Config::default()); launch_with_props(root_component, (), Config::default());
} }
/// Launch your app and run the event loop, with configuration. /// Launch your app and run the event loop, with configuration.
@@ -202,13 +201,6 @@ pub async fn run_with_props<T: Clone + 'static>(
#[cfg(all(feature = "hot_reload", debug_assertions))] #[cfg(all(feature = "hot_reload", debug_assertions))]
let mut hotreload_rx = hot_reload::init(); let mut hotreload_rx = hot_reload::init();
for s in crate::cache::BUILTIN_INTERNED_STRINGS {
wasm_bindgen::intern(s);
}
for s in &cfg.cached_strings {
wasm_bindgen::intern(s);
}
let (tx, mut rx) = futures_channel::mpsc::unbounded(); let (tx, mut rx) = futures_channel::mpsc::unbounded();
#[cfg(feature = "hydrate")] #[cfg(feature = "hydrate")]