@remotion/lambda 4.0.496 → 4.0.498
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.
- package/dist/api/deploy-site-from-bundle.d.ts +28 -0
- package/dist/api/deploy-site-from-bundle.js +48 -0
- package/dist/api/deploy-site.d.ts +5 -11
- package/dist/api/deploy-site.js +43 -117
- package/dist/api/upload-dir.js +2 -1
- package/dist/cli/commands/sites/create.js +2 -0
- package/dist/esm/index.mjs +295 -126
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/shared/deploy-site-with-bundle.d.ts +31 -0
- package/dist/shared/deploy-site-with-bundle.js +116 -0
- package/dist/shared/get-etag.js +4 -4
- package/dist/shared/multipart-upload-part-size.d.ts +1 -0
- package/dist/shared/multipart-upload-part-size.js +4 -0
- package/dist/shared/validate-bundle-dir.d.ts +1 -0
- package/dist/shared/validate-bundle-dir.js +63 -0
- package/dist/shared/validate-site-name.js +9 -3
- package/package.json +13 -13
- package/remotionlambda-arm64.zip +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AwsRegion, RequestHandler } from '@remotion/lambda-client';
|
|
2
|
+
import { type AwsProvider } from '@remotion/lambda-client';
|
|
3
|
+
import type { ToOptions } from '@remotion/renderer';
|
|
4
|
+
import type { BrowserSafeApis } from '@remotion/renderer/client';
|
|
5
|
+
import type { FullClientSpecifics, ProviderSpecifics } from '@remotion/serverless';
|
|
6
|
+
import { type DeploySiteOutput, type DeploySiteWithBundleOptions } from '../shared/deploy-site-with-bundle';
|
|
7
|
+
export type DeploySiteFromBundleOutput = DeploySiteOutput;
|
|
8
|
+
type MandatoryParameters = {
|
|
9
|
+
bucketName: string;
|
|
10
|
+
region: AwsRegion;
|
|
11
|
+
bundleDir: string;
|
|
12
|
+
};
|
|
13
|
+
type OptionalParameters = {
|
|
14
|
+
siteName: string;
|
|
15
|
+
options: DeploySiteWithBundleOptions;
|
|
16
|
+
privacy: 'public' | 'no-acl';
|
|
17
|
+
forcePathStyle: boolean;
|
|
18
|
+
requestHandler: RequestHandler | null;
|
|
19
|
+
} & ToOptions<typeof BrowserSafeApis.optionsMap.deploySiteLambda>;
|
|
20
|
+
export type DeploySiteFromBundleInput = MandatoryParameters & Partial<OptionalParameters>;
|
|
21
|
+
export type InternalDeploySiteFromBundleInput = MandatoryParameters & OptionalParameters & {
|
|
22
|
+
indent: boolean;
|
|
23
|
+
providerSpecifics: ProviderSpecifics<AwsProvider>;
|
|
24
|
+
fullClientSpecifics: FullClientSpecifics<AwsProvider>;
|
|
25
|
+
};
|
|
26
|
+
export declare const internalDeploySiteFromBundle: (input: InternalDeploySiteFromBundleInput) => DeploySiteFromBundleOutput;
|
|
27
|
+
export declare const deploySiteFromBundle: (args: DeploySiteFromBundleInput) => DeploySiteOutput;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deploySiteFromBundle = exports.internalDeploySiteFromBundle = void 0;
|
|
4
|
+
const lambda_client_1 = require("@remotion/lambda-client");
|
|
5
|
+
const error_handling_1 = require("@remotion/renderer/error-handling");
|
|
6
|
+
const full_client_implementation_1 = require("../functions/full-client-implementation");
|
|
7
|
+
const deploy_site_with_bundle_1 = require("../shared/deploy-site-with-bundle");
|
|
8
|
+
const validate_bundle_dir_1 = require("../shared/validate-bundle-dir");
|
|
9
|
+
const mandatoryDeploySiteFromBundle = ({ bucketName, bundleDir, region, siteName, options, privacy, throwIfSiteExists, providerSpecifics, forcePathStyle, fullClientSpecifics, requestHandler, }) => {
|
|
10
|
+
const resolvedBundleDir = (0, validate_bundle_dir_1.validateBundleDir)(bundleDir);
|
|
11
|
+
return (0, deploy_site_with_bundle_1.deploySiteWithBundle)({
|
|
12
|
+
bucketName,
|
|
13
|
+
region,
|
|
14
|
+
siteName,
|
|
15
|
+
options,
|
|
16
|
+
privacy,
|
|
17
|
+
throwIfSiteExists,
|
|
18
|
+
providerSpecifics,
|
|
19
|
+
forcePathStyle,
|
|
20
|
+
fullClientSpecifics,
|
|
21
|
+
requestHandler,
|
|
22
|
+
getBundle: () => Promise.resolve(resolvedBundleDir),
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.internalDeploySiteFromBundle = (0, error_handling_1.wrapWithErrorHandling)(mandatoryDeploySiteFromBundle);
|
|
26
|
+
/*
|
|
27
|
+
* @description Deploys an existing Remotion bundle to an S3 bucket without bundling it again.
|
|
28
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/deploysitefrombundle)
|
|
29
|
+
*/
|
|
30
|
+
const deploySiteFromBundle = (args) => {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
32
|
+
return (0, exports.internalDeploySiteFromBundle)({
|
|
33
|
+
bucketName: args.bucketName,
|
|
34
|
+
bundleDir: args.bundleDir,
|
|
35
|
+
region: args.region,
|
|
36
|
+
options: (_a = args.options) !== null && _a !== void 0 ? _a : {},
|
|
37
|
+
privacy: (_b = args.privacy) !== null && _b !== void 0 ? _b : 'public',
|
|
38
|
+
siteName: (_c = args.siteName) !== null && _c !== void 0 ? _c : lambda_client_1.LambdaClientInternals.awsImplementation.randomHash(),
|
|
39
|
+
indent: false,
|
|
40
|
+
logLevel: (_d = args.logLevel) !== null && _d !== void 0 ? _d : 'info',
|
|
41
|
+
throwIfSiteExists: (_e = args.throwIfSiteExists) !== null && _e !== void 0 ? _e : false,
|
|
42
|
+
providerSpecifics: lambda_client_1.LambdaClientInternals.awsImplementation,
|
|
43
|
+
forcePathStyle: (_f = args.forcePathStyle) !== null && _f !== void 0 ? _f : false,
|
|
44
|
+
fullClientSpecifics: full_client_implementation_1.awsFullClientSpecifics,
|
|
45
|
+
requestHandler: (_g = args.requestHandler) !== null && _g !== void 0 ? _g : null,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.deploySiteFromBundle = deploySiteFromBundle;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { type GitSource, type WebpackOverrideFn } from '@remotion/bundler';
|
|
1
|
+
import { type BundlerOverrideFn, type GitSource, type RspackOverrideFn, type WebpackOverrideFn } from '@remotion/bundler';
|
|
2
2
|
import type { AwsRegion, RequestHandler } from '@remotion/lambda-client';
|
|
3
3
|
import { type AwsProvider } from '@remotion/lambda-client';
|
|
4
4
|
import type { ToOptions } from '@remotion/renderer';
|
|
5
5
|
import type { BrowserSafeApis } from '@remotion/renderer/client';
|
|
6
6
|
import type { FullClientSpecifics, ProviderSpecifics, UploadDirProgress } from '@remotion/serverless';
|
|
7
|
+
import { type DeploySiteOutput } from '../shared/deploy-site-with-bundle';
|
|
8
|
+
export type { DeploySiteOutput };
|
|
7
9
|
type MandatoryParameters = {
|
|
8
10
|
entryPoint: string;
|
|
9
11
|
bucketName: string;
|
|
@@ -15,6 +17,8 @@ type OptionalParameters = {
|
|
|
15
17
|
onBundleProgress?: (progress: number) => void;
|
|
16
18
|
onUploadProgress?: (upload: UploadDirProgress) => void;
|
|
17
19
|
onDiffingProgress?: (bytes: number, done: boolean) => void;
|
|
20
|
+
bundlerOverride?: BundlerOverrideFn;
|
|
21
|
+
rspackOverride?: RspackOverrideFn;
|
|
18
22
|
webpackOverride?: WebpackOverrideFn;
|
|
19
23
|
ignoreRegisterRootWarning?: boolean;
|
|
20
24
|
enableCaching?: boolean;
|
|
@@ -33,19 +37,9 @@ type OptionalParameters = {
|
|
|
33
37
|
requestHandler: RequestHandler | null;
|
|
34
38
|
} & ToOptions<typeof BrowserSafeApis.optionsMap.deploySiteLambda>;
|
|
35
39
|
export type DeploySiteInput = MandatoryParameters & Partial<OptionalParameters>;
|
|
36
|
-
export type DeploySiteOutput = Promise<{
|
|
37
|
-
serveUrl: string;
|
|
38
|
-
siteName: string;
|
|
39
|
-
stats: {
|
|
40
|
-
uploadedFiles: number;
|
|
41
|
-
deletedFiles: number;
|
|
42
|
-
untouchedFiles: number;
|
|
43
|
-
};
|
|
44
|
-
}>;
|
|
45
40
|
export type InternalDeploySiteInput = MandatoryParameters & OptionalParameters & {
|
|
46
41
|
providerSpecifics: ProviderSpecifics<AwsProvider>;
|
|
47
42
|
fullClientSpecifics: FullClientSpecifics<AwsProvider>;
|
|
48
43
|
};
|
|
49
44
|
export declare const internalDeploySite: (input: InternalDeploySiteInput) => DeploySiteOutput;
|
|
50
45
|
export declare const deploySite: (args: DeploySiteInput) => DeploySiteOutput;
|
|
51
|
-
export {};
|
package/dist/api/deploy-site.js
CHANGED
|
@@ -8,137 +8,63 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
8
8
|
const lambda_client_1 = require("@remotion/lambda-client");
|
|
9
9
|
const constants_1 = require("@remotion/lambda-client/constants");
|
|
10
10
|
const error_handling_1 = require("@remotion/renderer/error-handling");
|
|
11
|
-
const serverless_1 = require("@remotion/serverless");
|
|
12
11
|
const full_client_implementation_1 = require("../functions/full-client-implementation");
|
|
13
|
-
const
|
|
14
|
-
const validate_site_name_1 = require("../shared/validate-site-name");
|
|
12
|
+
const deploy_site_with_bundle_1 = require("../shared/deploy-site-with-bundle");
|
|
15
13
|
const mandatoryDeploySite = async ({ bucketName, entryPoint, siteName, options, region, privacy, gitSource, throwIfSiteExists, providerSpecifics, forcePathStyle, fullClientSpecifics, requestHandler, }) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
lambda_client_1.LambdaClientInternals.validateAwsRegion(region);
|
|
19
|
-
(0, serverless_1.validateBucketName)({
|
|
20
|
-
bucketName,
|
|
21
|
-
bucketNamePrefix: constants_1.REMOTION_BUCKET_PREFIX,
|
|
22
|
-
options: {
|
|
23
|
-
mustStartWithRemotion: !(options === null || options === void 0 ? void 0 : options.bypassBucketNameValidation),
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
(0, validate_site_name_1.validateSiteName)(siteName);
|
|
27
|
-
(0, serverless_1.validatePrivacy)(privacy, false);
|
|
28
|
-
const accountId = await providerSpecifics.getAccountId({ region });
|
|
29
|
-
const bucketExists = await providerSpecifics.bucketExists({
|
|
14
|
+
let generatedBundleDir = null;
|
|
15
|
+
const result = await (0, deploy_site_with_bundle_1.deploySiteWithBundle)({
|
|
30
16
|
bucketName,
|
|
31
17
|
region,
|
|
32
|
-
|
|
18
|
+
siteName,
|
|
19
|
+
options,
|
|
20
|
+
privacy,
|
|
21
|
+
throwIfSiteExists,
|
|
22
|
+
providerSpecifics,
|
|
33
23
|
forcePathStyle,
|
|
24
|
+
fullClientSpecifics,
|
|
34
25
|
requestHandler,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onSymlinkDetected: () => undefined,
|
|
65
|
-
outDir: null,
|
|
66
|
-
askAIEnabled: (_j = options === null || options === void 0 ? void 0 : options.askAIEnabled) !== null && _j !== void 0 ? _j : true,
|
|
67
|
-
interactivityEnabled: (_k = options === null || options === void 0 ? void 0 : options.interactivityEnabled) !== null && _k !== void 0 ? _k : true,
|
|
68
|
-
audioLatencyHint: null,
|
|
69
|
-
keyboardShortcutsEnabled: (_l = options === null || options === void 0 ? void 0 : options.keyboardShortcutsEnabled) !== null && _l !== void 0 ? _l : true,
|
|
70
|
-
renderDefaults: null,
|
|
71
|
-
rspack: (_m = options === null || options === void 0 ? void 0 : options.rspack) !== null && _m !== void 0 ? _m : false,
|
|
72
|
-
symlinkPublicDir: false,
|
|
73
|
-
}),
|
|
74
|
-
]);
|
|
75
|
-
if (throwIfSiteExists && files.length > 0) {
|
|
76
|
-
throw new Error('`throwIfSiteExists` was passed as true, but there are already files in this folder: ' +
|
|
77
|
-
files
|
|
78
|
-
.slice(0, 5)
|
|
79
|
-
.map((f) => f.Key)
|
|
80
|
-
.join(', '));
|
|
81
|
-
}
|
|
82
|
-
(_a = options.onDiffingProgress) === null || _a === void 0 ? void 0 : _a.call(options, 0, false);
|
|
83
|
-
let totalBytes = 0;
|
|
84
|
-
const { toDelete, toUpload, existingCount } = await (0, get_s3_operations_1.getS3DiffOperations)({
|
|
85
|
-
objects: files,
|
|
86
|
-
bundle: bundled,
|
|
87
|
-
prefix: subFolder,
|
|
88
|
-
onProgress: (bytes) => {
|
|
89
|
-
var _a;
|
|
90
|
-
totalBytes = bytes;
|
|
91
|
-
(_a = options.onDiffingProgress) === null || _a === void 0 ? void 0 : _a.call(options, bytes, false);
|
|
26
|
+
getBundle: async () => {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
28
|
+
generatedBundleDir = await fullClientSpecifics.bundleSite({
|
|
29
|
+
publicPath: `/${(0, constants_1.getSitesKey)(siteName)}/`,
|
|
30
|
+
bundlerOverride: (_a = options.bundlerOverride) !== null && _a !== void 0 ? _a : ((f) => f),
|
|
31
|
+
rspackOverride: (_b = options.rspackOverride) !== null && _b !== void 0 ? _b : ((f) => f),
|
|
32
|
+
webpackOverride: (_c = options.webpackOverride) !== null && _c !== void 0 ? _c : ((f) => f),
|
|
33
|
+
enableCaching: (_d = options.enableCaching) !== null && _d !== void 0 ? _d : true,
|
|
34
|
+
publicDir: (_e = options.publicDir) !== null && _e !== void 0 ? _e : null,
|
|
35
|
+
rootDir: (_f = options.rootDir) !== null && _f !== void 0 ? _f : null,
|
|
36
|
+
ignoreRegisterRootWarning: (_g = options.ignoreRegisterRootWarning) !== null && _g !== void 0 ? _g : false,
|
|
37
|
+
onProgress: (_h = options.onBundleProgress) !== null && _h !== void 0 ? _h : (() => undefined),
|
|
38
|
+
entryPoint,
|
|
39
|
+
gitSource,
|
|
40
|
+
bufferStateDelayInMilliseconds: null,
|
|
41
|
+
maxTimelineTracks: null,
|
|
42
|
+
onDirectoryCreated: () => undefined,
|
|
43
|
+
onPublicDirCopyProgress: () => undefined,
|
|
44
|
+
onSymlinkDetected: () => undefined,
|
|
45
|
+
outDir: null,
|
|
46
|
+
askAIEnabled: (_j = options.askAIEnabled) !== null && _j !== void 0 ? _j : true,
|
|
47
|
+
interactivityEnabled: (_k = options.interactivityEnabled) !== null && _k !== void 0 ? _k : true,
|
|
48
|
+
audioLatencyHint: null,
|
|
49
|
+
keyboardShortcutsEnabled: (_l = options.keyboardShortcutsEnabled) !== null && _l !== void 0 ? _l : true,
|
|
50
|
+
renderDefaults: null,
|
|
51
|
+
rspack: (_m = options.rspack) !== null && _m !== void 0 ? _m : false,
|
|
52
|
+
symlinkPublicDir: false,
|
|
53
|
+
});
|
|
54
|
+
return generatedBundleDir;
|
|
92
55
|
},
|
|
93
|
-
fullClientSpecifics,
|
|
94
56
|
});
|
|
95
|
-
(
|
|
96
|
-
|
|
97
|
-
fullClientSpecifics.uploadDir({
|
|
98
|
-
bucket: bucketName,
|
|
99
|
-
region,
|
|
100
|
-
localDir: bundled,
|
|
101
|
-
onProgress: (_o = options === null || options === void 0 ? void 0 : options.onUploadProgress) !== null && _o !== void 0 ? _o : (() => undefined),
|
|
102
|
-
keyPrefix: subFolder,
|
|
103
|
-
privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
|
|
104
|
-
toUpload,
|
|
105
|
-
forcePathStyle,
|
|
106
|
-
requestHandler,
|
|
107
|
-
}),
|
|
108
|
-
Promise.all(toDelete.map((d) => {
|
|
109
|
-
return providerSpecifics.deleteFile({
|
|
110
|
-
bucketName,
|
|
111
|
-
customCredentials: null,
|
|
112
|
-
key: d.Key,
|
|
113
|
-
region,
|
|
114
|
-
forcePathStyle,
|
|
115
|
-
requestHandler,
|
|
116
|
-
});
|
|
117
|
-
})),
|
|
118
|
-
]);
|
|
119
|
-
if (node_fs_1.default.existsSync(bundled)) {
|
|
120
|
-
node_fs_1.default.rmSync(bundled, {
|
|
57
|
+
if (generatedBundleDir && node_fs_1.default.existsSync(generatedBundleDir)) {
|
|
58
|
+
node_fs_1.default.rmSync(generatedBundleDir, {
|
|
121
59
|
recursive: true,
|
|
122
60
|
});
|
|
123
61
|
}
|
|
124
|
-
return
|
|
125
|
-
serveUrl: lambda_client_1.LambdaClientInternals.makeS3ServeUrl({
|
|
126
|
-
bucketName,
|
|
127
|
-
subFolder,
|
|
128
|
-
region,
|
|
129
|
-
}),
|
|
130
|
-
siteName,
|
|
131
|
-
stats: {
|
|
132
|
-
uploadedFiles: toUpload.length,
|
|
133
|
-
deletedFiles: toDelete.length,
|
|
134
|
-
untouchedFiles: existingCount,
|
|
135
|
-
},
|
|
136
|
-
};
|
|
62
|
+
return result;
|
|
137
63
|
};
|
|
138
64
|
exports.internalDeploySite = (0, error_handling_1.wrapWithErrorHandling)(mandatoryDeploySite);
|
|
139
65
|
/*
|
|
140
|
-
* @description
|
|
141
|
-
* @see [Documentation](https://remotion.dev/docs/
|
|
66
|
+
* @description Bundles a Remotion project and deploys it to an S3 bucket for rendering on AWS Lambda.
|
|
67
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/deploysite)
|
|
142
68
|
*/
|
|
143
69
|
const deploySite = (args) => {
|
|
144
70
|
var _a, _b, _c, _d, _e, _f, _g;
|
package/dist/api/upload-dir.js
CHANGED
|
@@ -10,6 +10,7 @@ const lib_storage_1 = require("@aws-sdk/lib-storage");
|
|
|
10
10
|
const lambda_client_1 = require("@remotion/lambda-client");
|
|
11
11
|
const mime_types_1 = __importDefault(require("mime-types"));
|
|
12
12
|
const make_s3_key_1 = require("../shared/make-s3-key");
|
|
13
|
+
const multipart_upload_part_size_1 = require("../shared/multipart-upload-part-size");
|
|
13
14
|
async function getFiles(directory, originalDirectory, toUpload) {
|
|
14
15
|
const dirents = await node_fs_1.promises.readdir(directory, { withFileTypes: true });
|
|
15
16
|
const _files = await Promise.all(dirents
|
|
@@ -65,7 +66,7 @@ const uploadDir = async ({ bucket, region, localDir, onProgress, keyPrefix, priv
|
|
|
65
66
|
const parallelUploadsS3 = new lib_storage_1.Upload({
|
|
66
67
|
client,
|
|
67
68
|
queueSize: 2,
|
|
68
|
-
partSize:
|
|
69
|
+
partSize: multipart_upload_part_size_1.multipartUploadPartSize,
|
|
69
70
|
params: {
|
|
70
71
|
Key,
|
|
71
72
|
Bucket: bucket,
|
|
@@ -154,6 +154,8 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel, implementatio
|
|
|
154
154
|
enableCaching: client_1.BrowserSafeApis.options.bundleCacheOption.getValue({
|
|
155
155
|
commandLine: cli_1.CliInternals.parsedCli,
|
|
156
156
|
}).value,
|
|
157
|
+
bundlerOverride: config_1.ConfigInternals.getBundlerOverrideFn(),
|
|
158
|
+
rspackOverride: config_1.ConfigInternals.getRspackOverrideFn(),
|
|
157
159
|
webpackOverride: (_c = config_1.ConfigInternals.getWebpackOverrideFn()) !== null && _c !== void 0 ? _c : ((f) => f),
|
|
158
160
|
bypassBucketNameValidation: Boolean(args_1.parsedLambdaCli['force-bucket-name']),
|
|
159
161
|
askAIEnabled,
|