@bobtail.software/b-ssr 1.0.3 → 1.0.4

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.
@@ -1,9 +1,7 @@
1
- import { AnyRouter } from '@tanstack/react-router';
2
-
3
1
  /**
4
2
  * Hidrata la aplicación en el cliente.
5
3
  * @param createRouterFn Función que crea el router
6
4
  */
7
- declare function hydrateClient(createRouterFn: () => AnyRouter): void;
5
+ declare function hydrateClient(createRouterFn: () => any): void;
8
6
 
9
7
  export { hydrateClient };
@@ -1 +1 @@
1
- import{RouterClient as r}from"@tanstack/react-router/ssr/client";import c from"react";import{createRoot as m,hydrateRoot as i}from"react-dom/client";import{jsx as o}from"react/jsx-runtime";function f(n){let e=n(),t=document.getElementById("root")||document.getElementById("app");t&&!t.innerHTML?m(t).render(o(c.StrictMode,{children:o(r,{router:e})})):t&&i(document,o(r,{router:e}))}export{f as hydrateClient};
1
+ import{RouterClient as r}from"@tanstack/react-router/ssr/client";import c from"react";import{createRoot as m,hydrateRoot as d}from"react-dom/client";import{jsx as o}from"react/jsx-runtime";function l(n){let e=n(),t=document.getElementById("root")||document.getElementById("app");t&&!t.innerHTML?m(t).render(o(c.StrictMode,{children:o(r,{router:e})})):t&&d(document,o(r,{router:e}))}export{l as hydrateClient};
@@ -1,4 +1,3 @@
1
- import { AnyRouter } from '@tanstack/react-router';
2
1
  import { FastifyRequest, FastifyReply } from 'fastify';
3
2
 
4
3
  interface RenderOptions {
@@ -13,6 +12,6 @@ interface RenderOptions {
13
12
  * @param createRouterFn Función que devuelve una instancia del Router
14
13
  * @returns Una función `render` lista para ser exportada en entry-server.tsx
15
14
  */
16
- declare function createServerHandler(createRouterFn: () => AnyRouter): ({ req, reply, head, data }: RenderOptions) => Promise<never>;
15
+ declare function createServerHandler(createRouterFn: () => any): ({ req, reply, head, data }: RenderOptions) => Promise<never>;
17
16
 
18
17
  export { type RenderOptions, createServerHandler };
@@ -1 +1 @@
1
- import{createRequestHandler as R,renderRouterToStream as h,RouterServer as y}from"@tanstack/react-router/ssr/server";import{jsx as l}from"react/jsx-runtime";function p(e){let d=e.protocol,s=e.hostname,r=`${d}://${s}`,u=new URL(e.url,r||"http://localhost:3000").href,a=new Headers;for(let[c,o]of Object.entries(e.headers))o&&a.set(c,Array.isArray(o)?o.join(", "):o);return new Request(u,{method:e.method,headers:a})}function q(e){return async function({req:s,reply:r,head:u,data:a}){let c=p(s),i=await R({request:c,createRouter:()=>{let t=e(),n=t.options.context||{};return t.update({context:{...n,head:u,req:s,reply:r,loaderData:a}}),t}})(({request:t,responseHeaders:n,router:f})=>h({request:t,responseHeaders:n,router:f,children:l(y,{router:f})}));return r.status(i.status),i.headers.forEach((t,n)=>{r.header(n,t)}),r.send(i.body)}}export{q as createServerHandler};
1
+ import{createRequestHandler as h,renderRouterToStream as R,RouterServer as y}from"@tanstack/react-router/ssr/server";import{jsx as p}from"react/jsx-runtime";function l(e){let d=e.protocol,s=e.hostname,r=`${d}://${s}`,u=new URL(e.url,r||"http://localhost:3000").href,a=new Headers;for(let[c,o]of Object.entries(e.headers))o&&a.set(c,Array.isArray(o)?o.join(", "):o);return new Request(u,{method:e.method,headers:a})}function q(e){return async function({req:s,reply:r,head:u,data:a}){let c=l(s),i=await h({request:c,createRouter:()=>{let t=e(),n=t.options.context||{};return t.update({context:{...n,head:u,req:s,reply:r,loaderData:a}}),t}})(({request:t,responseHeaders:n,router:f})=>R({request:t,responseHeaders:n,router:f,children:p(y,{router:f})}));return r.status(i.status),i.headers.forEach((t,n)=>{r.header(n,t)}),r.send(i.body)}}export{q as createServerHandler};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobtail.software/b-ssr",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Fastify + Vite SSR Plugin wrapper with RPC",
5
5
  "author": "Victor Moreno <info@bobtail.software> (https://bobtail.software)",
6
6
  "license": "GPL-3.0",