🎥 Make videos programmatically with React
`@remotion/vercel`: Rename OnProgress to CreateSandboxOnProgress and export it
Jonny Burgerc7fe64864c44
diff --git a/packages/docs/docs/vercel/create-sandbox.mdx b/packages/docs/docs/vercel/create-sandbox.mdxindex 4b8a28fc1e..50d1bf3141 100644--- a/packages/docs/docs/vercel/create-sandbox.mdx+++ b/packages/docs/docs/vercel/create-sandbox.mdx@@ -16,6 +16,7 @@ This is a lower-level API. For most use cases, prefer [`getOrCreateSandbox()`](/// @module: es2022// @target: es2022import {createSandbox} from '@remotion/vercel';+import type {CreateSandboxOnProgress} from '@remotion/vercel';// ---cut---const sandbox = await createSandbox({bundleDir: '.remotion',@@ -37,8 +38,12 @@ The path to your Remotion bundle directory, relative to the current working direA callback that receives progress updates during sandbox creation.+```ts twoslash+import type {CreateSandboxOnProgress} from '@remotion/vercel';+```+```ts-type OnProgress = (update: {+type CreateSandboxOnProgress = (update: {progress: number; // 0 to 1message: string; // Human-readable phase description}) => void;diff --git a/packages/docs/docs/vercel/get-or-create-sandbox.mdx b/packages/docs/docs/vercel/get-or-create-sandbox.mdxindex adb60d5584..c6db54c71d 100644--- a/packages/docs/docs/vercel/get-or-create-sandbox.mdx+++ b/packages/docs/docs/vercel/get-or-create-sandbox.mdx@@ -36,7 +36,7 @@ The path to your Remotion bundle directory, relative to the current working dire### `onProgress?`-A callback that receives progress updates. Only called during development when a fresh sandbox is created.+A callback of type [`CreateSandboxOnProgress`](/docs/vercel/create-sandbox#onprogress) that receives progress updates. Only called during development when a fresh sandbox is created.## Return valuediff --git a/packages/vercel/src/create-sandbox.ts b/packages/vercel/src/create-sandbox.tsindex 0afd48b65b..fabcb0d728 100644--- a/packages/vercel/src/create-sandbox.ts+++ b/packages/vercel/src/create-sandbox.ts@@ -5,7 +5,7 @@ import {installJsDependencies} from './internals/install-js-dependencies';import {installSystemDependencies} from './internals/install-system-dependencies';import {patchCompositor} from './internals/patch-compositor';import {getRenderVideoScript} from './internals/render-video-script';-import type {OnProgress, VercelSandbox} from './types';+import type {CreateSandboxOnProgress, VercelSandbox} from './types';export const SANDBOX_CREATING_TIMEOUT = 5 * 60 * 1000;@@ -14,7 +14,7 @@ export async function createSandbox({onProgress,}: {bundleDir: string;- onProgress?: OnProgress;+ onProgress?: CreateSandboxOnProgress;}): Promise<VercelSandbox> {const report = (progress: number, message: string) => {onProgress?.({progress, message});diff --git a/packages/vercel/src/get-or-create-sandbox.ts b/packages/vercel/src/get-or-create-sandbox.tsindex c6b8e8795f..cb30b8b1af 100644--- a/packages/vercel/src/get-or-create-sandbox.ts+++ b/packages/vercel/src/get-or-create-sandbox.ts@@ -1,14 +1,14 @@import {createSandbox, SANDBOX_CREATING_TIMEOUT} from './create-sandbox';import {getSnapshot} from './get-snapshot';import {createDisposableSandbox} from './internals/disposable';-import type {OnProgress, VercelSandbox} from './types';+import type {CreateSandboxOnProgress, VercelSandbox} from './types';export async function getOrCreateSandbox({bundleDir,onProgress,}: {bundleDir: string;- onProgress?: OnProgress;+ onProgress?: CreateSandboxOnProgress;}): Promise<VercelSandbox> {// During local development, a new sandbox is created from scratch always (no snapshotting)if (!process.env.VERCEL) {diff --git a/packages/vercel/src/index.ts b/packages/vercel/src/index.tsindex 00b15e0343..e8f1129766 100644--- a/packages/vercel/src/index.ts+++ b/packages/vercel/src/index.ts@@ -5,5 +5,9 @@ export {getSnapshot} from './get-snapshot';export {renderStillOnVercel} from './render-still';export {renderVideoOnVercel} from './render-video';export {saveSnapshot} from './save-snapshot';-export type {OnProgress, RenderOnVercelProgress, VercelSandbox} from './types';+export type {+ CreateSandboxOnProgress,+ RenderOnVercelProgress,+ VercelSandbox,+} from './types';export {uploadToBlobStorage} from './upload-to-blob-storage';diff --git a/packages/vercel/src/types.ts b/packages/vercel/src/types.tsindex 49095bbf60..f3d2d9f586 100644--- a/packages/vercel/src/types.ts+++ b/packages/vercel/src/types.ts@@ -2,7 +2,10 @@ import type {Sandbox} from '@vercel/sandbox';export type VercelSandbox = Sandbox & AsyncDisposable;-export type OnProgress = (update: {progress: number; message: string}) => void;+export type CreateSandboxOnProgress = (update: {+ progress: number;+ message: string;+}) => void;export type RenderOnVercelProgress =| {type: 'opening-browser'}