@remotion/renderer 3.3.4 → 3.3.6
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/browser/ScreenshotOptions.d.ts +0 -14
- package/dist/browser/ScreenshotOptions.js +0 -1
- package/dist/provide-screenshot.d.ts +3 -2
- package/dist/provide-screenshot.js +3 -1
- package/dist/puppeteer-screenshot.d.ts +9 -3
- package/dist/puppeteer-screenshot.js +10 -14
- package/dist/render-frames.js +13 -3
- package/dist/render-still.js +3 -1
- package/dist/screenshot-dom-element.d.ts +3 -2
- package/dist/screenshot-dom-element.js +5 -2
- package/dist/screenshot-task.d.ts +9 -3
- package/dist/screenshot-task.js +12 -6
- package/package.json +3 -3
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface ScreenshotClip {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
}
|
|
7
|
-
export interface ScreenshotOptions {
|
|
8
|
-
type: 'png' | 'jpeg';
|
|
9
|
-
path?: string;
|
|
10
|
-
clip?: ScreenshotClip;
|
|
11
|
-
quality?: number;
|
|
12
|
-
omitBackground: boolean;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { Page } from './browser/BrowserPage';
|
|
3
2
|
import type { ImageFormat } from './image-format';
|
|
4
|
-
export declare const provideScreenshot: ({ page, imageFormat, options, quality, }: {
|
|
3
|
+
export declare const provideScreenshot: ({ page, imageFormat, options, quality, height, width, }: {
|
|
5
4
|
page: Page;
|
|
6
5
|
imageFormat: ImageFormat;
|
|
7
6
|
quality: number | undefined;
|
|
@@ -9,4 +8,6 @@ export declare const provideScreenshot: ({ page, imageFormat, options, quality,
|
|
|
9
8
|
frame: number;
|
|
10
9
|
output: string | null;
|
|
11
10
|
};
|
|
11
|
+
height: number;
|
|
12
|
+
width: number;
|
|
12
13
|
}) => Promise<Buffer>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.provideScreenshot = void 0;
|
|
4
4
|
const screenshot_dom_element_1 = require("./screenshot-dom-element");
|
|
5
|
-
const provideScreenshot = ({ page, imageFormat, options, quality, }) => {
|
|
5
|
+
const provideScreenshot = ({ page, imageFormat, options, quality, height, width, }) => {
|
|
6
6
|
return (0, screenshot_dom_element_1.screenshotDOMElement)({
|
|
7
7
|
page,
|
|
8
8
|
opts: {
|
|
@@ -10,6 +10,8 @@ const provideScreenshot = ({ page, imageFormat, options, quality, }) => {
|
|
|
10
10
|
},
|
|
11
11
|
imageFormat,
|
|
12
12
|
quality,
|
|
13
|
+
height,
|
|
14
|
+
width,
|
|
13
15
|
});
|
|
14
16
|
};
|
|
15
17
|
exports.provideScreenshot = provideScreenshot;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { Page } from './browser/BrowserPage';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare const screenshot: (options: {
|
|
3
|
+
page: Page;
|
|
4
|
+
type: 'png' | 'jpeg';
|
|
5
|
+
path?: string;
|
|
6
|
+
quality?: number;
|
|
7
|
+
omitBackground: boolean;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}) => Promise<Buffer | string | void>;
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.screenshot = void 0;
|
|
27
27
|
const assert = __importStar(require("assert"));
|
|
28
28
|
const screenshot_task_1 = require("./screenshot-task");
|
|
29
|
-
const screenshot = (
|
|
29
|
+
const screenshot = (options) => {
|
|
30
30
|
let screenshotType = null;
|
|
31
31
|
// options.type takes precedence over inferring the type from options.path
|
|
32
32
|
// because it may be a 0-length file with no extension created beforehand
|
|
@@ -58,18 +58,14 @@ const screenshot = (page, options) => {
|
|
|
58
58
|
assert.ok(options.quality >= 0 && options.quality <= 100, 'Expected options.quality to be between 0 and 100 (inclusive), got ' +
|
|
59
59
|
options.quality);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
assert.ok(options.clip.width !== 0, 'Expected options.clip.width not to be 0.');
|
|
71
|
-
assert.ok(options.clip.height !== 0, 'Expected options.clip.height not to be 0.');
|
|
72
|
-
}
|
|
73
|
-
return page.screenshotTaskQueue.postTask(() => (0, screenshot_task_1.screenshotTask)(page, screenshotType, options));
|
|
61
|
+
return options.page.screenshotTaskQueue.postTask(() => (0, screenshot_task_1.screenshotTask)({
|
|
62
|
+
page: options.page,
|
|
63
|
+
format: screenshotType,
|
|
64
|
+
height: options.height,
|
|
65
|
+
width: options.width,
|
|
66
|
+
omitBackground: options.omitBackground,
|
|
67
|
+
path: options.path,
|
|
68
|
+
quality: options.quality,
|
|
69
|
+
}));
|
|
74
70
|
};
|
|
75
71
|
exports.screenshot = screenshot;
|
package/dist/render-frames.js
CHANGED
|
@@ -52,7 +52,7 @@ const getConcurrency = (others) => {
|
|
|
52
52
|
}
|
|
53
53
|
return undefined;
|
|
54
54
|
};
|
|
55
|
-
const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, quality, imageFormat = image_format_1.DEFAULT_IMAGE_FORMAT, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, actualConcurrency, everyNthFrame = 1, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, }) => {
|
|
55
|
+
const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, quality, imageFormat = image_format_1.DEFAULT_IMAGE_FORMAT, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale = 1, actualConcurrency, everyNthFrame = 1, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, }) => {
|
|
56
56
|
if (outputDir) {
|
|
57
57
|
if (!fs_1.default.existsSync(outputDir)) {
|
|
58
58
|
fs_1.default.mkdirSync(outputDir, {
|
|
@@ -146,7 +146,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
146
146
|
cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
|
|
147
147
|
stopped = true;
|
|
148
148
|
});
|
|
149
|
-
const renderFrameWithOptionToReject = async (frame, index, reject) => {
|
|
149
|
+
const renderFrameWithOptionToReject = async ({ frame, index, reject, width, height, }) => {
|
|
150
150
|
const pool = await poolPromise;
|
|
151
151
|
const freePage = await pool.acquire();
|
|
152
152
|
if (stopped) {
|
|
@@ -174,6 +174,8 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
174
174
|
frame,
|
|
175
175
|
output: null,
|
|
176
176
|
},
|
|
177
|
+
height: composition.height,
|
|
178
|
+
width: composition.width,
|
|
177
179
|
});
|
|
178
180
|
(0, perf_1.stopPerfMeasure)(id);
|
|
179
181
|
onFrameBuffer(buffer, frame);
|
|
@@ -198,6 +200,8 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
198
200
|
frame,
|
|
199
201
|
output,
|
|
200
202
|
},
|
|
203
|
+
height,
|
|
204
|
+
width,
|
|
201
205
|
});
|
|
202
206
|
}
|
|
203
207
|
}
|
|
@@ -228,7 +232,13 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
228
232
|
};
|
|
229
233
|
const renderFrame = (frame, index) => {
|
|
230
234
|
return new Promise((resolve, reject) => {
|
|
231
|
-
renderFrameWithOptionToReject(
|
|
235
|
+
renderFrameWithOptionToReject({
|
|
236
|
+
frame,
|
|
237
|
+
index,
|
|
238
|
+
reject,
|
|
239
|
+
width: composition.width,
|
|
240
|
+
height: composition.height,
|
|
241
|
+
})
|
|
232
242
|
.then(() => {
|
|
233
243
|
resolve();
|
|
234
244
|
})
|
package/dist/render-still.js
CHANGED
|
@@ -48,7 +48,7 @@ const set_props_and_env_1 = require("./set-props-and-env");
|
|
|
48
48
|
const validate_frame_1 = require("./validate-frame");
|
|
49
49
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
50
50
|
const validate_scale_1 = require("./validate-scale");
|
|
51
|
-
const innerRenderStill = async ({ composition, quality, imageFormat = 'png', serveUrl, puppeteerInstance, dumpBrowserLogs = false, onError, inputProps, envVariables, output, frame = 0, overwrite = true, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale, proxyPort, cancelSignal, }) => {
|
|
51
|
+
const innerRenderStill = async ({ composition, quality, imageFormat = 'png', serveUrl, puppeteerInstance, dumpBrowserLogs = false, onError, inputProps, envVariables, output, frame = 0, overwrite = true, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale = 1, proxyPort, cancelSignal, }) => {
|
|
52
52
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
|
|
53
53
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
|
|
54
54
|
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderStill()`', false);
|
|
@@ -159,6 +159,8 @@ const innerRenderStill = async ({ composition, quality, imageFormat = 'png', ser
|
|
|
159
159
|
frame: stillFrame,
|
|
160
160
|
output,
|
|
161
161
|
},
|
|
162
|
+
height: composition.height,
|
|
163
|
+
width: composition.width,
|
|
162
164
|
});
|
|
163
165
|
await cleanup();
|
|
164
166
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { Page } from './browser/BrowserPage';
|
|
3
2
|
import type { ImageFormat } from './image-format';
|
|
4
|
-
export declare const screenshotDOMElement: ({ page, imageFormat, quality, opts, }: {
|
|
3
|
+
export declare const screenshotDOMElement: ({ page, imageFormat, quality, opts, height, width, }: {
|
|
5
4
|
page: Page;
|
|
6
5
|
imageFormat: ImageFormat;
|
|
7
6
|
quality: number | undefined;
|
|
8
7
|
opts: {
|
|
9
8
|
path: string | null;
|
|
10
9
|
};
|
|
10
|
+
height: number;
|
|
11
|
+
width: number;
|
|
11
12
|
}) => Promise<Buffer>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.screenshotDOMElement = void 0;
|
|
4
4
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
5
5
|
const puppeteer_screenshot_1 = require("./puppeteer-screenshot");
|
|
6
|
-
const screenshotDOMElement = async ({ page, imageFormat, quality, opts, }) => {
|
|
6
|
+
const screenshotDOMElement = async ({ page, imageFormat, quality, opts, height, width, }) => {
|
|
7
7
|
const { path } = opts;
|
|
8
8
|
if (imageFormat === 'png') {
|
|
9
9
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
@@ -28,11 +28,14 @@ const screenshotDOMElement = async ({ page, imageFormat, quality, opts, }) => {
|
|
|
28
28
|
if (imageFormat === 'none') {
|
|
29
29
|
throw new TypeError('Tried to make a screenshot with format "none"');
|
|
30
30
|
}
|
|
31
|
-
return (0, puppeteer_screenshot_1.screenshot)(
|
|
31
|
+
return (0, puppeteer_screenshot_1.screenshot)({
|
|
32
|
+
page,
|
|
32
33
|
omitBackground: imageFormat === 'png',
|
|
33
34
|
path: path !== null && path !== void 0 ? path : undefined,
|
|
34
35
|
type: imageFormat,
|
|
35
36
|
quality,
|
|
37
|
+
width,
|
|
38
|
+
height,
|
|
36
39
|
});
|
|
37
40
|
};
|
|
38
41
|
exports.screenshotDOMElement = screenshotDOMElement;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { Page } from './browser/BrowserPage';
|
|
3
|
-
import type { ScreenshotOptions } from './browser/ScreenshotOptions';
|
|
4
2
|
import type { StillImageFormat } from './image-format';
|
|
5
|
-
export declare const screenshotTask: (
|
|
3
|
+
export declare const screenshotTask: ({ format, height, omitBackground, page, width, path, quality, }: {
|
|
4
|
+
page: Page;
|
|
5
|
+
format: StillImageFormat;
|
|
6
|
+
path?: string | undefined;
|
|
7
|
+
quality?: number | undefined;
|
|
8
|
+
omitBackground: boolean;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}) => Promise<Buffer | string>;
|
package/dist/screenshot-task.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.screenshotTask = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const perf_1 = require("./perf");
|
|
9
|
-
const screenshotTask = async (page,
|
|
9
|
+
const screenshotTask = async ({ format, height, omitBackground, page, width, path, quality, }) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const client = page._client();
|
|
12
12
|
const target = page.target();
|
|
@@ -15,7 +15,7 @@ const screenshotTask = async (page, format, options) => {
|
|
|
15
15
|
targetId: target._targetId,
|
|
16
16
|
});
|
|
17
17
|
(0, perf_1.stopPerfMeasure)(perfTarget);
|
|
18
|
-
const shouldSetDefaultBackground =
|
|
18
|
+
const shouldSetDefaultBackground = omitBackground && format === 'png';
|
|
19
19
|
if (shouldSetDefaultBackground)
|
|
20
20
|
await client.send('Emulation.setDefaultBackgroundColorOverride', {
|
|
21
21
|
color: { r: 0, g: 0, b: 0, a: 0 },
|
|
@@ -24,8 +24,14 @@ const screenshotTask = async (page, format, options) => {
|
|
|
24
24
|
try {
|
|
25
25
|
const result = await client.send('Page.captureScreenshot', {
|
|
26
26
|
format,
|
|
27
|
-
quality
|
|
28
|
-
clip:
|
|
27
|
+
quality,
|
|
28
|
+
clip: {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
height,
|
|
32
|
+
scale: 1,
|
|
33
|
+
width,
|
|
34
|
+
},
|
|
29
35
|
captureBeyondViewport: true,
|
|
30
36
|
});
|
|
31
37
|
(0, perf_1.stopPerfMeasure)(cap);
|
|
@@ -33,8 +39,8 @@ const screenshotTask = async (page, format, options) => {
|
|
|
33
39
|
await client.send('Emulation.setDefaultBackgroundColorOverride');
|
|
34
40
|
const saveMarker = (0, perf_1.startPerfMeasure)('save');
|
|
35
41
|
const buffer = Buffer.from(result.data, 'base64');
|
|
36
|
-
if (
|
|
37
|
-
await fs_1.default.promises.writeFile(
|
|
42
|
+
if (path)
|
|
43
|
+
await fs_1.default.promises.writeFile(path, buffer);
|
|
38
44
|
(0, perf_1.stopPerfMeasure)(saveMarker);
|
|
39
45
|
return buffer;
|
|
40
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"execa": "5.1.1",
|
|
24
24
|
"extract-zip": "2.0.1",
|
|
25
|
-
"remotion": "3.3.
|
|
25
|
+
"remotion": "3.3.6",
|
|
26
26
|
"source-map": "^0.8.0-beta.0",
|
|
27
27
|
"ws": "8.7.0"
|
|
28
28
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "40198e5226bfa91a4df72159aec44d56e17fe8a1"
|
|
61
61
|
}
|