@elurjs/kit 2.4.5 → 2.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,47 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to Nix.js Kit are documented in this file.
3
+ All notable changes to Elur Kit are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.4.7]
9
+
10
+ ### Changed
11
+
12
+ - **Client entry now defers hydration with `requestIdleCallback`** — the
13
+ auto-generated `entry-client.ts` wraps `hydrateIslands(registry)` in
14
+ `requestIdleCallback(hydrate, { timeout: 2000 })` (with a `setTimeout`
15
+ fallback) so the browser can paint the server-rendered HTML before
16
+ hydrating islands. This reduces LCP element render delay on mobile
17
+ devices where the main thread was blocked by synchronous hydration.
18
+ Islands with directive `"load"` already have SSR-rendered DOM, so
19
+ users see content immediately — hydration only adds interactivity.
20
+
21
+ ## [2.4.6]
22
+
23
+ ### Fixed
24
+
25
+ - **`isSSR()` always returned `false`** — the kit's `ssr-flag.ts` used
26
+ `Symbol.for("@elurjs/core/reactivity-state")` while `@elurjs/core` < 3.5.1
27
+ used `Symbol.for("elur/reactivity-state")`. The mismatched symbols meant
28
+ the kit's `setSSR(true)` during `renderToString` never wrote to the core's
29
+ reactivity state, so `isSSR()` read `undefined` and defaulted to `false`.
30
+ Fixed in `@elurjs/core@3.5.1` which now namespaces its internal symbols
31
+ under `@elurjs/core/*`. Peer dependency bumped to `^3.5.1`.
32
+
33
+ ### Changed
34
+
35
+ - **`happy-dom` re-added as a test-only `devDependency`** — it was fully
36
+ removed in v2.4, but 5 client-side test suites (`island.test.ts`,
37
+ `island-reactive-array.test.ts`, `island-client-only.test.ts`,
38
+ `client-router.test.ts`, `client-router-a11y.test.ts`) still imported it
39
+ and failed with `ERR_MODULE_NOT_FOUND`. It is now back **only** in
40
+ `devDependencies` to provide a DOM environment for those tests. It is
41
+ never imported by `src/`, never referenced by either vite build config,
42
+ and never shipped in the published bundle (`files` contains only
43
+ `dist/lib`). `test/happy-dom-optional.test.ts` guards this invariant.
44
+
8
45
  ## [2.4.4]
9
46
 
10
47
  ### Fixed
package/README.md CHANGED
@@ -191,11 +191,17 @@ Options:
191
191
  manifest, no variants, no `<picture>`). The registry state is now in a
192
192
  dedicated shared chunk (`image/registry.js`) that both the CLI and the
193
193
  library import, ensuring a single module instance.
194
- - **`happy-dom` fully removed** — the kit no longer depends on
195
- happy-dom in any form. SSR uses the core's DOM-free
194
+ - **`happy-dom` removed from the runtime** — the kit no longer depends on
195
+ happy-dom at runtime. SSR uses the core's DOM-free
196
196
  `renderToString` (`@elurjs/core/server`) directly. The legacy DOM
197
197
  fallback (`renderWithDom`) was deleted along with all `external`/
198
- `globals` references in the vite build configs.
198
+ `globals` references in the vite build configs. `happy-dom` is kept
199
+ **only** as a `devDependency` to provide a DOM environment for the
200
+ client-side test suites (`island.test.ts`, `client-router.test.ts`,
201
+ ...); it is never imported by `src/`, never referenced by either vite
202
+ build config, and never shipped in the published bundle (`files`
203
+ contains only `dist/lib`). See
204
+ `test/happy-dom-optional.test.ts` for the guard that enforces this.
199
205
  - **`raw()` now supports server rendering** — added
200
206
  `ELUR_RENDER_PROTOCOL.renderServer` to `raw()` so it works with the
201
207
  core's DOM-free SSR (previously relied on the happy-dom fallback).
package/dist/lib/cli.cjs CHANGED
@@ -211,7 +211,15 @@ function buildEntrySource(islands, outFile, hydrateImport = "@elurjs/kit/island"
211
211
  const islandHydration = registryLines ? `const registry = {
212
212
  ${registryLines}
213
213
  };
214
- hydrateIslands(registry);
214
+ // Defer hydration until the browser is idle so the first paint is not
215
+ // blocked. Islands with directive "load" already have SSR-rendered DOM,
216
+ // so the user sees content immediately — hydration only adds interactivity.
217
+ const hydrate = () => hydrateIslands(registry);
218
+ if ("requestIdleCallback" in window) {
219
+ requestIdleCallback(hydrate, { timeout: 2000 });
220
+ } else {
221
+ setTimeout(hydrate, 0);
222
+ }
215
223
  document.addEventListener("elur:rendered", () => {
216
224
  cleanupHydratedIslands();
217
225
  hydrateIslands(registry);