@remotion/renderer 4.1.0-alpha1 → 4.1.0-alpha10
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/assets/download-and-map-assets-to-file.d.ts +2 -4
- package/dist/assets/download-and-map-assets-to-file.js +14 -10
- package/dist/assets/download-map.d.ts +4 -0
- package/dist/assets/download-map.js +3 -0
- package/dist/audio-codec.d.ts +1 -1
- package/dist/browser/Browser.d.ts +7 -6
- package/dist/browser/Browser.js +13 -13
- package/dist/browser/BrowserPage.d.ts +21 -6
- package/dist/browser/BrowserPage.js +80 -19
- package/dist/browser/BrowserRunner.d.ts +0 -1
- package/dist/browser/BrowserRunner.js +6 -6
- package/dist/browser/Connection.d.ts +9 -3
- package/dist/browser/Connection.js +11 -3
- package/dist/browser/ConsoleMessage.d.ts +8 -1
- package/dist/browser/ConsoleMessage.js +2 -1
- package/dist/browser/DOMWorld.d.ts +10 -4
- package/dist/browser/DOMWorld.js +16 -15
- package/dist/browser/ExecutionContext.js +4 -4
- package/dist/browser/FrameManager.d.ts +3 -6
- package/dist/browser/FrameManager.js +11 -16
- package/dist/browser/LaunchOptions.d.ts +2 -0
- package/dist/browser/Launcher.js +3 -3
- package/dist/browser/NetworkManager.d.ts +4 -1
- package/dist/browser/Target.d.ts +2 -1
- package/dist/browser/Target.js +3 -1
- package/dist/browser/create-browser-fetcher.js +19 -24
- package/dist/browser/devtools-types.d.ts +59 -0
- package/dist/browser/should-log-message.js +14 -0
- package/dist/chalk/index.d.ts +2 -1
- package/dist/chalk/index.js +3 -8
- package/dist/chalk/is-color-supported.d.ts +1 -1
- package/dist/chalk/is-color-supported.js +18 -10
- package/dist/client.d.ts +26 -31
- package/dist/compositor/compose.js +6 -1
- package/dist/compositor/compositor.d.ts +3 -2
- package/dist/compositor/compositor.js +10 -10
- package/dist/compositor/payloads.d.ts +15 -1
- package/dist/create-ffmpeg-merge-filter.js +1 -2
- package/dist/cycle-browser-tabs.d.ts +2 -1
- package/dist/cycle-browser-tabs.js +2 -2
- package/dist/format-logs.d.ts +3 -0
- package/dist/format-logs.js +207 -0
- package/dist/get-browser-instance.d.ts +3 -2
- package/dist/get-browser-instance.js +5 -5
- package/dist/get-bundle-url-from-serve-url.d.ts +2 -0
- package/dist/get-bundle-url-from-serve-url.js +30 -0
- package/dist/get-compositions.d.ts +7 -6
- package/dist/get-compositions.js +21 -11
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-local-browser-executable.js +15 -0
- package/dist/get-video-metadata.d.ts +2 -0
- package/dist/get-video-metadata.js +14 -0
- package/dist/index.d.ts +64 -61
- package/dist/index.js +3 -1
- package/dist/logger.d.ts +2 -2
- package/dist/logger.js +23 -18
- package/dist/offthread-video-server.d.ts +3 -3
- package/dist/offthread-video-server.js +65 -29
- package/dist/open-browser.d.ts +3 -2
- package/dist/open-browser.js +7 -5
- package/dist/options/crf.js +1 -1
- package/dist/options/video-codec.js +1 -1
- package/dist/perf.js +4 -2
- package/dist/prepare-server.d.ts +4 -5
- package/dist/prepare-server.js +16 -14
- package/dist/prespawn-ffmpeg.d.ts +2 -1
- package/dist/prespawn-ffmpeg.js +3 -31
- package/dist/puppeteer-evaluate.d.ts +4 -1
- package/dist/puppeteer-evaluate.js +5 -5
- package/dist/render-frames.d.ts +16 -8
- package/dist/render-frames.js +50 -22
- package/dist/render-media.d.ts +17 -9
- package/dist/render-media.js +41 -26
- package/dist/render-still.d.ts +13 -6
- package/dist/render-still.js +32 -17
- package/dist/replace-browser.d.ts +2 -1
- package/dist/replace-browser.js +2 -2
- package/dist/screenshot-task.js +4 -2
- package/dist/seek-to-frame.d.ts +8 -2
- package/dist/seek-to-frame.js +87 -25
- package/dist/select-composition.d.ts +10 -5
- package/dist/select-composition.js +39 -18
- package/dist/serialize-props.d.ts +6 -0
- package/dist/serialize-props.js +36 -0
- package/dist/serve-handler/index.js +1 -1
- package/dist/serve-static.d.ts +2 -3
- package/dist/serve-static.js +10 -4
- package/dist/set-props-and-env.d.ts +4 -1
- package/dist/set-props-and-env.js +52 -22
- package/dist/stitch-frames-to-video.d.ts +2 -1
- package/dist/stitch-frames-to-video.js +12 -22
- package/dist/symbolicate-stacktrace.d.ts +3 -2
- package/dist/symbolicate-stacktrace.js +14 -7
- package/dist/take-frame-and-compose.js +1 -1
- package/dist/validate-output-filename.d.ts +1 -1
- package/package.json +10 -10
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const BrowserSafeApis: {
|
|
2
|
-
getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "
|
|
2
|
+
getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
|
|
3
3
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
|
|
4
4
|
validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
|
|
5
|
-
getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "
|
|
6
|
-
getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "
|
|
7
|
-
isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "
|
|
5
|
+
getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => number;
|
|
6
|
+
getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => [number, number];
|
|
7
|
+
isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif" | undefined) => boolean;
|
|
8
8
|
proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
|
|
9
9
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
10
10
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
@@ -12,7 +12,7 @@ export declare const BrowserSafeApis: {
|
|
|
12
12
|
readonly h264: readonly ["aac", "pcm-16"];
|
|
13
13
|
readonly 'h264-mkv': readonly ["pcm-16"];
|
|
14
14
|
readonly aac: readonly ["aac", "pcm-16"];
|
|
15
|
-
readonly gif:
|
|
15
|
+
readonly gif: readonly [];
|
|
16
16
|
readonly h265: readonly ["aac", "pcm-16"];
|
|
17
17
|
readonly mp3: readonly ["mp3", "pcm-16"];
|
|
18
18
|
readonly prores: readonly ["aac", "pcm-16"];
|
|
@@ -73,10 +73,10 @@ export declare const BrowserSafeApis: {
|
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
|
|
76
|
+
prores: {
|
|
77
77
|
default: import("./file-extensions").FileExtension;
|
|
78
78
|
forAudioCodec: {
|
|
79
|
-
|
|
79
|
+
aac: {
|
|
80
80
|
possible: import("./file-extensions").FileExtension[];
|
|
81
81
|
default: import("./file-extensions").FileExtension;
|
|
82
82
|
};
|
|
@@ -86,10 +86,10 @@ export declare const BrowserSafeApis: {
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
|
-
|
|
89
|
+
mp3: {
|
|
90
90
|
default: import("./file-extensions").FileExtension;
|
|
91
91
|
forAudioCodec: {
|
|
92
|
-
|
|
92
|
+
mp3: {
|
|
93
93
|
possible: import("./file-extensions").FileExtension[];
|
|
94
94
|
default: import("./file-extensions").FileExtension;
|
|
95
95
|
};
|
|
@@ -99,22 +99,22 @@ export declare const BrowserSafeApis: {
|
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
aac: {
|
|
103
103
|
default: import("./file-extensions").FileExtension;
|
|
104
104
|
forAudioCodec: {
|
|
105
|
+
aac: {
|
|
106
|
+
possible: import("./file-extensions").FileExtension[];
|
|
107
|
+
default: import("./file-extensions").FileExtension;
|
|
108
|
+
};
|
|
105
109
|
"pcm-16": {
|
|
106
110
|
possible: import("./file-extensions").FileExtension[];
|
|
107
111
|
default: import("./file-extensions").FileExtension;
|
|
108
112
|
};
|
|
109
113
|
};
|
|
110
114
|
};
|
|
111
|
-
|
|
115
|
+
wav: {
|
|
112
116
|
default: import("./file-extensions").FileExtension;
|
|
113
117
|
forAudioCodec: {
|
|
114
|
-
aac: {
|
|
115
|
-
possible: import("./file-extensions").FileExtension[];
|
|
116
|
-
default: import("./file-extensions").FileExtension;
|
|
117
|
-
};
|
|
118
118
|
"pcm-16": {
|
|
119
119
|
possible: import("./file-extensions").FileExtension[];
|
|
120
120
|
default: import("./file-extensions").FileExtension;
|
|
@@ -132,12 +132,7 @@ export declare const BrowserSafeApis: {
|
|
|
132
132
|
};
|
|
133
133
|
gif: {
|
|
134
134
|
default: import("./file-extensions").FileExtension;
|
|
135
|
-
forAudioCodec: {
|
|
136
|
-
[x: string]: {
|
|
137
|
-
possible: import("./file-extensions").FileExtension[];
|
|
138
|
-
default: import("./file-extensions").FileExtension;
|
|
139
|
-
};
|
|
140
|
-
};
|
|
135
|
+
forAudioCodec: {};
|
|
141
136
|
};
|
|
142
137
|
};
|
|
143
138
|
defaultAudioCodecs: {
|
|
@@ -157,6 +152,10 @@ export declare const BrowserSafeApis: {
|
|
|
157
152
|
compressed: "pcm-16" | "opus" | null;
|
|
158
153
|
lossless: "pcm-16" | "opus" | null;
|
|
159
154
|
};
|
|
155
|
+
prores: {
|
|
156
|
+
compressed: "aac" | "pcm-16" | null;
|
|
157
|
+
lossless: "aac" | "pcm-16" | null;
|
|
158
|
+
};
|
|
160
159
|
mp3: {
|
|
161
160
|
compressed: "mp3" | "pcm-16" | null;
|
|
162
161
|
lossless: "mp3" | "pcm-16" | null;
|
|
@@ -169,21 +168,17 @@ export declare const BrowserSafeApis: {
|
|
|
169
168
|
compressed: "pcm-16" | null;
|
|
170
169
|
lossless: "pcm-16" | null;
|
|
171
170
|
};
|
|
172
|
-
prores: {
|
|
173
|
-
compressed: "aac" | "pcm-16" | null;
|
|
174
|
-
lossless: "aac" | "pcm-16" | null;
|
|
175
|
-
};
|
|
176
171
|
"h264-mkv": {
|
|
177
172
|
compressed: "pcm-16" | null;
|
|
178
173
|
lossless: "pcm-16" | null;
|
|
179
174
|
};
|
|
180
175
|
gif: {
|
|
181
|
-
compressed:
|
|
182
|
-
lossless:
|
|
176
|
+
compressed: null;
|
|
177
|
+
lossless: null;
|
|
183
178
|
};
|
|
184
179
|
};
|
|
185
|
-
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "
|
|
186
|
-
validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "
|
|
180
|
+
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">;
|
|
181
|
+
validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
|
|
187
182
|
codec: T_1;
|
|
188
183
|
audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
|
|
189
184
|
extension: string;
|
|
@@ -199,6 +194,6 @@ export declare const BrowserSafeApis: {
|
|
|
199
194
|
muteOption: import(".").RemotionOption;
|
|
200
195
|
videoCodecOption: import(".").RemotionOption;
|
|
201
196
|
};
|
|
202
|
-
codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "
|
|
203
|
-
codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "
|
|
197
|
+
codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => boolean;
|
|
198
|
+
codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => boolean;
|
|
204
199
|
};
|
|
@@ -71,10 +71,15 @@ const callCompositor = (payload) => {
|
|
|
71
71
|
reject(err);
|
|
72
72
|
}
|
|
73
73
|
catch (err) {
|
|
74
|
-
reject(new Error(`Compositor panicked: ${message}`));
|
|
74
|
+
reject(new Error(`Compositor panicked with code ${code}: ${message}`));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
+
if (child.stdin.closed) {
|
|
79
|
+
reject(new Error('Compositor stdin closed unexpectedly,' +
|
|
80
|
+
Buffer.concat(stderrChunks).toString('utf-8')));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
78
83
|
child.stdin.write(payload);
|
|
79
84
|
child.stdin.end();
|
|
80
85
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import type { LogLevel } from '../log-level';
|
|
2
3
|
import type { CompositorCommand } from './payloads';
|
|
3
4
|
export type Compositor = {
|
|
4
5
|
finishCommands: () => void;
|
|
@@ -7,5 +8,5 @@ export type Compositor = {
|
|
|
7
8
|
pid: number | null;
|
|
8
9
|
};
|
|
9
10
|
export declare const getIdealMaximumFrameCacheItems: () => number;
|
|
10
|
-
export declare const startLongRunningCompositor: (maximumFrameCacheItems: number,
|
|
11
|
-
export declare const startCompositor: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T], indent: boolean) => Compositor;
|
|
11
|
+
export declare const startLongRunningCompositor: (maximumFrameCacheItems: number, logLevel: LogLevel, indent: boolean) => Compositor;
|
|
12
|
+
export declare const startCompositor: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T], logLevel: LogLevel, indent: boolean) => Compositor;
|
|
@@ -9,6 +9,7 @@ const node_fs_1 = require("node:fs");
|
|
|
9
9
|
const node_os_1 = __importDefault(require("node:os"));
|
|
10
10
|
const call_ffmpeg_1 = require("../call-ffmpeg");
|
|
11
11
|
const get_concurrency_1 = require("../get-concurrency");
|
|
12
|
+
const log_level_1 = require("../log-level");
|
|
12
13
|
const logger_1 = require("../logger");
|
|
13
14
|
const compose_1 = require("./compose");
|
|
14
15
|
const get_executable_path_1 = require("./get-executable-path");
|
|
@@ -18,20 +19,20 @@ const getIdealMaximumFrameCacheItems = () => {
|
|
|
18
19
|
// Assuming 1 frame is approximately 6MB
|
|
19
20
|
// Assuming only half the available memory should be used
|
|
20
21
|
const max = Math.floor(freeMemory / (1024 * 1024 * 6));
|
|
21
|
-
// Never store more than
|
|
22
|
-
// But
|
|
23
|
-
return Math.max(
|
|
22
|
+
// Never store more than 2000 frames
|
|
23
|
+
// But 60 is needed even if it's going to swap
|
|
24
|
+
return Math.max(60, Math.min(max, 2000));
|
|
24
25
|
};
|
|
25
26
|
exports.getIdealMaximumFrameCacheItems = getIdealMaximumFrameCacheItems;
|
|
26
|
-
const startLongRunningCompositor = (maximumFrameCacheItems,
|
|
27
|
+
const startLongRunningCompositor = (maximumFrameCacheItems, logLevel, indent) => {
|
|
27
28
|
return (0, exports.startCompositor)('StartLongRunningProcess', {
|
|
28
29
|
concurrency: (0, get_concurrency_1.getActualConcurrency)(null),
|
|
29
30
|
maximum_frame_cache_items: maximumFrameCacheItems,
|
|
30
|
-
verbose,
|
|
31
|
-
}, indent);
|
|
31
|
+
verbose: (0, log_level_1.isEqualOrBelowLogLevel)(logLevel, 'verbose'),
|
|
32
|
+
}, logLevel, indent);
|
|
32
33
|
};
|
|
33
34
|
exports.startLongRunningCompositor = startLongRunningCompositor;
|
|
34
|
-
const startCompositor = (type, payload, indent) => {
|
|
35
|
+
const startCompositor = (type, payload, logLevel, indent) => {
|
|
35
36
|
var _a;
|
|
36
37
|
const bin = (0, get_executable_path_1.getExecutablePath)('compositor');
|
|
37
38
|
if (!process.env.READ_ONLY_FS) {
|
|
@@ -45,7 +46,7 @@ const startCompositor = (type, payload, indent) => {
|
|
|
45
46
|
const waiters = new Map();
|
|
46
47
|
const onMessage = (statusType, nonce, data) => {
|
|
47
48
|
if (nonce === '0') {
|
|
48
|
-
logger_1.Log.verboseAdvanced({ indent, logLevel
|
|
49
|
+
logger_1.Log.verboseAdvanced({ indent, logLevel, tag: 'compositor' }, data.toString('utf8'));
|
|
49
50
|
}
|
|
50
51
|
if (waiters.has(nonce)) {
|
|
51
52
|
if (statusType === 'error') {
|
|
@@ -157,7 +158,7 @@ const startCompositor = (type, payload, indent) => {
|
|
|
157
158
|
else {
|
|
158
159
|
const errorMessage = Buffer.concat(stderrChunks).toString('utf-8');
|
|
159
160
|
runningStatus = { type: 'quit-with-error', error: errorMessage };
|
|
160
|
-
const error = new Error(`Compositor panicked: ${errorMessage}`);
|
|
161
|
+
const error = new Error(`Compositor panicked with code ${code}: ${errorMessage}`);
|
|
161
162
|
for (const waiter of waitersToKill) {
|
|
162
163
|
waiter.reject(error);
|
|
163
164
|
}
|
|
@@ -205,7 +206,6 @@ const startCompositor = (type, payload, indent) => {
|
|
|
205
206
|
params,
|
|
206
207
|
},
|
|
207
208
|
};
|
|
208
|
-
// TODO: Should have a way to error out a single task
|
|
209
209
|
child.stdin.write(JSON.stringify(composed) + '\n');
|
|
210
210
|
waiters.set(nonce, {
|
|
211
211
|
resolve: _resolve,
|
|
@@ -27,6 +27,15 @@ export type Layer = {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
export type CompositorImageFormat = 'Png' | 'Jpeg';
|
|
30
|
+
export type VideoMetadata = {
|
|
31
|
+
fps: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
durationInSeconds: number;
|
|
35
|
+
codec: 'h264' | 'h265' | 'vp8' | 'vp9' | 'av1' | 'prores' | 'unknown';
|
|
36
|
+
canPlayInVideoTag: boolean;
|
|
37
|
+
supportsSeeking: boolean;
|
|
38
|
+
};
|
|
30
39
|
export type CompositorCommand = {
|
|
31
40
|
Compose: {
|
|
32
41
|
output: string;
|
|
@@ -36,7 +45,8 @@ export type CompositorCommand = {
|
|
|
36
45
|
output_format: CompositorImageFormat;
|
|
37
46
|
};
|
|
38
47
|
ExtractFrame: {
|
|
39
|
-
|
|
48
|
+
src: string;
|
|
49
|
+
original_src: string;
|
|
40
50
|
time: number;
|
|
41
51
|
transparent: boolean;
|
|
42
52
|
};
|
|
@@ -54,6 +64,10 @@ export type CompositorCommand = {
|
|
|
54
64
|
FreeUpMemory: {
|
|
55
65
|
percent_of_memory: number;
|
|
56
66
|
};
|
|
67
|
+
GetVideoMetadata: {
|
|
68
|
+
src: string;
|
|
69
|
+
};
|
|
70
|
+
VideoMetadata: VideoMetadata;
|
|
57
71
|
};
|
|
58
72
|
export type CompositorCommandSerialized<T extends keyof CompositorCommand> = {
|
|
59
73
|
nonce: string;
|
|
@@ -12,7 +12,6 @@ const createFfmpegMergeFilter = ({ inputs, }) => {
|
|
|
12
12
|
];
|
|
13
13
|
return `[${index}:a]${filters.filter(truthy_1.truthy).join(',')}[padded${index}]`;
|
|
14
14
|
});
|
|
15
|
-
const normalize = ':normalize=0';
|
|
16
15
|
return [
|
|
17
16
|
...pads,
|
|
18
17
|
`${new Array(inputs.length)
|
|
@@ -20,7 +19,7 @@ const createFfmpegMergeFilter = ({ inputs, }) => {
|
|
|
20
19
|
.map((_, i) => {
|
|
21
20
|
return `[padded${i}]`;
|
|
22
21
|
})
|
|
23
|
-
.join('')}amix=inputs=${inputs.length}:dropout_transition=0
|
|
22
|
+
.join('')}amix=inputs=${inputs.length}:dropout_transition=0:normalize=0[${exports.OUTPUT_FILTER_NAME}]`,
|
|
24
23
|
].join(';');
|
|
25
24
|
};
|
|
26
25
|
exports.createFfmpegMergeFilter = createFfmpegMergeFilter;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { LogLevel } from './log-level';
|
|
1
2
|
import type { BrowserReplacer } from './replace-browser';
|
|
2
|
-
export declare const cycleBrowserTabs: (puppeteerInstance: BrowserReplacer, concurrency: number) => {
|
|
3
|
+
export declare const cycleBrowserTabs: (puppeteerInstance: BrowserReplacer, concurrency: number, logLevel: LogLevel, indent: boolean) => {
|
|
3
4
|
stopCycling: () => void;
|
|
4
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cycleBrowserTabs = void 0;
|
|
4
|
-
const cycleBrowserTabs = (puppeteerInstance, concurrency) => {
|
|
4
|
+
const cycleBrowserTabs = (puppeteerInstance, concurrency, logLevel, indent) => {
|
|
5
5
|
if (concurrency <= 1) {
|
|
6
6
|
return {
|
|
7
7
|
stopCycling: () => undefined,
|
|
@@ -14,7 +14,7 @@ const cycleBrowserTabs = (puppeteerInstance, concurrency) => {
|
|
|
14
14
|
interval = setTimeout(() => {
|
|
15
15
|
puppeteerInstance
|
|
16
16
|
.getBrowser()
|
|
17
|
-
.pages()
|
|
17
|
+
.pages(logLevel, indent)
|
|
18
18
|
.then((pages) => {
|
|
19
19
|
if (pages.length === 0) {
|
|
20
20
|
return;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatObjectPreview = exports.formatRemoteObject = void 0;
|
|
4
|
+
const chalk_1 = require("./chalk");
|
|
5
|
+
const formatRemoteObject = (remoteObject) => {
|
|
6
|
+
if (remoteObject.preview) {
|
|
7
|
+
return (0, exports.formatObjectPreview)(remoteObject.preview);
|
|
8
|
+
}
|
|
9
|
+
if (remoteObject.type === 'string') {
|
|
10
|
+
return chalk_1.chalk.reset(`${remoteObject.value}`);
|
|
11
|
+
}
|
|
12
|
+
if (remoteObject.type === 'number') {
|
|
13
|
+
return chalk_1.chalk.yellow(`${remoteObject.value}`);
|
|
14
|
+
}
|
|
15
|
+
if (remoteObject.type === 'bigint') {
|
|
16
|
+
return chalk_1.chalk.yellow(`${remoteObject.description}`);
|
|
17
|
+
}
|
|
18
|
+
if (remoteObject.type === 'boolean') {
|
|
19
|
+
return chalk_1.chalk.yellow(`${remoteObject.value}`);
|
|
20
|
+
}
|
|
21
|
+
if (remoteObject.type === 'function') {
|
|
22
|
+
return chalk_1.chalk.cyan(String(remoteObject.description));
|
|
23
|
+
}
|
|
24
|
+
if (remoteObject.type === 'object') {
|
|
25
|
+
if (remoteObject.subtype === 'null') {
|
|
26
|
+
return chalk_1.chalk.white(`null`);
|
|
27
|
+
}
|
|
28
|
+
return chalk_1.chalk.reset(`Object`);
|
|
29
|
+
}
|
|
30
|
+
if (remoteObject.type === 'symbol') {
|
|
31
|
+
return chalk_1.chalk.green(`${remoteObject.description}`);
|
|
32
|
+
}
|
|
33
|
+
if (remoteObject.type === 'undefined') {
|
|
34
|
+
return chalk_1.chalk.gray(`undefined`);
|
|
35
|
+
}
|
|
36
|
+
throw new Error('unhandled remote object');
|
|
37
|
+
};
|
|
38
|
+
exports.formatRemoteObject = formatRemoteObject;
|
|
39
|
+
const formatObjectPreview = (preview) => {
|
|
40
|
+
if (typeof preview === 'undefined') {
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
if (preview.type === 'object') {
|
|
44
|
+
if (preview.subtype === 'date') {
|
|
45
|
+
return chalk_1.chalk.reset(`Date { ${chalk_1.chalk.magenta(String(preview.description))} }`);
|
|
46
|
+
}
|
|
47
|
+
const properties = preview.properties.map((property) => {
|
|
48
|
+
return chalk_1.chalk.reset(`${property.name}: ${formatProperty(property)}`);
|
|
49
|
+
});
|
|
50
|
+
if (preview.subtype === 'array') {
|
|
51
|
+
if (preview.overflow) {
|
|
52
|
+
return chalk_1.chalk.reset(`[ ${preview.properties.map((p) => formatProperty(p)).join(', ')}, …]`);
|
|
53
|
+
}
|
|
54
|
+
return chalk_1.chalk.reset(`[ ${preview.properties.map((p) => formatProperty(p)).join(', ')} ]`);
|
|
55
|
+
}
|
|
56
|
+
if (preview.subtype === 'arraybuffer') {
|
|
57
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
58
|
+
}
|
|
59
|
+
if (preview.subtype === 'dataview') {
|
|
60
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
61
|
+
}
|
|
62
|
+
if (preview.subtype === 'generator') {
|
|
63
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
64
|
+
}
|
|
65
|
+
if (preview.subtype === 'iterator') {
|
|
66
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
67
|
+
}
|
|
68
|
+
if (preview.subtype === 'map') {
|
|
69
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
70
|
+
}
|
|
71
|
+
if (preview.subtype === 'node') {
|
|
72
|
+
return chalk_1.chalk.magenta(`<${preview.description}>`);
|
|
73
|
+
}
|
|
74
|
+
if (preview.subtype === 'null') {
|
|
75
|
+
return chalk_1.chalk.white(String(preview.description));
|
|
76
|
+
}
|
|
77
|
+
if (preview.subtype === 'promise') {
|
|
78
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
79
|
+
}
|
|
80
|
+
if (preview.subtype === 'proxy') {
|
|
81
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
82
|
+
}
|
|
83
|
+
if (preview.subtype === 'regexp') {
|
|
84
|
+
return chalk_1.chalk.red(String(preview.description));
|
|
85
|
+
}
|
|
86
|
+
if (preview.subtype === 'set') {
|
|
87
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
88
|
+
}
|
|
89
|
+
if (preview.subtype === 'typedarray') {
|
|
90
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
91
|
+
}
|
|
92
|
+
if (preview.subtype === 'error') {
|
|
93
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
94
|
+
}
|
|
95
|
+
if (preview.subtype === 'wasmvalue') {
|
|
96
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
97
|
+
}
|
|
98
|
+
if (preview.subtype === 'weakmap') {
|
|
99
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
100
|
+
}
|
|
101
|
+
if (preview.subtype === 'weakset') {
|
|
102
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
103
|
+
}
|
|
104
|
+
if (preview.subtype === 'webassemblymemory') {
|
|
105
|
+
return chalk_1.chalk.reset(String(preview.description));
|
|
106
|
+
}
|
|
107
|
+
if (properties.length === 0) {
|
|
108
|
+
return chalk_1.chalk.reset('{}');
|
|
109
|
+
}
|
|
110
|
+
if (preview.overflow) {
|
|
111
|
+
return chalk_1.chalk.reset(`{ ${properties.join(', ')}, …}`);
|
|
112
|
+
}
|
|
113
|
+
return chalk_1.chalk.reset(`{ ${properties.join(', ')} }`);
|
|
114
|
+
}
|
|
115
|
+
return '';
|
|
116
|
+
};
|
|
117
|
+
exports.formatObjectPreview = formatObjectPreview;
|
|
118
|
+
const formatProperty = (property) => {
|
|
119
|
+
if (property.type === 'string') {
|
|
120
|
+
return chalk_1.chalk.green(`"${property.value}"`);
|
|
121
|
+
}
|
|
122
|
+
if (property.type === 'object') {
|
|
123
|
+
if (!property.subtype && property.value === 'Object') {
|
|
124
|
+
return chalk_1.chalk.reset(`{…}`);
|
|
125
|
+
}
|
|
126
|
+
if (property.subtype === 'date') {
|
|
127
|
+
return chalk_1.chalk.reset(`Date { ${chalk_1.chalk.magenta(String(property.value))} }`);
|
|
128
|
+
}
|
|
129
|
+
if (property.subtype === 'arraybuffer') {
|
|
130
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
131
|
+
}
|
|
132
|
+
if (property.subtype === 'array') {
|
|
133
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
134
|
+
}
|
|
135
|
+
if (property.subtype === 'dataview') {
|
|
136
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
137
|
+
}
|
|
138
|
+
if (property.subtype === 'error') {
|
|
139
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
140
|
+
}
|
|
141
|
+
if (property.subtype === 'generator') {
|
|
142
|
+
return chalk_1.chalk.reset(`[generator ${property.value}]`);
|
|
143
|
+
}
|
|
144
|
+
if (property.subtype === 'iterator') {
|
|
145
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
146
|
+
}
|
|
147
|
+
if (property.subtype === 'map') {
|
|
148
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
149
|
+
}
|
|
150
|
+
if (property.subtype === 'node') {
|
|
151
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
152
|
+
}
|
|
153
|
+
if (property.subtype === 'null') {
|
|
154
|
+
return chalk_1.chalk.white(`${property.value}`);
|
|
155
|
+
}
|
|
156
|
+
if (property.subtype === 'promise') {
|
|
157
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
158
|
+
}
|
|
159
|
+
if (property.subtype === 'proxy') {
|
|
160
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
161
|
+
}
|
|
162
|
+
if (property.subtype === 'regexp') {
|
|
163
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
164
|
+
}
|
|
165
|
+
if (property.subtype === 'set') {
|
|
166
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
167
|
+
}
|
|
168
|
+
if (property.subtype === 'typedarray') {
|
|
169
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
170
|
+
}
|
|
171
|
+
if (property.subtype === 'wasmvalue') {
|
|
172
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
173
|
+
}
|
|
174
|
+
if (property.subtype === 'webassemblymemory') {
|
|
175
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
176
|
+
}
|
|
177
|
+
if (property.subtype === 'weakmap') {
|
|
178
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
179
|
+
}
|
|
180
|
+
if (property.subtype === 'weakset') {
|
|
181
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
182
|
+
}
|
|
183
|
+
return chalk_1.chalk.reset(`${property.value}`);
|
|
184
|
+
}
|
|
185
|
+
if (property.type === 'accessor') {
|
|
186
|
+
return chalk_1.chalk.gray(`get()`);
|
|
187
|
+
}
|
|
188
|
+
if (property.type === 'bigint') {
|
|
189
|
+
return chalk_1.chalk.yellow(`${property.value}`);
|
|
190
|
+
}
|
|
191
|
+
if (property.type === 'boolean') {
|
|
192
|
+
return chalk_1.chalk.yellow(`${property.value}`);
|
|
193
|
+
}
|
|
194
|
+
if (property.type === 'function') {
|
|
195
|
+
return chalk_1.chalk.cyan(`Function`);
|
|
196
|
+
}
|
|
197
|
+
if (property.type === 'number') {
|
|
198
|
+
return chalk_1.chalk.yellow(`${property.value}`);
|
|
199
|
+
}
|
|
200
|
+
if (property.type === 'symbol') {
|
|
201
|
+
return chalk_1.chalk.green(`${property.value}`);
|
|
202
|
+
}
|
|
203
|
+
if (property.type === 'undefined') {
|
|
204
|
+
return chalk_1.chalk.gray(`undefined`);
|
|
205
|
+
}
|
|
206
|
+
throw new Error('unexpected property type ' + JSON.stringify(property));
|
|
207
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { BrowserExecutable } from './browser-executable';
|
|
2
2
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
3
3
|
import type { Page } from './browser/BrowserPage';
|
|
4
|
+
import type { LogLevel } from './log-level';
|
|
4
5
|
import type { ChromiumOptions } from './open-browser';
|
|
5
6
|
import type { AnySourceMapConsumer } from './symbolicate-stacktrace';
|
|
6
|
-
export declare const getPageAndCleanupFn: ({ passedInInstance, browserExecutable, chromiumOptions, context, forceDeviceScaleFactor, indent,
|
|
7
|
+
export declare const getPageAndCleanupFn: ({ passedInInstance, browserExecutable, chromiumOptions, context, forceDeviceScaleFactor, indent, logLevel, }: {
|
|
7
8
|
passedInInstance: HeadlessBrowser | undefined;
|
|
8
9
|
browserExecutable: BrowserExecutable | null;
|
|
9
10
|
chromiumOptions: ChromiumOptions;
|
|
10
11
|
context: AnySourceMapConsumer | null;
|
|
11
12
|
indent: boolean;
|
|
12
13
|
forceDeviceScaleFactor: number | undefined;
|
|
13
|
-
|
|
14
|
+
logLevel: LogLevel;
|
|
14
15
|
}) => Promise<{
|
|
15
16
|
cleanup: () => void;
|
|
16
17
|
page: Page;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPageAndCleanupFn = void 0;
|
|
4
4
|
const browser_1 = require("./browser");
|
|
5
5
|
const open_browser_1 = require("./open-browser");
|
|
6
|
-
const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromiumOptions, context, forceDeviceScaleFactor, indent,
|
|
6
|
+
const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromiumOptions, context, forceDeviceScaleFactor, indent, logLevel, }) => {
|
|
7
7
|
if (passedInInstance) {
|
|
8
|
-
const page = await passedInInstance.newPage(context);
|
|
8
|
+
const page = await passedInInstance.newPage(Promise.resolve(context), logLevel, indent);
|
|
9
9
|
return {
|
|
10
10
|
page,
|
|
11
11
|
cleanup: () => {
|
|
@@ -23,15 +23,15 @@ const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromi
|
|
|
23
23
|
chromiumOptions,
|
|
24
24
|
forceDeviceScaleFactor,
|
|
25
25
|
indent,
|
|
26
|
-
shouldDumpIo,
|
|
27
26
|
viewport: null,
|
|
27
|
+
logLevel,
|
|
28
28
|
});
|
|
29
|
-
const browserPage = await browserInstance.newPage(context);
|
|
29
|
+
const browserPage = await browserInstance.newPage(Promise.resolve(context), logLevel, indent);
|
|
30
30
|
return {
|
|
31
31
|
page: browserPage,
|
|
32
32
|
cleanup: () => {
|
|
33
33
|
// Close whole browser that was just created and don't wait for it to finish.
|
|
34
|
-
browserInstance.close(true).catch((err) => {
|
|
34
|
+
browserInstance.close(true, logLevel, indent).catch((err) => {
|
|
35
35
|
console.error('Was not able to close puppeteer page', err);
|
|
36
36
|
});
|
|
37
37
|
},
|
|
@@ -0,0 +1,30 @@
|
|
|
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.getBundleMapUrlFromServeUrl = exports.getBundleUrlFromServeUrl = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const remotion_1 = require("remotion");
|
|
9
|
+
const is_serve_url_1 = require("./is-serve-url");
|
|
10
|
+
const map = (webpackBundleOrServeUrl, suffix) => {
|
|
11
|
+
if ((0, is_serve_url_1.isServeUrl)(webpackBundleOrServeUrl)) {
|
|
12
|
+
const parsed = new URL(webpackBundleOrServeUrl);
|
|
13
|
+
const idx = parsed.pathname.lastIndexOf('/');
|
|
14
|
+
if (idx === -1) {
|
|
15
|
+
return parsed.origin + '/' + suffix;
|
|
16
|
+
}
|
|
17
|
+
return parsed.origin + parsed.pathname.substring(0, idx + 1) + suffix;
|
|
18
|
+
}
|
|
19
|
+
const index = webpackBundleOrServeUrl.lastIndexOf(path_1.default.sep);
|
|
20
|
+
const url = webpackBundleOrServeUrl.substring(0, index + 1) + suffix;
|
|
21
|
+
return url;
|
|
22
|
+
};
|
|
23
|
+
const getBundleUrlFromServeUrl = (serveUrl) => {
|
|
24
|
+
return map(serveUrl, remotion_1.Internals.bundleName);
|
|
25
|
+
};
|
|
26
|
+
exports.getBundleUrlFromServeUrl = getBundleUrlFromServeUrl;
|
|
27
|
+
const getBundleMapUrlFromServeUrl = (serveUrl) => {
|
|
28
|
+
return map(serveUrl, remotion_1.Internals.bundleMapName);
|
|
29
|
+
};
|
|
30
|
+
exports.getBundleMapUrlFromServeUrl = getBundleMapUrlFromServeUrl;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type VideoConfig } from 'remotion';
|
|
2
2
|
import type { BrowserExecutable } from './browser-executable';
|
|
3
3
|
import type { BrowserLog } from './browser-log';
|
|
4
4
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
5
|
+
import { type LogLevel } from './log-level';
|
|
5
6
|
import type { ChromiumOptions } from './open-browser';
|
|
6
7
|
import type { RemotionServer } from './prepare-server';
|
|
7
8
|
type InternalGetCompositionsOptions = {
|
|
8
|
-
|
|
9
|
+
serializedInputPropsWithCustomSchema: string;
|
|
9
10
|
envVariables: Record<string, string>;
|
|
10
11
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
11
12
|
onBrowserLog: null | ((log: BrowserLog) => void);
|
|
@@ -15,7 +16,7 @@ type InternalGetCompositionsOptions = {
|
|
|
15
16
|
port: number | null;
|
|
16
17
|
server: RemotionServer | undefined;
|
|
17
18
|
indent: boolean;
|
|
18
|
-
|
|
19
|
+
logLevel: LogLevel;
|
|
19
20
|
serveUrlOrWebpackUrl: string;
|
|
20
21
|
};
|
|
21
22
|
export type GetCompositionsOptions = {
|
|
@@ -27,12 +28,12 @@ export type GetCompositionsOptions = {
|
|
|
27
28
|
timeoutInMilliseconds?: number;
|
|
28
29
|
chromiumOptions?: ChromiumOptions;
|
|
29
30
|
port?: number | null;
|
|
30
|
-
|
|
31
|
+
logLevel?: LogLevel;
|
|
31
32
|
};
|
|
32
|
-
export declare const internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent,
|
|
33
|
+
export declare const internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, }: InternalGetCompositionsOptions) => Promise<VideoConfig[]>;
|
|
33
34
|
/**
|
|
34
35
|
* @description Gets the compositions defined in a Remotion project based on a Webpack bundle.
|
|
35
36
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
|
|
36
37
|
*/
|
|
37
|
-
export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsOptions) => Promise<
|
|
38
|
+
export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsOptions) => Promise<VideoConfig[]>;
|
|
38
39
|
export {};
|