renderify 0.1.0 → 0.3.0
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/README.md +88 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -39,6 +39,93 @@ console.log(result.html);
|
|
|
39
39
|
await app.stop();
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## Renderer-only (BYO LLM/Backend)
|
|
43
|
+
|
|
44
|
+
You do not need to use the built-in LLM providers. A common integration is to generate RuntimePlan externally and only use `renderify` for execution/rendering:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { renderPlanInBrowser, renderPlanOnce } from "renderify";
|
|
48
|
+
|
|
49
|
+
const plan = {
|
|
50
|
+
specVersion: "runtime-plan/v1",
|
|
51
|
+
id: "renderer_only",
|
|
52
|
+
version: 1,
|
|
53
|
+
root: {
|
|
54
|
+
type: "element",
|
|
55
|
+
tag: "section",
|
|
56
|
+
children: [{ type: "text", value: "Hello from external plan" }],
|
|
57
|
+
},
|
|
58
|
+
capabilities: { domWrite: true },
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Browser mount
|
|
62
|
+
await renderPlanInBrowser(plan, { target: "#app" });
|
|
63
|
+
|
|
64
|
+
// Optional one-shot execution in app orchestration flow
|
|
65
|
+
const result = await renderPlanOnce(plan);
|
|
66
|
+
console.log(result.html);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Renderer-only TSX + Dependency Package (JSPM)
|
|
70
|
+
|
|
71
|
+
`renderPlanInBrowser` defaults to `auto-pin-latest`, so bare imports work out of the box:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { renderPlanInBrowser } from "renderify";
|
|
75
|
+
|
|
76
|
+
const tsxPlan = {
|
|
77
|
+
specVersion: "runtime-plan/v1",
|
|
78
|
+
id: "renderer_only_tsx_datefns",
|
|
79
|
+
version: 1,
|
|
80
|
+
capabilities: { domWrite: true },
|
|
81
|
+
root: {
|
|
82
|
+
type: "element",
|
|
83
|
+
tag: "div",
|
|
84
|
+
children: [{ type: "text", value: "Loading..." }],
|
|
85
|
+
},
|
|
86
|
+
source: {
|
|
87
|
+
language: "tsx",
|
|
88
|
+
runtime: "renderify",
|
|
89
|
+
code: `
|
|
90
|
+
import { format } from "date-fns/format";
|
|
91
|
+
|
|
92
|
+
export default function App() {
|
|
93
|
+
return <section>Today: {format(new Date(), "yyyy-MM-dd")}</section>;
|
|
94
|
+
}
|
|
95
|
+
`,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
await renderPlanInBrowser(tsxPlan, { target: "#app" });
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
For production determinism, prefer `manifest-only` (explicit pinned versions) and disable auto-pin:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
const pinnedPlan = {
|
|
106
|
+
...tsxPlan,
|
|
107
|
+
moduleManifest: {
|
|
108
|
+
"date-fns/format": {
|
|
109
|
+
resolvedUrl: "https://ga.jspm.io/npm:date-fns@4.1.0/format.js",
|
|
110
|
+
version: "4.1.0",
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
await renderPlanInBrowser(pinnedPlan, {
|
|
116
|
+
target: "#app",
|
|
117
|
+
autoPinLatestModuleManifest: false,
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Auto-pin-latest workflow (`renderPlanInBrowser` default):
|
|
122
|
+
|
|
123
|
+
1. Write bare imports for DX, for example `import { format } from "date-fns/format"`.
|
|
124
|
+
2. On first run, Renderify resolves the bare specifier via JSPM latest metadata.
|
|
125
|
+
3. Renderify immediately pins and injects the exact resolved URL/version into `moduleManifest`, then executes with pinned resolution.
|
|
126
|
+
|
|
127
|
+
Use `manifest-only` in production (`autoPinLatestModuleManifest: false`) when you want fully pre-pinned, reviewable dependency mappings.
|
|
128
|
+
|
|
42
129
|
## One-shot Prompt Rendering
|
|
43
130
|
|
|
44
131
|
```ts
|
|
@@ -67,5 +154,6 @@ console.log(result.html);
|
|
|
67
154
|
|
|
68
155
|
## Notes
|
|
69
156
|
|
|
157
|
+
- Default browser embedding behavior is `auto-pin-latest` for bare source imports; use `manifest-only` for production-grade deterministic deployments.
|
|
70
158
|
- Node.js `>=22` is required.
|
|
71
159
|
- For advanced split-package usage, you can still import `@renderify/core`, `@renderify/runtime`, `@renderify/security`, `@renderify/llm`, and `@renderify/ir` directly.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renderify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Official Renderify SDK facade",
|
|
5
5
|
"main": "dist/renderify.cjs.js",
|
|
6
6
|
"types": "dist/renderify.d.ts",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@renderify/core": "^0.
|
|
49
|
-
"@renderify/ir": "^0.
|
|
50
|
-
"@renderify/llm": "^0.
|
|
51
|
-
"@renderify/runtime": "^0.
|
|
52
|
-
"@renderify/security": "^0.
|
|
48
|
+
"@renderify/core": "^0.3.0",
|
|
49
|
+
"@renderify/ir": "^0.3.0",
|
|
50
|
+
"@renderify/llm": "^0.3.0",
|
|
51
|
+
"@renderify/runtime": "^0.3.0",
|
|
52
|
+
"@renderify/security": "^0.3.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "echo \"Error: no test specified\" && exit 1",
|