Expand description
Pure-Rust, buildless toolchain for ES modules and Web Components. No Node, no bundler.
It vendors each npm package into a web_modules/ tree with an import map
(Snowpack-style) and serves them through an on-the-fly transform dev server
(like @web/dev-server), built entirely in Rust on
npm-utils, oxc and grass.
It emits native ES modules and leaves bare-specifier resolution to the browser’s
import map; it is not a bundler.
§Modules
Core (always on):
vendor: resolve, download and extract npm packages into aweb_modules/tree (vianpm-utils) and accumulate the import map.importmap: a deterministic import-map composer (build, merge fragments, render the<script type="importmap">).
Processors (applied to your source and assets):
typescript: TypeScript and modern JS → browser JS via oxc, with legacy decorators configured for Lit.scss: SCSS → CSS via grass.minify: JS minification via oxc_minifier.dts:.d.tsemission.i18n: XLIFF merge.icons: favicons from a PNG.
Toolchain (build and serve):
build: vendor, transform and render into an output dir.bundle: fold an app plus itsnode_modules/(CommonJS and all) into one browser ESM file via rolldown, for React-class packages that ship only CommonJS.templates: HTML templating (importmap injection).server/dev: serve embedded assets, or compile on the fly with file-watching and live-reload.
Re-exports§
pub use build::Build;pub use build::compress;pub use build::templates;pub use npm_utils as npm;pub use include_dir;
Modules§
- build
- Build-time toolchain for a consumer crate’s
build.rs. - cli_
config - CLI scaffolding (the
feature_args!macro + theNoConfigplaceholder) that lets each compiler processor carry its own clap config. Compiled only withcli, so the library path stays clap-free. CLI scaffolding for the compiler processors — compiled only with theclifeature, so the library path stays clap-free (the deliberate design noted on theclifeature inCargo.toml). - dev
- A buildless dev server: serve a frontend straight from source, compiling TypeScript and SCSS on the fly per request (mtime-cached) and live-reloading the browser when files change.
- dts
- Emit TypeScript declaration files (
.d.ts) viaoxc_isolated_declarations. - i18n
- Read and merge XLIFF 1.2 localisation files (e.g. lit-localize interchange)
into a
{ id: translation }map for runtime use, viaquick_xml. - icons
- Generate favicons and app icons from a source PNG, via
image+ico. - importmap
- A small, deterministic import map composer.
- minify
- JavaScript minification via
oxc_minifier+ minified codegen. - mount
- Compose a frontend from many prefix-mounted source directories.
- reject
- Reject-path filtering: keep config / secret / server-side files out of built output, bundles, and served responses.
- scss
- SCSS → CSS compilation via
grass(pure Rust, no Node/dart-sass). - server
- Axum integration: serve a frontend from a set of known roots.
- static_
files - Copy non-source static files into an output tree.
- symlinks
- Symlink policy for walking and serving source trees.
- tsconfig
- Generate TypeScript
tsconfigpathsfrom a set ofMounts: the editor /tscside of import resolution, co-generated from the same mount set as the runtimeImportmapso the two can’t drift. - typescript
- TypeScript / modern JS → browser JS via oxc.
- vendor
- Vendor packages into a
web_modules/tree and build the import map.
Structs§
- Dev
- The fluent dev-server builder (feature
builder), at the crate root alongsideFrontend. Fluent builder for the dev server: compile TS/SCSS on the fly, render*.tera, watch the source roots and live-reload the browser. - Frontend
- Serve a frontend from one or more known roots. Default: a single root at
/. - Mount
- A source directory mounted into the composed app.
Enums§
- Decorators
- The decorator-lowering mode (
web_modules::Decorators), always available so the buildProcessorsset can carry it regardless of which processors are compiled. Decorator handling for the TypeScript transform. Defined here (always compiled) so the buildProcessorsset can carry it whether or not thetypescriptprocessor is enabled; re-exported at the crate root asweb_modules::Decorators(and, with thetypescriptfeature, asweb_modules::typescript::Decorators). It takes effect only when thetypescriptprocessor actually runs. - Error
- Anything that can go wrong inside
web_modules. - Symlink
Mode - How symlinks in a source tree behave, everywhere: the build preflight, the dev
server, and the static router. Selected on
Processors::symlinks(sobuildanddevshare it), onFrontend::symlinks, and via--symlinkson the CLI.
Functions§
- serve
- Bind
addrand serveappuntil the process stops.
Type Aliases§
- Result
- Convenience alias:
Result<T, web_modules::Error>.