@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 +6 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
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
|
-
|
|
20
|
-
|
|
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
|
|
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:
|
|
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};
|