jsc-compile
v1.0.0
Published
Compile JavaScript to V8 bytecode archives via Docker multi-stage builds
Maintainers
Readme
jsc-compile
Compile JavaScript to V8 bytecode — protect your source code and improve startup time.
Takes a bundled .js file and produces a zstd-compressed .jsc
archive with pre-compiled V8 bytecode for 20+ Node.js LTS versions
and 20+ Electron/VS Code versions, on linux-x64, win32-x64,
and linux-arm64. No source code is shipped — only bytecode.
Install
npm install -g jsc-compileQuick start
# 1. Bundle your project (e.g. with esbuild)
esbuild src/index.js --bundle --platform=node --format=cjs --outfile=dist/mylib.bundle.js
# 2. Compile to bytecode
jsc-compile dist/mylib.bundle.js -o dist/mylib.jsc
# Output:
# mylib.jsc — compressed bytecode archive (all targets)
# index.js — self-contained runtime loaderThe generated loader has zero dependencies. Point your
package.json at it and ship:
{
"main": "index.js"
}How it works
mylib.bundle.js
│
▼ Generates a multi-stage Dockerfile
│
▼ Docker BuildKit compiles in parallel:
│ ├─ Node 24.x, 22.x, 20.x × linux-x64
│ ├─ Node 24.x, 22.x, 20.x × win32-x64 (via Wine)
│ ├─ Node 24.x, 22.x, 20.x × linux-arm64 (via QEMU)
│ ├─ Electron 33.x, 32.x … × linux-x64
│ ├─ Electron 33.x, 32.x … × win32-x64 (via Wine)
│ └─ Electron 33.x, 32.x … × linux-arm64 (via QEMU)
│
▼ Packs all .jsc into a single zstd-compressed archive
│
├─ mylib.jsc (~5% of raw size)
└─ index.js (~2 KB, self-contained)At runtime the loader decompresses the archive, selects the bytecode
matching the current Node/Electron version and platform, patches the
V8 header, and loads it via vm.Script. No temp files, no native
addons, no dependencies.
CLI options
jsc-compile <input>.js [options]| Option | Default | Description |
|---|---|---|
| -o, --output <file> | <input>.jsc | Output archive path |
| --no-electron | — | Skip Electron/VS Code targets |
| --no-node | — | Skip Node.js LTS targets |
| --no-local | — | Skip local Node.js version |
| --no-wsl | — | Run Docker directly instead of via WSL (Windows) |
| --docker-context <name> | — | Use a specific Docker context |
Prerequisites
- Node.js >= 22
- Docker with BuildKit support
- WSL on Windows (Docker commands are forwarded through WSL)
- Optionally, a named Docker context for remote builds
(
--docker-context my-builder)
Archive format
[4 bytes: index length (LE uint32)]
[N bytes: JSON index]
[remaining: concatenated .jsc blobs]
└─ all zstd compressedThe JSON index maps keys like node_22.14.0_linux-x64 or
electron_33.4.0_win32-x64 to { offset, size } entries.
License
ISC
