eserstack Product-Candidate — build pipeline for laroux · eser/stack Install:
pnpm add jsr:@eserstack/laroux-bundler
Build system and bundler for laroux.js - A React Server Components framework for Deno.
This package provides the complete build system for laroux.js, including:
- Runtime Bundler - On-demand bundling during development with HMR
- Prebuilt Bundler - Production build optimization with code splitting
- Deno Bundler - Deno-native bundling with TypeScript support
- Transform Pipeline - JSX, TypeScript, and RSC transformation
- Chunk Manifest - Smart code splitting and lazy loading
- Module Map - Client component discovery and mapping
- HMR Client - Hot Module Replacement for instant updates
- Error Overlay - Beautiful development-mode error display
- CSS Processing - CSS bundling and optimization
- Import Rewriting - Automatic import path resolution
pnpm add @eserstack/laroux-bundlerThe runtime bundler provides on-demand bundling with Hot Module Replacement:
import { RuntimeBundler } from "@eserstack/laroux-bundler/adapters/runtime-bundler";
const bundler = new RuntimeBundler({
srcDir: "./src",
distDir: "./dist",
enableHMR: true,
logLevel: "info",
});
// Build on demand
const result = await bundler.buildClientComponent("./src/app/counter.tsx");
// Get client entry
const entry = await bundler.getClientEntry();
// Get module map for RSC
const moduleMap = bundler.getModuleMap();The prebuilt bundler optimizes for production with code splitting:
import { PrebuiltBundler } from "@eserstack/laroux-bundler/adapters/prebuilt-bundler";
const bundler = new PrebuiltBundler({
srcDir: "./src",
distDir: "./dist",
optimize: true,
});
// Build all components upfront
await bundler.buildAll();
// Get optimized assets
const assets = bundler.getAssets();
const moduleMap = bundler.getModuleMap();On-demand bundler for development with HMR support.
class RuntimeBundler {
constructor(config: BundlerConfig);
// Build a client component on-demand
buildClientComponent(path: string): Promise<BuildResult>;
// Get the client entry point (includes HMR client)
getClientEntry(): Promise<string>;
// Get module map for RSC rendering
getModuleMap(): ModuleMap;
// Watch for file changes and trigger HMR
watch(): AsyncIterator<HMRUpdate>;
}Features:
- Lazy bundling - only bundles requested files
- Hot Module Replacement with smart refresh
- Fast rebuild times with incremental compilation
- Source maps for debugging
Production bundler with optimization and code splitting.
class PrebuiltBundler {
constructor(config: BundlerConfig);
// Build all components upfront
buildAll(): Promise<void>;
// Get all bundled assets
getAssets(): Map<string, Asset>;
// Get module map
getModuleMap(): ModuleMap;
// Get chunk manifest for lazy loading
getChunkManifest(): ChunkManifest;
}Features:
- Automatic code splitting by route
- Tree shaking and minification
- Asset optimization (CSS, images)
- Content hashing for cache busting
- Chunk manifest for lazy loading
interface BundlerConfig {
// Source directory
srcDir: string;
// Output directory
distDir: string;
// Enable Hot Module Replacement
enableHMR?: boolean;
// Minify output
minify?: boolean;
// Generate source maps
sourceMaps?: boolean;
// External dependencies (not bundled)
externals?: Record<string, string>;
// Target environment
target?: "browser" | "deno";
// Logging level
logLevel?: "trace" | "debug" | "info" | "warn" | "error";
}- Runtime bundling (on-demand)
- Hot Module Replacement
- Source maps enabled
- Fast rebuild times
- Error overlay
- Unminified code
laroux dev # Uses RuntimeBundler- Prebuilt bundling (all files upfront)
- Code splitting by route
- Tree shaking and minification
- Content hashing
- Optimized chunks
- No source maps (unless enabled)
laroux build # Uses PrebuiltBundlerThe bundler scans your source directory for client components (files with
"use client").
Each file goes through:
- TypeScript → JavaScript
- JSX → React calls
- Import path rewriting
- Client/Server boundary injection
Components are split into chunks based on:
- Route boundaries
- Dynamic imports
- Size thresholds
The bundler creates a module map that RSC uses to:
- Reference client components from server
- Inject chunk URLs into the stream
- Enable lazy loading
File changes trigger:
- Incremental rebuild of affected modules
- WebSocket notification to client
- Smart component refresh (preserve state when safe)
- @eserstack/cli - Main CLI tool
(
eser larouxcommands) - @eserstack/laroux-server - Server runtime (SSR, routing, actions)
- @eserstack/laroux - Framework-agnostic core utilities
- JSR Package — symbol-level API reference, generated from source
- Architecture decision records
- Generate the API reference locally with
deno task cli docs(output lands indocs/api/, which is not tracked)
Apache-2.0 © Eser Ozvataf