txiki.js — The tiny JavaScript runtime
Overview
txikia (basque): small, tiny.
txiki.js is a small and powerful JavaScript runtime. It targets state-of-the-art ECMAScript and aims to be WinterCG compliant.
It’s built on the shoulders of giants: it uses QuickJS-ng as its JavaScript engine and libuv as the platform layer.
See it in action here:
WinterCG
txiki.js aims to be WinterCG compliant, you can track the progress here.
Runtime features
- TCP and UDP sockets
- Unix sockets / named pipes
- Signal handling
- File operations
- Child processes
- DNS (getaddrinfo)
- WASI
- Miscellaneous utility functions
See the full API documentation.
Other extras:
- Import directly from HTTP(S) URLs
- Import JSON files
- Builtin test runner
Standard library
The following modules compose the standard library:
Building
CMake is necessary.
NOTE: The txiki.js build depends on a number of git submodules (libffi, libuv and wasm3).
If you didn’t already clone this repository recursively, make sure you initialize these
submodules with git submodule update --init
before proceeding to the build.
GNU/Linux
Install dependencies (libcurl
, build-essential
, cmake
, makeinfo
, autoreconf
, libtool
):
# On Debian / Ubuntu
sudo apt install libcurl4-openssl-dev build-essential cmake autoconf texinfo libtool
macOS
Install dependencies (cmake
, autoconf
):
brew install cmake autoconf automake libtool texinfo
Unix systems
# Get the code
git clone --recursive https://github.com/saghul/txiki.js --shallow-submodules && cd txiki.js
# Compile it!
make
# Run the REPL
./build/tjs
Prerequisites
First make sure you have MSYS2 installed. The mingw64
and clang64
environments are currently tested.
Then install the required dependencies:
pacman -S git make pactoys
pacboy -S curl-winssl:p toolchain:p cmake:p ninja:p
Build
These commands must be run in a MinGW64 or clang64 shell.
make
This will build the executable just like on Unix. Note that at this point there are a number of dynamically linked libraries, so if you want to use the executable on a different system you’ll need to copy those too. Check the list with ldd build/tjs.exe
.
Versioning
At this time txiki.js uses calendar versioning with the form YY.MM.MICRO.