@remotion/lambda 4.0.0-alpha13 → 4.0.0-alpha14

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 (74) hide show
  1. package/dist/api/delete-function.d.ts +1 -1
  2. package/dist/api/delete-render.d.ts +1 -1
  3. package/dist/api/delete-site.d.ts +2 -2
  4. package/dist/api/deploy-function.d.ts +2 -2
  5. package/dist/api/deploy-site.d.ts +2 -2
  6. package/dist/api/download-media.d.ts +2 -2
  7. package/dist/api/estimate-price.d.ts +1 -1
  8. package/dist/api/get-aws-client.d.ts +3 -3
  9. package/dist/api/get-buckets.d.ts +1 -1
  10. package/dist/api/get-compositions-on-lambda.d.ts +2 -2
  11. package/dist/api/get-function-info.d.ts +2 -2
  12. package/dist/api/get-functions.d.ts +1 -1
  13. package/dist/api/get-or-create-bucket.d.ts +2 -2
  14. package/dist/api/get-regions.d.ts +1 -1
  15. package/dist/api/get-render-progress.d.ts +1 -1
  16. package/dist/api/get-sites.d.ts +3 -3
  17. package/dist/api/iam-validation/simulate-rule.d.ts +2 -2
  18. package/dist/api/iam-validation/simulate.d.ts +2 -2
  19. package/dist/api/iam-validation/simulate.js +1 -1
  20. package/dist/api/presign-url.d.ts +1 -1
  21. package/dist/api/render-media-on-lambda.d.ts +2 -2
  22. package/dist/api/render-still-on-lambda.d.ts +2 -2
  23. package/dist/api/speculate-function-name.d.ts +1 -1
  24. package/dist/api/upload-dir.d.ts +2 -2
  25. package/dist/cli/args.d.ts +1 -1
  26. package/dist/cli/commands/render/progress.d.ts +4 -4
  27. package/dist/cli/commands/render/render.js +9 -1
  28. package/dist/cli/commands/still.js +9 -1
  29. package/dist/cli/helpers/progress-bar.d.ts +4 -4
  30. package/dist/cli/log.d.ts +1 -0
  31. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  32. package/dist/functions/chunk-optimization/types.d.ts +2 -2
  33. package/dist/functions/compositions.d.ts +1 -1
  34. package/dist/functions/compositions.js +11 -7
  35. package/dist/functions/helpers/find-output-file-in-bucket.d.ts +1 -1
  36. package/dist/functions/helpers/get-browser-instance.d.ts +1 -2
  37. package/dist/functions/helpers/get-browser-instance.js +4 -1
  38. package/dist/functions/helpers/get-current-architecture.d.ts +2 -0
  39. package/dist/functions/helpers/get-current-architecture.js +11 -0
  40. package/dist/functions/helpers/get-files-in-folder.d.ts +1 -1
  41. package/dist/functions/helpers/get-files-to-delete.d.ts +1 -1
  42. package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -1
  43. package/dist/functions/helpers/get-retry-stats.d.ts +1 -1
  44. package/dist/functions/helpers/io.d.ts +3 -3
  45. package/dist/functions/helpers/read-with-progress.d.ts +1 -1
  46. package/dist/functions/helpers/validate-composition.d.ts +5 -5
  47. package/dist/functions/helpers/validate-composition.js +5 -3
  48. package/dist/functions/helpers/write-lambda-error.d.ts +2 -2
  49. package/dist/functions/index.js +1 -1
  50. package/dist/functions/launch.d.ts +1 -1
  51. package/dist/functions/launch.js +6 -8
  52. package/dist/functions/progress.d.ts +1 -1
  53. package/dist/functions/renderer.d.ts +1 -1
  54. package/dist/functions/renderer.js +13 -12
  55. package/dist/functions/start.d.ts +1 -1
  56. package/dist/functions/still.d.ts +1 -1
  57. package/dist/functions/still.js +25 -11
  58. package/dist/pricing/aws-regions.d.ts +1 -1
  59. package/dist/shared/await.d.ts +1 -1
  60. package/dist/shared/aws-clients.d.ts +3 -3
  61. package/dist/shared/constants.d.ts +18 -18
  62. package/dist/shared/content-disposition-header.d.ts +1 -1
  63. package/dist/shared/get-most-expensive-chunks.d.ts +1 -1
  64. package/dist/shared/hosted-layers.d.ts +1 -1
  65. package/dist/shared/invoke-webhook.d.ts +2 -2
  66. package/dist/shared/parse-lambda-timings-key.d.ts +1 -1
  67. package/dist/shared/return-values.d.ts +1 -1
  68. package/dist/shared/truthy.d.ts +1 -1
  69. package/dist/shared/validate-architecture.d.ts +4 -0
  70. package/dist/shared/validate-architecture.js +14 -0
  71. package/dist/shared/validate-lambda-codec.d.ts +1 -1
  72. package/dist/shared/validate-outname.js +12 -12
  73. package/package.json +11 -11
  74. package/remotionlambda-arm64.zip +0 -0
@@ -6,14 +6,14 @@ import type { AwsRegion } from '../../pricing/aws-regions';
6
6
  import type { CustomCredentials } from '../../shared/aws-clients';
7
7
  import type { Privacy } from '../../shared/constants';
8
8
  import type { DownloadBehavior } from '../../shared/content-disposition-header';
9
- export declare type LambdaLSInput = {
9
+ export type LambdaLSInput = {
10
10
  bucketName: string;
11
11
  prefix: string;
12
12
  region: AwsRegion;
13
13
  expectedBucketOwner: string | null;
14
14
  continuationToken?: string;
15
15
  };
16
- export declare type LambdaLsReturnType = Promise<_Object[]>;
16
+ export type LambdaLsReturnType = Promise<_Object[]>;
17
17
  export declare const lambdaLs: ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }: LambdaLSInput) => LambdaLsReturnType;
18
18
  export declare const lambdaDeleteFile: ({ bucketName, key, region, customCredentials, }: {
19
19
  region: AwsRegion;
@@ -21,7 +21,7 @@ export declare const lambdaDeleteFile: ({ bucketName, key, region, customCredent
21
21
  key: string;
22
22
  customCredentials: CustomCredentials | null;
23
23
  }) => Promise<void>;
24
- declare type LambdaWriteFileInput = {
24
+ type LambdaWriteFileInput = {
25
25
  bucketName: string;
26
26
  key: string;
27
27
  body: ReadStream | string;
@@ -1,6 +1,6 @@
1
1
  import type { AwsRegion } from '../../pricing/aws-regions';
2
2
  import type { CustomCredentials } from '../../shared/aws-clients';
3
- export declare type LambdaReadFileProgress = (progress: {
3
+ export type LambdaReadFileProgress = (progress: {
4
4
  totalSize: number;
5
5
  downloaded: number;
6
6
  percent: number;
@@ -1,19 +1,19 @@
1
- import type { ChromiumOptions, DownloadMap, LogLevel, openBrowser } from '@remotion/renderer';
1
+ import type { ChromiumOptions, LogLevel, openBrowser, RemotionServer } from '@remotion/renderer';
2
2
  import type { AnyCompMetadata } from 'remotion';
3
3
  import type { Await } from '../../shared/await';
4
- declare type ValidateCompositionOptions = {
4
+ type ValidateCompositionOptions = {
5
5
  serveUrl: string;
6
6
  composition: string;
7
7
  browserInstance: Await<ReturnType<typeof openBrowser>>;
8
8
  inputProps: Record<string, unknown>;
9
- envVariables: Record<string, string> | undefined;
9
+ envVariables: Record<string, string>;
10
10
  timeoutInMilliseconds: number;
11
11
  chromiumOptions: ChromiumOptions;
12
12
  port: number | null;
13
- downloadMap: DownloadMap;
14
13
  forceHeight: number | null;
15
14
  forceWidth: number | null;
16
15
  logLevel: LogLevel;
16
+ server: RemotionServer | undefined;
17
17
  };
18
- export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, chromiumOptions, port, downloadMap, forceHeight, forceWidth, logLevel, }: ValidateCompositionOptions) => Promise<AnyCompMetadata>;
18
+ export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, }: ValidateCompositionOptions) => Promise<AnyCompMetadata>;
19
19
  export {};
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateComposition = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  const get_chromium_executable_path_1 = require("./get-chromium-executable-path");
6
- const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, chromiumOptions, port, downloadMap, forceHeight, forceWidth, logLevel, }) => {
7
- const comp = await (0, renderer_1.selectComposition)({
6
+ const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, }) => {
7
+ const comp = await renderer_1.RenderInternals.internalSelectComposition({
8
8
  id: composition,
9
9
  puppeteerInstance: browserInstance,
10
10
  inputProps,
@@ -12,10 +12,12 @@ const validateComposition = async ({ serveUrl, composition, browserInstance, inp
12
12
  timeoutInMilliseconds,
13
13
  chromiumOptions,
14
14
  port,
15
- downloadMap,
16
15
  browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
17
16
  serveUrl,
18
17
  verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
18
+ indent: false,
19
+ onBrowserLog: null,
20
+ server,
19
21
  });
20
22
  return {
21
23
  ...comp,
@@ -1,5 +1,5 @@
1
1
  import type { FileNameAndSize } from './get-files-in-folder';
2
- export declare type LambdaErrorInfo = {
2
+ export type LambdaErrorInfo = {
3
3
  type: 'renderer' | 'browser' | 'stitcher' | 'webhook';
4
4
  message: string;
5
5
  name: string;
@@ -16,7 +16,7 @@ export declare type LambdaErrorInfo = {
16
16
  } | null;
17
17
  };
18
18
  export declare const getTmpDirStateIfENoSp: (err: string) => LambdaErrorInfo['tmpDir'];
19
- export declare type EnhancedErrorInfo = LambdaErrorInfo & {
19
+ export type EnhancedErrorInfo = LambdaErrorInfo & {
20
20
  s3Location: string;
21
21
  explanation: string | null;
22
22
  };
@@ -17,7 +17,7 @@ const still_1 = require("./still");
17
17
  exports.handler = (0, streamify_response_1.streamifyResponse)(async (params, responseStream, context) => {
18
18
  process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
19
19
  const timeoutInMilliseconds = context.getRemainingTimeInMillis();
20
- if (!context || !context.invokedFunctionArn) {
20
+ if (!(context === null || context === void 0 ? void 0 : context.invokedFunctionArn)) {
21
21
  throw new Error('Lambda function unexpectedly does not have context.invokedFunctionArn');
22
22
  }
23
23
  (0, clean_tmpdir_1.deleteTmpDir)();
@@ -1,5 +1,5 @@
1
1
  import type { LambdaPayload } from '../shared/constants';
2
- declare type Options = {
2
+ type Options = {
3
3
  expectedBucketOwner: string;
4
4
  getRemainingTimeInMillis: () => number;
5
5
  };
@@ -84,7 +84,7 @@ const callFunctionWithRetry = async ({ payload, retries, functionName, }) => {
84
84
  }
85
85
  };
86
86
  const innerLaunchHandler = async (params, options) => {
87
- var _a, _b, _c, _d, _e;
87
+ var _a, _b, _c, _d, _e, _f;
88
88
  if (params.type !== constants_1.LambdaRoutines.launch) {
89
89
  throw new Error('Expected launch type');
90
90
  }
@@ -136,7 +136,6 @@ const innerLaunchHandler = async (params, options) => {
136
136
  }
137
137
  }, Math.max(options.getRemainingTimeInMillis() - 1000, 1000));
138
138
  const browserInstance = await (0, get_browser_instance_1.getBrowserInstance)(verbose, params.chromiumOptions);
139
- const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
140
139
  const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
141
140
  bucketName: params.bucketName,
142
141
  expectedBucketOwner: options.expectedBucketOwner,
@@ -148,14 +147,14 @@ const innerLaunchHandler = async (params, options) => {
148
147
  composition: params.composition,
149
148
  browserInstance,
150
149
  inputProps: await inputPropsPromise,
151
- envVariables: params.envVariables,
150
+ envVariables: (_b = params.envVariables) !== null && _b !== void 0 ? _b : {},
152
151
  timeoutInMilliseconds: params.timeoutInMilliseconds,
153
152
  chromiumOptions: params.chromiumOptions,
154
153
  port: null,
155
- downloadMap,
156
154
  forceHeight: params.forceHeight,
157
155
  forceWidth: params.forceWidth,
158
156
  logLevel: params.logLevel,
157
+ server: undefined,
159
158
  });
160
159
  remotion_1.Internals.validateDurationInFrames({
161
160
  durationInFrames: comp.durationInFrames,
@@ -170,7 +169,7 @@ const innerLaunchHandler = async (params, options) => {
170
169
  renderer_1.RenderInternals.validateConcurrency(params.concurrencyPerLambda, 'concurrencyPerLambda');
171
170
  const realFrameRange = renderer_1.RenderInternals.getRealFrameRange(comp.durationInFrames, params.frameRange);
172
171
  const frameCount = renderer_1.RenderInternals.getFramesToRender(realFrameRange, params.everyNthFrame);
173
- const framesPerLambda = (_b = params.framesPerLambda) !== null && _b !== void 0 ? _b : (0, best_frames_per_lambda_param_1.bestFramesPerLambdaParam)(frameCount.length);
172
+ const framesPerLambda = (_c = params.framesPerLambda) !== null && _c !== void 0 ? _c : (0, best_frames_per_lambda_param_1.bestFramesPerLambdaParam)(frameCount.length);
174
173
  (0, validate_frames_per_lambda_1.validateFramesPerLambda)({
175
174
  framesPerLambda,
176
175
  durationInFrames: frameCount.length,
@@ -253,7 +252,7 @@ const innerLaunchHandler = async (params, options) => {
253
252
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
254
253
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
255
254
  renderId: params.renderId,
256
- outName: (_c = params.outName) !== null && _c !== void 0 ? _c : undefined,
255
+ outName: (_d = params.outName) !== null && _d !== void 0 ? _d : undefined,
257
256
  privacy: params.privacy,
258
257
  everyNthFrame: params.everyNthFrame,
259
258
  frameRange: realFrameRange,
@@ -261,7 +260,7 @@ const innerLaunchHandler = async (params, options) => {
261
260
  };
262
261
  const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
263
262
  ? null
264
- : (_e = (_d = params.outName) === null || _d === void 0 ? void 0 : _d.s3OutputProvider) !== null && _e !== void 0 ? _e : null);
263
+ : (_f = (_e = params.outName) === null || _e === void 0 ? void 0 : _e.s3OutputProvider) !== null && _f !== void 0 ? _f : null);
265
264
  const output = await (0, find_output_file_in_bucket_1.findOutputFileInBucket)({
266
265
  bucketName: params.bucketName,
267
266
  customCredentials,
@@ -471,7 +470,6 @@ const innerLaunchHandler = async (params, options) => {
471
470
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
472
471
  customCredentials: null,
473
472
  });
474
- renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
475
473
  await Promise.all([cleanupChunksProm, node_fs_1.default.promises.rm(outfile)]);
476
474
  clearTimeout(webhookDueToTimeout);
477
475
  if (params.webhook && !webhookInvoked) {
@@ -1,5 +1,5 @@
1
1
  import type { LambdaPayload, RenderProgress } from '../shared/constants';
2
- declare type Options = {
2
+ type Options = {
3
3
  expectedBucketOwner: string;
4
4
  timeoutInMilliseconds: number;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import type { LambdaPayload } from '../shared/constants';
2
- declare type Options = {
2
+ type Options = {
3
3
  expectedBucketOwner: string;
4
4
  isWarm: boolean;
5
5
  };
@@ -55,12 +55,11 @@ const renderHandler = async (params, options, logs) => {
55
55
  codec: params.codec,
56
56
  preferLossless: true,
57
57
  }))}`);
58
- const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
59
58
  const downloads = {};
60
59
  const inputProps = await inputPropsPromise;
61
60
  await new Promise((resolve, reject) => {
62
- var _a, _b;
63
- (0, renderer_1.renderMedia)({
61
+ var _a, _b, _c, _d, _e;
62
+ renderer_1.RenderInternals.internalRenderMedia({
64
63
  composition: {
65
64
  id: params.composition,
66
65
  durationInFrames: params.durationInFrames,
@@ -103,17 +102,17 @@ const renderHandler = async (params, options, logs) => {
103
102
  },
104
103
  puppeteerInstance: browserInstance,
105
104
  serveUrl: params.serveUrl,
106
- jpegQuality: params.jpegQuality,
107
- envVariables: params.envVariables,
108
- dumpBrowserLogs: (_a = params.dumpBrowserLogs) !== null && _a !== void 0 ? _a : renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
105
+ jpegQuality: (_a = params.jpegQuality) !== null && _a !== void 0 ? _a : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
106
+ envVariables: (_b = params.envVariables) !== null && _b !== void 0 ? _b : {},
107
+ dumpBrowserLogs: (_c = params.dumpBrowserLogs) !== null && _c !== void 0 ? _c : renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
109
108
  verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
110
109
  onBrowserLog: (log) => {
111
110
  logs.push(log);
112
111
  },
113
112
  outputLocation,
114
113
  codec: chunkCodec,
115
- crf: (_b = params.crf) !== null && _b !== void 0 ? _b : undefined,
116
- pixelFormat: params.pixelFormat,
114
+ crf: (_d = params.crf) !== null && _d !== void 0 ? _d : null,
115
+ pixelFormat: (_e = params.pixelFormat) !== null && _e !== void 0 ? _e : renderer_1.RenderInternals.DEFAULT_PIXEL_FORMAT,
117
116
  proResProfile: params.proResProfile,
118
117
  onDownload: (src) => {
119
118
  console.log('Downloading', src);
@@ -143,9 +142,6 @@ const renderHandler = async (params, options, logs) => {
143
142
  port: null,
144
143
  everyNthFrame: params.everyNthFrame,
145
144
  numberOfGifLoops: null,
146
- internal: {
147
- downloadMap,
148
- },
149
145
  muted: params.muted,
150
146
  enforceAudioTrack: true,
151
147
  audioBitrate: params.audioBitrate,
@@ -156,6 +152,12 @@ const renderHandler = async (params, options, logs) => {
156
152
  audioCodec: null,
157
153
  preferLossless: true,
158
154
  browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
155
+ cancelSignal: undefined,
156
+ disallowParallelEncoding: false,
157
+ ffmpegOverride: ({ args }) => args,
158
+ indent: false,
159
+ onCtrlCExit: () => undefined,
160
+ server: undefined,
159
161
  })
160
162
  .then(({ slowestFrames }) => {
161
163
  console.log();
@@ -203,7 +205,6 @@ const renderHandler = async (params, options, logs) => {
203
205
  downloadBehavior: null,
204
206
  customCredentials: null,
205
207
  }),
206
- renderer_1.RenderInternals.cleanDownloadMap(downloadMap),
207
208
  ]);
208
209
  };
209
210
  const rendererHandler = async (params, options) => {
@@ -1,5 +1,5 @@
1
1
  import type { LambdaPayload } from '../shared/constants';
2
- declare type Options = {
2
+ type Options = {
3
3
  expectedBucketOwner: string;
4
4
  };
5
5
  export declare const startHandler: (params: LambdaPayload, options: Options) => Promise<{
@@ -1,5 +1,5 @@
1
1
  import type { LambdaPayload } from '../shared/constants';
2
- declare type Options = {
2
+ type Options = {
3
3
  expectedBucketOwner: string;
4
4
  };
5
5
  declare const innerStillHandler: (lambdaParams: LambdaPayload, renderId: string, options: Options) => Promise<{
@@ -31,7 +31,7 @@ const io_1 = require("./helpers/io");
31
31
  const validate_composition_1 = require("./helpers/validate-composition");
32
32
  const write_lambda_error_1 = require("./helpers/write-lambda-error");
33
33
  const innerStillHandler = async (lambdaParams, renderId, options) => {
34
- var _a, _b, _c, _d;
34
+ var _a, _b, _c, _d, _e, _f, _g;
35
35
  if (lambdaParams.type !== constants_1.LambdaRoutines.still) {
36
36
  throw new TypeError('Expected still type');
37
37
  }
@@ -53,7 +53,6 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
53
53
  ]);
54
54
  const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
55
55
  const outputPath = node_path_1.default.join(outputDir, 'output');
56
- const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
57
56
  const region = (0, get_current_region_1.getCurrentRegionInFunction)();
58
57
  const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
59
58
  bucketName,
@@ -66,19 +65,28 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
66
65
  region,
67
66
  bucketName,
68
67
  });
68
+ const verbose = renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose');
69
+ const server = await renderer_1.RenderInternals.prepareServer({
70
+ concurrency: 1,
71
+ indent: false,
72
+ port: null,
73
+ remotionRoot: process.cwd(),
74
+ verbose,
75
+ webpackConfigOrServeUrl: serveUrl,
76
+ });
69
77
  const composition = await (0, validate_composition_1.validateComposition)({
70
78
  serveUrl,
71
79
  browserInstance,
72
80
  composition: lambdaParams.composition,
73
81
  inputProps,
74
- envVariables: lambdaParams.envVariables,
82
+ envVariables: (_c = lambdaParams.envVariables) !== null && _c !== void 0 ? _c : {},
75
83
  chromiumOptions: lambdaParams.chromiumOptions,
76
84
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
77
85
  port: null,
78
- downloadMap,
79
86
  forceHeight: lambdaParams.forceHeight,
80
87
  forceWidth: lambdaParams.forceWidth,
81
88
  logLevel: lambdaParams.logLevel,
89
+ server,
82
90
  });
83
91
  const renderMetadata = {
84
92
  startedDate: Date.now(),
@@ -97,7 +105,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
97
105
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
98
106
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
99
107
  renderId,
100
- outName: (_c = lambdaParams.outName) !== null && _c !== void 0 ? _c : undefined,
108
+ outName: (_d = lambdaParams.outName) !== null && _d !== void 0 ? _d : undefined,
101
109
  privacy: lambdaParams.privacy,
102
110
  everyNthFrame: 1,
103
111
  frameRange: [lambdaParams.frame, lambdaParams.frame],
@@ -113,12 +121,12 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
113
121
  downloadBehavior: null,
114
122
  customCredentials: null,
115
123
  });
116
- await (0, renderer_1.renderStill)({
124
+ await renderer_1.RenderInternals.internalRenderStill({
117
125
  composition,
118
126
  output: outputPath,
119
127
  serveUrl,
120
- dumpBrowserLogs: (_d = lambdaParams.dumpBrowserLogs) !== null && _d !== void 0 ? _d : renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'),
121
- envVariables: lambdaParams.envVariables,
128
+ dumpBrowserLogs: (_e = lambdaParams.dumpBrowserLogs) !== null && _e !== void 0 ? _e : verbose,
129
+ envVariables: (_f = lambdaParams.envVariables) !== null && _f !== void 0 ? _f : {},
122
130
  frame: renderer_1.RenderInternals.convertToPositiveFrameIndex({
123
131
  frame: lambdaParams.frame,
124
132
  durationInFrames: composition.durationInFrames,
@@ -127,12 +135,18 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
127
135
  inputProps,
128
136
  overwrite: false,
129
137
  puppeteerInstance: browserInstance,
130
- jpegQuality: lambdaParams.jpegQuality,
138
+ jpegQuality: (_g = lambdaParams.jpegQuality) !== null && _g !== void 0 ? _g : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
131
139
  chromiumOptions: lambdaParams.chromiumOptions,
132
140
  scale: lambdaParams.scale,
133
141
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
134
- downloadMap,
135
142
  browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
143
+ cancelSignal: null,
144
+ indent: false,
145
+ onBrowserLog: null,
146
+ onDownload: null,
147
+ port: null,
148
+ server,
149
+ verbose,
136
150
  });
137
151
  const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, (0, expected_out_name_1.getCredentialsFromOutName)(lambdaParams.outName));
138
152
  const { size } = await node_fs_1.default.promises.stat(outputPath);
@@ -153,6 +167,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
153
167
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
154
168
  serialized: lambdaParams.inputProps,
155
169
  }),
170
+ server.closeServer(true),
156
171
  ]);
157
172
  const estimatedPrice = (0, estimate_price_1.estimatePrice)({
158
173
  durationInMiliseconds: Date.now() - start + 100,
@@ -163,7 +178,6 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
163
178
  // overestimate the price, but will only have a miniscule effect (~0.2%)
164
179
  diskSizeInMb: constants_1.MAX_EPHEMERAL_STORAGE_IN_MB,
165
180
  });
166
- renderer_1.RenderInternals.cleanDownloadMap(downloadMap);
167
181
  return {
168
182
  output: (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, bucketName, customCredentials),
169
183
  size,
@@ -1,3 +1,3 @@
1
1
  export declare const DEFAULT_AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "sa-east-1"];
2
2
  export declare const AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-south-1", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-south-1", "ap-east-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "me-south-1", "sa-east-1"];
3
- export declare type AwsRegion = typeof AWS_REGIONS[number];
3
+ export type AwsRegion = typeof AWS_REGIONS[number];
@@ -1 +1 @@
1
- export declare type Await<T> = T extends PromiseLike<infer U> ? U : T;
1
+ export type Await<T> = T extends PromiseLike<infer U> ? U : T;
@@ -5,7 +5,7 @@ import { S3Client } from '@aws-sdk/client-s3';
5
5
  import { ServiceQuotasClient } from '@aws-sdk/client-service-quotas';
6
6
  import { STSClient } from '@aws-sdk/client-sts';
7
7
  import type { AwsRegion } from '../pricing/aws-regions';
8
- export declare type ServiceMapping = {
8
+ export type ServiceMapping = {
9
9
  s3: S3Client;
10
10
  cloudwatch: CloudWatchLogsClient;
11
11
  iam: IAMClient;
@@ -13,10 +13,10 @@ export declare type ServiceMapping = {
13
13
  servicequotas: ServiceQuotasClient;
14
14
  sts: STSClient;
15
15
  };
16
- export declare type CustomCredentialsWithoutSensitiveData = {
16
+ export type CustomCredentialsWithoutSensitiveData = {
17
17
  endpoint: string;
18
18
  };
19
- export declare type CustomCredentials = CustomCredentialsWithoutSensitiveData & {
19
+ export type CustomCredentials = CustomCredentialsWithoutSensitiveData & {
20
20
  accessKeyId: string | null;
21
21
  secretAccessKey: string | null;
22
22
  };
@@ -59,17 +59,17 @@ export declare const getErrorFileName: ({ renderId, chunk, attempt, }: {
59
59
  chunk: number | null;
60
60
  attempt: number;
61
61
  }) => string;
62
- export declare type OutNameInput = string | {
62
+ export type OutNameInput = string | {
63
63
  bucketName: string;
64
64
  key: string;
65
65
  s3OutputProvider?: CustomCredentials;
66
66
  };
67
- export declare type OutNameInputWithoutCredentials = string | {
67
+ export type OutNameInputWithoutCredentials = string | {
68
68
  bucketName: string;
69
69
  key: string;
70
70
  s3OutputProvider?: CustomCredentialsWithoutSensitiveData;
71
71
  };
72
- export declare type OutNameOutput = {
72
+ export type OutNameOutput = {
73
73
  renderBucketName: string;
74
74
  key: string;
75
75
  customCredentials: CustomCredentials | null;
@@ -93,18 +93,18 @@ export declare enum LambdaRoutines {
93
93
  still = "still",
94
94
  compositions = "compositions"
95
95
  }
96
- declare type WebhookOption = null | {
96
+ type WebhookOption = null | {
97
97
  url: string;
98
98
  secret: string | null;
99
99
  };
100
- export declare type SerializedInputProps = {
100
+ export type SerializedInputProps = {
101
101
  type: 'bucket-url';
102
102
  hash: string;
103
103
  } | {
104
104
  type: 'payload';
105
105
  payload: unknown;
106
106
  };
107
- export declare type LambdaStartPayload = {
107
+ export type LambdaStartPayload = {
108
108
  rendererFunctionName: string | null;
109
109
  type: LambdaRoutines.start;
110
110
  serveUrl: string;
@@ -142,14 +142,14 @@ export declare type LambdaStartPayload = {
142
142
  bucketName: string | null;
143
143
  dumpBrowserLogs: boolean;
144
144
  };
145
- export declare type LambdaStatusPayload = {
145
+ export type LambdaStatusPayload = {
146
146
  type: LambdaRoutines.status;
147
147
  bucketName: string;
148
148
  renderId: string;
149
149
  version: string;
150
150
  s3OutputProvider?: CustomCredentials;
151
151
  };
152
- export declare type LambdaPayloads = {
152
+ export type LambdaPayloads = {
153
153
  info: {
154
154
  type: LambdaRoutines.info;
155
155
  };
@@ -267,18 +267,18 @@ export declare type LambdaPayloads = {
267
267
  dumpBrowserLogs: boolean;
268
268
  };
269
269
  };
270
- export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
271
- export declare type EncodingProgress = {
270
+ export type LambdaPayload = LambdaPayloads[LambdaRoutines];
271
+ export type EncodingProgress = {
272
272
  framesEncoded: number;
273
273
  };
274
- declare type Discriminated = {
274
+ type Discriminated = {
275
275
  type: 'still';
276
276
  imageFormat: StillImageFormat;
277
277
  } | {
278
278
  type: 'video';
279
279
  imageFormat: VideoImageFormat;
280
280
  };
281
- export declare type RenderMetadata = Discriminated & {
281
+ export type RenderMetadata = Discriminated & {
282
282
  siteId: string;
283
283
  videoConfig: AnyCompMetadata;
284
284
  startedDate: number;
@@ -299,13 +299,13 @@ export declare type RenderMetadata = Discriminated & {
299
299
  frameRange: [number, number];
300
300
  everyNthFrame: number;
301
301
  };
302
- export declare type AfterRenderCost = {
302
+ export type AfterRenderCost = {
303
303
  estimatedCost: number;
304
304
  estimatedDisplayCost: string;
305
305
  currency: string;
306
306
  disclaimer: string;
307
307
  };
308
- export declare type PostRenderData = {
308
+ export type PostRenderData = {
309
309
  cost: AfterRenderCost;
310
310
  outputFile: string;
311
311
  outputSize: number;
@@ -322,18 +322,18 @@ export declare type PostRenderData = {
322
322
  retriesInfo: ChunkRetry[];
323
323
  mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
324
324
  };
325
- export declare type CostsInfo = {
325
+ export type CostsInfo = {
326
326
  accruedSoFar: number;
327
327
  displayCost: string;
328
328
  currency: string;
329
329
  disclaimer: string;
330
330
  };
331
- export declare type CleanupInfo = {
331
+ export type CleanupInfo = {
332
332
  doneIn: number | null;
333
333
  minFilesToDelete: number;
334
334
  filesDeleted: number;
335
335
  };
336
- export declare type RenderProgress = {
336
+ export type RenderProgress = {
337
337
  chunks: number;
338
338
  done: boolean;
339
339
  encodingStatus: EncodingProgress | null;
@@ -359,7 +359,7 @@ export declare type RenderProgress = {
359
359
  framesRendered: number;
360
360
  outputSizeInBytes: number | null;
361
361
  };
362
- export declare type Privacy = 'public' | 'private' | 'no-acl';
362
+ export type Privacy = 'public' | 'private' | 'no-acl';
363
363
  export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
364
364
  export declare const LAMBDA_BURST_LIMIT_QUOTA = "L-548AE339";
365
365
  export {};
@@ -1,4 +1,4 @@
1
- export declare type DownloadBehavior = {
1
+ export type DownloadBehavior = {
2
2
  type: 'play-in-browser';
3
3
  } | {
4
4
  type: 'download';
@@ -1,6 +1,6 @@
1
1
  import type { ParsedTiming } from './parse-lambda-timings-key';
2
2
  export declare const OVERHEAD_TIME_PER_LAMBDA = 100;
3
- export declare type ExpensiveChunk = {
3
+ export type ExpensiveChunk = {
4
4
  chunk: number;
5
5
  frameRange: [number, number];
6
6
  timeInMilliseconds: number;
@@ -1,6 +1,6 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
2
  export declare const REMOTION_HOSTED_LAYER_ARN = "arn:aws:lambda:*:678892195805:layer:remotion-binaries-*";
3
- export declare type HostedLayers = {
3
+ export type HostedLayers = {
4
4
  [region in AwsRegion]: {
5
5
  layerArn: string;
6
6
  version: number;
@@ -12,7 +12,7 @@ import type { AfterRenderCost } from './constants';
12
12
  * @returns {string} Calculated signature
13
13
  */
14
14
  export declare function calculateSignature(payload: string, secret: string | null): string;
15
- declare type DynamicWebhookPayload = {
15
+ type DynamicWebhookPayload = {
16
16
  type: 'error';
17
17
  errors: {
18
18
  message: string;
@@ -29,7 +29,7 @@ declare type DynamicWebhookPayload = {
29
29
  } | {
30
30
  type: 'timeout';
31
31
  };
32
- export declare type WebhookPayload = {
32
+ export type WebhookPayload = {
33
33
  renderId: string;
34
34
  expectedBucketOwner: string;
35
35
  bucketName: string;
@@ -1,4 +1,4 @@
1
- export declare type ParsedTiming = {
1
+ export type ParsedTiming = {
2
2
  renderId: string;
3
3
  chunk: number;
4
4
  start: number;
@@ -15,7 +15,7 @@ export interface LambdaReturnValues {
15
15
  [LambdaRoutines.still]: ReturnType<typeof stillHandler>;
16
16
  [LambdaRoutines.compositions]: ReturnType<typeof compositionsHandler>;
17
17
  }
18
- export declare type StreamedResponse = {
18
+ export type StreamedResponse = {
19
19
  statusCode: number;
20
20
  headers: Record<string, string>;
21
21
  body: string;
@@ -1,3 +1,3 @@
1
- declare type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
1
+ type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
2
2
  export declare function truthy<T>(value: T): value is Truthy<T>;
3
3
  export {};
@@ -0,0 +1,4 @@
1
+ declare const validArchitectures: readonly ["arm64", "x86_64"];
2
+ export declare type LambdaArchitecture = typeof validArchitectures[number];
3
+ export declare const validateArchitecture: (architecture: unknown) => void;
4
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateArchitecture = void 0;
4
+ const validArchitectures = ['arm64', 'x86_64'];
5
+ const validateArchitecture = (architecture) => {
6
+ if (typeof architecture !== 'string') {
7
+ throw new TypeError('You must pass an architecture when deploying: One of ' +
8
+ validArchitectures.join(', '));
9
+ }
10
+ if (!validArchitectures.find((a) => a === architecture)) {
11
+ throw new TypeError(`You must pass an "architecture" when deploying a function: either "arm64" or "x86_64"`);
12
+ }
13
+ };
14
+ exports.validateArchitecture = validateArchitecture;