diff --git a/CHANGELOG.md b/CHANGELOG.md index 2093e53..8282b20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,160 @@ This project follows [Semantic Versioning](https://semver.org/). --- --- +## [4.2.0] — 2026-09-06 + +Making the runtime loud where it used to be quiet. Every item below is a case +where the library did the wrong thing — or the right thing for an unstated +reason — without saying so, and the cost was paid by whoever had to guess. Two +widened signatures, one new runtime behaviour, four new development warnings, +and a production bundle that is *smaller* than 4.1.0 despite all of them. No +breaking changes. + +### Fixed + +- **Development diagnostics now actually compile out of production builds.** + They did not. The dev gate led with a `globalThis.__SIBU_DEV__` lookup, and a + member expression is not something a bundler can substitute or fold — so + nothing was ever eliminated and every warning string the library can emit + shipped to every consumer, to be tested at runtime and never printed. + + The gate is now a statically foldable constant, and the warning helpers test + the build-time define inline so their bodies fold to nothing even in a + published `dist` chunk. A production consumer's bundle no longer contains the + diagnostics at all — so the core runtime is smaller than 4.1.0 despite + everything added below: + + | gzipped, minified, `__SIBU_DEV__: false` | 4.1.0 | 4.2.0 | + | --- | --- | --- | + | `sibujs` | 26,895 | **25,836** | + | `sibujs/plugins` | 28,877 | **28,615** | + | `sibujs/ui` | 16,462 | **16,112** | + | `dist/cdn.global.js` | 27,289 | **26,224** | + | application exercising every warning below | 33,658 | **32,958** | + + `tests/treeshaking-dev-diagnostics.test.ts` bundles for real and fails if any + diagnostic string survives, and `tests/dist-artifacts.test.ts` asserts the + same thing against the built `dist/` files — the source-level test could not + see the CDN bundle, which is exactly where the leak hid. Development builds + grow, which is where the diagnostics are supposed to be: the same application + is 53,079 bytes gzipped with `__SIBU_DEV__: true`. + +- **The CDN bundle shipped every diagnostic and could not be stripped.** The + CDN build applied no `__SIBU_DEV__` define at all, and a + ` +``` + +Production, with diagnostics compiled out rather than merely disabled: + ```html +``` + +Either way, the API is on `window.Sibu`: + +```html ``` +Develop against `cdn.dev.global.js` and swap the one line to ship. The runtime +behaviour is identical; only the warnings differ. + +A bundled app needs neither file — import from `"sibujs"` and let your bundler +define `__SIBU_DEV__` per build (the Vite and webpack plugins in `sibujs/build` +do this for you). The two CDN files exist because a ` ``` +> **Development vs production.** The snippet above loads the production bundle, +> where development warnings are compiled out. While building, load +> `dist/cdn.dev.global.js` instead — same runtime, warnings on — and switch back +> to `dist/cdn.global.js` to ship. See the CDN section of the README. + A complete, runnable version (multiple islands and strategies) lives in [`examples/islands.html`](../examples/islands.html). diff --git a/examples/islands.html b/examples/islands.html index 871e8b6..40c9c82 100644 --- a/examples/islands.html +++ b/examples/islands.html @@ -43,8 +43,13 @@
Seconds on screen: 0
- +