Skip to content

🎥 Make videos programmatically with React

version

Jonny Burger75e69f725a66
diff --git a/packages/bundler/src/renderEntry.tsx b/packages/bundler/src/renderEntry.tsx
index fe803ded9d..1de0a610cd 100644
--- a/packages/bundler/src/renderEntry.tsx
+++ b/packages/bundler/src/renderEntry.tsx
@@ -7,6 +7,7 @@ import type {render, unmountComponentAtNode} from 'react-dom';
import ReactDOM from 'react-dom/client';
import type {BundleState, TCompMetadata, TComposition} from 'remotion';
import {continueRender, delayRender, Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {getBundleMode, setBundleMode} from './bundle-mode';
import {Homepage} from './homepage/homepage';
@@ -223,6 +224,6 @@ if (typeof window !== 'undefined') {
};
window.siteVersion = '4';
- window.remotion_version = Internals.VERSION;
+ window.remotion_version = VERSION;
window.setBundleMode = setBundleModeAndUpdate;
}
diff --git a/packages/core/version.d.ts b/packages/core/version.d.ts
new file mode 100644
index 0000000000..3c9f4a2af7
--- /dev/null
+++ b/packages/core/version.d.ts
@@ -0,0 +1 @@
+export * from './dist/version';
diff --git a/packages/core/version.js b/packages/core/version.js
new file mode 100644
index 0000000000..dfe2c07e05
--- /dev/null
+++ b/packages/core/version.js
@@ -0,0 +1 @@
+module.exports = require('./dist/version');
diff --git a/packages/lambda/src/admin/make-layer-public.ts b/packages/lambda/src/admin/make-layer-public.ts
index 97af836023..23e954c9bd 100644
--- a/packages/lambda/src/admin/make-layer-public.ts
+++ b/packages/lambda/src/admin/make-layer-public.ts
@@ -3,7 +3,7 @@ import {
PublishLayerVersionCommand,
} from '@aws-sdk/client-lambda';
import {lambda} from 'aws-policies';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {getRegions} from '..';
import {quit} from '../cli/helpers/quit';
import {getLambdaClient} from '../shared/aws-clients';
@@ -61,7 +61,7 @@ const makeLayerPublic = async () => {
? 'Compiled from FFMPEG source. Read FFMPEG license: https://ffmpeg.org/legal.html'
: 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
CompatibleRuntimes: runtimes,
- Description: Internals.VERSION,
+ Description: VERSION,
})
);
await getLambdaClient(region).send(
diff --git a/packages/lambda/src/api/__mocks__/create-function.ts b/packages/lambda/src/api/__mocks__/create-function.ts
index b52889083c..bede945f93 100644
--- a/packages/lambda/src/api/__mocks__/create-function.ts
+++ b/packages/lambda/src/api/__mocks__/create-function.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {
DEFAULT_EPHEMERAL_STORAGE_IN_MB,
DEFAULT_MEMORY_SIZE,
@@ -13,7 +13,7 @@ export const createFunction: typeof original = (input) => {
functionName: input.functionName,
memorySizeInMb: DEFAULT_MEMORY_SIZE,
timeoutInSeconds: input.timeoutInSeconds,
- version: Internals.VERSION,
+ version: VERSION,
diskSizeInMb: DEFAULT_EPHEMERAL_STORAGE_IN_MB,
},
input.region
diff --git a/packages/lambda/src/api/__mocks__/get-functions.ts b/packages/lambda/src/api/__mocks__/get-functions.ts
index 2bf721b12d..5a3ec9c36f 100644
--- a/packages/lambda/src/api/__mocks__/get-functions.ts
+++ b/packages/lambda/src/api/__mocks__/get-functions.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import type {getFunctions as original} from '../get-functions';
import {getAllMockFunctions} from '../mock-functions';
@@ -6,5 +6,5 @@ export const getFunctions: typeof original = async ({
region,
compatibleOnly,
}) => {
- return getAllMockFunctions(region, compatibleOnly ? Internals.VERSION : null);
+ return getAllMockFunctions(region, compatibleOnly ? VERSION : null);
};
diff --git a/packages/lambda/src/api/deploy-function.ts b/packages/lambda/src/api/deploy-function.ts
index ad17684c35..a9fcbbb6ee 100644
--- a/packages/lambda/src/api/deploy-function.ts
+++ b/packages/lambda/src/api/deploy-function.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {getFunctions} from '../api/get-functions';
import type {AwsRegion} from '../pricing/aws-regions';
import {
@@ -60,7 +60,7 @@ export const deployFunction = async (
validateCustomRoleArn(options.customRoleArn);
const fnNameRender = [
- `${RENDER_FN_PREFIX}${Internals.VERSION.replace(/\./g, '-')}`,
+ `${RENDER_FN_PREFIX}${VERSION.replace(/\./g, '-')}`,
`mem${options.memorySizeInMb}mb`,
`disk${diskSizeInMb}mb`,
`${options.timeoutInSeconds}sec`,
@@ -74,7 +74,7 @@ export const deployFunction = async (
const alreadyDeployed = fns.find(
(f) =>
- f.version === Internals.VERSION &&
+ f.version === VERSION &&
f.memorySizeInMb === options.memorySizeInMb &&
f.timeoutInSeconds === options.timeoutInSeconds &&
f.diskSizeInMb === diskSizeInMb
diff --git a/packages/lambda/src/api/get-functions.ts b/packages/lambda/src/api/get-functions.ts
index 95c40569b6..c4dec3e4d1 100644
--- a/packages/lambda/src/api/get-functions.ts
+++ b/packages/lambda/src/api/get-functions.ts
@@ -1,6 +1,6 @@
import type {FunctionConfiguration} from '@aws-sdk/client-lambda';
import {ListFunctionsCommand} from '@aws-sdk/client-lambda';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import type {AwsRegion} from '../pricing/aws-regions';
import {getLambdaClient} from '../shared/aws-clients';
import {
@@ -104,6 +104,6 @@ export const getFunctions = async (
return true;
}
- return l.version === Internals.VERSION;
+ return l.version === VERSION;
});
};
diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.ts
index fe902670b1..62bd498a77 100644
--- a/packages/lambda/src/api/render-media-on-lambda.ts
+++ b/packages/lambda/src/api/render-media-on-lambda.ts
@@ -6,7 +6,7 @@ import type {
PixelFormat,
ProResProfile,
} from '@remotion/renderer';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import type {AwsRegion} from '../pricing/aws-regions';
import {callLambda} from '../shared/call-lambda';
import type {OutNameInput, Privacy} from '../shared/constants';
@@ -134,7 +134,7 @@ export const renderMediaOnLambda = async ({
concurrencyPerLambda: concurrencyPerLambda ?? 1,
downloadBehavior: downloadBehavior ?? {type: 'play-in-browser'},
muted: muted ?? false,
- version: Internals.VERSION,
+ version: VERSION,
},
region,
});
diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.ts
index 5eed216c25..6e86316834 100644
--- a/packages/lambda/src/api/render-still-on-lambda.ts
+++ b/packages/lambda/src/api/render-still-on-lambda.ts
@@ -3,7 +3,7 @@ import type {
LogLevel,
StillImageFormat,
} from '@remotion/renderer';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import type {AwsRegion} from '../pricing/aws-regions';
import {callLambda} from '../shared/call-lambda';
import type {CostsInfo, OutNameInput, Privacy} from '../shared/constants';
@@ -97,7 +97,7 @@ export const renderStillOnLambda = async ({
chromiumOptions: chromiumOptions ?? {},
scale: scale ?? 1,
downloadBehavior: downloadBehavior ?? {type: 'play-in-browser'},
- version: Internals.VERSION,
+ version: VERSION,
},
region,
});
diff --git a/packages/lambda/src/cli/commands/functions/deploy.ts b/packages/lambda/src/cli/commands/functions/deploy.ts
index 67fdb58d37..90b2922ed0 100644
--- a/packages/lambda/src/cli/commands/functions/deploy.ts
+++ b/packages/lambda/src/cli/commands/functions/deploy.ts
@@ -1,6 +1,6 @@
import {CliInternals} from '@remotion/cli';
import {Log} from '@remotion/cli/dist/log';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {deployFunction} from '../../../api/deploy-function';
import {
DEFAULT_ARCHITECTURE,
@@ -43,7 +43,7 @@ Region = ${region}
Memory = ${memorySizeInMb}MB
Disk size = ${diskSizeInMb}MB
Timeout = ${timeoutInSeconds}sec
-Version = ${Internals.VERSION}
+Version = ${VERSION}
Architecture = ${architecture}
CloudWatch Logging Enabled = ${createCloudWatchLogGroup}
CloudWatch Retention Period = ${cloudWatchLogRetentionPeriodInDays} days
diff --git a/packages/lambda/src/cli/helpers/find-function-name.ts b/packages/lambda/src/cli/helpers/find-function-name.ts
index cda703eb89..627ea39502 100644
--- a/packages/lambda/src/cli/helpers/find-function-name.ts
+++ b/packages/lambda/src/cli/helpers/find-function-name.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {getFunctions} from '../../api/get-functions';
import {BINARY_NAME} from '../../shared/constants';
import {FUNCTIONS_COMMAND} from '../commands/functions';
@@ -15,12 +15,12 @@ export const findFunctionName = async () => {
compatibleOnly: false,
});
const lambdasWithMatchingVersion = remotionLambdas.filter(
- (l) => l.version === Internals.VERSION
+ (l) => l.version === VERSION
);
if (lambdasWithMatchingVersion.length === 0) {
Log.error(
- `No lambda functions with version ${Internals.VERSION} found in your account.`
+ `No lambda functions with version ${VERSION} found in your account.`
);
if (remotionLambdas.length > 0) {
Log.error(
diff --git a/packages/lambda/src/functions/chunk-optimization/can-use-optimization.ts b/packages/lambda/src/functions/chunk-optimization/can-use-optimization.ts
index 5189910da2..2dd676a09c 100644
--- a/packages/lambda/src/functions/chunk-optimization/can-use-optimization.ts
+++ b/packages/lambda/src/functions/chunk-optimization/can-use-optimization.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import type {OptimizationProfile} from './types';
export const canUseOptimization = ({
@@ -18,7 +18,7 @@ export const canUseOptimization = ({
return false;
}
- if (optimization.lambdaVersion !== Internals.VERSION) {
+ if (optimization.lambdaVersion !== VERSION) {
return false;
}
diff --git a/packages/lambda/src/functions/info.ts b/packages/lambda/src/functions/info.ts
index 9d37b22479..a232375960 100644
--- a/packages/lambda/src/functions/info.ts
+++ b/packages/lambda/src/functions/info.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import type {LambdaPayload} from '../shared/constants';
import {LambdaRoutines} from '../shared/constants';
@@ -7,10 +7,8 @@ export const infoHandler = (lambdaParams: LambdaPayload) => {
throw new TypeError('Expected info type');
}
- const returnValue: {
- version: string;
- } = {
- version: Internals.VERSION,
+ const returnValue = {
+ version: VERSION,
};
return Promise.resolve(returnValue);
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index a59aa97749..65ee79ea41 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -2,6 +2,7 @@ import {InvokeCommand} from '@aws-sdk/client-lambda';
import {RenderInternals} from '@remotion/renderer';
import fs from 'fs';
import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {getLambdaClient} from '../shared/aws-clients';
import type {
EncodingProgress,
@@ -229,7 +230,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
type: 'video',
imageFormat: params.imageFormat,
inputProps: params.inputProps,
- lambdaVersion: Internals.VERSION,
+ lambdaVersion: VERSION,
framesPerLambda,
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
region: getCurrentRegionInFunction(),
@@ -373,7 +374,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
newTiming: getProfileDuration(optimizedProfile),
createdFromRenderId: params.renderId,
framesPerLambda,
- lambdaVersion: Internals.VERSION,
+ lambdaVersion: VERSION,
frameRange: realFrameRange,
everyNthFrame: params.everyNthFrame,
},
diff --git a/packages/lambda/src/functions/start.ts b/packages/lambda/src/functions/start.ts
index 508685f8fe..d6bfb060a0 100644
--- a/packages/lambda/src/functions/start.ts
+++ b/packages/lambda/src/functions/start.ts
@@ -1,5 +1,5 @@
import {InvokeCommand} from '@aws-sdk/client-lambda';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {getOrCreateBucket} from '../api/get-or-create-bucket';
import {getLambdaClient} from '../shared/aws-clients';
import type {LambdaPayload} from '../shared/constants';
@@ -12,15 +12,15 @@ export const startHandler = async (params: LambdaPayload) => {
throw new TypeError('Expected type start');
}
- if (params.version !== Internals.VERSION) {
+ if (params.version !== VERSION) {
if (!params.version) {
throw new Error(
- `Version mismatch: A Lambda function with version ${Internals.VERSION} was called using the @remotion/lambda package with an older version.`
+ `Version mismatch: A Lambda function with version ${VERSION} was called using the @remotion/lambda package with an older version.`
);
}
throw new Error(
- `Version mismatch: A Lambda function with version ${Internals.VERSION} was called using the @remotion/lambda package with version ${params.version}`
+ `Version mismatch: A Lambda function with version ${VERSION} was called using the @remotion/lambda package with version ${params.version}`
);
}
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index b611a3a586..3607dfb530 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -3,7 +3,7 @@ import type {StillImageFormat} from '@remotion/renderer';
import {RenderInternals, renderStill} from '@remotion/renderer';
import fs from 'fs';
import path from 'path';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {estimatePrice} from '../api/estimate-price';
import {getOrCreateBucket} from '../api/get-or-create-bucket';
import {getLambdaClient} from '../shared/aws-clients';
@@ -48,15 +48,15 @@ const innerStillHandler = async (
throw new TypeError('Expected still type');
}
- if (lambdaParams.version !== Internals.VERSION) {
+ if (lambdaParams.version !== VERSION) {
if (!lambdaParams.version) {
throw new Error(
- `Version mismatch: A Lambda function with version ${Internals.VERSION} was called using the @remotion/lambda package with an older version.`
+ `Version mismatch: A Lambda function with version ${VERSION} was called using the @remotion/lambda package with an older version.`
);
}
throw new Error(
- `Version mismatch: A Lambda function with version ${Internals.VERSION} was called using the @remotion/lambda package with version ${lambdaParams.version}`
+ `Version mismatch: A Lambda function with version ${VERSION} was called using the @remotion/lambda package with version ${lambdaParams.version}`
);
}
@@ -108,7 +108,7 @@ const innerStillHandler = async (
usesOptimizationProfile: false,
imageFormat: lambdaParams.imageFormat,
inputProps: lambdaParams.inputProps,
- lambdaVersion: Internals.VERSION,
+ lambdaVersion: VERSION,
framesPerLambda: 1,
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
region: getCurrentRegionInFunction(),
diff --git a/packages/lambda/src/test/integration/cli.test.ts b/packages/lambda/src/test/integration/cli.test.ts
index e1a9758a05..0b8b4b6818 100644
--- a/packages/lambda/src/test/integration/cli.test.ts
+++ b/packages/lambda/src/test/integration/cli.test.ts
@@ -1,6 +1,6 @@
// eslint-disable-next-line no-restricted-imports
import {CliInternals} from '@remotion/cli';
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {
DEFAULT_EPHEMERAL_STORAGE_IN_MB,
DEFAULT_MEMORY_SIZE,
@@ -12,7 +12,7 @@ import {getProcessWriteOutput} from './console-hooks';
test('Deploy function', async () => {
await LambdaInternals.executeCommand(['functions', 'deploy']);
expect(getProcessWriteOutput()).toContain(
- `Deployed as remotion-render-${Internals.VERSION.replace(
+ `Deployed as remotion-render-${VERSION.replace(
/\./g,
'-'
)}-mem${DEFAULT_MEMORY_SIZE}mb-disk${DEFAULT_EPHEMERAL_STORAGE_IN_MB}mb-${DEFAULT_TIMEOUT}sec\n`
diff --git a/packages/lambda/src/test/integration/deploy-function.test.ts b/packages/lambda/src/test/integration/deploy-function.test.ts
index b966d09683..18a9b88a4e 100644
--- a/packages/lambda/src/test/integration/deploy-function.test.ts
+++ b/packages/lambda/src/test/integration/deploy-function.test.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import {deleteFunction} from '../../api/delete-function';
import {deployFunction} from '../../api/deploy-function';
import {getFunctions} from '../../api/get-functions';
@@ -9,7 +9,7 @@ import {
import {DEFAULT_EPHEMERAL_STORAGE_IN_MB} from '../../shared/constants';
const expectedFunctionName = (memory: number, timeout: number, disk: number) =>
- `remotion-render-${Internals.VERSION.replace(
+ `remotion-render-${VERSION.replace(
/\./g,
'-'
)}-mem${memory}mb-disk${disk}mb-${timeout}sec`;
@@ -53,7 +53,7 @@ test('Should be able to get the function afterwards', async () => {
),
memorySizeInMb: 2048,
timeoutInSeconds: 120,
- version: Internals.VERSION,
+ version: VERSION,
region: 'us-east-1',
diskSizeInMb: 2048,
},
@@ -119,7 +119,7 @@ test('Should be able to get the function afterwards', async () => {
),
memorySizeInMb: 2048,
timeoutInSeconds: 120,
- version: Internals.VERSION,
+ version: VERSION,
region: 'us-east-1',
diskSizeInMb: 2048,
},
diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.ts
index a04ab4eafc..5c1c3d1e1b 100644
--- a/packages/renderer/src/set-props-and-env.ts
+++ b/packages/renderer/src/set-props-and-env.ts
@@ -1,4 +1,4 @@
-import {Internals} from 'remotion';
+import {VERSION} from 'remotion/version';
import type {Page} from './browser/BrowserPage';
import {DEFAULT_TIMEOUT} from './browser/TimeoutSettings';
import {normalizeServeUrl} from './normalize-serve-url';
@@ -154,14 +154,14 @@ export const setPropsAndEnv = async ({
);
}
- if (remotionVersion !== Internals.VERSION) {
+ if (remotionVersion !== VERSION) {
if (remotionVersion) {
console.warn(
- `The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${Internals.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`
+ `The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`
);
} else {
console.warn(
- `The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${Internals.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`
+ `The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`
);
}
}