@ilha/router 0.3.2 → 0.3.3

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/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { C as wrapError, E as setHistoryMode, S as useRoute, T as getHistoryMode, _ as routeParams, a as RouterView, b as router, c as enableLinkInterception, d as loader, f as navigate, g as routeHash, h as redirect, i as RouterLink, l as error, m as prime, n as LoaderError, o as composeLoaders, p as prefetch, r as Redirect, s as defineLayout, t as LOADER_ENDPOINT, u as isActive, v as routePath, w as wrapLayout, x as src_default, y as routeSearch } from "./src-C2qmhASZ.js";
1
+ import { C as wrapError, E as setHistoryMode, S as useRoute, T as getHistoryMode, _ as routeParams, a as RouterView, b as router, c as enableLinkInterception, d as loader, f as navigate, g as routeHash, h as redirect, i as RouterLink, l as error, m as prime, n as LoaderError, o as composeLoaders, p as prefetch, r as Redirect, s as defineLayout, t as LOADER_ENDPOINT, u as isActive, v as routePath, w as wrapLayout, x as src_default, y as routeSearch } from "./src-BFZ-RQw6.js";
2
2
  export { LOADER_ENDPOINT, LoaderError, Redirect, RouterLink, RouterView, composeLoaders, src_default as default, defineLayout, enableLinkInterception, error, getHistoryMode, isActive, loader, navigate, prefetch, prime, redirect, routeHash, routeParams, routePath, routeSearch, router, setHistoryMode, useRoute, wrapError, wrapLayout };
@@ -1,4 +1,4 @@
1
- import ilha, { context, html, mount } from "ilha";
1
+ import ilha, { ISLAND_MOUNT_INTERNAL, context, html, mount } from "ilha";
2
2
  import { addRoute, createRouter, findRoute } from "rou3";
3
3
  //#region src/hash.ts
4
4
  const isBrowser$1 = typeof window !== "undefined" && typeof document !== "undefined";
@@ -219,6 +219,33 @@ function wrapError(handler, page) {
219
219
  return errorIsland.mount(host, props);
220
220
  }
221
221
  };
222
+ Wrapper[ISLAND_MOUNT_INTERNAL] = (host, props) => {
223
+ try {
224
+ const pageInternal = page[ISLAND_MOUNT_INTERNAL];
225
+ if (typeof pageInternal === "function") return pageInternal(host, props);
226
+ return {
227
+ unmount: page.mount(host, props),
228
+ updateProps: () => {}
229
+ };
230
+ } catch (e) {
231
+ const route = {
232
+ path: routePath(),
233
+ params: routeParams(),
234
+ search: routeSearch(),
235
+ hash: routeHash()
236
+ };
237
+ const errorIsland = handler({
238
+ message: e.message,
239
+ status: e.status,
240
+ stack: e.stack
241
+ }, route);
242
+ host.innerHTML = errorIsland.toString();
243
+ return {
244
+ unmount: errorIsland.mount(host, props),
245
+ updateProps: () => {}
246
+ };
247
+ }
248
+ };
222
249
  return Wrapper;
223
250
  }
224
251
  function defineLayout(layout) {
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as wrapError, w as wrapLayout } from "./src-C2qmhASZ.js";
1
+ import { C as wrapError, w as wrapLayout } from "./src-BFZ-RQw6.js";
2
2
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
3
3
  import { basename, dirname, extname, join, relative, resolve } from "node:path";
4
4
  //#region src/vite.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilha/router",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "A tiny SPA router for Ilha",
5
5
  "license": "MIT",
6
6
  "author": "Ryuz <ryuzer@proton.me>",