mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-15 14:01:25 +00:00
Gate web-sys
APIs on activated features (#790)
* Gate `web-sys` APIs on activated features Currently the compile times of `web-sys` are unfortunately prohibitive, increasing the barrier to using it. This commit updates the crate to instead have all APIs gated by a set of Cargo features which affect what bindings are generated at compile time (and which are then compiled by rustc). It's significantly faster to activate only a handful of features vs all thousand of them! A magical env var is added to print the list of all features that should be generated, and then necessary logic is added to ferry features from the build script to the webidl crate which then uses that as a filter to remove items after parsing. Currently parsing is pretty speedy so we'll unconditionally parse all WebIDL files, but this may change in the future! For now this will make the `web-sys` crate a bit less ergonomic to use as lots of features will need to be specified, but it should make it much more approachable in terms of first-user experience with compile times. * Fix AppVeyor testing web-sys * FIx a typo * Udpate feature listings from rebase conflicts * Add some crate docs and such
This commit is contained in:
@ -77,6 +77,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: ImportedTypes> ImportedTypes for &'a T {
|
||||
fn imported_types<F>(&self, f: &mut F)
|
||||
where
|
||||
F: FnMut(&Ident, ImportedTypeKind),
|
||||
{
|
||||
(*self).imported_types(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ImportedTypes for ast::Program {
|
||||
fn imported_types<F>(&self, f: &mut F)
|
||||
where
|
||||
|
@ -15,9 +15,12 @@ macro_rules! bail_span {
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Diagnostic {
|
||||
inner: Repr,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum Repr {
|
||||
Single {
|
||||
text: String,
|
||||
|
@ -103,6 +103,7 @@ pub fn wrap_import_function(function: ast::ImportFunction) -> ast::Import {
|
||||
///
|
||||
/// Hashes the public field here along with a few cargo-set env vars to
|
||||
/// distinguish between runs of the procedural macro.
|
||||
#[derive(Debug)]
|
||||
pub struct ShortHash<T>(pub T);
|
||||
|
||||
impl<T: Hash> fmt::Display for ShortHash<T> {
|
||||
|
Reference in New Issue
Block a user