loopwind 0.25.6 → 0.25.7
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/app/.astro/types.d.ts +1 -0
- package/app/dist/_astro/callback.Ci5gaEfJ.css +1 -0
- package/app/dist/auth/callback/index.html +81 -0
- package/app/dist/device/index.html +70 -0
- package/app/dist/index.html +327 -0
- package/app/package-lock.json +9239 -0
- package/app/package.json +23 -0
- package/app/wrangler.toml +8 -0
- package/dist/cli.js +54 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/login.d.ts +5 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +60 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +5 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +15 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/publish.d.ts +10 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +155 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/templates.d.ts +5 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/templates.js +60 -0
- package/dist/commands/templates.js.map +1 -0
- package/dist/commands/unpublish.d.ts +5 -0
- package/dist/commands/unpublish.d.ts.map +1 -0
- package/dist/commands/unpublish.js +54 -0
- package/dist/commands/unpublish.js.map +1 -0
- package/dist/commands/whoami.d.ts +5 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +30 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/lib/api.d.ts +92 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +149 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/auth.d.ts +41 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +89 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/bundler.d.ts +18 -0
- package/dist/lib/bundler.d.ts.map +1 -0
- package/dist/lib/bundler.js +105 -0
- package/dist/lib/bundler.js.map +1 -0
- package/dist/lib/helpers.d.ts +35 -2
- package/dist/lib/helpers.d.ts.map +1 -1
- package/dist/lib/helpers.js +91 -13
- package/dist/lib/helpers.js.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/sdk/edge.d.ts +65 -0
- package/dist/sdk/edge.d.ts.map +1 -0
- package/dist/sdk/edge.js +329 -0
- package/dist/sdk/edge.js.map +1 -0
- package/dist/sdk/errors.d.ts +64 -0
- package/dist/sdk/errors.d.ts.map +1 -0
- package/dist/sdk/errors.js +94 -0
- package/dist/sdk/errors.js.map +1 -0
- package/dist/sdk/index.d.ts +29 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +30 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/render.d.ts +52 -0
- package/dist/sdk/render.d.ts.map +1 -0
- package/dist/sdk/render.js +432 -0
- package/dist/sdk/render.js.map +1 -0
- package/dist/sdk/types.d.ts +185 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +5 -0
- package/dist/sdk/types.js.map +1 -0
- package/dist/types/template.d.ts +18 -0
- package/dist/types/template.d.ts.map +1 -1
- package/package.json +26 -4
- package/plans/PLATFORM.md +1637 -237
- package/plans/PLATFORM_IMPLEMENTATION.md +1347 -530
- package/plans/SDK.md +797 -0
- package/platform/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/ebad93a0a7be9c5768c512f3e30740b64d2b6e575277a40d77044af5ae8fd3f2.sqlite +0 -0
- package/platform/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/ebad93a0a7be9c5768c512f3e30740b64d2b6e575277a40d77044af5ae8fd3f2.sqlite-shm +0 -0
- package/platform/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/ebad93a0a7be9c5768c512f3e30740b64d2b6e575277a40d77044af5ae8fd3f2.sqlite-wal +0 -0
- package/platform/migrations/0001_initial.sql +90 -0
- package/platform/package-lock.json +3104 -0
- package/platform/package.json +30 -0
- package/platform/wrangler.toml +43 -0
- package/tests-sdk/createRenderer.test.ts +251 -0
- package/tests-sdk/errors.test.ts +230 -0
- package/tests-sdk/render.test.ts +241 -0
- package/tests-sdk/tw.test.ts +277 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loopwind SDK - Render Functions
|
|
3
|
+
*/
|
|
4
|
+
import satori from 'satori';
|
|
5
|
+
import { Resvg } from '@resvg/resvg-wasm';
|
|
6
|
+
import sharp from 'sharp';
|
|
7
|
+
import { tw as twConverter } from '../lib/tailwind.js';
|
|
8
|
+
import { qr, image } from '../lib/helpers.js';
|
|
9
|
+
import { ensureResvgWasm } from '../lib/resvg-init.js';
|
|
10
|
+
import { RenderError, ValidationError, TimeoutError, } from './errors.js';
|
|
11
|
+
// Default fonts (loaded lazily)
|
|
12
|
+
let defaultFonts = null;
|
|
13
|
+
/**
|
|
14
|
+
* Load default Inter fonts from bundled assets or CDN
|
|
15
|
+
* Satori requires TTF/OTF/WOFF format (not WOFF2)
|
|
16
|
+
*/
|
|
17
|
+
async function loadDefaultFonts() {
|
|
18
|
+
if (defaultFonts)
|
|
19
|
+
return defaultFonts;
|
|
20
|
+
const fonts = [];
|
|
21
|
+
try {
|
|
22
|
+
// First try to load bundled fonts from package (WOFF format)
|
|
23
|
+
const path = await import('path');
|
|
24
|
+
const fs = await import('fs/promises');
|
|
25
|
+
const { fileURLToPath } = await import('url');
|
|
26
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
27
|
+
const __dirname = path.dirname(__filename);
|
|
28
|
+
const fontsDir = path.join(__dirname, '..', 'assets', 'fonts');
|
|
29
|
+
try {
|
|
30
|
+
const regularPath = path.join(fontsDir, 'Inter-Regular.woff');
|
|
31
|
+
const boldPath = path.join(fontsDir, 'Inter-Bold.woff');
|
|
32
|
+
const [regular, bold] = await Promise.all([
|
|
33
|
+
fs.readFile(regularPath),
|
|
34
|
+
fs.readFile(boldPath),
|
|
35
|
+
]);
|
|
36
|
+
fonts.push({ name: 'Inter', data: regular, weight: 400, style: 'normal' }, { name: 'Inter', data: bold, weight: 700, style: 'normal' });
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Bundled fonts not found, fetch from CDN (using WOFF, not WOFF2)
|
|
40
|
+
const [regular, bold] = await Promise.all([
|
|
41
|
+
fetch('https://cdn.jsdelivr.net/npm/@fontsource/inter@5.0.18/files/inter-latin-400-normal.woff')
|
|
42
|
+
.then(r => {
|
|
43
|
+
if (!r.ok)
|
|
44
|
+
throw new Error(`HTTP ${r.status}`);
|
|
45
|
+
return r.arrayBuffer();
|
|
46
|
+
}),
|
|
47
|
+
fetch('https://cdn.jsdelivr.net/npm/@fontsource/inter@5.0.18/files/inter-latin-700-normal.woff')
|
|
48
|
+
.then(r => {
|
|
49
|
+
if (!r.ok)
|
|
50
|
+
throw new Error(`HTTP ${r.status}`);
|
|
51
|
+
return r.arrayBuffer();
|
|
52
|
+
}),
|
|
53
|
+
]);
|
|
54
|
+
fonts.push({ name: 'Inter', data: regular, weight: 400, style: 'normal' }, { name: 'Inter', data: bold, weight: 700, style: 'normal' });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
throw new Error(`Failed to load default fonts: ${error.message}. Please provide custom fonts.`);
|
|
59
|
+
}
|
|
60
|
+
if (fonts.length === 0) {
|
|
61
|
+
throw new Error('No fonts could be loaded. Please provide custom fonts.');
|
|
62
|
+
}
|
|
63
|
+
defaultFonts = fonts;
|
|
64
|
+
return fonts;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Convert FontConfig array to Satori font format
|
|
68
|
+
*/
|
|
69
|
+
function toSatoriFonts(fonts) {
|
|
70
|
+
return fonts.map(f => ({
|
|
71
|
+
name: f.name,
|
|
72
|
+
data: f.data,
|
|
73
|
+
weight: f.weight || 400,
|
|
74
|
+
style: f.style || 'normal',
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Validate render options
|
|
79
|
+
*/
|
|
80
|
+
function validateOptions(options) {
|
|
81
|
+
const { width, height, format, fps, duration, quality, crf, scale } = options;
|
|
82
|
+
if (width !== undefined && (width < 1 || width > 16384)) {
|
|
83
|
+
throw new ValidationError('Width must be between 1 and 16384', 'width', '1-16384', width);
|
|
84
|
+
}
|
|
85
|
+
if (height !== undefined && (height < 1 || height > 16384)) {
|
|
86
|
+
throw new ValidationError('Height must be between 1 and 16384', 'height', '1-16384', height);
|
|
87
|
+
}
|
|
88
|
+
if (format !== undefined) {
|
|
89
|
+
const validFormats = ['png', 'svg', 'jpg', 'jpeg', 'webp', 'mp4', 'gif'];
|
|
90
|
+
if (!validFormats.includes(format)) {
|
|
91
|
+
throw new ValidationError(`Invalid format: ${format}`, 'format', validFormats.join(', '), format);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (fps !== undefined && (fps < 1 || fps > 120)) {
|
|
95
|
+
throw new ValidationError('FPS must be between 1 and 120', 'fps', '1-120', fps);
|
|
96
|
+
}
|
|
97
|
+
if (duration !== undefined && (duration < 0.1 || duration > 300)) {
|
|
98
|
+
throw new ValidationError('Duration must be between 0.1 and 300 seconds', 'duration', '0.1-300', duration);
|
|
99
|
+
}
|
|
100
|
+
if (quality !== undefined && (quality < 1 || quality > 100)) {
|
|
101
|
+
throw new ValidationError('Quality must be between 1 and 100', 'quality', '1-100', quality);
|
|
102
|
+
}
|
|
103
|
+
if (crf !== undefined && (crf < 0 || crf > 51)) {
|
|
104
|
+
throw new ValidationError('CRF must be between 0 and 51', 'crf', '0-51', crf);
|
|
105
|
+
}
|
|
106
|
+
if (scale !== undefined && (scale < 0.1 || scale > 10)) {
|
|
107
|
+
throw new ValidationError('Scale must be between 0.1 and 10', 'scale', '0.1-10', scale);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Check if format is a video format
|
|
112
|
+
*/
|
|
113
|
+
function isVideoFormat(format) {
|
|
114
|
+
return format === 'mp4' || format === 'gif';
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Render a single frame to SVG
|
|
118
|
+
*/
|
|
119
|
+
async function renderFrameToSVG(template, props, width, height, fonts, frameInfo, config, debug) {
|
|
120
|
+
// Create helpers
|
|
121
|
+
const twFn = (classes) => twConverter(classes, null, config || {}, {
|
|
122
|
+
progress: frameInfo?.progress ?? 0,
|
|
123
|
+
frame: frameInfo?.index ?? 0,
|
|
124
|
+
totalFrames: frameInfo?.total,
|
|
125
|
+
durationMs: frameInfo?.duration ? frameInfo.duration * 1000 : undefined,
|
|
126
|
+
});
|
|
127
|
+
// Pre-generate QR codes and images from props
|
|
128
|
+
const qrCache = new Map();
|
|
129
|
+
const imageCache = new Map();
|
|
130
|
+
// Pre-generate QR codes for string props
|
|
131
|
+
const qrPromises = [];
|
|
132
|
+
for (const value of Object.values(props)) {
|
|
133
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
134
|
+
const promise = qr(value)
|
|
135
|
+
.then(dataUri => { qrCache.set(value, dataUri); })
|
|
136
|
+
.catch(() => { });
|
|
137
|
+
qrPromises.push(promise);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
await Promise.all(qrPromises);
|
|
141
|
+
// Pre-load images from props
|
|
142
|
+
const imagePromises = [];
|
|
143
|
+
for (const value of Object.values(props)) {
|
|
144
|
+
if (typeof value === 'string' && (value.startsWith('http://') ||
|
|
145
|
+
value.startsWith('https://') ||
|
|
146
|
+
/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(value))) {
|
|
147
|
+
const promise = image(value)
|
|
148
|
+
.then(dataUri => { imageCache.set(value, dataUri); })
|
|
149
|
+
.catch(() => { });
|
|
150
|
+
imagePromises.push(promise);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
await Promise.all(imagePromises);
|
|
154
|
+
// Helper functions
|
|
155
|
+
const qrHelper = (text) => qrCache.get(text) || '';
|
|
156
|
+
const imageHelper = (pathOrUrl) => imageCache.get(pathOrUrl) || pathOrUrl;
|
|
157
|
+
// Build full props
|
|
158
|
+
const fullProps = {
|
|
159
|
+
...props,
|
|
160
|
+
tw: twFn,
|
|
161
|
+
qr: qrHelper,
|
|
162
|
+
image: imageHelper,
|
|
163
|
+
...(frameInfo && { frame: frameInfo }),
|
|
164
|
+
};
|
|
165
|
+
// Render template to JSX
|
|
166
|
+
let element;
|
|
167
|
+
try {
|
|
168
|
+
element = template(fullProps);
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw new RenderError(`Template execution failed: ${error.message}`, 'jsx', error);
|
|
172
|
+
}
|
|
173
|
+
// Render to SVG using Satori
|
|
174
|
+
try {
|
|
175
|
+
const svg = await satori(element, {
|
|
176
|
+
width,
|
|
177
|
+
height,
|
|
178
|
+
fonts: toSatoriFonts(fonts),
|
|
179
|
+
debug: debug || false,
|
|
180
|
+
});
|
|
181
|
+
return svg;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
throw new RenderError(`SVG generation failed: ${error.message}`, 'svg', error);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Convert SVG to PNG using resvg
|
|
189
|
+
*/
|
|
190
|
+
async function svgToPng(svg, width, scale) {
|
|
191
|
+
await ensureResvgWasm();
|
|
192
|
+
try {
|
|
193
|
+
const resvg = new Resvg(svg, {
|
|
194
|
+
fitTo: {
|
|
195
|
+
mode: 'width',
|
|
196
|
+
value: Math.round(width * scale),
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
const pngData = resvg.render();
|
|
200
|
+
return Buffer.from(pngData.asPng());
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
throw new RenderError(`PNG rasterization failed: ${error.message}`, 'rasterize', error);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Convert PNG to other image formats using sharp
|
|
208
|
+
*/
|
|
209
|
+
async function convertFormat(pngBuffer, format, quality) {
|
|
210
|
+
try {
|
|
211
|
+
let pipeline = sharp(pngBuffer);
|
|
212
|
+
switch (format) {
|
|
213
|
+
case 'jpg':
|
|
214
|
+
case 'jpeg':
|
|
215
|
+
pipeline = pipeline.jpeg({ quality });
|
|
216
|
+
break;
|
|
217
|
+
case 'webp':
|
|
218
|
+
pipeline = pipeline.webp({ quality });
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
return pipeline.toBuffer();
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
throw new RenderError(`Format conversion failed: ${error.message}`, 'encode', error);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Render a template to image
|
|
229
|
+
*/
|
|
230
|
+
async function renderImage(template, options, config) {
|
|
231
|
+
const { props, width = config?.defaults?.width || 1200, height = config?.defaults?.height || 630, format = 'png', quality = 90, scale = 2, fonts: customFonts, debug = false, } = options;
|
|
232
|
+
// Load fonts
|
|
233
|
+
const fonts = customFonts || await loadDefaultFonts();
|
|
234
|
+
// Render to SVG
|
|
235
|
+
const svg = await renderFrameToSVG(template, props, width, height, fonts, undefined, config, debug);
|
|
236
|
+
// Return SVG if requested
|
|
237
|
+
if (format === 'svg') {
|
|
238
|
+
return Buffer.from(svg, 'utf-8');
|
|
239
|
+
}
|
|
240
|
+
// Convert to PNG
|
|
241
|
+
const png = await svgToPng(svg, width, scale);
|
|
242
|
+
// Return PNG if requested
|
|
243
|
+
if (format === 'png') {
|
|
244
|
+
return png;
|
|
245
|
+
}
|
|
246
|
+
// Convert to other formats
|
|
247
|
+
return convertFormat(png, format, quality);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Render a template to video
|
|
251
|
+
*/
|
|
252
|
+
async function renderVideo(template, options, config) {
|
|
253
|
+
const { props, width = config?.defaults?.width || 1920, height = config?.defaults?.height || 1080, format = 'mp4', fps = 30, duration = 5, crf = 23, fonts: customFonts, } = options;
|
|
254
|
+
// Load fonts
|
|
255
|
+
const fonts = customFonts || await loadDefaultFonts();
|
|
256
|
+
// Calculate total frames
|
|
257
|
+
const totalFrames = Math.floor(fps * duration);
|
|
258
|
+
const frames = [];
|
|
259
|
+
// Render each frame
|
|
260
|
+
for (let i = 0; i < totalFrames; i++) {
|
|
261
|
+
const progress = i / (totalFrames - 1);
|
|
262
|
+
const time = i / fps;
|
|
263
|
+
const frameInfo = {
|
|
264
|
+
index: i,
|
|
265
|
+
total: totalFrames,
|
|
266
|
+
progress,
|
|
267
|
+
time,
|
|
268
|
+
fps,
|
|
269
|
+
duration,
|
|
270
|
+
};
|
|
271
|
+
const svg = await renderFrameToSVG(template, props, width, height, fonts, frameInfo, config);
|
|
272
|
+
const png = await svgToPng(svg, width, 1); // Scale 1 for video
|
|
273
|
+
frames.push(png);
|
|
274
|
+
}
|
|
275
|
+
// Encode video using h264-mp4-encoder
|
|
276
|
+
if (format === 'mp4') {
|
|
277
|
+
const { default: HME } = await import('h264-mp4-encoder');
|
|
278
|
+
const encoder = await HME.createH264MP4Encoder();
|
|
279
|
+
encoder.width = width;
|
|
280
|
+
encoder.height = height;
|
|
281
|
+
encoder.frameRate = fps;
|
|
282
|
+
encoder.quantizationParameter = crf;
|
|
283
|
+
encoder.initialize();
|
|
284
|
+
// Add frames
|
|
285
|
+
for (const frame of frames) {
|
|
286
|
+
const { data } = await sharp(frame).raw().toBuffer({ resolveWithObject: true });
|
|
287
|
+
encoder.addFrameRgba(new Uint8Array(data));
|
|
288
|
+
}
|
|
289
|
+
encoder.finalize();
|
|
290
|
+
const mp4 = encoder.FS.readFile(encoder.outputFilename);
|
|
291
|
+
encoder.delete();
|
|
292
|
+
return Buffer.from(mp4);
|
|
293
|
+
}
|
|
294
|
+
// Encode GIF using gifenc
|
|
295
|
+
if (format === 'gif') {
|
|
296
|
+
const { GIFEncoder, quantize, applyPalette } = await import('gifenc');
|
|
297
|
+
const gif = GIFEncoder();
|
|
298
|
+
const frameDelay = Math.round(1000 / fps);
|
|
299
|
+
for (const frame of frames) {
|
|
300
|
+
const { data, info } = await sharp(frame)
|
|
301
|
+
.raw()
|
|
302
|
+
.toBuffer({ resolveWithObject: true });
|
|
303
|
+
const rgba = new Uint8Array(data);
|
|
304
|
+
const palette = quantize(rgba, 256);
|
|
305
|
+
const indexed = applyPalette(rgba, palette);
|
|
306
|
+
gif.writeFrame(indexed, info.width, info.height, {
|
|
307
|
+
palette,
|
|
308
|
+
delay: frameDelay,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
gif.finish();
|
|
312
|
+
return Buffer.from(gif.bytes());
|
|
313
|
+
}
|
|
314
|
+
throw new ValidationError(`Unsupported video format: ${format}`, 'format', 'mp4, gif', format);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Main render function
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* import { render } from 'loopwind';
|
|
322
|
+
*
|
|
323
|
+
* const OGImage = ({ title, tw }) => (
|
|
324
|
+
* <div style={tw("w-full h-full bg-blue-500 flex items-center justify-center")}>
|
|
325
|
+
* <h1 style={tw("text-white text-6xl")}>{title}</h1>
|
|
326
|
+
* </div>
|
|
327
|
+
* );
|
|
328
|
+
*
|
|
329
|
+
* const png = await render(OGImage, {
|
|
330
|
+
* props: { title: 'Hello World' },
|
|
331
|
+
* width: 1200,
|
|
332
|
+
* height: 630,
|
|
333
|
+
* format: 'png',
|
|
334
|
+
* });
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
export async function render(template, options) {
|
|
338
|
+
// Validate options
|
|
339
|
+
validateOptions(options);
|
|
340
|
+
const format = options.format || 'png';
|
|
341
|
+
// Handle timeout
|
|
342
|
+
if (options.timeout) {
|
|
343
|
+
const startTime = Date.now();
|
|
344
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
345
|
+
setTimeout(() => {
|
|
346
|
+
const elapsed = Date.now() - startTime;
|
|
347
|
+
reject(new TimeoutError(`Render timed out after ${options.timeout}ms`, options.timeout, elapsed));
|
|
348
|
+
}, options.timeout);
|
|
349
|
+
});
|
|
350
|
+
const renderPromise = isVideoFormat(format)
|
|
351
|
+
? renderVideo(template, options)
|
|
352
|
+
: renderImage(template, options);
|
|
353
|
+
return Promise.race([renderPromise, timeoutPromise]);
|
|
354
|
+
}
|
|
355
|
+
// No timeout
|
|
356
|
+
if (isVideoFormat(format)) {
|
|
357
|
+
return renderVideo(template, options);
|
|
358
|
+
}
|
|
359
|
+
return renderImage(template, options);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Create a reusable renderer with preset configuration
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```typescript
|
|
366
|
+
* import { createRenderer } from 'loopwind';
|
|
367
|
+
*
|
|
368
|
+
* const render = createRenderer({
|
|
369
|
+
* fonts: [
|
|
370
|
+
* { name: 'Inter', data: interFont, weight: 400 },
|
|
371
|
+
* ],
|
|
372
|
+
* colors: {
|
|
373
|
+
* primary: '#3b82f6',
|
|
374
|
+
* },
|
|
375
|
+
* defaults: {
|
|
376
|
+
* width: 1200,
|
|
377
|
+
* height: 630,
|
|
378
|
+
* },
|
|
379
|
+
* });
|
|
380
|
+
*
|
|
381
|
+
* // Now render without repeating config
|
|
382
|
+
* const png = await render(OGImage, { props: { title: 'Hello' }, format: 'png' });
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
export function createRenderer(config) {
|
|
386
|
+
// Pre-process fonts if provided as FontConfig[]
|
|
387
|
+
const fonts = Array.isArray(config.fonts) ? config.fonts : undefined;
|
|
388
|
+
return async function (templateOrName, options) {
|
|
389
|
+
// Resolve template by name if string
|
|
390
|
+
let template;
|
|
391
|
+
if (typeof templateOrName === 'string') {
|
|
392
|
+
if (!config.templates || !config.templates[templateOrName]) {
|
|
393
|
+
throw new ValidationError(`Template "${templateOrName}" not found in registry`, 'template', Object.keys(config.templates || {}).join(', ') || 'no templates registered', templateOrName);
|
|
394
|
+
}
|
|
395
|
+
template = config.templates[templateOrName];
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
template = templateOrName;
|
|
399
|
+
}
|
|
400
|
+
// Merge options with defaults
|
|
401
|
+
const mergedOptions = {
|
|
402
|
+
...options,
|
|
403
|
+
width: options.width ?? config.defaults?.width,
|
|
404
|
+
height: options.height ?? config.defaults?.height,
|
|
405
|
+
format: options.format ?? config.defaults?.format,
|
|
406
|
+
fonts: options.fonts ?? fonts,
|
|
407
|
+
};
|
|
408
|
+
// Validate
|
|
409
|
+
validateOptions(mergedOptions);
|
|
410
|
+
const format = mergedOptions.format || 'png';
|
|
411
|
+
// Handle timeout
|
|
412
|
+
if (mergedOptions.timeout) {
|
|
413
|
+
const startTime = Date.now();
|
|
414
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
415
|
+
setTimeout(() => {
|
|
416
|
+
const elapsed = Date.now() - startTime;
|
|
417
|
+
reject(new TimeoutError(`Render timed out after ${mergedOptions.timeout}ms`, mergedOptions.timeout, elapsed));
|
|
418
|
+
}, mergedOptions.timeout);
|
|
419
|
+
});
|
|
420
|
+
const renderPromise = isVideoFormat(format)
|
|
421
|
+
? renderVideo(template, mergedOptions, config)
|
|
422
|
+
: renderImage(template, mergedOptions, config);
|
|
423
|
+
return Promise.race([renderPromise, timeoutPromise]);
|
|
424
|
+
}
|
|
425
|
+
// No timeout
|
|
426
|
+
if (isVideoFormat(format)) {
|
|
427
|
+
return renderVideo(template, mergedOptions, config);
|
|
428
|
+
}
|
|
429
|
+
return renderImage(template, mergedOptions, config);
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/sdk/render.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MA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
|
+
* Tailwind-to-style converter function
|
|
7
|
+
*/
|
|
8
|
+
export type TwFunction = (classes: string) => React.CSSProperties;
|
|
9
|
+
/**
|
|
10
|
+
* Frame information for video templates
|
|
11
|
+
*/
|
|
12
|
+
export interface FrameInfo {
|
|
13
|
+
/** Current frame number (0-based) */
|
|
14
|
+
index: number;
|
|
15
|
+
/** Total number of frames */
|
|
16
|
+
total: number;
|
|
17
|
+
/** Progress from 0 to 1 */
|
|
18
|
+
progress: number;
|
|
19
|
+
/** Current time in seconds */
|
|
20
|
+
time: number;
|
|
21
|
+
/** Frames per second */
|
|
22
|
+
fps: number;
|
|
23
|
+
/** Total duration in seconds */
|
|
24
|
+
duration: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Image transform options
|
|
28
|
+
*/
|
|
29
|
+
export interface ImageTransformOptions {
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
fit?: 'cover' | 'contain' | 'fill' | 'inside' | 'outside';
|
|
33
|
+
format?: 'png' | 'jpeg' | 'webp' | 'avif';
|
|
34
|
+
quality?: number;
|
|
35
|
+
background?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Props that templates receive
|
|
39
|
+
*/
|
|
40
|
+
export interface BaseTemplateProps {
|
|
41
|
+
/** Tailwind class converter */
|
|
42
|
+
tw: TwFunction;
|
|
43
|
+
/** Frame info for video templates */
|
|
44
|
+
frame?: FrameInfo;
|
|
45
|
+
/** Image loader helper */
|
|
46
|
+
image?: (pathOrUrl: string, transform?: ImageTransformOptions) => string;
|
|
47
|
+
/** QR code generator helper */
|
|
48
|
+
qr?: (text: string, options?: QRCodeOptions) => string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* QR code generation options
|
|
52
|
+
*/
|
|
53
|
+
export interface QRCodeOptions {
|
|
54
|
+
width?: number;
|
|
55
|
+
margin?: number;
|
|
56
|
+
errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
57
|
+
color?: {
|
|
58
|
+
dark?: string;
|
|
59
|
+
light?: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* JSON-serializable value types for template props
|
|
64
|
+
*/
|
|
65
|
+
export type JsonValue = string | number | boolean | null | undefined | JsonValue[] | {
|
|
66
|
+
[key: string]: JsonValue;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Template props must be JSON-serializable
|
|
70
|
+
*/
|
|
71
|
+
export type TemplateProps = Record<string, JsonValue>;
|
|
72
|
+
/**
|
|
73
|
+
* Template function type
|
|
74
|
+
*/
|
|
75
|
+
export type Template<P extends TemplateProps = TemplateProps> = (props: P & BaseTemplateProps) => React.ReactElement;
|
|
76
|
+
/**
|
|
77
|
+
* Font configuration
|
|
78
|
+
*/
|
|
79
|
+
export interface FontConfig {
|
|
80
|
+
/** Font family name */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Font data (ArrayBuffer or Buffer) */
|
|
83
|
+
data: ArrayBuffer | Buffer;
|
|
84
|
+
/** Font weight */
|
|
85
|
+
weight?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
86
|
+
/** Font style */
|
|
87
|
+
style?: 'normal' | 'italic';
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Simple font family definition
|
|
91
|
+
*/
|
|
92
|
+
export type SimpleFontFamily = string[];
|
|
93
|
+
/**
|
|
94
|
+
* Font family with custom files
|
|
95
|
+
*/
|
|
96
|
+
export interface FontFamilyWithFiles {
|
|
97
|
+
family: string[];
|
|
98
|
+
files: Array<{
|
|
99
|
+
data: ArrayBuffer | Buffer;
|
|
100
|
+
weight?: number;
|
|
101
|
+
style?: 'normal' | 'italic';
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Fonts configuration
|
|
106
|
+
*/
|
|
107
|
+
export type FontsConfig = Record<string, SimpleFontFamily | FontFamilyWithFiles>;
|
|
108
|
+
/**
|
|
109
|
+
* Design tokens configuration
|
|
110
|
+
*/
|
|
111
|
+
export interface TokensConfig {
|
|
112
|
+
borderRadius?: Record<string, string>;
|
|
113
|
+
spacing?: Record<string, string>;
|
|
114
|
+
fontSize?: Record<string, string>;
|
|
115
|
+
[key: string]: Record<string, string> | undefined;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Renderer configuration
|
|
119
|
+
*/
|
|
120
|
+
export interface RendererConfig {
|
|
121
|
+
/** Custom colors for tw() */
|
|
122
|
+
colors?: Record<string, string>;
|
|
123
|
+
/** Font configuration */
|
|
124
|
+
fonts?: FontsConfig | FontConfig[];
|
|
125
|
+
/** Design tokens */
|
|
126
|
+
tokens?: TokensConfig;
|
|
127
|
+
/** Default dimensions and format */
|
|
128
|
+
defaults?: {
|
|
129
|
+
width?: number;
|
|
130
|
+
height?: number;
|
|
131
|
+
format?: OutputFormat;
|
|
132
|
+
};
|
|
133
|
+
/** Pre-registered templates */
|
|
134
|
+
templates?: Record<string, Template>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Output format
|
|
138
|
+
*/
|
|
139
|
+
export type OutputFormat = 'png' | 'svg' | 'jpg' | 'jpeg' | 'webp' | 'mp4' | 'gif';
|
|
140
|
+
/**
|
|
141
|
+
* Image format (no video)
|
|
142
|
+
*/
|
|
143
|
+
export type ImageFormat = 'png' | 'svg' | 'jpg' | 'jpeg' | 'webp';
|
|
144
|
+
/**
|
|
145
|
+
* Video format
|
|
146
|
+
*/
|
|
147
|
+
export type VideoFormat = 'mp4' | 'gif';
|
|
148
|
+
/**
|
|
149
|
+
* Render options
|
|
150
|
+
*/
|
|
151
|
+
export interface RenderOptions<P extends TemplateProps = TemplateProps> {
|
|
152
|
+
/** Props to pass to template */
|
|
153
|
+
props: P;
|
|
154
|
+
/** Output width in pixels */
|
|
155
|
+
width?: number;
|
|
156
|
+
/** Output height in pixels */
|
|
157
|
+
height?: number;
|
|
158
|
+
/** Output format */
|
|
159
|
+
format?: OutputFormat;
|
|
160
|
+
/** JPEG/WebP quality (1-100) */
|
|
161
|
+
quality?: number;
|
|
162
|
+
/** Video frames per second */
|
|
163
|
+
fps?: number;
|
|
164
|
+
/** Video duration in seconds */
|
|
165
|
+
duration?: number;
|
|
166
|
+
/** Video quality (CRF 0-51, lower = better) */
|
|
167
|
+
crf?: number;
|
|
168
|
+
/** Custom fonts (if not using createRenderer) */
|
|
169
|
+
fonts?: FontConfig[];
|
|
170
|
+
/** Render scale (default: 2 for images, 1 for video) */
|
|
171
|
+
scale?: number;
|
|
172
|
+
/** Debug mode (shows bounding boxes) */
|
|
173
|
+
debug?: boolean;
|
|
174
|
+
/** Timeout in milliseconds */
|
|
175
|
+
timeout?: number;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Render result
|
|
179
|
+
*/
|
|
180
|
+
export type RenderResult = Buffer | Uint8Array;
|
|
181
|
+
/**
|
|
182
|
+
* Renderer function signature
|
|
183
|
+
*/
|
|
184
|
+
export type RenderFunction = <P extends TemplateProps>(template: Template<P> | string, options: RenderOptions<P>) => Promise<RenderResult>;
|
|
185
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sdk/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC,aAAa,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,GAAG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