Skip to content

🎥 Make videos programmatically with React

file structure

Jonny Burgera3a4f8053d3d
diff --git a/packages/bundler/src/bundler.ts b/packages/bundler/src/bundler.ts
index 2c327175ce..fa047259dc 100644
--- a/packages/bundler/src/bundler.ts
+++ b/packages/bundler/src/bundler.ts
@@ -39,8 +39,7 @@ export const bundle = async (
webpackOverride:
options?.webpackOverride ?? Internals.getWebpackOverrideFn(),
onProgressUpdate,
- enableCaching:
- options?.enableCaching ?? Internals.DEFAULT_WEBPACK_CACHE_ENABLED,
+ enableCaching: options?.enableCaching ?? Internals.getWebpackCaching(),
publicPath: options?.publicPath ?? '/',
maxTimelineTracks: 15,
}),
diff --git a/packages/lambda/src/bundle-lambda.ts b/packages/lambda/src/api/bundle-lambda.ts
similarity index 100%
rename from packages/lambda/src/bundle-lambda.ts
rename to packages/lambda/src/api/bundle-lambda.ts
diff --git a/packages/lambda/src/bundle-remotion.ts b/packages/lambda/src/api/bundle-remotion.ts
similarity index 73%
rename from packages/lambda/src/bundle-remotion.ts
rename to packages/lambda/src/api/bundle-remotion.ts
index 11e039f076..1ebee17561 100644
--- a/packages/lambda/src/bundle-remotion.ts
+++ b/packages/lambda/src/api/bundle-remotion.ts
@@ -1,8 +1,8 @@
import {bundle} from '@remotion/bundler';
-import {Internals} from 'remotion';
export const BINARY_NAME = 'remotion-lambda';
+// TODO: Necessary? No
export const bundleRemotion = ({
entryFile,
onProgress,
@@ -13,8 +13,6 @@ export const bundleRemotion = ({
publicPath: string;
}) => {
return bundle(entryFile, onProgress, {
- enableCaching: false,
- webpackOverride: Internals.getWebpackOverrideFn(),
publicPath,
});
};
diff --git a/packages/lambda/src/cli/cleanup.ts b/packages/lambda/src/cli/cleanup.ts
index 0b7bf7ac9f..87d13130cc 100644
--- a/packages/lambda/src/cli/cleanup.ts
+++ b/packages/lambda/src/cli/cleanup.ts
@@ -1,7 +1,7 @@
import {LambdaClient} from '@aws-sdk/client-lambda';
import {S3Client} from '@aws-sdk/client-s3';
import {CliInternals} from '@remotion/cli';
-import {BINARY_NAME} from '../bundle-remotion';
+import {BINARY_NAME} from '../api/bundle-remotion';
import {cleanupLambdas, getRemotionLambdas} from '../cleanup/cleanup-lambdas';
import {cleanUpBuckets, getRemotionS3Buckets} from '../cleanup/s3-buckets';
import {REGION} from '../constants';
diff --git a/packages/lambda/src/cli/help.ts b/packages/lambda/src/cli/help.ts
index d036c22a1c..88f5c2ca54 100644
--- a/packages/lambda/src/cli/help.ts
+++ b/packages/lambda/src/cli/help.ts
@@ -1,5 +1,5 @@
import chalk from 'chalk';
-import {BINARY_NAME} from '../bundle-remotion';
+import {BINARY_NAME} from '../api/bundle-remotion';
import {CLEANUP_COMMAND} from './cleanup';
import {Log} from './log';
import {RENDER_COMMAND} from './render';
diff --git a/packages/lambda/src/cli/policies.ts b/packages/lambda/src/cli/policies.ts
index 04e14aaf72..a745b2279c 100644
--- a/packages/lambda/src/cli/policies.ts
+++ b/packages/lambda/src/cli/policies.ts
@@ -1,5 +1,5 @@
import {CliInternals} from '@remotion/cli';
-import {BINARY_NAME} from '../bundle-remotion';
+import {BINARY_NAME} from '../api/bundle-remotion';
import {simulatePermissions} from '../iam-validation/simulate';
import {
suggestedPolicy,
diff --git a/packages/lambda/src/cli/render.ts b/packages/lambda/src/cli/render.ts
index d05e38ba65..185cd42e55 100644
--- a/packages/lambda/src/cli/render.ts
+++ b/packages/lambda/src/cli/render.ts
@@ -1,6 +1,6 @@
import {ListFunctionsCommand} from '@aws-sdk/client-lambda';
import {CliInternals} from '@remotion/cli';
-import {BINARY_NAME} from '../bundle-remotion';
+import {BINARY_NAME} from '../api/bundle-remotion';
import {callLambda} from '../call-lambda';
import {checkLambdaStatus} from '../check-lambda-status';
import {LambdaRoutines, RENDER_FN_PREFIX} from '../constants';
diff --git a/packages/lambda/src/cli/upload.ts b/packages/lambda/src/cli/upload.ts
index a59b934ca8..19e4c8966b 100644
--- a/packages/lambda/src/cli/upload.ts
+++ b/packages/lambda/src/cli/upload.ts
@@ -1,7 +1,7 @@
import {CliInternals} from '@remotion/cli';
import {existsSync, lstatSync} from 'fs';
import path from 'path';
-import {BINARY_NAME} from '../bundle-remotion';
+import {BINARY_NAME} from '../api/bundle-remotion';
import {deploySite} from '../deploy-site';
import {getOrMakeBucket} from '../get-or-make-bucket';
import {
diff --git a/packages/lambda/src/concat-videos.ts b/packages/lambda/src/concat-videos.ts
index cdcf701f50..68936ab602 100644
--- a/packages/lambda/src/concat-videos.ts
+++ b/packages/lambda/src/concat-videos.ts
@@ -9,8 +9,8 @@ import {
} from 'fs';
import path, {join} from 'path';
import {chunkKey, EFS_MOUNT_PATH, ENABLE_EFS} from './constants';
+import {timer} from './functions/helpers/timer';
import {lambdaLs, lambdaReadFile} from './io';
-import {timer} from './timer';
import {tmpDir} from './tmpdir';
export const getChunkDownloadOutputLocation = ({
diff --git a/packages/lambda/src/create-lambda.ts b/packages/lambda/src/create-lambda.ts
index c839ba317f..ce7b4d41b7 100644
--- a/packages/lambda/src/create-lambda.ts
+++ b/packages/lambda/src/create-lambda.ts
@@ -1,7 +1,7 @@
import {GetUserCommand} from '@aws-sdk/client-iam';
import {CreateFunctionCommand, LambdaClient} from '@aws-sdk/client-lambda';
import {readFileSync} from 'fs';
-import {bundleLambda} from './bundle-lambda';
+import {bundleLambda} from './api/bundle-lambda';
import {
EFS_MOUNT_PATH,
ENABLE_EFS,
diff --git a/packages/lambda/src/deploy-site.ts b/packages/lambda/src/deploy-site.ts
index f4d41dc953..6f241b947b 100644
--- a/packages/lambda/src/deploy-site.ts
+++ b/packages/lambda/src/deploy-site.ts
@@ -1,5 +1,5 @@
import {PutBucketWebsiteCommand} from '@aws-sdk/client-s3';
-import {bundleRemotion} from './bundle-remotion';
+import {bundleRemotion} from './api/bundle-remotion';
import {getSitesKey} from './constants';
import {randomHash} from './helpers/random-hash';
import {makeS3Url} from './make-s3-url';
diff --git a/packages/lambda/src/functions/fire.ts b/packages/lambda/src/functions/fire.ts
index 1e9efc7823..add7fa24c7 100644
--- a/packages/lambda/src/functions/fire.ts
+++ b/packages/lambda/src/functions/fire.ts
@@ -1,7 +1,7 @@
import {InvokeCommand} from '@aws-sdk/client-lambda';
import {LambdaPayload, LambdaRoutines} from '../constants';
import {lambdaClient} from '../shared/aws-clients';
-import {timer} from '../timer';
+import {timer} from './helpers/timer';
export const fireHandler = async (params: LambdaPayload) => {
if (params.type !== LambdaRoutines.fire) {
diff --git a/packages/lambda/src/timer.ts b/packages/lambda/src/functions/helpers/timer.ts
similarity index 100%
rename from packages/lambda/src/timer.ts
rename to packages/lambda/src/functions/helpers/timer.ts
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index c4b161e97f..936d0a5219 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -27,8 +27,8 @@ import {chunk} from '../helpers/chunk';
import {lambdaWriteFile} from '../io';
import {getSiteId} from '../make-s3-url';
import {lambdaClient} from '../shared/aws-clients';
-import {timer} from '../timer';
import {validateComposition} from '../validate-composition';
+import {timer} from './helpers/timer';
const innerLaunchHandler = async (params: LambdaPayload) => {
if (params.type !== LambdaRoutines.launch) {
diff --git a/packages/lambda/src/functions/renderer.ts b/packages/lambda/src/functions/renderer.ts
index 63a06a5b15..90676e2ec1 100644
--- a/packages/lambda/src/functions/renderer.ts
+++ b/packages/lambda/src/functions/renderer.ts
@@ -18,8 +18,8 @@ import {getBrowserInstance} from '../get-browser-instance';
import {randomHash} from '../helpers/random-hash';
import {lambdaWriteFile} from '../io';
import {lambdaClient} from '../shared/aws-clients';
-import {timer} from '../timer';
import {tmpDir} from '../tmpdir';
+import {timer} from './helpers/timer';
const renderHandler = async (params: LambdaPayload) => {
if (params.type !== LambdaRoutines.renderer) {