@remotion/renderer 4.1.0-alpha1 → 4.1.0-alpha11
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 +4 -9
- package/dist/combine-videos.js +5 -1
- package/dist/compositor/compose.js +6 -1
- package/dist/compositor/compositor.d.ts +3 -2
- package/dist/compositor/compositor.js +18 -14
- 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-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 +45 -42
- 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 +76 -31
- 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/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 +20 -7
- package/dist/take-frame-and-compose.js +1 -1
- package/package.json +10 -10
package/dist/client.d.ts
CHANGED
|
@@ -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"];
|
|
@@ -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: {
|
|
@@ -178,8 +173,8 @@ export declare const BrowserSafeApis: {
|
|
|
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
180
|
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">;
|
package/dist/combine-videos.js
CHANGED
|
@@ -7,6 +7,7 @@ const node_path_1 = require("node:path");
|
|
|
7
7
|
const audio_codec_1 = require("./audio-codec");
|
|
8
8
|
const call_ffmpeg_1 = require("./call-ffmpeg");
|
|
9
9
|
const is_audio_codec_1 = require("./is-audio-codec");
|
|
10
|
+
const logger_1 = require("./logger");
|
|
10
11
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
11
12
|
const truthy_1 = require("./truthy");
|
|
12
13
|
const combineVideos = async (options) => {
|
|
@@ -49,7 +50,10 @@ const combineVideos = async (options) => {
|
|
|
49
50
|
(_a = task.stderr) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
|
|
50
51
|
if (onProgress) {
|
|
51
52
|
const parsed = (0, parse_ffmpeg_progress_1.parseFfmpegProgress)(data.toString('utf8'));
|
|
52
|
-
if (parsed
|
|
53
|
+
if (parsed === undefined) {
|
|
54
|
+
logger_1.Log.verbose(data.toString('utf8'));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
53
57
|
onProgress(parsed);
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -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,29 +9,31 @@ 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");
|
|
15
16
|
const make_nonce_1 = require("./make-nonce");
|
|
16
17
|
const getIdealMaximumFrameCacheItems = () => {
|
|
17
18
|
const freeMemory = node_os_1.default.freemem();
|
|
18
|
-
// Assuming 1 frame is approximately
|
|
19
|
+
// Assuming 1 frame is approximately 24MB
|
|
20
|
+
// (4K video)
|
|
19
21
|
// Assuming only half the available memory should be used
|
|
20
|
-
const max = Math.floor(freeMemory / (1024 * 1024 *
|
|
21
|
-
// Never store more than
|
|
22
|
-
// But
|
|
23
|
-
return Math.max(
|
|
22
|
+
const max = Math.floor(freeMemory / (1024 * 1024 * 24));
|
|
23
|
+
// Never store more than 2000 frames
|
|
24
|
+
// But 60 is needed even if it's going to swap
|
|
25
|
+
return Math.max(60, Math.min(max, 2000));
|
|
24
26
|
};
|
|
25
27
|
exports.getIdealMaximumFrameCacheItems = getIdealMaximumFrameCacheItems;
|
|
26
|
-
const startLongRunningCompositor = (maximumFrameCacheItems,
|
|
28
|
+
const startLongRunningCompositor = (maximumFrameCacheItems, logLevel, indent) => {
|
|
27
29
|
return (0, exports.startCompositor)('StartLongRunningProcess', {
|
|
28
30
|
concurrency: (0, get_concurrency_1.getActualConcurrency)(null),
|
|
29
31
|
maximum_frame_cache_items: maximumFrameCacheItems,
|
|
30
|
-
verbose,
|
|
31
|
-
}, indent);
|
|
32
|
+
verbose: (0, log_level_1.isEqualOrBelowLogLevel)(logLevel, 'verbose'),
|
|
33
|
+
}, logLevel, indent);
|
|
32
34
|
};
|
|
33
35
|
exports.startLongRunningCompositor = startLongRunningCompositor;
|
|
34
|
-
const startCompositor = (type, payload, indent) => {
|
|
36
|
+
const startCompositor = (type, payload, logLevel, indent) => {
|
|
35
37
|
var _a;
|
|
36
38
|
const bin = (0, get_executable_path_1.getExecutablePath)('compositor');
|
|
37
39
|
if (!process.env.READ_ONLY_FS) {
|
|
@@ -45,7 +47,7 @@ const startCompositor = (type, payload, indent) => {
|
|
|
45
47
|
const waiters = new Map();
|
|
46
48
|
const onMessage = (statusType, nonce, data) => {
|
|
47
49
|
if (nonce === '0') {
|
|
48
|
-
logger_1.Log.verboseAdvanced({ indent, logLevel
|
|
50
|
+
logger_1.Log.verboseAdvanced({ indent, logLevel, tag: 'compositor' }, data.toString('utf8'));
|
|
49
51
|
}
|
|
50
52
|
if (waiters.has(nonce)) {
|
|
51
53
|
if (statusType === 'error') {
|
|
@@ -144,7 +146,7 @@ const startCompositor = (type, payload, indent) => {
|
|
|
144
146
|
});
|
|
145
147
|
let resolve = null;
|
|
146
148
|
let reject = null;
|
|
147
|
-
child.on('close', (code) => {
|
|
149
|
+
child.on('close', (code, signal) => {
|
|
148
150
|
const waitersToKill = Array.from(waiters.values());
|
|
149
151
|
if (code === 0) {
|
|
150
152
|
runningStatus = { type: 'quit-without-error' };
|
|
@@ -155,9 +157,12 @@ const startCompositor = (type, payload, indent) => {
|
|
|
155
157
|
waiters.clear();
|
|
156
158
|
}
|
|
157
159
|
else {
|
|
158
|
-
const errorMessage = Buffer.concat(stderrChunks).toString('utf-8')
|
|
160
|
+
const errorMessage = Buffer.concat(stderrChunks).toString('utf-8') +
|
|
161
|
+
outputBuffer.toString('utf-8');
|
|
159
162
|
runningStatus = { type: 'quit-with-error', error: errorMessage };
|
|
160
|
-
const error =
|
|
163
|
+
const error = code === null
|
|
164
|
+
? new Error(`Compositor exited with signal ${signal}`)
|
|
165
|
+
: new Error(`Compositor panicked with code ${code}: ${errorMessage}`);
|
|
161
166
|
for (const waiter of waitersToKill) {
|
|
162
167
|
waiter.reject(error);
|
|
163
168
|
}
|
|
@@ -205,7 +210,6 @@ const startCompositor = (type, payload, indent) => {
|
|
|
205
210
|
params,
|
|
206
211
|
},
|
|
207
212
|
};
|
|
208
|
-
// TODO: Should have a way to error out a single task
|
|
209
213
|
child.stdin.write(JSON.stringify(composed) + '\n');
|
|
210
214
|
waiters.set(nonce, {
|
|
211
215
|
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 {};
|