@carats/ssr 0.0.15 → 0.0.16
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 +1 -4
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,11 +13,8 @@ interface CaratsServerEntry {
|
|
|
13
13
|
type CuletArgs = Omit<CaratsRequest, 'data'> & {
|
|
14
14
|
params: Record<string, string>;
|
|
15
15
|
};
|
|
16
|
-
type Culet<T = any> = (
|
|
17
|
-
__isCulet__?: true;
|
|
18
|
-
};
|
|
16
|
+
type Culet<T = any> = (request: CuletArgs) => T;
|
|
19
17
|
declare const seat: <T extends Culet>(f: T) => T;
|
|
20
|
-
declare function culet<T = any>(culet: Culet<T>): Culet<T>;
|
|
21
18
|
declare function culet<T = any>(route: string, culet: Culet<T>): Culet<T>;
|
|
22
19
|
declare function defineServerEntry(facets: Facets): CaratsServerEntry;
|
|
23
20
|
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getPageComponent as
|
|
2
|
-
<script>window.ssp=${JSON.stringify({for:
|
|
1
|
+
import{getPageComponent as p,renderPage as g}from"@carats/render";import{parseUrl as d}from"@carats/url";import{init as y,transpile as f}from"jjsx";var o={},x=r=>r;function q(r,t){return o[r]=t,t}function S(r){y();async function t(e,u){let{component:a,params:c,route:n}=u||p.call(r,e.url.replace("/culet",""));return o[n]?await o[n]({...e,params:c}):a.defaultProps}async function l(e){let{suspense:{error:u}}=r,a=p.call(r,e.url),{path:c}=d(e.url),n=await t(e,a),{component:i}=a,s=i.head||"";s+=`
|
|
2
|
+
<script>window.ssp=${JSON.stringify({for:c,data:n})}</script>`,s=s.trim();let m=await g.call(r,i,n);try{return{html:m,head:s}}catch(C){return{html:f(u(C)),head:s}}}return{render:l,getServerProps:t,facets:r,culets:o}}export{q as culet,S as defineServerEntry,x as seat};
|