ESPACK v0.2.0
ESPACK v0.2.0 — self-extracting single-file ExternalObject bundles
Build-time packer + ES3 self-extracting loader so ExternalObject DLLs ship inside a single .jsx and materialize on disk at runtime, in the "1 + n" model:
- 1 shared esb64 accelerator DLL (
ESB64Native.dll, ~9.5 KB, WHATWG-exact) unpacked once per system into%LOCALAPPDATA%\espack\using the bundle's inlined ES3 base64 lane, then reused by every espack bundle on that machine. - n payload DLLs (
--embed, repeatable), each decoded by the accelerator (b64decodeToFile: native decode straight to disk — NUL-safe, no string channel) into%LOCALAPPDATA%\<bundle-name>\.
Runtime order: ES3 mode → inlined lane unpacks the accelerator (only if missing) → accelerator natively unpacks every payload → all DLLs load via ExternalObject. If the accelerator is unavailable (read-only cache, locked host), payloads fall back to the JSX lane transparently with the reason on ESPAK.lastError().
Features
- Deterministic, dependency-free Node packer (
espack-build.mjs): self-contained output — no$.evalFile, no#include ESPAK.attach()capability switch: start in ES3 fallback → extract → load → swap the library's hot functions to native; stay in ES3 with a surfaced error on any failure- Versioned extracted filenames + best-effort GC (a loaded DLL is locked until host exit)
- Integrity: size + versioned name; wrong-size files trigger re-extraction
- esb64 memo makes same-session re-extraction ~0 ms
Measured on Illustrator 30.6.0 (ExtendScript 4.5.6)
- JSX-lane decode: linear ~1 µs/base64 char, no engine wedge through 64 K (chunk 24,576)
- Accelerator extraction (one-time per system): ~13 ms for the 9.5 KB DLL
- Payload extraction: 3–10 µs (native
b64decodeToFile) - Load (skip-extract path): ~1.2–1.9 ms
- File BINARY I/O: byte-exact incl. NULs;
%LOCALAPPDATA%writes verified from JSX
Quick start
npm test # 28 Node tests + vendor-sync drift guard
node espack-build.mjs --embed MyDll.dll --out dist/MyBundle.jsx --name mybundle
npm run e2e # live end-to-end on Illustrator (requires the COM tool)Drop the emitted .jsx into Illustrator's Scripts folder (or run via COM/DoJavaScript); it installs ESPAK on $.global and extracts/loads on demand.
Consumers
- esb64 —
dist/ESB64.accel.jsx: self-referential bundle; its ES3 atob extracts the DLL that accelerates atob (btoa 16 K: 18.6 ms → 317 µs, 58.5×; atob 48 K: 66.8 ms → 957 µs, 69.8×) - eson —
dist/ESON.accel.jsx: auto-enables the native RFC-exact parse gate
Assets: ESPAK-demo.accel.jsx — a ready-to-run demo bundle (shared accelerator only) for live inspection.