Skip to content
Merged
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
9 changes: 3 additions & 6 deletions .github/workflows/size-cmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ jobs:

- name: Write Optimisation Flags
run: |
echo 'share-generics = true' >> .cargo/config.toml
echo 'build-std = ["std", "panic_abort"]' >> .cargo/config.toml
echo 'build-std-features = ["panic_immediate_abort"]' >> .cargo/config.toml
echo '[build]' >> .cargo/config.toml
echo 'rustflags = ["-Cpanic=abort"]' >> .cargo/config.toml

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -54,11 +55,7 @@ jobs:
version: "latest"

- name: Build examples
run: find ./*/index.html | xargs -I '{}' trunk build --release '{}' || exit 0
working-directory: examples
env:
RUSTUP_TOOLCHAIN: nightly
RUSTFLAGS: --cfg nightly_yew
run: cargo run -p build-examples --bin build-examples

- name: Collect size information
run: python3 ci/collect_sizes.py
Expand Down
10 changes: 3 additions & 7 deletions ci/collect_sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@
def find_example_sizes(parent_dir: Path) -> Dict[str, int]:
example_sizes: Dict[str, int] = {}

for example_dir in (parent_dir / "examples").iterdir():

if not example_dir.is_dir():
print(f"{example_dir} is not a directory.")
continue
for example_dist_dir in (parent_dir / "dist").iterdir():

total_size = 0

# For examples with multiple bundles, we add them together.
for bundle in (example_dir / "dist").glob(f"*.wasm"):
for bundle in example_dist_dir.glob(f"*.wasm"):
size = bundle.stat().st_size

print(f"{bundle} has a size of {size}.")

total_size += size

if total_size > 0:
example_sizes[example_dir.name] = total_size
example_sizes[example_dist_dir.name] = total_size

return example_sizes

Expand Down
19 changes: 9 additions & 10 deletions packages/yew-macro/src/html_tree/html_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,16 @@ impl ToTokens for HtmlElement {
}}
});

#[cfg(nightly_yew)]
let invalid_void_tag_msg_start = {
#[rustversion::since(1.89)]
fn derive_debug_tag(vtag: &Ident) -> String {
let span = vtag.span().unwrap();
let source_file = span.source_file().path();
let source_file = source_file.display();
let start = span.start();
format!("[{}:{}:{}] ", source_file, start.line(), start.column())
};

#[cfg(not(nightly_yew))]
let invalid_void_tag_msg_start = "";
format!("[{}:{}:{}] ", span.file(), span.line(), span.column())
}
#[rustversion::before(1.89)]
fn derive_debug_tag(_: &Ident) -> &'static str {
""
}
let invalid_void_tag_msg_start = derive_debug_tag(&vtag);

let value = value();
let checked = checked();
Expand Down
1 change: 1 addition & 0 deletions packages/yew-macro/src/html_tree/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn lint<L>(tree: &HtmlTree)
where
L: Lint,
{
let _ = L::lint;
#[cfg(not(yew_lints))]
let _ = tree;
#[cfg(yew_lints)]
Expand Down
2 changes: 0 additions & 2 deletions packages/yew-macro/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(nightly_yew, feature(proc_macro_span))]

//! This crate provides Yew's procedural macro `html!` which allows using JSX-like syntax
//! for generating html and the `Properties` derive macro for deriving the `Properties` trait
//! for components.
Expand Down
2 changes: 1 addition & 1 deletion packages/yew/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#[allow(missing_docs)]
//! Internal module for unit tests
pub mod layout_tests;
Loading