Skip to main content

xtask_wasm/
lib.rs

1#![deny(missing_docs)]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3#![doc = include_str!("../README.md")]
4
5#[cfg(not(target_arch = "wasm32"))]
6use std::process::Command;
7
8#[cfg(not(target_arch = "wasm32"))]
9pub use xtask_watch::{
10    anyhow, cargo_metadata, cargo_metadata::camino, clap, metadata, package, xtask_command, Watch,
11};
12
13#[cfg(not(target_arch = "wasm32"))]
14mod dev_server;
15#[cfg(not(target_arch = "wasm32"))]
16mod dist;
17#[cfg(all(not(target_arch = "wasm32"), feature = "sass"))]
18mod sass;
19#[cfg(all(not(target_arch = "wasm32"), feature = "wasm-opt"))]
20mod wasm_opt;
21
22#[cfg(not(target_arch = "wasm32"))]
23pub use dev_server::*;
24#[cfg(not(target_arch = "wasm32"))]
25pub use dist::*;
26#[cfg(all(not(target_arch = "wasm32"), feature = "sass"))]
27#[cfg_attr(docsrs, doc(cfg(feature = "sass")))]
28pub use sass::*;
29
30#[cfg(all(not(target_arch = "wasm32"), feature = "wasm-opt"))]
31#[cfg_attr(docsrs, doc(cfg(feature = "wasm-opt")))]
32pub use wasm_opt::*;
33
34#[cfg(all(not(target_arch = "wasm32"), feature = "sass"))]
35#[cfg_attr(docsrs, doc(cfg(feature = "sass")))]
36pub use sass_rs;
37
38#[cfg(all(not(target_arch = "wasm32"), feature = "run-example"))]
39#[cfg_attr(docsrs, doc(cfg(feature = "run-example")))]
40pub use env_logger;
41
42#[cfg(all(not(target_arch = "wasm32"), feature = "run-example"))]
43#[cfg_attr(docsrs, doc(cfg(feature = "run-example")))]
44pub use log;
45
46/// Get the default command for the build in the dist process.
47///
48/// This is `cargo build --target wasm32-unknown-unknown`.
49#[cfg(not(target_arch = "wasm32"))]
50pub fn default_build_command() -> Command {
51    let mut command = Command::new("cargo");
52    command.args(["build", "--target", "wasm32-unknown-unknown"]);
53    command
54}
55
56#[cfg(all(target_arch = "wasm32", feature = "run-example"))]
57pub use console_error_panic_hook;
58
59#[cfg(all(target_arch = "wasm32", feature = "run-example"))]
60pub use wasm_bindgen;
61
62#[cfg(feature = "run-example")]
63pub use xtask_wasm_run_example::*;