components-js
A Rust library for analyzing Components.js projects — discovering modules, component classes, configurations, and their relationships.
Overview
Components.js is a semantic dependency injection framework for TypeScript and JavaScript. This crate provides tooling to statically analyze Components.js projects: parsing component files, resolving JSON-LD contexts, and building registries of modules, classes, and configuration instances.
Features
- Module discovery — scan
node_modulesfor Components.js module definitions - Component registry — build a typed registry of classes, abstract classes, and their parameters
- Config resolution — discover and parse configuration instances
- Context expansion — resolve JSON-LD
@contextreferences - Pluggable filesystem — abstract
Fstrait for custom backends (in-memory, WASM, etc.)
Feature flags
| Feature | Default | Description |
|---|---|---|
tokio |
✓ | Enables OsFs, an Fs implementation backed by tokio::fs |
cli |
Enables the components-js binary (adds clap, anyhow, tracing-subscriber) |
Library usage
[]
= { = "0.1", = false, = ["tokio"] }
use OsFs;
use ModuleState;
use ComponentRegistry;
let fs = OsFs;
let state = build.await?;
let mut registry = new;
registry.register_available_modules.await?;
registry.finalize;
CLI usage
Acknowledgements
This project is a Rust reimplementation of analysis tooling for Components.js by Linked Software Dependencies.