🎥 Make videos programmatically with React
`@remotion/bundler`: Remove legacy positional signatures in v5 (#9739)
Jonny Burger4ea5a91585bd
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.tsindex ae05b32fb8..5ff5e1b3ac 100644--- a/packages/bundler/src/bundle.ts+++ b/packages/bundler/src/bundle.ts@@ -5,6 +5,7 @@ import {promisify} from 'node:util';import {isMainThread} from 'node:worker_threads';import type {GitSource, RenderDefaults} from '@remotion/studio-shared';import {getProjectName} from '@remotion/studio-shared';+import {NoReactInternals} from 'remotion/no-react';import webpack from 'webpack';import {copyDir} from './copy-dir';import {indexHtml} from './index-html';@@ -81,7 +82,7 @@ export const getBundleStaticHash = (publicPath: string): string => {);};-export type MandatoryLegacyBundleOptions = {+export type MandatoryBundleInternalsOptions = {bundlerOverride?: BundlerOverrideFn;rspackOverride?: RspackOverrideFn;webpackOverride: WebpackOverrideFn;@@ -105,7 +106,17 @@ export type MandatoryLegacyBundleOptions = {symlinkPublicDir: boolean;};-export type LegacyBundleOptions = Partial<MandatoryLegacyBundleOptions>;+type V4LegacyBundleOptions = Partial<MandatoryBundleInternalsOptions>;++export type MandatoryLegacyBundleOptions =+ typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES extends true+ ? never+ : MandatoryBundleInternalsOptions;++export type LegacyBundleOptions =+ typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES extends true+ ? never+ : V4LegacyBundleOptions;export const getConfig = ({entryPoint,@@ -118,7 +129,7 @@ export const getConfig = ({entryPoint: string;resolvedRemotionRoot: string;onProgress: (progress: number) => void;- options: MandatoryLegacyBundleOptions;+ options: MandatoryBundleInternalsOptions;}) => {const configArgs = {entry: path.join(@@ -150,7 +161,6 @@ export const getConfig = ({};type NewBundleOptions = {- entryPoint: string;onProgress: (progress: number) => void;ignoreRegisterRootWarning: boolean;onDirectoryCreated: (dir: string) => void;@@ -164,33 +174,47 @@ type NewBundleOptions = {type MandatoryBundleOptions = {entryPoint: string;} & NewBundleOptions &- MandatoryLegacyBundleOptions;+ MandatoryBundleInternalsOptions;export type BundleOptions = {entryPoint: string;} & Partial<NewBundleOptions> &- LegacyBundleOptions;+ Partial<MandatoryBundleInternalsOptions>;-type Arguments =+type V4BundleArguments =| [options: BundleOptions]| [entryPoint: string,onProgress?: (progress: number) => void,- options?: LegacyBundleOptions,+ options?: V4LegacyBundleOptions,];-const convertArgumentsIntoOptions = (args: Arguments): BundleOptions => {+type BundleArguments =+ typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES extends true+ ? [options: BundleOptions]+ : V4BundleArguments;++export const convertBundleArgumentsIntoOptions = (+ args: V4BundleArguments,+ enableV5BreakingChanges: boolean,+): BundleOptions => {if ((args.length as number) === 0) {throw new TypeError('bundle() was called without arguments');}const firstArg = args[0];if (typeof firstArg === 'string') {- return {- entryPoint: firstArg,- onProgress: args[1],- ...(args[2] ?? {}),- };+ if (!enableV5BreakingChanges) {+ return {+ entryPoint: firstArg,+ onProgress: args[1],+ ...(args[2] ?? {}),+ };+ }++ throw new TypeError(+ 'bundle() no longer supports the legacy positional arguments. Pass an options object instead: bundle({entryPoint, onProgress, ...options}).',+ );}if (typeof firstArg.entryPoint !== 'string') {@@ -446,8 +470,11 @@ export const internalBundle = async (* @description Bundles a Remotion project and prepares it for rendering.* @see [Documentation](https://remotion.dev/docs/bundle)*/-export async function bundle(...args: Arguments): Promise<string> {- const actualArgs = convertArgumentsIntoOptions(args);+export async function bundle(...args: BundleArguments): Promise<string> {+ const actualArgs = convertBundleArgumentsIntoOptions(+ args,+ NoReactInternals.ENABLE_V5_BREAKING_CHANGES,+ );const result = await internalBundle({bufferStateDelayInMilliseconds:actualArgs.bufferStateDelayInMilliseconds ?? null,diff --git a/packages/bundler/src/index.ts b/packages/bundler/src/index.tsindex b8486eb71a..9a27192577 100644--- a/packages/bundler/src/index.ts+++ b/packages/bundler/src/index.ts@@ -28,6 +28,7 @@ export {BundleOptions,LegacyBundleOptions,MandatoryLegacyBundleOptions,+ MandatoryBundleInternalsOptions,} from './bundle';export type {BundlerConfiguration,diff --git a/packages/bundler/src/test/validate-bundle.test.ts b/packages/bundler/src/test/validate-bundle.test.tsindex a08233a1ef..28455c041a 100644--- a/packages/bundler/src/test/validate-bundle.test.ts+++ b/packages/bundler/src/test/validate-bundle.test.ts@@ -1,5 +1,5 @@import {expect, test} from 'bun:test';-import {bundle} from '../bundle';+import {bundle, convertBundleArgumentsIntoOptions} from '../bundle';test('Should reject bad bundle options', () => {// @ts-expect-error@@ -10,3 +10,16 @@ test('Should reject bad bundle options', () => {/bundle\(\) was called without the `entryPoint` option/,);});++test('Should gate the legacy positional bundle() signature', () => {+ expect(convertBundleArgumentsIntoOptions(['src/index.ts'], false)).toEqual({+ entryPoint: 'src/index.ts',+ onProgress: undefined,+ });++ expect(() =>+ convertBundleArgumentsIntoOptions(['src/index.ts'], true),+ ).toThrow(+ 'bundle() no longer supports the legacy positional arguments. Pass an options object instead: bundle({entryPoint, onProgress, ...options}).',+ );+});diff --git a/packages/cli/src/setup-cache.ts b/packages/cli/src/setup-cache.tsindex acc0b97e74..9e0abacb11 100644--- a/packages/cli/src/setup-cache.ts+++ b/packages/cli/src/setup-cache.ts@@ -2,7 +2,7 @@ import {existsSync} from 'fs';import path from 'path';import type {BundlerOverrideFn,- MandatoryLegacyBundleOptions,+ MandatoryBundleInternalsOptions,RspackOverrideFn,WebpackOverrideFn,} from '@remotion/bundler';@@ -226,7 +226,7 @@ export const bundleOnCli = async ({updateProgress(false);};- const options: MandatoryLegacyBundleOptions = {+ const options: MandatoryBundleInternalsOptions = {enableCaching: shouldCache,bundlerOverride: bundlerOverride ?? ConfigInternals.getBundlerOverrideFn(),rspackOverride: rspackOverride ?? ConfigInternals.getRspackOverrideFn(),diff --git a/packages/docs/blog/2021-08-11-remotion-2-3.mdx b/packages/docs/blog/2021-08-11-remotion-2-3.mdxindex 2825b64924..2cb1a12ae6 100644--- a/packages/docs/blog/2021-08-11-remotion-2-3.mdx+++ b/packages/docs/blog/2021-08-11-remotion-2-3.mdx@@ -62,7 +62,7 @@ npx remotion still --props='{"custom": "data"}' my-comp out.pngIf you render using the Node.JS APIs, we have a new equivalent API for rendering stills as well.-```ts twoslash+```tsimport {bundle} from '@remotion/bundler';import {getCompositions, renderStill} from '@remotion/renderer';diff --git a/packages/docs/blog/2022-11-17-remotion-3-3.mdx b/packages/docs/blog/2022-11-17-remotion-3-3.mdxindex b42661a909..9d9d88a092 100644--- a/packages/docs/blog/2022-11-17-remotion-3-3.mdx+++ b/packages/docs/blog/2022-11-17-remotion-3-3.mdx@@ -207,7 +207,7 @@ Previously, the progress for rendering and encoding was reported individually. TPreviously, [`bundle()`](/docs/bundle) accepted three arguments: `entryPoint`, `onProgress` and `options`.-```ts twoslash title="Old bundle() signature"+```ts title="Old bundle() signature"import {bundle} from '@remotion/bundler';bundle('./src/index.ts', (progress) => console.log(progress), {diff --git a/packages/docs/docs/5-0-migration.mdx b/packages/docs/docs/5-0-migration.mdxindex 5eada948cd..df7a4b7682 100644--- a/packages/docs/docs/5-0-migration.mdx+++ b/packages/docs/docs/5-0-migration.mdx@@ -55,6 +55,21 @@ A common footgun was the render was not working as intended because the input pr**Required action**: Pass an empty object `{}` if you don't have any input props.+## `bundle()` and `getCompositions()` now take an options object++The legacy positional signatures of [`bundle()`](/docs/bundle) and [`getCompositions()`](/docs/renderer/get-compositions) have been removed.+The return value of `bundle()` remains the output directory as a string.++**Required action**: Move positional arguments into an options object:++```diff title="Before and after"+- bundle(entryPoint, onProgress, options)++ bundle({entryPoint, onProgress, ...options})++- getCompositions(serveUrl, options)++ getCompositions({serveUrl, ...options})+```+## `visualizeAudio()` yields different result[`optimizeFor: "speed"`](/docs/visualize-audio#optimizefor) is now the default. This will yield slightly different results.diff --git a/packages/docs/docs/audio/exporting.mdx b/packages/docs/docs/audio/exporting.mdxindex 809f1b8e10..dd079136c5 100644--- a/packages/docs/docs/audio/exporting.mdx+++ b/packages/docs/docs/audio/exporting.mdx@@ -40,7 +40,9 @@ const compositionId = 'HelloWorld';// You only have to do this once, you can reuse the bundle.const entry = './src/index';console.log('Creating a Webpack bundle of the video');-const bundleLocation = await bundle(path.resolve(entry), () => undefined, {+const bundleLocation = await bundle({+ entryPoint: path.resolve(entry),+ onProgress: () => undefined,// If you have a Webpack override, make sure to add it herewebpackOverride: (config) => config,});@@ -52,7 +54,8 @@ const inputProps = {// Extract all the compositions you have defined in your project// from the webpack bundle.-const comps = await getCompositions(bundleLocation, {+const comps = await getCompositions({+ serveUrl: bundleLocation,// You can pass custom input props that you can retrieve using getInputProps()// in the composition list. Use this if you want to dynamically set the duration or// dimensions of the video.@@ -149,7 +152,9 @@ const compositionId = 'HelloWorld';// You only have to do this once, you can reuse the bundle.const entry = './src/index';console.log('Creating a Webpack bundle of the video');-const bundleLocation = await bundle(path.resolve(entry), () => undefined, {+const bundleLocation = await bundle({+ entryPoint: path.resolve(entry),+ onProgress: () => undefined,// If you have a Webpack override, make sure to add it herewebpackOverride: (config) => config,});@@ -161,7 +166,8 @@ const inputProps = {// Extract all the compositions you have defined in your project// from the webpack bundle.-const comps = await getCompositions(bundleLocation, {+const comps = await getCompositions({+ serveUrl: bundleLocation,// You can pass custom input props that you can retrieve using getInputProps()// in the composition list. Use this if you want to dynamically set the duration or// dimensions of the video.diff --git a/packages/docs/docs/bundle.mdx b/packages/docs/docs/bundle.mdxindex 83f9f10a6d..49ed928f66 100644--- a/packages/docs/docs/bundle.mdx+++ b/packages/docs/docs/bundle.mdx@@ -169,7 +169,7 @@ await bundle('src/index.ts', () => console.log(progress * 100 + '% done'), {});```-It is still supported in Remotion v3, but we encourage to migrate to the new function signature.+It is supported through Remotion v4 and removed in Remotion 5.0. Migrate to the options object signature before upgrading.## Return valuediff --git a/packages/docs/docs/layout-utils/best-practices.mdx b/packages/docs/docs/layout-utils/best-practices.mdxindex 862fbcf8b1..7d30ca505f 100644--- a/packages/docs/docs/layout-utils/best-practices.mdx+++ b/packages/docs/docs/layout-utils/best-practices.mdx@@ -206,7 +206,7 @@ Pass `validateFontIsLoaded: true` to any of [`measureText()`](/docs/layout-utilsThis will take a second measurement with the fallback font and if it produces the same measurements, it assumes the fallback font was used and will throw an error.:::note-In Remotion v5, this will become the default.+In Remotion 5.0, this will become the default.:::## Match all font propertiesdiff --git a/packages/docs/docs/player/player-integration.mdx b/packages/docs/docs/player/player-integration.mdxindex 339d43aeef..f2871c0e43 100644--- a/packages/docs/docs/player/player-integration.mdx+++ b/packages/docs/docs/player/player-integration.mdx@@ -197,7 +197,9 @@ In any Node.JS context, you can call [`bundle()`](/docs/bundle) to bundle your vimport path from 'path';import {bundle} from '@remotion/bundler';-const bundled = await bundle(path.join(process.cwd(), 'src', 'remotion', 'index.ts'));+const bundled = await bundle({+ entryPoint: path.join(process.cwd(), 'src', 'remotion', 'index.ts'),+});```See [Server-side rendering](/docs/ssr) for a full example.diff --git a/packages/docs/docs/render-all.mdx b/packages/docs/docs/render-all.mdxindex 6e75b3a159..dbc8846a5f 100644--- a/packages/docs/docs/render-all.mdx+++ b/packages/docs/docs/render-all.mdx@@ -49,7 +49,10 @@ const bundled = await bundle({webpackOverride: (config) => config,});-const compositions = await getCompositions(bundled);+const compositions = await getCompositions({+ serveUrl: bundled,+ inputProps: {},+});for (const composition of compositions) {console.log(`Rendering ${composition.id}...`);diff --git a/packages/docs/docs/renderer/get-compositions.mdx b/packages/docs/docs/renderer/get-compositions.mdxindex 679b3d8415..abb0e27e25 100644--- a/packages/docs/docs/renderer/get-compositions.mdx+++ b/packages/docs/docs/renderer/get-compositions.mdx@@ -11,7 +11,7 @@ Gets a list of compositions defined in a Remotion project based on a [Remotion BFor every compositions their [`calculateMetadata()`](/docs/composition#calculatemetadata) function is evaluated. If you just want to evaluate one composition that you want to render, use [`selectComposition()`](/docs/renderer/select-composition).-The new signature, from [v4.0.497](https://github.com/remotion-dev/remotion/releases/v4.0.497) is:+The options object signature is available from [v4.0.497](https://github.com/remotion-dev/remotion/releases/v4.0.497) and is the only signature in Remotion 5.0:```ts twoslash title="Example"import {bundle} from '@remotion/bundler';@@ -25,7 +25,7 @@ const compositions = await getCompositions({});```-Use [the old signature](#legacy-function-signature) for versions below 4.0.496. It remains supported.+Use [the positional signature](#legacy-function-signature) for versions below v4.0.497. It remains supported through Remotion v4.## Arguments@@ -160,9 +160,9 @@ An absolute path overriding the `ffprobe` executable to use.## Legacy function signature-The positional function signature is also supported for backwards compatibility:+The positional function signature is supported through Remotion v4 and removed in Remotion 5.0:-```ts twoslash title="Legacy signature"+```ts title="Legacy signature"import {getCompositions} from '@remotion/renderer';const compositions = await getCompositions('https://example.com', {@@ -170,6 +170,8 @@ const compositions = await getCompositions('https://example.com', {});```+Migrate to the options object signature before upgrading to Remotion 5.0.+## Return valueReturns a promise that resolves to an array of available compositions. Example value:diff --git a/packages/docs/docs/renderer/render-still.mdx b/packages/docs/docs/renderer/render-still.mdxindex 40183fa2f8..5986b83170 100644--- a/packages/docs/docs/renderer/render-still.mdx+++ b/packages/docs/docs/renderer/render-still.mdx@@ -29,7 +29,8 @@ const serveUrl = await bundle({entryPoint: require.resolve('./src/index.ts'),});-const comps = await getCompositions(serveUrl, {+const comps = await getCompositions({+ serveUrl,inputProps: {custom: 'data',},diff --git a/packages/docs/render-cards.ts b/packages/docs/render-cards.tsindex 2755a3026f..83e2ead798 100644--- a/packages/docs/render-cards.ts+++ b/packages/docs/render-cards.ts@@ -1,9 +1,9 @@-import {bundle} from '@remotion/bundler';-import {getCompositions, renderStill} from '@remotion/renderer';import {execSync} from 'child_process';import fs from 'fs';import os from 'os';import path from 'path';+import {bundle} from '@remotion/bundler';+import {getCompositions, renderStill} from '@remotion/renderer';import {readDir} from './get-pages.mjs';const data: {@@ -176,7 +176,10 @@ const serveUrl = await bundle({entryPoint: path.join(process.cwd(), './src/remotion/entry.ts'),publicDir: path.join(process.cwd(), 'static'),});-const compositions = await getCompositions(serveUrl);+const compositions = await getCompositions({+ serveUrl,+ inputProps: {},+});for (const composition of compositions.filter((c) => c.id.startsWith('expert') || c.id.startsWith('template'),diff --git a/packages/docs/render-element-previews.ts b/packages/docs/render-element-previews.tsindex bc5941a1a5..b6a663a74e 100644--- a/packages/docs/render-element-previews.ts+++ b/packages/docs/render-element-previews.ts@@ -89,7 +89,10 @@ const serveUrl = await bundle({entryPoint: path.join(process.cwd(), 'src', 'remotion', 'entry.ts'),publicDir: path.join(process.cwd(), 'static'),});-const compositions = await getCompositions(serveUrl);+const compositions = await getCompositions({+ serveUrl,+ inputProps: {},+});const elementCompositions = compositions.filter((composition) =>composition.id.startsWith('element-'),);diff --git a/packages/example/render-all.ts b/packages/example/render-all.tsindex 2a6f97c401..b2e346dbbf 100644--- a/packages/example/render-all.ts+++ b/packages/example/render-all.ts@@ -8,7 +8,10 @@ const start = async () => {webpackOverride,});- const compositions = await getCompositions(bundled);+ const compositions = await getCompositions({+ serveUrl: bundled,+ inputProps: {},+ });for (const composition of compositions) {console.log(`Rendering ${composition.id}...`);diff --git a/packages/it-tests/src/ssr/render-frames.test.ts b/packages/it-tests/src/ssr/render-frames.test.tsindex bc9ce7fef4..1ca49fc694 100644--- a/packages/it-tests/src/ssr/render-frames.test.ts+++ b/packages/it-tests/src/ssr/render-frames.test.ts@@ -16,7 +16,8 @@ test('Legacy SSR way of rendering videos should still work',async () => {const puppeteerInstance = await openBrowser('chrome');- const compositions = await getCompositions(exampleBuild, {+ const compositions = await getCompositions({+ serveUrl: exampleBuild,puppeteerInstance,inputProps: {},});diff --git a/packages/it-tests/src/ssr/render-media-sample-rate.test.ts b/packages/it-tests/src/ssr/render-media-sample-rate.test.tsindex 08a1539aaf..702a6c131c 100644--- a/packages/it-tests/src/ssr/render-media-sample-rate.test.ts+++ b/packages/it-tests/src/ssr/render-media-sample-rate.test.ts@@ -42,7 +42,10 @@ const getSampleRateFromFile = async (filePath: string): Promise<number> => {test('Render video with sampleRate 44100 should produce 44100 Hz audio',async () => {- const compositions = await getCompositions(exampleBuild);+ const compositions = await getCompositions({+ serveUrl: exampleBuild,+ inputProps: {},+ });const comp = compositions.find((c) => c.id === 'audio-testing');if (!comp) {@@ -71,7 +74,10 @@ test(test('Render video with default sampleRate should produce 48000 Hz audio',async () => {- const compositions = await getCompositions(exampleBuild);+ const compositions = await getCompositions({+ serveUrl: exampleBuild,+ inputProps: {},+ });const comp = compositions.find((c) => c.id === 'audio-testing');if (!comp) {diff --git a/packages/it-tests/src/ssr/render-media.test.ts b/packages/it-tests/src/ssr/render-media.test.tsindex 12ce7d323e..1d9c87321f 100644--- a/packages/it-tests/src/ssr/render-media.test.ts+++ b/packages/it-tests/src/ssr/render-media.test.ts@@ -10,7 +10,8 @@ test('Render video with browser instance open',async () => {const puppeteerInstance = await openBrowser('chrome');- const compositions = await getCompositions(exampleBuild, {+ const compositions = await getCompositions({+ serveUrl: exampleBuild,puppeteerInstance,inputProps: {},});@@ -42,7 +43,10 @@ test();test('Render video with browser instance not open', async () => {- const compositions = await getCompositions(exampleBuild);+ const compositions = await getCompositions({+ serveUrl: exampleBuild,+ inputProps: {},+ });const reactSvg = compositions.find((c) => c.id === 'react-svg');@@ -109,7 +113,10 @@ test('should fail on invalid CRF', async () => {});test('Render video to a buffer', async () => {- const compositions = await getCompositions(exampleBuild);+ const compositions = await getCompositions({+ serveUrl: exampleBuild,+ inputProps: {},+ });const reactSvg = compositions.find((c) => c.id === 'react-svg');diff --git a/packages/it-tests/src/ssr/render-still.test.ts b/packages/it-tests/src/ssr/render-still.test.tsindex 161596ab33..345abf1b53 100644--- a/packages/it-tests/src/ssr/render-still.test.ts+++ b/packages/it-tests/src/ssr/render-still.test.ts@@ -46,7 +46,10 @@ test('Render video with browser instance open', async () => {test('Render still with browser instance not open and legacy webpack config',async () => {- const compositions = await getCompositions(exampleBuild);+ const compositions = await getCompositions({+ serveUrl: exampleBuild,+ inputProps: {},+ });const reactSvg = compositions.find((c) => c.id === 'react-svg');diff --git a/packages/lambda/src/test/mocks/mock-bundle-site.ts b/packages/lambda/src/test/mocks/mock-bundle-site.tsindex ef5e113729..0104744649 100644--- a/packages/lambda/src/test/mocks/mock-bundle-site.ts+++ b/packages/lambda/src/test/mocks/mock-bundle-site.ts@@ -1,30 +1,22 @@import type {bundle, BundleOptions} from '@remotion/bundler';-const convertArgumentsIntoOptions = (- args: Parameters<typeof bundle>,-): BundleOptions => {- if ((args.length as number) === 0) {+const validateOptions = (options: BundleOptions): BundleOptions => {+ if (!options) {throw new TypeError('bundle() was called without arguments');}- const firstArg = args[0];- if (typeof firstArg === 'string') {- return {- entryPoint: firstArg,- onProgress: args[1],- ...(args[2] ?? {}),- };- }-- if (typeof firstArg.entryPoint !== 'string') {+ if (typeof options.entryPoint !== 'string') {throw new TypeError('bundle() was called without the `entryPoint` option');}- return firstArg;+ return options;};export const mockBundleSite: typeof bundle = (...args) => {- const {entryPoint} = convertArgumentsIntoOptions(args);+ const firstArg = args[0] as BundleOptions | string;+ const options =+ typeof firstArg === 'string' ? {entryPoint: firstArg} : firstArg;+ const {entryPoint} = validateOptions(options);if (entryPoint === 'first') {return Promise.resolve('/path/to/bundle-1');}diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.tsindex 8cfa3dbab2..e826454b87 100644--- a/packages/renderer/src/get-compositions.ts+++ b/packages/renderer/src/get-compositions.ts@@ -38,7 +38,7 @@ type InternalGetCompositionsOptions = {onLog: OnLog;} & ToOptions<typeof optionsMap.getCompositions>;-export type LegacyGetCompositionsOptions = RequiredInputPropsInV5 & {+type SharedGetCompositionsOptions = {envVariables?: Record<string, string>;puppeteerInstance?: HeadlessBrowser;onBrowserLog?: (log: BrowserLog) => void;@@ -47,16 +47,32 @@ export type LegacyGetCompositionsOptions = RequiredInputPropsInV5 & {port?: number | null;} & Partial<ToOptions<typeof optionsMap.getCompositions>>;-export type GetCompositionsOptions = LegacyGetCompositionsOptions & {- serveUrl: string;-};+type V4LegacyGetCompositionsOptions = {+ inputProps?: Record<string, unknown>;+} & SharedGetCompositionsOptions;-type GetCompositionsArguments =+export type LegacyGetCompositionsOptions =+ typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES extends true+ ? never+ : V4LegacyGetCompositionsOptions;++export type GetCompositionsOptions = RequiredInputPropsInV5 &+ SharedGetCompositionsOptions & {+ serveUrl: string;+ };++type V4GetCompositionsArguments =| [options: GetCompositionsOptions]- | [serveUrlOrWebpackUrl: string, config?: LegacyGetCompositionsOptions];+ | [serveUrlOrWebpackUrl: string, config?: V4LegacyGetCompositionsOptions];-const convertGetCompositionsArgumentsToOptions = (- args: GetCompositionsArguments,+type GetCompositionsArguments =+ typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES extends true+ ? [options: GetCompositionsOptions]+ : V4GetCompositionsArguments;++export const convertGetCompositionsArgumentsToOptions = (+ args: V4GetCompositionsArguments,+ enableV5BreakingChanges: boolean,): GetCompositionsOptions => {if ((args.length as number) === 0) {throw new Error(@@ -66,10 +82,16 @@ const convertGetCompositionsArgumentsToOptions = (const firstArg = args[0];if (typeof firstArg === 'string') {+ if (enableV5BreakingChanges) {+ throw new TypeError(+ 'getCompositions() no longer supports the legacy positional arguments. Pass an options object instead: getCompositions({serveUrl, ...options}).',+ );+ }+return {...(args[1] ?? {}),serveUrl: firstArg,- };+ } as GetCompositionsOptions;}return firstArg;@@ -311,7 +333,11 @@ export const internalGetCompositions = wrapWithErrorHandling(export const getCompositions = (...args: GetCompositionsArguments): Promise<VideoConfig[]> => {- const options = convertGetCompositionsArgumentsToOptions(args);+ const options = convertGetCompositionsArgumentsToOptions(+ args,+ NoReactInternals.ENABLE_V5_BREAKING_CHANGES,+ );+if (typeof options?.serveUrl !== 'string' || !options.serveUrl) {throw new Error('No serve URL or webpack bundle directory was passed to getCompositions().',diff --git a/packages/renderer/src/test/get-compositions.test.ts b/packages/renderer/src/test/get-compositions.test.tsnew file mode 100644index 0000000000..30d5255beb--- /dev/null+++ b/packages/renderer/src/test/get-compositions.test.ts@@ -0,0 +1,20 @@+import {expect, test} from 'bun:test';+import {convertGetCompositionsArgumentsToOptions} from '../get-compositions';++test('Should gate the legacy positional getCompositions() signature', () => {+ expect(+ convertGetCompositionsArgumentsToOptions(+ ['https://example.com', {inputProps: {title: 'Hello'}}],+ false,+ ),+ ).toEqual({+ serveUrl: 'https://example.com',+ inputProps: {title: 'Hello'},+ });++ expect(() =>+ convertGetCompositionsArgumentsToOptions(['https://example.com'], true),+ ).toThrow(+ 'getCompositions() no longer supports the legacy positional arguments. Pass an options object instead: getCompositions({serveUrl, ...options}).',+ );+});diff --git a/packages/template-skia/README.md b/packages/template-skia/README.mdindex bc7aa3f1c1..68d832f130 100644--- a/packages/template-skia/README.md+++ b/packages/template-skia/README.md@@ -42,7 +42,9 @@ npx remotion upgradeThis template uses a [custom Webpack override](https://www.remotion.dev/docs/bundlers). If you are using server-side rendering, you need to import `enableSkia` from `@remotion/skia/enable` and pass it to [`bundle()`](https://www.remotion.dev/docs/bundle) (if using SSR) and [`deploySite()`](https://www.remotion.dev/docs/lambda/deploysite) (if using Lambda):```ts-bundle(entry, () => undefined, {+bundle({+ entryPoint: entry,+ onProgress: () => undefined,webpackOverride: (config) => enableSkia(config),});// ordiff --git a/packages/template-still/src/server/index.ts b/packages/template-still/src/server/index.tsindex 821b19883a..afa6a93c31 100644--- a/packages/template-still/src/server/index.ts+++ b/packages/template-still/src/server/index.ts@@ -22,7 +22,9 @@ dotenv.config({ quiet: true });const app = express();const port = process.env.PORT || 8000;-const webpackBundling = bundle(path.join(process.cwd(), "src/index.ts"));+const webpackBundling = bundle({+ entryPoint: path.join(process.cwd(), "src/index.ts"),+});const tmpDir = fs.promises.mkdtemp(path.join(os.tmpdir(), "remotion-"));enum Params {