@remotion/lambda 3.1.4 → 3.1.7

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 (38) hide show
  1. package/dist/admin/bundle-lambda.js +1 -0
  2. package/dist/api/deploy-site.js +2 -3
  3. package/dist/api/presign-url.d.ts +2 -1
  4. package/dist/api/render-media-on-lambda.d.ts +1 -2
  5. package/dist/api/render-media-on-lambda.js +4 -3
  6. package/dist/api/render-still-on-lambda.d.ts +1 -2
  7. package/dist/api/render-still-on-lambda.js +2 -3
  8. package/dist/cli/commands/render/progress.d.ts +1 -1
  9. package/dist/cli/commands/sites/create.js +2 -3
  10. package/dist/cli/index.js +1 -1
  11. package/dist/functions/helpers/create-post-render-data.js +1 -2
  12. package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -2
  13. package/dist/functions/helpers/get-lambdas-invoked-stats.js +6 -11
  14. package/dist/functions/helpers/get-progress.js +5 -5
  15. package/dist/functions/helpers/io.d.ts +1 -1
  16. package/dist/functions/helpers/io.js +3 -1
  17. package/dist/functions/helpers/print-cloudwatch-helper.d.ts +1 -1
  18. package/dist/functions/helpers/validate-composition.d.ts +4 -3
  19. package/dist/functions/helpers/validate-composition.js +2 -1
  20. package/dist/functions/index.js +12 -5
  21. package/dist/functions/launch.js +10 -8
  22. package/dist/functions/renderer.js +6 -5
  23. package/dist/functions/start.js +1 -2
  24. package/dist/functions/still.js +8 -4
  25. package/dist/shared/bundle-site.d.ts +1 -6
  26. package/dist/shared/check-credentials.js +2 -2
  27. package/dist/shared/constants.d.ts +3 -3
  28. package/dist/shared/constants.js +1 -1
  29. package/dist/shared/truthy.d.ts +3 -0
  30. package/dist/shared/truthy.js +7 -0
  31. package/dist/shared/validate-presign-expiration.d.ts +0 -2
  32. package/dist/shared/validate-presign-expiration.js +7 -7
  33. package/package.json +7 -6
  34. package/remotionlambda.zip +0 -0
  35. package/dist/cli/helpers/format-bytes.d.ts +0 -6
  36. package/dist/cli/helpers/format-bytes.js +0 -103
  37. package/dist/shared/chunk.d.ts +0 -1
  38. package/dist/shared/chunk.js +0 -11
@@ -25,6 +25,7 @@ const bundleLambda = async () => {
25
25
  bundle: true,
26
26
  outfile,
27
27
  entryPoints: [template],
28
+ treeShaking: true,
28
29
  });
29
30
  await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP);
30
31
  fs_1.default.unlinkSync(outfile);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deploySite = void 0;
4
- const remotion_1 = require("remotion");
5
4
  const delete_site_1 = require("../api/delete-site");
6
5
  const bundle_site_1 = require("../shared/bundle-site");
7
6
  const constants_1 = require("../shared/constants");
@@ -46,8 +45,8 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
46
45
  });
47
46
  const bundled = await (0, bundle_site_1.bundleSite)(entryPoint, (_a = options === null || options === void 0 ? void 0 : options.onBundleProgress) !== null && _a !== void 0 ? _a : (() => undefined), {
48
47
  publicPath: `/${subFolder}/`,
49
- webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b : remotion_1.Internals.getWebpackOverrideFn(),
50
- enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c : remotion_1.Internals.getWebpackCaching(),
48
+ webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b : ((f) => f),
49
+ enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c : true,
51
50
  });
52
51
  await Promise.all([
53
52
  (0, upload_dir_1.uploadDir)({
@@ -1,5 +1,5 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- export declare type PresignURLInput = {
2
+ declare type PresignURLInput = {
3
3
  region: AwsRegion;
4
4
  bucketName: string;
5
5
  objectKey: string;
@@ -17,3 +17,4 @@ export declare type PresignURLInput = {
17
17
  * @returns {Promise<string | null>} The public url of an object or `null` if `checkIfObjectExists=true` & object does not exist.
18
18
  */
19
19
  export declare const presignUrl: ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, }: PresignURLInput) => Promise<string | null>;
20
+ export {};
@@ -1,5 +1,4 @@
1
- import type { ChromiumOptions } from '@remotion/renderer';
2
- import type { FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from 'remotion';
1
+ import type { ChromiumOptions, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
3
2
  import type { AwsRegion } from '../pricing/aws-regions';
4
3
  import type { OutNameInput, Privacy } from '../shared/constants';
5
4
  import type { DownloadBehavior } from '../shared/content-disposition-header';
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderVideoOnLambda = exports.renderMediaOnLambda = void 0;
4
- const remotion_1 = require("remotion");
5
4
  const call_lambda_1 = require("../shared/call-lambda");
6
5
  const constants_1 = require("../shared/constants");
7
6
  const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
7
+ const validate_download_behavior_1 = require("../shared/validate-download-behavior");
8
8
  const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
9
9
  const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
10
10
  const validate_serveurl_1 = require("../shared/validate-serveurl");
@@ -30,6 +30,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
30
30
  const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
31
31
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
32
32
  (0, validate_frames_per_lambda_1.validateFramesPerLambda)(framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null);
33
+ (0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
33
34
  const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
34
35
  const res = await (0, call_lambda_1.callLambda)({
35
36
  functionName,
@@ -48,10 +49,10 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
48
49
  quality,
49
50
  maxRetries,
50
51
  privacy,
51
- logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : remotion_1.Internals.Logging.DEFAULT_LOG_LEVEL,
52
+ logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
52
53
  frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
53
54
  outName: outName !== null && outName !== void 0 ? outName : null,
54
- timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : remotion_1.Internals.DEFAULT_PUPPETEER_TIMEOUT,
55
+ timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
55
56
  chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
56
57
  scale: scale !== null && scale !== void 0 ? scale : 1,
57
58
  everyNthFrame: everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1,
@@ -1,5 +1,4 @@
1
- import type { ChromiumOptions } from '@remotion/renderer';
2
- import type { LogLevel, StillImageFormat } from 'remotion';
1
+ import type { ChromiumOptions, LogLevel, StillImageFormat } from '@remotion/renderer';
3
2
  import type { AwsRegion } from '../pricing/aws-regions';
4
3
  import type { CostsInfo, OutNameInput } from '../shared/constants';
5
4
  import type { DownloadBehavior } from '../shared/content-disposition-header';
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderStillOnLambda = void 0;
4
- const remotion_1 = require("remotion");
5
4
  const call_lambda_1 = require("../shared/call-lambda");
6
5
  const constants_1 = require("../shared/constants");
7
6
  const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
@@ -37,9 +36,9 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
37
36
  frame: frame !== null && frame !== void 0 ? frame : 0,
38
37
  privacy,
39
38
  attempt: 1,
40
- logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : remotion_1.Internals.Logging.DEFAULT_LOG_LEVEL,
39
+ logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
41
40
  outName: outName !== null && outName !== void 0 ? outName : null,
42
- timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : remotion_1.Internals.DEFAULT_PUPPETEER_TIMEOUT,
41
+ timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
43
42
  chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
44
43
  scale: scale !== null && scale !== void 0 ? scale : 1,
45
44
  downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
@@ -10,7 +10,7 @@ declare type ChunkProgress = {
10
10
  chunksInvoked: number;
11
11
  doneIn: number | null;
12
12
  };
13
- export declare type MultiRenderProgress = {
13
+ declare type MultiRenderProgress = {
14
14
  lambdaInvokeProgress: LambdaInvokeProgress;
15
15
  chunkProgress: ChunkProgress;
16
16
  encodingProgress: EncodingProgress;
@@ -7,7 +7,6 @@ exports.sitesCreateSubcommand = exports.SITES_CREATE_SUBCOMMAND = void 0;
7
7
  const cli_1 = require("@remotion/cli");
8
8
  const fs_1 = require("fs");
9
9
  const path_1 = __importDefault(require("path"));
10
- const remotion_1 = require("remotion");
11
10
  const deploy_site_1 = require("../../../api/deploy-site");
12
11
  const get_or_create_bucket_1 = require("../../../api/get-or-create-bucket");
13
12
  const constants_1 = require("../../../shared/constants");
@@ -97,8 +96,8 @@ const sitesCreateSubcommand = async (args) => {
97
96
  };
98
97
  updateProgress();
99
98
  },
100
- enableCaching: remotion_1.Internals.getWebpackCaching(),
101
- webpackOverride: (_b = remotion_1.Internals.getWebpackOverrideFn()) !== null && _b !== void 0 ? _b : remotion_1.Internals.defaultOverrideFunction,
99
+ enableCaching: cli_1.ConfigInternals.getWebpackCaching(),
100
+ webpackOverride: (_b = cli_1.ConfigInternals.getWebpackOverrideFn()) !== null && _b !== void 0 ? _b : ((f) => f),
102
101
  },
103
102
  region: (0, get_aws_region_1.getAwsRegion)(),
104
103
  });
package/dist/cli/index.js CHANGED
@@ -133,7 +133,7 @@ AWS returned an "TooManyRequestsException" error message which could mean you re
133
133
  };
134
134
  exports.executeCommand = executeCommand;
135
135
  const cli = async () => {
136
- await cli_1.CliInternals.initializeRenderCli('lambda');
136
+ await cli_1.CliInternals.initializeRenderCli(cli_1.CliInternals.findRemotionRoot(), 'lambda');
137
137
  await (0, exports.executeCommand)(args_1.parsedLambdaCli._);
138
138
  };
139
139
  exports.cli = cli;
@@ -12,7 +12,6 @@ const get_lambdas_invoked_stats_1 = require("./get-lambdas-invoked-stats");
12
12
  const get_retry_stats_1 = require("./get-retry-stats");
13
13
  const get_time_to_finish_1 = require("./get-time-to-finish");
14
14
  const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata, contents, timeToEncode, errorExplanations, timeToDelete, outputFile, }) => {
15
- var _a;
16
15
  const initializedKeys = contents.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaTimingsPrefix)(renderId)); });
17
16
  const parsedTimings = initializedKeys.map(({ Key }) => (0, parse_lambda_timings_key_1.parseLambdaTimingsKey)(Key));
18
17
  const times = parsedTimings
@@ -42,7 +41,7 @@ const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata
42
41
  const renderSize = contents
43
42
  .map((c) => { var _a; return (_a = c.Size) !== null && _a !== void 0 ? _a : 0; })
44
43
  .reduce((a, b) => a + b, 0);
45
- const { timeToInvokeLambdas } = (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, renderId, (_a = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.estimatedRenderLambdaInvokations) !== null && _a !== void 0 ? _a : null, renderMetadata.startedDate);
44
+ const { timeToInvokeLambdas } = (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, renderId, renderMetadata.startedDate);
46
45
  const retriesInfo = (0, get_retry_stats_1.getRetryStats)({ contents, renderId });
47
46
  if (timeToInvokeLambdas === null) {
48
47
  throw new Error('should have timing for all lambdas');
@@ -1,7 +1,6 @@
1
1
  import type { _Object } from '@aws-sdk/client-s3';
2
2
  export declare type LambdaInvokeStats = {
3
3
  timeToInvokeLambdas: number | null;
4
- allLambdasInvoked: boolean;
5
4
  lambdasInvoked: number;
6
5
  };
7
- export declare const getLambdasInvokedStats: (contents: _Object[], renderId: string, estimatedRenderLambdaInvokations: number | null, startDate: number | null) => LambdaInvokeStats;
6
+ export declare const getLambdasInvokedStats: (contents: _Object[], renderId: string, startDate: number | null) => LambdaInvokeStats;
@@ -2,20 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLambdasInvokedStats = void 0;
4
4
  const constants_1 = require("../../shared/constants");
5
- const parse_lambda_initialized_key_1 = require("../../shared/parse-lambda-initialized-key");
6
5
  const min_max_1 = require("./min-max");
7
- const getLambdasInvokedStats = (contents, renderId, estimatedRenderLambdaInvokations, startDate) => {
8
- const lambdasInvoked = contents
9
- .filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaInitializedPrefix)(renderId)); })
10
- .filter((c) => (0, parse_lambda_initialized_key_1.parseLambdaInitializedKey)(c.Key).attempt === 1);
11
- const allLambdasInvoked = lambdasInvoked.length === estimatedRenderLambdaInvokations;
12
- const timeToInvokeLambdas = allLambdasInvoked && startDate
13
- ? (0, min_max_1.max)(lambdasInvoked.map((l) => { var _a; return (_a = l.LastModified) === null || _a === void 0 ? void 0 : _a.getTime(); })) -
14
- startDate
15
- : null;
6
+ const getLambdasInvokedStats = (contents, renderId, startDate) => {
7
+ const lambdasInvoked = contents.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaInitializedPrefix)(renderId)); });
8
+ const timeToInvokeLambdas = startDate === null
9
+ ? null
10
+ : (0, min_max_1.max)(lambdasInvoked.map((l) => { var _a; return (_a = l.LastModified) === null || _a === void 0 ? void 0 : _a.getTime(); })) -
11
+ startDate;
16
12
  return {
17
13
  timeToInvokeLambdas,
18
- allLambdasInvoked,
19
14
  lambdasInvoked: lambdasInvoked.length,
20
15
  };
21
16
  };
@@ -23,7 +23,7 @@ const get_time_to_finish_1 = require("./get-time-to-finish");
23
23
  const inspect_errors_1 = require("./inspect-errors");
24
24
  const io_1 = require("./io");
25
25
  const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region, memorySizeInMb, timeoutInMiliseconds, }) => {
26
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
26
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
27
27
  const postRenderData = await (0, get_post_render_data_1.getPostRenderData)({
28
28
  bucketName,
29
29
  region,
@@ -135,7 +135,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
135
135
  const renderSize = contents
136
136
  .map((c) => { var _a; return (_a = c.Size) !== null && _a !== void 0 ? _a : 0; })
137
137
  .reduce((a, b) => a + b, 0);
138
- const lambdasInvokedStats = (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, renderId, (_g = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.estimatedRenderLambdaInvokations) !== null && _g !== void 0 ? _g : null, (_h = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.startedDate) !== null && _h !== void 0 ? _h : null);
138
+ const lambdasInvokedStats = (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, renderId, (_g = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.startedDate) !== null && _g !== void 0 ? _g : null);
139
139
  const retriesInfo = (0, get_retry_stats_1.getRetryStats)({
140
140
  contents,
141
141
  renderId,
@@ -147,7 +147,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
147
147
  lambdaInvokeStatus: lambdasInvokedStats,
148
148
  });
149
149
  const chunkCount = outputFile
150
- ? (_j = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _j !== void 0 ? _j : 0
150
+ ? (_h = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _h !== void 0 ? _h : 0
151
151
  : chunks.length;
152
152
  // We add a 20 second buffer for it, since AWS timeshifts can be quite a lot. Once it's 20sec over the limit, we consider it timed out
153
153
  const isBeyondTimeout = renderMetadata &&
@@ -178,7 +178,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
178
178
  renderId,
179
179
  renderMetadata,
180
180
  bucket: bucketName,
181
- outputFile: (_k = outputFile === null || outputFile === void 0 ? void 0 : outputFile.url) !== null && _k !== void 0 ? _k : null,
181
+ outputFile: (_j = outputFile === null || outputFile === void 0 ? void 0 : outputFile.url) !== null && _j !== void 0 ? _j : null,
182
182
  timeToFinish,
183
183
  errors: allErrors,
184
184
  fatalErrorEncountered: allErrors.some((f) => f.isFatal && !f.willRetry),
@@ -193,7 +193,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
193
193
  type: 'absolute-time',
194
194
  })
195
195
  : null,
196
- timeToInvokeLambdas: (_l = encodingStatus === null || encodingStatus === void 0 ? void 0 : encodingStatus.timeToInvoke) !== null && _l !== void 0 ? _l : lambdasInvokedStats.timeToInvokeLambdas,
196
+ timeToInvokeLambdas: (_k = encodingStatus === null || encodingStatus === void 0 ? void 0 : encodingStatus.timeToInvoke) !== null && _k !== void 0 ? _k : lambdasInvokedStats.timeToInvokeLambdas,
197
197
  overallProgress: (0, get_overall_progress_1.getOverallProgress)({
198
198
  cleanup: cleanup ? cleanup.filesDeleted / cleanup.minFilesToDelete : 0,
199
199
  encoding: finalEncodingStatus && renderMetadata
@@ -13,7 +13,7 @@ export declare type LambdaLSInput = {
13
13
  };
14
14
  export declare type LambdaLsReturnType = Promise<_Object[]>;
15
15
  export declare const lambdaLs: ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }: LambdaLSInput) => LambdaLsReturnType;
16
- export declare const lambdaWriteFile: ({ bucketName, key, body, region, privacy, expectedBucketOwner, }: {
16
+ export declare const lambdaWriteFile: ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, }: {
17
17
  bucketName: string;
18
18
  key: string;
19
19
  body: ReadStream | string;
@@ -7,6 +7,7 @@ exports.lambdaReadFile = exports.lambdaWriteFile = exports.lambdaLs = void 0;
7
7
  const client_s3_1 = require("@aws-sdk/client-s3");
8
8
  const mime_types_1 = __importDefault(require("mime-types"));
9
9
  const aws_clients_1 = require("../../shared/aws-clients");
10
+ const content_disposition_header_1 = require("../../shared/content-disposition-header");
10
11
  const lambdaLs = async ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }) => {
11
12
  var _a, _b, _c;
12
13
  try {
@@ -46,7 +47,7 @@ const lambdaLs = async ({ bucketName, prefix, region, expectedBucketOwner, conti
46
47
  }
47
48
  };
48
49
  exports.lambdaLs = lambdaLs;
49
- const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, }) => {
50
+ const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, }) => {
50
51
  await (0, aws_clients_1.getS3Client)(region).send(new client_s3_1.PutObjectCommand({
51
52
  Bucket: bucketName,
52
53
  Key: key,
@@ -54,6 +55,7 @@ const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expecte
54
55
  ACL: privacy === 'private' ? 'private' : 'public-read',
55
56
  ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
56
57
  ContentType: mime_types_1.default.lookup(key) || 'application/octet-stream',
58
+ ContentDisposition: (0, content_disposition_header_1.getContentDispositionHeader)(downloadBehavior),
57
59
  }));
58
60
  };
59
61
  exports.lambdaWriteFile = lambdaWriteFile;
@@ -1,2 +1,2 @@
1
1
  import type { LambdaRoutines } from '../../defaults';
2
- export declare const printCloudwatchHelper: (type: LambdaRoutines, data: Record<string, string>) => void;
2
+ export declare const printCloudwatchHelper: (type: LambdaRoutines, data: Record<string, string | boolean>) => void;
@@ -1,5 +1,5 @@
1
- import type { ChromiumOptions, openBrowser } from '@remotion/renderer';
2
- import type { FfmpegExecutable, TCompMetadata } from 'remotion';
1
+ import type { ChromiumOptions, DownloadMap, FfmpegExecutable, openBrowser } from '@remotion/renderer';
2
+ import type { TCompMetadata } from 'remotion';
3
3
  import type { Await } from '../../shared/await';
4
4
  declare type ValidateCompositionOptions = {
5
5
  serveUrl: string;
@@ -12,6 +12,7 @@ declare type ValidateCompositionOptions = {
12
12
  timeoutInMilliseconds: number;
13
13
  chromiumOptions: ChromiumOptions;
14
14
  port: number | null;
15
+ downloadMap: DownloadMap;
15
16
  };
16
- export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, }: ValidateCompositionOptions) => Promise<TCompMetadata>;
17
+ export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, downloadMap, }: ValidateCompositionOptions) => Promise<TCompMetadata>;
17
18
  export {};
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateComposition = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
- const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, }) => {
5
+ const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, downloadMap, }) => {
6
6
  const compositions = await (0, renderer_1.getCompositions)(serveUrl, {
7
7
  puppeteerInstance: browserInstance,
8
8
  inputProps: inputProps,
@@ -12,6 +12,7 @@ const validateComposition = async ({ serveUrl, composition, browserInstance, inp
12
12
  timeoutInMilliseconds,
13
13
  chromiumOptions,
14
14
  port,
15
+ downloadMap,
15
16
  });
16
17
  const found = compositions.find((c) => c.id === composition);
17
18
  if (!found) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handler = void 0;
4
- const remotion_1 = require("remotion");
4
+ const renderer_1 = require("@remotion/renderer");
5
5
  const constants_1 = require("../shared/constants");
6
6
  const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
7
7
  const is_warm_1 = require("./helpers/is-warm");
@@ -9,7 +9,7 @@ const print_cloudwatch_helper_1 = require("./helpers/print-cloudwatch-helper");
9
9
  const info_1 = require("./info");
10
10
  const launch_1 = require("./launch");
11
11
  const progress_1 = require("./progress");
12
- const renderer_1 = require("./renderer");
12
+ const renderer_2 = require("./renderer");
13
13
  const start_1 = require("./start");
14
14
  const still_1 = require("./still");
15
15
  const handler = async (params, context) => {
@@ -25,6 +25,7 @@ const handler = async (params, context) => {
25
25
  if (params.type === constants_1.LambdaRoutines.still) {
26
26
  (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.still, {
27
27
  inputProps: JSON.stringify(params.inputProps),
28
+ isWarm,
28
29
  });
29
30
  return (0, still_1.stillHandler)(params, {
30
31
  expectedBucketOwner: currentUserId,
@@ -33,6 +34,7 @@ const handler = async (params, context) => {
33
34
  if (params.type === constants_1.LambdaRoutines.start) {
34
35
  (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.start, {
35
36
  inputProps: JSON.stringify(params.inputProps),
37
+ isWarm,
36
38
  });
37
39
  return (0, start_1.startHandler)(params);
38
40
  }
@@ -40,12 +42,14 @@ const handler = async (params, context) => {
40
42
  (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.launch, {
41
43
  renderId: params.renderId,
42
44
  inputProps: JSON.stringify(params.inputProps),
45
+ isWarm,
43
46
  });
44
47
  return (0, launch_1.launchHandler)(params, { expectedBucketOwner: currentUserId });
45
48
  }
46
49
  if (params.type === constants_1.LambdaRoutines.status) {
47
50
  (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.status, {
48
51
  renderId: params.renderId,
52
+ isWarm,
49
53
  });
50
54
  return (0, progress_1.progressHandler)(params, {
51
55
  expectedBucketOwner: currentUserId,
@@ -56,16 +60,19 @@ const handler = async (params, context) => {
56
60
  (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.renderer, {
57
61
  renderId: params.renderId,
58
62
  chunk: String(params.chunk),
59
- dumpLogs: String(remotion_1.Internals.Logging.isEqualOrBelowLogLevel(params.logLevel, 'verbose')),
63
+ dumpLogs: String(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')),
60
64
  inputProps: JSON.stringify(params.inputProps),
65
+ isWarm,
61
66
  });
62
- return (0, renderer_1.rendererHandler)(params, {
67
+ return (0, renderer_2.rendererHandler)(params, {
63
68
  expectedBucketOwner: currentUserId,
64
69
  isWarm,
65
70
  });
66
71
  }
67
72
  if (params.type === constants_1.LambdaRoutines.info) {
68
- (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.info, {});
73
+ (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.info, {
74
+ isWarm,
75
+ });
69
76
  return (0, info_1.infoHandler)(params);
70
77
  }
71
78
  throw new Error(constants_1.COMMAND_NOT_FOUND);
@@ -46,7 +46,7 @@ const innerLaunchHandler = async (params, options) => {
46
46
  }
47
47
  const startedDate = Date.now();
48
48
  const [browserInstance, optimization] = await Promise.all([
49
- (0, get_browser_instance_1.getBrowserInstance)(remotion_1.Internals.Logging.isEqualOrBelowLogLevel(remotion_1.Internals.Logging.getLogLevel(), 'verbose'), params.chromiumOptions),
49
+ (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'), params.chromiumOptions),
50
50
  (0, s3_optimization_file_1.getOptimization)({
51
51
  bucketName: params.bucketName,
52
52
  siteId: (0, make_s3_url_1.getServeUrlHash)(params.serveUrl),
@@ -55,6 +55,7 @@ const innerLaunchHandler = async (params, options) => {
55
55
  expectedBucketOwner: options.expectedBucketOwner,
56
56
  }),
57
57
  ]);
58
+ const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
58
59
  const comp = await (0, validate_composition_1.validateComposition)({
59
60
  serveUrl: params.serveUrl,
60
61
  composition: params.composition,
@@ -66,11 +67,12 @@ const innerLaunchHandler = async (params, options) => {
66
67
  timeoutInMilliseconds: params.timeoutInMilliseconds,
67
68
  chromiumOptions: params.chromiumOptions,
68
69
  port: null,
70
+ downloadMap,
69
71
  });
70
- remotion_1.Internals.validateDurationInFrames(comp.durationInFrames, 'passed to <Component />');
71
- remotion_1.Internals.validateFps(comp.fps, 'passed to <Component />', null);
72
- remotion_1.Internals.validateDimension(comp.height, 'height', 'passed to <Component />');
73
- remotion_1.Internals.validateDimension(comp.width, 'width', 'passed to <Component />');
72
+ remotion_1.Internals.validateDurationInFrames(comp.durationInFrames, 'passed to a Lambda render');
73
+ remotion_1.Internals.validateFps(comp.fps, 'passed to a Lambda render', false);
74
+ remotion_1.Internals.validateDimension(comp.height, 'height', 'passed to a Lambda render');
75
+ remotion_1.Internals.validateDimension(comp.width, 'width', 'passed to a Lambda render');
74
76
  renderer_1.RenderInternals.validateConcurrency(params.concurrencyPerLambda, 'concurrencyPerLambda');
75
77
  const realFrameRange = renderer_1.RenderInternals.getRealFrameRange(comp.durationInFrames, params.frameRange);
76
78
  const frameCount = renderer_1.RenderInternals.getFramesToRender(realFrameRange, params.everyNthFrame);
@@ -118,7 +120,7 @@ const innerLaunchHandler = async (params, options) => {
118
120
  proResProfile: params.proResProfile,
119
121
  quality: params.quality,
120
122
  privacy: params.privacy,
121
- logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : remotion_1.Internals.Logging.DEFAULT_LOG_LEVEL,
123
+ logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
122
124
  attempt: 1,
123
125
  timeoutInMilliseconds: params.timeoutInMilliseconds,
124
126
  chromiumOptions: params.chromiumOptions,
@@ -293,7 +295,7 @@ const innerLaunchHandler = async (params, options) => {
293
295
  framesEncoded: frameCount.length,
294
296
  totalFrames: frameCount.length,
295
297
  doneIn: encodingStop ? encodingStop - encodingStart : null,
296
- timeToInvoke: (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, params.renderId, renderMetadata.estimatedRenderLambdaInvokations, renderMetadata.startedDate).timeToInvokeLambdas,
298
+ timeToInvoke: (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, params.renderId, renderMetadata.startedDate).timeToInvokeLambdas,
297
299
  };
298
300
  const finalEncodingProgressProm = (0, io_1.lambdaWriteFile)({
299
301
  bucketName: params.bucketName,
@@ -321,7 +323,7 @@ const innerLaunchHandler = async (params, options) => {
321
323
  contents,
322
324
  jobs,
323
325
  });
324
- const postRenderData = await (0, create_post_render_data_1.createPostRenderData)({
326
+ const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
325
327
  expectedBucketOwner: options.expectedBucketOwner,
326
328
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
327
329
  renderId: params.renderId,
@@ -8,7 +8,6 @@ const client_lambda_1 = require("@aws-sdk/client-lambda");
8
8
  const renderer_1 = require("@remotion/renderer");
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
- const remotion_1 = require("remotion");
12
11
  const aws_clients_1 = require("../shared/aws-clients");
13
12
  const constants_1 = require("../shared/constants");
14
13
  const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
@@ -23,8 +22,7 @@ const renderHandler = async (params, options, logs) => {
23
22
  if (params.type !== constants_1.LambdaRoutines.renderer) {
24
23
  throw new Error('Params must be renderer');
25
24
  }
26
- remotion_1.Internals.Logging.setLogLevel(params.logLevel);
27
- const browserInstance = await (0, get_browser_instance_1.getBrowserInstance)(remotion_1.Internals.Logging.isEqualOrBelowLogLevel(params.logLevel, 'verbose'), (_a = params.chromiumOptions) !== null && _a !== void 0 ? _a : {});
25
+ const browserInstance = await (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'), (_a = params.chromiumOptions) !== null && _a !== void 0 ? _a : {});
28
26
  const outputPath = renderer_1.RenderInternals.tmpDir('remotion-render-');
29
27
  if (typeof params.chunk !== 'number') {
30
28
  throw new Error('must pass chunk');
@@ -42,6 +40,7 @@ const renderHandler = async (params, options, logs) => {
42
40
  const outdir = renderer_1.RenderInternals.tmpDir(constants_1.RENDERER_PATH_TOKEN);
43
41
  const outputLocation = path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(params.codec, 'chunk')}`);
44
42
  const chunkCodec = params.codec === 'gif' ? 'h264-mkv' : params.codec;
43
+ const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
45
44
  await (0, renderer_1.renderMedia)({
46
45
  composition: {
47
46
  id: params.composition,
@@ -55,7 +54,7 @@ const renderHandler = async (params, options, logs) => {
55
54
  frameRange: params.frameRange,
56
55
  onProgress: ({ renderedFrames, encodedFrames, stitchStage }) => {
57
56
  if (renderedFrames % 10 === 0 &&
58
- remotion_1.Internals.Logging.isEqualOrBelowLogLevel(params.logLevel, 'verbose')) {
57
+ renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')) {
59
58
  console.log(`Rendered ${renderedFrames} frames, encoded ${encodedFrames} frames, stage = ${stitchStage}`);
60
59
  }
61
60
  const allFrames = renderer_1.RenderInternals.getFramesToRender(params.frameRange, params.everyNthFrame);
@@ -91,7 +90,8 @@ const renderHandler = async (params, options, logs) => {
91
90
  serveUrl: params.serveUrl,
92
91
  quality: params.quality,
93
92
  envVariables: params.envVariables,
94
- dumpBrowserLogs: remotion_1.Internals.Logging.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
93
+ dumpBrowserLogs: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
94
+ verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
95
95
  onBrowserLog: (log) => {
96
96
  logs.push(log);
97
97
  },
@@ -112,6 +112,7 @@ const renderHandler = async (params, options, logs) => {
112
112
  port: null,
113
113
  everyNthFrame: params.everyNthFrame,
114
114
  numberOfGifLoops: null,
115
+ downloadMap,
115
116
  });
116
117
  const endRendered = Date.now();
117
118
  console.log('Adding silent audio, chunk', params.chunk);
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startHandler = void 0;
4
4
  const client_lambda_1 = require("@aws-sdk/client-lambda");
5
- const remotion_1 = require("remotion");
6
5
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
7
6
  const aws_clients_1 = require("../shared/aws-clients");
8
7
  const constants_1 = require("../shared/constants");
@@ -34,7 +33,7 @@ const startHandler = async (params) => {
34
33
  quality: params.quality,
35
34
  maxRetries: params.maxRetries,
36
35
  privacy: params.privacy,
37
- logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : remotion_1.Internals.Logging.DEFAULT_LOG_LEVEL,
36
+ logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
38
37
  frameRange: params.frameRange,
39
38
  outName: params.outName,
40
39
  timeoutInMilliseconds: params.timeoutInMilliseconds,
@@ -8,13 +8,13 @@ const client_lambda_1 = require("@aws-sdk/client-lambda");
8
8
  const renderer_1 = require("@remotion/renderer");
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
- const remotion_1 = require("remotion");
12
11
  const estimate_price_1 = require("../api/estimate-price");
13
12
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
14
13
  const aws_clients_1 = require("../shared/aws-clients");
15
14
  const constants_1 = require("../shared/constants");
16
15
  const make_s3_url_1 = require("../shared/make-s3-url");
17
16
  const random_hash_1 = require("../shared/random-hash");
17
+ const validate_download_behavior_1 = require("../shared/validate-download-behavior");
18
18
  const validate_outname_1 = require("../shared/validate-outname");
19
19
  const validate_privacy_1 = require("../shared/validate-privacy");
20
20
  const expected_out_name_1 = require("./helpers/expected-out-name");
@@ -27,10 +27,11 @@ const io_1 = require("./helpers/io");
27
27
  const validate_composition_1 = require("./helpers/validate-composition");
28
28
  const write_lambda_error_1 = require("./helpers/write-lambda-error");
29
29
  const innerStillHandler = async (lambdaParams, renderId, options) => {
30
- var _a, _b, _c;
30
+ var _a, _b;
31
31
  if (lambdaParams.type !== constants_1.LambdaRoutines.still) {
32
32
  throw new TypeError('Expected still type');
33
33
  }
34
+ (0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
34
35
  (0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy);
35
36
  (0, validate_outname_1.validateOutname)(lambdaParams.outName);
36
37
  const start = Date.now();
@@ -38,10 +39,11 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
38
39
  (0, get_or_create_bucket_1.getOrCreateBucket)({
39
40
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
40
41
  }),
41
- (0, get_browser_instance_1.getBrowserInstance)(remotion_1.Internals.Logging.isEqualOrBelowLogLevel((_a = lambdaParams.logLevel) !== null && _a !== void 0 ? _a : remotion_1.Internals.Logging.DEFAULT_LOG_LEVEL, 'verbose'), (_b = lambdaParams.chromiumOptions) !== null && _b !== void 0 ? _b : {}),
42
+ (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_a = lambdaParams.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
42
43
  ]);
43
44
  const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
44
45
  const outputPath = path_1.default.join(outputDir, 'output');
46
+ const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
45
47
  const composition = await (0, validate_composition_1.validateComposition)({
46
48
  serveUrl: lambdaParams.serveUrl,
47
49
  browserInstance,
@@ -53,6 +55,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
53
55
  chromiumOptions: lambdaParams.chromiumOptions,
54
56
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
55
57
  port: null,
58
+ downloadMap,
56
59
  });
57
60
  const renderMetadata = {
58
61
  startedDate: Date.now(),
@@ -72,7 +75,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
72
75
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
73
76
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
74
77
  renderId,
75
- outName: (_c = lambdaParams.outName) !== null && _c !== void 0 ? _c : undefined,
78
+ outName: (_b = lambdaParams.outName) !== null && _b !== void 0 ? _b : undefined,
76
79
  };
77
80
  await (0, io_1.lambdaWriteFile)({
78
81
  bucketName,
@@ -98,6 +101,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
98
101
  chromiumOptions: lambdaParams.chromiumOptions,
99
102
  scale: lambdaParams.scale,
100
103
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
104
+ downloadMap,
101
105
  });
102
106
  const { key, renderBucketName } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName);
103
107
  const { size } = await fs_1.default.promises.stat(outputPath);
@@ -1,6 +1 @@
1
- export declare const bundleSite: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: {
2
- webpackOverride?: import("remotion").WebpackOverrideFn | undefined;
3
- outDir?: string | undefined;
4
- enableCaching?: boolean | undefined;
5
- publicPath?: string | undefined;
6
- } | undefined) => Promise<string>;
1
+ export declare const bundleSite: (entryPoint: string, onProgressUpdate?: ((progress: number) => void) | undefined, options?: import("@remotion/bundler").BundleOptions | undefined) => Promise<string>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkCredentials = void 0;
4
- const remotion_1 = require("remotion");
5
4
  const is_cli_1 = require("../cli/is-cli");
6
5
  const docs_url_1 = require("./docs-url");
6
+ const truthy_1 = require("./truthy");
7
7
  const messageForVariable = (variable) => {
8
8
  return [
9
9
  `You have tried to call a Remotion Lambda function, but have not set the environment variable ${variable}.`,
@@ -13,7 +13,7 @@ const messageForVariable = (variable) => {
13
13
  `- Please refer to the Remotion Lambda docs (${docs_url_1.DOCS_URL}/docs/lambda/setup) to see how to generate the credentials for your AWS account and then set the environment variables.`,
14
14
  `- For more reasons see the troubleshooting page: ${docs_url_1.DOCS_URL}/docs/lambda/troubleshooting/permissions`,
15
15
  ]
16
- .filter(remotion_1.Internals.truthy)
16
+ .filter(truthy_1.truthy)
17
17
  .join('\n');
18
18
  };
19
19
  const checkCredentials = () => {
@@ -1,5 +1,5 @@
1
- import type { ChromiumOptions } from '@remotion/renderer';
2
- import type { Codec, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile, VideoConfig } from 'remotion';
1
+ import type { ChromiumOptions, Codec, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
2
+ import type { VideoConfig } from 'remotion';
3
3
  import type { ChunkRetry } from '../functions/helpers/get-retry-stats';
4
4
  import type { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
5
5
  import type { AwsRegion } from '../pricing/aws-regions';
@@ -224,7 +224,7 @@ export declare type RenderMetadata = {
224
224
  renderId: string;
225
225
  outName: OutNameInput | undefined;
226
226
  };
227
- export declare type LambdaVersions = '2022-07-20' | '2022-07-18' | '2022-07-15' | '2022-07-14' | '2022-07-12' | '2022-07-10' | '2022-07-09' | '2022-07-08' | '2022-07-04' | '2022-06-30' | '2022-06-29' | '2022-06-25' | '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
227
+ export declare type LambdaVersions = '2022-07-27' | '2022-07-25' | '2022-07-23' | '2022-07-20' | '2022-07-18' | '2022-07-15' | '2022-07-14' | '2022-07-12' | '2022-07-10' | '2022-07-09' | '2022-07-08' | '2022-07-04' | '2022-06-30' | '2022-06-29' | '2022-06-25' | '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
228
228
  export declare const CURRENT_VERSION: LambdaVersions;
229
229
  export declare type PostRenderData = {
230
230
  cost: {
@@ -84,6 +84,6 @@ var LambdaRoutines;
84
84
  LambdaRoutines["renderer"] = "renderer";
85
85
  LambdaRoutines["still"] = "still";
86
86
  })(LambdaRoutines = exports.LambdaRoutines || (exports.LambdaRoutines = {}));
87
- exports.CURRENT_VERSION = '2022-07-20';
87
+ exports.CURRENT_VERSION = '2022-07-27';
88
88
  exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
89
89
  exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
@@ -0,0 +1,3 @@
1
+ declare type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
2
+ export declare function truthy<T>(value: T): value is Truthy<T>;
3
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.truthy = void 0;
4
+ function truthy(value) {
5
+ return Boolean(value);
6
+ }
7
+ exports.truthy = truthy;
@@ -1,3 +1 @@
1
- export declare const MAX_PRESIGN_EXPIRATION = 604800;
2
- export declare const MIN_PRESIGN_EXPIRATION = 1;
3
1
  export declare const validatePresignExpiration: (presignExpiration: unknown) => void;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validatePresignExpiration = exports.MIN_PRESIGN_EXPIRATION = exports.MAX_PRESIGN_EXPIRATION = void 0;
4
- exports.MAX_PRESIGN_EXPIRATION = 604800;
5
- exports.MIN_PRESIGN_EXPIRATION = 1;
3
+ exports.validatePresignExpiration = void 0;
4
+ const MAX_PRESIGN_EXPIRATION = 604800;
5
+ const MIN_PRESIGN_EXPIRATION = 1;
6
6
  const validatePresignExpiration = (presignExpiration) => {
7
7
  if (typeof presignExpiration === 'undefined' || presignExpiration === null) {
8
8
  return;
@@ -19,11 +19,11 @@ const validatePresignExpiration = (presignExpiration) => {
19
19
  if (presignExpiration % 1 !== 0) {
20
20
  throw new TypeError(`'expiresIn' should be an integer but is ${JSON.stringify(presignExpiration)}`);
21
21
  }
22
- if (presignExpiration > exports.MAX_PRESIGN_EXPIRATION) {
23
- throw new TypeError(`The 'expiresIn' parameter must be less or equal than ${exports.MAX_PRESIGN_EXPIRATION} (7 days) as enforced by AWS`);
22
+ if (presignExpiration > MAX_PRESIGN_EXPIRATION) {
23
+ throw new TypeError(`The 'expiresIn' parameter must be less or equal than ${MAX_PRESIGN_EXPIRATION} (7 days) as enforced by AWS`);
24
24
  }
25
- if (presignExpiration < exports.MIN_PRESIGN_EXPIRATION) {
26
- throw new TypeError(`The 'expiresIn' parameter must be greater or equal than ${exports.MIN_PRESIGN_EXPIRATION}`);
25
+ if (presignExpiration < MIN_PRESIGN_EXPIRATION) {
26
+ throw new TypeError(`The 'expiresIn' parameter must be greater or equal than ${MIN_PRESIGN_EXPIRATION}`);
27
27
  }
28
28
  };
29
29
  exports.validatePresignExpiration = validatePresignExpiration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "3.1.4",
3
+ "version": "3.1.7",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "module": "true",
11
11
  "scripts": {
12
+ "prepublish": "node ensure-version-match.js",
12
13
  "testintegration": "jest src/test/integration --runInBand",
13
14
  "lint": "eslint src --ext ts,tsx",
14
15
  "test": "jest src/test/unit",
@@ -31,12 +32,12 @@
31
32
  "@aws-sdk/client-service-quotas": "3.58.0",
32
33
  "@aws-sdk/lib-storage": "3.58.0",
33
34
  "@aws-sdk/s3-request-presigner": "3.58.0",
34
- "@remotion/bundler": "3.1.4",
35
- "@remotion/cli": "3.1.4",
36
- "@remotion/renderer": "3.1.4",
35
+ "@remotion/bundler": "3.1.7",
36
+ "@remotion/cli": "3.1.7",
37
+ "@remotion/renderer": "3.1.7",
37
38
  "aws-policies": "^1.0.1",
38
39
  "mime-types": "2.1.34",
39
- "remotion": "3.1.4"
40
+ "remotion": "3.1.7"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "react": ">=16.8.0",
@@ -61,5 +62,5 @@
61
62
  "publishConfig": {
62
63
  "access": "public"
63
64
  },
64
- "gitHead": "cb662e72c635e5e70c5541d85e276ce2f4075099"
65
+ "gitHead": "599379fef6043a7125d1979766f915580ec1cf77"
65
66
  }
Binary file
@@ -1,6 +0,0 @@
1
- export declare const formatBytes: (number: number, options?: Intl.NumberFormatOptions & {
2
- locale: string;
3
- bits?: boolean;
4
- binary?: boolean;
5
- signed: boolean;
6
- }) => string;
@@ -1,103 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatBytes = void 0;
4
- const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
5
- const BIBYTE_UNITS = [
6
- 'B',
7
- 'kiB',
8
- 'MiB',
9
- 'GiB',
10
- 'TiB',
11
- 'PiB',
12
- 'EiB',
13
- 'ZiB',
14
- 'YiB',
15
- ];
16
- const BIT_UNITS = [
17
- 'b',
18
- 'kbit',
19
- 'Mbit',
20
- 'Gbit',
21
- 'Tbit',
22
- 'Pbit',
23
- 'Ebit',
24
- 'Zbit',
25
- 'Ybit',
26
- ];
27
- const BIBIT_UNITS = [
28
- 'b',
29
- 'kibit',
30
- 'Mibit',
31
- 'Gibit',
32
- 'Tibit',
33
- 'Pibit',
34
- 'Eibit',
35
- 'Zibit',
36
- 'Yibit',
37
- ];
38
- /*
39
- Formats the given number using `Number#toLocaleString`.
40
- - If locale is a string, the value is expected to be a locale-key (for example: `de`).
41
- - If locale is true, the system default locale is used for translation.
42
- - If no value for locale is specified, the number is returned unmodified.
43
- */
44
- const toLocaleString = (number, locale, options) => {
45
- if (typeof locale === 'string' || Array.isArray(locale)) {
46
- return number.toLocaleString(locale, options);
47
- }
48
- if (locale === true || options !== undefined) {
49
- return number.toLocaleString(undefined, options);
50
- }
51
- return String(number);
52
- };
53
- const formatBytes = (number, options = {
54
- locale: 'en-US',
55
- signed: false,
56
- maximumFractionDigits: 1,
57
- }) => {
58
- if (!Number.isFinite(number)) {
59
- throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
60
- }
61
- options = { bits: false, binary: false, ...options };
62
- const UNITS = options.bits
63
- ? options.binary
64
- ? BIBIT_UNITS
65
- : BIT_UNITS
66
- : options.binary
67
- ? BIBYTE_UNITS
68
- : BYTE_UNITS;
69
- if (options.signed && number === 0) {
70
- return `0 $ {
71
- UNITS[0]
72
- }`;
73
- }
74
- const isNegative = number < 0;
75
- const prefix = isNegative ? '-' : options.signed ? '+' : '';
76
- if (isNegative) {
77
- number = -number;
78
- }
79
- let localeOptions;
80
- if (options.minimumFractionDigits !== undefined) {
81
- localeOptions = {
82
- minimumFractionDigits: options.minimumFractionDigits,
83
- };
84
- }
85
- if (options.maximumFractionDigits !== undefined) {
86
- localeOptions = {
87
- maximumFractionDigits: options.maximumFractionDigits,
88
- ...localeOptions,
89
- };
90
- }
91
- if (number < 1) {
92
- const numString = toLocaleString(number, options.locale, localeOptions);
93
- return prefix + numString + ' ' + UNITS[0];
94
- }
95
- const exponent = Math.min(Math.floor(options.binary
96
- ? Math.log(number) / Math.log(1024)
97
- : Math.log10(number) / 3), UNITS.length - 1);
98
- number /= (options.binary ? 1024 : 1000) ** exponent;
99
- const numberString = toLocaleString(Number(number), options.locale, localeOptions);
100
- const unit = UNITS[exponent];
101
- return prefix + numberString + ' ' + unit;
102
- };
103
- exports.formatBytes = formatBytes;
@@ -1 +0,0 @@
1
- export declare const chunk: <T>(input: T[], size: number) => T[][];
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chunk = void 0;
4
- const chunk = (input, size) => {
5
- return input.reduce((arr, item, idx) => {
6
- return idx % size === 0
7
- ? [...arr, [item]]
8
- : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
9
- }, []);
10
- };
11
- exports.chunk = chunk;