@carats/ssr 0.0.10 → 0.0.12

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.d.ts CHANGED
@@ -16,8 +16,12 @@ type CuletArgs<B = Object> = CaratsRequest<B> & {
16
16
  type Culet<I = any, O = any> = ((request: CuletArgs<I>) => O) & {
17
17
  __isCulet__?: true;
18
18
  };
19
- declare function culet(culet: Culet): Culet;
20
- declare function culet(route: string, culet: Culet): Culet;
19
+ /**
20
+ * @template I - Input type - The type of the request.body object
21
+ * @template O - Output type - The type of culet output
22
+ */
23
+ declare function culet<I = any, O = any>(culet: Culet<I, O>): Culet<I, O>;
24
+ declare function culet<I = any, O = any>(route: string, culet: Culet<I, O>): Culet<I, O>;
21
25
  declare function defineServerEntry(facets: Facets): CaratsServerEntry;
22
26
 
23
27
  export { type CaratsServerEntry, type Culet, type CuletArgs, culet, defineServerEntry };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{getPageComponent as l,renderPage as g}from"@carats/render";import{parseUrl as f}from"@carats/url";import{init as d,transpile as y}from"jjsx";var a={};function x(t,r){if(typeof t=="string")return a[t]=r,r.__isCulet__=!0,r;if(!t.__isCulet__)throw new Error("Invalid culet");return t}function q(t){d();async function r(e,u){let{component:o,params:i,route:n}=u||l.call(t,e.url.replace("/culet",""));return a[n]?await a[n]({...e,params:i}):o.defaultProps}async function p(e){let{suspense:{error:u}}=t,o=l.call(t,e.url),{path:i}=f(e.url),n=await r(e,o),{component:c}=o,s=c.head||"";s+=`
2
- <script>window.ssp=${JSON.stringify({for:i,data:n})}</script>`,s=s.trim();let C=await g.call(t,c,n);try{return{html:C,head:s}}catch(m){return{html:y(u(m)),head:s}}}return{render:p,getServerProps:r,facets:t,culets:a}}export{x as culet,q as defineServerEntry};
1
+ import{getPageComponent as l,renderPage as g}from"@carats/render";import{parseUrl as y}from"@carats/url";import{init as f,transpile as d}from"jjsx";var o={};function h(t,r){if(typeof t=="string")return o[t]=r,r.__isCulet__=!0,r;if(!t.__isCulet__)throw new Error("Invalid culet");return t}function w(t){f();async function r(e,u){let{component:a,params:i,route:n}=u||l.call(t,e.url.replace("/culet",""));return o[n]?await o[n]({...e,params:i}):a.defaultProps}async function p(e){let{suspense:{error:u}}=t,a=l.call(t,e.url),{path:i}=y(e.url),n=await r(e,a),{component:c}=a,s=c.head||"";s+=`
2
+ <script>window.ssp=${JSON.stringify({for:i,data:n})}</script>`,s=s.trim();let C=await g.call(t,c,n);try{return{html:C,head:s}}catch(m){return{html:d(u(m)),head:s}}}return{render:p,getServerProps:r,facets:t,culets:o}}export{h as culet,w as defineServerEntry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carats/ssr",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "SSR module for Carats",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",