Properties, including methods
Owned fields and class methods can be renamed. Host names stay exact. That includes the names that would otherwise sit on a JavaScript prototype — when the type system owns them, they are safe to mangle.
Language · compiler · Lilpack
LilScript is a typed, compression-first language. The compiler mangles, reshapes, and scores a complete JavaScript artifact against the codec you pick — gzip, Brotli, or raw size. Lilpack is the Vite-based delivery path: fast reloads, a language server, the usual editor tools.
class Vector {
float x;
float y;
init(float x, float y) {
this.x = x;
this.y = y;
}
float lengthSquared() {
return this.x * this.x + this.y * this.y;
}
}
int[] values = [1, 2, 3, 4];
auto doubled = values.map((int value) => value * 2);
int sum = 0;
for (int i = 0; i < doubled.length; i++) {
sum += doubled[i];
}
Vector vector = new Vector(3.0, 4.0);
if (vector.lengthSquared() == 25.0) {
print(`sum=${sum}`);
}
var b=[1,2,3,4].map(a=>a*2|0);
var a=0,c=0;
while(a<b.length){
c=c+b[a]|0;
a=a+1|0;
}
console.log(`sum=${c}`)
01 · How it gets smaller
Minifiers rename locals after the objects already exist. LilScript proves what can disappear before JavaScript is spelled — then measures the finished file under the codec you chose.
Owned fields and class methods can be renamed. Host names stay exact. That includes the names that would otherwise sit on a JavaScript prototype — when the type system owns them, they are safe to mangle.
struct and class are not glue.
Non-escaping values scalar-replace into var /
let. Values that stay become compact arrays. That
helps transfer size, memory, and access cost.
javascript.cost_model is the score the search
actually uses. A shorter raw spelling can lose under Brotli.
Performance is a separate knob: size-first is the default;
performance-first keeps hotter shapes.
02 · Monaco · the VS Code editor
Two production pages. One is npm monaco-editor@0.56.
The other is the LilScript editor compiled from
entry.lil plus the monaco-editor-core catalog — not
monaco with a few files swapped. Microsoft’s TypeScript language
service is still on both sides.
03 · Libraries we actually port
Each card is a scoped contract: same behavior, Brotli-11 of the selected JavaScript, npm + Vite 8 unless noted. Open a card for the live pair, the project page, or the compare notes.
Compiled Lil editor + catalog versus npm monaco-editor. TypeScript
ts.worker is still Microsoft’s.
mix, wrap, stagger,
spring — same equations as npm motion@13. Not the
full DOM package.
Official js-framework-benchmark keyed table. Solid 2.0 versus the LilScript compile. Live pairs are on the SolidLil lab.
Complete ESM root namespace, aliases, and live array type.
MurmurHash 2 and 3, reusable root API, same checksums.
Full root entrypoint. Eligible on size and the 1.05× runtime gate.
Both published roots. Types let the wrappers disappear.
Published root. Eligible against Vite and Closure ADVANCED.
Geometric predicates. Large typed corpus, modest transfer cut.
Published browser entrypoint. Effectively even on Brotli.
Public API, 769 official tests. 17,159 B → 16,736 B Brotli versus Vite 8 Oxc of npm.
Parcel Market next to the Astro control. Same CSS and behavior.
Drop-in public API. Official jquery.min.js is still
the Brotli lane to beat. Public names stay a config choice.
GFM + CommonMark parse API. 660/660 HTML match, smaller than the parse-only official sources minified by Oxc, and 13% faster in Chromium. This port has no extension system.
How to read this. Brotli-11 of the selected
JavaScript, same lilscript-codec scorers. Kernels move
more than public libraries. mitt and clsx are currently a few bytes
larger. Subset ports (Preact, Zod, Acorn, Redux Toolkit) live on the
compare page and are labeled as such.
04 · Published ports
Each port has its own site: install the package, open the paired demos, read the receipts. The in-repo stage is still here for the rest of the corpus.
Solid 2.0 client and LSX. Official keyed table: 11,180 B → 3,862 B Brotli.
yeargun.github.io/solidlil motionlil16 paired browser fixtures. Carousel, spring, gestures, scroll.
yeargun.github.io/motionlil @itslil/mobxMobX 7 public API. Official tests pass; Vite 8 Oxc Brotli is the fair size lane.
yeargun.github.io/mobxlil @itslil/jqueryjQuery 3.7.1 public API. Published drop-in; official min is still 1.13× smaller on Brotli.
yeargun.github.io/jquerylil @itslil/marked
marked 18.0.10 parse API. 660 spec cases; 9,580 B vs parse-only
official Oxc 10,092 B, not the full npm file with use().
monaco-editor 0.56, submodule-by-submodule, plus the paired IDE.
yeargun.github.io/monacolil In-repo stageLastro, hashes, paired Closure cases, and the rest of the corpus on this site.
Browse every demo05 · Tooling
Closure’s Advanced mode is the closest ancestor. The Java stack around it is slow and awkward for everyday web work. LilScript is being built so reload, analysis, and editor support sit on par with the rest of the ecosystem.
lilpack dev turns candidate search off and keeps HMR
honest. Production uses the project lilscript.toml.
lilscript-lsp and the repo extension: highlight,
diagnostics, completion, hover, rename, format.
Codec, priority, mangling, inlining, layouts, chunks. The language page walks the ones that change behavior.
06 · Models, and the 5–10%
That was not the plan; it is just what we keep seeing. A library rewrite is often close to one-shot, and the compiled file is usually smaller once gzip or Brotli is applied. Across the ports we maintain, that cut is typically about 5% to 10%. The cards above are the measured exceptions and the near-ties — not a promise that every file will move that far.