🎥 Make videos programmatically with React
don't import react
Jonny Burgerfd7d07b4c32f
diff --git a/packages/cloudrun/src/api/deploy-service.ts b/packages/cloudrun/src/api/deploy-service.tsindex a5a58e831f..1c7a63c4bd 100644--- a/packages/cloudrun/src/api/deploy-service.ts+++ b/packages/cloudrun/src/api/deploy-service.ts@@ -1,4 +1,4 @@-import {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import {DEFAULT_MAX_INSTANCES,DEFAULT_MIN_INSTANCES,@@ -131,5 +131,4 @@ const deployServiceRaw = async ({* @param params.region GCP region to deploy the Cloud Run service to.* @returns {Promise<DeployServiceOutput>} See documentation for detailed structure*/-export const deployService =- BrowserSafeApis.wrapWithErrorHandling(deployServiceRaw);+export const deployService = PureJSAPIs.wrapWithErrorHandling(deployServiceRaw);diff --git a/packages/cloudrun/src/api/deploy-site.ts b/packages/cloudrun/src/api/deploy-site.tsindex fd548d6f68..075a570264 100644--- a/packages/cloudrun/src/api/deploy-site.ts+++ b/packages/cloudrun/src/api/deploy-site.ts@@ -1,5 +1,5 @@import type {WebpackOverrideFn} from '@remotion/bundler';-import {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import {cloudrunDeleteFile, cloudrunLs} from '../functions/helpers/io';import {bundleSite} from '../shared/bundle-site';import {getSitesKey} from '../shared/constants';@@ -117,4 +117,4 @@ const deploySiteRaw = async ({* @param {string} params.siteName The name of the folder in which the project gets deployed to.* @param {object} params.options Further options, see documentation page for this function.*/-export const deploySite = BrowserSafeApis.wrapWithErrorHandling(deploySiteRaw);+export const deploySite = PureJSAPIs.wrapWithErrorHandling(deploySiteRaw);diff --git a/packages/cloudrun/src/api/render-media-on-cloudrun.ts b/packages/cloudrun/src/api/render-media-on-cloudrun.tsindex 824d9eef6a..a3353ba9b6 100644--- a/packages/cloudrun/src/api/render-media-on-cloudrun.ts+++ b/packages/cloudrun/src/api/render-media-on-cloudrun.ts@@ -10,7 +10,8 @@ import type {X264Preset,} from '@remotion/renderer';import {RenderInternals} from '@remotion/renderer';-import {BrowserSafeApis} from '@remotion/renderer/client';+import type {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import {Internals} from 'remotion';import type {CloudRunCrashResponse,@@ -276,6 +277,6 @@ const renderMediaOnCloudrunRaw = async ({* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure*/-export const renderMediaOnCloudrun = BrowserSafeApis.wrapWithErrorHandling(+export const renderMediaOnCloudrun = PureJSAPIs.wrapWithErrorHandling(renderMediaOnCloudrunRaw,) as typeof renderMediaOnCloudrunRaw;diff --git a/packages/cloudrun/src/api/render-still-on-cloudrun.ts b/packages/cloudrun/src/api/render-still-on-cloudrun.tsindex 0f346e914a..5acc620123 100644--- a/packages/cloudrun/src/api/render-still-on-cloudrun.ts+++ b/packages/cloudrun/src/api/render-still-on-cloudrun.ts@@ -5,7 +5,8 @@ import type {ToOptions,} from '@remotion/renderer';import {RenderInternals} from '@remotion/renderer';-import {BrowserSafeApis} from '@remotion/renderer/client';+import type {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import {Internals} from 'remotion';import type {CloudRunCrashResponse,@@ -204,6 +205,6 @@ const renderStillOnCloudrunRaw = async ({return renderResponse;};-export const renderStillOnCloudrun = BrowserSafeApis.wrapWithErrorHandling(+export const renderStillOnCloudrun = PureJSAPIs.wrapWithErrorHandling(renderStillOnCloudrunRaw,) as typeof renderStillOnCloudrunRaw;diff --git a/packages/lambda/src/api/deploy-function.ts b/packages/lambda/src/api/deploy-function.tsindex 1dd70a4b4e..73a989695f 100644--- a/packages/lambda/src/api/deploy-function.ts+++ b/packages/lambda/src/api/deploy-function.ts@@ -1,4 +1,4 @@-import {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import {VERSION} from 'remotion/version';import {getFunctions} from '../api/get-functions';import type {AwsRegion} from '../pricing/aws-regions';@@ -105,6 +105,6 @@ const deployFunctionRaw = async (* @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property*/-export const deployFunction = BrowserSafeApis.wrapWithErrorHandling(+export const deployFunction = PureJSAPIs.wrapWithErrorHandling(deployFunctionRaw,) as typeof deployFunctionRaw;diff --git a/packages/lambda/src/api/deploy-site.ts b/packages/lambda/src/api/deploy-site.tsindex f71bbeccdc..8ac827d996 100644--- a/packages/lambda/src/api/deploy-site.ts+++ b/packages/lambda/src/api/deploy-site.ts@@ -1,5 +1,5 @@import type {WebpackOverrideFn} from '@remotion/bundler';-import {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import fs from 'node:fs';import {lambdaDeleteFile, lambdaLs} from '../functions/helpers/io';import type {AwsRegion} from '../pricing/aws-regions';@@ -150,6 +150,6 @@ const deploySiteRaw = async ({* @param {string} params.siteName The name of the folder in which the project gets deployed to.* @param {object} params.options Further options, see documentation page for this function.*/-export const deploySite = BrowserSafeApis.wrapWithErrorHandling(+export const deploySite = PureJSAPIs.wrapWithErrorHandling(deploySiteRaw,) as typeof deploySiteRaw;diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.tsindex e3a0faab95..31cd8b7c4d 100644--- a/packages/lambda/src/api/render-media-on-lambda.ts+++ b/packages/lambda/src/api/render-media-on-lambda.ts@@ -9,7 +9,8 @@ import type {VideoImageFormat,X264Preset,} from '@remotion/renderer';-import {BrowserSafeApis} from '@remotion/renderer/client';+import type {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import type {AwsRegion} from '../pricing/aws-regions';import {callLambda} from '../shared/call-lambda';import type {OutNameInput, Privacy} from '../shared/constants';@@ -137,7 +138,7 @@ const renderMediaOnLambdaRaw = async (* @param params.webhook Configuration for webhook called upon completion or timeout of the render.* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure*/-export const renderMediaOnLambda = BrowserSafeApis.wrapWithErrorHandling(+export const renderMediaOnLambda = PureJSAPIs.wrapWithErrorHandling(renderMediaOnLambdaRaw,) as typeof renderMediaOnLambdaRaw;diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.tsindex 28863aa10e..0c1fe5a811 100644--- a/packages/lambda/src/api/render-still-on-lambda.ts+++ b/packages/lambda/src/api/render-still-on-lambda.ts@@ -4,7 +4,8 @@ import type {StillImageFormat,ToOptions,} from '@remotion/renderer';-import {BrowserSafeApis} from '@remotion/renderer/client';+import type {BrowserSafeApis} from '@remotion/renderer/client';+import {PureJSAPIs} from '@remotion/renderer/pure';import {VERSION} from 'remotion/version';import type {AwsRegion} from '../pricing/aws-regions';import {callLambda} from '../shared/call-lambda';@@ -188,6 +189,6 @@ const renderStillOnLambdaRaw = async ({* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.*/-export const renderStillOnLambda = BrowserSafeApis.wrapWithErrorHandling(+export const renderStillOnLambda = PureJSAPIs.wrapWithErrorHandling(renderStillOnLambdaRaw,) as typeof renderStillOnLambdaRaw;diff --git a/packages/renderer/pure.d.ts b/packages/renderer/pure.d.tsnew file mode 100644index 0000000000..c298a38508--- /dev/null+++ b/packages/renderer/pure.d.ts@@ -0,0 +1 @@+export * from './dist/pure';diff --git a/packages/renderer/pure.js b/packages/renderer/pure.jsnew file mode 100644index 0000000000..7c0874e11d--- /dev/null+++ b/packages/renderer/pure.js@@ -0,0 +1 @@+module.exports = require('./dist/pure');diff --git a/packages/renderer/src/client.ts b/packages/renderer/src/client.tsindex c9c7e9fbb8..881e0e0edb 100644--- a/packages/renderer/src/client.ts+++ b/packages/renderer/src/client.ts@@ -28,7 +28,6 @@ import {videoCodecOption} from './options/video-codec';import {DEFAULT_PIXEL_FORMAT, validPixelFormats} from './pixel-format';import {proResProfileOptions} from './prores-profile';import {validateOutputFilename} from './validate-output-filename';-import {wrapWithErrorHandling} from './wrap-with-error-handling';import {x264PresetOptions} from './x264-preset';export const BrowserSafeApis = {@@ -61,5 +60,4 @@ export const BrowserSafeApis = {optionsMap,codecSupportsCrf,codecSupportsVideoBitrate,- wrapWithErrorHandling,};diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.tsindex 8d7bf89347..9f13965849 100644--- a/packages/renderer/src/get-compositions.ts+++ b/packages/renderer/src/get-compositions.ts@@ -4,7 +4,6 @@ import type {BrowserLog} from './browser-log';import type {HeadlessBrowser} from './browser/Browser';import type {Page} from './browser/BrowserPage';import {DEFAULT_TIMEOUT} from './browser/TimeoutSettings';-import {BrowserSafeApis} from './client';import {handleJavascriptException} from './error-handling/handle-javascript-exception';import {findRemotionRoot} from './find-closest-package-json';import {getPageAndCleanupFn} from './get-browser-instance';@@ -19,6 +18,7 @@ import {puppeteerEvaluateWithCatch} from './puppeteer-evaluate';import {waitForReady} from './seek-to-frame';import {setPropsAndEnv} from './set-props-and-env';import {validatePuppeteerTimeout} from './validate-puppeteer-timeout';+import {wrapWithErrorHandling} from './wrap-with-error-handling';type InternalGetCompositionsOptions = {serializedInputPropsWithCustomSchema: string;@@ -230,7 +230,7 @@ const internalGetCompositionsRaw = async ({});};-export const internalGetCompositions = BrowserSafeApis.wrapWithErrorHandling(+export const internalGetCompositions = wrapWithErrorHandling(internalGetCompositionsRaw,);diff --git a/packages/renderer/src/pure.ts b/packages/renderer/src/pure.tsnew file mode 100644index 0000000000..e76a13328c--- /dev/null+++ b/packages/renderer/src/pure.ts@@ -0,0 +1,5 @@+import {wrapWithErrorHandling} from './wrap-with-error-handling';++export const PureJSAPIs = {+ wrapWithErrorHandling,+};