@remotion/renderer 4.0.0-alpha4 → 4.0.0-alpha5
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/README.md +5 -43
- package/dist/assets/download-map.d.ts +0 -26
- package/dist/assets/download-map.js +0 -5
- package/dist/assets/get-audio-channels.d.ts +1 -2
- package/dist/assets/get-audio-channels.js +5 -9
- package/dist/audio-codec.d.ts +4 -3
- package/dist/audio-codec.js +3 -9
- package/dist/browser/BrowserFetcher.d.ts +0 -1
- package/dist/browser/BrowserFetcher.js +1 -2
- package/dist/browser/BrowserRunner.js +8 -2
- package/dist/browser/FrameManager.js +2 -3
- package/dist/browser/LaunchOptions.d.ts +1 -0
- package/dist/browser/Launcher.js +2 -1
- package/dist/browser/devtools-commands.d.ts +5 -1
- package/dist/browser/devtools-types.d.ts +78 -0
- package/dist/browser/is-target-closed-err.d.ts +1 -0
- package/dist/browser/is-target-closed-err.js +9 -0
- package/dist/call-ffmpeg.d.ts +14 -0
- package/dist/call-ffmpeg.js +37 -0
- package/dist/check-apple-silicon.js +2 -45
- package/dist/client.d.ts +67 -42
- package/dist/client.js +27 -1
- package/dist/codec-supports-media.d.ts +2 -1
- package/dist/codec-supports-media.js +20 -5
- package/dist/combine-videos.d.ts +0 -3
- package/dist/combine-videos.js +5 -9
- package/dist/compositor/compose.d.ts +3 -1
- package/dist/compositor/compose.js +34 -14
- package/dist/compositor/compositor.d.ts +12 -0
- package/dist/compositor/compositor.js +202 -0
- package/dist/compositor/get-executable-path.d.ts +1 -1
- package/dist/compositor/get-executable-path.js +27 -8
- package/dist/compositor/make-nonce.d.ts +1 -0
- package/dist/compositor/make-nonce.js +8 -0
- package/dist/compositor/payloads.d.ts +34 -7
- package/dist/create-ffmpeg-complex-filter.d.ts +5 -5
- package/dist/create-ffmpeg-complex-filter.js +2 -4
- package/dist/create-ffmpeg-merge-filter.d.ts +2 -5
- package/dist/create-ffmpeg-merge-filter.js +2 -10
- package/dist/create-silent-audio.d.ts +1 -4
- package/dist/create-silent-audio.js +3 -7
- package/dist/crf.js +8 -2
- package/dist/delete-directory.js +16 -16
- package/dist/file-extensions.d.ts +1 -12
- package/dist/file-extensions.js +1 -13
- package/dist/get-compositions.d.ts +3 -5
- package/dist/get-compositions.js +8 -11
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-frame-padded-index.d.ts +2 -1
- package/dist/guess-extension-for-media.d.ts +1 -3
- package/dist/guess-extension-for-media.js +4 -8
- package/dist/image-format.d.ts +12 -6
- package/dist/image-format.js +16 -13
- package/dist/index.d.ts +66 -59
- package/dist/index.js +15 -17
- package/dist/jpeg-quality.d.ts +1 -0
- package/dist/jpeg-quality.js +21 -0
- package/dist/merge-audio-track.d.ts +0 -2
- package/dist/merge-audio-track.js +3 -10
- package/dist/offthread-video-server.d.ts +8 -8
- package/dist/offthread-video-server.js +63 -56
- package/dist/open-browser.d.ts +1 -0
- package/dist/open-browser.js +7 -6
- package/dist/options/audio-bitrate.d.ts +2 -0
- package/dist/options/audio-bitrate.js +11 -0
- package/dist/options/crf.d.ts +2 -0
- package/dist/options/crf.js +11 -0
- package/dist/options/enforce-audio.d.ts +2 -0
- package/dist/options/enforce-audio.js +11 -0
- package/dist/options/jpeg-quality.d.ts +2 -0
- package/dist/options/jpeg-quality.js +11 -0
- package/dist/options/mute.d.ts +2 -0
- package/dist/options/mute.js +11 -0
- package/dist/options/option.d.ts +8 -0
- package/dist/options/option.js +2 -0
- package/dist/options/scale.d.ts +2 -0
- package/dist/options/scale.js +11 -0
- package/dist/options/video-bitrate.d.ts +2 -0
- package/dist/options/video-bitrate.js +11 -0
- package/dist/options/video-codec.d.ts +2 -0
- package/dist/options/video-codec.js +11 -0
- package/dist/perf.d.ts +1 -1
- package/dist/perf.js +9 -7
- package/dist/prepare-server.d.ts +3 -4
- package/dist/prepare-server.js +5 -5
- package/dist/preprocess-audio-track.d.ts +0 -4
- package/dist/preprocess-audio-track.js +4 -8
- package/dist/prespawn-ffmpeg.d.ts +6 -9
- package/dist/prespawn-ffmpeg.js +7 -12
- package/dist/prestitcher-memory-usage.d.ts +0 -4
- package/dist/prestitcher-memory-usage.js +2 -3
- package/dist/prores-profile.d.ts +1 -2
- package/dist/prores-profile.js +4 -4
- package/dist/provide-screenshot.d.ts +4 -5
- package/dist/provide-screenshot.js +2 -2
- package/dist/puppeteer-screenshot.d.ts +3 -3
- package/dist/puppeteer-screenshot.js +9 -32
- package/dist/render-frames.d.ts +13 -25
- package/dist/render-frames.js +29 -40
- package/dist/render-media.d.ts +16 -18
- package/dist/render-media.js +33 -43
- package/dist/render-still.d.ts +10 -8
- package/dist/render-still.js +14 -13
- package/dist/screenshot-dom-element.d.ts +4 -5
- package/dist/screenshot-dom-element.js +6 -3
- package/dist/screenshot-task.d.ts +2 -3
- package/dist/screenshot-task.js +38 -23
- package/dist/serve-handler/index.js +6 -4
- package/dist/serve-static.d.ts +2 -3
- package/dist/serve-static.js +24 -20
- package/dist/stitch-frames-to-video.d.ts +2 -12
- package/dist/stitch-frames-to-video.js +24 -33
- package/dist/take-frame-and-compose.d.ts +4 -5
- package/dist/take-frame-and-compose.js +12 -6
- package/dist/tmp-dir.js +1 -2
- package/dist/validate-concurrency.d.ts +2 -0
- package/dist/validate-concurrency.js +11 -5
- package/dist/validate-output-filename.d.ts +1 -1
- package/dist/validate-puppeteer-timeout.js +1 -0
- package/install-toolchain.mjs +36 -0
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -1,47 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Renderer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Contains TypeScript + Rust code for rendering a Remotion video.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
See the public APIs here: https://remotion.dev/docs/renderer
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Development
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
curl https://sh.rustup.rs -sSf | sh
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Second, install components that allow for cross-compilation:
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
sh install_platforms.sh
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Third, install linkers for cross compilation:
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
brew install MaterializeInc/crosstools/x86_64-unknown-linux-gnu
|
|
25
|
-
brew install MaterializeInc/crosstools/aarch64-unknown-linux-gnu
|
|
26
|
-
brew install messense/macos-cross-toolchains/x86_64-unknown-linux-musl
|
|
27
|
-
brew install messense/macos-cross-toolchains/aarch64-unknown-linux-musl
|
|
28
|
-
brew install mingw-w64
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
> This will take a few minutes.
|
|
32
|
-
|
|
33
|
-
## Building
|
|
34
|
-
|
|
35
|
-
To build the Rust parts for your operating system, run:
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
node build.mjs
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
To build the Rust binaries for all supported platforms, run:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
node build.mjs --all
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
The resulting artifacts should be checked into Git.
|
|
9
|
+
For developing the Rust parts, see https://remotion.dev/docs/contributing/rust.
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { TAsset } from 'remotion';
|
|
3
|
-
declare type EncodingStatus = {
|
|
4
|
-
type: 'encoding';
|
|
5
|
-
} | {
|
|
6
|
-
type: 'done';
|
|
7
|
-
src: string;
|
|
8
|
-
} | undefined;
|
|
9
|
-
export declare type SpecialVCodecForTransparency = 'vp9' | 'vp8' | 'none';
|
|
10
|
-
export declare type NeedsResize = [number, number] | null;
|
|
11
|
-
export declare type Vp9Result = {
|
|
12
|
-
specialVcodecForTransparency: SpecialVCodecForTransparency;
|
|
13
|
-
needsResize: NeedsResize;
|
|
14
|
-
};
|
|
15
|
-
export declare type VideoDurationResult = {
|
|
16
|
-
duration: number | null;
|
|
17
|
-
fps: number | null;
|
|
18
|
-
};
|
|
19
2
|
export declare type AudioChannelsAndDurationResultCache = {
|
|
20
3
|
channels: number;
|
|
21
4
|
duration: number | null;
|
|
@@ -37,14 +20,6 @@ export declare type DownloadMap = {
|
|
|
37
20
|
[downloadDir: string]: (() => void)[];
|
|
38
21
|
};
|
|
39
22
|
};
|
|
40
|
-
lastFrameMap: Record<string, {
|
|
41
|
-
lastAccessed: number;
|
|
42
|
-
data: Buffer;
|
|
43
|
-
}>;
|
|
44
|
-
isBeyondLastFrameMap: Record<string, number>;
|
|
45
|
-
isVp9VideoCache: Record<string, Vp9Result>;
|
|
46
|
-
ensureFileHasPresentationTimestamp: Record<string, EncodingStatus>;
|
|
47
|
-
videoDurationResultCache: Record<string, VideoDurationResult>;
|
|
48
23
|
durationOfAssetCache: Record<string, AudioChannelsAndDurationResultCache>;
|
|
49
24
|
downloadDir: string;
|
|
50
25
|
preEncode: string;
|
|
@@ -66,4 +41,3 @@ export declare type RenderAssetInfo = {
|
|
|
66
41
|
};
|
|
67
42
|
export declare const makeDownloadMap: () => DownloadMap;
|
|
68
43
|
export declare const cleanDownloadMap: (downloadMap: DownloadMap) => void;
|
|
69
|
-
export {};
|
|
@@ -48,11 +48,6 @@ const makeDownloadMap = () => {
|
|
|
48
48
|
isDownloadingMap: {},
|
|
49
49
|
hasBeenDownloadedMap: {},
|
|
50
50
|
listeners: {},
|
|
51
|
-
lastFrameMap: {},
|
|
52
|
-
isBeyondLastFrameMap: {},
|
|
53
|
-
ensureFileHasPresentationTimestamp: {},
|
|
54
|
-
isVp9VideoCache: {},
|
|
55
|
-
videoDurationResultCache: {},
|
|
56
51
|
durationOfAssetCache: {},
|
|
57
52
|
id: String(Math.random()),
|
|
58
53
|
assetDir: dir,
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
1
|
import type { AudioChannelsAndDurationResultCache, DownloadMap } from './download-map';
|
|
3
|
-
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string
|
|
2
|
+
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string) => Promise<AudioChannelsAndDurationResultCache>;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getAudioChannelsAndDuration = void 0;
|
|
7
|
-
const
|
|
8
|
-
const ffmpeg_flags_1 = require("../ffmpeg-flags");
|
|
4
|
+
const call_ffmpeg_1 = require("../call-ffmpeg");
|
|
9
5
|
const p_limit_1 = require("../p-limit");
|
|
10
6
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
11
|
-
async function getAudioChannelsAndDurationUnlimited(downloadMap, src
|
|
7
|
+
async function getAudioChannelsAndDurationUnlimited(downloadMap, src) {
|
|
12
8
|
if (downloadMap.durationOfAssetCache[src]) {
|
|
13
9
|
return downloadMap.durationOfAssetCache[src];
|
|
14
10
|
}
|
|
@@ -20,7 +16,7 @@ async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExe
|
|
|
20
16
|
]
|
|
21
17
|
.reduce((acc, val) => acc.concat(val), [])
|
|
22
18
|
.filter(Boolean);
|
|
23
|
-
const task = await (0,
|
|
19
|
+
const task = await (0, call_ffmpeg_1.callFf)('ffprobe', args);
|
|
24
20
|
const channels = task.stdout.match(/channels=([0-9]+)/);
|
|
25
21
|
const duration = task.stdout.match(/duration=([0-9.]+)/);
|
|
26
22
|
const result = {
|
|
@@ -30,7 +26,7 @@ async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExe
|
|
|
30
26
|
downloadMap.durationOfAssetCache[src] = result;
|
|
31
27
|
return result;
|
|
32
28
|
}
|
|
33
|
-
const getAudioChannelsAndDuration = (downloadMap, src
|
|
34
|
-
return limit(() => getAudioChannelsAndDurationUnlimited(downloadMap, src
|
|
29
|
+
const getAudioChannelsAndDuration = (downloadMap, src) => {
|
|
30
|
+
return limit(() => getAudioChannelsAndDurationUnlimited(downloadMap, src));
|
|
35
31
|
};
|
|
36
32
|
exports.getAudioChannelsAndDuration = getAudioChannelsAndDuration;
|
package/dist/audio-codec.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const supportedAudioCodecs: {
|
|
|
5
5
|
readonly h264: readonly ["aac", "pcm-16"];
|
|
6
6
|
readonly 'h264-mkv': readonly ["pcm-16"];
|
|
7
7
|
readonly aac: readonly ["aac", "pcm-16"];
|
|
8
|
-
readonly gif:
|
|
8
|
+
readonly gif: const[];
|
|
9
9
|
readonly h265: readonly ["aac", "pcm-16"];
|
|
10
10
|
readonly mp3: readonly ["mp3", "pcm-16"];
|
|
11
11
|
readonly prores: readonly ["aac", "pcm-16"];
|
|
@@ -13,8 +13,8 @@ export declare const supportedAudioCodecs: {
|
|
|
13
13
|
readonly vp9: readonly ["opus", "pcm-16"];
|
|
14
14
|
readonly wav: readonly ["pcm-16"];
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
declare const audioCodecNames: readonly ["pcm_s16le", "aac", "libmp3lame", "libopus"];
|
|
17
|
+
declare type FfmpegAudioCodecName = typeof audioCodecNames[number];
|
|
18
18
|
export declare const mapAudioCodecToFfmpegAudioCodecName: (audioCodec: AudioCodec) => FfmpegAudioCodecName;
|
|
19
19
|
export declare const defaultAudioCodecs: {
|
|
20
20
|
[key in Codec]: {
|
|
@@ -25,3 +25,4 @@ export declare const getDefaultAudioCodec: ({ codec, preferLossless, }: {
|
|
|
25
25
|
codec: Codec;
|
|
26
26
|
preferLossless: boolean;
|
|
27
27
|
}) => AudioCodec | null;
|
|
28
|
+
export {};
|
package/dist/audio-codec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultAudioCodec = exports.defaultAudioCodecs = exports.mapAudioCodecToFfmpegAudioCodecName = exports.
|
|
3
|
+
exports.getDefaultAudioCodec = exports.defaultAudioCodecs = exports.mapAudioCodecToFfmpegAudioCodecName = exports.supportedAudioCodecs = exports.validAudioCodecs = void 0;
|
|
4
4
|
exports.validAudioCodecs = ['pcm-16', 'aac', 'mp3', 'opus'];
|
|
5
5
|
exports.supportedAudioCodecs = {
|
|
6
6
|
h264: ['aac', 'pcm-16'],
|
|
@@ -18,12 +18,7 @@ const _satisfies = exports.supportedAudioCodecs;
|
|
|
18
18
|
if (_satisfies) {
|
|
19
19
|
// Just for type checking
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
'pcm_s16le',
|
|
23
|
-
'aac',
|
|
24
|
-
'libmp3lame',
|
|
25
|
-
'libopus',
|
|
26
|
-
];
|
|
21
|
+
const audioCodecNames = ['pcm_s16le', 'aac', 'libmp3lame', 'libopus'];
|
|
27
22
|
const mapAudioCodecToFfmpegAudioCodecName = (audioCodec) => {
|
|
28
23
|
if (audioCodec === 'aac') {
|
|
29
24
|
return 'aac';
|
|
@@ -67,8 +62,7 @@ exports.defaultAudioCodecs = {
|
|
|
67
62
|
},
|
|
68
63
|
prores: {
|
|
69
64
|
lossless: 'pcm-16',
|
|
70
|
-
|
|
71
|
-
compressed: 'aac',
|
|
65
|
+
compressed: 'pcm-16',
|
|
72
66
|
},
|
|
73
67
|
vp8: {
|
|
74
68
|
lossless: 'pcm-16',
|
|
@@ -38,5 +38,4 @@ export declare const localRevisions: (downloadsFolder: string, product: Product,
|
|
|
38
38
|
export declare const removeBrowser: (revision: string, folderPath: string) => Promise<void>;
|
|
39
39
|
export declare const getFolderPath: (revision: string, downloadsFolder: string, platform: Platform) => string;
|
|
40
40
|
export declare const getRevisionInfo: (revision: string, product: Product) => BrowserFetcherRevisionInfo;
|
|
41
|
-
export declare function _downloadFile(url: string, destinationPath: string, progressCallback: (x: number, y: number) => void): Promise<number>;
|
|
42
41
|
export {};
|
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.
|
|
44
|
+
exports.getRevisionInfo = exports.getFolderPath = exports.removeBrowser = exports.localRevisions = exports.download = exports.getDownloadHost = exports.getDownloadsFolder = exports.getPlatform = void 0;
|
|
45
45
|
const childProcess = __importStar(require("child_process"));
|
|
46
46
|
const fs = __importStar(require("fs"));
|
|
47
47
|
const http = __importStar(require("http"));
|
|
@@ -331,7 +331,6 @@ function _downloadFile(url, destinationPath, progressCallback) {
|
|
|
331
331
|
});
|
|
332
332
|
return promise;
|
|
333
333
|
}
|
|
334
|
-
exports._downloadFile = _downloadFile;
|
|
335
334
|
function install(archivePath, folderPath) {
|
|
336
335
|
if (archivePath.endsWith('.zip')) {
|
|
337
336
|
return (0, extract_zip_1.default)(archivePath, { dir: folderPath });
|
|
@@ -105,8 +105,14 @@ class BrowserRunner {
|
|
|
105
105
|
stdio,
|
|
106
106
|
});
|
|
107
107
|
if (dumpio) {
|
|
108
|
-
(_a = this.proc.
|
|
109
|
-
|
|
108
|
+
(_a = this.proc.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (d) => {
|
|
109
|
+
process.stdout.write(options.indentationString);
|
|
110
|
+
process.stdout.write(d.toString().trimStart());
|
|
111
|
+
});
|
|
112
|
+
(_b = this.proc.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (d) => {
|
|
113
|
+
process.stderr.write(options.indentationString);
|
|
114
|
+
process.stderr.write(d.toString().trimStart());
|
|
115
|
+
});
|
|
110
116
|
}
|
|
111
117
|
__classPrivateFieldSet(this, _BrowserRunner_closed, false, "f");
|
|
112
118
|
__classPrivateFieldSet(this, _BrowserRunner_processClosing, new Promise((fulfill, reject) => {
|
|
@@ -33,6 +33,7 @@ const Connection_1 = require("./Connection");
|
|
|
33
33
|
const DOMWorld_1 = require("./DOMWorld");
|
|
34
34
|
const EventEmitter_1 = require("./EventEmitter");
|
|
35
35
|
const ExecutionContext_1 = require("./ExecutionContext");
|
|
36
|
+
const is_target_closed_err_1 = require("./is-target-closed-err");
|
|
36
37
|
const LifecycleWatcher_1 = require("./LifecycleWatcher");
|
|
37
38
|
const NetworkManager_1 = require("./NetworkManager");
|
|
38
39
|
const util_1 = require("./util");
|
|
@@ -135,9 +136,7 @@ class FrameManager extends EventEmitter_1.EventEmitter {
|
|
|
135
136
|
}
|
|
136
137
|
catch (error) {
|
|
137
138
|
// The target might have been closed before the initialization finished.
|
|
138
|
-
if ((0, util_1.isErrorLike)(error) &&
|
|
139
|
-
(error.message.includes('Target closed') ||
|
|
140
|
-
error.message.includes('Session closed'))) {
|
|
139
|
+
if ((0, util_1.isErrorLike)(error) && (0, is_target_closed_err_1.isTargetClosedErr)(error)) {
|
|
141
140
|
return;
|
|
142
141
|
}
|
|
143
142
|
throw error;
|
|
@@ -29,5 +29,6 @@ export interface LaunchOptions {
|
|
|
29
29
|
env?: Record<string, string | undefined>;
|
|
30
30
|
pipe?: boolean;
|
|
31
31
|
product?: Product;
|
|
32
|
+
indentationString: string;
|
|
32
33
|
}
|
|
33
34
|
export declare type PuppeteerNodeLaunchOptions = BrowserLaunchArgumentOptions & LaunchOptions & BrowserConnectOptions;
|
package/dist/browser/Launcher.js
CHANGED
|
@@ -57,7 +57,7 @@ class ChromeLauncher {
|
|
|
57
57
|
this._preferredRevision = preferredRevision;
|
|
58
58
|
}
|
|
59
59
|
async launch(options) {
|
|
60
|
-
const { args = [], dumpio = false, executablePath, pipe = false, env = process.env, defaultViewport, timeout = 60000, debuggingPort, } = options;
|
|
60
|
+
const { args = [], dumpio = false, executablePath, pipe = false, env = process.env, defaultViewport, timeout = 60000, debuggingPort, indentationString, } = options;
|
|
61
61
|
const chromeArguments = args;
|
|
62
62
|
if (!chromeArguments.some((argument) => {
|
|
63
63
|
return argument.startsWith('--remote-debugging-');
|
|
@@ -91,6 +91,7 @@ class ChromeLauncher {
|
|
|
91
91
|
dumpio,
|
|
92
92
|
env,
|
|
93
93
|
pipe: false,
|
|
94
|
+
indentationString,
|
|
94
95
|
});
|
|
95
96
|
let browser;
|
|
96
97
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivateTargetRequest, AddScriptToEvaluateOnNewDocumentRequest, AddScriptToEvaluateOnNewDocumentResponse, CallFunctionOnRequest, CallFunctionOnResponse, CaptureScreenshotRequest, CaptureScreenshotResponse, CloseTargetRequest, CloseTargetResponse, CreateIsolatedWorldRequest, CreateIsolatedWorldResponse, DetachFromTargetRequest, DevtoolsRemoteObject, EnableRequest, ExceptionDetails, GetFrameTreeResponse, NavigateRequest, NavigateResponse, ReleaseObjectRequest, SetAutoAttachRequest, SetDefaultBackgroundColorOverrideRequest, SetDeviceMetricsOverrideRequest, SetLifecycleEventsEnabledRequest } from './devtools-types';
|
|
1
|
+
import type { ActivateTargetRequest, AddScriptToEvaluateOnNewDocumentRequest, AddScriptToEvaluateOnNewDocumentResponse, CallFunctionOnRequest, CallFunctionOnResponse, CaptureScreenshotRequest, CaptureScreenshotResponse, CloseTargetRequest, CloseTargetResponse, CreateIsolatedWorldRequest, CreateIsolatedWorldResponse, DetachFromTargetRequest, DevtoolsRemoteObject, EnableRequest, ExceptionDetails, GetFrameTreeResponse, NavigateRequest, NavigateResponse, PrintPDFRequest, PrintPDFResponse, ReleaseObjectRequest, SetAutoAttachRequest, SetDefaultBackgroundColorOverrideRequest, SetDeviceMetricsOverrideRequest, SetLifecycleEventsEnabledRequest } from './devtools-types';
|
|
2
2
|
export interface Commands {
|
|
3
3
|
/**
|
|
4
4
|
* Does nothing.
|
|
@@ -216,6 +216,10 @@ export interface Commands {
|
|
|
216
216
|
paramsType: [CaptureScreenshotRequest?];
|
|
217
217
|
returnType: CaptureScreenshotResponse;
|
|
218
218
|
};
|
|
219
|
+
'Page.printToPDF': {
|
|
220
|
+
paramsType: [PrintPDFRequest];
|
|
221
|
+
returnType: PrintPDFResponse;
|
|
222
|
+
};
|
|
219
223
|
'Target.activateTarget': {
|
|
220
224
|
paramsType: [ActivateTargetRequest];
|
|
221
225
|
returnType: void;
|
|
@@ -537,6 +537,84 @@ export interface CaptureScreenshotResponse {
|
|
|
537
537
|
*/
|
|
538
538
|
data: string;
|
|
539
539
|
}
|
|
540
|
+
export interface PrintPDFRequest {
|
|
541
|
+
/**
|
|
542
|
+
* Paper orientation. Defaults to false.
|
|
543
|
+
*/
|
|
544
|
+
landscape?: boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Display header and footer. Defaults to false.
|
|
547
|
+
*/
|
|
548
|
+
displayHeaderFooter?: boolean;
|
|
549
|
+
/**
|
|
550
|
+
* Print background graphics. Defaults to false.
|
|
551
|
+
*/
|
|
552
|
+
printBackground?: boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Scale of the webpage rendering. Defaults to 1.
|
|
555
|
+
*/
|
|
556
|
+
scale?: number;
|
|
557
|
+
/**
|
|
558
|
+
* Paper width in inches. Defaults to 8.5 inches.
|
|
559
|
+
*/
|
|
560
|
+
paperWidth?: number;
|
|
561
|
+
/**
|
|
562
|
+
* Paper height in inches. Defaults to 11 inches.
|
|
563
|
+
*/
|
|
564
|
+
paperHeight?: number;
|
|
565
|
+
/**
|
|
566
|
+
* Top margin in inches. Defaults to 1cm (~0.4 inches).
|
|
567
|
+
*/
|
|
568
|
+
marginTop?: number;
|
|
569
|
+
/**
|
|
570
|
+
* Bottom margin in inches. Defaults to 1cm (~0.4 inches).
|
|
571
|
+
*/
|
|
572
|
+
marginBottom?: number;
|
|
573
|
+
/**
|
|
574
|
+
* Left margin in inches. Defaults to 1cm (~0.4 inches).
|
|
575
|
+
*/
|
|
576
|
+
marginLeft?: number;
|
|
577
|
+
/**
|
|
578
|
+
* Right margin in inches. Defaults to 1cm (~0.4 inches).
|
|
579
|
+
*/
|
|
580
|
+
marginRight?: number;
|
|
581
|
+
/**
|
|
582
|
+
* Paper ranges to print, one based, e.g., '1-5, 8, 11-13'.
|
|
583
|
+
* Pages are printed in the document order, not in the order specified,
|
|
584
|
+
* and no more than once. Defaults to empty string,
|
|
585
|
+
* which implies the entire document is printed.
|
|
586
|
+
* The page numbers are quietly capped to actual page count of the document,
|
|
587
|
+
* and ranges beyond the end of the document are ignored.
|
|
588
|
+
* If this results in no pages to print, an error is reported.
|
|
589
|
+
* It is an error to specify a range with start greater than end.
|
|
590
|
+
*/
|
|
591
|
+
pageRanges?: string;
|
|
592
|
+
/**
|
|
593
|
+
* HTML template for the print header.
|
|
594
|
+
* Should be valid HTML markup with following classes used to inject printing values into them:
|
|
595
|
+
* date: formatted print date
|
|
596
|
+
* title: document title
|
|
597
|
+
* url: document location
|
|
598
|
+
* pageNumber: current page number
|
|
599
|
+
* totalPages: total pages in the document
|
|
600
|
+
* For example, <span class=title></span> would generate span containing the title.
|
|
601
|
+
*/
|
|
602
|
+
headerTemplate?: string;
|
|
603
|
+
/**
|
|
604
|
+
* HTML template for the print footer. Should use the same format as the headerTemplate.
|
|
605
|
+
*/
|
|
606
|
+
footerTemplate?: string;
|
|
607
|
+
/**
|
|
608
|
+
* Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
|
|
609
|
+
*/
|
|
610
|
+
preferCSSPageSize?: boolean;
|
|
611
|
+
}
|
|
612
|
+
export interface PrintPDFResponse {
|
|
613
|
+
/**
|
|
614
|
+
* Base64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON)
|
|
615
|
+
*/
|
|
616
|
+
data: string;
|
|
617
|
+
}
|
|
540
618
|
export interface RequestWillBeSentEvent {
|
|
541
619
|
/**
|
|
542
620
|
* Request identifier.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isTargetClosedErr: (error: Error | undefined) => boolean | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTargetClosedErr = void 0;
|
|
4
|
+
const isTargetClosedErr = (error) => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
return (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('Target closed')) ||
|
|
7
|
+
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes('Session closed')));
|
|
8
|
+
};
|
|
9
|
+
exports.isTargetClosedErr = isTargetClosedErr;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
export declare const dynamicLibraryPathOptions: () => {
|
|
3
|
+
env: {
|
|
4
|
+
DYLD_LIBRARY_PATH: string;
|
|
5
|
+
RUST_BACKTRACE: string;
|
|
6
|
+
} | {
|
|
7
|
+
PATH: string;
|
|
8
|
+
RUST_BACKTRACE: string;
|
|
9
|
+
} | {
|
|
10
|
+
LD_LIBRARY_PATH: string;
|
|
11
|
+
RUST_BACKTRACE: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const callFf: (bin: 'ffmpeg' | 'ffprobe', args: (string | null)[], options?: execa.Options<string>) => execa.ExecaChildProcess<string>;
|
|
@@ -0,0 +1,37 @@
|
|
|
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.callFf = exports.dynamicLibraryPathOptions = void 0;
|
|
7
|
+
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const get_executable_path_1 = require("./compositor/get-executable-path");
|
|
10
|
+
const truthy_1 = require("./truthy");
|
|
11
|
+
const dynamicLibraryPathOptions = () => {
|
|
12
|
+
const lib = path_1.default.join((0, get_executable_path_1.getExecutablePath)('ffmpeg-cwd'), 'remotion', 'lib');
|
|
13
|
+
return {
|
|
14
|
+
env: {
|
|
15
|
+
RUST_BACKTRACE: 'full',
|
|
16
|
+
...(process.platform === 'darwin'
|
|
17
|
+
? {
|
|
18
|
+
DYLD_LIBRARY_PATH: lib,
|
|
19
|
+
}
|
|
20
|
+
: process.platform === 'win32'
|
|
21
|
+
? {
|
|
22
|
+
PATH: `${process.env.PATH};${lib}`,
|
|
23
|
+
}
|
|
24
|
+
: {
|
|
25
|
+
LD_LIBRARY_PATH: lib,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.dynamicLibraryPathOptions = dynamicLibraryPathOptions;
|
|
31
|
+
const callFf = (bin, args, options) => {
|
|
32
|
+
return (0, execa_1.default)((0, get_executable_path_1.getExecutablePath)(bin), args.filter(truthy_1.truthy), {
|
|
33
|
+
...(0, exports.dynamicLibraryPathOptions)(),
|
|
34
|
+
...options,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.callFf = callFf;
|
|
@@ -1,55 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.checkNodeVersionAndWarnAboutRosetta = void 0;
|
|
27
|
-
const os = __importStar(require("os"));
|
|
28
4
|
const checkNodeVersionAndWarnAboutRosetta = () => {
|
|
29
|
-
// see https://github.com/nodejs/node/issues/41900#issuecomment-1113511254
|
|
30
|
-
const cpus = os.cpus();
|
|
31
|
-
const isAppleSilicon = cpus[0].model.includes('Apple');
|
|
32
|
-
const isArm64 = os.arch() === 'arm64';
|
|
33
5
|
const version = process.version.replace('v', '').split('.');
|
|
34
6
|
const majorVersion = Number(version[0]);
|
|
35
|
-
const requiredNodeVersion =
|
|
36
|
-
if (majorVersion <
|
|
7
|
+
const requiredNodeVersion = 16;
|
|
8
|
+
if (majorVersion < 16) {
|
|
37
9
|
throw new Error(`Remotion requires at least Node ${requiredNodeVersion}. You currently have ${process.version}. Update your node version to ${requiredNodeVersion} to use Remotion.`);
|
|
38
10
|
}
|
|
39
|
-
if (isAppleSilicon && !isArm64) {
|
|
40
|
-
const recommendedNodeVersion = 16;
|
|
41
|
-
const recommendNodeUpgrade = majorVersion < recommendedNodeVersion;
|
|
42
|
-
console.warn([
|
|
43
|
-
`⚠️ Apple Silicon detected but Node.JS running under Rosetta. This will cause performance issues.\n`,
|
|
44
|
-
`Recommended actions:\n`,
|
|
45
|
-
recommendNodeUpgrade
|
|
46
|
-
? ` - Upgrade to Node ${recommendedNodeVersion} or later\n`
|
|
47
|
-
: ' - Run Node using `arch -arm64` architecture\n',
|
|
48
|
-
'See https://remotion.dev/docs/troubleshooting/rosetta for more information.',
|
|
49
|
-
'---',
|
|
50
|
-
]
|
|
51
|
-
.filter(Boolean)
|
|
52
|
-
.join('\n'));
|
|
53
|
-
}
|
|
54
11
|
};
|
|
55
12
|
exports.checkNodeVersionAndWarnAboutRosetta = checkNodeVersionAndWarnAboutRosetta;
|