fob-bundler 0.2.2

Fob bundler - Rolldown-based bundling on top of fob foundation
Documentation

fob-bundler

Fob bundler - Rolldown-based bundling on top of fob foundation.

This crate provides full bundling capabilities using Rolldown, building on top of the fob foundation crate for graph analysis and runtime abstraction.

Quick Start

Bundle a library

use fob_bundler as fob;

# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result = fob::BuildOptions::library("./src/index.js")
    .external(["react", "react-dom"])
    .sourcemap(true)
    .build()
    .await?;

let bundle = result.output.as_single().expect("single bundle");
for asset in bundle.assets.iter() {
    std::fs::write(format!("dist/{}", asset.filename()), asset.content_as_bytes())?;
}
# Ok(()) }

Analyze without bundling

use fob_bundler as fob;

# #[tokio::main]
# async fn main() -> Result<(), Box<dyn std::error::Error>> {
let analysis = fob_graph::analyze(["./src/index.js"]).await?;
for unused in analysis.graph.unused_exports()? {
    println!("unused: {} from {}", unused.export.name, unused.module_id);
}
# Ok(()) }