sveltelean
Version v0.18.0

How budgets work

  • Each package's yarn size builds its entries, writes budget and measured size to artifacts/size.json and exits with an error over budget; yarn verify runs it on every pull request.
  • A budget sits ten to fifteen percent above the value measured when it was set (behavior budgets: measured plus ten percent, rounded up to the next hundred bytes), so a regression fails CI and a compressor update of a few bytes does not.
  • A budget is raised only with the reason in the commit and a changeset (Methodology).

Behavior JavaScript

Each Tier 1 and Tier 2 registration module, Vite production build, shared kernel included. Brotli. The script also fails on a diagnostic marker in the bundle or a lost registration side effect.

SubjectEntryBudgetMeasuredHeadroomStatus
tabsvite1900 B brotli1839 B brotli61 Bwithin budget
menuvite2800 B brotli2771 B brotli29 Bwithin budget
listboxvite2600 B brotli2357 B brotli243 Bwithin budget
selectvite5300 B brotli5020 B brotli280 Bwithin budget
autocompletevite4000 B brotli3960 B brotli40 Bwithin budget
calendarvite5000 B brotli4594 B brotli406 Bwithin budget
date-pickervite10200 B brotli9476 B brotli724 Bwithin budget
toastvite1800 B brotli1616 B brotli184 Bwithin budget
treevite2400 B brotli2140 B brotli260 Bwithin budget
slidervite1700 B brotli1549 B brotli151 Bwithin budget
inputvite2000 B brotli1808 B brotli192 Bwithin budget
checkbox-groupvite1600 B brotli1456 B brotli144 Bwithin budget
field/validationvite1900 B brotli1714 B brotli186 Bwithin budget
toggle-groupvite2200 B brotli1932 B brotli268 Bwithin budget
toolbarvite1800 B brotli1706 B brotli94 Bwithin budget
splittervite2000 B brotli1908 B brotli92 Bwithin budget
sortablevite4300 B brotli3833 B brotli467 Bwithin budget
menu/contextmenuvite1800 B brotli1631 B brotli169 Bwithin budget
file-dropvite3300 B brotli2983 B brotli317 Bwithin budget
hover-cardvite2000 B brotli1985 B brotli15 Bwithin budget
menubarvite2100 B brotli2063 B brotli37 Bwithin budget
hintvite2900 B brotli2687 B brotli213 Bwithin budget
copyvite1300 B brotli1291 B brotli9 Bwithin budget
findablevite1900 B brotli1887 B brotli13 Bwithin budget
select+searchvite5500 B brotli5458 B brotli42 Bwithin budget
select+search+createvite5600 B brotli5575 B brotli25 Bwithin budget
anchor-positionvite1850 B brotli1825 B brotli25 Bwithin budget
popover/anchorvite1450 B brotli1400 B brotli50 Bwithin budget

Script: packages/primitives/scripts/size.mjs; values from packages/primitives/artifacts/size.json.

Method

ESM, target es2022, gzip level 9, brotli quality 11 (node:zlib). Tier 1 and Tier 2 entries are dist/<name>/register.js with @svelte-lean/core from the workspace. "vite" builds the public specifier with Vite in production mode; the brotli budget applies to it and it must list no diagnostics and keep the registration. "esbuild" bundles the same file with esbuild under the production condition; it keeps development helpers core references from folded DEV gates and is recorded for comparison. "core-only" is a registration with an empty handler. "native-only" imports the root entry and a Tier 0 subpath and must contain no runtime.

Kernel

The @svelte-lean/core root entry (production condition and runtime-detected environment) and what one Tier 1 behavior pulls in under Vite. Gzip, all three.

SubjectEntryBudgetMeasuredHeadroomStatus
productionesbuild2750 B gzip2637 B gzip113 Bwithin budget
defaultesbuild2750 B gzip2726 B gzip24 Bwithin budget
consumervite2750 B gzip1239 B gzip1511 Bwithin budget
reorderesbuild1950 B gzip1752 B gzip198 Bwithin budget

Script: packages/core/scripts/size.mjs; values from packages/core/artifacts/size.json.

Method

ESM, target es2022, gzip level 9, brotli quality 11 (node:zlib). "production" and "default" are dist/index.js with every export, esbuild bundle + minify, under the production export condition and the runtime-detected env module respectively. "consumer" is one Tier 1 behavior using parts and emit, built with Vite in production mode; it must list no diagnostics. "reorder" is dist/reorder.js (the @svelte-lean/core/reorder subpath), esbuild bundle + minify.

Table entry points

Every @svelte-lean/table entry bundled alone with esbuild, Svelte excluded. Shared code counts once per entry here; a consumer bundler de-duplicates it. Gzip.

SubjectEntryBudgetMeasuredHeadroomStatus
rendererdist/index.js25200 B gzip25080 B gzip120 Bwithin budget
headlessdist/core.js2700 B gzip2665 B gzip35 Bwithin budget
enginedist/table.svelte.js3600 B gzip3538 B gzip62 Bwithin budget
groupingdist/grouping.js2400 B gzip2149 B gzip251 Bwithin budget
pivotdist/pivot.js600 B gzip526 B gzip74 Bwithin budget
editingdist/editing.js800 B gzip707 B gzip93 Bwithin budget
csvdist/export.js850 B gzip741 B gzip109 Bwithin budget
clipboarddist/clipboard.js1000 B gzip895 B gzip105 Bwithin budget
serverdist/server.js425 B gzip369 B gzip56 Bwithin budget
statedist/state.js900 B gzip796 B gzip104 Bwithin budget
stylesdist/style.css9100 B gzip9086 B gzip14 Bwithin budget

Script: packages/table/scripts/size.mjs; values from packages/table/artifacts/size.json.

Method

Each entry bundled independently with esbuild (bundle + minify, ESM); shared code is counted per entry here and de-duplicated by consumer bundlers. Svelte peer runtime excluded. gzip level 9 / brotli quality 11 (node:zlib). Budgets are gzip.

Styles

The resolved, minified index.css. Gzip, whole package; single files are listed on Results without a budget.

SubjectEntryBudgetMeasuredHeadroomStatus
index.css (resolved)–34700 B gzip31502 B gzip3198 Bwithin budget

Script: packages/styles/scripts/size.mjs; values from packages/styles/artifacts/size.json.

Method

bytes = shipped source; minified = comments and redundant whitespace removed by scripts/check.mjs minify (a bundler minifier may be slightly smaller); gzip level 9 and brotli quality 11 of the minified text. standalone = the file with the files it @imports inlined. "index.css (resolved)" inlines every @import once, depth first, and carries the budget.

Targets

Initial targets of ADR 0003, aspirational, quoted from the ADR and compared with the measured values.

Tabs < 1 kB brotli, basic Menu ~1–2 kB, entire common behavior set < 5 kB.
SubjectTarget (aspirational)MeasuredEnforced budgetResult
Tabs registration with the kernel1000 B brotli1839 B brotli1900 B brotliabove the target, within the enforced budget
Menu registration with the kernel1000–2000 B brotli2771 B brotli2800 B brotliabove the range, within the enforced budget
Entire common behavior set (tabs and menu on one page, one kernel)5000 B brotli4600 B brotlinone: measured by the tabs-and-menu fixture, not gatedwithin the target
Native primitives (button, dialog, popover, accordion, checkbox, switch, radio group)no behavior JavaScript0 B brotlithe native-only fixture forbids every runtime modulemet

A target is a direction; the enforced budget is the gate a release may not exceed.

Tier budgets

Each tier is a runtime budget, not a byte budget (ADR 0003).

TierNameBudget
0NativeNo runtime JavaScript, no instance listeners, no instance state objects
1Delegated micro-behaviorOne shared listener per required event type; no per-root listener; DOM-encoded state
2Lazy scoped controllerWeakMap state created on first interaction; AbortController-scoped listeners; cleanup
3Application-controlledSvelte state owned by the application; never required by a default primitive

Listener budget

No number in a file holds these budgets; an exact assertion does.

  • Tier 1: the per-type listener counts for a thousand tabs roots equal those for one root, on the runtime's account and on an independent count of every addEventListener call (listeners.spec.ts). Live counts: Results, Proof.
  • Tier 2 (select, autocomplete): no state for untouched roots (autocomplete.test.ts, select.test.ts); zero controllers after load for a hundred roots in Chrome, one per interacted root, released on close and on focus loss (lazy.spec.ts). Their register modules have the brotli budgets above.