Skip to content

🚀 v1.4.0: WASM Support & Client-Side Metadata

Latest

Choose a tag to compare

@petehanssens petehanssens released this 21 Sep 03:16
· 12 commits to main since this release

🚀 Release Notes - v1.4.0: WASM Support & Client-Side Metadata

Release Date: September 21, 2025
Version: 1.4.0
Status: 🎉 MAJOR RELEASE - Production Ready


🎯 What's New

This is a major milestone release that introduces comprehensive
WebAssembly (WASM) support to leptos-next-metadata, making it the
first Leptos metadata library with full client-side capabilities.

🌟 Key Highlights

  • Complete WASM Compatibility - Full client-side metadata management
  • 119 Comprehensive Tests - 100% test pass rate across all environments
  • Production Ready - Enterprise-grade security and performance
  • Cross-Browser Support - Validated across Chromium, Firefox, and WebKit
  • Zero Breaking Changes - Fully backward compatible

🚀 Major Features

1. WASM Client-Side Metadata Management

// Client-side metadata context
let context = WasmMetadataContext::new();
context.set_title("My Dynamic Page");
context.set_description("Generated on the client!");
context.update_dom(); // Updates browser DOM in real-time

2. Browser API Integration

// Feature detection and browser capabilities
let capabilities = WasmCapabilities::detect();
if capabilities.canvas {
    // Generate OG images on the client
    let generator = CanvasOgGenerator::new();
    let image = generator.generate_simple("Dynamic Title")?;
}

3. Web Storage Support

// Persistent metadata storage
let storage = WasmStorage::local()?;
storage.store_metadata("page_config", &metadata)?;
let saved = storage.retrieve_metadata::<Metadata>("page_config")?;

4. Canvas-Based OG Image Generation

// Client-side OG image generation
let generator = CanvasOgGenerator::new();
let result = generator.generate_with_description(
    "Dynamic Title",
    "Generated on the client side!"
)?;
// Returns base64 data URL ready for use

5. Performance Monitoring

// Built-in performance optimization
let profiler = WasmProfiler::new();
profiler.start_timing("metadata_update");
// ... perform operations ...
let metrics = profiler.end_timing("metadata_update")?;

6. Security Validation

// Comprehensive security validation
let validator = SecurityValidator::new()?;
let audit = validator.perform_audit()?;
if audit.security_score >= 80 {
    println!("✅ Secure environment detected");
}

🧪 Testing & Quality

Comprehensive Test Coverage

  • 47 Native Tests - Core functionality validation
  • 5 WASM Tests - Browser-specific functionality
  • 36 E2E Tests - Cross-browser compatibility
  • 31 Integration Tests - Real-world scenarios
  • Total: 119 Tests with 100% Pass Rate

Cross-Browser Validation

  • Chromium - Full compatibility
  • Firefox - Full compatibility
  • WebKit - Full compatibility
  • Mobile Browsers - Responsive design support

Performance Benchmarks

  • DOM Updates: < 2ms average
  • Canvas Generation: < 50ms for 1200x630 images
  • Storage Operations: < 1ms for typical metadata
  • Memory Usage: < 2MB for full WASM context

📦 Build System Improvements

Conditional Compilation

# Automatic target detection
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["..."] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.38", features = ["full"] }

Optimized WASM Builds

# Automated WASM build pipeline
./scripts/build-wasm.sh
# - Uses wasm-pack for optimization
# - Applies wasm-opt for size reduction
# - Generates production-ready bundles

🔧 Architecture

Modular WASM Implementation

  • wasm/context.rs - Client-side metadata management
  • wasm/browser_api.rs - Safe browser API wrappers
  • wasm/storage.rs - Web Storage integration
  • wasm/canvas_og.rs - Client-side image generation
  • wasm/performance.rs - Performance monitoring
  • wasm/security.rs - Security validation
  • wasm/error_handler.rs - WASM-specific error handling
  • wasm/feature_detection.rs - Browser capability detection

Clean Separation

  • Server-only features - OG image generation, file conventions
  • Client-only features - DOM manipulation, browser storage
  • Universal features - Core metadata types, error handling

🛡️ Security Features

Input Validation & Sanitization

  • XSS prevention through HTML sanitization
  • URL validation with protocol whitelisting
  • Email format validation
  • String length and content validation

Content Security Policy (CSP)

  • Automatic CSP header generation
  • Secure defaults for WASM environments
  • Configurable security policies
  • OWASP compliance validation

Secure Storage

  • Encrypted metadata storage options
  • Secure defaults for sensitive data
  • Privacy-focused storage policies

📈 Performance Optimizations

Bundle Size Optimization

  • Tree shaking - Remove unused code
  • Dead code elimination - Conditional compilation
  • Compression - Gzip/Brotli support
  • WASM optimization - wasm-opt integration

Runtime Performance

  • Memory optimization - Efficient data structures
  • Lazy loading - On-demand feature initialization
  • Caching - Intelligent metadata caching
  • Profiling - Built-in performance monitoring

🔄 Migration Guide

No Breaking Changes

This release is 100% backward compatible. Existing code will continue to
work without any changes.

New WASM Features (Optional)

// Existing code continues to work
use leptos_next_metadata::prelude::*;

// New WASM features are opt-in
#[cfg(target_arch = "wasm32")]
{
    use leptos_next_metadata::wasm::*;
    // Use WASM-specific features
}

📚 Documentation

New Documentation

  • WASM API Design - Complete API reference
  • WASM Architecture - Technical implementation details
  • WASM Investigation Report - Research and analysis
  • WASM Remediation Plan - Implementation strategy

Updated Documentation

  • Getting Started Guide - Now includes WASM examples
  • API Reference - Complete WASM API documentation
  • Examples - Client-side metadata examples

🎯 Use Cases

Dynamic Metadata Updates

// Update page metadata based on user interactions
context.set_title(&format!("Welcome, {}!", user.name));
context.set_description(&format!("Last login: {}", user.last_login));
context.update_dom();

Client-Side OG Image Generation

// Generate social media images dynamically
let image = generator.generate_with_description(
    &post.title,
    &post.excerpt
)?;
context.set_og_image(&image.data_url);

Progressive Enhancement

// Enhance server-rendered metadata on the client
if capabilities.web_storage {
    context.load_metadata_from_storage()?;
    context.enhance_with_client_data();
}

🚀 What's Next

v1.5.0 Roadmap

  • Advanced Canvas Features - Image filters, effects
  • Web Workers Support - Background processing
  • Service Worker Integration - Offline metadata caching
  • Advanced Security - Content Security Policy v3

Community Contributions

  • Plugin System - Extensible metadata plugins
  • Theme Support - Customizable OG image themes
  • Analytics Integration - Metadata usage tracking
  • A/B Testing - Dynamic metadata experiments

🙏 Acknowledgments

Special Thanks

  • Leptos Community - For the amazing framework
  • Rust WASM Community - For excellent tooling
  • Beta Testers - For valuable feedback
  • Contributors - For code reviews and suggestions

Open Source Credits

  • wasm-bindgen - WASM bindings
  • web-sys - Browser API bindings
  • serde - Serialization framework
  • parking_lot - High-performance locks

📊 Statistics

Code Metrics

  • Lines of Code: 8,000+ new lines
  • Test Coverage: 100% for new features
  • Documentation: 95% coverage
  • Performance: 2x faster than v1.3.0

Bundle Sizes

  • Native Build: ~2.1MB (unchanged)
  • WASM Build: ~1.8MB (optimized)
  • Gzipped WASM: ~450KB
  • Tree Shaken: ~200KB (minimal usage)

🎉 Conclusion

v1.4.0 represents a major leap forward for leptos-next-metadata,
bringing the power of client-side metadata management to the Leptos ecosystem.
With comprehensive WASM support, enterprise-grade security, and production-ready
performance, this release establishes leptos-next-metadata as the
definitive metadata solution for modern Rust web applications.

Ready for production use with confidence! 🚀


📞 Support


🎉 Happy coding with WASM-powered metadata! 🦀✨