@ilha/router 0.6.2 → 0.6.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 @@
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-B_DKbd_R.js";
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
+ import{C as e,E as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x,v as S,w as C,x as w,y as T}from"./src-ObXICXKp.js";export{b as LOADER_ENDPOINT,h as LoaderError,v as Redirect,f as RouterLink,a as RouterView,g as composeLoaders,w as default,y as defineLayout,s as enableLinkInterception,p as error,r as getHistoryMode,x as isActive,c as loader,l as navigate,_ as prefetch,m as prime,d as redirect,u as routeHash,i as routeParams,S as routePath,T as routeSearch,o as router,t as setHistoryMode,n as useRoute,e as wrapError,C as wrapLayout};
@@ -0,0 +1,6 @@
1
+ import{watch as e}from"node:fs";import{basename as t,dirname as n,extname as r,join as i,relative as a,resolve as o,sep as s}from"node:path";import{createUnplugin as c}from"unplugin";import{mkdir as l,readFile as u,readdir as d,writeFile as f}from"node:fs/promises";function p(e){return e.replace(/\\/g,`/`)}const m=/\.(test|spec|d)\.(ts|tsx)$/,h=/^\s*export\s+(?:const|let|var|async\s+function|function)\s+load\b/m;async function g(e){try{let t=(await u(e,`utf8`)).replace(/^\s*\/\/.*$/gm,``);return h.test(t)}catch{return!1}}function _(e){return e.startsWith(`[...`)&&e.endsWith(`]`)?`**:${e.slice(4,-1)}`:e.startsWith(`[`)&&e.endsWith(`]`)?`:${e.slice(1,-1)}`:e}function v(e){return e.startsWith(`(`)&&e.endsWith(`)`)?``:_(e)}function y(e,t){let n=p(a(e,t)),i=n.slice(0,-r(n).length).split(`/`),o=[...i.slice(0,-1).map(v),_(i.at(-1))];return o.at(-1)===`index`&&o.pop(),`/`+o.filter(Boolean).join(`/`)||`/`}function b(e){return e===`/`?`index`:e.replace(/^\//,``).replace(/\*\*:[^/]*/g,e=>e.length>3?e.slice(3):`wildcard`).replace(/:/g,``).replace(/\*\*/g,`wildcard`).replace(/\//g,`-`).replace(/[^a-zA-Z0-9-]/g,``)||`page`}function x(e){return e===`/`?3:e.includes(`**`)?0:e.includes(`:`)?1:2}function S(e){return[...e].sort((e,t)=>{let n=x(t.pattern)-x(e.pattern);if(n!==0)return n;let r=t.pattern.split(`/`).length-e.pattern.split(`/`).length;return r===0?e.pattern.localeCompare(t.pattern):r})}function C(e,t,r,o){let s=p(a(e,n(t))),c=s===``?[]:s.split(`/`);return[e,...c.map((t,n)=>i(e,...c.slice(0,n+1)))].flatMap(e=>{let t=`${i(e,o)}.tsx`;if(r.has(t))return[t];let n=`${i(e,o)}.ts`;return r.has(n)?[n]:[]})}async function w(e,t=0){if(t>20)return console.warn(`[ilha:pages] Max scan depth (20) reached at ${e} — skipping`),[];let n=[];try{for(let r of await d(e,{withFileTypes:!0})){let a=i(e,r.name);r.isDirectory()?n.push(...await w(a,t+1)):r.isFile()&&/\.(ts|tsx)$/.test(r.name)&&!m.test(r.name)&&n.push(a)}}catch(e){if(e.code===`ENOENT`)return[];throw e}return n}async function T(e){let n=await w(e),r=new Set(n),i=n.filter(e=>!t(e).startsWith(`+`)),a=new Map,o=e=>{let t=a.get(e);return t||(t=g(e),a.set(e,t)),t};return Promise.all(i.map(async t=>{let n=y(e,t),i=C(e,t,r,`+layout`),a=C(e,t,r,`+error`),[s,...c]=await Promise.all([g(t),...i.map(o)]),l=i.filter((e,t)=>c[t]);return{file:t,pattern:n,name:b(n),layouts:i,errors:a,hasLoader:s,loaderLayouts:l}}))}function E(e,t){if(e.length===0){console.warn(`[ilha:pages] No pages found in ${t}`);return}let n=new Map,r=new Map;for(let t of e){let e=n.get(t.pattern);e?console.warn(`[ilha:pages] Duplicate route pattern "${t.pattern}"\n first: ${e}\n second: ${t.file}\n The first match wins — the second page will never be reached.`):n.set(t.pattern,t.file);let i=r.get(t.name);i?console.warn(`[ilha:pages] Registry name collision: "${t.name}" is used by both\n ${i}\n ${t.file}\n Hydration may not work correctly for one of these routes.`):r.set(t.name,t.file)}}function D(e){return{serverFile:i(e,`pages.server.ts`),clientFile:i(e,`pages.client.ts`),loadersFile:i(e,`loaders.ts`)}}async function O(e,t,n={}){let r=n.mode??`spa`,i=n.interceptLinks,a=r===`static`,o=S(await T(e));E(o,e),await l(t,{recursive:!0});let{serverFile:s,clientFile:c,loadersFile:u}=D(t),d=await M(s,k(o,s)),f=await M(c,A(o,c,{isStatic:a,interceptLinks:i}));a||await M(u,j(o,u,s)),(d||f)&&await N(t)}function k(e,t){let r=e=>{let r=p(a(n(t),e));return r.startsWith(`.`)?r:`./${r}`},i=[`import { router, wrapLayout, wrapError } from "@ilha/router";`,`import type { Island } from "ilha";`],o=[],s=[],c=[];for(let[t,n]of e.entries()){i.push(`import { default as _page${t} } from ${JSON.stringify(r(n.file))};`);for(let[e,a]of n.layouts.entries())i.push(`import { default as _layout${t}_${e} } from ${JSON.stringify(r(a))};`);for(let[e,a]of n.errors.entries())i.push(`import { default as _error${t}_${e} } from ${JSON.stringify(r(a))};`);let a=`_page${t}`;for(let e=n.errors.length-1;e>=0;e--)a=`wrapError(_error${t}_${e}, ${a})`;for(let e=n.layouts.length-1;e>=0;e--)a=`wrapLayout(_layout${t}_${e}, ${a})`;let l=`_wrapped${t}`;o.push(`const ${l} = ${a};`),s.push(` ${JSON.stringify(n.name)}: ${l}`+(t<e.length-1?`,`:``)),c.push(` .route(${JSON.stringify(n.pattern)}, ${l})`+(n.hasLoader||n.loaderLayouts.length>0?`.markLoader(${JSON.stringify(n.pattern)})`:``))}return[`// @generated by @ilha/router — do not edit`,`// Server module. Use for SSR and SSG/prerender.`,`// Import via: import { pageRouter, registry } from "ilha:pages/server";`,``,...i,``,...o,``,`export const registry: Record<string, Island<any, any>> = {`,...s,`};`,``,`export const pageRouter = router()`,...c,` ;`].join(`
2
+ `)}function A(e,t,r){let{isStatic:i,interceptLinks:o}=r,s=e=>{let r=p(a(n(t),e));return r.startsWith(`.`)?r:`./${r}`},c=e=>`${s(e)}?client`,l=i?[`import { router as _router, wrapLayout, wrapError } from "@ilha/router";`,`import type { Island } from "ilha";`]:[`import { router, wrapLayout, wrapError } from "@ilha/router";`,`import type { Island } from "ilha";`],u=[],d=[],f=[];for(let[t,n]of e.entries()){l.push(`import { default as _page${t} } from ${JSON.stringify(c(n.file))};`);for(let[e,r]of n.layouts.entries())l.push(`import { default as _layout${t}_${e} } from ${JSON.stringify(c(r))};`);for(let[e,r]of n.errors.entries())l.push(`import { default as _error${t}_${e} } from ${JSON.stringify(c(r))};`);let r=`_page${t}`;for(let e=n.errors.length-1;e>=0;e--)r=`wrapError(_error${t}_${e}, ${r})`;for(let e=n.layouts.length-1;e>=0;e--)r=`wrapLayout(_layout${t}_${e}, ${r})`;let a=`_wrapped${t}`;u.push(`const ${a} = ${r};`),d.push(` ${JSON.stringify(n.name)}: ${a}`+(t<e.length-1?`,`:``)),i||f.push(` .route(${JSON.stringify(n.pattern)}, ${a})`+(n.hasLoader||n.loaderLayouts.length>0?`.markLoader(${JSON.stringify(n.pattern)})`:``))}let m=i?`_router({ mode: "static" })`:`router(${o===!1?`{ interceptLinks: false }`:``})`,h=[`// @generated by @ilha/router — do not edit`,`// Client module. Use for browser hydration.`,`// Import via: import { pageRouter, registry } from "ilha:pages/client";`,``,...l,``,...u,``,`export const registry: Record<string, Island<any, any>> = {`,...d,`};`,``];return i?h.push(`export const pageRouter = ${m};`):h.push(`export const pageRouter = ${m}`,...f,` ;`),h.join(`
3
+ `)}function j(e,t,r){let i=e=>{let r=p(a(n(t),e));return r.startsWith(`.`)?r:`./${r}`},o=e.filter(e=>e.hasLoader||e.loaderLayouts.length>0);if(o.length===0)return[`// @generated by @ilha/router — do not edit`,`// This project has no loader exports; this file is intentionally empty.`,``,`export {};`,``].join(`
4
+ `);let s=i(r).replace(/\.tsx?$/,``),c=[`import { pageRouter } from ${JSON.stringify(s)};`],l=!1,u=[];for(let[e,t]of o.entries()){let n=[];for(let[r,a]of t.loaderLayouts.entries()){let t=`_p${e}_l${r}`;c.push(`import { load as ${t} } from ${JSON.stringify(i(a))};`),n.push(t)}if(t.hasLoader){let r=`_p${e}`;c.push(`import { load as ${r} } from ${JSON.stringify(i(t.file))};`),n.push(r)}let r=n.length===1?n[0]:`composeLoaders([${n.join(`, `)}])`;n.length>1&&(l=!0),u.push(`pageRouter.attachLoader(${JSON.stringify(t.pattern)}, ${r});`)}return l&&c.unshift(`import { composeLoaders } from "@ilha/router";`),[`// @generated by @ilha/router — do not edit`,`// Server-only. Import this module from your SSR entry to wire loaders`,`// onto pageRouter. Importing it from the client is a no-op but wastes`,`// bundle size — rely on the default build pipeline to keep it out.`,``,...c,``,...u,``].join(`
5
+ `)}async function M(e,t){try{if(await u(e,`utf8`)===t)return!1}catch{}return await f(e,t,`utf8`),!0}async function N(e){await M(i(e,`pages.d.ts`),[`// @generated by @ilha/router — do not edit`,``,`declare module "ilha:pages/server" {`,` import type { RouterBuilder } from "@ilha/router";`,` import type { Island } from "ilha";`,` export const pageRouter: RouterBuilder;`,` export const registry: Record<string, Island<any, any>>;`,`}`,``,`declare module "ilha:pages/client" {`,` import type { RouterBuilder } from "@ilha/router";`,` import type { Island } from "ilha";`,` export const pageRouter: RouterBuilder;`,` export const registry: Record<string, Island<any, any>>;`,`}`,``,`declare module "ilha:loaders" {`,` // Side-effect-only module. Importing it attaches loaders to pageRouter.`,`}`,``].join(`
6
+ `))}const P=`\0ilha:pages/server`,F=`\0ilha:pages/client`,I=`\0ilha:loaders`,L=[P,F,I];function R(e,t){let n=o(e,t.dir??`src/pages`),r=o(e,t.outDir??`.ilha`),{serverFile:i,clientFile:a,loadersFile:s}=D(r);return{pagesDir:n,outDir:r,serverFile:i,clientFile:a,loadersFile:s}}function z(e){let n,r,i,a,o,c=t=>{({pagesDir:n,outDir:r,serverFile:i,clientFile:a,loadersFile:o}=R(t,e))},l=async()=>{try{await O(n,r,{mode:e.mode,interceptLinks:e.interceptLinks})}catch(e){console.error(`[ilha:pages] codegen failed:`,e)}},u=e=>e===n||e.startsWith(n+s);return{get pagesDir(){return n},get outDir(){return r},get serverFile(){return i},get clientFile(){return a},get loadersFile(){return o},setPaths:c,regen:l,shouldRegenOnChange:e=>{if(!u(e))return!1;let n=t(e);return n.startsWith(`+`)||/\.(ts|tsx)$/.test(n)},isUnderPagesDir:u}}async function B(e,t,n){n(t)&&await e.regen()}function V(e,t,n){if(t===`ilha:pages/server`)return P;if(t===`ilha:pages/client`)return F;if(t===`ilha:loaders`)return I;if(t.endsWith(`?client`)){let e=t.slice(0,-7);return(n?o(n.replace(/\?.*$/,``),`..`,e):o(e))+`?client`}}function H(e,t){if(t===`\0ilha:pages/server`){let t=e.serverFile.replace(/\.tsx?$/,``);return`export { pageRouter, registry } from ${JSON.stringify(t)};`}if(t===`\0ilha:pages/client`){let t=e.clientFile.replace(/\.tsx?$/,``);return`export { pageRouter, registry } from ${JSON.stringify(t)};`}if(t===`\0ilha:loaders`){let t=e.loadersFile.replace(/\.tsx?$/,``);return`import ${JSON.stringify(t)};`}if(t.endsWith(`?client`)){let e=t.slice(0,-7);return`export { default } from ${JSON.stringify(e)};`}}function U(e,t){return async n=>{e.isUnderPagesDir(n)&&(await e.regen(),await t())}}function W(t,n){let r=e(t.pagesDir,{recursive:!0},(e,r)=>{r&&n(i(t.pagesDir,r))});return()=>r.close()}const G=c((e={})=>{let t=z(e);return{name:`ilha:pages`,async buildStart(){t.pagesDir||t.setPaths(process.cwd()),this.addWatchFile?.(t.pagesDir),await t.regen()},async watchChange(e){await B(t,e,e=>t.shouldRegenOnChange(e))},resolveId(e,n){return V(t,e,n)},load(e){return H(t,e)},vite:{configResolved(e){t.setPaths(e.root)},configureServer(e){e.watcher.add(t.pagesDir);let n=U(t,async()=>{for(let t of L){let n=e.moduleGraph.getModuleById(t);n&&e.moduleGraph.invalidateModule(n)}e.hot.send({type:`full-reload`})});e.watcher.on(`add`,n),e.watcher.on(`addDir`,n),e.watcher.on(`unlink`,n),e.watcher.on(`change`,async e=>{t.shouldRegenOnChange(e)&&await n(e)})}},rspack(e){t.setPaths(e.options.context??process.cwd());let n=U(t,()=>{e.watching&&e.invalidate()}),r;e.hooks.watchRun.tap(`ilha:pages`,()=>{r?.(),r=W(t,n)}),e.hooks.shutdown.tap(`ilha:pages`,()=>r?.())}}});export{G as t};
package/dist/rolldown.js CHANGED
@@ -1,9 +1 @@
1
- import { C as wrapError, w as wrapLayout } from "./src-B_DKbd_R.js";
2
- import { t as ilhaPages } from "./plugin-Cq0xpVL8.js";
3
- //#region src/rolldown.ts
4
- /** Rolldown plugin — use via `@ilha/router/rolldown`. */
5
- function pages(options = {}) {
6
- return ilhaPages.rolldown(options);
7
- }
8
- //#endregion
9
- export { ilhaPages, pages, wrapError, wrapLayout };
1
+ import{C as e,w as t}from"./src-ObXICXKp.js";import{t as n}from"./plugin-OpojKenS.js";function r(e={}){return n.rolldown(e)}export{n as ilhaPages,r as pages,e as wrapError,t as wrapLayout};
package/dist/rspack.js CHANGED
@@ -1,9 +1 @@
1
- import { C as wrapError, w as wrapLayout } from "./src-B_DKbd_R.js";
2
- import { t as ilhaPages } from "./plugin-Cq0xpVL8.js";
3
- //#region src/rspack.ts
4
- /** Rspack plugin — use via `@ilha/router/rspack`. */
5
- function pages(options = {}) {
6
- return ilhaPages.rspack(options);
7
- }
8
- //#endregion
9
- export { ilhaPages, pages, wrapError, wrapLayout };
1
+ import{C as e,w as t}from"./src-ObXICXKp.js";import{t as n}from"./plugin-OpojKenS.js";function r(e={}){return n.rspack(e)}export{n as ilhaPages,r as pages,e as wrapError,t as wrapLayout};
@@ -0,0 +1,3 @@
1
+ import e,{ISLAND_MOUNT_INTERNAL as t,context as n,html as r,mount as i}from"ilha";import{addRoute as a,createRouter as o,findRoute as s}from"rou3";const c=typeof window<`u`&&typeof document<`u`,l={readLocation(){return c?{pathname:location.pathname,search:location.search,hash:location.hash}:{pathname:`/`,search:``,hash:``}},push(e){c&&history.pushState(null,``,e)},replace(e){c&&history.replaceState(null,``,e)},onChange(e){return c?(window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)):()=>{}},toLinkHref(e){return e},extractLogicalPath(e){let t=e.getAttribute(`href`);return!t||e.protocol&&!/^(http:|https:)$/.test(e.protocol)||t.startsWith(`#`)||e.hostname&&(e.hostname!==location.hostname||e.protocol!==location.protocol)?null:e.pathname+e.search+e.hash}};function u(e){let t=e.startsWith(`#`)?e.slice(1):e,n=t===``?`/`:t.startsWith(`/`)?t:`/`+t,r=new URL(n,`http://_`);return{pathname:r.pathname,search:r.search,hash:r.hash}}const d={readLocation(){return c?u(location.hash):{pathname:`/`,search:``,hash:``}},push(e){c&&history.pushState(null,``,e.startsWith(`#`)?e:`#`+e)},replace(e){c&&history.replaceState(null,``,e.startsWith(`#`)?e:`#`+e)},onChange(e){return c?(window.addEventListener(`popstate`,e),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(`hashchange`,e)}):()=>{}},toLinkHref(e){return e.startsWith(`#`)?e:`#`+e},extractLogicalPath(e){let t=e.getAttribute(`href`);if(!t||e.protocol&&!/^(http:|https:)$/.test(e.protocol))return null;if(t.startsWith(`#`)){let e=t.slice(1);return e===``||!e.startsWith(`/`)?null:e}if(/^https?:\/\//i.test(t))try{let e=new URL(t);if(e.origin!==location.origin||!e.hash||e.hash===`#`)return null;let n=e.hash.slice(1);return n.startsWith(`/`)?n:null}catch{return null}return t}};let f=`history`,p=l;function m(e){f=e,p=e===`hash`?d:l}function h(){return f}function g(){return p}const _=typeof window<`u`&&typeof document<`u`;function v(e){return e}var y=class{__ilhaRedirect=!0;to;status;constructor(e,t=302){this.to=e,this.status=t}},b=class{__ilhaLoaderError=!0;status;message;constructor(e,t){this.status=e,this.message=t}};function x(e,t=302){throw new y(e,t)}function S(e,t){throw new b(e,t)}function C(e){return e.length===0?async()=>({}):e.length===1?e[0]:async t=>{let n=await Promise.all(e.map(e=>e(t)));return Object.assign({},...n)}}const w=Symbol.for(`ilha.router.wrapLayout.leaf`);function T(e){let t=e.match(/^<([a-zA-Z][\w-]*)\s[^>]*>([\s\S]*)<\/\1>\s*$/);return t?t[2]:e}function ee(e){let t=e.match(/^<([a-zA-Z][\w-]*)\s([^>]*)>/);return t?{tag:t[1],attrs:t[2]}:null}function te(e){let t=[];for(let n of e.matchAll(/<div\s[^>]*data-ilha-slot="k:page"[^>]*>/g)){let r=n.index+n[0].length,i=1,a=r;for(;a<e.length&&i>0;){let n=e.indexOf(`<div`,a),o=e.indexOf(`</div>`,a);if(o===-1)break;if(n!==-1&&n<o)i+=1,a=n+4;else{if(--i,i===0){t.push({openEnd:r,closeStart:o});break}a=o+6}}}return t}function E(e,t,n){let r=te(e);if(r.length===0)return e;let i=n===`innermost`?r[r.length-1]:r[0];return e.slice(0,i.openEnd)+t+e.slice(i.closeStart)}async function ne(e,t,n,r){let i=T(await t.hydratable(n,r));return E(e.toString(n),i,`innermost`)}function re(e,n){let r=n[w]??n,i=r===n?null:n,a=e(Object.assign(n.key(`page`),{toString:n.toString.bind(n)}));a[w]=r;function o(e){let t=[...e.querySelectorAll(`[data-ilha-slot="k:page"]`)].filter(t=>{let n=t.closest(`[data-ilha]`);return n===null||n===e});return t.length===0?e:t[t.length-1]}function s(e,t){if(t.hasAttribute(`data-ilha-state`))return;let n=e.getAttribute(`data-ilha-state`);if(n)try{let e=JSON.parse(n);delete e._skipOnMount,t.setAttribute(`data-ilha-state`,JSON.stringify(e))}catch{}}let c=a.mount.bind(a),l=a[t];function u(e){s(e,o(e)),e.removeAttribute(`data-ilha-state`)}return a.mount=(e,t)=>(u(e),c(e,t)),a[t]=(e,t)=>(u(e),typeof l==`function`?l(e,t):{unmount:c(e,t),updateProps:()=>{}}),a.hydratable=async(e,t)=>{if(!t?.name)throw Error(`wrapLayout: hydratable requires options.name`);let n=e??{},o=await r.hydratable(n,t),s=ee(o);if(!s)return o;let c=T(o),l=i?await ne(i,r,n,t):c,u=E(a.toString(n),l,`first`);return`<${s.tag} ${s.attrs}>${u}</${s.tag}>`},a}function ie(n,r){let i=e.render(()=>{try{return r.toString()}catch(e){let t={path:M(),params:N(),search:P(),hash:F()};return n({message:e.message,status:e.status,stack:e.stack},t).toString()}});return i.mount=(e,t)=>{try{return r.mount(e,t)}catch(r){let i={path:M(),params:N(),search:P(),hash:F()},a=n({message:r.message,status:r.status,stack:r.stack},i);return e.innerHTML=a.toString(),a.mount(e,t)}},i[t]=(e,i)=>{try{let n=r[t];return typeof n==`function`?n(e,i):{unmount:r.mount(e,i),updateProps:()=>{}}}catch(t){let r={path:M(),params:N(),search:P(),hash:F()},a=n({message:t.message,status:t.status,stack:t.stack},r);return e.innerHTML=a.toString(),{unmount:a.mount(e,i),updateProps:()=>{}}}},i.hydratable=async(e,t)=>{if(!t?.name)throw Error(`wrapError: hydratable requires options.name`);return r.hydratable(e??{},t)},i}function ae(e){return e}function D(e){let t=new Map;for(let[n,r]of Object.entries(e))t.has(r)||t.set(r,n);return t}const O=`/__ilha/loader`,k=new Map;async function A(e,t){let n=k.get(e);if(n){k.delete(e);try{return await n}catch{}}let r=`${O}?path=${encodeURIComponent(e)}`;try{let e=await fetch(r,{signal:t,headers:{accept:`application/json`}});if(!e.ok){try{let t=await e.json();if(t&&typeof t==`object`&&`kind`in t)return t}catch{}return{kind:`error`,status:e.status,message:e.statusText}}return await e.json()}catch(e){if(e?.name===`AbortError`)throw e;return{kind:`error`,status:0,message:e?.message??`network error`}}}function j(e){if(!_||k.has(e))return;let t=e.split(`?`)[0]??``;if(!s(z,`GET`,t)?.data?.hasLoader)return;let n=A(e).catch(e=>({kind:`error`,status:0,message:e?.message??`prefetch failed`}));k.set(e,n)}async function oe(e,t,n,r,i,a){if(!e)return t.innerHTML=`<div data-router-empty></div>`,()=>{};let o=!!s(z,`GET`,n.split(`?`)[0]??``)?.data?.hasLoader,c={},l=o?await A(n,r):{kind:`data`,data:{}};if(l.kind===`redirect`)return K(l.to,{replace:!0}),()=>{};if(l.kind===`error`){let e=String(l.message).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);return t.innerHTML=`<div data-router-view data-router-error="${l.status}">${e}</div>`,()=>{}}if(l.kind===`not-found`)return t.innerHTML=`<div data-router-empty></div>`,()=>{};if(c=l.data,!i)return console.warn(`[ilha-router] No registry provided for client-side navigation. Island will not be interactive.`),t.innerHTML=`<div data-router-view>${e.toString(c)}</div>`,()=>{};let u=a?.get(e)??Object.entries(i).find(([,t])=>t===e)?.[0];if(!u)return console.warn(`[ilha-router] Island not found in registry for client-side navigation.`),t.innerHTML=`<div data-router-view>${e.toString(c)}</div>`,()=>{};t.innerHTML=`<div data-router-view>${await e.hydratable(c,{name:u,as:`div`,snapshot:!0})}</div>`;let d=t.querySelector(`[data-ilha="${u}"]`);return d?e.mount(d):()=>{}}const M=n(`router.path`,``),N=n(`router.params`,{}),P=n(`router.search`,``),F=n(`router.hash`,``);function I(){return{path:M,params:N,search:P,hash:F}}const L=n(`router.active`,null);let R=[],z=o(),B=new Map,V=new Map;function H(e){let t={};if(e)for(let[n,r]of Object.entries(e))t[n]=decodeURIComponent(r);return t}function U(e){let t=typeof e==`string`?new URL(e,`http://localhost`):e,n=s(z,`GET`,t.pathname);M(t.pathname),N(H(n?.params)),P(t.search),F(t.hash),L(n?.data?.island??null)}function W(){let e=g().readLocation(),t=s(z,`GET`,e.pathname);M(e.pathname),N(H(t?.params)),P(e.search),F(e.hash),L(t?.data?.island??null)}function G(){_&&W()}function K(e,t={}){if(!_)return;let n=g(),r=n.readLocation();e!==r.pathname+r.search+r.hash&&(t.replace?n.replace(e):n.push(e),W())}function q(e=document,t={}){if(!_)return()=>{};let n=t.prefetch!==!1;function r(e,t){let n=e.getAttribute(`target`)===`_blank`,r=!!t&&(t.ctrlKey||t.metaKey||t.shiftKey),i=e.hasAttribute(`data-no-intercept`);return n||r||i?null:g().extractLogicalPath(e)}let i=e=>{if(e.defaultPrevented)return;let t=e.target.closest(`a`);if(!t)return;let n=r(t,e);n!==null&&(e.preventDefault(),K(n))},a=e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`data-prefetch`);if(n===null||n===`false`)return;let i=r(t);i!==null&&j(i.split(`#`)[0]??i)};return e.addEventListener(`click`,i),n&&e.addEventListener(`mouseover`,a,{passive:!0}),()=>{e.removeEventListener(`click`,i),n&&e.removeEventListener(`mouseover`,a)}}const J=e.render(()=>{let e=L();return e?`<div data-router-view>${e.toString()}</div>`:`<div data-router-empty></div>`}),Y=e.state(`href`,``).state(`label`,``).on(`[data-link]@click`,({state:e,event:t})=>{t.preventDefault(),K(e.href())}).on(`[data-link]@mouseenter`,({state:e})=>{let t=e.href();if(t){if(/^https?:\/\//i.test(t))try{let e=new URL(t);if(e.origin!==location.origin)return;j(e.pathname+e.search);return}catch{return}j(t)}}).render(({state:e})=>r`<a data-link data-prefetch href="${()=>g().toLinkHref(e.href())}"
2
+ >${e.label}</a
3
+ >`);function X(e){let t=s(z,`GET`,M());return t?B.get(t.data.island)===e:!1}function Z(e){return typeof e==`string`?new URL(e,`http://localhost`):e}function Q(e){try{return new Request(e.toString())}catch{return{url:e.toString(),headers:new Headers}}}async function $(e,t,n,r,i){try{return{kind:`data`,data:await e({params:n,request:r,url:t,signal:i})??{}}}catch(e){return e instanceof y?{kind:`redirect`,to:e.to,status:e.status}:e instanceof b?{kind:`error`,status:e.status,message:e.message}:{kind:`error`,status:e?.status??500,message:e?.message??`Loader failed`}}}function se(t={}){let n=t.mode??`spa`,r=t.interceptLinks!==!1;R=[],z=o(),B=new Map,V=new Map;let c=null,l=null,u={route(e,t,n){let r=!!n,i={island:t,loader:n,hasLoader:r};return R.push({pattern:e,island:t,loader:n,hasLoader:r}),a(z,`GET`,e,i),V.set(e,i),B.has(t)||B.set(t,e),u},attachLoader(e,t){let n=V.get(e);if(!n)return console.warn(`[ilha-router] attachLoader("${e}", …): pattern was never registered via .route(). The loader will be ignored.`),u;n.loader=t,n.hasLoader=!0;let r=R.find(t=>t.pattern===e);return r&&(r.loader=t,r.hasLoader=!0),u},markLoader(e){let t=V.get(e);if(!t)return console.warn(`[ilha-router] markLoader("${e}"): pattern was never registered via .route(). The loader marker will be ignored.`),u;t.hasLoader=!0;let n=R.find(t=>t.pattern===e);return n&&(n.hasLoader=!0),u},routes(){return R.map(e=>({...e}))},prime:G,hydrateStatic(e,t={}){if(!_)return()=>{};let n=t.root??document.body;G();let{unmount:r}=i(e,{root:n});return r},mount(t,{hydrate:i=!1,registry:a,interceptLinks:o}={}){if(!_)return console.warn(`[ilha-router] mount() called in a non-browser environment`),()=>{};let u=typeof t==`string`?document.querySelector(t):t;if(!u)return console.warn(`[ilha-router] No element found for selector "${t}"`),()=>{};if(W(),n===`static`)return console.warn(`[ilha-router] router.mount() called in static mode. Use router.hydrateStatic(registry) instead.`),()=>{};c=g().onChange(()=>W()),l=o??r?q(document):null;let d=null,f=null;if(i){h()===`hash`&&console.warn("[ilha-router] mount({ hydrate: true }) was called in hash mode. SSR + hydration assumes the server can render the active route, but in hash mode the server only ever sees the document URL. Use plain SPA mode (`mount(target)` without `hydrate: true`) for hash-mode apps.");let t=u.querySelector(`[data-router-view]`)??u,n=L(),r=a?D(a):void 0,i=0,o=e.render(()=>{let e=L();if(e!==n){let o=++i;f?.abort(),f=new AbortController;let s=f.signal;queueMicrotask(async()=>{if(o===i){d?.();try{let n=g().readLocation();d=await oe(e,t,n.pathname+n.search,s,a,r)}catch(e){if(e?.name===`AbortError`)return;throw e}n=e}})}return``}),s=document.createElement(`div`);s.style.display=`none`,u.appendChild(s);let p=o.mount(s);return()=>{++i,f?.abort(),p(),s.remove(),d?.(),c?.(),l?.(),c=null,l=null}}let p=null,m=null,v=0;d=J.mount(u);async function y(e,t){if(p?.(),p=null,m=e,!e)return;let n=u?.querySelector(`[data-router-view]`);if(!n)return;let r=g().readLocation(),i=s(z,`GET`,r.pathname)?.data?.hasLoader?await A(r.pathname+r.search,t):{kind:`data`,data:{}};if(t.aborted)return;if(i.kind===`redirect`){K(i.to,{replace:!0});return}let a=i.kind===`data`?i.data:{};n.innerHTML=e.toString(a),p=e.mount(n,a)}f=new AbortController,y(L(),f.signal);let b=e.render(()=>{let e=L();if(e!==m){let t=++v;f?.abort(),f=new AbortController;let n=f.signal;queueMicrotask(()=>{t===v&&y(e,n)})}return``}),x=document.createElement(`div`);x.style.display=`none`,u.appendChild(x);let S=b.mount(x);return()=>{++v,f?.abort(),p?.(),S(),x.remove(),d?.(),c?.(),l?.(),c=null,l=null}},render(e){return U(e),J.toString()},async renderHydratable(e,t,n={},r){let i=await this.renderResponse(e,t,n,r);return i.kind===`html`||i.kind===`error`?i.html:`<meta http-equiv="refresh" content="0; url=${i.to}">`},async renderResponse(e,t,n={},r){let i=Z(e);U(i);let a=s(z,`GET`,i.pathname),o=a?.data?.island??null;if(!o)return{kind:`html`,html:`<div data-router-empty></div>`,status:404};let c={};if(a?.data?.loader){let e=r??Q(i),t=new AbortController,n=await $(a.data.loader,i,N(),e,t.signal);if(n.kind===`redirect`)return{kind:`redirect`,to:n.to,status:n.status};if(n.kind===`error`){let e=String(n.message).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),t=`<div data-router-view data-router-error="${n.status}">${e}</div>`;return{kind:`error`,status:n.status,message:n.message,html:t}}c=n.data}let l=D(t).get(o);return l?{kind:`html`,html:`<div data-router-view>${await o.hydratable(c,{name:l,as:`div`,snapshot:!0,...n})}</div>`}:(console.warn(`[ilha-router] renderHydratable: active island for "${M()}" is not in the registry. Falling back to plain SSR — the island will not be interactive on the client.`),{kind:`html`,html:`<div data-router-view>${o.toString(c)}</div>`})},async runLoader(e,t){let n=Z(e),r=s(z,`GET`,n.pathname);if(!r?.data?.island)return{kind:`not-found`};if(!r.data.loader)return{kind:`data`,data:{}};let i=H(r.params),a=t??Q(n),o=new AbortController;return $(r.data.loader,n,i,a,o.signal)},hydrate(e,t={}){if(!_)return console.warn(`[ilha-router] hydrate() called in a non-browser environment`),()=>{};let n=t.root??document.body,r=t.target??n;G();let{unmount:a}=i(e,{root:n}),o=this.mount(r,{hydrate:!0,registry:e,interceptLinks:t.interceptLinks});return()=>{a(),o()}}};return u}var ce={router:se,navigate:K,useRoute:I,isActive:X,enableLinkInterception:q,prime:G,prefetch:j,RouterView:J,RouterLink:Y,loader:v,redirect:x,error:S,composeLoaders:C};export{ie as C,m as E,I as S,h as T,N as _,J as a,se as b,q as c,v as d,K as f,F as g,x as h,Y as i,S as l,G as m,b as n,C as o,j as p,y as r,ae as s,O as t,X as u,M as v,re as w,ce as x,P as y};
package/dist/vite.d.ts CHANGED
@@ -19,7 +19,7 @@ import SassEmbedded from "sass-embedded";
19
19
  import Less from "less";
20
20
  import Stylus from "stylus";
21
21
 
22
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/hmrPayload.d.ts
22
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/hmrPayload.d.ts
23
23
  type HotPayload = ConnectedPayload | PingPayload | UpdatePayload | FullReloadPayload | CustomPayload | ErrorPayload | PrunePayload;
24
24
  interface ConnectedPayload {
25
25
  type: 'connected';
@@ -84,7 +84,7 @@ interface ErrorPayload {
84
84
  };
85
85
  }
86
86
  //#endregion
87
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts
87
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts
88
88
  //#region src/shared/invokeMethods.d.ts
89
89
  interface FetchFunctionOptions {
90
90
  cached?: boolean;
@@ -137,7 +137,7 @@ interface ViteFetchResult {
137
137
  invalidate: boolean;
138
138
  }
139
139
  //#endregion
140
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/customEvent.d.ts
140
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/customEvent.d.ts
141
141
  interface CustomEventMap {
142
142
  // client events
143
143
  'vite:beforeUpdate': UpdatePayload;
@@ -199,7 +199,7 @@ type ForwardConsolePayload = {
199
199
  */
200
200
  type InferCustomEventPayload<T extends string> = T extends keyof CustomEventMap ? CustomEventMap[T] : any;
201
201
  //#endregion
202
- //#region ../../node_modules/.bun/rolldown@1.0.2/node_modules/rolldown/dist/shared/logging-BSNejiLS.d.mts
202
+ //#region ../../node_modules/.bun/rolldown@1.0.3/node_modules/rolldown/dist/shared/logging-BSNejiLS.d.mts
203
203
  //#region src/log/logging.d.ts
204
204
  /** @inline */
205
205
  type LogLevel$1 = "info" | "debug" | "warn";
@@ -249,7 +249,7 @@ interface RolldownError extends RolldownLog {
249
249
  }
250
250
  type LogOrStringHandler = (level: LogLevelWithError, log: RolldownLogWithString) => void; //#endregion
251
251
  //#endregion
252
- //#region ../../node_modules/.bun/@oxc-project+types@0.132.0/node_modules/@oxc-project/types/types.d.ts
252
+ //#region ../../node_modules/.bun/@oxc-project+types@0.133.0/node_modules/@oxc-project/types/types.d.ts
253
253
  // Auto-generated code, DO NOT EDIT DIRECTLY!
254
254
  // To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`.
255
255
  interface Program extends Span {
@@ -1548,7 +1548,7 @@ type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
1548
1548
  type UpdateOperator = "++" | "--";
1549
1549
  type Node$1 = Program | IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | ThisExpression | ArrayExpression | ObjectExpression | ObjectProperty | TemplateLiteral | TaggedTemplateExpression | TemplateElement | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | CallExpression | NewExpression | MetaProperty | SpreadElement | UpdateExpression | UnaryExpression | BinaryExpression | PrivateInExpression | LogicalExpression | ConditionalExpression | AssignmentExpression | ArrayAssignmentTarget | ObjectAssignmentTarget | AssignmentTargetRest | AssignmentTargetWithDefault | AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty | SequenceExpression | Super | AwaitExpression | ChainExpression | ParenthesizedExpression | Directive | Hashbang | BlockStatement | VariableDeclaration | VariableDeclarator | EmptyStatement | ExpressionStatement | IfStatement | DoWhileStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | ContinueStatement | BreakStatement | ReturnStatement | WithStatement | SwitchStatement | SwitchCase | LabeledStatement | ThrowStatement | TryStatement | CatchClause | DebuggerStatement | AssignmentPattern | ObjectPattern | BindingProperty | ArrayPattern | BindingRestElement | Function$1 | FunctionBody | ArrowFunctionExpression | YieldExpression | Class | ClassBody | MethodDefinition | PropertyDefinition | PrivateIdentifier | StaticBlock | AccessorProperty | ImportExpression | ImportDeclaration | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExportSpecifier | V8IntrinsicExpression | BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXOpeningFragment | JSXClosingFragment | JSXNamespacedName | JSXMemberExpression | JSXExpressionContainer | JSXEmptyExpression | JSXAttribute | JSXSpreadAttribute | JSXIdentifier | JSXSpreadChild | JSXText | TSThisParameter | TSEnumDeclaration | TSEnumBody | TSEnumMember | TSTypeAnnotation | TSLiteralType | TSConditionalType | TSUnionType | TSIntersectionType | TSParenthesizedType | TSTypeOperator | TSArrayType | TSIndexedAccessType | TSTupleType | TSNamedTupleMember | TSOptionalType | TSRestType | TSAnyKeyword | TSStringKeyword | TSBooleanKeyword | TSNumberKeyword | TSNeverKeyword | TSIntrinsicKeyword | TSUnknownKeyword | TSNullKeyword | TSUndefinedKeyword | TSVoidKeyword | TSSymbolKeyword | TSThisType | TSObjectKeyword | TSBigIntKeyword | TSTypeReference | TSQualifiedName | TSTypeParameterInstantiation | TSTypeParameter | TSTypeParameterDeclaration | TSTypeAliasDeclaration | TSClassImplements | TSInterfaceDeclaration | TSInterfaceBody | TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration | TSMethodSignature | TSConstructSignatureDeclaration | TSIndexSignatureName | TSInterfaceHeritage | TSTypePredicate | TSModuleDeclaration | TSGlobalDeclaration | TSModuleBlock | TSTypeLiteral | TSInferType | TSTypeQuery | TSImportType | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType | TSTemplateLiteralType | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | Decorator | TSExportAssignment | TSNamespaceExportDeclaration | TSInstantiationExpression | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType | ParamPattern;
1550
1550
  //#endregion
1551
- //#region ../../node_modules/.bun/rolldown@1.0.2/node_modules/rolldown/dist/shared/binding-DktDDYoY.d.mts
1551
+ //#region ../../node_modules/.bun/rolldown@1.0.3/node_modules/rolldown/dist/shared/binding-BaCZTfMx.d.mts
1552
1552
  interface CodegenOptions {
1553
1553
  /**
1554
1554
  * Remove whitespace.
@@ -1556,6 +1556,20 @@ interface CodegenOptions {
1556
1556
  * @default true
1557
1557
  */
1558
1558
  removeWhitespace?: boolean;
1559
+ /**
1560
+ * How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
1561
+ *
1562
+ * * `"none"` - Do not preserve any legal comments.
1563
+ * * `"inline"` - Preserve all legal comments inline.
1564
+ * * `"eof"` - Move all legal comments to the end of the file.
1565
+ * * `"external"` - Extract legal comments without linking.
1566
+ * * `{ linked: "path/to/legal.txt" }` - Extract legal comments and add a link comment to the given path.
1567
+ *
1568
+ * @default "none" (when minifying)
1569
+ */
1570
+ legalComments?: 'none' | 'inline' | 'eof' | 'external' | {
1571
+ linked: string;
1572
+ };
1559
1573
  }
1560
1574
  interface CompressOptions {
1561
1575
  /**
@@ -1847,6 +1861,18 @@ interface DecoratorOptions {
1847
1861
  * @default false
1848
1862
  */
1849
1863
  emitDecoratorMetadata?: boolean;
1864
+ /**
1865
+ * Aligns nullable-union `design:type` emission with `--strictNullChecks`.
1866
+ *
1867
+ * When `true` (default), `T | null` and `T | undefined` emit `Object`, matching tsc strict.
1868
+ * When `false`, `null` and `undefined` are elided from the union so the underlying
1869
+ * primitive constructor is emitted, matching tsc with `--strictNullChecks=false`
1870
+ * and `babel-plugin-transform-typescript-metadata`.
1871
+ *
1872
+ * @see https://www.typescriptlang.org/tsconfig/#strictNullChecks
1873
+ * @default true
1874
+ */
1875
+ strictNullChecks?: boolean;
1850
1876
  }
1851
1877
  type HelperMode =
1852
1878
  /**
@@ -2652,7 +2678,7 @@ declare class Exclude$1 {
2652
2678
  constructor(expr: FilterExpression);
2653
2679
  }
2654
2680
  //#endregion
2655
- //#region ../../node_modules/.bun/rolldown@1.0.2/node_modules/rolldown/dist/shared/define-config-Bo24xyUK.d.mts
2681
+ //#region ../../node_modules/.bun/rolldown@1.0.3/node_modules/rolldown/dist/shared/define-config-3BX_X2Am.d.mts
2656
2682
  //#region src/types/misc.d.ts
2657
2683
  /** @inline */
2658
2684
  type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
@@ -4132,6 +4158,8 @@ interface ChecksOptions {
4132
4158
  * Such modules can significantly slow down module resolution. Consider using
4133
4159
  * [`@rolldown/plugin-transform-imports`](https://github.com/rolldown/plugins/tree/main/packages/transform-imports)
4134
4160
  * to rewrite barrel imports at the source level so the barrel file is never loaded.
4161
+ *
4162
+ * See [Large barrel modules](https://rolldown.rs/in-depth/lazy-barrel-optimization#large-barrel-modules) for more details.
4135
4163
  * @default true
4136
4164
  * */
4137
4165
  largeBarrelModules?: boolean;
@@ -6283,7 +6311,7 @@ interface RolldownOptions extends InputOptions {
6283
6311
  * @category Config
6284
6312
  */
6285
6313
  //#endregion
6286
- //#region ../../node_modules/.bun/rolldown@1.0.2/node_modules/rolldown/dist/shared/transform-BpeSEA-X.d.mts
6314
+ //#region ../../node_modules/.bun/rolldown@1.0.3/node_modules/rolldown/dist/shared/transform-7xCUVrpL.d.mts
6287
6315
  //#endregion
6288
6316
  //#region src/utils/transform.d.ts
6289
6317
  /**
@@ -6298,13 +6326,13 @@ interface TransformOptions$1 extends BindingEnhancedTransformOptions {}
6298
6326
  * @category Utilities
6299
6327
  */
6300
6328
  //#endregion
6301
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/internal/esbuildOptions.d.ts
6329
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/internal/esbuildOptions.d.ts
6302
6330
  /* eslint-enable @typescript-eslint/ban-ts-comment */
6303
6331
  type EsbuildTarget = string | string[];
6304
6332
  type EsbuildTransformOptions = esbuild.TransformOptions;
6305
6333
  type DepsOptimizerEsbuildOptions = Omit<esbuild.BuildOptions, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>;
6306
6334
  //#endregion
6307
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/metadata.d.ts
6335
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/metadata.d.ts
6308
6336
  interface AssetMetadata {
6309
6337
  importedAssets: Set<string>;
6310
6338
  importedCss: Set<string>;
@@ -6347,16 +6375,16 @@ declare module 'rolldown' {
6347
6375
  }
6348
6376
  }
6349
6377
  //#endregion
6350
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/internal/terserOptions.d.ts
6378
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/internal/terserOptions.d.ts
6351
6379
  /* eslint-enable @typescript-eslint/ban-ts-comment */
6352
6380
  type TerserMinifyOptions = Terser.MinifyOptions;
6353
6381
  //#endregion
6354
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/internal/lightningcssOptions.d.ts
6382
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/internal/lightningcssOptions.d.ts
6355
6383
  /* eslint-enable @typescript-eslint/ban-ts-comment */
6356
6384
  type LightningCSSOptions = Omit<Lightningcss.BundleAsyncOptions<Lightningcss.CustomAtRules>, 'filename' | 'resolver' | 'minify' | 'sourceMap' | 'analyzeDependencies' // properties not overridden by Vite, but does not make sense to set by end users
6357
6385
  | 'inputSourceMap' | 'projectRoot'>;
6358
6386
  //#endregion
6359
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/internal/cssPreprocessorOptions.d.ts
6387
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/internal/cssPreprocessorOptions.d.ts
6360
6388
  /* eslint-enable @typescript-eslint/ban-ts-comment */
6361
6389
  // https://github.com/type-challenges/type-challenges/issues/29285
6362
6390
  type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
@@ -6375,7 +6403,7 @@ declare global {
6375
6403
  interface HTMLLinkElement {}
6376
6404
  }
6377
6405
  //#endregion
6378
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/types/importGlob.d.ts
6406
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/types/importGlob.d.ts
6379
6407
  /**
6380
6408
  * Declare Worker in case DOM is not added to the tsconfig lib causing
6381
6409
  * Worker interface is not defined. For developers with DOM lib added,
@@ -6386,10 +6414,10 @@ declare global {
6386
6414
  interface Worker {}
6387
6415
  }
6388
6416
  //#endregion
6389
- //#region ../../node_modules/.bun/vite@8.0.14+9357385a17cbd143/node_modules/vite/dist/node/index.d.ts
6417
+ //#region ../../node_modules/.bun/vite@8.0.16+9357385a17cbd143/node_modules/vite/dist/node/index.d.ts
6390
6418
  //#region \0rolldown/runtime.js
6391
6419
  //#endregion
6392
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.24_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
6420
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.1_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
6393
6421
  //#region src/node/cli-commands.d.ts
6394
6422
  interface StartOptions {
6395
6423
  root?: string;
@@ -6398,7 +6426,7 @@ interface StartOptions {
6398
6426
  port?: string | number;
6399
6427
  open?: boolean;
6400
6428
  } //#endregion
6401
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.24_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
6429
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.1_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
6402
6430
  //#region src/node/config.d.ts
6403
6431
  interface DevToolsConfig extends Partial<StartOptions> {
6404
6432
  enabled: boolean;
package/dist/vite.js CHANGED
@@ -1,9 +1 @@
1
- import { C as wrapError, w as wrapLayout } from "./src-B_DKbd_R.js";
2
- import { t as ilhaPages } from "./plugin-Cq0xpVL8.js";
3
- //#region src/vite.ts
4
- /** Vite plugin — use via `@ilha/router/vite`. */
5
- function pages(options = {}) {
6
- return ilhaPages.vite(options);
7
- }
8
- //#endregion
9
- export { ilhaPages, pages, wrapError, wrapLayout };
1
+ import{C as e,w as t}from"./src-ObXICXKp.js";import{t as n}from"./plugin-OpojKenS.js";function r(e={}){return n.vite(e)}export{n as ilhaPages,r as pages,e as wrapError,t as wrapLayout};
package/package.json CHANGED
@@ -1,7 +1,23 @@
1
1
  {
2
2
  "name": "@ilha/router",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "A tiny SPA router for Ilha",
5
+ "keywords": [
6
+ "frontend",
7
+ "ilha",
8
+ "island-architecture",
9
+ "islands",
10
+ "router",
11
+ "routing",
12
+ "spa",
13
+ "ssr",
14
+ "unplugin",
15
+ "vite"
16
+ ],
17
+ "homepage": "https://github.com/ilhajs/ilha/tree/main/packages/router#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/ilhajs/ilha/issues"
20
+ },
5
21
  "license": "MIT",
6
22
  "author": "Ryuz <ryuzer@proton.me>",
7
23
  "repository": {
@@ -12,9 +28,12 @@
12
28
  "dist"
13
29
  ],
14
30
  "type": "module",
31
+ "sideEffects": false,
32
+ "module": "./dist/index.js",
15
33
  "browser": {
16
34
  "process": false
17
35
  },
36
+ "types": "./dist/index.d.ts",
18
37
  "exports": {
19
38
  ".": {
20
39
  "types": "./dist/index.d.ts",
@@ -33,16 +52,19 @@
33
52
  "import": "./dist/rolldown.js"
34
53
  }
35
54
  },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
36
58
  "scripts": {
37
59
  "build": "tsc && tsdown",
38
60
  "test": "bun test"
39
61
  },
40
62
  "dependencies": {
41
- "ilha": "0.7.1",
63
+ "ilha": "0.8.0",
42
64
  "rou3": "0.8.1",
43
65
  "unplugin": "3.0.0"
44
66
  },
45
67
  "devDependencies": {
46
- "vite": "^8.0.14"
68
+ "vite": "^8.0.16"
47
69
  }
48
70
  }