- Notifications
You must be signed in to change notification settings - Fork58
wasmerio/winterjs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
WinterJS isblazing-fast JavaScript server that runs Service Workers scripts according to theWinter Community Group specification.
WinterJS is able to handle up to 100,000 reqs/s in a single laptop (seeBenchmark).
Note: WinterJS is not officially endorsed by WinterCG, despite sharing "Winter" in their name. There are manyruntimes supporting WinterCG, WinterJS being one among those.
The WinterJS server is published in Wasmer aswasmer/winterjs
.
You can run the HTTP server locally with:
wasmer run wasmer/winterjs --net --mapdir=tests:tests tests/simple.js
Wheresimple.js
is:
addEventListener('fetch',(req)=>{req.respondWith(newResponse('hello'));});
WinterJS needs to build SpiderMonkey from source as part of its own build process.Please follow the steps outlined here to make sure you are ready to build SpiderMonkey:https://github.com/wasmerio/mozjs/blob/master/README.md.
You also need to do this before installing WinterJS withcargo install
, which builds WinterJS from the source instead of downloading pre-built binaries.
Also, when building WinterJS in debug mode, you need to have NodeJS and npm installed and runnpm install
beforehand.This is required since debug builds of WinterJS also build the TypeScript code insrc/builtins/internal_js_modules
.Release builds use the existing, pre-compiled*.js
sources in that directory.This was done to simplify installing WinterJS withcargo install
.If you update the TypeScript sources, make sure to update the*.js
sources by building at least once in debug mode and commit the updated*.js
files.
Once you can build SpiderMonkey, you simply need to runcargo build
as usual to build WinterJS itself.
You can install WinterJS natively with:
cargo install --git https://github.com/wasmerio/winterjs winterjs
Once you have WinterJS installed, you can simply do:
winterjs tests/simple.js
And then access the server inhttps://localhost:8080/
WinterJS is powered bySpiderMonkey,Spiderfire andhyperto bring a new level of awesomeness to your Javascript apps.
WinterJS is using theWASIX standard to compile to WebAssembly. Please note that compiling to WASIX is currently a complex process. We recommend using precompiled versions fromwasmer/winterjs
, but please open an issue if you need to compile to WASIX locally.
WinterJS is fully compliant with the WinterCG spec, although the runtime itself is still a work in progress.For more information, see the API Compatibility section below.
This section will be updated as APIs are added/fixed.If an API is missing from this section, that means that it is still not implemented.
You can check a more detailed list here:https://runtime-compat.unjs.io/
The following words are used to describe the status of an API:
- ✅ Stable - The API is implemented and fully compliant with the spec. This does not account for potential undiscovered implementation errors in the native code.
- 🔶 Partial - The API is implemented but not fully compliant with the spec and/or there are known limitations.
- ❌ Pending - The API is not implemented yet.
API | Status | Notes |
---|---|---|
console | ✅ Stable | |
fetch | ✅ Stable | |
URL | ✅ Stable | |
URLSearchParams | ✅ Stable | |
Request | ✅ Stable | |
Headers | ✅ Stable | |
Response | ✅ Stable | |
Blob | ✅ Stable | |
File | ✅ Stable | |
FormData | ✅ Stable | |
TextDecoder | ✅ Stable | |
TextDecoderStream | ✅ Stable | |
TextEncoder | ✅ Stable | |
TextEncoderStream | ✅ Stable | |
ReadableStream and supporting types | ✅ Stable | |
WritableStream and supporting types | ✅ Stable | |
TransformStream and supporting types | 🔶 Partial | Back-pressure is not implemented |
atob | ✅ Stable | |
btoa | ✅ Stable | |
performance.now() | ✅ Stable | |
performance.timeOrigin | ✅ Stable | |
crypto | ✅ Stable | |
crypto.subtle | 🔶 Partial | Only HMAC, MD5 and SHA algorithms are supported |
The following (non-WinterCG) APIs are implemented and accessible in WinterJS:
API | Status | Notes |
---|---|---|
Service Workers Caches API | ✅ Stable | Accessible viacaches .caches.default (similar toCloudflare workers) is also available.The current implementation is memory-backed, and cached responses willnot persist between multiple runs of WinterJS. |
About
Winter is coming... ❄️
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.