@remotion/renderer 4.0.223 → 4.0.225
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/Cargo.lock +2 -243
- package/Cargo.toml +0 -1
- package/dist/browser/Browser.d.ts +11 -12
- package/dist/browser/Browser.js +18 -14
- package/dist/browser/BrowserRunner.d.ts +17 -20
- package/dist/browser/BrowserRunner.js +128 -145
- package/dist/browser/LaunchOptions.d.ts +5 -13
- package/dist/browser/Launcher.d.ts +17 -9
- package/dist/browser/Launcher.js +23 -107
- package/dist/client.d.ts +5 -5
- package/dist/compositor/payloads.d.ts +0 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -2
- package/dist/open-browser.js +12 -4
- package/dist/options/color-space.d.ts +1 -1
- package/dist/options/index.d.ts +1 -1
- package/dist/options/options-map.d.ts +3 -3
- package/dist/serve-static.js +4 -0
- package/ensure-browser.mjs +7 -14
- package/package.json +10 -10
|
@@ -37,23 +37,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
37
37
|
__setModuleDefault(result, mod);
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
41
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
42
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
43
|
-
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");
|
|
44
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
45
|
-
};
|
|
46
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
47
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
48
|
-
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");
|
|
49
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
50
|
-
};
|
|
51
|
-
var _BrowserRunner_executablePath, _BrowserRunner_processArguments, _BrowserRunner_userDataDir, _BrowserRunner_closed, _BrowserRunner_listeners, _BrowserRunner_processClosing;
|
|
52
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
41
|
+
exports.makeBrowserRunner = void 0;
|
|
54
42
|
const childProcess = __importStar(require("node:child_process"));
|
|
55
|
-
const
|
|
43
|
+
const node_path_1 = require("node:path");
|
|
56
44
|
const delete_directory_1 = require("../delete-directory");
|
|
45
|
+
const log_level_1 = require("../log-level");
|
|
57
46
|
const logger_1 = require("../logger");
|
|
58
47
|
const truthy_1 = require("../truthy");
|
|
59
48
|
const Connection_1 = require("./Connection");
|
|
@@ -66,124 +55,32 @@ const PROCESS_ERROR_EXPLANATION = `Puppeteer was unable to kill the process whic
|
|
|
66
55
|
This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser.
|
|
67
56
|
Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed.
|
|
68
57
|
If you think this is a bug, please report it on the Puppeteer issue tracker.`;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.proc = childProcess.spawn(__classPrivateFieldGet(this, _BrowserRunner_executablePath, "f"), __classPrivateFieldGet(this, _BrowserRunner_processArguments, "f"), {
|
|
89
|
-
// On non-windows platforms, `detached: true` makes child process a
|
|
90
|
-
// leader of a new process group, making it possible to kill child
|
|
91
|
-
// process tree with `.kill(-pid)` command. @see
|
|
92
|
-
// https://nodejs.org/api/child_process.html#child_process_options_detached
|
|
93
|
-
detached: process.platform !== 'win32',
|
|
94
|
-
env,
|
|
95
|
-
stdio,
|
|
96
|
-
});
|
|
97
|
-
if (dumpio) {
|
|
98
|
-
(_a = this.proc.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (d) => {
|
|
99
|
-
const message = d.toString('utf8').trim();
|
|
100
|
-
if ((0, should_log_message_1.shouldLogBrowserMessage)(message)) {
|
|
101
|
-
const formatted = (0, should_log_message_1.formatChromeMessage)(message);
|
|
102
|
-
if (!formatted) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const { output, tag } = formatted;
|
|
106
|
-
logger_1.Log.verbose({ indent: options.indent, logLevel: options.logLevel, tag }, output);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
(_b = this.proc.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (d) => {
|
|
110
|
-
const message = d.toString('utf8').trim();
|
|
111
|
-
if ((0, should_log_message_1.shouldLogBrowserMessage)(message)) {
|
|
112
|
-
const formatted = (0, should_log_message_1.formatChromeMessage)(message);
|
|
113
|
-
if (!formatted) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const { output, tag } = formatted;
|
|
117
|
-
logger_1.Log.error({ indent: options.indent, logLevel: options.logLevel, tag }, output);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
__classPrivateFieldSet(this, _BrowserRunner_closed, false, "f");
|
|
122
|
-
__classPrivateFieldSet(this, _BrowserRunner_processClosing, new Promise((fulfill, reject) => {
|
|
123
|
-
this.proc.once('exit', () => {
|
|
124
|
-
__classPrivateFieldSet(this, _BrowserRunner_closed, true, "f");
|
|
125
|
-
// Cleanup as processes exit.
|
|
126
|
-
try {
|
|
127
|
-
if (fs.existsSync(__classPrivateFieldGet(this, _BrowserRunner_userDataDir, "f"))) {
|
|
128
|
-
(0, delete_directory_1.deleteDirectory)(__classPrivateFieldGet(this, _BrowserRunner_userDataDir, "f"));
|
|
129
|
-
}
|
|
130
|
-
fulfill();
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
reject(error);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}), "f");
|
|
137
|
-
__classPrivateFieldSet(this, _BrowserRunner_listeners, [(0, util_1.addEventListener)(process, 'exit', this.kill.bind(this))], "f");
|
|
138
|
-
__classPrivateFieldGet(this, _BrowserRunner_listeners, "f").push((0, util_1.addEventListener)(process, 'SIGINT', () => {
|
|
139
|
-
this.kill();
|
|
140
|
-
process.exit(130);
|
|
141
|
-
}));
|
|
142
|
-
__classPrivateFieldGet(this, _BrowserRunner_listeners, "f").push((0, util_1.addEventListener)(process, 'SIGTERM', this.close.bind(this)));
|
|
143
|
-
__classPrivateFieldGet(this, _BrowserRunner_listeners, "f").push((0, util_1.addEventListener)(process, 'SIGHUP', this.close.bind(this)));
|
|
144
|
-
}
|
|
145
|
-
close() {
|
|
146
|
-
if (__classPrivateFieldGet(this, _BrowserRunner_closed, "f")) {
|
|
147
|
-
return Promise.resolve();
|
|
148
|
-
}
|
|
149
|
-
this.kill();
|
|
150
|
-
// Cleanup this listener last, as that makes sure the full callback runs. If we
|
|
151
|
-
// perform this earlier, then the previous function calls would not happen.
|
|
152
|
-
(0, util_1.removeEventListeners)(__classPrivateFieldGet(this, _BrowserRunner_listeners, "f"));
|
|
153
|
-
return __classPrivateFieldGet(this, _BrowserRunner_processClosing, "f");
|
|
154
|
-
}
|
|
155
|
-
forgetEventLoop() {
|
|
156
|
-
var _a, _b;
|
|
157
|
-
(0, assert_1.assert)(this.proc, 'BrowserRunner not started.');
|
|
158
|
-
this.proc.unref();
|
|
159
|
-
// @ts-expect-error
|
|
160
|
-
(_a = this.proc.stdout) === null || _a === void 0 ? void 0 : _a.unref();
|
|
161
|
-
// @ts-expect-error
|
|
162
|
-
(_b = this.proc.stderr) === null || _b === void 0 ? void 0 : _b.unref();
|
|
163
|
-
(0, assert_1.assert)(this.connection, 'BrowserRunner not connected.');
|
|
164
|
-
this.connection.transport.forgetEventLoop();
|
|
165
|
-
}
|
|
166
|
-
rememberEventLoop() {
|
|
167
|
-
var _a, _b;
|
|
168
|
-
(0, assert_1.assert)(this.proc, 'BrowserRunner not started.');
|
|
169
|
-
this.proc.ref();
|
|
170
|
-
// @ts-expect-error
|
|
171
|
-
(_a = this.proc.stdout) === null || _a === void 0 ? void 0 : _a.ref();
|
|
172
|
-
// @ts-expect-error
|
|
173
|
-
(_b = this.proc.stderr) === null || _b === void 0 ? void 0 : _b.ref();
|
|
174
|
-
(0, assert_1.assert)(this.connection, 'BrowserRunner not connected.');
|
|
175
|
-
this.connection.transport.rememberEventLoop();
|
|
176
|
-
}
|
|
177
|
-
kill() {
|
|
178
|
-
var _a;
|
|
58
|
+
const makeBrowserRunner = async ({ executablePath, processArguments, userDataDir, logLevel, indent, timeout, }) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const dumpio = (0, log_level_1.isEqualOrBelowLogLevel)(logLevel, 'verbose');
|
|
61
|
+
const stdio = dumpio
|
|
62
|
+
? ['ignore', 'pipe', 'pipe']
|
|
63
|
+
: ['pipe', 'ignore', 'pipe'];
|
|
64
|
+
const proc = childProcess.spawn(executablePath, processArguments, {
|
|
65
|
+
// On non-windows platforms, `detached: true` makes child process a
|
|
66
|
+
// leader of a new process group, making it possible to kill child
|
|
67
|
+
// process tree with `.kill(-pid)` command. @see
|
|
68
|
+
// https://nodejs.org/api/child_process.html#child_process_options_detached
|
|
69
|
+
detached: process.platform !== 'win32',
|
|
70
|
+
env: process.env,
|
|
71
|
+
stdio,
|
|
72
|
+
});
|
|
73
|
+
const browserWSEndpoint = await waitForWSEndpoint(proc, timeout);
|
|
74
|
+
const transport = await NodeWebSocketTransport_1.NodeWebSocketTransport.create(browserWSEndpoint);
|
|
75
|
+
const connection = new Connection_1.Connection(transport);
|
|
76
|
+
const killProcess = () => {
|
|
179
77
|
// If the process failed to launch (for example if the browser executable path
|
|
180
78
|
// is invalid), then the process does not get a pid assigned. A call to
|
|
181
79
|
// `proc.kill` would error, as the `pid` to-be-killed can not be found.
|
|
182
|
-
if (
|
|
183
|
-
const { proc } = this;
|
|
80
|
+
if (proc.pid && pidExists(proc.pid)) {
|
|
184
81
|
try {
|
|
185
82
|
if (process.platform === 'win32') {
|
|
186
|
-
childProcess.exec(`taskkill /pid ${
|
|
83
|
+
childProcess.exec(`taskkill /pid ${proc.pid} /T /F`, (error) => {
|
|
187
84
|
if (error) {
|
|
188
85
|
// taskkill can fail to kill the process e.g. due to missing permissions.
|
|
189
86
|
// Let's kill the process via Node API. This delays killing of all child
|
|
@@ -195,7 +92,7 @@ class BrowserRunner {
|
|
|
195
92
|
else {
|
|
196
93
|
// on linux the process group can be killed with the group id prefixed with
|
|
197
94
|
// a minus sign. The process group id is the group leader's pid.
|
|
198
|
-
const processGroupId = -
|
|
95
|
+
const processGroupId = -proc.pid;
|
|
199
96
|
try {
|
|
200
97
|
process.kill(processGroupId, 'SIGKILL');
|
|
201
98
|
}
|
|
@@ -211,26 +108,113 @@ class BrowserRunner {
|
|
|
211
108
|
throw new Error(`${PROCESS_ERROR_EXPLANATION}\nError cause: ${(0, util_1.isErrorLike)(error) ? error.stack : error}`);
|
|
212
109
|
}
|
|
213
110
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
111
|
+
(0, delete_directory_1.deleteDirectory)(userDataDir);
|
|
112
|
+
// Cleanup this listener last, as that makes sure the full callback runs. If we
|
|
113
|
+
// perform this earlier, then the previous function calls would not happen.
|
|
114
|
+
(0, util_1.removeEventListeners)(listeners);
|
|
115
|
+
};
|
|
116
|
+
const closeProcess = () => {
|
|
117
|
+
if (closed) {
|
|
118
|
+
return Promise.resolve();
|
|
217
119
|
}
|
|
218
|
-
|
|
120
|
+
killProcess();
|
|
121
|
+
(0, delete_directory_1.deleteDirectory)(userDataDir);
|
|
219
122
|
// Cleanup this listener last, as that makes sure the full callback runs. If we
|
|
220
123
|
// perform this earlier, then the previous function calls would not happen.
|
|
221
|
-
(0, util_1.removeEventListeners)(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
124
|
+
(0, util_1.removeEventListeners)(listeners);
|
|
125
|
+
return processClosing;
|
|
126
|
+
};
|
|
127
|
+
if (dumpio) {
|
|
128
|
+
(_a = proc.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (d) => {
|
|
129
|
+
const message = d.toString('utf8').trim();
|
|
130
|
+
if ((0, should_log_message_1.shouldLogBrowserMessage)(message)) {
|
|
131
|
+
const formatted = (0, should_log_message_1.formatChromeMessage)(message);
|
|
132
|
+
if (!formatted) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const { output, tag } = formatted;
|
|
136
|
+
logger_1.Log.verbose({ indent, logLevel, tag }, output);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
(_b = proc.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (d) => {
|
|
140
|
+
const message = d.toString('utf8').trim();
|
|
141
|
+
if ((0, should_log_message_1.shouldLogBrowserMessage)(message)) {
|
|
142
|
+
const formatted = (0, should_log_message_1.formatChromeMessage)(message);
|
|
143
|
+
if (!formatted) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const { output, tag } = formatted;
|
|
147
|
+
logger_1.Log.error({ indent, logLevel, tag }, output);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
230
150
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
151
|
+
let closed = false;
|
|
152
|
+
const processClosing = new Promise((fulfill, reject) => {
|
|
153
|
+
proc.once('exit', () => {
|
|
154
|
+
closed = true;
|
|
155
|
+
// Cleanup as processes exit.
|
|
156
|
+
try {
|
|
157
|
+
fulfill();
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
reject(error);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
const listeners = [(0, util_1.addEventListener)(process, 'exit', killProcess)];
|
|
165
|
+
listeners.push((0, util_1.addEventListener)(process, 'SIGINT', () => {
|
|
166
|
+
killProcess();
|
|
167
|
+
process.exit(130);
|
|
168
|
+
}));
|
|
169
|
+
listeners.push((0, util_1.addEventListener)(process, 'SIGTERM', closeProcess));
|
|
170
|
+
listeners.push((0, util_1.addEventListener)(process, 'SIGHUP', closeProcess));
|
|
171
|
+
const deleteBrowserCaches = () => {
|
|
172
|
+
// We leave some data:
|
|
173
|
+
// Default/Cookies
|
|
174
|
+
// Default/Local Storage
|
|
175
|
+
// Default/Session Storage
|
|
176
|
+
// DevToolsActivePort
|
|
177
|
+
// Because not sure if it is bad to delete them while Chrome is running.
|
|
178
|
+
const cachePaths = [
|
|
179
|
+
(0, node_path_1.join)(userDataDir, 'Default', 'Cache', 'Cache_Data'),
|
|
180
|
+
(0, node_path_1.join)(userDataDir, 'Default', 'Code Cache'),
|
|
181
|
+
(0, node_path_1.join)(userDataDir, 'Default', 'DawnCache'),
|
|
182
|
+
(0, node_path_1.join)(userDataDir, 'Default', 'GPUCache'),
|
|
183
|
+
];
|
|
184
|
+
for (const p of cachePaths) {
|
|
185
|
+
(0, delete_directory_1.deleteDirectory)(p);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const rememberEventLoop = () => {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
proc.ref();
|
|
191
|
+
// @ts-expect-error
|
|
192
|
+
(_a = proc.stdout) === null || _a === void 0 ? void 0 : _a.ref();
|
|
193
|
+
// @ts-expect-error
|
|
194
|
+
(_b = proc.stderr) === null || _b === void 0 ? void 0 : _b.ref();
|
|
195
|
+
(0, assert_1.assert)(connection, 'BrowserRunner not connected.');
|
|
196
|
+
connection.transport.rememberEventLoop();
|
|
197
|
+
};
|
|
198
|
+
const forgetEventLoop = () => {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
proc.unref();
|
|
201
|
+
// @ts-expect-error
|
|
202
|
+
(_a = proc.stdout) === null || _a === void 0 ? void 0 : _a.unref();
|
|
203
|
+
// @ts-expect-error
|
|
204
|
+
(_b = proc.stderr) === null || _b === void 0 ? void 0 : _b.unref();
|
|
205
|
+
(0, assert_1.assert)(connection, 'BrowserRunner not connected.');
|
|
206
|
+
connection.transport.forgetEventLoop();
|
|
207
|
+
};
|
|
208
|
+
return {
|
|
209
|
+
listeners,
|
|
210
|
+
deleteBrowserCaches,
|
|
211
|
+
forgetEventLoop,
|
|
212
|
+
rememberEventLoop,
|
|
213
|
+
connection,
|
|
214
|
+
closeProcess,
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
exports.makeBrowserRunner = makeBrowserRunner;
|
|
234
218
|
function waitForWSEndpoint(browserProcess, timeout) {
|
|
235
219
|
const browserStderr = browserProcess.stderr;
|
|
236
220
|
(0, assert_1.assert)(browserStderr, '`browserProcess` does not have stderr.');
|
|
@@ -271,7 +255,6 @@ function waitForWSEndpoint(browserProcess, timeout) {
|
|
|
271
255
|
return;
|
|
272
256
|
}
|
|
273
257
|
cleanup();
|
|
274
|
-
// The RegExp matches, so this will obviously exist.
|
|
275
258
|
resolve(match[1]);
|
|
276
259
|
}
|
|
277
260
|
function cleanup() {
|
|
@@ -14,20 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { LogLevel } from '../log-level';
|
|
17
|
-
import type {
|
|
18
|
-
export interface BrowserLaunchArgumentOptions {
|
|
19
|
-
headless?: boolean | 'chrome';
|
|
20
|
-
userDataDir?: string;
|
|
21
|
-
devtools?: boolean;
|
|
22
|
-
debuggingPort?: number;
|
|
23
|
-
args: string[];
|
|
24
|
-
}
|
|
17
|
+
import type { Viewport } from './PuppeteerViewport';
|
|
25
18
|
export interface LaunchOptions {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
dumpio?: boolean;
|
|
19
|
+
args: string[];
|
|
20
|
+
executablePath: string;
|
|
29
21
|
logLevel: LogLevel;
|
|
30
|
-
env?: Record<string, string | undefined>;
|
|
31
22
|
indent: boolean;
|
|
23
|
+
defaultViewport: Viewport;
|
|
24
|
+
userDataDir: string;
|
|
32
25
|
}
|
|
33
|
-
export type PuppeteerNodeLaunchOptions = BrowserLaunchArgumentOptions & LaunchOptions & BrowserConnectOptions;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2017 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
|
+
*/
|
|
1
16
|
import { HeadlessBrowser } from './Browser';
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
launch(object: PuppeteerNodeLaunchOptions): Promise<HeadlessBrowser>;
|
|
5
|
-
executablePath: (path?: any) => string;
|
|
6
|
-
}
|
|
7
|
-
export declare class ChromeLauncher implements ProductLauncher {
|
|
8
|
-
launch(options: PuppeteerNodeLaunchOptions): Promise<HeadlessBrowser>;
|
|
9
|
-
executablePath(): string;
|
|
10
|
-
}
|
|
17
|
+
import type { LaunchOptions } from './LaunchOptions';
|
|
18
|
+
export declare const launchChrome: ({ args, executablePath, defaultViewport, indent, logLevel, userDataDir, }: LaunchOptions) => Promise<HeadlessBrowser>;
|
package/dist/browser/Launcher.js
CHANGED
|
@@ -1,32 +1,4 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ChromeLauncher = void 0;
|
|
30
2
|
/**
|
|
31
3
|
* Copyright 2017 Google Inc. All rights reserved.
|
|
32
4
|
*
|
|
@@ -42,85 +14,29 @@ exports.ChromeLauncher = void 0;
|
|
|
42
14
|
* See the License for the specific language governing permissions and
|
|
43
15
|
* limitations under the License.
|
|
44
16
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const path = __importStar(require("node:path"));
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.launchChrome = void 0;
|
|
48
19
|
const Browser_1 = require("./Browser");
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// with a custom directory specified via the userDataDir option.
|
|
65
|
-
const userDataDir = await node_fs_1.default.promises.mkdtemp(path.join(tmpDir(), 'puppeteer_dev_chrome_profile-'));
|
|
66
|
-
chromeArguments.push(`--user-data-dir=${userDataDir}`);
|
|
67
|
-
let chromeExecutable = executablePath;
|
|
68
|
-
if (!chromeExecutable) {
|
|
69
|
-
const { missingText, executablePath: exPath } = resolveExecutablePath();
|
|
70
|
-
if (missingText) {
|
|
71
|
-
throw new Error(missingText);
|
|
72
|
-
}
|
|
73
|
-
chromeExecutable = exPath;
|
|
74
|
-
}
|
|
75
|
-
const runner = new BrowserRunner_1.BrowserRunner({
|
|
76
|
-
executablePath: chromeExecutable,
|
|
77
|
-
processArguments: chromeArguments,
|
|
78
|
-
userDataDir,
|
|
79
|
-
});
|
|
80
|
-
runner.start({
|
|
81
|
-
dumpio,
|
|
82
|
-
env,
|
|
83
|
-
indent,
|
|
84
|
-
logLevel: options.logLevel,
|
|
85
|
-
});
|
|
86
|
-
let browser;
|
|
87
|
-
try {
|
|
88
|
-
const connection = await runner.setupConnection({
|
|
89
|
-
timeout,
|
|
90
|
-
});
|
|
91
|
-
browser = await Browser_1.HeadlessBrowser._create({
|
|
92
|
-
connection,
|
|
93
|
-
defaultViewport,
|
|
94
|
-
closeCallback: runner.close.bind(runner),
|
|
95
|
-
forgetEventLoop: runner.forgetEventLoop.bind(runner),
|
|
96
|
-
rememberEventLoop: runner.rememberEventLoop.bind(runner),
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
runner.kill();
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
await browser.waitForTarget((t) => {
|
|
105
|
-
return t.type() === 'page';
|
|
106
|
-
}, { timeout });
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
await browser.close(false, options.logLevel, options.indent);
|
|
110
|
-
throw error;
|
|
111
|
-
}
|
|
112
|
-
return browser;
|
|
20
|
+
const launchChrome = async ({ args, executablePath, defaultViewport, indent, logLevel, userDataDir, }) => {
|
|
21
|
+
const timeout = 60000;
|
|
22
|
+
const browser = await Browser_1.HeadlessBrowser.create({
|
|
23
|
+
defaultViewport,
|
|
24
|
+
args,
|
|
25
|
+
executablePath,
|
|
26
|
+
timeout,
|
|
27
|
+
userDataDir,
|
|
28
|
+
logLevel,
|
|
29
|
+
indent,
|
|
30
|
+
});
|
|
31
|
+
try {
|
|
32
|
+
await browser.waitForTarget((t) => {
|
|
33
|
+
return t.type() === 'page';
|
|
34
|
+
}, { timeout });
|
|
113
35
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
36
|
+
catch (error) {
|
|
37
|
+
await browser.close(false, logLevel, indent);
|
|
38
|
+
throw error;
|
|
117
39
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const revisionInfo = (0, BrowserFetcher_1.getRevisionInfo)();
|
|
122
|
-
const missingText = revisionInfo.local
|
|
123
|
-
? undefined
|
|
124
|
-
: `Could not find expected browser locally.`;
|
|
125
|
-
return { executablePath: revisionInfo.executablePath, missingText };
|
|
126
|
-
}
|
|
40
|
+
return browser;
|
|
41
|
+
};
|
|
42
|
+
exports.launchChrome = launchChrome;
|
package/dist/client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const BrowserSafeApis: {
|
|
|
12
12
|
validPixelFormatsForCodec: (codec: import("./codec").Codec) => readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"] | ("yuv420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le")[];
|
|
13
13
|
validVideoImageFormats: readonly ["png", "jpeg", "none"];
|
|
14
14
|
validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
|
|
15
|
-
DEFAULT_PIXEL_FORMAT: "yuv420p" | "
|
|
15
|
+
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
16
16
|
DEFAULT_TIMEOUT: number;
|
|
17
17
|
DEFAULT_JPEG_QUALITY: number;
|
|
18
18
|
DEFAULT_COLOR_SPACE: "default";
|
|
@@ -412,7 +412,7 @@ export declare const BrowserSafeApis: {
|
|
|
412
412
|
source: string;
|
|
413
413
|
value: import("./options/color-space").ColorSpace;
|
|
414
414
|
};
|
|
415
|
-
setConfig: (value: "
|
|
415
|
+
setConfig: (value: "default" | "bt709" | "bt2020-ncl" | null) => void;
|
|
416
416
|
};
|
|
417
417
|
deleteAfterOption: {
|
|
418
418
|
name: string;
|
|
@@ -938,7 +938,7 @@ export declare const BrowserSafeApis: {
|
|
|
938
938
|
source: string;
|
|
939
939
|
value: import("./options/color-space").ColorSpace;
|
|
940
940
|
};
|
|
941
|
-
setConfig: (value: "
|
|
941
|
+
setConfig: (value: "default" | "bt709" | "bt2020-ncl" | null) => void;
|
|
942
942
|
};
|
|
943
943
|
readonly codec: {
|
|
944
944
|
name: string;
|
|
@@ -1678,7 +1678,7 @@ export declare const BrowserSafeApis: {
|
|
|
1678
1678
|
source: string;
|
|
1679
1679
|
value: import("./options/color-space").ColorSpace;
|
|
1680
1680
|
};
|
|
1681
|
-
setConfig: (value: "
|
|
1681
|
+
setConfig: (value: "default" | "bt709" | "bt2020-ncl" | null) => void;
|
|
1682
1682
|
};
|
|
1683
1683
|
readonly muted: {
|
|
1684
1684
|
name: string;
|
|
@@ -1942,7 +1942,7 @@ export declare const BrowserSafeApis: {
|
|
|
1942
1942
|
source: string;
|
|
1943
1943
|
value: import("./options/color-space").ColorSpace;
|
|
1944
1944
|
};
|
|
1945
|
-
setConfig: (value: "
|
|
1945
|
+
setConfig: (value: "default" | "bt709" | "bt2020-ncl" | null) => void;
|
|
1946
1946
|
};
|
|
1947
1947
|
readonly audioBitrate: {
|
|
1948
1948
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -142,7 +142,7 @@ export declare const RenderInternals: {
|
|
|
142
142
|
DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
|
|
143
143
|
validateOpenGlRenderer: (option: unknown) => import("./options/gl").OpenGlRenderer | null;
|
|
144
144
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
|
|
145
|
-
DEFAULT_PIXEL_FORMAT: "yuv420p" | "
|
|
145
|
+
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
146
146
|
validateJpegQuality: (q: unknown) => void;
|
|
147
147
|
DEFAULT_TIMEOUT: number;
|
|
148
148
|
DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
|
|
@@ -353,7 +353,7 @@ export declare const RenderInternals: {
|
|
|
353
353
|
validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
|
|
354
354
|
validVideoImageFormats: readonly ["png", "jpeg", "none"];
|
|
355
355
|
DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
|
|
356
|
-
DEFAULT_VIDEO_IMAGE_FORMAT: "
|
|
356
|
+
DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
|
|
357
357
|
DEFAULT_JPEG_QUALITY: number;
|
|
358
358
|
chalk: {
|
|
359
359
|
enabled: () => boolean;
|
|
@@ -889,7 +889,6 @@ export declare const RenderInternals: {
|
|
|
889
889
|
slowestFrames: import("./render-media").SlowFrame[];
|
|
890
890
|
}>;
|
|
891
891
|
validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader", "vulkan", "angle-egl"];
|
|
892
|
-
copyImageToClipboard: (src: string, logLevel: import("./log-level").LogLevel, binariesDirectory: string | null) => Promise<void>;
|
|
893
892
|
isIpV6Supported: (flattened: import("os").NetworkInterfaceInfo[]) => boolean;
|
|
894
893
|
getChromiumGpuInformation: ({ browserExecutable, indent, logLevel, chromiumOptions, timeoutInMilliseconds, onBrowserDownload, }: {
|
|
895
894
|
browserExecutable: import("./browser-executable").BrowserExecutable;
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,6 @@ const codec_1 = require("./codec");
|
|
|
41
41
|
const combine_videos_1 = require("./combine-videos");
|
|
42
42
|
const get_executable_path_1 = require("./compositor/get-executable-path");
|
|
43
43
|
const convert_to_positive_frame_index_1 = require("./convert-to-positive-frame-index");
|
|
44
|
-
const copy_to_clipboard_1 = require("./copy-to-clipboard");
|
|
45
44
|
const delete_directory_1 = require("./delete-directory");
|
|
46
45
|
const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
47
46
|
const symbolicate_error_1 = require("./error-handling/symbolicate-error");
|
|
@@ -195,7 +194,6 @@ exports.RenderInternals = {
|
|
|
195
194
|
internalRenderFrames: render_frames_1.internalRenderFrames,
|
|
196
195
|
internalRenderMedia: render_media_1.internalRenderMedia,
|
|
197
196
|
validOpenGlRenderers: gl_1.validOpenGlRenderers,
|
|
198
|
-
copyImageToClipboard: copy_to_clipboard_1.copyImageToClipboard,
|
|
199
197
|
isIpV6Supported: port_config_1.isIpV6Supported,
|
|
200
198
|
getChromiumGpuInformation: test_gpu_1.getChromiumGpuInformation,
|
|
201
199
|
getPortConfig: port_config_1.getPortConfig,
|