@remotion/renderer 3.0.22 → 4.0.0-2x.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/calculate-asset-positions.d.ts +2 -2
- package/dist/assets/convert-assets-to-file-urls.d.ts +2 -2
- package/dist/assets/download-and-map-assets-to-file.d.ts +1 -1
- package/dist/assets/ffmpeg-volume-expression.d.ts +1 -1
- package/dist/assets/flatten-volume-array.d.ts +1 -1
- package/dist/assets/get-audio-channels.d.ts +1 -1
- package/dist/assets/types.d.ts +1 -1
- package/dist/browser/Browser.d.ts +5 -159
- package/dist/browser/Browser.js +5 -190
- package/dist/browser/BrowserConnector.d.ts +1 -1
- package/dist/browser/BrowserFetcher.d.ts +3 -3
- package/dist/browser/BrowserFetcher.js +38 -20
- package/dist/browser/BrowserRunner.d.ts +2 -2
- package/dist/browser/BrowserRunner.js +1 -1
- package/dist/browser/Connection.d.ts +2 -9
- package/dist/browser/Connection.js +3 -23
- package/dist/browser/ConsoleMessage.d.ts +1 -1
- package/dist/browser/DOMWorld.d.ts +5 -6
- package/dist/browser/DOMWorld.js +2 -18
- package/dist/browser/EvalTypes.d.ts +1 -1
- package/dist/browser/EventEmitter.d.ts +1 -48
- package/dist/browser/EventEmitter.js +0 -49
- package/dist/browser/ExecutionContext.d.ts +6 -5
- package/dist/browser/FrameManager.d.ts +9 -13
- package/dist/browser/FrameManager.js +3 -19
- package/dist/browser/HTTPRequest.d.ts +2 -2
- package/dist/browser/HTTPResponse.d.ts +0 -1
- package/dist/browser/HTTPResponse.js +2 -9
- package/dist/browser/JSHandle.d.ts +3 -4
- package/dist/browser/JSHandle.js +0 -3
- package/dist/browser/LaunchOptions.d.ts +2 -81
- package/dist/browser/Launcher.d.ts +2 -2
- package/dist/browser/Launcher.js +21 -119
- package/dist/browser/LifecycleWatcher.d.ts +4 -4
- package/dist/browser/LifecycleWatcher.js +4 -17
- package/dist/browser/NetworkEventManager.d.ts +1 -3
- package/dist/browser/NetworkEventManager.js +0 -47
- package/dist/browser/NetworkManager.d.ts +1 -3
- package/dist/browser/NetworkManager.js +3 -35
- package/dist/browser/Page.d.ts +7 -9
- package/dist/browser/PuppeteerNode.d.ts +7 -56
- package/dist/browser/PuppeteerNode.js +4 -58
- package/dist/browser/Target.d.ts +3 -3
- package/dist/browser/assert.d.ts +0 -20
- package/dist/browser/assert.js +0 -20
- package/dist/browser/create-browser-fetcher.d.ts +1 -1
- package/dist/browser/create-browser-fetcher.js +3 -11
- package/dist/browser/util.d.ts +2 -2
- package/dist/browser/util.js +1 -1
- package/dist/browser-log.d.ts +1 -1
- package/dist/calculate-ffmpeg-filters.d.ts +1 -1
- package/dist/can-use-parallel-encoding.d.ts +1 -1
- package/dist/combine-videos.d.ts +1 -1
- package/dist/convert-to-pcm.d.ts +1 -1
- package/dist/create-silent-audio.d.ts +1 -1
- package/dist/cycle-browser-tabs.d.ts +1 -1
- package/dist/delay-render-embedded-stack.d.ts +1 -1
- package/dist/ensure-presentation-timestamp.d.ts +1 -1
- package/dist/ensure-presentation-timestamp.js +1 -1
- package/dist/error-handling/handle-javascript-exception.d.ts +2 -2
- package/dist/error-handling/handle-javascript-exception.js +2 -2
- package/dist/error-handling/symbolicate-error.d.ts +1 -1
- package/dist/error-handling/symbolicateable-error.d.ts +1 -1
- package/dist/extract-frame-from-video.d.ts +6 -5
- package/dist/extract-frame-from-video.js +26 -14
- package/dist/get-audio-codec-name.d.ts +1 -1
- package/dist/get-browser-instance.d.ts +4 -3
- package/dist/get-codec-name.d.ts +1 -1
- package/dist/get-compositions.d.ts +4 -4
- package/dist/get-compositions.js +2 -2
- package/dist/get-duration-from-frame-range.d.ts +1 -1
- package/dist/get-extension-from-codec.d.ts +1 -1
- package/dist/get-frame-to-render.d.ts +1 -1
- package/dist/get-local-browser-executable.d.ts +1 -1
- package/dist/get-local-browser-executable.js +7 -5
- package/dist/get-prores-profile-name.d.ts +1 -1
- package/dist/get-video-info.d.ts +8 -0
- package/dist/get-video-info.js +45 -0
- package/dist/image-format.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/is-vp9-video.d.ts +1 -1
- package/dist/last-frame-from-video-cache.d.ts +3 -3
- package/dist/merge-audio-track.d.ts +1 -1
- package/dist/offthread-video-server.d.ts +3 -3
- package/dist/open-browser.d.ts +5 -3
- package/dist/open-browser.js +8 -8
- package/dist/prepare-server.d.ts +2 -2
- package/dist/preprocess-audio-track.d.ts +2 -2
- package/dist/prespawn-ffmpeg.d.ts +2 -2
- package/dist/provide-screenshot.d.ts +4 -5
- package/dist/provide-screenshot.js +0 -1
- package/dist/puppeteer-evaluate.d.ts +1 -1
- package/dist/puppeteer-evaluate.js +3 -4
- package/dist/puppeteer-screenshot.d.ts +3 -3
- package/dist/puppeteer-screenshot.js +2 -4
- package/dist/render-frames.d.ts +9 -9
- package/dist/render-frames.js +18 -10
- package/dist/render-media.d.ts +8 -8
- package/dist/render-still.d.ts +6 -6
- package/dist/screenshot-dom-element.d.ts +6 -8
- package/dist/screenshot-dom-element.js +3 -6
- package/dist/screenshot-task.d.ts +3 -3
- package/dist/screenshot-task.js +3 -5
- package/dist/seek-to-frame.d.ts +2 -2
- package/dist/serve-handler/index.d.ts +1 -1
- package/dist/serve-handler/index.js +0 -1
- package/dist/serve-static.d.ts +2 -2
- package/dist/set-props-and-env.d.ts +1 -1
- package/dist/set-props-and-env.js +3 -0
- package/dist/stitch-frames-to-video.d.ts +3 -3
- package/dist/stringify-ffmpeg-filter.d.ts +2 -2
- package/dist/stringify-ffmpeg-filter.js +3 -0
- package/dist/symbolicate-stacktrace.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/validate-even-dimensions-with-codec.d.ts +1 -1
- package/dist/validate-output-filename.d.ts +1 -1
- package/package.json +10 -6
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TAsset } from 'remotion';
|
|
2
|
-
import { Assets } from './types';
|
|
1
|
+
import type { TAsset } from 'remotion';
|
|
2
|
+
import type { Assets } from './types';
|
|
3
3
|
export declare const calculateAssetPositions: (frames: TAsset[][]) => Assets;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TAsset } from 'remotion';
|
|
2
|
-
import { RenderMediaOnDownload } from './download-and-map-assets-to-file';
|
|
1
|
+
import type { TAsset } from 'remotion';
|
|
2
|
+
import type { RenderMediaOnDownload } from './download-and-map-assets-to-file';
|
|
3
3
|
export declare const convertAssetsToFileUrls: ({ assets, downloadDir, onDownload, }: {
|
|
4
4
|
assets: TAsset[][];
|
|
5
5
|
downloadDir: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AssetVolume, MediaAsset } from './types';
|
|
1
|
+
import type { AssetVolume, MediaAsset } from './types';
|
|
2
2
|
export declare const flattenVolumeArray: (volume: AssetVolume) => AssetVolume;
|
|
3
3
|
export declare const convertAssetToFlattenedVolume: (asset: MediaAsset) => MediaAsset;
|
package/dist/assets/types.d.ts
CHANGED
|
@@ -13,165 +13,33 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
import { ChildProcess } from 'child_process';
|
|
18
|
-
import { Connection } from './Connection';
|
|
16
|
+
import type { Connection } from './Connection';
|
|
19
17
|
import { EventEmitter } from './EventEmitter';
|
|
20
|
-
import { Page } from './Page';
|
|
21
|
-
import { Viewport } from './PuppeteerViewport';
|
|
18
|
+
import type { Page } from './Page';
|
|
19
|
+
import type { Viewport } from './PuppeteerViewport';
|
|
22
20
|
import { Target } from './Target';
|
|
23
|
-
interface BrowserContextOptions {
|
|
24
|
-
/**
|
|
25
|
-
* Proxy server with optional port to use for all requests.
|
|
26
|
-
* Username and password can be set in `Page.authenticate`.
|
|
27
|
-
*/
|
|
28
|
-
proxyServer?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Bypass the proxy for the given semi-colon-separated list of hosts.
|
|
31
|
-
*/
|
|
32
|
-
proxyBypassList?: string[];
|
|
33
|
-
}
|
|
34
21
|
declare type BrowserCloseCallback = () => Promise<void> | void;
|
|
35
22
|
interface WaitForTargetOptions {
|
|
36
|
-
/**
|
|
37
|
-
* Maximum wait time in milliseconds. Pass `0` to disable the timeout.
|
|
38
|
-
* @defaultValue 30 seconds.
|
|
39
|
-
*/
|
|
40
23
|
timeout?: number;
|
|
41
24
|
}
|
|
42
25
|
export declare class Browser extends EventEmitter {
|
|
43
26
|
#private;
|
|
44
|
-
static _create({ connection, contextIds, defaultViewport,
|
|
27
|
+
static _create({ connection, contextIds, defaultViewport, closeCallback, }: {
|
|
45
28
|
connection: Connection;
|
|
46
29
|
contextIds: string[];
|
|
47
30
|
defaultViewport: Viewport;
|
|
48
|
-
process?: ChildProcess;
|
|
49
31
|
closeCallback?: BrowserCloseCallback;
|
|
50
32
|
}): Promise<Browser>;
|
|
51
33
|
get _targets(): Map<string, Target>;
|
|
52
|
-
constructor(connection: Connection, contextIds: string[], defaultViewport: Viewport,
|
|
53
|
-
/**
|
|
54
|
-
* The spawned browser process. Returns `null` if the browser instance was created with
|
|
55
|
-
* {@link Puppeteer.connect}.
|
|
56
|
-
*/
|
|
57
|
-
process(): ChildProcess | null;
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new incognito browser context. This won't share cookies/cache with other
|
|
60
|
-
* browser contexts.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```js
|
|
64
|
-
* (async () => {
|
|
65
|
-
* const browser = await puppeteer.launch();
|
|
66
|
-
* // Create a new incognito browser context.
|
|
67
|
-
* const context = await browser.createIncognitoBrowserContext();
|
|
68
|
-
* // Create a new page in a pristine context.
|
|
69
|
-
* const page = await context.newPage();
|
|
70
|
-
* // Do stuff
|
|
71
|
-
* await page.goto('https://example.com');
|
|
72
|
-
* })();
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
createIncognitoBrowserContext(options?: BrowserContextOptions): Promise<BrowserContext>;
|
|
76
|
-
/**
|
|
77
|
-
* Returns an array of all open browser contexts. In a newly created browser, this will
|
|
78
|
-
* return a single instance of {@link BrowserContext}.
|
|
79
|
-
*/
|
|
34
|
+
constructor(connection: Connection, contextIds: string[], defaultViewport: Viewport, closeCallback?: BrowserCloseCallback);
|
|
80
35
|
browserContexts(): BrowserContext[];
|
|
81
|
-
/**
|
|
82
|
-
* Returns the default browser context. The default browser context cannot be closed.
|
|
83
|
-
*/
|
|
84
|
-
defaultBrowserContext(): BrowserContext;
|
|
85
|
-
_disposeContext(contextId?: string): Promise<void>;
|
|
86
|
-
/**
|
|
87
|
-
* The browser websocket endpoint which can be used as an argument to
|
|
88
|
-
* {@link Puppeteer.connect}.
|
|
89
|
-
*
|
|
90
|
-
* @returns The Browser websocket url.
|
|
91
|
-
*
|
|
92
|
-
* @remarks
|
|
93
|
-
*
|
|
94
|
-
* The format is `ws://${host}:${port}/devtools/browser/<id>`.
|
|
95
|
-
*
|
|
96
|
-
* You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`.
|
|
97
|
-
* Learn more about the
|
|
98
|
-
* {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and
|
|
99
|
-
* the {@link
|
|
100
|
-
* https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target
|
|
101
|
-
* | browser endpoint}.
|
|
102
|
-
*/
|
|
103
|
-
wsEndpoint(): string;
|
|
104
|
-
/**
|
|
105
|
-
* Promise which resolves to a new {@link Page} object. The Page is created in
|
|
106
|
-
* a default browser context.
|
|
107
|
-
*/
|
|
108
36
|
newPage(): Promise<Page>;
|
|
109
37
|
_createPageInContext(contextId?: string): Promise<Page>;
|
|
110
|
-
/**
|
|
111
|
-
* All active targets inside the Browser. In case of multiple browser contexts, returns
|
|
112
|
-
* an array with all the targets in all browser contexts.
|
|
113
|
-
*/
|
|
114
38
|
targets(): Target[];
|
|
115
|
-
/**
|
|
116
|
-
* The target associated with the browser.
|
|
117
|
-
*/
|
|
118
|
-
target(): Target;
|
|
119
|
-
/**
|
|
120
|
-
* Searches for a target in all browser contexts.
|
|
121
|
-
*
|
|
122
|
-
* @param predicate - A function to be run for every target.
|
|
123
|
-
* @returns The first target found that matches the `predicate` function.
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
*
|
|
127
|
-
* An example of finding a target for a page opened via `window.open`:
|
|
128
|
-
* ```js
|
|
129
|
-
* await page.evaluate(() => window.open('https://www.example.com/'));
|
|
130
|
-
* const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/');
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
39
|
waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: WaitForTargetOptions): Promise<Target>;
|
|
134
|
-
/**
|
|
135
|
-
* An array of all open pages inside the Browser.
|
|
136
|
-
*
|
|
137
|
-
* @remarks
|
|
138
|
-
*
|
|
139
|
-
* In case of multiple browser contexts, returns an array with all the pages in all
|
|
140
|
-
* browser contexts. Non-visible pages, such as `"background_page"`, will not be listed
|
|
141
|
-
* here. You can find them using {@link Target.page}.
|
|
142
|
-
*/
|
|
143
40
|
pages(): Promise<Page[]>;
|
|
144
|
-
/**
|
|
145
|
-
* A string representing the browser name and version.
|
|
146
|
-
*
|
|
147
|
-
* @remarks
|
|
148
|
-
*
|
|
149
|
-
* For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For
|
|
150
|
-
* non-headless, this is similar to `Chrome/61.0.3153.0`.
|
|
151
|
-
*
|
|
152
|
-
* The format of browser.version() might change with future releases of Chromium.
|
|
153
|
-
*/
|
|
154
|
-
version(): Promise<string>;
|
|
155
|
-
/**
|
|
156
|
-
* The browser's original user agent. Pages can override the browser user agent with
|
|
157
|
-
* {@link Page.setUserAgent}.
|
|
158
|
-
*/
|
|
159
|
-
userAgent(): Promise<string>;
|
|
160
|
-
/**
|
|
161
|
-
* Closes Chromium and all of its pages (if any were opened). The {@link Browser} object
|
|
162
|
-
* itself is considered to be disposed and cannot be used anymore.
|
|
163
|
-
*/
|
|
164
41
|
close(): Promise<void>;
|
|
165
|
-
/**
|
|
166
|
-
* Disconnects Puppeteer from the browser, but leaves the Chromium process running.
|
|
167
|
-
* After calling `disconnect`, the {@link Browser} object is considered disposed and
|
|
168
|
-
* cannot be used anymore.
|
|
169
|
-
*/
|
|
170
42
|
disconnect(): void;
|
|
171
|
-
/**
|
|
172
|
-
* Indicates that the browser is connected.
|
|
173
|
-
*/
|
|
174
|
-
isConnected(): boolean;
|
|
175
43
|
}
|
|
176
44
|
export declare class BrowserContext extends EventEmitter {
|
|
177
45
|
#private;
|
|
@@ -181,29 +49,7 @@ export declare class BrowserContext extends EventEmitter {
|
|
|
181
49
|
timeout?: number;
|
|
182
50
|
}): Promise<Target>;
|
|
183
51
|
pages(): Promise<Page[]>;
|
|
184
|
-
/**
|
|
185
|
-
* Returns whether BrowserContext is incognito.
|
|
186
|
-
* The default browser context is the only non-incognito browser context.
|
|
187
|
-
*
|
|
188
|
-
* @remarks
|
|
189
|
-
* The default browser context cannot be closed.
|
|
190
|
-
*/
|
|
191
|
-
isIncognito(): boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Creates a new page in the browser context.
|
|
194
|
-
*/
|
|
195
52
|
newPage(): Promise<Page>;
|
|
196
|
-
/**
|
|
197
|
-
* The browser this browser context belongs to.
|
|
198
|
-
*/
|
|
199
53
|
browser(): Browser;
|
|
200
|
-
/**
|
|
201
|
-
* Closes the browser context. All the targets that belong to the browser context
|
|
202
|
-
* will be closed.
|
|
203
|
-
*
|
|
204
|
-
* @remarks
|
|
205
|
-
* Only incognito browser contexts can be closed.
|
|
206
|
-
*/
|
|
207
|
-
close(): Promise<void>;
|
|
208
54
|
}
|
|
209
55
|
export {};
|
package/dist/browser/Browser.js
CHANGED
|
@@ -25,7 +25,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
25
25
|
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");
|
|
26
26
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
27
|
};
|
|
28
|
-
var _Browser_instances, _Browser_defaultViewport,
|
|
28
|
+
var _Browser_instances, _Browser_defaultViewport, _Browser_connection, _Browser_closeCallback, _Browser_defaultContext, _Browser_contexts, _Browser_targets, _Browser_targetCreated, _Browser_targetDestroyed, _Browser_targetInfoChanged, _BrowserContext_browser, _BrowserContext_id;
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.BrowserContext = exports.Browser = void 0;
|
|
31
31
|
const assert_1 = require("./assert");
|
|
@@ -34,18 +34,16 @@ const Target_1 = require("./Target");
|
|
|
34
34
|
const util_1 = require("./util");
|
|
35
35
|
class Browser extends EventEmitter_1.EventEmitter {
|
|
36
36
|
// eslint-disable-next-line max-params
|
|
37
|
-
constructor(connection, contextIds, defaultViewport,
|
|
37
|
+
constructor(connection, contextIds, defaultViewport, closeCallback) {
|
|
38
38
|
super();
|
|
39
39
|
_Browser_instances.add(this);
|
|
40
40
|
_Browser_defaultViewport.set(this, void 0);
|
|
41
|
-
_Browser_process.set(this, void 0);
|
|
42
41
|
_Browser_connection.set(this, void 0);
|
|
43
42
|
_Browser_closeCallback.set(this, void 0);
|
|
44
43
|
_Browser_defaultContext.set(this, void 0);
|
|
45
44
|
_Browser_contexts.set(this, void 0);
|
|
46
45
|
_Browser_targets.set(this, void 0);
|
|
47
46
|
__classPrivateFieldSet(this, _Browser_defaultViewport, defaultViewport, "f");
|
|
48
|
-
__classPrivateFieldSet(this, _Browser_process, process, "f");
|
|
49
47
|
__classPrivateFieldSet(this, _Browser_connection, connection, "f");
|
|
50
48
|
__classPrivateFieldSet(this, _Browser_closeCallback, closeCallback ||
|
|
51
49
|
function () {
|
|
@@ -61,95 +59,17 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
61
59
|
__classPrivateFieldGet(this, _Browser_connection, "f").on('Target.targetDestroyed', __classPrivateFieldGet(this, _Browser_instances, "m", _Browser_targetDestroyed).bind(this));
|
|
62
60
|
__classPrivateFieldGet(this, _Browser_connection, "f").on('Target.targetInfoChanged', __classPrivateFieldGet(this, _Browser_instances, "m", _Browser_targetInfoChanged).bind(this));
|
|
63
61
|
}
|
|
64
|
-
static async _create({ connection, contextIds, defaultViewport,
|
|
65
|
-
const browser = new Browser(connection, contextIds, defaultViewport,
|
|
62
|
+
static async _create({ connection, contextIds, defaultViewport, closeCallback, }) {
|
|
63
|
+
const browser = new Browser(connection, contextIds, defaultViewport, closeCallback);
|
|
66
64
|
await connection.send('Target.setDiscoverTargets', { discover: true });
|
|
67
65
|
return browser;
|
|
68
66
|
}
|
|
69
67
|
get _targets() {
|
|
70
68
|
return __classPrivateFieldGet(this, _Browser_targets, "f");
|
|
71
69
|
}
|
|
72
|
-
/**
|
|
73
|
-
* The spawned browser process. Returns `null` if the browser instance was created with
|
|
74
|
-
* {@link Puppeteer.connect}.
|
|
75
|
-
*/
|
|
76
|
-
process() {
|
|
77
|
-
var _a;
|
|
78
|
-
return (_a = __classPrivateFieldGet(this, _Browser_process, "f")) !== null && _a !== void 0 ? _a : null;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Creates a new incognito browser context. This won't share cookies/cache with other
|
|
82
|
-
* browser contexts.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```js
|
|
86
|
-
* (async () => {
|
|
87
|
-
* const browser = await puppeteer.launch();
|
|
88
|
-
* // Create a new incognito browser context.
|
|
89
|
-
* const context = await browser.createIncognitoBrowserContext();
|
|
90
|
-
* // Create a new page in a pristine context.
|
|
91
|
-
* const page = await context.newPage();
|
|
92
|
-
* // Do stuff
|
|
93
|
-
* await page.goto('https://example.com');
|
|
94
|
-
* })();
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
async createIncognitoBrowserContext(options = {}) {
|
|
98
|
-
const { proxyServer, proxyBypassList } = options;
|
|
99
|
-
const { browserContextId } = await __classPrivateFieldGet(this, _Browser_connection, "f").send('Target.createBrowserContext', {
|
|
100
|
-
proxyServer,
|
|
101
|
-
proxyBypassList: proxyBypassList === null || proxyBypassList === void 0 ? void 0 : proxyBypassList.join(','),
|
|
102
|
-
});
|
|
103
|
-
const context = new BrowserContext(this, browserContextId);
|
|
104
|
-
__classPrivateFieldGet(this, _Browser_contexts, "f").set(browserContextId, context);
|
|
105
|
-
return context;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Returns an array of all open browser contexts. In a newly created browser, this will
|
|
109
|
-
* return a single instance of {@link BrowserContext}.
|
|
110
|
-
*/
|
|
111
70
|
browserContexts() {
|
|
112
71
|
return [__classPrivateFieldGet(this, _Browser_defaultContext, "f"), ...Array.from(__classPrivateFieldGet(this, _Browser_contexts, "f").values())];
|
|
113
72
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Returns the default browser context. The default browser context cannot be closed.
|
|
116
|
-
*/
|
|
117
|
-
defaultBrowserContext() {
|
|
118
|
-
return __classPrivateFieldGet(this, _Browser_defaultContext, "f");
|
|
119
|
-
}
|
|
120
|
-
async _disposeContext(contextId) {
|
|
121
|
-
if (!contextId) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
await __classPrivateFieldGet(this, _Browser_connection, "f").send('Target.disposeBrowserContext', {
|
|
125
|
-
browserContextId: contextId,
|
|
126
|
-
});
|
|
127
|
-
__classPrivateFieldGet(this, _Browser_contexts, "f").delete(contextId);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* The browser websocket endpoint which can be used as an argument to
|
|
131
|
-
* {@link Puppeteer.connect}.
|
|
132
|
-
*
|
|
133
|
-
* @returns The Browser websocket url.
|
|
134
|
-
*
|
|
135
|
-
* @remarks
|
|
136
|
-
*
|
|
137
|
-
* The format is `ws://${host}:${port}/devtools/browser/<id>`.
|
|
138
|
-
*
|
|
139
|
-
* You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`.
|
|
140
|
-
* Learn more about the
|
|
141
|
-
* {@link https://chromedevtools.github.io/devtools-protocol | devtools protocol} and
|
|
142
|
-
* the {@link
|
|
143
|
-
* https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target
|
|
144
|
-
* | browser endpoint}.
|
|
145
|
-
*/
|
|
146
|
-
wsEndpoint() {
|
|
147
|
-
return __classPrivateFieldGet(this, _Browser_connection, "f").url();
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Promise which resolves to a new {@link Page} object. The Page is created in
|
|
151
|
-
* a default browser context.
|
|
152
|
-
*/
|
|
153
73
|
newPage() {
|
|
154
74
|
return __classPrivateFieldGet(this, _Browser_defaultContext, "f").newPage();
|
|
155
75
|
}
|
|
@@ -172,41 +92,11 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
172
92
|
}
|
|
173
93
|
return page;
|
|
174
94
|
}
|
|
175
|
-
/**
|
|
176
|
-
* All active targets inside the Browser. In case of multiple browser contexts, returns
|
|
177
|
-
* an array with all the targets in all browser contexts.
|
|
178
|
-
*/
|
|
179
95
|
targets() {
|
|
180
96
|
return Array.from(__classPrivateFieldGet(this, _Browser_targets, "f").values()).filter((target) => {
|
|
181
97
|
return target._isInitialized;
|
|
182
98
|
});
|
|
183
99
|
}
|
|
184
|
-
/**
|
|
185
|
-
* The target associated with the browser.
|
|
186
|
-
*/
|
|
187
|
-
target() {
|
|
188
|
-
const browserTarget = this.targets().find((target) => {
|
|
189
|
-
return target.type() === 'browser';
|
|
190
|
-
});
|
|
191
|
-
if (!browserTarget) {
|
|
192
|
-
throw new Error('Browser target is not found');
|
|
193
|
-
}
|
|
194
|
-
return browserTarget;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Searches for a target in all browser contexts.
|
|
198
|
-
*
|
|
199
|
-
* @param predicate - A function to be run for every target.
|
|
200
|
-
* @returns The first target found that matches the `predicate` function.
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
*
|
|
204
|
-
* An example of finding a target for a page opened via `window.open`:
|
|
205
|
-
* ```js
|
|
206
|
-
* await page.evaluate(() => window.open('https://www.example.com/'));
|
|
207
|
-
* const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/');
|
|
208
|
-
* ```
|
|
209
|
-
*/
|
|
210
100
|
async waitForTarget(predicate, options = {}) {
|
|
211
101
|
const { timeout = 30000 } = options;
|
|
212
102
|
let resolve;
|
|
@@ -234,15 +124,6 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
234
124
|
}
|
|
235
125
|
}
|
|
236
126
|
}
|
|
237
|
-
/**
|
|
238
|
-
* An array of all open pages inside the Browser.
|
|
239
|
-
*
|
|
240
|
-
* @remarks
|
|
241
|
-
*
|
|
242
|
-
* In case of multiple browser contexts, returns an array with all the pages in all
|
|
243
|
-
* browser contexts. Non-visible pages, such as `"background_page"`, will not be listed
|
|
244
|
-
* here. You can find them using {@link Target.page}.
|
|
245
|
-
*/
|
|
246
127
|
async pages() {
|
|
247
128
|
const contextPages = await Promise.all(this.browserContexts().map((context) => {
|
|
248
129
|
return context.pages();
|
|
@@ -252,53 +133,16 @@ class Browser extends EventEmitter_1.EventEmitter {
|
|
|
252
133
|
return acc.concat(x);
|
|
253
134
|
}, []);
|
|
254
135
|
}
|
|
255
|
-
/**
|
|
256
|
-
* A string representing the browser name and version.
|
|
257
|
-
*
|
|
258
|
-
* @remarks
|
|
259
|
-
*
|
|
260
|
-
* For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For
|
|
261
|
-
* non-headless, this is similar to `Chrome/61.0.3153.0`.
|
|
262
|
-
*
|
|
263
|
-
* The format of browser.version() might change with future releases of Chromium.
|
|
264
|
-
*/
|
|
265
|
-
async version() {
|
|
266
|
-
const version = await __classPrivateFieldGet(this, _Browser_instances, "m", _Browser_getVersion).call(this);
|
|
267
|
-
return version.product;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* The browser's original user agent. Pages can override the browser user agent with
|
|
271
|
-
* {@link Page.setUserAgent}.
|
|
272
|
-
*/
|
|
273
|
-
async userAgent() {
|
|
274
|
-
const version = await __classPrivateFieldGet(this, _Browser_instances, "m", _Browser_getVersion).call(this);
|
|
275
|
-
return version.userAgent;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Closes Chromium and all of its pages (if any were opened). The {@link Browser} object
|
|
279
|
-
* itself is considered to be disposed and cannot be used anymore.
|
|
280
|
-
*/
|
|
281
136
|
async close() {
|
|
282
137
|
await __classPrivateFieldGet(this, _Browser_closeCallback, "f").call(null);
|
|
283
138
|
this.disconnect();
|
|
284
139
|
}
|
|
285
|
-
/**
|
|
286
|
-
* Disconnects Puppeteer from the browser, but leaves the Chromium process running.
|
|
287
|
-
* After calling `disconnect`, the {@link Browser} object is considered disposed and
|
|
288
|
-
* cannot be used anymore.
|
|
289
|
-
*/
|
|
290
140
|
disconnect() {
|
|
291
141
|
__classPrivateFieldGet(this, _Browser_connection, "f").dispose();
|
|
292
142
|
}
|
|
293
|
-
/**
|
|
294
|
-
* Indicates that the browser is connected.
|
|
295
|
-
*/
|
|
296
|
-
isConnected() {
|
|
297
|
-
return !__classPrivateFieldGet(this, _Browser_connection, "f")._closed;
|
|
298
|
-
}
|
|
299
143
|
}
|
|
300
144
|
exports.Browser = Browser;
|
|
301
|
-
_Browser_defaultViewport = new WeakMap(),
|
|
145
|
+
_Browser_defaultViewport = new WeakMap(), _Browser_connection = new WeakMap(), _Browser_closeCallback = new WeakMap(), _Browser_defaultContext = new WeakMap(), _Browser_contexts = new WeakMap(), _Browser_targets = new WeakMap(), _Browser_instances = new WeakSet(), _Browser_targetCreated = async function _Browser_targetCreated(event) {
|
|
302
146
|
var _a;
|
|
303
147
|
const { targetInfo } = event;
|
|
304
148
|
const { browserContextId } = targetInfo;
|
|
@@ -335,8 +179,6 @@ _Browser_defaultViewport = new WeakMap(), _Browser_process = new WeakMap(), _Bro
|
|
|
335
179
|
if (wasInitialized && previousURL !== target.url()) {
|
|
336
180
|
this.emit("targetchanged" /* BrowserEmittedEvents.TargetChanged */, target);
|
|
337
181
|
}
|
|
338
|
-
}, _Browser_getVersion = function _Browser_getVersion() {
|
|
339
|
-
return __classPrivateFieldGet(this, _Browser_connection, "f").send('Browser.getVersion');
|
|
340
182
|
};
|
|
341
183
|
class BrowserContext extends EventEmitter_1.EventEmitter {
|
|
342
184
|
constructor(browser, contextId) {
|
|
@@ -364,39 +206,12 @@ class BrowserContext extends EventEmitter_1.EventEmitter {
|
|
|
364
206
|
return Boolean(page);
|
|
365
207
|
});
|
|
366
208
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Returns whether BrowserContext is incognito.
|
|
369
|
-
* The default browser context is the only non-incognito browser context.
|
|
370
|
-
*
|
|
371
|
-
* @remarks
|
|
372
|
-
* The default browser context cannot be closed.
|
|
373
|
-
*/
|
|
374
|
-
isIncognito() {
|
|
375
|
-
return Boolean(__classPrivateFieldGet(this, _BrowserContext_id, "f"));
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Creates a new page in the browser context.
|
|
379
|
-
*/
|
|
380
209
|
newPage() {
|
|
381
210
|
return __classPrivateFieldGet(this, _BrowserContext_browser, "f")._createPageInContext(__classPrivateFieldGet(this, _BrowserContext_id, "f"));
|
|
382
211
|
}
|
|
383
|
-
/**
|
|
384
|
-
* The browser this browser context belongs to.
|
|
385
|
-
*/
|
|
386
212
|
browser() {
|
|
387
213
|
return __classPrivateFieldGet(this, _BrowserContext_browser, "f");
|
|
388
214
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Closes the browser context. All the targets that belong to the browser context
|
|
391
|
-
* will be closed.
|
|
392
|
-
*
|
|
393
|
-
* @remarks
|
|
394
|
-
* Only incognito browser contexts can be closed.
|
|
395
|
-
*/
|
|
396
|
-
async close() {
|
|
397
|
-
(0, assert_1.assert)(__classPrivateFieldGet(this, _BrowserContext_id, "f"), 'Non-incognito profiles cannot be closed!');
|
|
398
|
-
await __classPrivateFieldGet(this, _BrowserContext_browser, "f")._disposeContext(__classPrivateFieldGet(this, _BrowserContext_id, "f"));
|
|
399
|
-
}
|
|
400
215
|
}
|
|
401
216
|
exports.BrowserContext = BrowserContext;
|
|
402
217
|
_BrowserContext_browser = new WeakMap(), _BrowserContext_id = new WeakMap();
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Viewport } from './PuppeteerViewport';
|
|
16
|
+
import type { Viewport } from './PuppeteerViewport';
|
|
17
17
|
export interface BrowserConnectOptions {
|
|
18
18
|
defaultViewport: Viewport;
|
|
19
19
|
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Product } from './Product';
|
|
17
|
-
declare type Platform = 'linux' | '
|
|
16
|
+
import type { Product } from './Product';
|
|
17
|
+
declare type Platform = 'linux' | 'mac' | 'mac_arm' | 'win32' | 'win64';
|
|
18
18
|
export interface BrowserFetcherOptions {
|
|
19
19
|
platform: Platform | null;
|
|
20
20
|
product: Product;
|
|
@@ -53,7 +53,7 @@ export declare class BrowserFetcher {
|
|
|
53
53
|
* @returns A promise that resolves to `true` if the revision could be downloaded
|
|
54
54
|
* from the host.
|
|
55
55
|
*/
|
|
56
|
-
canDownload(): Promise<boolean>;
|
|
56
|
+
canDownload(revision: string): Promise<boolean>;
|
|
57
57
|
/**
|
|
58
58
|
* Initiates a GET request to download the revision from the host.
|
|
59
59
|
* @remarks
|