A JavaScript runtime built with Mozilla's SpiderMonkey engine and Rust. Think of it as a lightweight alternative to Node.js or Bun, with a focus on simplicity and performance.
- 🎨 Colored Console Output - Different colors for log, error, warn, info, and debug
- 📦 Node.js Compatible APIs -
process,Date.now(),__dirname,__filename - 📝 Module System - CommonJS-style
require()(work in progress) - 🎯 Clean Error Messages - Node.js/Bun style error formatting
- ⚡ Fast Startup - Minimal runtime overhead
cargo build --release./target/release/sm_runtimeWelcome to sm_runtime
Type `exit` or `quit` to stop
> console.log("Hello, World!");
Hello, World!
> process.version
v1.0.0-sm_runtime
> Date.now()
1775172435539
> quit
Goodbye!
./target/release/sm_runtime script.jsconsole.log("Regular message"); // White
console.error("Error message"); // Red
console.warn("Warning message"); // Yellow
console.info("Info message"); // Cyan
console.debug("Debug message"); // Grayprocess.version // "v1.0.0-sm_runtime"
process.platform // "linux", "macos", or "windows"
process.arch // "x86_64", "arm64", etc.
process.cwd() // Current working directory
process.env // Environment variables
process.exit(code) // Exit with codeDate.now() // Current timestamp in milliseconds// CommonJS style (work in progress)
const module = require('./my-module');
// Available globals
__dirname // Directory of current script
__filename // Full path of current scriptsrc/
├── main.rs # Entry point and initialization
├── console.rs # Colored console implementation
├── repl.rs # REPL loop with colored output
├── runtime.rs # Node.js compatible APIs
├── module.rs # Module system (require)
└── engine.rs # Engine utilities
console.log("Hello from sm_runtime!");
console.log("Platform:", process.platform);
console.log("Node version:", process.version);
console.log("Timestamp:", Date.now());# Debug build
cargo build
# Release build
cargo build --release
# Run tests
cargo test- Rust 1.70+
- Mozilla SpiderMonkey (bundled via mozjs crate)
GPLv3