Expand description
§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;
let result = fob::BuildOptions::new("./src/index.js")
.platform(fob::Platform::Node) // Uses Node.js export conditions
.externalize(["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())?;
}§Using BuildConfig (Recommended for New Code)
BuildConfig provides a cleaner API with better type safety:
use fob_bundler::BuildConfig;
let result = BuildConfig::new("./src/index.js")
.bundle(false)
.output_dir("dist")
.build()
.await?;
result.write_to("dist", true)?;§Analyze without bundling
use fob_bundler as fob;
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);
}Re-exports§
pub use builders::BuildOptions;pub use builders::BuildOutput;pub use builders::BuildResult;pub use builders::CodeSplittingConfig;pub use builders::EntryMode;pub use builders::EntryPoints;pub use builders::ExternalConfig;pub use builders::IncrementalConfig;pub use builders::MinifyLevel;pub use builders::build;pub use builtins::CssPlugin;pub use cache::CacheConfig;pub use cache::CacheKey;pub use config::BuildConfig;pub use config::ExternalPattern;pub use config::OptimizationConfig;pub use config::OutputConfig;pub use config::ResolutionConfig;pub use output::AppBuild;pub use output::Bundle as JoyBundle;pub use output::ComponentBuild;pub use output::ImportMap;pub use target::DeploymentTarget;pub use target::ExportConditions;pub use target::NodeBuiltins;pub use target::RuntimeEnvironment;pub use analysis::AnalyzedBundle;
Modules§
- analysis
- Bundler-specific analysis types.
- builders
- Build APIs for Fob’s unified bundling interface.
- builtins
- Built-in functionality for the bundler.
- cache
- Persistent build cache for fob-bundler.
- collection
- Shared collection types for module graph analysis.
- config
- Build configuration types.
- dependency_
chain - Dependency chain analysis for understanding module relationships.
- diagnostics
- Diagnostic extraction from Rolldown errors.
- export
- external_
dep - framework_
rules - Framework-aware dead code analysis.
- from_
collection - Convert intermediate collection types to final graph representation.
- from_
rolldown - import
- module
- module_
collection_ plugin - module_
id - output
- oxc
- OXC (Oxidation Compiler) foundation types re-exported for workspace consistency.
- package_
json - Package.json parsing and dependency analysis.
- plugins
- Plugin system for fob-bundler.
- runtime
- Bundler-specific Runtime implementation
- semantic
- Semantic analysis engine using Oxc for symbol extraction.
- span
- statistics
- symbol
- Symbol tracking for intra-file dead code analysis.
- target
- Deployment target types and configuration.
- test_
utils test-utilsand non-target_family=wasm, or non-target_family=wasm
Structs§
- Analysis
Result - Analyze
Options - Options for the analyze() function.
- Analyzer
- Fast standalone analyzer for module graphs.
- Bundle
Output - Bundler
- Bundler
Builder - Bundler
Options - Bundler
Transform Options - Cache
Analysis - Chain
Analysis - Analysis of all dependency chains to a module.
- Class
Member Info - Information about a class member symbol
- Class
Member Metadata - Additional metadata for class member symbols
- Collected
Import - Represents an import statement in a module
- Collected
Module - Represents a collected module with all its metadata
- Collection
State - Shared state for collecting module information during bundling or analysis
- Configured
- Typestate marker for a configured analyzer (has entry points).
- Decorator
Options - Dependency
Chain - A chain of dependencies from an entry point to a target module.
- Dependency
Coverage - Coverage statistics for dependencies.
- Emitted
Asset - Enum
Member Info - Information about an enum member
- Enum
Member Metadata - Metadata for enum member tracking
- Export
- Complete metadata describing a module export.
- External
Dependency - Represents an external dependency (e.g. npm package) and modules that import it.
- File
Metadata - File metadata
- Graph
Statistics - Basic statistics about a
ModuleGraphuseful for dashboards or logging. - Hook
Generate Bundle Args - Hook
Load Args - Hook
Load Output - Hook
Resolve IdArgs - Hook
Resolve IdOutput - Hook
Transform Args - Hook
Transform Output - Hook
Usage - Import
- Complete analysis of a dependency edge.
- Import
Resolution - Input
Item - Isolated
Declarations Options - LogWithout
Plugin - Module
- Resolved module metadata used by graph algorithms and builders.
- Module
Graph - In-memory module dependency graph.
- Module
Id - Canonical identifier for a module in the Joy graph.
- Namespace
Import Info - Information about a namespace import
- Native
Runtime Non- target_family=wasm - Native filesystem Runtime implementation using
std::fs. - Output
Asset - Output
Chunk - Package
Json - Parsed package.json structure.
- Rename
Event - Resolve
Options - A simple wrapper around
oxc_resolver::ResolveOptionsto make it easier to use in therolldown_resolvercrate. See oxc_resolver::ResolveOptions for more information. - Side
Effect Import - A side-effect-only import (no bindings, just execution)
- Source
Span - Byte range within a source file used for diagnostics and tooling.
- Symbol
- A symbol declared within a module (variable, function, class, etc.).
- Symbol
Span - Source location information for a symbol.
- Symbol
Statistics - Statistics about symbols across the entire graph.
- Symbol
Table - Collection of all symbols in a module.
- Test
Runtime ( test-utilsand non-target_family=wasm, or non-target_family=wasm) and non-target_family=wasm - Simple test runtime that wraps std::fs for native tests.
- Transformation
Trace - Type
Coverage - Coverage for a specific dependency type.
- Type
Only Import - A type-only import (TypeScript)
- Type
Script Options - Unconfigured
- Typestate marker for an unconfigured analyzer (no entry points yet).
- Unreachable
Code - Unreachable code detected in a module.
- Unused
Dependency - An npm dependency that is declared but never imported.
- Unused
Export - Output entry for unused exports.
- Unused
Symbol - An unused symbol in a specific module.
Enums§
- Analyze
Error - Error that can occur during analysis.
- Cache
Effectiveness - Collected
Export - Represents an export declaration in a module
- Collected
Import Specifier - Collection
Graph Error - Errors that can occur during collection-to-graph conversion
- Dependency
Type - Type of dependency in package.json.
- Enum
Member Value - Enum member value types
- Error
- Error types for fob-bundler operations.
- Export
Kind - Export declaration kind.
- Globals
Output Option - Import
Kind - Mechanism used to load the dependency.
- Import
Outcome - Import
Specifier - Individual import binding from a module.
- IsExternal
- Module
IdError - Error type for
ModuleIdconstruction failures. - Module
Type - Output
- Output
Format - Platform
- Plugin
Context - RawMinify
Options - Rename
Phase - Runtime
Error - Errors that can occur during runtime operations
- Source
MapType - Source
Type - Resolved module source type derived from file extensions.
- Symbol
Kind - Classification of symbol types for better diagnostics.
- Symbol
Metadata - Symbol metadata (extensible for different symbol kinds)
- Visibility
- Visibility modifier for class members
Traits§
- Framework
Rule - Framework-specific rule for marking exports as used by framework conventions.
- Plugin
- Runtime
Functions§
- analyze
- Convenience function using default options.
- analyze_
with_ options - Analyze module graph with custom options.
- extract_
package_ name - Extract the base package name from an npm import specifier.
- parse_
module_ structure - Parse a JavaScript/TypeScript module to extract its import/export structure
Type Aliases§
- Hook
Load Return - Hook
Noop Return - Hook
Resolve IdReturn - Hook
Transform Return - Result
- Result type alias for fob-bundler operations.
- Runtime
Result - Result type for runtime operations
- Shared
Pluginable - Shared
Transform Plugin Context