-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for building with web-sys (#961)
* Enable travis * `web-sys` general conversion (#826) * Moved patches from different PRs. * Add bits & pieces and some services. * Rename `stdweb` feature to `std_web`. * Move tests and examples to different PR. * Revert some `cargo_web` handling removal. * Missed something. * Implement `console_error_panic_hook`. * Update Cargo.toml Co-authored-by: Justin Starry <justin.m.starry@gmail.com> * Move document creation to util convenience method (#855) * `web-sys` listener conversion (#813) * `web-sys` listener initial try. * Improve macros? * Remove generic from `EventListenerHandle`. * Fix build. * A cleaner solution? * Even cleaner. * Fix `build.rs`. * Minor improvements. * Following the yew toml style. * Fixing visibility. * Fix `rustfmt`. * Add `web-sys` re-exports. * Move general changes to different PR. * Remove compat. * Actually remove `compat.rs`. * Rename `stdweb` feature to `std_web`. * Move to gloo's `EventListener` and some polish. * Remove outdated comment. * Change `EventHandler` to be cancelled on drop. * `web-sys` html conversion (#817) * Converting all `html` parts. * Format. * Move general changes to different PR. * Removed compat. * Rename `stdweb` feature to `std_web`. * Remove redudant function copy. * Some polish. * Move to gloo's `EventListener`. * Replace `unwrap`s with `expect`s. * `web-sys` agent conversion (#818) * Converting `agent`. * Remove wrong `cfg` in imports. * Move general changes to different PR. * Some optimisations. * Rename `stdweb` feature to `std_web`. * Fix `ArrayBuffer` to `Uint8Array` conversions. * Add js module worker. * Use `cfg-if`` and `cfg-match` to make things clearer. * Fix `std_web` build. * Add some polish. * Add build guards for invalid build configs (#866) * `web_sys` cfg conversion (#862) * Use `cfg-if` and `cfg-match` and some polish. * Mistakes were made. * Missed line during rebasing. * Mistakes were undone. * Remove global. * Remove part of `global!`. * `web-sys` services conversion (#827) * Convert `console`. * Finish services. * Some polish. * Fix `ArrayBuffer` to `Uint8Array` conversions. * Fix aborting fetch leading to error and some polish. * Replaced some `unwrap`s with `expect`s. * Use `cfg_if` and `cfg_match` and do some polish. * Proper scoping. * Some fixes. * Move fetch and reader services to different PR. * Revert split. * Fix CI builds (#877) * Fix derive_props_test * Move tests (#897) (#898) * `web-sys` fetch service conversion (#867) * Split implementation. * Import global. * Import global. * Revert split. * Make fetch available again. * Revert "Revert split." This reverts commit 6e3f101. * Re-revert split. * Some polish. * Move to `wasm_bindgen_futures`. * Switch to `thiserror`. * wip * Update src/services/fetch/web_sys.rs Co-Authored-By: daxpedda <daxpedda@gmail.com> * Some more polish. Co-authored-by: Justin Starry <justin.m.starry@gmail.com> * `web-sys` reader service conversion (#868) * Split reader implementation. * Revert split. * Remove leftover files. * Make reader available again. * Revert "Revert split." This reverts commit 8abdc9c. * Revert "Remove leftover files." This reverts commit 188c6eb. * Re-revert split. * Polish. * Forgot some part. * Some polish. * Some polish. * `web-sys` examples/tests conversion (#841) * Fix examples/tests to work with `web_sys`. * Update `StorageService` usage. * Split `stdweb` and `web-sys` examples. * Fixing the shell script. * Trying to reset file permissions. * Update to new reader API. * Update to new fetch API. * Update to new fetch API. * Re-enable examples CI. * Deleted duplicate example. * Some fixes. * Fix rand build. * Fix spawning workers in combination with `wasm-bindgen`. (#901) * Fix component rendering process (#913) * wip * Fix component rendering process * Simplify yew-macro a bit (#902) * yew-macro: Simplify Properties validation * Fix most clippy warnings * Fix clippy warnings (#912) * Import Task trait in dashboard example * Remove duplicate vtag tests * Fix prevent_default() by non-passive (#958) * Fix prevent_default() by non-passive * Fix cargo fmt * Remove `Option` from most services. * Remove `Option` from resize service. * Apply fetch changes. * Apply reader service changes. * Fix `node_refs` example. * Remove web-sys travis branch Co-authored-by: daxpedda <daxpedda@gmail.com> Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com> Co-authored-by: Jet Li <jing.i.qin@icloud.com>
- Loading branch information
1 parent
2a7d7ac
commit d38ce42
Showing
195 changed files
with
4,953 additions
and
1,242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
use std::env; | ||
|
||
pub fn main() { | ||
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); | ||
if cfg!(all(feature = "web_sys", feature = "std_web")) { | ||
panic!("Yew does not allow the `web_sys` and `std_web` cargo features to be used simultaneously"); | ||
} else if cfg!(not(any(feature = "web_sys", feature = "std_web"))) { | ||
panic!("Yew requires selecting either the `web_sys` or `std_web` cargo feature"); | ||
} | ||
|
||
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); | ||
let using_wasi = target_os == "wasi"; | ||
|
||
let cargo_web = env::var("COMPILING_UNDER_CARGO_WEB").unwrap_or_default(); | ||
if target_arch == "wasm32" && cargo_web != "1" { | ||
println!("cargo:rustc-cfg=feature=\"wasm_bindgen_test\""); | ||
let using_cargo_web = cargo_web == "1"; | ||
if using_cargo_web && cfg!(feature = "web_sys") { | ||
panic!("cargo-web is not compatible with web-sys"); | ||
} | ||
|
||
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); | ||
let using_wasm_bindgen = target_arch == "wasm32" && !using_cargo_web && !using_wasi; | ||
if !using_wasm_bindgen && cfg!(all(feature = "web_sys", not(feature = "doc_test"))) { | ||
let target = env::var("TARGET").unwrap_or_default(); | ||
panic!( | ||
"Selected target `{}` is not compatible with web-sys", | ||
target | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
tests/derive_props_test.rs → crates/macro/tests/derive_props_test.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
[workspace] | ||
members = [ | ||
"counter", | ||
"crm", | ||
"custom_components", | ||
"dashboard", | ||
"node_refs", | ||
"file_upload", | ||
"fragments", | ||
"futures", | ||
"game_of_life", | ||
"inner_html", | ||
"js_callback", | ||
"large_table", | ||
"minimal", | ||
"mount_point", | ||
"multi_thread", | ||
"nested_list", | ||
"npm_and_rest", | ||
"pub_sub", | ||
"server", | ||
"showcase", | ||
"textarea", | ||
"timer", | ||
"todomvc", | ||
"two_apps", | ||
"pub_sub", | ||
"webgl" | ||
"webgl", | ||
"std_web/counter", | ||
"std_web/file_upload", | ||
"std_web/inner_html", | ||
"std_web/js_callback", | ||
"std_web/mount_point", | ||
"std_web/multi_thread", | ||
"std_web/node_refs", | ||
"std_web/npm_and_rest", | ||
"std_web/todomvc", | ||
"std_web/two_apps", | ||
"web_sys/counter", | ||
"web_sys/file_upload", | ||
"web_sys/inner_html", | ||
"web_sys/js_callback", | ||
"web_sys/mount_point", | ||
"web_sys/multi_thread", | ||
"web_sys/node_refs", | ||
"web_sys/npm_and_rest", | ||
"web_sys/todomvc", | ||
"web_sys/two_apps", | ||
] |
Oops, something went wrong.