Skip to content

🎥 Make videos programmatically with React

`template-vercel`: Never-expire sandbox snapshots and simplify runtime code

Jonny Burgerc7da2a2e55b9
diff --git a/bun.lock b/bun.lock
index 8129d7dd0d..a79121a28d 100644
--- a/bun.lock
+++ b/bun.lock
@@ -2177,7 +2177,7 @@
"@types/bun": "1.3.3",
"@vercel/blob": "2.0.1",
"@vercel/functions": "^3.4.1",
- "@vercel/sandbox": "1.3.1",
+ "@vercel/sandbox": "1.6.0",
"clsx": "2.1.1",
"next": "16.1.5",
"react": "19.2.3",
@@ -4640,7 +4640,7 @@
"@vercel/remix": ["@vercel/[email protected]", "", { "dependencies": { "@vercel/static-config": "3.0.0", "isbot": "3.8.0", "ts-morph": "12.0.0" }, "peerDependencies": { "@remix-run/dev": "2.15.2", "@remix-run/node": "2.15.2", "@remix-run/server-runtime": "2.15.2", "react": "19.0.0", "react-dom": "19.0.0" } }, "sha512-JZJmuM/pZl5zLACRHzq2uOamzTOeiKRnco0o07A+hUxTKemhS1tqc2R9PdQ6Mf/8ZcXY5ZxW5tah3zjBea6D4w=="],
- "@vercel/sandbox": ["@vercel/[email protected]", "", { "dependencies": { "@vercel/oidc": "^3.1.0", "async-retry": "1.3.3", "jsonlines": "0.1.1", "ms": "2.1.3", "picocolors": "^1.1.1", "tar-stream": "3.1.7", "undici": "^7.16.0", "xdg-app-paths": "5.1.0", "zod": "3.24.4" } }, "sha512-FFeeJgb4mcm89LSS2ta5kUlAbJ4FsjBbi6otK6Au50GJh9ubzdZuaxiVhWas9NlQ9EnE3FZsIslLLLvjN7Onlw=="],
+ "@vercel/sandbox": ["@vercel/[email protected]", "", { "dependencies": { "@vercel/oidc": "^3.1.0", "async-retry": "1.3.3", "jsonlines": "0.1.1", "ms": "2.1.3", "picocolors": "^1.1.1", "tar-stream": "3.1.7", "undici": "^7.16.0", "xdg-app-paths": "5.1.0", "zod": "3.24.4" } }, "sha512-T204S3RZIdo+BCR5gpErTQBYz+ruXjTMRiZyf+HV/UQeKjPKAVKWu27T65kahDvVvJrbadHhxR2Cds28rXXF/Q=="],
"@vercel/static-config": ["@vercel/[email protected]", "", { "dependencies": { "ajv": "8.6.3", "json-schema-to-ts": "1.6.4", "ts-morph": "12.0.0" } }, "sha512-2qtvcBJ1bGY0dYGYh3iM7yGKkk971FujLEDXzuW5wcZsPr1GSEjO/w2iSr3qve6nDDtBImsGoDEnus5FI4+fIw=="],
diff --git a/packages/template-vercel/create-snapshot.ts b/packages/template-vercel/create-snapshot.ts
index 18adda4a0f..ba98ccbe7c 100644
--- a/packages/template-vercel/create-snapshot.ts
+++ b/packages/template-vercel/create-snapshot.ts
@@ -1,23 +1,20 @@
-import { createSandbox } from "./src/app/api/render/sandbox/create-sandbox";
-import { saveSnapshotCache } from "./src/app/api/render/sandbox/snapshots";
-
-const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;
+import { createSandbox } from './src/app/api/render/sandbox/create-sandbox';
+import { saveSnapshotCache } from './src/app/api/render/sandbox/snapshots';
const sandbox = await createSandbox({
onProgress: async (progress) => {
- if (progress.type === "phase") {
+ if (progress.type === 'phase') {
const pct = Math.round((progress.progress ?? 0) * 100);
console.log(`[create-snapshot] ${progress.phase} (${pct}%)`);
}
},
});
-console.log("[create-snapshot] Taking snapshot...");
-const snapshot = await sandbox.snapshot();
+console.log('[create-snapshot] Taking snapshot...');
+const snapshot = await sandbox.snapshot({ expiration: 0 });
-const expiresAt = new Date(Date.now() + SEVEN_DAYS_MS);
-await saveSnapshotCache(snapshot.snapshotId, expiresAt);
+await saveSnapshotCache(snapshot.snapshotId);
console.log(
- `[create-snapshot] Snapshot saved: ${snapshot.snapshotId} (expires ${expiresAt.toISOString()})`,
+ `[create-snapshot] Snapshot saved: ${snapshot.snapshotId} (never expires)`,
);
diff --git a/packages/template-vercel/package.json b/packages/template-vercel/package.json
index 8ef2276ec2..8a18e87e9d 100644
--- a/packages/template-vercel/package.json
+++ b/packages/template-vercel/package.json
@@ -22,7 +22,7 @@
"@types/bun": "1.3.3",
"@vercel/blob": "2.0.1",
"@vercel/functions": "^3.4.1",
- "@vercel/sandbox": "1.3.1",
+ "@vercel/sandbox": "1.6.0",
"clsx": "2.1.1",
"next": "16.1.5",
"react": "19.2.3",
diff --git a/packages/template-vercel/src/app/api/render/helpers.ts b/packages/template-vercel/src/app/api/render/helpers.ts
index 09f6a1a670..01067155ff 100644
--- a/packages/template-vercel/src/app/api/render/helpers.ts
+++ b/packages/template-vercel/src/app/api/render/helpers.ts
@@ -1,6 +1,6 @@
-import { Sandbox } from "@vercel/sandbox";
-import { readFile } from "fs/promises";
-import path from "path";
+import { Sandbox } from '@vercel/sandbox';
+import { readFile } from 'fs/promises';
+import path from 'path';
export const createDisposableSandbox = async (
options: Parameters<typeof Sandbox.create>[0],
@@ -24,9 +24,9 @@ export const createDisposableWriter = (
};
export type RenderProgress =
- | { type: "phase"; phase: string; progress: number; subtitle?: string }
- | { type: "done"; url: string; size: number }
- | { type: "error"; message: string };
+ | { type: 'phase'; phase: string; progress: number }
+ | { type: 'done'; url: string; size: number }
+ | { type: 'error'; message: string };
export type OnProgressFn = (message: RenderProgress) => Promise<void>;
@@ -35,6 +35,6 @@ export function formatSSE(message: RenderProgress): string {
}
export async function getRenderScript(): Promise<Buffer> {
- const renderScriptPath = path.join(process.cwd(), "render.ts");
+ const renderScriptPath = path.join(process.cwd(), 'render.ts');
return readFile(renderScriptPath);
}
diff --git a/packages/template-vercel/src/app/api/render/render.ts b/packages/template-vercel/src/app/api/render/render.ts
index b869db10af..7d850537bc 100644
--- a/packages/template-vercel/src/app/api/render/render.ts
+++ b/packages/template-vercel/src/app/api/render/render.ts
@@ -1,12 +1,12 @@
-import { Sandbox } from "@vercel/sandbox";
-import { BUILD_DIR } from "../../../../build-dir.mjs";
-import type { RenderConfig } from "../../../../render";
-import { COMP_NAME } from "../../../../types/constants";
+import { Sandbox } from '@vercel/sandbox';
+import { BUILD_DIR } from '../../../../build-dir.mjs';
+import type { RenderConfig } from '../../../../render';
+import { COMP_NAME } from '../../../../types/constants';
export type RenderInSandboxProgress =
- | { type: "render-progress"; progress: number }
- | { type: "uploading" }
- | { type: "done"; url: string; size: number };
+ | { type: 'render-progress'; progress: number }
+ | { type: 'uploading' }
+ | { type: 'done'; url: string; size: number };
export async function renderInSandbox({
sandbox,
@@ -23,7 +23,7 @@ export async function renderInSandbox({
const renderId = crypto.randomUUID();
const blobToken = process.env.BLOB_READ_WRITE_TOKEN;
if (!blobToken) {
- throw new Error("BLOB_READ_WRITE_TOKEN is not set");
+ throw new Error('BLOB_READ_WRITE_TOKEN is not set');
}
const renderConfig: RenderConfig = {
@@ -36,8 +36,8 @@ export async function renderInSandbox({
// Run the render script
const renderCmd = await sandbox.runCommand({
- cmd: "node",
- args: ["--strip-types", "render.ts", JSON.stringify(renderConfig)],
+ cmd: 'node',
+ args: ['--strip-types', 'render.ts', JSON.stringify(renderConfig)],
detached: true,
});
@@ -45,17 +45,17 @@ export async function renderInSandbox({
let doneSize: number | null = null;
for await (const log of renderCmd.logs()) {
- if (log.stream === "stdout") {
+ if (log.stream === 'stdout') {
try {
const message = JSON.parse(log.data);
- if (message.type === "progress") {
+ if (message.type === 'progress') {
await onProgress({
- type: "render-progress",
+ type: 'render-progress',
progress: message.progress,
});
- } else if (message.type === "uploading") {
- await onProgress({ type: "uploading" });
- } else if (message.type === "done") {
+ } else if (message.type === 'uploading') {
+ await onProgress({ type: 'uploading' });
+ } else if (message.type === 'done') {
doneUrl = message.url;
doneSize = message.size;
}
@@ -73,8 +73,8 @@ export async function renderInSandbox({
}
if (!doneUrl || doneSize === null) {
- throw new Error("Render script did not return upload result");
+ throw new Error('Render script did not return upload result');
}
- await onProgress({ type: "done", url: doneUrl, size: doneSize });
+ await onProgress({ type: 'done', url: doneUrl, size: doneSize });
}
diff --git a/packages/template-vercel/src/app/api/render/route.ts b/packages/template-vercel/src/app/api/render/route.ts
index 914a33fc82..85e368cf73 100644
--- a/packages/template-vercel/src/app/api/render/route.ts
+++ b/packages/template-vercel/src/app/api/render/route.ts
@@ -1,12 +1,12 @@
-import { waitUntil } from "@vercel/functions";
-import { RenderRequest } from "../../../../types/schema";
+import { waitUntil } from '@vercel/functions';
+import { RenderRequest } from '../../../../types/schema';
import {
createDisposableWriter,
formatSSE,
type RenderProgress,
-} from "./helpers";
-import { renderInSandbox } from "./render";
-import { reuseOrCreateSandbox } from "./sandbox/reuse-or-create-sandbox";
+} from './helpers';
+import { renderInSandbox } from './render';
+import { getSandbox } from './sandbox/get-sandbox';
export async function POST(req: Request) {
const encoder = new TextEncoder();
@@ -25,33 +25,33 @@ export async function POST(req: Request) {
const payload = await req.json();
const body = RenderRequest.parse(payload);
- await using sandbox = await reuseOrCreateSandbox(send);
- const renderingPhase = "Rendering video...";
- await send({ type: "phase", phase: renderingPhase, progress: 0 });
+ await using sandbox = await getSandbox();
+ const renderingPhase = 'Rendering video...';
+ await send({ type: 'phase', phase: renderingPhase, progress: 0 });
await renderInSandbox({
sandbox,
inputProps: body.inputProps,
onProgress: async (update) => {
- if (update.type === "render-progress") {
+ if (update.type === 'render-progress') {
await send({
- type: "phase",
+ type: 'phase',
phase: renderingPhase,
progress: update.progress,
});
- } else if (update.type === "uploading") {
+ } else if (update.type === 'uploading') {
await send({
- type: "phase",
- phase: "Uploading video...",
+ type: 'phase',
+ phase: 'Uploading video...',
progress: 1,
});
- } else if (update.type === "done") {
- await send({ type: "done", url: update.url, size: update.size });
+ } else if (update.type === 'done') {
+ await send({ type: 'done', url: update.url, size: update.size });
}
},
});
} catch (err) {
console.log(err);
- await send({ type: "error", message: (err as Error).message });
+ await send({ type: 'error', message: (err as Error).message });
}
};
@@ -59,9 +59,9 @@ export async function POST(req: Request) {
return new Response(stream.readable, {
headers: {
- "Content-Type": "text/event-stream",
- "Cache-Control": "no-cache",
- Connection: "keep-alive",
+ 'Content-Type': 'text/event-stream',
+ 'Cache-Control': 'no-cache',
+ Connection: 'keep-alive',
},
});
}
diff --git a/packages/template-vercel/src/app/api/render/sandbox/add-bundle.ts b/packages/template-vercel/src/app/api/render/sandbox/add-bundle.ts
index 963fe1cbe9..6ff60b73c2 100644
--- a/packages/template-vercel/src/app/api/render/sandbox/add-bundle.ts
+++ b/packages/template-vercel/src/app/api/render/sandbox/add-bundle.ts
@@ -1,9 +1,9 @@
-import { Sandbox } from "@vercel/sandbox";
-import { execSync } from "child_process";
-import { existsSync } from "fs";
-import { readdir, readFile } from "fs/promises";
-import path from "path";
-import { BUILD_DIR } from "../../../../../build-dir.mjs";
+import { Sandbox } from '@vercel/sandbox';
+import { execSync } from 'child_process';
+import { existsSync } from 'fs';
+import { readdir, readFile } from 'fs/promises';
+import path from 'path';
+import { BUILD_DIR } from '../../../../../build-dir.mjs';
export const addBundleToSandbox = async (
sandbox: Sandbox & AsyncDisposable,
@@ -14,18 +14,18 @@ export const addBundleToSandbox = async (
const dirs = new Set<string>();
for (const file of bundleFiles) {
const dir = path.dirname(file.path);
- if (dir && dir !== ".") {
+ if (dir && dir !== '.') {
dirs.add(dir);
}
}
for (const dir of Array.from(dirs).sort()) {
- await sandbox.mkDir(BUILD_DIR + "/" + dir);
+ await sandbox.mkDir(BUILD_DIR + '/' + dir);
}
await sandbox.writeFiles(
bundleFiles.map((file) => ({
- path: BUILD_DIR + "/" + file.path,
+ path: BUILD_DIR + '/' + file.path,
content: file.content,
})),
);
@@ -40,7 +40,7 @@ async function getRemotionBundleFiles(): Promise<
const files: { path: string; content: Buffer }[] = [];
- async function readDirRecursive(dir: string, basePath: string = "") {
+ async function readDirRecursive(dir: string, basePath: string = '') {
const entries = await readdir(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
@@ -68,10 +68,10 @@ async function ensureLocalBundle(): Promise<void> {
try {
execSync(`node_modules/.bin/remotion bundle --out-dir ./${BUILD_DIR}`, {
cwd: process.cwd(),
- stdio: "pipe",
+ stdio: 'pipe',
});
} catch (e) {
- const stderr = (e as { stderr?: Buffer }).stderr?.toString() ?? "";
+ const stderr = (e as { stderr?: Buffer }).stderr?.toString() ?? '';
throw new Error(`Remotion bundle failed: ${stderr}`);
}
}
diff --git a/packages/template-vercel/src/app/api/render/sandbox/create-sandbox.ts b/packages/template-vercel/src/app/api/render/sandbox/create-sandbox.ts
index 971ef99dee..c6c02532d1 100644
--- a/packages/template-vercel/src/app/api/render/sandbox/create-sandbox.ts
+++ b/packages/template-vercel/src/app/api/render/sandbox/create-sandbox.ts
@@ -1,14 +1,14 @@
-import { Sandbox } from "@vercel/sandbox";
+import { Sandbox } from '@vercel/sandbox';
import {
createDisposableSandbox,
getRenderScript,
OnProgressFn,
-} from "../helpers";
-import { addBundleToSandbox } from "./add-bundle";
-import { installBrowser } from "./install-browser";
-import { installJsDependencies } from "./install-js-dependencies";
-import { installSystemDependencies } from "./install-system-dependencies";
-import { patchCompositor } from "./patch-compositor";
+} from '../helpers';
+import { addBundleToSandbox } from './add-bundle';
+import { installBrowser } from './install-browser';
+import { installJsDependencies } from './install-js-dependencies';
+import { installSystemDependencies } from './install-system-dependencies';
+import { patchCompositor } from './patch-compositor';
export async function createSandbox({
onProgress,
@@ -16,15 +16,12 @@ export async function createSandbox({
onProgress: OnProgressFn;
}): Promise<Sandbox & AsyncDisposable> {
const sandbox = await createDisposableSandbox({
- runtime: "node24",
+ runtime: 'node24',
resources: { vcpus: 4 },
timeout: 5 * 60 * 1000,
});
- const preparingPhase = "Preparing...";
- const preparingSubtitle = process.env.VERCEL
- ? "This only needs to be done once."
- : "This is only needed during development.";
+ const preparingPhase = 'Preparing...';
// Preparation has 3 stages with weights:
// - System dependencies: 60%
@@ -35,9 +32,8 @@ export async function createSandbox({
const WEIGHT_BROWSER = 0.2;
await onProgress({
- type: "phase",
+ type: 'phase',
phase: preparingPhase,
- subtitle: preparingSubtitle,
progress: 0,
});
@@ -46,28 +42,25 @@ export async function createSandbox({
sandbox,
onProgress: async (stageProgress: number) => {
await onProgress({
- type: "phase",
+ type: 'phase',
phase: preparingPhase,
- subtitle: preparingSubtitle,
progress: stageProgress * WEIGHT_SYS_DEPS,
});
},
});
await onProgress({
- type: "phase",
- phase: "Adding Remotion video to Sandbox...",
+ type: 'phase',
+ phase: 'Adding Remotion video to Sandbox...',
progress: 0,
- subtitle: preparingSubtitle,
});
// Stage 2: Copy Remotion bundle (20%)
await addBundleToSandbox(sandbox);
await onProgress({
- type: "phase",
+ type: 'phase',
phase: preparingPhase,
- subtitle: preparingSubtitle,
progress: WEIGHT_SYS_DEPS + WEIGHT_BUNDLE,
});
@@ -82,9 +75,8 @@ export async function createSandbox({
sandbox,
onProgress: async (browserProgress: number) => {
await onProgress({
- type: "phase",
+ type: 'phase',
phase: preparingPhase,
- subtitle: preparingSubtitle,
progress:
WEIGHT_SYS_DEPS + WEIGHT_BUNDLE + browserProgress * WEIGHT_BROWSER,
});
@@ -94,12 +86,12 @@ export async function createSandbox({
const renderScript = await getRenderScript();
await sandbox.writeFiles([
{
- path: "render.ts",
+ path: 'render.ts',
content: renderScript,
},
{
- path: "package.json",
- content: Buffer.from(JSON.stringify({ type: "module" })),
+ path: 'package.json',
+ content: Buffer.from(JSON.stringify({ type: 'module' })),
},
]);
diff --git a/packages/template-vercel/src/app/api/render/sandbox/get-sandbox.ts b/packages/template-vercel/src/app/api/render/sandbox/get-sandbox.ts
new file mode 100644
index 0000000000..e9c40d585c
--- /dev/null
+++ b/packages/template-vercel/src/app/api/render/sandbox/get-sandbox.ts
@@ -0,0 +1,20 @@
+import { Sandbox } from '@vercel/sandbox';
+import { createDisposableSandbox } from '../helpers';
+import { getCachedSnapshot } from './snapshots';
+
+const TIMEOUT = 5 * 60 * 1000;
+
+export async function getSandbox(): Promise<Sandbox & AsyncDisposable> {
+ const cachedSnapshotId = await getCachedSnapshot();
+
+ if (!cachedSnapshotId) {
+ throw new Error(
+ 'No sandbox snapshot found. Run `bun run create-snapshot` first.',
+ );
+ }
+
+ return await createDisposableSandbox({
+ source: { type: 'snapshot', snapshotId: cachedSnapshotId },
+ timeout: TIMEOUT,
+ });
+}
diff --git a/packages/template-vercel/src/app/api/render/sandbox/install-browser.ts b/packages/template-vercel/src/app/api/render/sandbox/install-browser.ts
index 233a50fccc..e3333539b6 100644
--- a/packages/template-vercel/src/app/api/render/sandbox/install-browser.ts
+++ b/packages/template-vercel/src/app/api/render/sandbox/install-browser.ts
@@ -1,9 +1,9 @@
-import { Sandbox } from "@vercel/sandbox";
-import { readFile } from "fs/promises";
-import path from "path";
+import { Sandbox } from '@vercel/sandbox';
+import { readFile } from 'fs/promises';
+import path from 'path';
async function getEnsureBrowserScript(): Promise<Buffer> {
- const scriptPath = path.join(process.cwd(), "ensure-browser.ts");
+ const scriptPath = path.join(process.cwd(), 'ensure-browser.ts');
return readFile(scriptPath);
}
@@ -17,22 +17,22 @@ export async function installBrowser({
const ensureBrowserScript = await getEnsureBrowserScript();
await sandbox.writeFiles([
{
- path: "ensure-browser.ts",
+ path: 'ensure-browser.ts',
content: ensureBrowserScript,
},
]);
const ensureBrowserCmd = await sandbox.runCommand({
- cmd: "node",
- args: ["--strip-types", "ensure-browser.ts"],
+ cmd: 'node',
+ args: ['--strip-types', 'ensure-browser.ts'],
detached: true,
});
for await (const log of ensureBrowserCmd.logs()) {
- if (log.stream === "stdout") {
+ if (log.stream === 'stdout') {
try {
const message = JSON.parse(log.data);
- if (message.type === "browser-progress") {
+ if (message.type === 'browser-progress') {
await onProgress(message.percent ?? 0);
continue;
}
diff --git a/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.ts b/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.ts
index d7a0d66918..cd38cea4a4 100644
--- a/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.ts
+++ b/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.ts
@@ -1,5 +1,5 @@
-import { Sandbox } from "@vercel/sandbox";
-import { VERSION } from "remotion/version";
+import { Sandbox } from '@vercel/sandbox';
+import { VERSION } from 'remotion/version';
export async function installJsDependencies({
sandbox,
@@ -7,7 +7,7 @@ export async function installJsDependencies({
sandbox: Sandbox;
}): Promise<void> {
const installCmd = await sandbox.runCommand({
- cmd: "pnpm",
+ cmd: 'pnpm',
args: [
`i`,
`@remotion/renderer@${VERSION}`,
diff --git a/packages/template-vercel/src/app/api/render/sandbox/install-system-dependencies.ts b/packages/template-vercel/src/app/api/render/sandbox/install-system-dependencies.ts
index 06c12a5b88..e889e191bb 100644
--- a/packages/template-vercel/src/app/api/render/sandbox/install-system-dependencies.ts
+++ b/packages/template-vercel/src/app/api/render/sandbox/install-system-dependencies.ts
@@ -1,4 +1,4 @@
-import { Sandbox } from "@vercel/sandbox";
+import { Sandbox } from '@vercel/sandbox';
export async function installSystemDependencies({
sandbox,
@@ -8,26 +8,26 @@ export async function installSystemDependencies({
onProgress: (progress: number) => Promise<void>;
}): Promise<void> {
const sysInstallCmd = await sandbox.runCommand({
- cmd: "sudo",
+ cmd: 'sudo',
args: [
- "dnf",
- "install",
- "-y",
- "nss",
- "atk",
- "at-spi2-atk",
- "cups-libs",
- "libdrm",
- "libXcomposite",
- "libXdamage",
- "libXrandr",
- "mesa-libgbm",
- "alsa-lib",
- "pango",
- "gtk3",
- "patchelf",
- "zstd",
- "binutils",
+ 'dnf',
+ 'install',
+ '-y',
+ 'nss',
+ 'atk',
+ 'at-spi2-atk',
+ 'cups-libs',
+ 'libdrm',
+ 'libXcomposite',
+ 'libXdamage',
+ 'libXrandr',
+ 'mesa-libgbm',
+ 'alsa-lib',
+ 'pango',
+ 'gtk3',
+ 'patchelf',
+ 'zstd',
+ 'binutils',
],
detached: true,
});
diff --git a/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.ts b/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.ts
index cc621a25fd..251516fb61 100644
--- a/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.ts
+++ b/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.ts
@@ -1,8 +1,8 @@
-import { Sandbox } from "@vercel/sandbox";
+import { Sandbox } from '@vercel/sandbox';
-const GLIBC_DIR = "/tmp/glibc235";
+const GLIBC_DIR = '/tmp/glibc235';
const LIBC6_DEB_URL =
- "https://launchpadlibrarian.net/612471225/libc6_2.35-0ubuntu3.1_amd64.deb";
+ 'https://launchpadlibrarian.net/612471225/libc6_2.35-0ubuntu3.1_amd64.deb';
/**
* Remotion does not officially support glibc 2.34, but it can be patched.
@@ -88,8 +88,8 @@ echo "[patch-compositor] Compositor patched successfully"
`;
const cmd = await sandbox.runCommand({
- cmd: "bash",
- args: ["-c", script],
+ cmd: 'bash',
+ args: ['-c', script],
detached: true,
});
diff --git a/packages/template-vercel/src/app/api/render/sandbox/reuse-or-create-sandbox.ts b/packages/template-vercel/src/app/api/render/sandbox/reuse-or-create-sandbox.ts
deleted file mode 100644
index 357f9f7bb0..0000000000
--- a/packages/template-vercel/src/app/api/render/sandbox/reuse-or-create-sandbox.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Sandbox } from "@vercel/sandbox";
-import { createDisposableSandbox, OnProgressFn } from "../helpers";
-import { createSandbox } from "./create-sandbox";
-import { getCachedSnapshot } from "./snapshots";
-
-const TIMEOUT = 5 * 60 * 1000;
-
-export async function reuseOrCreateSandbox(
- onProgress: OnProgressFn,
-): Promise<Sandbox & AsyncDisposable> {
- await onProgress({
- type: "phase",
- phase: "Creating sandbox...",
- progress: 0,
- });
-
- // In production, the snapshot is created at build time via `create-snapshot`
- const cachedSnapshotId = await getCachedSnapshot();
-
- if (cachedSnapshotId) {
- try {
- return await createDisposableSandbox({
- source: { type: "snapshot", snapshotId: cachedSnapshotId },
- timeout: TIMEOUT,
- });
- } catch {
- // Snapshot may have been deleted or is invalid, fall through to full setup
- }
- }
-
- // Local development: create sandbox from scratch (no snapshotting)
- return await createSandbox({ onProgress });
-}
diff --git a/packages/template-vercel/src/app/api/render/sandbox/snapshots.ts b/packages/template-vercel/src/app/api/render/sandbox/snapshots.ts
index c732c371cd..90dd3299e0 100644
--- a/packages/template-vercel/src/app/api/render/sandbox/snapshots.ts
+++ b/packages/template-vercel/src/app/api/render/sandbox/snapshots.ts
@@ -1,11 +1,10 @@
-import { head, put } from "@vercel/blob";
+import { head, put } from '@vercel/blob';
type SnapshotCache = {
snapshotId: string;
- expiresAt: string;
};
-const SNAPSHOT_BLOB_KEY = `snapshot-cache/${process.env.VERCEL_DEPLOYMENT_ID ?? "local"}.json`;
+const SNAPSHOT_BLOB_KEY = `snapshot-cache/${process.env.VERCEL_DEPLOYMENT_ID ?? 'local'}.json`;
export async function getCachedSnapshot(): Promise<string | null> {
if (!process.env.VERCEL) {
@@ -17,28 +16,20 @@ export async function getCachedSnapshot(): Promise<string | null> {
const response = await fetch(metadata.url);
const cache: SnapshotCache = await response.json();
- if (new Date(cache.expiresAt) < new Date()) {
- return null;
- }
-
return cache.snapshotId;
} catch {
return null;
}
}
-export async function saveSnapshotCache(
- snapshotId: string,
- expiresAt: Date,
-): Promise<void> {
+export async function saveSnapshotCache(snapshotId: string): Promise<void> {
const cache: SnapshotCache = {
snapshotId,
- expiresAt: expiresAt.toISOString(),
};
await put(SNAPSHOT_BLOB_KEY, JSON.stringify(cache), {
- access: "public",
- contentType: "application/json",
+ access: 'public',
+ contentType: 'application/json',
addRandomSuffix: false,
});
}
diff --git a/packages/template-vercel/src/app/layout.tsx b/packages/template-vercel/src/app/layout.tsx
index 296ec01712..0ce8a02457 100644
--- a/packages/template-vercel/src/app/layout.tsx
+++ b/packages/template-vercel/src/app/layout.tsx
@@ -1,13 +1,13 @@
-import { Metadata, Viewport } from "next";
-import "../../styles/global.css";
+import { Metadata, Viewport } from 'next';
+import '../../styles/global.css';
export const metadata: Metadata = {
- title: "Remotion rendering on Vercel Sandbox",
- description: "Remotion rendering on Vercel Sandbox",
+ title: 'Remotion rendering on Vercel Sandbox',
+ description: 'Remotion rendering on Vercel Sandbox',
};
export const viewport: Viewport = {
- width: "device-width",
+ width: 'device-width',
initialScale: 1,
maximumScale: 1,
};
diff --git a/packages/template-vercel/src/app/page.tsx b/packages/template-vercel/src/app/page.tsx
index 4b225065c5..53515295c9 100644
--- a/packages/template-vercel/src/app/page.tsx
+++ b/packages/template-vercel/src/app/page.tsx
@@ -1,9 +1,9 @@
-"use client";
+'use client';
-import { Player } from "@remotion/player";
-import type { NextPage } from "next";
-import { useMemo, useState } from "react";
-import { z } from "zod";
+import { Player } from '@remotion/player';
+import type { NextPage } from 'next';
+import { useMemo, useState } from 'react';
+import { z } from 'zod';
import {
CompositionProps,
defaultMyCompProps,
@@ -11,10 +11,10 @@ import {
VIDEO_FPS,
VIDEO_HEIGHT,
VIDEO_WIDTH,
-} from "../../types/constants";
-import { RenderControls } from "../components/RenderControls";
-import { Tips } from "../components/Tips";
-import { Main } from "../remotion/MyComp/Main";
+} from '../../types/constants';
+import { RenderControls } from '../components/RenderControls';
+import { Tips } from '../components/Tips';
+import { Main } from '../remotion/MyComp/Main';
const Home: NextPage = () => {
const [text, setText] = useState<string>(defaultMyCompProps.title);
@@ -37,7 +37,7 @@ const Home: NextPage = () => {
compositionHeight={VIDEO_HEIGHT}
compositionWidth={VIDEO_WIDTH}
style={{
- width: "100%",
+ width: '100%',
}}
controls
autoPlay
diff --git a/packages/template-vercel/src/components/AlignEnd.tsx b/packages/template-vercel/src/components/AlignEnd.tsx
index 834b07ab2d..3c48b89036 100644
--- a/packages/template-vercel/src/components/AlignEnd.tsx
+++ b/packages/template-vercel/src/components/AlignEnd.tsx
@@ -1,8 +1,8 @@
-import React from "react";
+import React from 'react';
export const AlignEnd: React.FC<{
children: React.ReactNode;
className?: string;
}> = ({ children, className }) => {
- return <div className={`self-end ${className ?? ""}`}>{children}</div>;
+ return <div className={`self-end ${className ?? ''}`}>{children}</div>;
};
diff --git a/packages/template-vercel/src/components/Button.tsx b/packages/template-vercel/src/components/Button.tsx
index c717c2e94a..4b49513f6b 100644
--- a/packages/template-vercel/src/components/Button.tsx
+++ b/packages/template-vercel/src/components/Button.tsx
@@ -1,7 +1,7 @@
-import React, { forwardRef } from "react";
-import { cn } from "../lib/utils";
-import { Spacing } from "./Spacing";
-import { Spinner } from "./Spinner";
+import React, { forwardRef } from 'react';
+import { cn } from '../lib/utils';
+import { Spacing } from './Spacing';
+import { Spinner } from './Spinner';
const ButtonForward: React.ForwardRefRenderFunction<
HTMLButtonElement,
@@ -17,9 +17,9 @@ const ButtonForward: React.ForwardRefRenderFunction<
<button
ref={ref}
className={cn(
- "border-foreground border rounded-geist bg-foreground text-background px-geist-half font-geist h-10 font-medium transition-all duration-150 ease-in-out inline-flex items-center appearance-none text-sm hover:bg-background hover:text-foreground hover:border-focused-border-color disabled:bg-button-disabled-color disabled:text-disabled-text-color disabled:border-unfocused-border-color disabled:cursor-not-allowed",
+ 'border-foreground border rounded-geist bg-foreground text-background px-geist-half font-geist h-10 font-medium transition-all duration-150 ease-in-out inline-flex items-center appearance-none text-sm hover:bg-background hover:text-foreground hover:border-focused-border-color disabled:bg-button-disabled-color disabled:text-disabled-text-color disabled:border-unfocused-border-color disabled:cursor-not-allowed',
secondary
- ? "bg-background text-foreground border-unfocused-border-color"
+ ? 'bg-background text-foreground border-unfocused-border-color'
: undefined,
)}
onClick={onClick}
diff --git a/packages/template-vercel/src/components/Container.tsx b/packages/template-vercel/src/components/Container.tsx
index 19cbcb59e5..9703b44927 100644
--- a/packages/template-vercel/src/components/Container.tsx
+++ b/packages/template-vercel/src/components/Container.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React from 'react';
export const InputContainer: React.FC<{
children: React.ReactNode;
diff --git a/packages/template-vercel/src/components/DownloadButton.tsx b/packages/template-vercel/src/components/DownloadButton.tsx
index 0ffa9576ba..99e8718a74 100644
--- a/packages/template-vercel/src/components/DownloadButton.tsx
+++ b/packages/template-vercel/src/components/DownloadButton.tsx
@@ -1,16 +1,16 @@
-import React from "react";
-import { State } from "../helpers/use-rendering";
-import { Button } from "./Button";
-import { Spacing } from "./Spacing";
+import React from 'react';
+import { State } from '../helpers/use-rendering';
+import { Button } from './Button';
+import { Spacing } from './Spacing';
const Megabytes: React.FC<{
sizeInBytes: number;
}> = ({ sizeInBytes }) => {
- const megabytes = Intl.NumberFormat("en", {
- notation: "compact",
- style: "unit",
- unit: "byte",
- unitDisplay: "narrow",
+ const megabytes = Intl.NumberFormat('en', {
+ notation: 'compact',
+ style: 'unit',
+ unit: 'byte',
+ unitDisplay: 'narrow',
}).format(sizeInBytes);
return <span className="opacity-60">{megabytes}</span>;
};
@@ -19,8 +19,8 @@ export const DownloadButton: React.FC<{
state: State;
undo: () => void;
}> = ({ state, undo }) => {
- if (state.status !== "done") {
- throw new Error("Download button should not be rendered when not done");
+ if (state.status !== 'done') {
+ throw new Error('Download button should not be rendered when not done');
}
return (
diff --git a/packages/template-vercel/src/components/Error.tsx b/packages/template-vercel/src/components/Error.tsx
index 28020e53c2..2df268555a 100644
--- a/packages/template-vercel/src/components/Error.tsx
+++ b/packages/template-vercel/src/components/Error.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React from 'react';
export const ErrorComp: React.FC<{
message: string;
diff --git a/packages/template-vercel/src/components/Input.tsx b/packages/template-vercel/src/components/Input.tsx
index b31484af23..654e50364d 100644
--- a/packages/template-vercel/src/components/Input.tsx
+++ b/packages/template-vercel/src/components/Input.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback } from "react";
+import React, { useCallback } from 'react';
export const Input: React.FC<{
text: string;
diff --git a/packages/template-vercel/src/components/ProgressBar.tsx b/packages/template-vercel/src/components/ProgressBar.tsx
index 7eac570836..224c0a2bed 100644
--- a/packages/template-vercel/src/components/ProgressBar.tsx
+++ b/packages/template-vercel/src/components/ProgressBar.tsx
@@ -1,4 +1,4 @@
-import React, { useMemo } from "react";
+import React, { useMemo } from 'react';
export const ProgressBar: React.FC<{
progress: number;
diff --git a/packages/template-vercel/src/components/RenderControls.tsx b/packages/template-vercel/src/components/RenderControls.tsx
index 0afe1eb03a..210f4dc3b8 100644
--- a/packages/template-vercel/src/components/RenderControls.tsx
+++ b/packages/template-vercel/src/components/RenderControls.tsx
@@ -1,14 +1,14 @@
-import { z } from "zod";
-import { COMP_NAME, CompositionProps } from "../../types/constants";
-import { useRendering } from "../helpers/use-rendering";
-import { AlignEnd } from "./AlignEnd";
-import { Button } from "./Button";
-import { InputContainer } from "./Container";
-import { DownloadButton } from "./DownloadButton";
-import { ErrorComp } from "./Error";
-import { Input } from "./Input";
-import { ProgressBar } from "./ProgressBar";
-import { Spacing } from "./Spacing";
+import { z } from 'zod';
+import { COMP_NAME, CompositionProps } from '../../types/constants';
+import { useRendering } from '../helpers/use-rendering';
+import { AlignEnd } from './AlignEnd';
+import { Button } from './Button';
+import { InputContainer } from './Container';
+import { DownloadButton } from './DownloadButton';
+import { ErrorComp } from './Error';
+import { Input } from './Input';
+import { ProgressBar } from './ProgressBar';
+import { Spacing } from './Spacing';
export const RenderControls: React.FC<{
text: string;
@@ -19,60 +19,51 @@ export const RenderControls: React.FC<{
return (
<InputContainer>
- {state.status === "init" ||
- state.status === "invoking" ||
- state.status === "error" ? (
+ {state.status === 'init' ||
+ state.status === 'invoking' ||
+ state.status === 'error' ? (
<>
<Input
- disabled={state.status === "invoking"}
+ disabled={state.status === 'invoking'}
setText={setText}
text={text}
></Input>
<AlignEnd className="mt-4">
<Button
- disabled={state.status === "invoking"}
- loading={state.status === "invoking"}
+ disabled={state.status === 'invoking'}
+ loading={state.status === 'invoking'}
onClick={renderMedia}
>
Render video
</Button>
</AlignEnd>
- {state.status === "invoking" ? (
+ {state.status === 'invoking' ? (
<>
<Spacing></Spacing>
<div
style={{
fontSize: 14,
lineHeight: 1.5,
- minHeight: "2.5em",
+ minHeight: '2.5em',
marginBottom: 8,
}}
>
- <div style={{ color: "#666" }}>
+ <div style={{ color: '#666' }}>
{state.phase}
{state.progress < 1
? ` ${Math.max(Math.round(state.progress * 100), 1)}%`
: null}
</div>
- <div
- style={{
- color: "#999",
- fontSize: 12,
- visibility: state.subtitle ? "visible" : "hidden",
- }}
- >
- {state.subtitle ?? "\u00A0"}
- </div>
</div>
<ProgressBar progress={state.progress} />
</>
) : null}
- {state.status === "error" ? (
+ {state.status === 'error' ? (
<ErrorComp message={state.error.message}></ErrorComp>
) : null}
</>
) : null}
- {state.status === "done" ? (
+ {state.status === 'done' ? (
<>
<ProgressBar progress={1} />
<Spacing></Spacing>
diff --git a/packages/template-vercel/src/components/Spacing.tsx b/packages/template-vercel/src/components/Spacing.tsx
index c901cfdadb..742905d320 100644
--- a/packages/template-vercel/src/components/Spacing.tsx
+++ b/packages/template-vercel/src/components/Spacing.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React from 'react';
export const Spacing: React.FC = () => {
return <div className="w-geist-quarter h-geist-quarter" />;
diff --git a/packages/template-vercel/src/components/Spinner.tsx b/packages/template-vercel/src/components/Spinner.tsx
index 2c88b26509..e1cae300fa 100644
--- a/packages/template-vercel/src/components/Spinner.tsx
+++ b/packages/template-vercel/src/components/Spinner.tsx
@@ -1,6 +1,6 @@
-import { translatePath } from "@remotion/paths";
-import { makeRect } from "@remotion/shapes";
-import React, { useMemo } from "react";
+import { translatePath } from '@remotion/paths';
+import { makeRect } from '@remotion/shapes';
+import React, { useMemo } from 'react';
const viewBox = 100;
const lines = 12;
@@ -32,7 +32,7 @@ export const Spinner: React.FC<{
className="animate-spinner"
style={{
rotate: `${(index * Math.PI * 2) / lines}rad`,
- transformOrigin: "center center",
+ transformOrigin: 'center center',
animationDelay: `${index * 0.1 - lines * 0.1}s`,
}}
key={index}
diff --git a/packages/template-vercel/src/components/Tips.tsx b/packages/template-vercel/src/components/Tips.tsx
index 3f88e15754..dbfb3b9050 100644
--- a/packages/template-vercel/src/components/Tips.tsx
+++ b/packages/template-vercel/src/components/Tips.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React from 'react';
const Tip: React.FC<{
title: React.ReactNode;
diff --git a/packages/template-vercel/src/helpers/api-response.ts b/packages/template-vercel/src/helpers/api-response.ts
index d4da4ce786..574a3134ae 100644
--- a/packages/template-vercel/src/helpers/api-response.ts
+++ b/packages/template-vercel/src/helpers/api-response.ts
@@ -1,13 +1,13 @@
-import { NextResponse } from "next/server";
-import { z, ZodType } from "zod";
+import { NextResponse } from 'next/server';
+import { z, ZodType } from 'zod';
export type ApiResponse<Res> =
| {
- type: "error";
+ type: 'error';
message: string;
}
| {
- type: "success";
+ type: 'success';
data: Res;
};
@@ -22,12 +22,12 @@ export const executeApi =
const parsed = schema.parse(payload);
const data = await handler(req, parsed);
return NextResponse.json({
- type: "success",
+ type: 'success',
data: data,
});
} catch (err) {
return NextResponse.json(
- { type: "error", message: (err as Error).message },
+ { type: 'error', message: (err as Error).message },
{
status: 500,
},
diff --git a/packages/template-vercel/src/helpers/use-rendering.ts b/packages/template-vercel/src/helpers/use-rendering.ts
index 1dcbff6788..e4781702a2 100644
--- a/packages/template-vercel/src/helpers/use-rendering.ts
+++ b/packages/template-vercel/src/helpers/use-rendering.ts
@@ -1,26 +1,25 @@
-import { useCallback, useMemo, useState } from "react";
-import { z } from "zod";
-import { CompositionProps } from "../../types/constants";
-import { SSEMessage } from "../../types/schema";
+import { useCallback, useMemo, useState } from 'react';
+import { z } from 'zod';
+import { CompositionProps } from '../../types/constants';
+import { SSEMessage } from '../../types/schema';
export type State =
| {
- status: "init";
+ status: 'init';
}
| {
- status: "invoking";
+ status: 'invoking';
phase: string;
progress: number;
- subtitle: string | null;
}
| {
- status: "error";
+ status: 'error';
error: Error;
}
| {
url: string;
size: number;
- status: "done";
+ status: 'done';
};
export const useRendering = (
@@ -28,65 +27,63 @@ export const useRendering = (
inputProps: z.infer<typeof CompositionProps>,
) => {
const [state, setState] = useState<State>({
- status: "init",
+ status: 'init',
});
const renderMedia = useCallback(async () => {
setState({
- status: "invoking",
- phase: "Starting...",
+ status: 'invoking',
+ phase: 'Starting...',
progress: 0,
- subtitle: null,
});
try {
- const response = await fetch("/api/render", {
- method: "POST",
- headers: { "content-type": "application/json" },
+ const response = await fetch('/api/render', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
body: JSON.stringify({ id, inputProps }),
});
if (!response.ok || !response.body) {
- throw new Error("Failed to start render");
+ throw new Error('Failed to start render');
}
const reader = response.body.getReader();
const decoder = new TextDecoder();
- let buffer = "";
+ let buffer = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
- const lines = buffer.split("\n\n");
- buffer = lines.pop() || "";
+ const lines = buffer.split('\n\n');
+ buffer = lines.pop() || '';
for (const line of lines) {
- if (!line.startsWith("data: ")) continue;
+ if (!line.startsWith('data: ')) continue;
const json = line.slice(6);
const message = JSON.parse(json) as SSEMessage;
- if (message.type === "phase") {
+ if (message.type === 'phase') {
setState((prev) => {
- if (prev.status !== "invoking") return prev;
+ if (prev.status !== 'invoking') return prev;
return {
...prev,
phase: message.phase,
progress: message.progress,
- subtitle: message.subtitle ?? null,
};
});
- } else if (message.type === "done") {
+ } else if (message.type === 'done') {
setState({
- status: "done",
+ status: 'done',
url: message.url,
size: message.size,
});
- } else if (message.type === "error") {
+ } else if (message.type === 'error') {
setState({
- status: "error",
+ status: 'error',
error: new Error(message.message),
});
}
@@ -94,14 +91,14 @@ export const useRendering = (
}
} catch (err) {
setState({
- status: "error",
+ status: 'error',
error: err as Error,
});
}
}, [id, inputProps]);
const undo = useCallback(() => {
- setState({ status: "init" });
+ setState({ status: 'init' });
}, []);
return useMemo(() => {
diff --git a/packages/template-vercel/src/lib/utils.ts b/packages/template-vercel/src/lib/utils.ts
index a5ef193506..2819a830d2 100644
--- a/packages/template-vercel/src/lib/utils.ts
+++ b/packages/template-vercel/src/lib/utils.ts
@@ -1,5 +1,5 @@
-import { clsx, type ClassValue } from "clsx";
-import { twMerge } from "tailwind-merge";
+import { clsx, type ClassValue } from 'clsx';
+import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
diff --git a/packages/template-vercel/src/remotion/MyComp/Main.tsx b/packages/template-vercel/src/remotion/MyComp/Main.tsx
index df866b81d6..10a7583072 100644
--- a/packages/template-vercel/src/remotion/MyComp/Main.tsx
+++ b/packages/template-vercel/src/remotion/MyComp/Main.tsx
@@ -1,20 +1,20 @@
-import { fontFamily, loadFont } from "@remotion/google-fonts/Inter";
+import { fontFamily, loadFont } from '@remotion/google-fonts/Inter';
import {
AbsoluteFill,
Sequence,
spring,
useCurrentFrame,
useVideoConfig,
-} from "remotion";
-import { z } from "zod";
-import { CompositionProps } from "../../../types/constants";
-import { NextLogo } from "./NextLogo";
-import { Rings } from "./Rings";
-import { TextFade } from "./TextFade";
+} from 'remotion';
+import { z } from 'zod';
+import { CompositionProps } from '../../../types/constants';
+import { NextLogo } from './NextLogo';
+import { Rings } from './Rings';
+import { TextFade } from './TextFade';
-loadFont("normal", {
- subsets: ["latin"],
- weights: ["400", "700"],
+loadFont('normal', {
+ subsets: ['latin'],
+ weights: ['400', '700'],
});
export const Main = ({ title }: z.infer<typeof CompositionProps>) => {
const frame = useCurrentFrame();
diff --git a/packages/template-vercel/src/remotion/MyComp/NextLogo.tsx b/packages/template-vercel/src/remotion/MyComp/NextLogo.tsx
index b7f87f6bf2..f5aacd6d5e 100644
--- a/packages/template-vercel/src/remotion/MyComp/NextLogo.tsx
+++ b/packages/template-vercel/src/remotion/MyComp/NextLogo.tsx
@@ -1,9 +1,9 @@
-import { evolvePath } from "@remotion/paths";
-import React, { useMemo } from "react";
-import { interpolate, spring, useCurrentFrame, useVideoConfig } from "remotion";
+import { evolvePath } from '@remotion/paths';
+import React, { useMemo } from 'react';
+import { interpolate, spring, useCurrentFrame, useVideoConfig } from 'remotion';
const nStroke =
- "M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z";
+ 'M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z';
export const NextLogo: React.FC<{
outProgress: number;
diff --git a/packages/template-vercel/src/remotion/MyComp/Rings.tsx b/packages/template-vercel/src/remotion/MyComp/Rings.tsx
index 8e27bae856..d4aa3ce012 100644
--- a/packages/template-vercel/src/remotion/MyComp/Rings.tsx
+++ b/packages/template-vercel/src/remotion/MyComp/Rings.tsx
@@ -1,5 +1,5 @@
-import React from "react";
-import { AbsoluteFill, interpolateColors, useVideoConfig } from "remotion";
+import React from 'react';
+import { AbsoluteFill, interpolateColors, useVideoConfig } from 'remotion';
const RadialGradient: React.FC<{
radius: number;
@@ -11,8 +11,8 @@ const RadialGradient: React.FC<{
return (
<AbsoluteFill
style={{
- justifyContent: "center",
- alignItems: "center",
+ justifyContent: 'center',
+ alignItems: 'center',
}}
>
<div
@@ -46,7 +46,7 @@ export const Rings: React.FC<{
<RadialGradient
key={i}
radius={height * 0.3 * i}
- color={interpolateColors(i, [0, 4], ["#fff", "#fff"])}
+ color={interpolateColors(i, [0, 4], ['#fff', '#fff'])}
/>
);
})
diff --git a/packages/template-vercel/src/remotion/MyComp/TextFade.tsx b/packages/template-vercel/src/remotion/MyComp/TextFade.tsx
index 1b71930a0b..09ddcd20be 100644
--- a/packages/template-vercel/src/remotion/MyComp/TextFade.tsx
+++ b/packages/template-vercel/src/remotion/MyComp/TextFade.tsx
@@ -1,11 +1,11 @@
-import React, { useMemo } from "react";
+import React, { useMemo } from 'react';
import {
AbsoluteFill,
interpolate,
spring,
useCurrentFrame,
useVideoConfig,
-} from "remotion";
+} from 'remotion';
export const TextFade: React.FC<{
children: React.ReactNode;
diff --git a/packages/template-vercel/src/remotion/Root.tsx b/packages/template-vercel/src/remotion/Root.tsx
index 35901f2f06..284b680e91 100644
--- a/packages/template-vercel/src/remotion/Root.tsx
+++ b/packages/template-vercel/src/remotion/Root.tsx
@@ -1,4 +1,4 @@
-import { Composition } from "remotion";
+import { Composition } from 'remotion';
import {
COMP_NAME,
defaultMyCompProps,
@@ -6,9 +6,9 @@ import {
VIDEO_FPS,
VIDEO_HEIGHT,
VIDEO_WIDTH,
-} from "../../types/constants";
-import { Main } from "./MyComp/Main";
-import { NextLogo } from "./MyComp/NextLogo";
+} from '../../types/constants';
+import { Main } from './MyComp/Main';
+import { NextLogo } from './MyComp/NextLogo';
export const RemotionRoot: React.FC = () => {
return (
diff --git a/packages/template-vercel/src/remotion/index.ts b/packages/template-vercel/src/remotion/index.ts
index 2142852e8d..092fe6e97d 100644
--- a/packages/template-vercel/src/remotion/index.ts
+++ b/packages/template-vercel/src/remotion/index.ts
@@ -1,5 +1,5 @@
-import { registerRoot } from "remotion";
-import "../../styles/global.css";
-import { RemotionRoot } from "./Root";
+import { registerRoot } from 'remotion';
+import '../../styles/global.css';
+import { RemotionRoot } from './Root';
registerRoot(RemotionRoot);
diff --git a/packages/template-vercel/types/schema.ts b/packages/template-vercel/types/schema.ts
index 66d77866c9..3a24a04455 100644
--- a/packages/template-vercel/types/schema.ts
+++ b/packages/template-vercel/types/schema.ts
@@ -1,23 +1,23 @@
-import { z } from "zod";
-import { CompositionProps } from "./constants";
+import { z } from 'zod';
+import { CompositionProps } from './constants';
export const RenderRequest = z.object({
- id: z.string(),
- inputProps: CompositionProps,
+ id: z.string(),
+ inputProps: CompositionProps,
});
export type RenderResponse =
- | {
- type: "error";
- message: string;
- }
- | {
- type: "done";
- url: string;
- size: number;
- };
+ | {
+ type: 'error';
+ message: string;
+ }
+ | {
+ type: 'done';
+ url: string;
+ size: number;
+ };
export type SSEMessage =
- | { type: "phase"; phase: string; progress: number; subtitle?: string }
- | { type: "done"; url: string; size: number }
- | { type: "error"; message: string };
+ | { type: 'phase'; phase: string; progress: number }
+ | { type: 'done'; url: string; size: number }
+ | { type: 'error'; message: string };