@remotion/renderer 4.0.256 → 4.0.258
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/index.d.ts +1 -1
- package/ensure-browser.mjs +484 -428
- package/package.json +12 -12
- package/dist/browser/BrowserConnector.d.ts +0 -19
- package/dist/browser/BrowserConnector.js +0 -17
- package/dist/browser/PuppeteerNode.d.ts +0 -30
- package/dist/browser/PuppeteerNode.js +0 -52
- package/dist/browser/node.d.ts +0 -2
- package/dist/browser/node.js +0 -5
- package/dist/copy-to-clipboard.d.ts +0 -2
- package/dist/copy-to-clipboard.js +0 -18
- package/dist/example-videos.d.ts +0 -34
- package/dist/example-videos.js +0 -43
- package/dist/get-local-browser.d.ts +0 -1
- package/dist/get-local-browser.js +0 -19
- package/dist/take-frame-and-compose.d.ts +0 -22
- package/dist/take-frame-and-compose.js +0 -100
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/renderer",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.258",
|
|
7
7
|
"description": "Render Remotion videos using Node.js or Bun",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
19
|
"source-map": "^0.8.0-beta.0",
|
|
20
20
|
"ws": "8.17.1",
|
|
21
|
-
"remotion": "4.0.
|
|
22
|
-
"@remotion/streaming": "4.0.
|
|
21
|
+
"remotion": "4.0.258",
|
|
22
|
+
"@remotion/streaming": "4.0.258"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=16.8.0",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"react-dom": "19.0.0",
|
|
34
34
|
"@types/ws": "8.5.10",
|
|
35
35
|
"eslint": "9.14.0",
|
|
36
|
-
"@remotion/example-videos": "4.0.
|
|
37
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
36
|
+
"@remotion/example-videos": "4.0.258",
|
|
37
|
+
"@remotion/eslint-config-internal": "4.0.258"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@remotion/compositor-darwin-
|
|
41
|
-
"@remotion/compositor-
|
|
42
|
-
"@remotion/compositor-linux-
|
|
43
|
-
"@remotion/compositor-linux-arm64-
|
|
44
|
-
"@remotion/compositor-
|
|
45
|
-
"@remotion/compositor-linux-x64-musl": "4.0.
|
|
46
|
-
"@remotion/compositor-win32-x64-msvc": "4.0.
|
|
40
|
+
"@remotion/compositor-darwin-arm64": "4.0.258",
|
|
41
|
+
"@remotion/compositor-darwin-x64": "4.0.258",
|
|
42
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.258",
|
|
43
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.258",
|
|
44
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.258",
|
|
45
|
+
"@remotion/compositor-linux-x64-musl": "4.0.258",
|
|
46
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.258"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"remotion",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2020 Google Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { Viewport } from './PuppeteerViewport';
|
|
17
|
-
export interface BrowserConnectOptions {
|
|
18
|
-
defaultViewport: Viewport;
|
|
19
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2020 Google Inc. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2020 Google Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { HeadlessBrowser } from './Browser';
|
|
17
|
-
import type { BrowserConnectOptions } from './BrowserConnector';
|
|
18
|
-
import type { ProductLauncher } from './Launcher';
|
|
19
|
-
import type { BrowserLaunchArgumentOptions, LaunchOptions } from './LaunchOptions';
|
|
20
|
-
interface PuppeteerLaunchOptions extends LaunchOptions, BrowserLaunchArgumentOptions, BrowserConnectOptions {
|
|
21
|
-
extraPrefsFirefox?: Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
export declare class PuppeteerNode {
|
|
24
|
-
#private;
|
|
25
|
-
constructor();
|
|
26
|
-
launch(options: PuppeteerLaunchOptions): Promise<HeadlessBrowser>;
|
|
27
|
-
executablePath(channel?: string): string;
|
|
28
|
-
get _launcher(): ProductLauncher;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2020 Google Inc. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
18
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
19
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
|
-
};
|
|
22
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
23
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
24
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
25
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
26
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
27
|
-
};
|
|
28
|
-
var _PuppeteerNode_lazyLauncher;
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.PuppeteerNode = void 0;
|
|
31
|
-
const Launcher_1 = require("./Launcher");
|
|
32
|
-
class PuppeteerNode {
|
|
33
|
-
constructor() {
|
|
34
|
-
_PuppeteerNode_lazyLauncher.set(this, void 0);
|
|
35
|
-
this.launch = this.launch.bind(this);
|
|
36
|
-
this.executablePath = this.executablePath.bind(this);
|
|
37
|
-
}
|
|
38
|
-
launch(options) {
|
|
39
|
-
return this._launcher.launch(options);
|
|
40
|
-
}
|
|
41
|
-
executablePath(channel) {
|
|
42
|
-
return this._launcher.executablePath(channel);
|
|
43
|
-
}
|
|
44
|
-
get _launcher() {
|
|
45
|
-
if (!__classPrivateFieldGet(this, _PuppeteerNode_lazyLauncher, "f")) {
|
|
46
|
-
__classPrivateFieldSet(this, _PuppeteerNode_lazyLauncher, new Launcher_1.ChromeLauncher(), "f");
|
|
47
|
-
}
|
|
48
|
-
return __classPrivateFieldGet(this, _PuppeteerNode_lazyLauncher, "f");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.PuppeteerNode = PuppeteerNode;
|
|
52
|
-
_PuppeteerNode_lazyLauncher = new WeakMap();
|
package/dist/browser/node.d.ts
DELETED
package/dist/browser/node.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyImageToClipboard = void 0;
|
|
4
|
-
const compositor_1 = require("./compositor/compositor");
|
|
5
|
-
const copyImageToClipboard = async (src, logLevel, binariesDirectory) => {
|
|
6
|
-
const compositor = (0, compositor_1.startLongRunningCompositor)({
|
|
7
|
-
maximumFrameCacheItemsInBytes: null,
|
|
8
|
-
logLevel,
|
|
9
|
-
indent: false,
|
|
10
|
-
binariesDirectory,
|
|
11
|
-
});
|
|
12
|
-
await compositor.executeCommand('CopyImageToClipboard', {
|
|
13
|
-
src,
|
|
14
|
-
});
|
|
15
|
-
await compositor.finishCommands();
|
|
16
|
-
await compositor.waitForDone();
|
|
17
|
-
};
|
|
18
|
-
exports.copyImageToClipboard = copyImageToClipboard;
|
package/dist/example-videos.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare const exampleVideos: {
|
|
2
|
-
bigBuckBunny: string;
|
|
3
|
-
transparentWebm: string;
|
|
4
|
-
framerWithoutFileExtension: string;
|
|
5
|
-
corrupted: string;
|
|
6
|
-
customDar: string;
|
|
7
|
-
screenrecording: string;
|
|
8
|
-
nofps: string;
|
|
9
|
-
variablefps: string;
|
|
10
|
-
zerotimestamp: string;
|
|
11
|
-
webcam: string;
|
|
12
|
-
iphonevideo: string;
|
|
13
|
-
av1: string;
|
|
14
|
-
framer24fps: string;
|
|
15
|
-
music: string;
|
|
16
|
-
notavideo: string;
|
|
17
|
-
notafile: string;
|
|
18
|
-
transparentwithdar: string;
|
|
19
|
-
prores: string;
|
|
20
|
-
iphonehevc: string;
|
|
21
|
-
matroskaPcm16: string;
|
|
22
|
-
mp4withmp3: string;
|
|
23
|
-
av1bbb: string;
|
|
24
|
-
av1mp4: string;
|
|
25
|
-
av1mp4WithColr: string;
|
|
26
|
-
vp8Vorbis: string;
|
|
27
|
-
vp9: string;
|
|
28
|
-
stretchedVp8: string;
|
|
29
|
-
matroskaMp3: string;
|
|
30
|
-
matroskaH265Aac: string;
|
|
31
|
-
opusWebm: string;
|
|
32
|
-
avi: string;
|
|
33
|
-
opus51Webm: string;
|
|
34
|
-
};
|
package/dist/example-videos.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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.exampleVideos = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const examplePackage = node_path_1.default.join(__dirname, '..', '..', 'example');
|
|
9
|
-
const docsPackage = node_path_1.default.join(__dirname, '..', '..', 'docs');
|
|
10
|
-
exports.exampleVideos = {
|
|
11
|
-
bigBuckBunny: node_path_1.default.join(examplePackage, 'public/bigbuckbunny.mp4'),
|
|
12
|
-
transparentWebm: node_path_1.default.join(docsPackage, '/static/img/transparent-video.webm'),
|
|
13
|
-
framerWithoutFileExtension: node_path_1.default.join(examplePackage, 'public', 'framermp4withoutfileextension'),
|
|
14
|
-
corrupted: node_path_1.default.join(examplePackage, 'public', 'corrupted.mp4'),
|
|
15
|
-
customDar: node_path_1.default.join(examplePackage, 'public', 'custom-dar.mp4'),
|
|
16
|
-
screenrecording: node_path_1.default.join(examplePackage, 'public', 'quick.mov'),
|
|
17
|
-
nofps: node_path_1.default.join(examplePackage, 'public', 'nofps.webm'),
|
|
18
|
-
variablefps: node_path_1.default.join(examplePackage, 'public', 'variablefps.webm'),
|
|
19
|
-
zerotimestamp: node_path_1.default.join(examplePackage, 'public', 'zero-timestamp.mp4'),
|
|
20
|
-
webcam: node_path_1.default.join(examplePackage, 'public', 'webcam.webm'),
|
|
21
|
-
iphonevideo: node_path_1.default.join(examplePackage, 'public', 'iphonevideo.mov'),
|
|
22
|
-
av1: node_path_1.default.join(examplePackage, 'public', 'av1.webm'),
|
|
23
|
-
framer24fps: node_path_1.default.join(examplePackage, 'src', 'resources', 'framer-24fps.mp4'),
|
|
24
|
-
music: node_path_1.default.join(examplePackage, 'public', 'music.mp3'),
|
|
25
|
-
notavideo: node_path_1.default.join(examplePackage, 'public', 'giphy.gif'),
|
|
26
|
-
notafile: node_path_1.default.join(examplePackage, 'public', 'doesnotexist'),
|
|
27
|
-
transparentwithdar: node_path_1.default.join(examplePackage, 'public', 'transparent-with-dar.webm'),
|
|
28
|
-
prores: node_path_1.default.join(examplePackage, 'public', 'prores.mov'),
|
|
29
|
-
iphonehevc: node_path_1.default.join(examplePackage, 'public', 'iphone-hevc.mov'),
|
|
30
|
-
matroskaPcm16: node_path_1.default.join(examplePackage, 'public', 'matroska-pcm16.mkv'),
|
|
31
|
-
mp4withmp3: node_path_1.default.join(examplePackage, 'public', 'mp4-mp3.mp4'),
|
|
32
|
-
av1bbb: node_path_1.default.join(examplePackage, 'public', 'av1-bbb.webm'),
|
|
33
|
-
av1mp4: node_path_1.default.join(examplePackage, 'public', 'av1-bbb.mp4'),
|
|
34
|
-
av1mp4WithColr: node_path_1.default.join(examplePackage, 'public', 'av1.mp4'),
|
|
35
|
-
vp8Vorbis: node_path_1.default.join(examplePackage, 'public', 'vp8-vorbis.webm'),
|
|
36
|
-
vp9: node_path_1.default.join(examplePackage, 'public', 'vp9.webm'),
|
|
37
|
-
stretchedVp8: node_path_1.default.join(examplePackage, 'public', 'stretched-vp8.webm'),
|
|
38
|
-
matroskaMp3: node_path_1.default.join(examplePackage, 'public', 'matroska-mp3.mkv'),
|
|
39
|
-
matroskaH265Aac: node_path_1.default.join(examplePackage, 'public', 'matroska-h265-aac.mkv'),
|
|
40
|
-
opusWebm: node_path_1.default.join(examplePackage, 'public', 'opus.webm'),
|
|
41
|
-
avi: node_path_1.default.join(examplePackage, 'public', 'example.avi'),
|
|
42
|
-
opus51Webm: node_path_1.default.join(examplePackage, 'public', 'vp8-opus-5-1-channels.webm'),
|
|
43
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getLocalBrowser: () => null;
|
|
@@ -1,19 +0,0 @@
|
|
|
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.getLocalBrowser = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const getSearchPathsForProduct = () => {
|
|
9
|
-
return [];
|
|
10
|
-
};
|
|
11
|
-
const getLocalBrowser = () => {
|
|
12
|
-
for (const p of getSearchPathsForProduct()) {
|
|
13
|
-
if (fs_1.default.existsSync(p)) {
|
|
14
|
-
return p;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
exports.getLocalBrowser = getLocalBrowser;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { TRenderAsset } from 'remotion/no-react';
|
|
2
|
-
import type { DownloadMap } from './assets/download-map';
|
|
3
|
-
import type { Page } from './browser/BrowserPage';
|
|
4
|
-
import type { Compositor } from './compositor/compositor';
|
|
5
|
-
import type { StillImageFormat, VideoImageFormat } from './image-format';
|
|
6
|
-
export declare const takeFrameAndCompose: ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, compositor, timeoutInMilliseconds, }: {
|
|
7
|
-
freePage: Page;
|
|
8
|
-
imageFormat: VideoImageFormat | StillImageFormat;
|
|
9
|
-
jpegQuality: number | undefined;
|
|
10
|
-
frame: number;
|
|
11
|
-
height: number;
|
|
12
|
-
width: number;
|
|
13
|
-
output: string | null;
|
|
14
|
-
scale: number;
|
|
15
|
-
downloadMap: DownloadMap;
|
|
16
|
-
wantsBuffer: boolean;
|
|
17
|
-
compositor: Compositor;
|
|
18
|
-
timeoutInMilliseconds: number;
|
|
19
|
-
}) => Promise<{
|
|
20
|
-
buffer: Buffer | null;
|
|
21
|
-
collectedAssets: TRenderAsset[];
|
|
22
|
-
}>;
|
|
@@ -1,100 +0,0 @@
|
|
|
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.takeFrameAndCompose = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const collect_assets_1 = require("./collect-assets");
|
|
10
|
-
const compose_1 = require("./compositor/compose");
|
|
11
|
-
const provide_screenshot_1 = require("./provide-screenshot");
|
|
12
|
-
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
13
|
-
const truthy_1 = require("./truthy");
|
|
14
|
-
const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, compositor, timeoutInMilliseconds, }) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const [{ value: clipRegion }, collectedAssets] = await Promise.all([
|
|
17
|
-
(0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
18
|
-
pageFunction: () => {
|
|
19
|
-
if (typeof window.remotion_getClipRegion === 'undefined') {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return window.remotion_getClipRegion();
|
|
23
|
-
},
|
|
24
|
-
args: [],
|
|
25
|
-
frame,
|
|
26
|
-
page: freePage,
|
|
27
|
-
timeoutInMilliseconds,
|
|
28
|
-
}),
|
|
29
|
-
(0, collect_assets_1.collectAssets)({ frame, freePage, timeoutInMilliseconds }),
|
|
30
|
-
]);
|
|
31
|
-
if (imageFormat === 'none') {
|
|
32
|
-
return { buffer: null, collectedAssets };
|
|
33
|
-
}
|
|
34
|
-
const needsComposing = clipRegion === null
|
|
35
|
-
? null
|
|
36
|
-
: {
|
|
37
|
-
tmpFile: node_path_1.default.join(downloadMap.compositingDir, `${frame}.${imageFormat}`),
|
|
38
|
-
finalOutFile: output !== null && output !== void 0 ? output : node_path_1.default.join(downloadMap.compositingDir, `${frame}-final.${imageFormat}`),
|
|
39
|
-
clipRegion: clipRegion,
|
|
40
|
-
};
|
|
41
|
-
if (clipRegion !== 'hide') {
|
|
42
|
-
const shouldMakeBuffer = wantsBuffer && !needsComposing;
|
|
43
|
-
const buf = await (0, provide_screenshot_1.provideScreenshot)({
|
|
44
|
-
page: freePage,
|
|
45
|
-
imageFormat,
|
|
46
|
-
jpegQuality,
|
|
47
|
-
options: {
|
|
48
|
-
frame,
|
|
49
|
-
output: shouldMakeBuffer ? null : ((_a = needsComposing === null || needsComposing === void 0 ? void 0 : needsComposing.tmpFile) !== null && _a !== void 0 ? _a : output),
|
|
50
|
-
},
|
|
51
|
-
height,
|
|
52
|
-
width,
|
|
53
|
-
clipRegion,
|
|
54
|
-
timeoutInMilliseconds,
|
|
55
|
-
scale,
|
|
56
|
-
});
|
|
57
|
-
if (shouldMakeBuffer) {
|
|
58
|
-
return { buffer: buf, collectedAssets };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (needsComposing) {
|
|
62
|
-
if (imageFormat === 'pdf') {
|
|
63
|
-
throw new Error("You cannot use Rust APIs (like <Clipper>) if `imageFormat` is 'pdf'.");
|
|
64
|
-
}
|
|
65
|
-
if (imageFormat === 'webp') {
|
|
66
|
-
throw new Error("You cannot use Rust APIs (like <Clipper>) if `imageFormat` is 'webp'.");
|
|
67
|
-
}
|
|
68
|
-
await (0, compose_1.compose)({
|
|
69
|
-
height: height * scale,
|
|
70
|
-
width: width * scale,
|
|
71
|
-
layers: [
|
|
72
|
-
needsComposing.clipRegion === 'hide'
|
|
73
|
-
? null
|
|
74
|
-
: {
|
|
75
|
-
type: imageFormat === 'jpeg'
|
|
76
|
-
? 'JpgImage'
|
|
77
|
-
: 'PngImage',
|
|
78
|
-
params: {
|
|
79
|
-
height: needsComposing.clipRegion.height * scale,
|
|
80
|
-
width: needsComposing.clipRegion.width * scale,
|
|
81
|
-
src: needsComposing.tmpFile,
|
|
82
|
-
x: needsComposing.clipRegion.x * scale,
|
|
83
|
-
y: needsComposing.clipRegion.y * scale,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
].filter(truthy_1.truthy),
|
|
87
|
-
output: needsComposing.finalOutFile,
|
|
88
|
-
downloadMap,
|
|
89
|
-
imageFormat: imageFormat === 'jpeg' ? 'Jpeg' : 'Png',
|
|
90
|
-
compositor,
|
|
91
|
-
});
|
|
92
|
-
if (wantsBuffer) {
|
|
93
|
-
const buffer = await node_fs_1.default.promises.readFile(needsComposing.finalOutFile);
|
|
94
|
-
await node_fs_1.default.promises.unlink(needsComposing.finalOutFile);
|
|
95
|
-
return { buffer, collectedAssets };
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return { buffer: null, collectedAssets };
|
|
99
|
-
};
|
|
100
|
-
exports.takeFrameAndCompose = takeFrameAndCompose;
|