Jade is an educational JavaScript runtime implementation demonstrating core concepts used in production runtimes like Node.js and Bun. This project serves as a foundation for understanding low-level runtime construction using:
- JavaScriptCore (JSC) from WebKit for JS execution
- libuv for cross-platform asynchronous I/O
- C for native bindings and system integration
Current State: Basic prototype supporting core runtime features
sudo apt update
sudo apt install \
libwebkit2gtk-4.0-dev \
libuv1-dev \
cmake \
build-essential
brew install cmake libuv
xcode-select --install # For Xcode command line tools
# Clone repository
git clone https://github.com/dexter-xD/jade.git
cd jade
# Configure build
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
# Compile
make
# Verify build
./jade --version
βββββββββββββββββββββββββ
β JavaScript β
β (User Code) β
βββββββββββββ¬ββββββββββββ
β
βββββββββββββΌββββββββββββ βββββββββββββββββββββ
β JavaScriptCore (JSC) ββββΆβ System β
β JS Execution β β APIs β
βββββββββββββ¬ββββββββββββ βββββββββββββββββββββ
β β²
βββββββββββββΌββββββββββββ β
β libuv Event βββββββββββ
β Loop β
βββββββββββββββββββββββββ
-
JSC Engine Layer
- Creates/manages JS contexts
- Handles JS code parsing/execution
- Manages JS/C value conversions
-
libuv Event Loop
- Timer management (
setTimeout
) - Filesystem operations (planned)
- Network I/O (planned)
- Thread pool integration
- Timer management (
-
System API Bridge
- Console I/O implementation
- Future: File system access
- Future: Network interfaces
- Core event loop infrastructure
- Basic JS execution context
console.log
/console.error
bindingssetTimeout
implementation- Memory-safe value passing between JS/C
- Build system with CMake
- Proper error propagation JS β C
- File system API stubs
- Module resolution prototype
./build/jade path/to/script.js
// Basic functionality demo
console.log("Jade Runtime Initialized");
setTimeout(() => {
console.error("Async operation completed");
}, 1000);
console.log("Main thread execution");
Expected Output:
LOG: Jade Runtime Initialized
LOG: Main thread execution
ERROR: Async operation completed
- No Promise support
- Limited error handling
- Single-file execution only
- Basic memory management
# Run all tests
cd build && ctest --output-on-failure
# Specific test target
./test/runtime_tests
# Generate coverage report
mkdir -p coverage
gcovr --exclude tests/ --html-details coverage/report.html
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1
make clean && make
- Basic JS execution context
- Event loop scaffolding
- Console API implementation
- File system API stubs
- Error handling system
- Memory management audits
- Cross-platform testing
- Benchmarking suite
- Promise integration
- HTTP server prototype
- WASM support exploration
- Debugger protocol
- Core runtime improvements
- Additional system APIs
- Test coverage expansion
- Documentation improvements
- Cross-platform fixes
- Create issue for discussion
- Fork repository
- Use feature branch workflow:
git checkout -b feat/features
- Follow coding standards:
- C11 standard
- 4-space indentation
- Doxygen-style comments
- Submit PR with:
- Implementation details
- Test cases
- Documentation updates
Issue | Workaround | Priority |
---|---|---|
Memory leaks in timer callbacks | Manual cleanup in tests | High |
No Windows support | Use WSL/Linux VM | Medium |
Limited error messages | Check debug build output | Low |
Jade is maintained by dexter as an educational resource for understanding low-level runtime development. Not affiliated with Node.js, Bun, or WebKit projects.
If you find this project helpful, consider buying me a coffee! β