โ ๏ธ Early stage of development.
My own JavaScript runtime - currently, just randomly messing around with v8 engine in C++. Very unstable as I learn how things work together.
- Try to bind SWC (written in Rust) into my C++ codebase
- Integrate my async IO library for runtime's event loop: luxio (renamed to
pandio
, runtime will use updated version soon). - Create timers
- Clunky TCP support
- Basic support for ES6 imports
- Improve TCP module
- Improve memory management and fix potential leaks
- File system module
Current state example:
import {
assert,
assertThrows,
assertStrictEqual
} from 'std:assert';
import { tcpListen } from 'std:net';
function willThrow() {
throw new Error("Some error");
}
Runtime.argv.forEach(item => {
console.log(`Arg: ${item}`);
});
assert(2 + 2 == 4);
assertThrows(willThrow);
assertStrictEqual(2, 2);
console.log(`Platform is ${Runtime.platform} and pid is: ${Runtime.pid}`);
console.log(`Cwd is: ${Runtime.cwd()} and runtime version is: ${Runtime.version}`);
console.log(`Dirname: ${import.meta.dirname}`)
console.log(`Filename: ${import.meta.filename}`);
console.log(`Url: ${import.meta.url}`);
tcpListen((socket) => {
console.log("Client connected");
setTimeout(() => {
socket.close();
}, 5 * 1000);
socket.read((chunk) => {
console.log(`Received data`);
const response = `<h1>${chunk}</h1>`; // echo HTTP request
socket.write(`HTTP/1.1 200 OK\r\nContent-Length: ${response.length}\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n`);
socket.write(response);
});
}, 8000);
Distributed under the MIT License. See LICENSE
for more information.