Skip to content

🎥 Make videos programmatically with React

document all SSR APIs

Jonny Burger5101ad81d2fe
diff --git a/packages/bundler/src/bundler.ts b/packages/bundler/src/bundler.ts
index dea04513b5..2ae390bc9c 100644
--- a/packages/bundler/src/bundler.ts
+++ b/packages/bundler/src/bundler.ts
@@ -21,7 +21,7 @@ const prepareOutDir = async (specified: string | null) => {
export const bundle = async (
entryPoint: string,
- onProgressUpdate?: (f: number) => void,
+ onProgressUpdate?: (progress: number) => void,
options?: {
webpackOverride?: WebpackOverrideFn;
outDir?: string;
diff --git a/packages/docs/docs/bundle.md b/packages/docs/docs/bundle.md
new file mode 100644
index 0000000000..f8e19e8223
--- /dev/null
+++ b/packages/docs/docs/bundle.md
@@ -0,0 +1,78 @@
+---
+id: bundle
+title: bundle()
+---
+
+_Part of the `@remotion/bundler` package._
+
+Bundles a Remotion project using Webpack and prepares it for render using [`renderFrames()`](/docs/render-frames).
+
+```ts
+const bundle: (
+ entryPoint: string,
+ onProgressUpdate?: (progress: number) => void,
+ options?: {
+ webpackOverride?: WebpackOverrideFn;
+ outDir?: string;
+ enableCaching?: boolean;
+ }
+) => Promise<string>
+```
+
+## Arguments
+
+### `entryPoint`
+
+A `string` containing an absolute path of the entry point of a Remotion project. In a default Remotion project created with the template, the entry point is located at `src/index.tsx`.
+
+### `onProgressUpdate?`
+
+A callback function that notifies about the progress of the Webpack bundling. Example function:
+
+```ts
+const onProgressUpdate = (progress: number) => {
+ console.log(`Webpack bundling progress: ${progress * 100}%`)
+}
+```
+
+### `options`
+
+An object containing the following keys:
+
+#### `webpackOverride?`
+
+_optional_
+
+A function to override the webpack config reducer-style. Takes a function which gives you the current webpack config which you can transform and return a modified version of it. For example:
+
+```ts
+const webpackOverride: WebpackOverrideFn = (webpackConfig) => {
+ return {
+ ...webpackConfig
+ // Override properties
+ }
+}
+```
+
+#### `outDir?`
+
+_optional_
+
+Specify a desired output directory. If no passed, the webpack bundle will be created in a temp dir.
+
+#### `enableCaching?`
+
+_optional_
+
+A `boolean` specifying whether Webpack caching should be enabled. Default `true`, it is recommended to leave caching enabled at all times since file changes should be recognized by Webpack nonetheless.
+
+## Return value
+
+A promise which will resolve into a `string` specifying the output directory.
+
+## See also
+
+- [Server-Side rendering](/docs/ssr)
+- [getCompositions()](/docs/get-compositions)
+- [renderFrames()](/docs/render-frames)
+- [stitchFramesToVideo()](/docs/stitch-frames-to-video)
diff --git a/packages/docs/docs/get-compositions.md b/packages/docs/docs/get-compositions.md
index d11431e388..02002deeec 100644
--- a/packages/docs/docs/get-compositions.md
+++ b/packages/docs/docs/get-compositions.md
@@ -3,6 +3,8 @@ title: getCompositions()
id: get-compositions
---
+_Part of the `@remotion/renderer` package._
+
Gets the compositions defined in a Remotion project based on a webpack bundle. Spins up a browser with Puppeteer and evaluates the Remotion root.
```ts
@@ -60,5 +62,6 @@ Returns a promise that resolves to an array of available compositions. Example v
## See also
- [Server-Side rendering](/docs/ssr)
+- [bundle()](/docs/bundle)
- [renderFrames()](/docs/render-frames)
- [stitchFramesToVideo()](/docs/stitch-frames-to-video)
diff --git a/packages/docs/docs/render-frames.md b/packages/docs/docs/render-frames.md
index a52929761b..02b1f5dab5 100644
--- a/packages/docs/docs/render-frames.md
+++ b/packages/docs/docs/render-frames.md
@@ -3,6 +3,8 @@ id: render-frames
title: renderFrames()
---
+_Part of the `@remotion/renderer` package._
+
Renders a series of images using Puppeteer and computes information for mixing audio.
```ts
@@ -122,6 +124,7 @@ A promise resolving to an object containing the following properties:
## See also
+- [bundle()](/docs/bundle)
- [Server-Side rendering](/docs/ssr)
- [getCompositions()](/docs/get-compositions)
- [stitchFramesToVideo()](/docs/stitch-frames-to-video)
diff --git a/packages/docs/docs/ssr.md b/packages/docs/docs/ssr.md
index 21d88a1447..b93dc61325 100644
--- a/packages/docs/docs/ssr.md
+++ b/packages/docs/docs/ssr.md
@@ -155,6 +155,7 @@ We are working on a library which will help you render videos using AWS Lambda.
## API reference
+- [bundle()](/docs/bundle)
- [getCompositions()](/docs/get-compositions)
- [renderFrames()](/docs/render-frames)
- [stitchFramesToVideo()](/docs/stitch-frames-to-video)
diff --git a/packages/docs/docs/stitch-frames-to-video.md b/packages/docs/docs/stitch-frames-to-video.md
index 3e615fa670..87e1e2c6c9 100644
--- a/packages/docs/docs/stitch-frames-to-video.md
+++ b/packages/docs/docs/stitch-frames-to-video.md
@@ -3,6 +3,8 @@ id: stitch-frames-to-video
title: stitchFramesToVideo()
---
+_Part of the `@remotion/renderer` package._
+
Takes a series of images and audio information generated by [`renderFrames()`](/docs/render-frames) and encodes it to a video.
```ts
@@ -118,6 +120,7 @@ A boolean value that when set to `true`, will log all kinds of debug information
## See also
+- [bundle()](/docs/bundle)
- [Server-Side rendering](/docs/ssr)
- [getCompositions()](/docs/get-compositions)
- [renderFrames()](/docs/render-frames)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index a6b28424e7..d93d5bfffc 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -59,6 +59,11 @@ module.exports = {
"easing",
],
},
+ {
+ type: "category",
+ label: "API - @remotion/bundler",
+ items: ["bundle"],
+ },
"gif",
{
type: "category",