@remotion/lambda 4.0.0-alpha4 → 4.0.0-alpha5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/admin/bundle-lambda.js +17 -23
  2. package/dist/admin/make-layer-public.js +59 -87
  3. package/dist/api/clean-items.js +1 -1
  4. package/dist/api/create-function.d.ts +1 -3
  5. package/dist/api/create-function.js +6 -6
  6. package/dist/api/deploy-function.d.ts +0 -3
  7. package/dist/api/deploy-function.js +1 -7
  8. package/dist/api/deploy-site.js +3 -8
  9. package/dist/api/download-media.d.ts +0 -4
  10. package/dist/api/download-media.js +1 -5
  11. package/dist/api/estimate-price.d.ts +1 -3
  12. package/dist/api/estimate-price.js +3 -9
  13. package/dist/api/get-compositions-on-lambda.d.ts +2 -2
  14. package/dist/api/get-or-create-bucket.d.ts +0 -1
  15. package/dist/api/get-or-create-bucket.js +0 -3
  16. package/dist/api/iam-validation/simulate.js +4 -2
  17. package/dist/api/render-media-on-lambda.d.ts +10 -6
  18. package/dist/api/render-media-on-lambda.js +6 -3
  19. package/dist/api/render-still-on-lambda.d.ts +7 -3
  20. package/dist/api/render-still-on-lambda.js +6 -3
  21. package/dist/cli/args.d.ts +0 -2
  22. package/dist/cli/commands/functions/deploy.js +7 -9
  23. package/dist/cli/commands/functions/ls.js +4 -1
  24. package/dist/cli/commands/functions/rm.js +8 -2
  25. package/dist/cli/commands/functions/rmall.js +8 -2
  26. package/dist/cli/commands/render/render.js +22 -12
  27. package/dist/cli/commands/sites/create.js +7 -8
  28. package/dist/cli/commands/still.js +7 -5
  29. package/dist/cli/helpers/progress-bar.d.ts +1 -2
  30. package/dist/cli/helpers/progress-bar.js +3 -7
  31. package/dist/cli/log.d.ts +12 -0
  32. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  33. package/dist/functions/compositions.d.ts +1 -1
  34. package/dist/functions/compositions.js +0 -2
  35. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +1 -3
  36. package/dist/functions/helpers/calculate-price-from-bucket.js +1 -2
  37. package/dist/functions/helpers/concat-videos.d.ts +2 -4
  38. package/dist/functions/helpers/concat-videos.js +2 -5
  39. package/dist/functions/helpers/create-post-render-data.js +0 -2
  40. package/dist/functions/helpers/get-chromium-executable-path.js +6 -1
  41. package/dist/functions/helpers/get-progress.js +0 -2
  42. package/dist/functions/helpers/is-enosp-err.js +1 -1
  43. package/dist/functions/helpers/validate-composition.d.ts +3 -5
  44. package/dist/functions/helpers/validate-composition.js +1 -3
  45. package/dist/functions/index.d.ts +15 -4
  46. package/dist/functions/index.js +1 -1
  47. package/dist/functions/launch.js +2 -6
  48. package/dist/functions/renderer.js +9 -9
  49. package/dist/functions/start.js +1 -1
  50. package/dist/functions/still.js +1 -5
  51. package/dist/index.d.ts +5 -6
  52. package/dist/index.js +1 -2
  53. package/dist/shared/constants.d.ts +20 -17
  54. package/dist/shared/constants.js +1 -2
  55. package/dist/shared/function-zip-path.d.ts +0 -1
  56. package/dist/shared/function-zip-path.js +1 -2
  57. package/dist/shared/hosted-layers.d.ts +2 -91
  58. package/dist/shared/hosted-layers.js +64 -363
  59. package/dist/shared/invoke-webhook.d.ts +0 -2
  60. package/package.json +9 -10
  61. package/remotionlambda-arm64.zip +0 -0
  62. package/remotionlambda-x64.zip +0 -0
  63. package/remotionlambda.zip +0 -0
@@ -4,51 +4,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const bundler_1 = require("@remotion/bundler");
7
- const compositor_linux_arm64_musl_1 = require("@remotion/compositor-linux-arm64-musl");
8
- const compositor_linux_x64_musl_1 = require("@remotion/compositor-linux-x64-musl");
7
+ const compositor_linux_arm64_gnu_1 = require("@remotion/compositor-linux-arm64-gnu");
9
8
  const fs_1 = __importDefault(require("fs"));
10
9
  const path_1 = __importDefault(require("path"));
11
10
  const quit_1 = require("../cli/helpers/quit");
12
11
  const function_zip_path_1 = require("../shared/function-zip-path");
13
12
  const zl = require("zip-lib");
14
- const bundleLambda = async (arch) => {
15
- var _a;
13
+ const bundleLambda = async () => {
16
14
  const outdir = path_1.default.join(__dirname, '..', `build-render`);
17
15
  fs_1.default.mkdirSync(outdir, {
18
16
  recursive: true,
19
17
  });
20
18
  const outfile = path_1.default.join(outdir, 'index.js');
21
- ((_a = fs_1.default.rmSync) !== null && _a !== void 0 ? _a : fs_1.default.rmdirSync)(outdir, { recursive: true });
19
+ fs_1.default.rmSync(outdir, { recursive: true });
22
20
  fs_1.default.mkdirSync(outdir, { recursive: true });
23
21
  const template = require.resolve(path_1.default.join(__dirname, '..', 'functions', 'index'));
24
22
  await bundler_1.BundlerInternals.esbuild.build({
25
23
  platform: 'node',
26
- target: 'node14',
24
+ target: 'node16',
27
25
  bundle: true,
28
26
  outfile,
29
27
  entryPoints: [template],
30
28
  treeShaking: true,
31
- external: ['./compositor', './compositor.exe'],
29
+ external: [
30
+ './compositor',
31
+ './compositor.exe',
32
+ './ffmpeg/remotion/bin/ffprobe',
33
+ './ffmpeg/remotion/bin/ffprobe.exe',
34
+ './ffmpeg/remotion/bin/ffmpeg',
35
+ './ffmpeg/remotion/bin/ffmpeg.exe',
36
+ ],
32
37
  });
33
38
  const compositorFile = `${outdir}/compositor`;
34
- if (arch === 'arm64') {
35
- fs_1.default.copyFileSync(compositor_linux_arm64_musl_1.binaryPath, compositorFile);
36
- await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
37
- }
38
- else {
39
- fs_1.default.copyFileSync(compositor_linux_x64_musl_1.binaryPath, compositorFile);
40
- await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_X86_64);
41
- }
42
- fs_1.default.unlinkSync(compositorFile);
43
- fs_1.default.unlinkSync(outfile);
39
+ fs_1.default.copyFileSync(compositor_linux_arm64_gnu_1.binaryPath, compositorFile);
40
+ await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
41
+ fs_1.default.rmSync(outdir, { recursive: true });
44
42
  };
45
- bundleLambda('arm64')
43
+ bundleLambda()
46
44
  .then(() => {
47
- console.log('Lambda bundled for arm64');
48
- return bundleLambda('x86_64');
49
- })
50
- .then(() => {
51
- console.log('Lambda bundled for x86_64');
45
+ console.log('Bundled Lambda');
52
46
  })
53
47
  .catch((err) => {
54
48
  console.log(err);
@@ -6,98 +6,70 @@ const version_1 = require("remotion/version");
6
6
  const get_regions_1 = require("../api/get-regions");
7
7
  const quit_1 = require("../cli/helpers/quit");
8
8
  const aws_clients_1 = require("../shared/aws-clients");
9
- const runtimes = ['nodejs14.x'];
10
- const archictures = ['arm64', 'x86_64'];
9
+ const runtimes = ['nodejs18.x'];
11
10
  const layerInfo = {
12
- arm64: {
13
- 'ap-northeast-1': [],
14
- 'ap-south-1': [],
15
- 'ap-southeast-1': [],
16
- 'ap-southeast-2': [],
17
- 'eu-central-1': [],
18
- 'eu-west-1': [],
19
- 'eu-west-2': [],
20
- 'us-east-1': [],
21
- 'us-east-2': [],
22
- 'us-west-2': [],
23
- 'af-south-1': [],
24
- 'ap-east-1': [],
25
- 'ap-northeast-2': [],
26
- 'ap-northeast-3': [],
27
- 'ca-central-1': [],
28
- 'eu-north-1': [],
29
- 'eu-south-1': [],
30
- 'eu-west-3': [],
31
- 'me-south-1': [],
32
- 'sa-east-1': [],
33
- 'us-west-1': [],
34
- },
35
- x86_64: {
36
- 'ap-northeast-1': [],
37
- 'ap-south-1': [],
38
- 'ap-southeast-1': [],
39
- 'ap-southeast-2': [],
40
- 'eu-central-1': [],
41
- 'eu-west-1': [],
42
- 'eu-west-2': [],
43
- 'us-east-1': [],
44
- 'us-east-2': [],
45
- 'us-west-2': [],
46
- 'af-south-1': [],
47
- 'ap-east-1': [],
48
- 'ap-northeast-2': [],
49
- 'ap-northeast-3': [],
50
- 'ca-central-1': [],
51
- 'eu-north-1': [],
52
- 'eu-south-1': [],
53
- 'eu-west-3': [],
54
- 'me-south-1': [],
55
- 'sa-east-1': [],
56
- 'us-west-1': [],
57
- },
11
+ 'ap-northeast-1': [],
12
+ 'ap-south-1': [],
13
+ 'ap-southeast-1': [],
14
+ 'ap-southeast-2': [],
15
+ 'eu-central-1': [],
16
+ 'eu-west-1': [],
17
+ 'eu-west-2': [],
18
+ 'us-east-1': [],
19
+ 'us-east-2': [],
20
+ 'us-west-2': [],
21
+ 'af-south-1': [],
22
+ 'ap-east-1': [],
23
+ 'ap-northeast-2': [],
24
+ 'ap-northeast-3': [],
25
+ 'ca-central-1': [],
26
+ 'eu-north-1': [],
27
+ 'eu-south-1': [],
28
+ 'eu-west-3': [],
29
+ 'me-south-1': [],
30
+ 'sa-east-1': [],
31
+ 'us-west-1': [],
58
32
  };
59
33
  const makeLayerPublic = async () => {
60
34
  const layers = ['fonts', 'ffmpeg', 'chromium'];
61
- for (const architecture of archictures) {
62
- for (const region of (0, get_regions_1.getRegions)()) {
63
- for (const layer of layers) {
64
- const layerName = `remotion-binaries-${layer}-${architecture}`;
65
- const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
66
- Content: {
67
- S3Bucket: 'remotionlambda-binaries-' + region,
68
- S3Key: `remotion-layer-${layer}-v9-${architecture}.zip`,
69
- },
70
- LayerName: layerName,
71
- LicenseInfo: layer === 'chromium'
72
- ? 'Chromium 104, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
73
- : layer === 'ffmpeg'
74
- ? 'Compiled from FFMPEG source. Read FFMPEG license: https://ffmpeg.org/legal.html'
75
- : 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
76
- CompatibleRuntimes: runtimes,
77
- Description: version_1.VERSION,
78
- }));
79
- await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.AddLayerVersionPermissionCommand({
80
- Action: aws_policies_1.lambda.GetLayerVersion,
81
- LayerName: layerName,
82
- Principal: '*',
83
- VersionNumber: Version,
84
- StatementId: 'public-layer',
85
- }));
86
- if (!layerInfo[architecture][region]) {
87
- layerInfo[architecture][region] = [];
88
- }
89
- if (!LayerArn) {
90
- throw new Error('layerArn is null');
91
- }
92
- if (!Version) {
93
- throw new Error('Version is null');
94
- }
95
- layerInfo[architecture][region].push({
96
- layerArn: LayerArn,
97
- version: Version,
98
- });
99
- console.log({ LayerArn, Version });
35
+ for (const region of (0, get_regions_1.getRegions)()) {
36
+ for (const layer of layers) {
37
+ const layerName = `remotion-binaries-${layer}-arm64`;
38
+ const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
39
+ Content: {
40
+ S3Bucket: 'remotionlambda-binaries-' + region,
41
+ S3Key: `remotion-layer-${layer}-v10-arm64.zip`,
42
+ },
43
+ LayerName: layerName,
44
+ LicenseInfo: layer === 'chromium'
45
+ ? 'Chromium 114, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
46
+ : layer === 'ffmpeg'
47
+ ? 'FFmpeg 6.0, compiled from source. Read FFMPEG license: https://ffmpeg.org/legal.html'
48
+ : 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
49
+ CompatibleRuntimes: runtimes,
50
+ Description: version_1.VERSION,
51
+ }));
52
+ await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.AddLayerVersionPermissionCommand({
53
+ Action: aws_policies_1.lambda.GetLayerVersion,
54
+ LayerName: layerName,
55
+ Principal: '*',
56
+ VersionNumber: Version,
57
+ StatementId: 'public-layer',
58
+ }));
59
+ if (!layerInfo[region]) {
60
+ layerInfo[region] = [];
100
61
  }
62
+ if (!LayerArn) {
63
+ throw new Error('layerArn is null');
64
+ }
65
+ if (!Version) {
66
+ throw new Error('Version is null');
67
+ }
68
+ layerInfo[region].push({
69
+ layerArn: LayerArn,
70
+ version: Version,
71
+ });
72
+ console.log({ LayerArn, Version });
101
73
  }
102
74
  }
103
75
  };
@@ -5,7 +5,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
5
5
  const aws_clients_1 = require("../shared/aws-clients");
6
6
  const p_limit_1 = require("../shared/p-limit");
7
7
  const limit = (0, p_limit_1.pLimit)(10);
8
- const cleanItems = async ({ bucket, onAfterItemDeleted, onBeforeItemDeleted, region, list, }) => {
8
+ const cleanItems = ({ bucket, onAfterItemDeleted, onBeforeItemDeleted, region, list, }) => {
9
9
  return Promise.all(list.map((object) => limit(async () => {
10
10
  onBeforeItemDeleted({
11
11
  bucketName: bucket,
@@ -1,6 +1,5 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- import type { LambdaArchitecture } from '../shared/validate-architecture';
3
- export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, customRoleArn, }: {
2
+ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, }: {
4
3
  createCloudWatchLogGroup: boolean;
5
4
  region: AwsRegion;
6
5
  zipFile: string;
@@ -11,7 +10,6 @@ export declare const createFunction: ({ createCloudWatchLogGroup, region, zipFil
11
10
  alreadyCreated: boolean;
12
11
  retentionInDays: number;
13
12
  ephemerealStorageInMb: number;
14
- architecture: LambdaArchitecture;
15
13
  customRoleArn: string;
16
14
  }) => Promise<{
17
15
  FunctionName: string;
@@ -8,7 +8,7 @@ const defaults_1 = require("../defaults");
8
8
  const aws_clients_1 = require("../shared/aws-clients");
9
9
  const hosted_layers_1 = require("../shared/hosted-layers");
10
10
  const suggested_policy_1 = require("./iam-validation/suggested-policy");
11
- const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, architecture, ephemerealStorageInMb, customRoleArn, }) => {
11
+ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, functionName, accountId, memorySizeInMb, timeoutInSeconds, alreadyCreated, retentionInDays, ephemerealStorageInMb, customRoleArn, }) => {
12
12
  var _a;
13
13
  if (createCloudWatchLogGroup) {
14
14
  try {
@@ -38,15 +38,15 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
38
38
  FunctionName: functionName,
39
39
  Handler: 'index.handler',
40
40
  Role: customRoleArn !== null && customRoleArn !== void 0 ? customRoleArn : defaultRoleName,
41
+ Runtime: 'nodejs18.x',
41
42
  Description: 'Renders a Remotion video.',
42
43
  MemorySize: memorySizeInMb,
43
44
  Timeout: timeoutInSeconds,
44
- Layers: hosted_layers_1.__internal_doNotUsehostedLayers[architecture][region].map(({ layerArn, version }) => `${layerArn}:${version}`),
45
- Architectures: [architecture],
45
+ Layers: hosted_layers_1.hostedLayers[region].map(({ layerArn, version }) => `${layerArn}:${version}`),
46
+ Architectures: ['arm64'],
46
47
  EphemeralStorage: {
47
48
  Size: ephemerealStorageInMb,
48
49
  },
49
- Runtime: 'nodejs14.x',
50
50
  }));
51
51
  await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutFunctionEventInvokeConfigCommand({
52
52
  MaximumRetryAttempts: 0,
@@ -66,11 +66,11 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
66
66
  await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutRuntimeManagementConfigCommand({
67
67
  FunctionName,
68
68
  UpdateRuntimeOn: 'Manual',
69
- RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:69000d3430a08938bcab71617dffcb8ea551a2cbc36c59f38c52a1ea087e461b`,
69
+ RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:b97ad873eb5228db2e7d5727cd116734cc24c92ff1381739c4400c095404a2d3`,
70
70
  }));
71
71
  }
72
72
  catch (err) {
73
- console.warn('⚠️ Could not lock the runtime version. We recommend to update your policies to prevent your functions from breaking soon: https://remotion.dev/docs/lambda/feb-2023-incident');
73
+ console.warn('⚠️ Could not lock the runtime version. We recommend to update your policies to prevent your functions from breaking in the future in case the AWS runtime changes. See https://remotion.dev/docs/lambda/feb-2023-incident for an example on how to update your policy.');
74
74
  }
75
75
  return { FunctionName: FunctionName };
76
76
  };
@@ -1,12 +1,10 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- import type { LambdaArchitecture } from '../shared/validate-architecture';
3
2
  export declare type DeployFunctionInput = {
4
3
  createCloudWatchLogGroup: boolean;
5
4
  cloudWatchLogRetentionPeriodInDays?: number;
6
5
  region: AwsRegion;
7
6
  timeoutInSeconds: number;
8
7
  memorySizeInMb: number;
9
- architecture: LambdaArchitecture;
10
8
  diskSizeInMb?: number;
11
9
  customRoleArn?: string;
12
10
  };
@@ -22,7 +20,6 @@ export declare type DeployFunctionOutput = {
22
20
  * @param options.region The region you want to deploy your function to.
23
21
  * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
24
22
  * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
25
- * @param options.architecture The architecture Lambda should run on. One of x86_64 and x64
26
23
  * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
27
24
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
28
25
  */
@@ -7,7 +7,6 @@ const constants_1 = require("../shared/constants");
7
7
  const function_zip_path_1 = require("../shared/function-zip-path");
8
8
  const get_account_id_1 = require("../shared/get-account-id");
9
9
  const lambda_version_string_1 = require("../shared/lambda-version-string");
10
- const validate_architecture_1 = require("../shared/validate-architecture");
11
10
  const validate_aws_region_1 = require("../shared/validate-aws-region");
12
11
  const validate_custom_role_arn_1 = require("../shared/validate-custom-role-arn");
13
12
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
@@ -23,7 +22,6 @@ const create_function_1 = require("./create-function");
23
22
  * @param options.region The region you want to deploy your function to.
24
23
  * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
25
24
  * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
26
- * @param options.architecture The architecture Lambda should run on. One of x86_64 and x64
27
25
  * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
28
26
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
29
27
  */
@@ -34,7 +32,6 @@ const deployFunction = async (options) => {
34
32
  (0, validate_timeout_1.validateTimeout)(options.timeoutInSeconds);
35
33
  (0, validate_aws_region_1.validateAwsRegion)(options.region);
36
34
  (0, validate_retention_period_1.validateCloudWatchRetentionPeriod)(options.cloudWatchLogRetentionPeriodInDays);
37
- (0, validate_architecture_1.validateArchitecture)(options.architecture);
38
35
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
39
36
  (0, validate_custom_role_arn_1.validateCustomRoleArn)(options.customRoleArn);
40
37
  const fnNameRender = [
@@ -55,16 +52,13 @@ const deployFunction = async (options) => {
55
52
  const created = await (0, create_function_1.createFunction)({
56
53
  createCloudWatchLogGroup: options.createCloudWatchLogGroup,
57
54
  region: options.region,
58
- zipFile: options.architecture === 'arm64'
59
- ? function_zip_path_1.FUNCTION_ZIP_ARM64
60
- : function_zip_path_1.FUNCTION_ZIP_X86_64,
55
+ zipFile: function_zip_path_1.FUNCTION_ZIP_ARM64,
61
56
  functionName: fnNameRender,
62
57
  accountId,
63
58
  memorySizeInMb: options.memorySizeInMb,
64
59
  timeoutInSeconds: options.timeoutInSeconds,
65
60
  retentionInDays: (_b = options.cloudWatchLogRetentionPeriodInDays) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
66
61
  alreadyCreated: Boolean(alreadyDeployed),
67
- architecture: options.architecture,
68
62
  ephemerealStorageInMb: diskSizeInMb,
69
63
  customRoleArn: options.customRoleArn,
70
64
  });
@@ -87,14 +87,9 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
87
87
  })),
88
88
  ]);
89
89
  if (!process.env.VITEST) {
90
- if (fs_1.default.rmSync) {
91
- fs_1.default.rmSync(bundled, {
92
- recursive: true,
93
- });
94
- }
95
- else {
96
- fs_1.default.rmdirSync(bundled, { recursive: true });
97
- }
90
+ fs_1.default.rmSync(bundled, {
91
+ recursive: true,
92
+ });
98
93
  }
99
94
  return {
100
95
  serveUrl: (0, make_s3_url_1.makeS3ServeUrl)({ bucketName, subFolder, region }),
@@ -25,7 +25,3 @@ export declare type DownloadMediaOutput = {
25
25
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
26
26
  */
27
27
  export declare const downloadMedia: (input: DownloadMediaInput) => Promise<DownloadMediaOutput>;
28
- /**
29
- * @deprecated Renamed to downloadMedia()
30
- */
31
- export declare const downloadVideo: (input: DownloadMediaInput) => Promise<DownloadMediaOutput>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.downloadVideo = exports.downloadMedia = void 0;
6
+ exports.downloadMedia = void 0;
7
7
  const renderer_1 = require("@remotion/renderer");
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const expected_out_name_1 = require("../functions/helpers/expected-out-name");
@@ -50,7 +50,3 @@ const downloadMedia = async (input) => {
50
50
  };
51
51
  };
52
52
  exports.downloadMedia = downloadMedia;
53
- /**
54
- * @deprecated Renamed to downloadMedia()
55
- */
56
- exports.downloadVideo = exports.downloadMedia;
@@ -1,11 +1,9 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- import type { LambdaArchitecture } from '../shared/validate-architecture';
3
2
  export declare type EstimatePriceInput = {
4
3
  region: AwsRegion;
5
4
  durationInMiliseconds: number;
6
5
  memorySizeInMb: number;
7
6
  diskSizeInMb: number;
8
- architecture: LambdaArchitecture;
9
7
  lambdasInvoked: number;
10
8
  };
11
9
  /**
@@ -14,4 +12,4 @@ export declare type EstimatePriceInput = {
14
12
  * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
15
13
  * @returns {number} Price in USD
16
14
  */
17
- export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, architecture, lambdasInvoked, }: EstimatePriceInput) => number;
15
+ export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }: EstimatePriceInput) => number;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.estimatePrice = void 0;
4
4
  const defaults_1 = require("../defaults");
5
5
  const price_per_1_s_1 = require("../pricing/price-per-1-s");
6
- const validate_architecture_1 = require("../shared/validate-architecture");
7
6
  const validate_aws_region_1 = require("../shared/validate-aws-region");
8
7
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
9
8
  const validate_memory_size_1 = require("../shared/validate-memory-size");
@@ -13,10 +12,9 @@ const validate_memory_size_1 = require("../shared/validate-memory-size");
13
12
  * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
14
13
  * @returns {number} Price in USD
15
14
  */
16
- const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, architecture, lambdasInvoked, }) => {
15
+ const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }) => {
17
16
  (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
18
17
  (0, validate_aws_region_1.validateAwsRegion)(region);
19
- (0, validate_architecture_1.validateArchitecture)(architecture);
20
18
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
21
19
  if (typeof durationInMiliseconds !== 'number') {
22
20
  throw new TypeError(`Parameter 'durationInMiliseconds' must be a number but got ${typeof durationInMiliseconds}`);
@@ -30,15 +28,11 @@ const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSize
30
28
  if (durationInMiliseconds < 0) {
31
29
  throw new TypeError(`Parameter 'durationInMiliseconds' must be over 0 but it is ${durationInMiliseconds}.`);
32
30
  }
33
- const durationPrice = architecture === 'x86_64'
34
- ? price_per_1_s_1.pricing[region]['Lambda Duration'].price
35
- : price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
31
+ const durationPrice = price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
36
32
  // In GB-second
37
33
  const timeCostDollars = Number(durationPrice) *
38
34
  ((memorySizeInMb * durationInMiliseconds) / 1000 / 1024);
39
- const diskSizePrice = architecture === 'x86_64'
40
- ? price_per_1_s_1.pricing[region]['Lambda Storage-Duration'].price
41
- : price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
35
+ const diskSizePrice = price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
42
36
  const chargedDiskSize = Math.max(0, diskSizeInMb - defaults_1.MIN_EPHEMERAL_STORAGE_IN_MB);
43
37
  // In GB-second
44
38
  const diskSizeDollars = chargedDiskSize *
@@ -1,5 +1,5 @@
1
1
  import type { ChromiumOptions, LogLevel } from '@remotion/renderer';
2
- import type { TCompMetadata } from 'remotion';
2
+ import type { AnyCompMetadata } from 'remotion';
3
3
  import type { AwsRegion } from '../client';
4
4
  export declare type GetCompositionsOnLambdaInput = {
5
5
  chromiumOptions?: ChromiumOptions;
@@ -13,7 +13,7 @@ export declare type GetCompositionsOnLambdaInput = {
13
13
  forceBucketName?: string;
14
14
  dumpBrowserLogs?: boolean;
15
15
  };
16
- export declare type GetCompositionsOnLambdaOutput = TCompMetadata[];
16
+ export declare type GetCompositionsOnLambdaOutput = AnyCompMetadata[];
17
17
  /**
18
18
  * @description Returns the compositions from a serveUrl
19
19
  * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
@@ -1,7 +1,6 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
2
  export declare type GetOrCreateBucketInput = {
3
3
  region: AwsRegion;
4
- onBucketEnsured?: () => void;
5
4
  };
6
5
  export declare type GetOrCreateBucketOutput = {
7
6
  bucketName: string;
@@ -12,13 +12,11 @@ const get_buckets_1 = require("./get-buckets");
12
12
  * @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
13
13
  */
14
14
  const getOrCreateBucket = async (options) => {
15
- var _a, _b;
16
15
  const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(options.region);
17
16
  if (remotionBuckets.length > 1) {
18
17
  throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${options.region}) starting with "${constants_1.REMOTION_BUCKET_PREFIX}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
19
18
  }
20
19
  if (remotionBuckets.length === 1) {
21
- (_a = options.onBucketEnsured) === null || _a === void 0 ? void 0 : _a.call(options);
22
20
  return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
23
21
  }
24
22
  const bucketName = (0, validate_bucketname_1.makeBucketName)(options.region);
@@ -26,7 +24,6 @@ const getOrCreateBucket = async (options) => {
26
24
  bucketName,
27
25
  region: options.region,
28
26
  });
29
- (_b = options.onBucketEnsured) === null || _b === void 0 ? void 0 : _b.call(options);
30
27
  return { bucketName, alreadyExisted: false };
31
28
  };
32
29
  exports.getOrCreateBucket = getOrCreateBucket;
@@ -36,10 +36,12 @@ const simulatePermissions = async (options) => {
36
36
  }
37
37
  const callerIdentityArnType = callerIdentityArnComponents[1];
38
38
  let callerArn;
39
- if (callerIdentityArnType === 'iam' && callerIdentityArnComponents[3] === 'user') {
39
+ if (callerIdentityArnType === 'iam' &&
40
+ callerIdentityArnComponents[3] === 'user') {
40
41
  callerArn = callerIdentity.Arn;
41
42
  }
42
- else if (callerIdentityArnType === 'sts' && callerIdentityArnComponents[3] === 'assumed-role') {
43
+ else if (callerIdentityArnType === 'sts' &&
44
+ callerIdentityArnComponents[3] === 'assumed-role') {
43
45
  const assumedRoleComponents = callerIdentityArnComponents[4].match(/\/([^/]+)\/(.*)/);
44
46
  if (!assumedRoleComponents) {
45
47
  throw new Error('Unsupported AWS Caller Identity as Assumed-Role ARN detected');
@@ -1,4 +1,4 @@
1
- import type { AudioCodec, ChromiumOptions, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
1
+ import type { AudioCodec, ChromiumOptions, FrameRange, LogLevel, PixelFormat, ProResProfile, VideoImageFormat } from '@remotion/renderer';
2
2
  import type { AwsRegion } from '../pricing/aws-regions';
3
3
  import type { OutNameInput, Privacy } from '../shared/constants';
4
4
  import type { DownloadBehavior } from '../shared/content-disposition-header';
@@ -10,13 +10,17 @@ export declare type RenderMediaOnLambdaInput = {
10
10
  composition: string;
11
11
  inputProps?: unknown;
12
12
  codec: LambdaCodec;
13
- imageFormat?: ImageFormat;
13
+ imageFormat?: VideoImageFormat;
14
14
  crf?: number | undefined;
15
15
  envVariables?: Record<string, string>;
16
16
  pixelFormat?: PixelFormat;
17
17
  proResProfile?: ProResProfile;
18
18
  privacy?: Privacy;
19
- quality?: number;
19
+ /**
20
+ * @deprecated Renamed to `jpegQuality`
21
+ */
22
+ quality?: never;
23
+ jpegQuality?: number;
20
24
  maxRetries?: number;
21
25
  framesPerLambda?: number;
22
26
  logLevel?: LogLevel;
@@ -62,7 +66,7 @@ export declare type RenderMediaOnLambdaOutput = {
62
66
  * @param params.crf The constant rate factor to be used during encoding.
63
67
  * @param params.envVariables Object containing environment variables to be inserted into the video environment
64
68
  * @param params.proResProfile The ProRes profile if rendering a ProRes video
65
- * @param params.quality JPEG quality if JPEG was selected as the image format.
69
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
66
70
  * @param params.region The AWS region in which the media should be rendered.
67
71
  * @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted. Default "1"
68
72
  * @param params.logLevel Level of logging that Lambda function should perform. Default "info".
@@ -70,8 +74,8 @@ export declare type RenderMediaOnLambdaOutput = {
70
74
  * @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch
71
75
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
72
76
  */
73
- export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
77
+ export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
74
78
  /**
75
79
  * @deprecated Renamed to renderMediaOnLambda()
76
80
  */
77
- export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
81
+ export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
@@ -22,7 +22,7 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
22
22
  * @param params.crf The constant rate factor to be used during encoding.
23
23
  * @param params.envVariables Object containing environment variables to be inserted into the video environment
24
24
  * @param params.proResProfile The ProRes profile if rendering a ProRes video
25
- * @param params.quality JPEG quality if JPEG was selected as the image format.
25
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
26
26
  * @param params.region The AWS region in which the media should be rendered.
27
27
  * @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted. Default "1"
28
28
  * @param params.logLevel Level of logging that Lambda function should perform. Default "info".
@@ -30,8 +30,11 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
30
30
  * @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch
31
31
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
32
32
  */
33
- const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }) => {
33
+ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, dumpBrowserLogs, }) => {
34
34
  var _a;
35
+ if (quality) {
36
+ throw new Error(`"quality" has been renamed. Use "jpegQuality" instead.`);
37
+ }
35
38
  const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
36
39
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
37
40
  (0, validate_frames_per_lambda_1.validateFramesPerLambda)({
@@ -61,7 +64,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
61
64
  envVariables,
62
65
  pixelFormat,
63
66
  proResProfile,
64
- quality,
67
+ jpegQuality,
65
68
  maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : 1,
66
69
  privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
67
70
  logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',