@remotion/renderer 3.0.19 → 3.0.22
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/get-audio-channels.d.ts +4 -2
- package/dist/assets/get-audio-channels.js +14 -3
- package/dist/browser/Browser.d.ts +209 -0
- package/dist/browser/Browser.js +402 -0
- package/dist/browser/BrowserConnector.d.ts +19 -0
- package/dist/browser/BrowserConnector.js +17 -0
- package/dist/browser/BrowserFetcher.d.ts +89 -0
- package/dist/browser/BrowserFetcher.js +492 -0
- package/dist/browser/BrowserRunner.d.ts +39 -0
- package/dist/browser/BrowserRunner.js +308 -0
- package/dist/browser/Connection.d.ts +49 -0
- package/dist/browser/Connection.js +262 -0
- package/dist/browser/ConnectionTransport.d.ts +21 -0
- package/dist/browser/ConnectionTransport.js +17 -0
- package/dist/browser/ConsoleMessage.d.ts +31 -0
- package/dist/browser/ConsoleMessage.js +48 -0
- package/dist/browser/DOMWorld.d.ts +50 -0
- package/dist/browser/DOMWorld.js +280 -0
- package/dist/browser/EmulationManager.d.ts +7 -0
- package/dist/browser/EmulationManager.js +40 -0
- package/dist/browser/Errors.d.ts +25 -0
- package/dist/browser/Errors.js +35 -0
- package/dist/browser/EvalTypes.d.ts +27 -0
- package/dist/browser/EvalTypes.js +17 -0
- package/dist/browser/EventEmitter.d.ts +70 -0
- package/dist/browser/EventEmitter.js +102 -0
- package/dist/browser/ExecutionContext.d.ts +33 -0
- package/dist/browser/ExecutionContext.js +174 -0
- package/dist/browser/FrameManager.d.ts +96 -0
- package/dist/browser/FrameManager.js +512 -0
- package/dist/browser/HTTPRequest.d.ts +28 -0
- package/dist/browser/HTTPRequest.js +37 -0
- package/dist/browser/HTTPResponse.d.ts +22 -0
- package/dist/browser/HTTPResponse.js +33 -0
- package/dist/browser/JSHandle.d.ts +36 -0
- package/dist/browser/JSHandle.js +93 -0
- package/dist/browser/LaunchOptions.d.ts +117 -0
- package/dist/browser/LaunchOptions.js +17 -0
- package/dist/browser/Launcher.d.ts +9 -0
- package/dist/browser/Launcher.js +602 -0
- package/dist/browser/LifecycleWatcher.d.ts +29 -0
- package/dist/browser/LifecycleWatcher.js +193 -0
- package/dist/browser/NetworkEventManager.d.ts +35 -0
- package/dist/browser/NetworkEventManager.js +128 -0
- package/dist/browser/NetworkManager.d.ts +36 -0
- package/dist/browser/NetworkManager.js +280 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +17 -0
- package/dist/browser/NodeWebSocketTransport.js +90 -0
- package/dist/browser/Page.d.ts +74 -0
- package/dist/browser/Page.js +282 -0
- package/dist/browser/Product.d.ts +16 -0
- package/dist/browser/Product.js +17 -0
- package/dist/browser/PuppeteerNode.d.ts +89 -0
- package/dist/browser/PuppeteerNode.js +135 -0
- package/dist/browser/PuppeteerViewport.d.ts +5 -0
- package/dist/browser/PuppeteerViewport.js +2 -0
- package/dist/browser/ScreenshotOptions.d.ts +14 -0
- package/dist/browser/ScreenshotOptions.js +2 -0
- package/dist/browser/Target.d.ts +61 -0
- package/dist/browser/Target.js +146 -0
- package/dist/browser/TaskQueue.d.ts +20 -0
- package/dist/browser/TaskQueue.js +47 -0
- package/dist/browser/TimeoutSettings.d.ts +23 -0
- package/dist/browser/TimeoutSettings.js +62 -0
- package/dist/browser/assert.d.ts +21 -0
- package/dist/browser/assert.js +29 -0
- package/dist/browser/compat.d.ts +2 -0
- package/dist/browser/compat.js +17 -0
- package/dist/browser/create-browser-fetcher.d.ts +17 -0
- package/dist/browser/create-browser-fetcher.js +127 -0
- package/dist/browser/environment.d.ts +16 -0
- package/dist/browser/environment.js +19 -0
- package/dist/browser/get-download-destination.d.ts +1 -0
- package/dist/browser/get-download-destination.js +38 -0
- package/dist/browser/mitt/index.d.ts +22 -0
- package/dist/browser/mitt/index.js +49 -0
- package/dist/browser/node.d.ts +2 -0
- package/dist/browser/node.js +9 -0
- package/dist/browser/revisions.d.ts +21 -0
- package/dist/browser/revisions.js +22 -0
- package/dist/browser/util.d.ts +46 -0
- package/dist/browser/util.js +161 -0
- package/dist/ensure-presentation-timestamp.d.ts +1 -0
- package/dist/ensure-presentation-timestamp.js +57 -0
- package/dist/extract-frame-from-video.d.ts +4 -5
- package/dist/extract-frame-from-video.js +58 -27
- package/dist/index.d.ts +24 -0
- package/dist/index.js +11 -0
- package/dist/is-vp9-video.d.ts +3 -0
- package/dist/is-vp9-video.js +24 -0
- package/dist/last-frame-from-video-cache.d.ts +4 -3
- package/dist/last-frame-from-video-cache.js +9 -6
- package/dist/offthread-video-server.d.ts +2 -1
- package/dist/offthread-video-server.js +14 -3
- package/dist/open-browser.js +1 -2
- package/dist/prepare-server.js +11 -0
- package/dist/serve-handler/index.js +1 -8
- package/dist/should-use-vp9-decoder.d.ts +0 -0
- package/dist/should-use-vp9-decoder.js +1 -0
- package/dist/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/validate-offthreadvideo-image-format.js +15 -0
- package/package.json +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
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 { JSHandle } from './JSHandle';
|
|
17
|
+
export interface ConsoleMessageLocation {
|
|
18
|
+
url?: string;
|
|
19
|
+
lineNumber?: number;
|
|
20
|
+
columnNumber?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare type ConsoleMessageType = 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd' | 'verbose';
|
|
23
|
+
export declare class ConsoleMessage {
|
|
24
|
+
#private;
|
|
25
|
+
type: ConsoleMessageType;
|
|
26
|
+
text: string;
|
|
27
|
+
args: JSHandle[];
|
|
28
|
+
constructor(type: ConsoleMessageType, text: string, args: JSHandle[], stackTraceLocations: ConsoleMessageLocation[]);
|
|
29
|
+
location(): ConsoleMessageLocation;
|
|
30
|
+
stackTrace(): ConsoleMessageLocation[];
|
|
31
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
18
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
19
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
20
|
+
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");
|
|
21
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
22
|
+
};
|
|
23
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
24
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
|
+
};
|
|
28
|
+
var _ConsoleMessage_stackTraceLocations;
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.ConsoleMessage = void 0;
|
|
31
|
+
class ConsoleMessage {
|
|
32
|
+
constructor(type, text, args, stackTraceLocations) {
|
|
33
|
+
_ConsoleMessage_stackTraceLocations.set(this, void 0);
|
|
34
|
+
this.type = type;
|
|
35
|
+
this.text = text;
|
|
36
|
+
this.args = args;
|
|
37
|
+
__classPrivateFieldSet(this, _ConsoleMessage_stackTraceLocations, stackTraceLocations, "f");
|
|
38
|
+
}
|
|
39
|
+
location() {
|
|
40
|
+
var _a;
|
|
41
|
+
return (_a = __classPrivateFieldGet(this, _ConsoleMessage_stackTraceLocations, "f")[0]) !== null && _a !== void 0 ? _a : {};
|
|
42
|
+
}
|
|
43
|
+
stackTrace() {
|
|
44
|
+
return __classPrivateFieldGet(this, _ConsoleMessage_stackTraceLocations, "f");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ConsoleMessage = ConsoleMessage;
|
|
48
|
+
_ConsoleMessage_stackTraceLocations = new WeakMap();
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2019 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 { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike } from './EvalTypes';
|
|
17
|
+
import { ExecutionContext } from './ExecutionContext';
|
|
18
|
+
import { Frame } from './FrameManager';
|
|
19
|
+
import { ElementHandle, JSHandle } from './JSHandle';
|
|
20
|
+
import { TimeoutSettings } from './TimeoutSettings';
|
|
21
|
+
export declare class DOMWorld {
|
|
22
|
+
#private;
|
|
23
|
+
get _waitTasks(): Set<WaitTask>;
|
|
24
|
+
constructor(frame: Frame, timeoutSettings: TimeoutSettings);
|
|
25
|
+
frame(): Frame;
|
|
26
|
+
_setContext(context: ExecutionContext | null): void;
|
|
27
|
+
_hasContext(): boolean;
|
|
28
|
+
_detach(): void;
|
|
29
|
+
executionContext(): Promise<ExecutionContext>;
|
|
30
|
+
evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>;
|
|
31
|
+
evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
|
|
32
|
+
_document(): Promise<ElementHandle>;
|
|
33
|
+
waitForFunction(pageFunction: Function | string, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
|
|
34
|
+
title(): Promise<string>;
|
|
35
|
+
}
|
|
36
|
+
interface WaitTaskOptions {
|
|
37
|
+
domWorld: DOMWorld;
|
|
38
|
+
predicateBody: Function | string;
|
|
39
|
+
title: string;
|
|
40
|
+
timeout: number;
|
|
41
|
+
args: SerializableOrJSHandle[];
|
|
42
|
+
}
|
|
43
|
+
declare class WaitTask {
|
|
44
|
+
#private;
|
|
45
|
+
promise: Promise<JSHandle>;
|
|
46
|
+
constructor(options: WaitTaskOptions);
|
|
47
|
+
terminate(error: Error): void;
|
|
48
|
+
rerun(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2019 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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
18
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
19
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
20
|
+
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");
|
|
21
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
22
|
+
};
|
|
23
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
24
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
|
+
};
|
|
28
|
+
var _DOMWorld_frame, _DOMWorld_timeoutSettings, _DOMWorld_documentPromise, _DOMWorld_contextPromise, _DOMWorld_contextResolveCallback, _DOMWorld_detached, _DOMWorld_waitTasks, _WaitTask_instances, _WaitTask_domWorld, _WaitTask_timeout, _WaitTask_predicateBody, _WaitTask_args, _WaitTask_runCount, _WaitTask_resolve, _WaitTask_reject, _WaitTask_timeoutTimer, _WaitTask_terminated, _WaitTask_cleanup;
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.DOMWorld = void 0;
|
|
31
|
+
const assert_1 = require("./assert");
|
|
32
|
+
const Errors_1 = require("./Errors");
|
|
33
|
+
const util_1 = require("./util");
|
|
34
|
+
class DOMWorld {
|
|
35
|
+
constructor(frame, timeoutSettings) {
|
|
36
|
+
_DOMWorld_frame.set(this, void 0);
|
|
37
|
+
_DOMWorld_timeoutSettings.set(this, void 0);
|
|
38
|
+
_DOMWorld_documentPromise.set(this, null);
|
|
39
|
+
_DOMWorld_contextPromise.set(this, null);
|
|
40
|
+
_DOMWorld_contextResolveCallback.set(this, null);
|
|
41
|
+
_DOMWorld_detached.set(this, false);
|
|
42
|
+
_DOMWorld_waitTasks.set(this, new Set());
|
|
43
|
+
// Keep own reference to client because it might differ from the FrameManager's
|
|
44
|
+
// client for OOP iframes.
|
|
45
|
+
__classPrivateFieldSet(this, _DOMWorld_frame, frame, "f");
|
|
46
|
+
__classPrivateFieldSet(this, _DOMWorld_timeoutSettings, timeoutSettings, "f");
|
|
47
|
+
this._setContext(null);
|
|
48
|
+
}
|
|
49
|
+
get _waitTasks() {
|
|
50
|
+
return __classPrivateFieldGet(this, _DOMWorld_waitTasks, "f");
|
|
51
|
+
}
|
|
52
|
+
frame() {
|
|
53
|
+
return __classPrivateFieldGet(this, _DOMWorld_frame, "f");
|
|
54
|
+
}
|
|
55
|
+
_setContext(context) {
|
|
56
|
+
var _a;
|
|
57
|
+
if (context) {
|
|
58
|
+
(0, assert_1.assert)(__classPrivateFieldGet(this, _DOMWorld_contextResolveCallback, "f"), 'Execution Context has already been set.');
|
|
59
|
+
(_a = __classPrivateFieldGet(this, _DOMWorld_contextResolveCallback, "f")) === null || _a === void 0 ? void 0 : _a.call(null, context);
|
|
60
|
+
__classPrivateFieldSet(this, _DOMWorld_contextResolveCallback, null, "f");
|
|
61
|
+
for (const waitTask of this._waitTasks) {
|
|
62
|
+
waitTask.rerun();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
__classPrivateFieldSet(this, _DOMWorld_documentPromise, null, "f");
|
|
67
|
+
__classPrivateFieldSet(this, _DOMWorld_contextPromise, new Promise((fulfill) => {
|
|
68
|
+
__classPrivateFieldSet(this, _DOMWorld_contextResolveCallback, fulfill, "f");
|
|
69
|
+
}), "f");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
_hasContext() {
|
|
73
|
+
return !__classPrivateFieldGet(this, _DOMWorld_contextResolveCallback, "f");
|
|
74
|
+
}
|
|
75
|
+
_detach() {
|
|
76
|
+
__classPrivateFieldSet(this, _DOMWorld_detached, true, "f");
|
|
77
|
+
for (const waitTask of this._waitTasks) {
|
|
78
|
+
waitTask.terminate(new Error('waitForFunction failed: frame got detached.'));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
executionContext() {
|
|
82
|
+
if (__classPrivateFieldGet(this, _DOMWorld_detached, "f")) {
|
|
83
|
+
throw new Error(`Execution context is not available in detached frame "${__classPrivateFieldGet(this, _DOMWorld_frame, "f").url()}" (are you trying to evaluate?)`);
|
|
84
|
+
}
|
|
85
|
+
if (__classPrivateFieldGet(this, _DOMWorld_contextPromise, "f") === null) {
|
|
86
|
+
throw new Error(`Execution content promise is missing`);
|
|
87
|
+
}
|
|
88
|
+
return __classPrivateFieldGet(this, _DOMWorld_contextPromise, "f");
|
|
89
|
+
}
|
|
90
|
+
async evaluateHandle(pageFunction, ...args) {
|
|
91
|
+
const context = await this.executionContext();
|
|
92
|
+
return context.evaluateHandle(pageFunction, ...args);
|
|
93
|
+
}
|
|
94
|
+
async evaluate(pageFunction, ...args) {
|
|
95
|
+
const context = await this.executionContext();
|
|
96
|
+
return context.evaluate(pageFunction, ...args);
|
|
97
|
+
}
|
|
98
|
+
_document() {
|
|
99
|
+
if (__classPrivateFieldGet(this, _DOMWorld_documentPromise, "f")) {
|
|
100
|
+
return __classPrivateFieldGet(this, _DOMWorld_documentPromise, "f");
|
|
101
|
+
}
|
|
102
|
+
__classPrivateFieldSet(this, _DOMWorld_documentPromise, this.executionContext().then(async (context) => {
|
|
103
|
+
const document = await context.evaluateHandle('document');
|
|
104
|
+
const element = document.asElement();
|
|
105
|
+
if (element === null) {
|
|
106
|
+
throw new Error('Document is null');
|
|
107
|
+
}
|
|
108
|
+
return element;
|
|
109
|
+
}), "f");
|
|
110
|
+
return __classPrivateFieldGet(this, _DOMWorld_documentPromise, "f");
|
|
111
|
+
}
|
|
112
|
+
waitForFunction(pageFunction, ...args) {
|
|
113
|
+
const timeout = __classPrivateFieldGet(this, _DOMWorld_timeoutSettings, "f").timeout();
|
|
114
|
+
const waitTaskOptions = {
|
|
115
|
+
domWorld: this,
|
|
116
|
+
predicateBody: pageFunction,
|
|
117
|
+
title: 'function',
|
|
118
|
+
timeout,
|
|
119
|
+
args,
|
|
120
|
+
};
|
|
121
|
+
const waitTask = new WaitTask(waitTaskOptions);
|
|
122
|
+
return waitTask.promise;
|
|
123
|
+
}
|
|
124
|
+
title() {
|
|
125
|
+
return this.evaluate(() => {
|
|
126
|
+
return document.title;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.DOMWorld = DOMWorld;
|
|
131
|
+
_DOMWorld_frame = new WeakMap(), _DOMWorld_timeoutSettings = new WeakMap(), _DOMWorld_documentPromise = new WeakMap(), _DOMWorld_contextPromise = new WeakMap(), _DOMWorld_contextResolveCallback = new WeakMap(), _DOMWorld_detached = new WeakMap(), _DOMWorld_waitTasks = new WeakMap();
|
|
132
|
+
const noop = () => undefined;
|
|
133
|
+
class WaitTask {
|
|
134
|
+
constructor(options) {
|
|
135
|
+
_WaitTask_instances.add(this);
|
|
136
|
+
_WaitTask_domWorld.set(this, void 0);
|
|
137
|
+
_WaitTask_timeout.set(this, void 0);
|
|
138
|
+
_WaitTask_predicateBody.set(this, void 0);
|
|
139
|
+
_WaitTask_args.set(this, void 0);
|
|
140
|
+
_WaitTask_runCount.set(this, 0);
|
|
141
|
+
_WaitTask_resolve.set(this, noop);
|
|
142
|
+
_WaitTask_reject.set(this, noop);
|
|
143
|
+
_WaitTask_timeoutTimer.set(this, void 0);
|
|
144
|
+
_WaitTask_terminated.set(this, false);
|
|
145
|
+
function getPredicateBody(predicateBody) {
|
|
146
|
+
if ((0, util_1.isString)(predicateBody)) {
|
|
147
|
+
return `return (${predicateBody});`;
|
|
148
|
+
}
|
|
149
|
+
return `return (${predicateBody})(...args);`;
|
|
150
|
+
}
|
|
151
|
+
__classPrivateFieldSet(this, _WaitTask_domWorld, options.domWorld, "f");
|
|
152
|
+
__classPrivateFieldSet(this, _WaitTask_timeout, options.timeout, "f");
|
|
153
|
+
__classPrivateFieldSet(this, _WaitTask_predicateBody, getPredicateBody(options.predicateBody), "f");
|
|
154
|
+
__classPrivateFieldSet(this, _WaitTask_args, options.args, "f");
|
|
155
|
+
__classPrivateFieldSet(this, _WaitTask_runCount, 0, "f");
|
|
156
|
+
__classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.add(this);
|
|
157
|
+
this.promise = new Promise((resolve, reject) => {
|
|
158
|
+
__classPrivateFieldSet(this, _WaitTask_resolve, resolve, "f");
|
|
159
|
+
__classPrivateFieldSet(this, _WaitTask_reject, reject, "f");
|
|
160
|
+
});
|
|
161
|
+
// Since page navigation requires us to re-install the pageScript, we should track
|
|
162
|
+
// timeout on our end.
|
|
163
|
+
if (options.timeout) {
|
|
164
|
+
const timeoutError = new Errors_1.TimeoutError(`waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded`);
|
|
165
|
+
__classPrivateFieldSet(this, _WaitTask_timeoutTimer, setTimeout(() => {
|
|
166
|
+
return this.terminate(timeoutError);
|
|
167
|
+
}, options.timeout), "f");
|
|
168
|
+
}
|
|
169
|
+
this.rerun();
|
|
170
|
+
}
|
|
171
|
+
terminate(error) {
|
|
172
|
+
__classPrivateFieldSet(this, _WaitTask_terminated, true, "f");
|
|
173
|
+
__classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, error);
|
|
174
|
+
__classPrivateFieldGet(this, _WaitTask_instances, "m", _WaitTask_cleanup).call(this);
|
|
175
|
+
}
|
|
176
|
+
async rerun() {
|
|
177
|
+
var _a;
|
|
178
|
+
const runCount = __classPrivateFieldSet(this, _WaitTask_runCount, (_a = __classPrivateFieldGet(this, _WaitTask_runCount, "f"), ++_a), "f");
|
|
179
|
+
let success = null;
|
|
180
|
+
let error = null;
|
|
181
|
+
const context = await __classPrivateFieldGet(this, _WaitTask_domWorld, "f").executionContext();
|
|
182
|
+
if (__classPrivateFieldGet(this, _WaitTask_terminated, "f") || runCount !== __classPrivateFieldGet(this, _WaitTask_runCount, "f")) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (__classPrivateFieldGet(this, _WaitTask_terminated, "f") || runCount !== __classPrivateFieldGet(this, _WaitTask_runCount, "f")) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
success = await context.evaluateHandle(waitForPredicatePageFunction, __classPrivateFieldGet(this, _WaitTask_predicateBody, "f"), __classPrivateFieldGet(this, _WaitTask_timeout, "f"), ...__classPrivateFieldGet(this, _WaitTask_args, "f"));
|
|
190
|
+
}
|
|
191
|
+
catch (error_) {
|
|
192
|
+
error = error_;
|
|
193
|
+
}
|
|
194
|
+
if (__classPrivateFieldGet(this, _WaitTask_terminated, "f") || runCount !== __classPrivateFieldGet(this, _WaitTask_runCount, "f")) {
|
|
195
|
+
if (success) {
|
|
196
|
+
await success.dispose();
|
|
197
|
+
}
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// Ignore timeouts in pageScript - we track timeouts ourselves.
|
|
201
|
+
// If the frame's execution context has already changed, `frame.evaluate` will
|
|
202
|
+
// throw an error - ignore this predicate run altogether.
|
|
203
|
+
if (!error &&
|
|
204
|
+
(await __classPrivateFieldGet(this, _WaitTask_domWorld, "f")
|
|
205
|
+
.evaluate((s) => {
|
|
206
|
+
return !s;
|
|
207
|
+
}, success)
|
|
208
|
+
.catch(() => {
|
|
209
|
+
return true;
|
|
210
|
+
}))) {
|
|
211
|
+
if (!success) {
|
|
212
|
+
throw new Error('Assertion: result handle is not available');
|
|
213
|
+
}
|
|
214
|
+
await success.dispose();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (error) {
|
|
218
|
+
if (error.message.includes('TypeError: binding is not a function')) {
|
|
219
|
+
return this.rerun();
|
|
220
|
+
}
|
|
221
|
+
// When frame is detached the task should have been terminated by the DOMWorld.
|
|
222
|
+
// This can fail if we were adding this task while the frame was detached,
|
|
223
|
+
// so we terminate here instead.
|
|
224
|
+
if (error.message.includes('Execution context is not available in detached frame')) {
|
|
225
|
+
this.terminate(new Error('waitForFunction failed: frame got detached.'));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
// When the page is navigated, the promise is rejected.
|
|
229
|
+
// We will try again in the new execution context.
|
|
230
|
+
if (error.message.includes('Execution context was destroyed')) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
// We could have tried to evaluate in a context which was already
|
|
234
|
+
// destroyed.
|
|
235
|
+
if (error.message.includes('Cannot find context with specified id')) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
__classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, error);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
if (!success) {
|
|
242
|
+
throw new Error('Assertion: result handle is not available');
|
|
243
|
+
}
|
|
244
|
+
__classPrivateFieldGet(this, _WaitTask_resolve, "f").call(this, success);
|
|
245
|
+
}
|
|
246
|
+
__classPrivateFieldGet(this, _WaitTask_instances, "m", _WaitTask_cleanup).call(this);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
_WaitTask_domWorld = new WeakMap(), _WaitTask_timeout = new WeakMap(), _WaitTask_predicateBody = new WeakMap(), _WaitTask_args = new WeakMap(), _WaitTask_runCount = new WeakMap(), _WaitTask_resolve = new WeakMap(), _WaitTask_reject = new WeakMap(), _WaitTask_timeoutTimer = new WeakMap(), _WaitTask_terminated = new WeakMap(), _WaitTask_instances = new WeakSet(), _WaitTask_cleanup = function _WaitTask_cleanup() {
|
|
250
|
+
if (__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f") !== undefined) {
|
|
251
|
+
clearTimeout(__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f"));
|
|
252
|
+
}
|
|
253
|
+
__classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.delete(this);
|
|
254
|
+
};
|
|
255
|
+
function waitForPredicatePageFunction(predicateBody, timeout, ...args) {
|
|
256
|
+
// eslint-disable-next-line no-new-func
|
|
257
|
+
const predicate = new Function('...args', predicateBody);
|
|
258
|
+
let timedOut = false;
|
|
259
|
+
if (timeout) {
|
|
260
|
+
setTimeout(() => {
|
|
261
|
+
timedOut = true;
|
|
262
|
+
}, timeout);
|
|
263
|
+
}
|
|
264
|
+
return new Promise((resolve) => {
|
|
265
|
+
async function onRaf() {
|
|
266
|
+
if (timedOut) {
|
|
267
|
+
resolve(undefined);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const success = await predicate(...args);
|
|
271
|
+
if (success) {
|
|
272
|
+
resolve(success);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
requestAnimationFrame(onRaf);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
onRaf();
|
|
279
|
+
});
|
|
280
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
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");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
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");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _EmulationManager_client;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EmulationManager = void 0;
|
|
16
|
+
class EmulationManager {
|
|
17
|
+
constructor(client) {
|
|
18
|
+
_EmulationManager_client.set(this, void 0);
|
|
19
|
+
__classPrivateFieldSet(this, _EmulationManager_client, client, "f");
|
|
20
|
+
}
|
|
21
|
+
async emulateViewport(viewport) {
|
|
22
|
+
const { height, width } = viewport;
|
|
23
|
+
const { deviceScaleFactor } = viewport;
|
|
24
|
+
const screenOrientation = {
|
|
25
|
+
angle: 0,
|
|
26
|
+
type: 'portraitPrimary',
|
|
27
|
+
};
|
|
28
|
+
await Promise.all([
|
|
29
|
+
__classPrivateFieldGet(this, _EmulationManager_client, "f").send('Emulation.setDeviceMetricsOverride', {
|
|
30
|
+
mobile: false,
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
deviceScaleFactor,
|
|
34
|
+
screenOrientation,
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.EmulationManager = EmulationManager;
|
|
40
|
+
_EmulationManager_client = new WeakMap();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018 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
|
+
declare class CustomError extends Error {
|
|
17
|
+
constructor(message?: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class TimeoutError extends CustomError {
|
|
20
|
+
}
|
|
21
|
+
export declare class ProtocolError extends CustomError {
|
|
22
|
+
code?: number;
|
|
23
|
+
originalMessage: string;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2018 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 });
|
|
18
|
+
exports.ProtocolError = exports.TimeoutError = void 0;
|
|
19
|
+
class CustomError extends Error {
|
|
20
|
+
constructor(message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = this.constructor.name;
|
|
23
|
+
Error.captureStackTrace(this, this.constructor);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class TimeoutError extends CustomError {
|
|
27
|
+
}
|
|
28
|
+
exports.TimeoutError = TimeoutError;
|
|
29
|
+
class ProtocolError extends CustomError {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.originalMessage = '';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ProtocolError = ProtocolError;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { JSHandle } from './JSHandle';
|
|
17
|
+
export declare type EvaluateFn<T = any, U = any, V = any> = string | ((arg1: T, ...args: U[]) => V);
|
|
18
|
+
export declare type UnwrapPromiseLike<T> = T extends PromiseLike<infer U> ? U : T;
|
|
19
|
+
export declare type EvaluateFnReturnType<T extends EvaluateFn> = T extends (...args: any[]) => infer R ? R : any;
|
|
20
|
+
export declare type EvaluateHandleFn = string | ((...args: any[]) => any);
|
|
21
|
+
declare type Serializable = number | string | boolean | null | bigint | JSONArray | JSONObject;
|
|
22
|
+
declare type JSONArray = readonly Serializable[];
|
|
23
|
+
interface JSONObject {
|
|
24
|
+
[key: string]: Serializable;
|
|
25
|
+
}
|
|
26
|
+
export declare type SerializableOrJSHandle = Serializable | JSHandle;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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 });
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { EventType, Handler } from './mitt';
|
|
2
|
+
export interface CommonEventEmitter {
|
|
3
|
+
on(event: EventType, handler: Handler): CommonEventEmitter;
|
|
4
|
+
off(event: EventType, handler: Handler): CommonEventEmitter;
|
|
5
|
+
addListener(event: EventType, handler: Handler): CommonEventEmitter;
|
|
6
|
+
removeListener(event: EventType, handler: Handler): CommonEventEmitter;
|
|
7
|
+
emit(event: EventType, eventData?: unknown): boolean;
|
|
8
|
+
once(event: EventType, handler: Handler): CommonEventEmitter;
|
|
9
|
+
listenerCount(event: string): number;
|
|
10
|
+
removeAllListeners(event?: EventType): CommonEventEmitter;
|
|
11
|
+
}
|
|
12
|
+
export declare class EventEmitter implements CommonEventEmitter {
|
|
13
|
+
private emitter;
|
|
14
|
+
private eventsMap;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Bind an event listener to fire when an event occurs.
|
|
18
|
+
* @param event - the event type you'd like to listen to. Can be a string or symbol.
|
|
19
|
+
* @param handler - the function to be called when the event occurs.
|
|
20
|
+
* @returns `this` to enable you to chain method calls.
|
|
21
|
+
*/
|
|
22
|
+
on(event: EventType, handler: Handler): EventEmitter;
|
|
23
|
+
/**
|
|
24
|
+
* Remove an event listener from firing.
|
|
25
|
+
* @param event - the event type you'd like to stop listening to.
|
|
26
|
+
* @param handler - the function that should be removed.
|
|
27
|
+
* @returns `this` to enable you to chain method calls.
|
|
28
|
+
*/
|
|
29
|
+
off(event: EventType, handler: Handler): EventEmitter;
|
|
30
|
+
/**
|
|
31
|
+
* Remove an event listener.
|
|
32
|
+
* @deprecated please use {@link EventEmitter.off} instead.
|
|
33
|
+
*/
|
|
34
|
+
removeListener(event: EventType, handler: Handler): EventEmitter;
|
|
35
|
+
/**
|
|
36
|
+
* Add an event listener.
|
|
37
|
+
* @deprecated please use {@link EventEmitter.on} instead.
|
|
38
|
+
*/
|
|
39
|
+
addListener(event: EventType, handler: Handler): EventEmitter;
|
|
40
|
+
/**
|
|
41
|
+
* Emit an event and call any associated listeners.
|
|
42
|
+
*
|
|
43
|
+
* @param event - the event you'd like to emit
|
|
44
|
+
* @param eventData - any data you'd like to emit with the event
|
|
45
|
+
* @returns `true` if there are any listeners, `false` if there are not.
|
|
46
|
+
*/
|
|
47
|
+
emit(event: EventType, eventData?: unknown): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Like `on` but the listener will only be fired once and then it will be removed.
|
|
50
|
+
* @param event - the event you'd like to listen to
|
|
51
|
+
* @param handler - the handler function to run when the event occurs
|
|
52
|
+
* @returns `this` to enable you to chain method calls.
|
|
53
|
+
*/
|
|
54
|
+
once(event: EventType, handler: Handler): EventEmitter;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the number of listeners for a given event.
|
|
57
|
+
*
|
|
58
|
+
* @param event - the event to get the listener count for
|
|
59
|
+
* @returns the number of listeners bound to the given event
|
|
60
|
+
*/
|
|
61
|
+
listenerCount(event: EventType): number;
|
|
62
|
+
/**
|
|
63
|
+
* Removes all listeners. If given an event argument, it will remove only
|
|
64
|
+
* listeners for that event.
|
|
65
|
+
* @param event - the event to remove listeners for.
|
|
66
|
+
* @returns `this` to enable you to chain method calls.
|
|
67
|
+
*/
|
|
68
|
+
removeAllListeners(event?: EventType): EventEmitter;
|
|
69
|
+
private eventListenersCount;
|
|
70
|
+
}
|