Skip to content

🎥 Make videos programmatically with React

`@remotion/vercel`: Fix docs to use real imports instead of manual type declarations

Jonny Burgeraaf3e3fed5ad
diff --git a/bun.lock b/bun.lock
index cb5adf4551..ddfc27d6ed 100644
--- a/bun.lock
+++ b/bun.lock
@@ -420,6 +420,7 @@
"@remotion/tailwind-v4": "workspace:*",
"@remotion/three": "workspace:*",
"@remotion/transitions": "workspace:*",
+ "@remotion/vercel": "workspace:*",
"@remotion/web-renderer": "workspace:*",
"@remotion/webcodecs": "workspace:*",
"@remotion/whisper-web": "workspace:*",
@@ -433,6 +434,7 @@
"@types/uuid": "^8.3.4",
"@vercel/config": "^0.0.28",
"@vercel/functions": "^3.1.4",
+ "@vercel/sandbox": "1.6.0",
"chalk": "4.1.2",
"clipboard": "^2.0.8",
"clsx": "^1.1.1",
@@ -2277,7 +2279,7 @@
},
"packages/vercel": {
"name": "@remotion/vercel",
- "version": "4.0.424",
+ "version": "4.0.425",
"dependencies": {
"remotion": "workspace:*",
},
diff --git a/packages/docs/docs/vercel/create-sandbox.mdx b/packages/docs/docs/vercel/create-sandbox.mdx
index 3efdd1debb..4b8a28fc1e 100644
--- a/packages/docs/docs/vercel/create-sandbox.mdx
+++ b/packages/docs/docs/vercel/create-sandbox.mdx
@@ -15,8 +15,7 @@ This is a lower-level API. For most use cases, prefer [`getOrCreateSandbox()`](/
```ts twoslash title="create-snapshot.ts"
// @module: es2022
// @target: es2022
-import type {OnProgress, VercelSandbox} from '@remotion/vercel';
-const createSandbox: (options: {bundleDir: string; onProgress?: OnProgress}) => Promise<VercelSandbox> = null as unknown as (options: {bundleDir: string; onProgress?: OnProgress}) => Promise<VercelSandbox>;
+import {createSandbox} from '@remotion/vercel';
// ---cut---
const sandbox = await createSandbox({
bundleDir: '.remotion',
diff --git a/packages/docs/docs/vercel/create-snapshot.mdx b/packages/docs/docs/vercel/create-snapshot.mdx
index d6939f3f93..8a5f6ac2ad 100644
--- a/packages/docs/docs/vercel/create-snapshot.mdx
+++ b/packages/docs/docs/vercel/create-snapshot.mdx
@@ -15,9 +15,8 @@ Typically called during the build step (e.g. in `create-snapshot.ts`) to cache t
```ts twoslash title="create-snapshot.ts"
// @module: es2022
// @target: es2022
-import type {VercelSandbox} from '@remotion/vercel';
-const createSnapshot: (options: {sandbox: VercelSandbox}) => Promise<{snapshotId: string}> = null as unknown as (options: {sandbox: VercelSandbox}) => Promise<{snapshotId: string}>;
-declare const sandbox: VercelSandbox;
+import {createSnapshot, createSandbox} from '@remotion/vercel';
+const sandbox = await createSandbox({bundleDir: '.remotion'});
// ---cut---
const {snapshotId} = await createSnapshot({sandbox});
console.log(`Snapshot created: ${snapshotId}`);
diff --git a/packages/docs/docs/vercel/get-or-create-sandbox.mdx b/packages/docs/docs/vercel/get-or-create-sandbox.mdx
index ee398b8e91..adb60d5584 100644
--- a/packages/docs/docs/vercel/get-or-create-sandbox.mdx
+++ b/packages/docs/docs/vercel/get-or-create-sandbox.mdx
@@ -16,8 +16,7 @@ The primary entry point for getting a sandbox. Automatically handles the dev/pro
```ts twoslash title="route.ts"
// @module: es2022
// @target: es2022
-import type {OnProgress, VercelSandbox} from '@remotion/vercel';
-const getOrCreateSandbox: (options: {bundleDir: string; onProgress?: OnProgress}) => Promise<VercelSandbox> = null as unknown as (options: {bundleDir: string; onProgress?: OnProgress}) => Promise<VercelSandbox>;
+import {getOrCreateSandbox} from '@remotion/vercel';
// ---cut---
await using sandbox = await getOrCreateSandbox({
bundleDir: '.remotion',
diff --git a/packages/docs/docs/vercel/get-snapshot.mdx b/packages/docs/docs/vercel/get-snapshot.mdx
index 2967ecb60e..d6ef33a1f0 100644
--- a/packages/docs/docs/vercel/get-snapshot.mdx
+++ b/packages/docs/docs/vercel/get-snapshot.mdx
@@ -15,7 +15,7 @@ Used internally by [`getOrCreateSandbox()`](/docs/vercel/get-or-create-sandbox)
```ts twoslash title="route.ts"
// @module: es2022
// @target: es2022
-const getSnapshot: () => Promise<string | null> = null as unknown as () => Promise<string | null>;
+import {getSnapshot} from '@remotion/vercel';
// ---cut---
const snapshotId = await getSnapshot();
if (snapshotId) {
diff --git a/packages/docs/docs/vercel/render-still-on-vercel.mdx b/packages/docs/docs/vercel/render-still-on-vercel.mdx
index fe7f63e40c..a22254a8b4 100644
--- a/packages/docs/docs/vercel/render-still-on-vercel.mdx
+++ b/packages/docs/docs/vercel/render-still-on-vercel.mdx
@@ -15,10 +15,8 @@ The rendered file stays inside the sandbox. Use [`uploadToBlobStorage()`](/docs/
```ts twoslash title="route.ts"
// @module: es2022
// @target: es2022
-import type {RenderOnVercelProgress, VercelSandbox} from '@remotion/vercel';
-const renderStillOnVercel: (options: {sandbox: VercelSandbox; compositionId: string; inputProps: Record<string, unknown>; imageFormat?: 'png' | 'jpeg' | 'webp'; outputFile?: string; onProgress?: (progress: RenderOnVercelProgress) => void; bundleDir?: string}) => Promise<{file: string}> =
- null as unknown as any;
-declare const sandbox: VercelSandbox;
+import {renderStillOnVercel, getOrCreateSandbox} from '@remotion/vercel';
+const sandbox = await getOrCreateSandbox({bundleDir: '.remotion'});
// ---cut---
const {file} = await renderStillOnVercel({
sandbox,
diff --git a/packages/docs/docs/vercel/render-video-on-vercel.mdx b/packages/docs/docs/vercel/render-video-on-vercel.mdx
index b0b6411c95..06b39e9b41 100644
--- a/packages/docs/docs/vercel/render-video-on-vercel.mdx
+++ b/packages/docs/docs/vercel/render-video-on-vercel.mdx
@@ -15,9 +15,8 @@ The rendered file stays inside the sandbox. Use [`uploadToBlobStorage()`](/docs/
```ts twoslash title="route.ts"
// @module: es2022
// @target: es2022
-import type {RenderOnVercelProgress, VercelSandbox} from '@remotion/vercel';
-const renderVideoOnVercel: (options: {sandbox: VercelSandbox; compositionId: string; inputProps: Record<string, unknown>; codec?: string; outputFile?: string; onProgress?: (progress: RenderOnVercelProgress) => void; bundleDir?: string}) => Promise<{file: string}> = null as unknown as any;
-declare const sandbox: VercelSandbox;
+import {renderVideoOnVercel, getOrCreateSandbox} from '@remotion/vercel';
+const sandbox = await getOrCreateSandbox({bundleDir: '.remotion'});
// ---cut---
const {file} = await renderVideoOnVercel({
sandbox,
diff --git a/packages/docs/docs/vercel/save-snapshot.mdx b/packages/docs/docs/vercel/save-snapshot.mdx
index 819d5159fc..8e0a8ae0e7 100644
--- a/packages/docs/docs/vercel/save-snapshot.mdx
+++ b/packages/docs/docs/vercel/save-snapshot.mdx
@@ -13,7 +13,7 @@ Saves a snapshot ID to Vercel Blob storage, keyed by the current `VERCEL_DEPLOYM
```ts twoslash title="create-snapshot.ts"
// @module: es2022
// @target: es2022
-const saveSnapshot: (options: {snapshotId: string}) => Promise<void> = null as unknown as (options: {snapshotId: string}) => Promise<void>;
+import {saveSnapshot} from '@remotion/vercel';
// ---cut---
await saveSnapshot({snapshotId: 'snap_abc123'});
```
diff --git a/packages/docs/docs/vercel/upload-to-blob-storage.mdx b/packages/docs/docs/vercel/upload-to-blob-storage.mdx
index 4dd9690690..69189b5a37 100644
--- a/packages/docs/docs/vercel/upload-to-blob-storage.mdx
+++ b/packages/docs/docs/vercel/upload-to-blob-storage.mdx
@@ -13,9 +13,8 @@ Uploads a file from the sandbox to [Vercel Blob](https://vercel.com/docs/storage
```ts twoslash title="route.ts"
// @module: es2022
// @target: es2022
-import type {VercelSandbox} from '@remotion/vercel';
-const uploadToBlobStorage: (options: {sandbox: VercelSandbox; sandboxFilePath: string; blobPath?: string; contentType: string; blobToken: string}) => Promise<{url: string; size: number}> = null as unknown as any;
-declare const sandbox: VercelSandbox;
+import {uploadToBlobStorage, getOrCreateSandbox} from '@remotion/vercel';
+const sandbox = await getOrCreateSandbox({bundleDir: '.remotion'});
// ---cut---
const {url, size} = await uploadToBlobStorage({
sandbox,
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 0da9805daa..1049ca0fcd 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -79,6 +79,7 @@
"@remotion/tailwind-v4": "workspace:*",
"@remotion/three": "workspace:*",
"@remotion/transitions": "workspace:*",
+ "@remotion/vercel": "workspace:*",
"@remotion/web-renderer": "workspace:*",
"@remotion/webcodecs": "workspace:*",
"@remotion/whisper-web": "workspace:*",
@@ -91,6 +92,7 @@
"@types/uuid": "^8.3.4",
"@vercel/config": "^0.0.28",
"@vercel/functions": "^3.1.4",
+ "@vercel/sandbox": "1.6.0",
"chalk": "4.1.2",
"clipboard": "^2.0.8",
"clsx": "^1.1.1",