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