@elurjs/kit 2.4.8 → 2.4.9
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 +11 -0
- package/dist/lib/cli.cjs +11 -13
- package/dist/lib/cli.cjs.map +1 -1
- package/dist/lib/cli.js +11 -13
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/{interpolation-plugin-ci-ChP0g.cjs → interpolation-plugin-TWDch8nn.cjs} +12 -14
- package/dist/lib/interpolation-plugin-TWDch8nn.cjs.map +1 -0
- package/dist/lib/{interpolation-plugin-BzfmN_tq.js → interpolation-plugin-Wgb1j4pT.js} +12 -14
- package/dist/lib/interpolation-plugin-Wgb1j4pT.js.map +1 -0
- package/dist/lib/vite/index.cjs +1 -1
- package/dist/lib/vite/index.js +1 -1
- package/package.json +1 -1
- package/dist/lib/interpolation-plugin-BzfmN_tq.js.map +0 -1
- package/dist/lib/interpolation-plugin-ci-ChP0g.cjs.map +0 -1
package/dist/lib/cli.js
CHANGED
|
@@ -211,23 +211,19 @@ function buildEntrySource(islands, outFile, hydrateImport = "@elurjs/kit/island"
|
|
|
211
211
|
const islandHydration = registryLines ? `const registry = {
|
|
212
212
|
${registryLines}
|
|
213
213
|
};
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
const hydrate =
|
|
218
|
-
const { hydrateIslands, cleanupHydratedIslands } = await import(${JSON.stringify(hydrateImport)});
|
|
219
|
-
cleanupHydratedIslands();
|
|
220
|
-
hydrateIslands(registry);
|
|
221
|
-
document.addEventListener("elur:rendered", () => {
|
|
222
|
-
cleanupHydratedIslands();
|
|
223
|
-
hydrateIslands(registry);
|
|
224
|
-
});
|
|
225
|
-
};
|
|
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);
|
|
226
218
|
if ("requestIdleCallback" in window) {
|
|
227
219
|
requestIdleCallback(hydrate, { timeout: 2000 });
|
|
228
220
|
} else {
|
|
229
221
|
setTimeout(hydrate, 0);
|
|
230
222
|
}
|
|
223
|
+
document.addEventListener("elur:rendered", () => {
|
|
224
|
+
cleanupHydratedIslands();
|
|
225
|
+
hydrateIslands(registry);
|
|
226
|
+
});
|
|
231
227
|
|
|
232
228
|
// Vite HMR: when an island module (or the entry itself) updates, dispose the
|
|
233
229
|
// current islands and re-hydrate from the updated modules — the registry's
|
|
@@ -235,7 +231,8 @@ if ("requestIdleCallback" in window) {
|
|
|
235
231
|
// needed (progressive enhancement, audit §10.2 / §12.2).
|
|
236
232
|
if (import.meta.hot) {
|
|
237
233
|
import.meta.hot.accept((newModule) => {
|
|
238
|
-
|
|
234
|
+
cleanupHydratedIslands();
|
|
235
|
+
hydrateIslands(registry);
|
|
239
236
|
if (newModule) {
|
|
240
237
|
// Re-run the module so its side effects (router, listeners) apply.
|
|
241
238
|
}
|
|
@@ -243,6 +240,7 @@ if (import.meta.hot) {
|
|
|
243
240
|
}` : "";
|
|
244
241
|
return `// AUTO-GENERATED by @elurjs/kit. Do not edit.
|
|
245
242
|
import { startClientRouter } from ${JSON.stringify(routerImport)};
|
|
243
|
+
import { hydrateIslands, cleanupHydratedIslands } from ${JSON.stringify(hydrateImport)};
|
|
246
244
|
|
|
247
245
|
startClientRouter();
|
|
248
246
|
${islandHydration}
|