@remotion/serverless 4.0.244 → 4.0.246
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/.turbo/turbo-make.log +1 -1
- package/LICENSE.md +1 -1
- package/dist/best-frames-per-function-param.d.ts +1 -0
- package/dist/best-frames-per-function-param.js +17 -0
- package/dist/calculate-chunk-times.d.ts +5 -0
- package/dist/calculate-chunk-times.js +29 -0
- package/dist/can-concat-seamlessly.d.ts +3 -0
- package/dist/can-concat-seamlessly.js +17 -0
- package/dist/cleanup-props.d.ts +9 -0
- package/dist/cleanup-props.js +23 -0
- package/dist/cleanup-serialized-input-props.d.ts +15 -0
- package/dist/cleanup-serialized-input-props.js +34 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +30 -12
- package/dist/compress-props.d.ts +6 -2
- package/dist/compress-props.js +5 -3
- package/dist/concat-videos.d.ts +25 -0
- package/dist/concat-videos.js +53 -0
- package/dist/constants.d.ts +39 -3
- package/dist/constants.js +8 -1
- package/dist/create-post-render-data.d.ts +20 -0
- package/dist/create-post-render-data.js +68 -0
- package/dist/docs-url.d.ts +1 -0
- package/dist/docs-url.js +4 -0
- package/dist/estimate-price-from-bucket.d.ts +15 -0
- package/dist/estimate-price-from-bucket.js +31 -0
- package/dist/expected-out-name.d.ts +1 -1
- package/dist/find-output-file-in-bucket.d.ts +16 -0
- package/dist/find-output-file-in-bucket.js +41 -0
- package/dist/format-costs-info.d.ts +2 -0
- package/dist/format-costs-info.js +23 -0
- package/dist/get-browser-instance.d.ts +5 -12
- package/dist/get-browser-instance.js +8 -7
- package/dist/get-custom-out-name.d.ts +1 -1
- package/dist/get-or-create-bucket.d.ts +1 -1
- package/dist/get-overall-progress-from-storage.d.ts +11 -0
- package/dist/get-overall-progress-from-storage.js +25 -0
- package/dist/get-overall-progress.d.ts +9 -0
- package/dist/get-overall-progress.js +23 -0
- package/dist/handlers/check-version-mismatch.d.ts +8 -0
- package/dist/handlers/check-version-mismatch.js +23 -0
- package/dist/handlers/compositions.d.ts +16 -0
- package/dist/handlers/compositions.js +81 -0
- package/dist/handlers/launch.d.ts +18 -0
- package/dist/handlers/launch.js +600 -0
- package/dist/handlers/progress.d.ts +16 -0
- package/dist/handlers/progress.js +54 -0
- package/dist/handlers/renderer.d.ts +24 -0
- package/dist/handlers/renderer.js +344 -0
- package/dist/handlers/start.d.ts +19 -0
- package/dist/handlers/start.js +104 -0
- package/dist/handlers/still.d.ts +21 -0
- package/dist/handlers/still.js +335 -0
- package/dist/index.d.ts +21 -5
- package/dist/index.js +54 -7
- package/dist/info.d.ts +1 -1
- package/dist/inner-routine.d.ts +22 -0
- package/dist/inner-routine.js +267 -0
- package/dist/inspect-error.d.ts +4 -0
- package/dist/inspect-error.js +39 -0
- package/dist/invoke-webhook.d.ts +42 -0
- package/dist/invoke-webhook.js +116 -0
- package/dist/is-warm.d.ts +2 -0
- package/dist/is-warm.js +10 -0
- package/dist/leak-detection.d.ts +4 -0
- package/dist/leak-detection.js +40 -0
- package/dist/make-bucket-name.d.ts +1 -1
- package/dist/make-timeout-error.d.ts +13 -0
- package/dist/make-timeout-error.js +32 -0
- package/dist/make-timeout-message.d.ts +12 -0
- package/dist/make-timeout-message.js +76 -0
- package/dist/merge-chunks.d.ts +38 -0
- package/dist/merge-chunks.js +92 -0
- package/dist/min-max.d.ts +2 -0
- package/dist/min-max.js +33 -0
- package/dist/most-expensive-chunks.d.ts +13 -0
- package/dist/most-expensive-chunks.js +28 -0
- package/dist/on-downloads-helpers.d.ts +2 -0
- package/dist/on-downloads-helpers.js +29 -0
- package/dist/overall-render-progress.d.ts +59 -0
- package/dist/overall-render-progress.js +180 -0
- package/dist/plan-frame-ranges.d.ts +7 -0
- package/dist/plan-frame-ranges.js +17 -0
- package/dist/print-logging-grep-helper.d.ts +4 -0
- package/dist/print-logging-grep-helper.js +12 -0
- package/dist/progress.d.ts +16 -0
- package/dist/progress.js +254 -0
- package/dist/provider-implementation.d.ts +152 -3
- package/dist/render-has-audio-video.d.ts +6 -0
- package/dist/render-has-audio-video.js +21 -0
- package/dist/render-metadata.d.ts +1 -1
- package/dist/render-progress.d.ts +51 -0
- package/dist/return-values.d.ts +38 -0
- package/dist/return-values.js +2 -0
- package/dist/stackback.d.ts +6 -0
- package/dist/stackback.js +59 -0
- package/dist/stream-renderer.d.ts +17 -0
- package/dist/stream-renderer.js +148 -0
- package/dist/streaming/streaming.d.ts +6 -6
- package/dist/streaming/streaming.js +3 -3
- package/dist/types.d.ts +55 -0
- package/dist/types.js +2 -0
- package/dist/validate-composition.d.ts +1 -1
- package/dist/validate-composition.js +11 -1
- package/dist/validate-download-behavior.d.ts +1 -0
- package/dist/validate-download-behavior.js +21 -0
- package/dist/validate-frames-per-function.d.ts +4 -0
- package/dist/validate-frames-per-function.js +29 -0
- package/dist/validate-privacy.d.ts +2 -0
- package/dist/validate-privacy.js +14 -0
- package/dist/validate.d.ts +4 -0
- package/dist/validate.js +8 -0
- package/dist/why-is-node-running.d.ts +15 -0
- package/dist/why-is-node-running.js +89 -0
- package/dist/{write-lambda-error.d.ts → write-error-to-storage.d.ts} +4 -4
- package/package.json +6 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/compositions.d.ts +0 -11
- package/dist/compositions.js +0 -82
- package/dist/still.d.ts +0 -28
- /package/dist/{still.js → render-progress.js} +0 -0
- /package/dist/{write-lambda-error.js → write-error-to-storage.js} +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamRendererFunctionWithRetry = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const serialize_artifact_1 = require("./serialize-artifact");
|
|
9
|
+
const streamRenderer = ({ payload, functionName, outdir, overallProgress, files, logLevel, onArtifact, providerSpecifics, }) => {
|
|
10
|
+
if (payload.type !== constants_1.ServerlessRoutines.renderer) {
|
|
11
|
+
throw new Error('Expected renderer type');
|
|
12
|
+
}
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
const receivedStreamingPayload = ({ message }) => {
|
|
15
|
+
if (message.type === 'lambda-invoked') {
|
|
16
|
+
overallProgress.setLambdaInvoked(payload.chunk);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (message.type === 'frames-rendered') {
|
|
20
|
+
overallProgress.setFrames({
|
|
21
|
+
index: payload.chunk,
|
|
22
|
+
encoded: message.payload.encoded,
|
|
23
|
+
rendered: message.payload.rendered,
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (message.type === 'video-chunk-rendered') {
|
|
28
|
+
const filename = (0, path_1.join)(outdir, `chunk:${String(payload.chunk).padStart(8, '0')}:video`);
|
|
29
|
+
(0, fs_1.writeFileSync)(filename, message.payload);
|
|
30
|
+
files.push(filename);
|
|
31
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Received video chunk for chunk ${payload.chunk}`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (message.type === 'audio-chunk-rendered') {
|
|
35
|
+
const filename = (0, path_1.join)(outdir, `chunk:${String(payload.chunk).padStart(8, '0')}:audio`);
|
|
36
|
+
(0, fs_1.writeFileSync)(filename, message.payload);
|
|
37
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Received audio chunk for chunk ${payload.chunk}`);
|
|
38
|
+
files.push(filename);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (message.type === 'chunk-complete') {
|
|
42
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `Finished chunk ${payload.chunk}`);
|
|
43
|
+
overallProgress.addChunkCompleted(payload.chunk, message.payload.start, message.payload.rendered);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (message.type === 'artifact-emitted') {
|
|
47
|
+
const artifact = (0, serialize_artifact_1.deserializeArtifact)(message.payload.artifact);
|
|
48
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `Received artifact on frame ${message.payload.artifact.frame}:`, artifact.filename, artifact.content.length + 'bytes.');
|
|
49
|
+
const { alreadyExisted } = onArtifact(artifact);
|
|
50
|
+
if (alreadyExisted) {
|
|
51
|
+
return resolve({
|
|
52
|
+
type: 'error',
|
|
53
|
+
error: `Chunk ${payload.chunk} emitted an asset filename ${message.payload.artifact.filename} at frame ${message.payload.artifact.frame} but there is already another artifact with the same name. https://remotion.dev/docs/artifacts`,
|
|
54
|
+
shouldRetry: false,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (message.type === 'error-occurred') {
|
|
60
|
+
overallProgress.addErrorWithoutUpload(message.payload.errorInfo);
|
|
61
|
+
overallProgress.setFrames({
|
|
62
|
+
encoded: 0,
|
|
63
|
+
index: payload.chunk,
|
|
64
|
+
rendered: 0,
|
|
65
|
+
});
|
|
66
|
+
renderer_1.RenderInternals.Log.error({
|
|
67
|
+
indent: false,
|
|
68
|
+
logLevel,
|
|
69
|
+
}, `Renderer function of chunk ${payload.chunk} failed with error: ${message.payload.error}`);
|
|
70
|
+
renderer_1.RenderInternals.Log.error({
|
|
71
|
+
indent: false,
|
|
72
|
+
logLevel,
|
|
73
|
+
}, `Will retry chunk = ${message.payload.shouldRetry}`);
|
|
74
|
+
resolve({
|
|
75
|
+
type: 'error',
|
|
76
|
+
error: message.payload.error,
|
|
77
|
+
shouldRetry: message.payload.shouldRetry,
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
throw new Error(`Unknown message type ${message.type}`);
|
|
82
|
+
};
|
|
83
|
+
providerSpecifics
|
|
84
|
+
.callFunctionStreaming({
|
|
85
|
+
functionName,
|
|
86
|
+
payload,
|
|
87
|
+
retriesRemaining: 1,
|
|
88
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
89
|
+
timeoutInTest: 12000,
|
|
90
|
+
type: constants_1.ServerlessRoutines.renderer,
|
|
91
|
+
receivedStreamingPayload,
|
|
92
|
+
})
|
|
93
|
+
.then(() => {
|
|
94
|
+
resolve({
|
|
95
|
+
type: 'success',
|
|
96
|
+
});
|
|
97
|
+
})
|
|
98
|
+
.catch((err) => {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
const shouldRetry = (_b = (_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('Error: aborted')) !== null && _b !== void 0 ? _b : false;
|
|
101
|
+
resolve({
|
|
102
|
+
type: 'error',
|
|
103
|
+
error: err.stack,
|
|
104
|
+
shouldRetry,
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const streamRendererFunctionWithRetry = async ({ payload, files, functionName, outdir, overallProgress, logLevel, onArtifact, providerSpecifics, }) => {
|
|
110
|
+
if (payload.type !== constants_1.ServerlessRoutines.renderer) {
|
|
111
|
+
throw new Error('Expected renderer type');
|
|
112
|
+
}
|
|
113
|
+
const result = await streamRenderer({
|
|
114
|
+
files,
|
|
115
|
+
functionName,
|
|
116
|
+
outdir,
|
|
117
|
+
overallProgress,
|
|
118
|
+
payload,
|
|
119
|
+
logLevel,
|
|
120
|
+
onArtifact,
|
|
121
|
+
providerSpecifics,
|
|
122
|
+
});
|
|
123
|
+
if (result.type === 'error') {
|
|
124
|
+
if (!result.shouldRetry) {
|
|
125
|
+
throw new Error(result.error);
|
|
126
|
+
}
|
|
127
|
+
overallProgress.addRetry({
|
|
128
|
+
attempt: payload.attempt + 1,
|
|
129
|
+
time: Date.now(),
|
|
130
|
+
chunk: payload.chunk,
|
|
131
|
+
});
|
|
132
|
+
return (0, exports.streamRendererFunctionWithRetry)({
|
|
133
|
+
files,
|
|
134
|
+
functionName,
|
|
135
|
+
outdir,
|
|
136
|
+
overallProgress,
|
|
137
|
+
payload: {
|
|
138
|
+
...payload,
|
|
139
|
+
attempt: payload.attempt + 1,
|
|
140
|
+
retriesLeft: payload.retriesLeft - 1,
|
|
141
|
+
},
|
|
142
|
+
logLevel,
|
|
143
|
+
onArtifact,
|
|
144
|
+
providerSpecifics,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
exports.streamRendererFunctionWithRetry = streamRendererFunctionWithRetry;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SerializedArtifact } from '../serialize-artifact';
|
|
2
|
-
import type { CloudProvider,
|
|
3
|
-
import type {
|
|
2
|
+
import type { CloudProvider, RenderStillFunctionResponsePayload } from '../types';
|
|
3
|
+
import type { FunctionErrorInfo } from '../write-error-to-storage';
|
|
4
4
|
declare const framesRendered: "frames-rendered";
|
|
5
5
|
declare const errorOccurred: "error-occurred";
|
|
6
6
|
declare const renderIdDetermined: "render-id-determined";
|
|
@@ -8,7 +8,7 @@ declare const videoChunkRendered: "video-chunk-rendered";
|
|
|
8
8
|
declare const audioChunkRendered: "audio-chunk-rendered";
|
|
9
9
|
declare const chunkComplete: "chunk-complete";
|
|
10
10
|
declare const stillRendered: "still-rendered";
|
|
11
|
-
declare const
|
|
11
|
+
declare const functionInvoked: "lambda-invoked";
|
|
12
12
|
declare const artifactEmitted: "artifact-emitted";
|
|
13
13
|
declare const messageTypes: {
|
|
14
14
|
readonly '1': {
|
|
@@ -61,7 +61,7 @@ export type StreamingPayload<Provider extends CloudProvider> = {
|
|
|
61
61
|
payload: {
|
|
62
62
|
error: string;
|
|
63
63
|
shouldRetry: boolean;
|
|
64
|
-
errorInfo:
|
|
64
|
+
errorInfo: FunctionErrorInfo;
|
|
65
65
|
};
|
|
66
66
|
} | {
|
|
67
67
|
type: typeof renderIdDetermined;
|
|
@@ -70,7 +70,7 @@ export type StreamingPayload<Provider extends CloudProvider> = {
|
|
|
70
70
|
};
|
|
71
71
|
} | {
|
|
72
72
|
type: typeof stillRendered;
|
|
73
|
-
payload:
|
|
73
|
+
payload: RenderStillFunctionResponsePayload<Provider>;
|
|
74
74
|
} | {
|
|
75
75
|
type: typeof chunkComplete;
|
|
76
76
|
payload: {
|
|
@@ -78,7 +78,7 @@ export type StreamingPayload<Provider extends CloudProvider> = {
|
|
|
78
78
|
rendered: number;
|
|
79
79
|
};
|
|
80
80
|
} | {
|
|
81
|
-
type: typeof
|
|
81
|
+
type: typeof functionInvoked;
|
|
82
82
|
payload: {
|
|
83
83
|
attempt: number;
|
|
84
84
|
};
|
|
@@ -9,7 +9,7 @@ const videoChunkRendered = 'video-chunk-rendered';
|
|
|
9
9
|
const audioChunkRendered = 'audio-chunk-rendered';
|
|
10
10
|
const chunkComplete = 'chunk-complete';
|
|
11
11
|
const stillRendered = 'still-rendered';
|
|
12
|
-
const
|
|
12
|
+
const functionInvoked = 'lambda-invoked';
|
|
13
13
|
const artifactEmitted = 'artifact-emitted';
|
|
14
14
|
const messageTypes = {
|
|
15
15
|
'1': { type: framesRendered },
|
|
@@ -19,7 +19,7 @@ const messageTypes = {
|
|
|
19
19
|
'5': { type: audioChunkRendered },
|
|
20
20
|
'6': { type: stillRendered },
|
|
21
21
|
'7': { type: chunkComplete },
|
|
22
|
-
'8': { type:
|
|
22
|
+
'8': { type: functionInvoked },
|
|
23
23
|
'9': { type: artifactEmitted },
|
|
24
24
|
};
|
|
25
25
|
exports.formatMap = {
|
|
@@ -30,7 +30,7 @@ exports.formatMap = {
|
|
|
30
30
|
[audioChunkRendered]: 'binary',
|
|
31
31
|
[stillRendered]: 'json',
|
|
32
32
|
[chunkComplete]: 'json',
|
|
33
|
-
[
|
|
33
|
+
[functionInvoked]: 'json',
|
|
34
34
|
[artifactEmitted]: 'json',
|
|
35
35
|
};
|
|
36
36
|
const messageTypeIdToMessageType = (messageTypeId) => {
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ServerlessPayloads, ServerlessRoutines } from './constants';
|
|
2
|
+
export interface CloudProvider<Region extends string = string, ReceivedArtifactType extends Record<string, unknown> = Record<string, unknown>, CreateFunctionSpecifics extends Record<string, unknown> = Record<string, unknown>> {
|
|
3
|
+
type: string;
|
|
4
|
+
region: Region;
|
|
5
|
+
receivedArtifactType: ReceivedArtifactType;
|
|
6
|
+
creationFunctionOptions: CreateFunctionSpecifics;
|
|
7
|
+
}
|
|
8
|
+
export type ReceivedArtifact<Provider extends CloudProvider> = {
|
|
9
|
+
filename: string;
|
|
10
|
+
sizeInBytes: number;
|
|
11
|
+
s3Url: string;
|
|
12
|
+
s3Key: string;
|
|
13
|
+
} & Provider['receivedArtifactType'];
|
|
14
|
+
export type CostsInfo = {
|
|
15
|
+
accruedSoFar: number;
|
|
16
|
+
displayCost: string;
|
|
17
|
+
currency: string;
|
|
18
|
+
disclaimer: string;
|
|
19
|
+
};
|
|
20
|
+
export type RenderStillFunctionResponsePayload<Provider extends CloudProvider> = {
|
|
21
|
+
type: 'success';
|
|
22
|
+
output: string;
|
|
23
|
+
outKey: string;
|
|
24
|
+
size: number;
|
|
25
|
+
bucketName: string;
|
|
26
|
+
sizeInBytes: number;
|
|
27
|
+
estimatedPrice: CostsInfo;
|
|
28
|
+
renderId: string;
|
|
29
|
+
receivedArtifacts: ReceivedArtifact<Provider>[];
|
|
30
|
+
};
|
|
31
|
+
export type ChunkRetry = {
|
|
32
|
+
chunk: number;
|
|
33
|
+
attempt: number;
|
|
34
|
+
time: number;
|
|
35
|
+
};
|
|
36
|
+
export type ParsedTiming = {
|
|
37
|
+
chunk: number;
|
|
38
|
+
start: number;
|
|
39
|
+
rendered: number;
|
|
40
|
+
};
|
|
41
|
+
export type CallFunctionOptions<T extends ServerlessRoutines, Provider extends CloudProvider> = {
|
|
42
|
+
functionName: string;
|
|
43
|
+
type: T;
|
|
44
|
+
payload: ServerlessPayloads<Provider>[T];
|
|
45
|
+
region: Provider['region'];
|
|
46
|
+
timeoutInTest: number;
|
|
47
|
+
};
|
|
48
|
+
export type ObjectChunkTimingData = {
|
|
49
|
+
chunk: number;
|
|
50
|
+
frameRange: [number, number];
|
|
51
|
+
startDate: number;
|
|
52
|
+
timings: {
|
|
53
|
+
[key: number]: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
package/dist/types.js
ADDED
|
@@ -2,7 +2,7 @@ import type { ChromiumOptions, LogLevel, OnBrowserDownload, openBrowser, Remotio
|
|
|
2
2
|
import type { VideoConfig } from 'remotion/no-react';
|
|
3
3
|
import type { Await } from './await';
|
|
4
4
|
import type { ProviderSpecifics } from './provider-implementation';
|
|
5
|
-
import type { CloudProvider } from './
|
|
5
|
+
import type { CloudProvider } from './types';
|
|
6
6
|
type ValidateCompositionOptions<Provider extends CloudProvider> = {
|
|
7
7
|
serveUrl: string;
|
|
8
8
|
composition: string;
|
|
@@ -2,6 +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 validate_1 = require("./validate");
|
|
5
6
|
const validateComposition = async ({ serveUrl, composition, browserInstance, serializedInputPropsWithCustomSchema, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, offthreadVideoCacheSizeInBytes, onBrowserDownload, onServeUrlVisited, providerSpecifics, }) => {
|
|
6
7
|
const { metadata: comp } = await renderer_1.RenderInternals.internalSelectComposition({
|
|
7
8
|
id: composition,
|
|
@@ -22,10 +23,19 @@ const validateComposition = async ({ serveUrl, composition, browserInstance, ser
|
|
|
22
23
|
onBrowserDownload,
|
|
23
24
|
onServeUrlVisited,
|
|
24
25
|
});
|
|
25
|
-
|
|
26
|
+
const videoConfig = {
|
|
26
27
|
...comp,
|
|
27
28
|
height: forceHeight !== null && forceHeight !== void 0 ? forceHeight : comp.height,
|
|
28
29
|
width: forceWidth !== null && forceWidth !== void 0 ? forceWidth : comp.width,
|
|
29
30
|
};
|
|
31
|
+
const reason = `of the "<Composition />" component with the id "${composition}"`;
|
|
32
|
+
(0, validate_1.validateDurationInFrames)(comp.durationInFrames, {
|
|
33
|
+
component: reason,
|
|
34
|
+
allowFloats: false,
|
|
35
|
+
});
|
|
36
|
+
(0, validate_1.validateFps)(comp.fps, reason, false);
|
|
37
|
+
(0, validate_1.validateDimension)(comp.height, 'height', reason);
|
|
38
|
+
(0, validate_1.validateDimension)(comp.width, 'width', reason);
|
|
39
|
+
return videoConfig;
|
|
30
40
|
};
|
|
31
41
|
exports.validateComposition = validateComposition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateDownloadBehavior: (downloadBehavior: unknown) => null | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDownloadBehavior = void 0;
|
|
4
|
+
const validateDownloadBehavior = (downloadBehavior) => {
|
|
5
|
+
if (downloadBehavior === null || downloadBehavior === undefined) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
if (typeof downloadBehavior !== 'object') {
|
|
9
|
+
throw new Error('downloadBehavior must be null or an object');
|
|
10
|
+
}
|
|
11
|
+
const behavior = downloadBehavior;
|
|
12
|
+
if (behavior.type !== 'download' && behavior.type !== 'play-in-browser') {
|
|
13
|
+
throw new Error('Download behavior must be either "download" or "play-in-browser"');
|
|
14
|
+
}
|
|
15
|
+
if (behavior.type === 'download') {
|
|
16
|
+
if (typeof behavior.fileName !== 'string' && behavior.fileName !== null) {
|
|
17
|
+
throw new Error('If "downloadBehavior.type" is "download", then fileName must be "null" or a string');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.validateDownloadBehavior = validateDownloadBehavior;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFramesPerFunction = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const validateFramesPerFunction = ({ framesPerFunction, durationInFrames, }) => {
|
|
6
|
+
if (framesPerFunction === null) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (framesPerFunction === undefined) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (typeof framesPerFunction !== 'number') {
|
|
13
|
+
throw new TypeError(`'framesPerLambda' needs to be a number, passed ${JSON.stringify(framesPerFunction)}`);
|
|
14
|
+
}
|
|
15
|
+
if (!Number.isFinite(framesPerFunction)) {
|
|
16
|
+
throw new TypeError(`'framesPerLambda' needs to be finite, passed ${framesPerFunction}`);
|
|
17
|
+
}
|
|
18
|
+
if (Number.isNaN(framesPerFunction)) {
|
|
19
|
+
throw new TypeError(`'framesPerLambda' needs to be NaN, passed ${framesPerFunction}`);
|
|
20
|
+
}
|
|
21
|
+
if (framesPerFunction % 1 !== 0) {
|
|
22
|
+
throw new TypeError(`'framesPerLambda' needs to be an integer, passed ${framesPerFunction}`);
|
|
23
|
+
}
|
|
24
|
+
const effectiveMinimum = Math.min(constants_1.MINIMUM_FRAMES_PER_LAMBDA, durationInFrames);
|
|
25
|
+
if (framesPerFunction < effectiveMinimum) {
|
|
26
|
+
throw new TypeError(`The framesPerLambda needs to be at least ${effectiveMinimum}, but is ${framesPerFunction}`);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.validateFramesPerFunction = validateFramesPerFunction;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePrivacy = validatePrivacy;
|
|
4
|
+
function validatePrivacy(privacy, allowPrivate) {
|
|
5
|
+
if (typeof privacy !== 'string') {
|
|
6
|
+
throw new TypeError('Privacy must be a string');
|
|
7
|
+
}
|
|
8
|
+
if (!allowPrivate && privacy === 'private') {
|
|
9
|
+
throw new TypeError('Privacy must be either "public" or "no-acl"');
|
|
10
|
+
}
|
|
11
|
+
if (privacy !== 'private' && privacy !== 'public' && privacy !== 'no-acl') {
|
|
12
|
+
throw new TypeError('Privacy must be either "private", "public" or "no-acl"');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NoReactInternals } from 'remotion/no-react';
|
|
2
|
+
export declare const validateFps: typeof NoReactInternals.validateFps;
|
|
3
|
+
export declare const validateDimension: typeof NoReactInternals.validateDimension;
|
|
4
|
+
export declare const validateDurationInFrames: typeof NoReactInternals.validateDurationInFrames;
|
package/dist/validate.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDurationInFrames = exports.validateDimension = exports.validateFps = void 0;
|
|
4
|
+
/* eslint-disable prefer-destructuring */
|
|
5
|
+
const no_react_1 = require("remotion/no-react");
|
|
6
|
+
exports.validateFps = no_react_1.NoReactInternals.validateFps;
|
|
7
|
+
exports.validateDimension = no_react_1.NoReactInternals.validateDimension;
|
|
8
|
+
exports.validateDurationInFrames = no_react_1.NoReactInternals.validateDurationInFrames;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import asyncHooks from 'async_hooks';
|
|
2
|
+
type Resource = {
|
|
3
|
+
type: string;
|
|
4
|
+
stacks: NodeJS.CallSite[];
|
|
5
|
+
resource: {
|
|
6
|
+
hasRef?: () => boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type NodeIntrospection = {
|
|
10
|
+
hook: asyncHooks.AsyncHook | null;
|
|
11
|
+
active: Map<number, Resource>;
|
|
12
|
+
};
|
|
13
|
+
export declare const enableNodeIntrospection: (enabled: boolean) => NodeIntrospection;
|
|
14
|
+
export declare function whyIsNodeRunning({ active, hook }: NodeIntrospection): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.enableNodeIntrospection = void 0;
|
|
7
|
+
exports.whyIsNodeRunning = whyIsNodeRunning;
|
|
8
|
+
/* eslint-disable no-console */
|
|
9
|
+
const async_hooks_1 = __importDefault(require("async_hooks"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const stackback_1 = require("./stackback");
|
|
13
|
+
const enableNodeIntrospection = (enabled) => {
|
|
14
|
+
const active = new Map();
|
|
15
|
+
if (!enabled) {
|
|
16
|
+
return {
|
|
17
|
+
active,
|
|
18
|
+
hook: null,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const hook = async_hooks_1.default.createHook({
|
|
22
|
+
init(asyncId, type, _triggerAsyncId, resource) {
|
|
23
|
+
if (type === 'TIMERWRAP' || type === 'PROMISE')
|
|
24
|
+
return;
|
|
25
|
+
if (type === 'PerformanceObserver' || type === 'RANDOMBYTESREQUEST')
|
|
26
|
+
return;
|
|
27
|
+
const err = new Error('whatevs');
|
|
28
|
+
const stacks = (0, stackback_1.stackback)(err);
|
|
29
|
+
active.set(asyncId, { type, stacks, resource });
|
|
30
|
+
},
|
|
31
|
+
destroy(asyncId) {
|
|
32
|
+
active.delete(asyncId);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
hook.enable();
|
|
36
|
+
return { hook, active };
|
|
37
|
+
};
|
|
38
|
+
exports.enableNodeIntrospection = enableNodeIntrospection;
|
|
39
|
+
function whyIsNodeRunning({ active, hook }) {
|
|
40
|
+
if (!hook) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
hook.disable();
|
|
44
|
+
const activeResources = [...active.values()].filter((r) => {
|
|
45
|
+
if (typeof r.resource.hasRef === 'function' && !r.resource.hasRef())
|
|
46
|
+
return false;
|
|
47
|
+
return true;
|
|
48
|
+
});
|
|
49
|
+
console.error('There are %d handle(s) keeping the process running', activeResources.length);
|
|
50
|
+
function printStacks(o) {
|
|
51
|
+
const stacks = o.stacks.slice(1).filter((s) => {
|
|
52
|
+
const filename = s.getFileName();
|
|
53
|
+
return (filename &&
|
|
54
|
+
filename.indexOf(path_1.sep) > -1 &&
|
|
55
|
+
filename.indexOf('internal' + path_1.sep) !== 0);
|
|
56
|
+
});
|
|
57
|
+
console.error('');
|
|
58
|
+
console.error('# %s', o.type);
|
|
59
|
+
if (stacks[0]) {
|
|
60
|
+
let padding = '';
|
|
61
|
+
stacks.forEach((s) => {
|
|
62
|
+
const pad = (s.getFileName() + ':' + s.getLineNumber()).replace(/./g, ' ');
|
|
63
|
+
if (pad.length > padding.length)
|
|
64
|
+
padding = pad;
|
|
65
|
+
});
|
|
66
|
+
stacks.forEach((s) => {
|
|
67
|
+
const prefix = s.getFileName() + ':' + s.getLineNumber();
|
|
68
|
+
try {
|
|
69
|
+
const src = fs_1.default
|
|
70
|
+
.readFileSync(s.getFileName(), 'utf-8')
|
|
71
|
+
.split(/\n|\r\n/);
|
|
72
|
+
console.error(prefix +
|
|
73
|
+
padding.slice(prefix.length) +
|
|
74
|
+
' - ' +
|
|
75
|
+
src[s.getLineNumber() - 1].trim());
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
console.error(prefix + padding.slice(prefix.length));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
console.error('(unknown stack trace)');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const o of activeResources) {
|
|
87
|
+
printStacks(o);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FileNameAndSize } from './get-files-in-folder';
|
|
2
2
|
import type { ProviderSpecifics } from './provider-implementation';
|
|
3
|
-
import type { CloudProvider } from './
|
|
4
|
-
export type
|
|
3
|
+
import type { CloudProvider } from './types';
|
|
4
|
+
export type FunctionErrorInfo = {
|
|
5
5
|
type: 'renderer' | 'browser' | 'stitcher' | 'webhook' | 'artifact';
|
|
6
6
|
message: string;
|
|
7
7
|
name: string;
|
|
@@ -17,8 +17,8 @@ export type LambdaErrorInfo = {
|
|
|
17
17
|
total: number;
|
|
18
18
|
} | null;
|
|
19
19
|
};
|
|
20
|
-
export declare const getTmpDirStateIfENoSp: <Provider extends CloudProvider>(err: string, providerSpecifics: ProviderSpecifics<Provider>) =>
|
|
21
|
-
export type EnhancedErrorInfo =
|
|
20
|
+
export declare const getTmpDirStateIfENoSp: <Provider extends CloudProvider>(err: string, providerSpecifics: ProviderSpecifics<Provider>) => FunctionErrorInfo["tmpDir"];
|
|
21
|
+
export type EnhancedErrorInfo = FunctionErrorInfo & {
|
|
22
22
|
/**
|
|
23
23
|
* @deprecated Will always be an empty string.
|
|
24
24
|
*/
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/serverless"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/serverless",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.246",
|
|
7
7
|
"description": "A runtime for distributed rendering",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -17,13 +17,14 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"remotion": "4.0.
|
|
21
|
-
"@remotion/renderer": "4.0.
|
|
22
|
-
"@remotion/
|
|
20
|
+
"remotion": "4.0.246",
|
|
21
|
+
"@remotion/renderer": "4.0.246",
|
|
22
|
+
"@remotion/bundler": "4.0.246",
|
|
23
|
+
"@remotion/streaming": "4.0.246"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"eslint": "9.14.0",
|
|
26
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
27
|
+
"@remotion/eslint-config-internal": "4.0.246"
|
|
27
28
|
},
|
|
28
29
|
"exports": {
|
|
29
30
|
".": "./dist/index.js",
|