• Stars
    star
    2,335
  • Rank 18,868 (Top 0.4 %)
  • Language
    C
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 4 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tiny JavaScript runtime

txiki.js — The tiny JavaScript runtime

Overview

txikia (basque): small, tiny.

txiki.js is a small and powerful JavaScript runtime. It's built on the shoulders of giants: it uses QuickJS as its JavaScript engine, libuv as the platform layer, wasm3 as the WebAssembly engine and curl as the HTTP / WebSocket client.

It targets ECMAScript 2020 and implements many web platform features.

See it in action here:

Building a tiny JavaScript runtime with QuickJS

Getting started

First head over to building and build the runtime.

$ ./build/tjs eval "console.log('hello world')"
hello world
$

If you want to run a script you can use tjs run:

$ ./build/tjs run examples/hello_world.js
hello world
$

Explore all the options:

$ ./build/tjs --help

Features

Support for the ES2020 specification plus some ES2020+ features like top level await.

Web Platform APIs

(1): All of them are async.

(2): No subtle support.

(3): No tables, globals or memory support.

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
  • BigFloat and BigDecimal extensions
  • Builtin test runner

Standard library

The following modules compose the standard library:

Supported platforms

  • GNU/Linux
  • macOS
  • Windows (beta)
  • Other Unixes (please test!)

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):

# On Debian / Ubuntu
sudo apt install libcurl4-openssl-dev build-essential cmake

macOS

Install dependencies (cmake, autoconf):

brew install cmake autoconf

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

Windows (beta)

Windows support it's currently considered beta. Tests do pass, but building it is not as easy as it should be.

Building has only been tested in 64bit Windows.

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.

Running the tests

Make sure these commands are run from Windows Terminal (mintty, what MSYS2 provides is not supported).

make test

Versioning

At this time txiki.js uses calendar versioning with the form YY.MM.MICRO.



Built with ❤️ by saghul and these awesome contributors.

More Repositories

1

pyuv

Python interface for libuv
C
1,112
star
2

pythonz

Python installation manager supporting CPython, Stackless, PyPy and Jython
Python
749
star
3

aiodns

Simple DNS resolver for asyncio
Python
513
star
4

sipp-scenarios

SIPp scenarios I use for testing SIP stuff
256
star
5

lxd-alpine-builder

Build Alpine Linux images for LXD
Shell
168
star
6

python-fibers

Lightweight cooperative microthreads for Python
C
160
star
7

pycares

Python interface for c-ares
Python
157
star
8

uvent

A gevent core implemented using libuv
Python
136
star
9

wasi-lab

Some WASI experiments 🧪☣️☠️
C
116
star
10

evergreen

Cooperative multitasking and i/o for Python
Python
114
star
11

CallRoulette

A WebRTC demo using Python (asyncio + aiohttp) as the backend
JavaScript
103
star
12

sjs

Skookum JS: a JavaScript runtime
C
97
star
13

tornaduv

Tornado IOLoop implemented with pyuv
Python
96
star
14

aiouv

A PEP-3156 compatible event loop
Python
71
star
15

uvwsgi

Python WSGI server
Python
37
star
16

qrfcview-osx

RFC viewer for OSX
C++
36
star
17

node-abstractsocket

Abstract namespace socket support for Node
JavaScript
24
star
18

libuv-chat

Something something libuv something
C
21
star
19

twisted-pyuv

Twisted reactor implemented with pyuv
Python
19
star
20

njk

Powerful portable templating in less than 1MB
C
19
star
21

cordova-plugin-audioroute

iOS audio route change events and more for Cordova
Objective-C
17
star
22

twitterbot

A simple Twitter bot retwitting the given hashtag
Python
14
star
23

TunnelIt

SSH reverse forwarder using Twisted
Python
14
star
24

sipsimple-examples

SIPSIMPLE SDK examples
Python
13
star
25

macOS-setup

My macOS setup, automated with Ansible
Shell
11
star
26

dotvim

My vim configuration
Vim Script
11
star
27

SIPwPing-server

Server providing a simple RESTful API to ping SIP servers
Python
11
star
28

shline

A simple powerline style prompt for my bash shell
Python
10
star
29

tornado-backdoor

Interactive Python interpreter over TCP for Tornado applications
Python
9
star
30

pysophia

WIP: Python (CFFI) bindings for Sophia
Python
9
star
31

jitsi-meet-api

Jitsi Meet external API wrapper
JavaScript
8
star
32

sandbox-html

JavaScript
7
star
33

gyn

Generate You some Ninja
Python
6
star
34

uttp

[Unfinished] libuv based HTTP server
C
6
star
35

dotfiles

My dotfiles
Shell
6
star
36

sylk-in-a-box

SylkServer + Sylk WebRTC client, in a box
Nginx
5
star
37

vim-colortoggle

A ViM plugin for toggling background and color scheme
Vim Script
5
star
38

yass

Yet Another SIP Softphone (archive)
Python
3
star
39

python-imap-prowl

A python script to sendpush notifications when new emails via Prowl push service
3
star
40

evergreen-requests

Evergreen + Requests
Python
3
star
41

notes

Notes about anything and everything
Python
2
star
42

jcfg

Jinja templates for your configuration files
Python
2
star
43

sipstache

The Ultimate Virtual Moustache Toolkit (TM)
Python
2
star
44

python-wsserver

[DEAD] A simple, single threaded WebSocket server
Python
2
star
45

python-asiri

GPIO interface for Asiri board with a MCP230XX chip
Python
1
star
46

python-imaplib2

Python threaded IMAP4 client module by Piers Lauder
Python
1
star
47

attachMediaStream

Simple abstraction for handling differences between browsers for attaching a media stream to a video element
JavaScript
1
star
48

gvoice-sip-status

Google App Engine application to query the availability of Google Voice inbound SIP service
Python
1
star
49

docker-nginx-webdav

Docker image using nginx to serve files over WebDAV
1
star
50

sipwping-django

Web frontend for SIPwPing server, based on Django
JavaScript
1
star