@itslil/mobx
v7.0.0
Published
MobX 7.0.0 reimplemented in LilScript. Drop-in ESM/CJS/UMD runtime with official types.
Maintainers
Readme
@itslil/mobx
MobX 7.0.0, reimplemented in LilScript and published as a dependency-free drop-in.
This is not the official mobx package. It is an independent runtime that implements the [email protected] public API. Types are the official 7.0.0 declarations. Upstream core tests pass (769 passed, 11 pending, 0 failed on the last full Jest run).
Site: yeargun.github.io/mobxlil — sizes, throughput, and the size/perf tradeoffs.
npm install @itslil/mobximport { observable, computed, autorun, action } from "@itslil/mobx"
const count = observable.box(0)
const doubled = computed(() => count.get() * 2)
autorun(() => console.log(doubled.get()))
action(() => count.set(count.get() + 1))()Alias the import if you already write from "mobx":
// package.json
{
"dependencies": { "@itslil/mobx": "7.0.0" },
"overrides": { "mobx": "npm:@itslil/[email protected]" }
}What it is good at
| Lane | Raw | gzip-9 | Brotli-11 |
| --- | ---: | ---: | ---: |
| Official [email protected] ESM | 180,997 | 40,282 | 33,453 |
| Vite + Terser of official | 71,255 | 19,850 | 17,610 |
| @itslil/mobx production ESM | 65,664 | 18,690 | 16,736 |
| Closure ADVANCED of official | 48,686 | 15,393 | 13,701 |
Brotli is about 0.50× the official published ESM and 0.95× Vite+Terser of that same source. Closure ADVANCED of official is still smaller (~0.82× this package). That gap is explained on the site: this build keeps the reusable package ABI and compiles realistic-performance-first, and the current source is open-world JsValue bags, so LilScript property mangling does not rename value_ / observers_ the way Closure renames official internals.
Quiet Node v24.11.1 throughput versus [email protected] (NODE_ENV=production, 8 samples, first 2 discarded): 12/12 suites ≤ 1.05×, retained memory 0.98×, checksums equal. The automated npm run check bench can exceed 1.05× on map/decorators immediately after a long compile (thermal). Treat the quiet numbers as the product claim, not a single noisy CI sample.
Compatibility
- 78/78
[email protected]runtime exports - ESM, CJS (
NODE_ENVswitcher), and UMD artifacts, same layout as official - Official
mobx.d.tssurface - Some
fn.lengthvalues differ because LilScript emits rest wrappers. Call them with the documented arguments; do not branch on.length.
Zero runtime dependencies.
Rebuild
Compiled JavaScript in dist/ is what npm installs. Rebuilding from src/**/*.lil needs a release LilScript compiler next to this repo, or LILSCRIPT_COMPILER.
npm run build # development + production artifacts
npm run check # tests, types, mixed-version, bench, size, Playwright
npm run examples # http://127.0.0.1:4177/examples/License
MIT. See NOTICE.md.
