Skip to content

🎥 Make videos programmatically with React

awesome now

Jonny Burger28a80f94e527
diff --git a/packages/.monorepo/builder.ts b/packages/.monorepo/builder.ts
index 8d7a64c9f5..d4bb42f82b 100644
--- a/packages/.monorepo/builder.ts
+++ b/packages/.monorepo/builder.ts
@@ -67,9 +67,7 @@ export const buildPackage = async ({
}) => {
console.time(`Generated ${formats.join(', ')}.`);
const pkg = await Bun.file(path.join(process.cwd(), 'package.json')).json();
- const newExports = {
- ...pkg.exports,
- };
+ const newExports = {};
const versions = {};
for (const format of formats) {
@@ -96,16 +94,18 @@ export const buildPackage = async ({
const exportName = firstName === 'index' ? '.' : './' + firstName;
newExports[exportName] = {
types: `./dist/${firstName}.d.ts`,
- ...(format === 'esm'
+ // Order is important!
+ // require() must be at top
+ ...(format === 'cjs'
? {
- module: outputPath,
- import: outputPath,
+ require: outputPath,
}
: {}),
...(newExports[exportName] ?? {}),
- ...(format === 'cjs'
+ ...(format === 'esm'
? {
- require: outputPath,
+ module: outputPath,
+ import: outputPath,
}
: {}),
};
diff --git a/packages/docs/components/lambda/default-frames-per-lambda.tsx b/packages/docs/components/lambda/default-frames-per-lambda.tsx
index a0cfc4078c..19e1d5f830 100644
--- a/packages/docs/components/lambda/default-frames-per-lambda.tsx
+++ b/packages/docs/components/lambda/default-frames-per-lambda.tsx
@@ -1,6 +1,6 @@
-import { MINIMUM_FRAMES_PER_LAMBDA } from "@remotion/lambda/defaults";
-import React from "react";
+import {MINIMUM_FRAMES_PER_LAMBDA} from '@remotion/lambda-client/constants';
+import React from 'react';
export const MinimumFramesPerLambda: React.FC = () => {
- return <code>{MINIMUM_FRAMES_PER_LAMBDA}</code>;
+ return <code>{MINIMUM_FRAMES_PER_LAMBDA}</code>;
};
diff --git a/packages/docs/components/lambda/default-log-retention.tsx b/packages/docs/components/lambda/default-log-retention.tsx
index b04acb3eef..d0fa876fd4 100644
--- a/packages/docs/components/lambda/default-log-retention.tsx
+++ b/packages/docs/components/lambda/default-log-retention.tsx
@@ -1,6 +1,6 @@
-import { DEFAULT_CLOUDWATCH_RETENTION_PERIOD } from "@remotion/lambda/defaults";
-import React from "react";
+import {DEFAULT_CLOUDWATCH_RETENTION_PERIOD} from '@remotion/lambda-client/constants';
+import React from 'react';
export const DefaultLogRetention: React.FC = () => {
- return <span>{DEFAULT_CLOUDWATCH_RETENTION_PERIOD}</span>;
+ return <span>{DEFAULT_CLOUDWATCH_RETENTION_PERIOD}</span>;
};
diff --git a/packages/docs/components/lambda/default-memory-size.tsx b/packages/docs/components/lambda/default-memory-size.tsx
index 896fa807f8..3520c70406 100644
--- a/packages/docs/components/lambda/default-memory-size.tsx
+++ b/packages/docs/components/lambda/default-memory-size.tsx
@@ -1,6 +1,6 @@
-import { DEFAULT_MEMORY_SIZE } from "@remotion/lambda/defaults";
-import React from "react";
+import {DEFAULT_MEMORY_SIZE} from '@remotion/lambda-client/constants';
+import React from 'react';
export const DefaultMemorySize: React.FC = () => {
- return <span>{DEFAULT_MEMORY_SIZE}</span>;
+ return <span>{DEFAULT_MEMORY_SIZE}</span>;
};
diff --git a/packages/docs/components/lambda/default-timeout.tsx b/packages/docs/components/lambda/default-timeout.tsx
index 72244dd946..35b33bbd14 100644
--- a/packages/docs/components/lambda/default-timeout.tsx
+++ b/packages/docs/components/lambda/default-timeout.tsx
@@ -1,6 +1,6 @@
-import { DEFAULT_TIMEOUT } from "@remotion/lambda/defaults";
-import React from "react";
+import {DEFAULT_TIMEOUT} from '@remotion/lambda-client/constants';
+import React from 'react';
export const DefaultTimeout: React.FC = () => {
- return <span>{DEFAULT_TIMEOUT}</span>;
+ return <span>{DEFAULT_TIMEOUT}</span>;
};
diff --git a/packages/docs/components/lambda/regions.tsx b/packages/docs/components/lambda/regions.tsx
index 03371095e9..1c5d1f2b41 100644
--- a/packages/docs/components/lambda/regions.tsx
+++ b/packages/docs/components/lambda/regions.tsx
@@ -1,16 +1,16 @@
-import { AWS_REGIONS } from "@remotion/lambda/regions";
-import React from "react";
+import {AWS_REGIONS} from '@remotion/lambda-client/regions';
+import React from 'react';
export const LambdaRegionList: React.FC = () => {
- return (
- <ul>
- {AWS_REGIONS.map((region) => {
- return (
- <li key={region}>
- <code>{region}</code>{" "}
- </li>
- );
- })}
- </ul>
- );
+ return (
+ <ul>
+ {AWS_REGIONS.map((region) => {
+ return (
+ <li key={region}>
+ <code>{region}</code>{' '}
+ </li>
+ );
+ })}
+ </ul>
+ );
};
diff --git a/packages/docs/components/lambda/role-permissions.tsx b/packages/docs/components/lambda/role-permissions.tsx
index bcc9161f9b..f79c602f0c 100644
--- a/packages/docs/components/lambda/role-permissions.tsx
+++ b/packages/docs/components/lambda/role-permissions.tsx
@@ -1,10 +1,10 @@
-import { getRolePolicy } from "@remotion/lambda/policies";
-import React from "react";
+import {getRolePolicy} from '@remotion/lambda/policies';
+import React from 'react';
export const RolePolicy: React.FC = () => {
- return (
- <div>
- <pre>{getRolePolicy()}</pre>
- </div>
- );
+ return (
+ <div>
+ <pre>{getRolePolicy()}</pre>
+ </div>
+ );
};
diff --git a/packages/docs/components/lambda/user-permissions.tsx b/packages/docs/components/lambda/user-permissions.tsx
index 5aff6f24e6..7df3c0e726 100644
--- a/packages/docs/components/lambda/user-permissions.tsx
+++ b/packages/docs/components/lambda/user-permissions.tsx
@@ -1,10 +1,10 @@
-import { getUserPolicy } from "@remotion/lambda/policies";
-import React from "react";
+import {getUserPolicy} from '@remotion/lambda/policies';
+import React from 'react';
export const UserPolicy: React.FC = () => {
- return (
- <div>
- <pre>{getUserPolicy()}</pre>
- </div>
- );
+ return (
+ <div>
+ <pre>{getUserPolicy()}</pre>
+ </div>
+ );
};
diff --git a/packages/docs/docs/lambda/supabase.mdx b/packages/docs/docs/lambda/supabase.mdx
index 854414deed..27d0f78d8b 100644
--- a/packages/docs/docs/lambda/supabase.mdx
+++ b/packages/docs/docs/lambda/supabase.mdx
@@ -9,15 +9,15 @@ slug: /lambda/supabase
This page shows how to trigger a Remotion Lambda render from a Supabase Edge Function.
Other than that, the steps to use Remotion Lambda are the same as described in the [Remotion Lambda setup](/docs/lambda/setup).
-## Invoking a Remotion Lambda render from Supabase Edge Functions<AvailableFrom v="4.0.258"/>
+## Invoking a Remotion Lambda render from Supabase Edge Functions<AvailableFrom v="4.0.261"/>
-Install the `@remotion/lambda` package in your Supabase Edge Functions project:
+Install the `@remotion/lambda-client` package in your Supabase Edge Functions project:
```bash
-deno add @remotion/[email protected]
+deno add @remotion/[email protected]
```
-Replace `4.0.258` with the version of Remotion you are using.
+Replace `4.0.261` with the version of Remotion you are using.
Set the environment variable `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`:
@@ -28,8 +28,8 @@ AWS_SECRET_ACCESS_KEY=xxx
```tsx title="supabase/functions/trigger-render.ts"
import 'jsr:@supabase/functions-js/edge-runtime.d.ts';
-// FIXME: Replace 4.0.258 with the version of Remotion you are using.
-import {renderMediaOnLambda} from 'npm:@remotion/[email protected]/client';
+// FIXME: Replace 4.0.261 with the version of Remotion you are using.
+import {renderMediaOnLambda} from 'npm:@remotion/[email protected]';
Deno.serve(async (req) => {
const {props} = await req.json();
@@ -67,7 +67,7 @@ Create a Supabase Storage bucket and set the environment variables `SUPABASE_ACC
Use an [`s3OutputProvider`](/docs/lambda/custom-destination#saving-to-another-cloud) to store the rendered video in Supabase Storage:
```tsx twoslash
-import {renderMediaOnLambda, speculateFunctionName} from '@remotion/lambda/client';
+import {renderMediaOnLambda, speculateFunctionName} from '@remotion/lambda-client';
// ---cut---
const {bucketName, renderId, cloudWatchMainLogs} = await renderMediaOnLambda({
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 0801e6e4fc..e0c63ec20f 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -47,6 +47,7 @@
"@remotion/captions": "workspace:*",
"@remotion/install-whisper-cpp": "workspace:*",
"@remotion/lambda": "workspace:*",
+ "@remotion/lambda-client": "workspace:*",
"@remotion/layout-utils": "workspace:*",
"@remotion/licensing": "workspace:*",
"@remotion/lottie": "workspace:*",
diff --git a/packages/lambda-client/package.json b/packages/lambda-client/package.json
index 0631f7e5f0..e1e2ca9dda 100644
--- a/packages/lambda-client/package.json
+++ b/packages/lambda-client/package.json
@@ -36,24 +36,23 @@
"access": "public"
},
"exports": {
- "./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
+ "require": "./dist/cjs/index.js",
"module": "./dist/esm/index.mjs",
- "import": "./dist/esm/index.mjs",
- "require": "./dist/cjs/index.js"
+ "import": "./dist/esm/index.mjs"
},
"./constants": {
"types": "./dist/constants.d.ts",
+ "require": "./dist/cjs/constants.js",
"module": "./dist/esm/constants.mjs",
- "import": "./dist/esm/constants.mjs",
- "require": "./dist/cjs/constants.js"
+ "import": "./dist/esm/constants.mjs"
},
"./regions": {
"types": "./dist/regions.d.ts",
+ "require": "./dist/cjs/regions.js",
"module": "./dist/esm/regions.mjs",
- "import": "./dist/esm/regions.mjs",
- "require": "./dist/cjs/regions.js"
+ "import": "./dist/esm/regions.mjs"
}
},
"typesVersions": {
diff --git a/packages/lambda-client/src/index.ts b/packages/lambda-client/src/index.ts
index 4085d02849..d56942b420 100644
--- a/packages/lambda-client/src/index.ts
+++ b/packages/lambda-client/src/index.ts
@@ -1,5 +1,5 @@
export type {EnhancedErrorInfo} from '@remotion/serverless';
-export {
+export type {
GetOrCreateBucketInput,
GetOrCreateBucketOutput,
} from '@remotion/serverless-client';
diff --git a/packages/lambda/package.json b/packages/lambda/package.json
index bf7a53d2db..4894f0d46e 100644
--- a/packages/lambda/package.json
+++ b/packages/lambda/package.json
@@ -55,20 +55,11 @@
"exports": {
"./package.json": "./package.json",
".": "./dist/index.js",
- "./defaults": "./dist/defaults.js",
- "./regions": "./dist/regions.js",
"./policies": "./dist/api/iam-validation/suggested-policy.js",
- "./client": "./dist/client.js",
- "./layers": "./dist/shared/hosted-layers.js"
+ "./client": "./dist/client.js"
},
"typesVersions": {
">=1.0": {
- "defaults": [
- "dist/defaults.d.ts"
- ],
- "regions": [
- "dist/regions.d.ts"
- ],
"policies": [
"dist/api/iam-validation/suggested-policy.d.ts"
],
diff --git a/packages/studio-shared/src/package-info.ts b/packages/studio-shared/src/package-info.ts
index 4865c4f2bf..a95c7c266e 100644
--- a/packages/studio-shared/src/package-info.ts
+++ b/packages/studio-shared/src/package-info.ts
@@ -40,6 +40,7 @@ export const packages = [
'lambda-ruby',
'lambda-python',
'lambda',
+ 'lambda-client',
'layout-utils',
'licensing',
'lottie',
@@ -57,6 +58,7 @@ export const packages = [
'promo-pages',
'streaming',
'serverless',
+ 'serverless-client',
'studio-server',
'studio-shared',
'studio',
@@ -136,6 +138,7 @@ export const descriptions: {[key in Pkgs]: string | null} = {
'lambda-go': null,
example: null,
'lambda-php': null,
+ 'lambda-client': null,
bugs: null,
docs: null,
'it-tests': null,
@@ -156,6 +159,7 @@ export const descriptions: {[key in Pkgs]: string | null} = {
'example-videos': null,
'promo-pages': null,
'svg-3d-engine': '3D SVG extrusion effects',
+ 'serverless-client': null,
};
export const installableMap: {[key in Pkgs]: boolean} = {
'svg-3d-engine': false,
@@ -169,6 +173,8 @@ export const installableMap: {[key in Pkgs]: boolean} = {
'cli-autocomplete': false,
cli: false,
cloudrun: true,
+ 'lambda-client': false,
+ 'serverless-client': false,
'compositor-darwin-arm64': false,
'compositor-darwin-x64': false,
'compositor-linux-arm64-gnu': false,
@@ -242,6 +248,8 @@ export const apiDocs: {[key in Pkgs]: string | null} = {
core: 'https://www.remotion.dev/docs/remotion',
lambda: 'https://www.remotion.dev/docs/lambda',
bundler: 'https://www.remotion.dev/docs/bundler',
+ 'lambda-client': null,
+ 'serverless-client': null,
'studio-server': null,
'install-whisper-cpp': 'https://www.remotion.dev/docs/install-whisper-cpp',
'google-fonts': 'https://www.remotion.dev/docs/google-fonts',
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2da2e73400..1fe7505aab 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -632,6 +632,9 @@ importers:
'@remotion/lambda':
specifier: workspace:*
version: link:../lambda
+ '@remotion/lambda-client':
+ specifier: workspace:*
+ version: link:../lambda-client
'@remotion/layout-utils':
specifier: workspace:*
version: link:../layout-utils