@carats/ssr 0.0.7 → 0.0.8

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
@@ -1,4 +1,4 @@
1
- import { CaratsRequest, Hallmark } from '@carats/core';
1
+ import { CaratsRequest, Culet } from '@carats/core';
2
2
  import { Facets } from '@carats/render';
3
3
 
4
4
  interface CaratsServerEntry {
@@ -8,11 +8,9 @@ interface CaratsServerEntry {
8
8
  }>;
9
9
  getServerProps: <T = any>(req: CaratsRequest) => Promise<T> | T;
10
10
  facets: Facets;
11
- hallmarks: Record<string, HallmarkModule>;
11
+ culets: Record<string, Culet>;
12
12
  }
13
- interface HallmarkModule {
14
- default: Hallmark;
15
- }
16
- declare function defineServerEntry(facets: Facets, hallmarks: Record<string, HallmarkModule>): CaratsServerEntry;
13
+ declare function culet(route: string, culet: Culet): void;
14
+ declare function defineServerEntry(facets: Facets): CaratsServerEntry;
17
15
 
18
- export { type CaratsServerEntry, defineServerEntry as default };
16
+ export { type CaratsServerEntry, culet, defineServerEntry };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{getPageComponent as u,renderPage as d}from"@carats/render";import{init as f,transpile as g}from"jjsx";function h(t,s){f();async function c(r){let{component:o,params:a,hallmark:l}=u.call(t,r.url.replace("/api","")),n=Object.keys(s).find(i=>i.endsWith(`${l}.cara.ts`));return n?await s[n].default({...r,params:a}):o.defaultProps||{...r,params:a}}async function m(r){let{suspense:{error:o}}=t,{component:a,hallmark:l}=u.call(t,r.url),n=await c(r),e=a.head||"";e+=`
2
- <script>window.ssp=${JSON.stringify({for:l,data:n})}</script>`,e=e.trim();let i=await d.call(t,a,n);try{return{html:i,head:e}}catch(p){return{html:g(o(p)),head:e}}}return{render:m,getServerProps:c,facets:t,hallmarks:s}}export{h as default};
1
+ import{getPageComponent as l,renderPage as C}from"@carats/render";import{parseUrl as d}from"@carats/url";import{init as f,transpile as P}from"jjsx";var a={};function w(r,s){a[r]=s}function E(r){f();async function s(t,c){let{component:o,params:i,route:e}=c||l.call(r,t.url.replace("/culet",""));return a[e]?await a[e]({...t,params:i}):o.defaultProps}async function p(t){let{suspense:{error:c}}=r,o=l.call(r,t.url),{path:i}=d(t.url),e=await s(t,o),{component:u}=o,n=u.head||"";n+=`
2
+ <script>window.ssp=${JSON.stringify({for:i,data:e})}</script>`,n=n.trim();let m=await C.call(r,u,e);try{return{html:m,head:n}}catch(g){return{html:P(c(g)),head:n}}}return{render:p,getServerProps:s,facets:r,culets:a}}export{w as culet,E as defineServerEntry};
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
- {
2
- "name": "@carats/ssr",
3
- "version": "0.0.7",
4
- "description": "SSR module for Carats",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": ["dist"],
8
- "type": "module",
9
- "scripts": {
10
- "prepublishOnly": "npm run build",
11
- "build": "tsup ./src/index.ts --config ../../tsup.config.ts"
12
- },
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "peerDependencies": {
17
- "@carats/core": "^0.0.12",
18
- "@carats/render": "^0.0.5",
19
- "jjsx": "^3.3.0",
20
- "vite": "^8.0.2"
21
- }
22
- }
1
+ {
2
+ "name": "@carats/ssr",
3
+ "version": "0.0.8",
4
+ "description": "SSR module for Carats",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": ["dist"],
8
+ "type": "module",
9
+ "scripts": {
10
+ "prepublishOnly": "npm run build",
11
+ "build": "tsup ./src/index.ts --config ../../tsup.config.ts"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "peerDependencies": {
17
+ "@carats/core": "^0.0.13",
18
+ "@carats/render": "^0.0.6",
19
+ "jjsx": "^3.3.0",
20
+ "vite": "^8.0.2"
21
+ }
22
+ }