Skip to content

Aclevo/VibeMonkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VibeMonkey

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.

Features

  • 🎨 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

Installation

cargo build --release

Usage

REPL Mode

./target/release/sm_runtime
Welcome 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!

Run a File

./target/release/sm_runtime script.js

Console API

console.log("Regular message");      // White
console.error("Error message");      // Red
console.warn("Warning message");     // Yellow
console.info("Info message");        // Cyan
console.debug("Debug message");      // Gray

Runtime APIs

process Object

process.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 code

Date Object

Date.now()  // Current timestamp in milliseconds

Module System

// CommonJS style (work in progress)
const module = require('./my-module');

// Available globals
__dirname   // Directory of current script
__filename  // Full path of current script

Project Structure

src/
├── 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

Example Scripts

test.js

console.log("Hello from sm_runtime!");
console.log("Platform:", process.platform);
console.log("Node version:", process.version);
console.log("Timestamp:", Date.now());

Building from Source

# Debug build
cargo build

# Release build
cargo build --release

# Run tests
cargo test

Requirements

  • Rust 1.70+
  • Mozilla SpiderMonkey (bundled via mozjs crate)

License

GPLv3

Acknowledgments

About

A vibecoded Javascript runtime using Rust and SpiderMonkey.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors