Skip to content

chore: rewrite bundle-size with valof, and budget each import by what it adds - #69

Merged
jo16oh merged 52 commits into
mainfrom
chore/bundle-size-valof
Oct 16, 2026
Merged

jo16oh merged 52 commits into
mainfrom
chore/bundle-size-valof

Conversation

@jo16oh

@jo16oh jo16oh commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Why

  • Each bundle was compared with the core's budget plus its increment, so it passed by using the core's unused budget. Every byte the core grew took a byte from every other bundle's room.

    + Enum   1,370 B  ≤ 1024 + 384   (+474 measured, +384 nominal)
    
  • The production checks searched the bundle for three development strings and Number.isNaN. Renaming a function or a message silenced them, and new development code went unchecked.

What changed

  • Cap the core by its whole size, and every other bundle by what it adds to the measured core (added by Enum +474 B / +640 B).
  • Raise the increments to Equals +256, Enum +640 and All +1024. Trait stays at +256.
  • Check every bundle by size. DevCodeKeptError fails a bundle whose source reads NODE_ENV while production and development minify to the same size. AddsNothingError fails a bundle that adds no library code to the base.
  • Keep the --json keys and shape, so replace-bundle-size-claims reads the same numbers.
  • Split scripts/bundle-size.ts into scripts/bundle-size/, modelling the bundles, the measurements and the report as valof values.
  • Report failures as better-result Results, adding it as a dev dependency.
  • Add pipe, flow and tap in scripts/shared/pipe, with type tests generated for every overload. flow can end in a sink such as GenAwait, which Result.gen takes with yield*.
  • Pin the scripts to the released valof through #valof, and check them against src before each release.

jo16oh added 30 commits October 15, 2026 11:08
@jo16oh jo16oh added the skip-changelog left out of the generated release notes label Oct 15, 2026
@jo16oh
jo16oh merged commit 58a1996 into main Oct 16, 2026
3 checks passed
@jo16oh
jo16oh deleted the chore/bundle-size-valof branch October 16, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog left out of the generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant