@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,146 @@
|
|
|
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 _Target_browserContext, _Target_targetInfo, _Target_sessionFactory, _Target_defaultViewport, _Target_pagePromise;
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.Target = void 0;
|
|
31
|
+
const Page_1 = require("./Page");
|
|
32
|
+
const isPagetTarget = (target) => {
|
|
33
|
+
return (target.type === 'page' ||
|
|
34
|
+
target.type === 'background_page' ||
|
|
35
|
+
target.type === 'webview');
|
|
36
|
+
};
|
|
37
|
+
class Target {
|
|
38
|
+
constructor(targetInfo, browserContext, sessionFactory, defaultViewport) {
|
|
39
|
+
_Target_browserContext.set(this, void 0);
|
|
40
|
+
_Target_targetInfo.set(this, void 0);
|
|
41
|
+
_Target_sessionFactory.set(this, void 0);
|
|
42
|
+
_Target_defaultViewport.set(this, void 0);
|
|
43
|
+
_Target_pagePromise.set(this, void 0);
|
|
44
|
+
__classPrivateFieldSet(this, _Target_targetInfo, targetInfo, "f");
|
|
45
|
+
__classPrivateFieldSet(this, _Target_browserContext, browserContext, "f");
|
|
46
|
+
this._targetId = targetInfo.targetId;
|
|
47
|
+
__classPrivateFieldSet(this, _Target_sessionFactory, sessionFactory, "f");
|
|
48
|
+
__classPrivateFieldSet(this, _Target_defaultViewport, defaultViewport, "f");
|
|
49
|
+
this._initializedPromise = new Promise((fulfill) => {
|
|
50
|
+
this._initializedCallback = fulfill;
|
|
51
|
+
}).then((success) => {
|
|
52
|
+
if (!success) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const opener = this.opener();
|
|
56
|
+
if (!opener || !__classPrivateFieldGet(opener, _Target_pagePromise, "f") || this.type() !== 'page') {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
this._isClosedPromise = new Promise((fulfill) => {
|
|
62
|
+
this._closedCallback = fulfill;
|
|
63
|
+
});
|
|
64
|
+
this._isInitialized =
|
|
65
|
+
!isPagetTarget(__classPrivateFieldGet(this, _Target_targetInfo, "f")) || __classPrivateFieldGet(this, _Target_targetInfo, "f").url !== '';
|
|
66
|
+
if (this._isInitialized) {
|
|
67
|
+
this._initializedCallback(true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Creates a Chrome Devtools Protocol session attached to the target.
|
|
72
|
+
*/
|
|
73
|
+
createCDPSession() {
|
|
74
|
+
return __classPrivateFieldGet(this, _Target_sessionFactory, "f").call(this);
|
|
75
|
+
}
|
|
76
|
+
_getTargetInfo() {
|
|
77
|
+
return __classPrivateFieldGet(this, _Target_targetInfo, "f");
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* If the target is not of type `"page"` or `"background_page"`, returns `null`.
|
|
81
|
+
*/
|
|
82
|
+
async page() {
|
|
83
|
+
var _a;
|
|
84
|
+
if (isPagetTarget(__classPrivateFieldGet(this, _Target_targetInfo, "f")) && !__classPrivateFieldGet(this, _Target_pagePromise, "f")) {
|
|
85
|
+
__classPrivateFieldSet(this, _Target_pagePromise, __classPrivateFieldGet(this, _Target_sessionFactory, "f").call(this).then((client) => {
|
|
86
|
+
var _a;
|
|
87
|
+
return Page_1.Page._create(client, this, (_a = __classPrivateFieldGet(this, _Target_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null);
|
|
88
|
+
}), "f");
|
|
89
|
+
}
|
|
90
|
+
return (_a = (await __classPrivateFieldGet(this, _Target_pagePromise, "f"))) !== null && _a !== void 0 ? _a : null;
|
|
91
|
+
}
|
|
92
|
+
url() {
|
|
93
|
+
return __classPrivateFieldGet(this, _Target_targetInfo, "f").url;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Identifies what kind of target this is.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
*
|
|
100
|
+
* See {@link https://developer.chrome.com/extensions/background_pages | docs} for more info about background pages.
|
|
101
|
+
*/
|
|
102
|
+
type() {
|
|
103
|
+
const { type } = __classPrivateFieldGet(this, _Target_targetInfo, "f");
|
|
104
|
+
if (type === 'page' ||
|
|
105
|
+
type === 'background_page' ||
|
|
106
|
+
type === 'service_worker' ||
|
|
107
|
+
type === 'shared_worker' ||
|
|
108
|
+
type === 'browser' ||
|
|
109
|
+
type === 'webview') {
|
|
110
|
+
return type;
|
|
111
|
+
}
|
|
112
|
+
return 'other';
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the browser the target belongs to.
|
|
116
|
+
*/
|
|
117
|
+
browser() {
|
|
118
|
+
return __classPrivateFieldGet(this, _Target_browserContext, "f").browser();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get the browser context the target belongs to.
|
|
122
|
+
*/
|
|
123
|
+
browserContext() {
|
|
124
|
+
return __classPrivateFieldGet(this, _Target_browserContext, "f");
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get the target that opened this target. Top-level targets return `null`.
|
|
128
|
+
*/
|
|
129
|
+
opener() {
|
|
130
|
+
const { openerId } = __classPrivateFieldGet(this, _Target_targetInfo, "f");
|
|
131
|
+
if (!openerId) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
return this.browser()._targets.get(openerId);
|
|
135
|
+
}
|
|
136
|
+
_targetInfoChanged(targetInfo) {
|
|
137
|
+
__classPrivateFieldSet(this, _Target_targetInfo, targetInfo, "f");
|
|
138
|
+
if (!this._isInitialized &&
|
|
139
|
+
(!isPagetTarget(__classPrivateFieldGet(this, _Target_targetInfo, "f")) || __classPrivateFieldGet(this, _Target_targetInfo, "f").url !== '')) {
|
|
140
|
+
this._isInitialized = true;
|
|
141
|
+
this._initializedCallback(true);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.Target = Target;
|
|
146
|
+
_Target_browserContext = new WeakMap(), _Target_targetInfo = new WeakMap(), _Target_sessionFactory = new WeakMap(), _Target_defaultViewport = new WeakMap(), _Target_pagePromise = new WeakMap();
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export declare class TaskQueue {
|
|
17
|
+
#private;
|
|
18
|
+
constructor();
|
|
19
|
+
postTask<T>(task: () => Promise<T>): Promise<T>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 _TaskQueue_chain;
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.TaskQueue = void 0;
|
|
31
|
+
class TaskQueue {
|
|
32
|
+
constructor() {
|
|
33
|
+
_TaskQueue_chain.set(this, void 0);
|
|
34
|
+
__classPrivateFieldSet(this, _TaskQueue_chain, Promise.resolve(), "f");
|
|
35
|
+
}
|
|
36
|
+
postTask(task) {
|
|
37
|
+
const result = __classPrivateFieldGet(this, _TaskQueue_chain, "f").then(task);
|
|
38
|
+
__classPrivateFieldSet(this, _TaskQueue_chain, result.then(() => {
|
|
39
|
+
return undefined;
|
|
40
|
+
}, () => {
|
|
41
|
+
return undefined;
|
|
42
|
+
}), "f");
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.TaskQueue = TaskQueue;
|
|
47
|
+
_TaskQueue_chain = new WeakMap();
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export declare class TimeoutSettings {
|
|
17
|
+
#private;
|
|
18
|
+
constructor();
|
|
19
|
+
setDefaultTimeout(timeout: number): void;
|
|
20
|
+
setDefaultNavigationTimeout(timeout: number): void;
|
|
21
|
+
navigationTimeout(): number;
|
|
22
|
+
timeout(): number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 _TimeoutSettings_defaultTimeout, _TimeoutSettings_defaultNavigationTimeout;
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.TimeoutSettings = void 0;
|
|
31
|
+
const DEFAULT_TIMEOUT = 30000;
|
|
32
|
+
class TimeoutSettings {
|
|
33
|
+
constructor() {
|
|
34
|
+
_TimeoutSettings_defaultTimeout.set(this, void 0);
|
|
35
|
+
_TimeoutSettings_defaultNavigationTimeout.set(this, void 0);
|
|
36
|
+
__classPrivateFieldSet(this, _TimeoutSettings_defaultTimeout, null, "f");
|
|
37
|
+
__classPrivateFieldSet(this, _TimeoutSettings_defaultNavigationTimeout, null, "f");
|
|
38
|
+
}
|
|
39
|
+
setDefaultTimeout(timeout) {
|
|
40
|
+
__classPrivateFieldSet(this, _TimeoutSettings_defaultTimeout, timeout, "f");
|
|
41
|
+
}
|
|
42
|
+
setDefaultNavigationTimeout(timeout) {
|
|
43
|
+
__classPrivateFieldSet(this, _TimeoutSettings_defaultNavigationTimeout, timeout, "f");
|
|
44
|
+
}
|
|
45
|
+
navigationTimeout() {
|
|
46
|
+
if (__classPrivateFieldGet(this, _TimeoutSettings_defaultNavigationTimeout, "f") !== null) {
|
|
47
|
+
return __classPrivateFieldGet(this, _TimeoutSettings_defaultNavigationTimeout, "f");
|
|
48
|
+
}
|
|
49
|
+
if (__classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f") !== null) {
|
|
50
|
+
return __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f");
|
|
51
|
+
}
|
|
52
|
+
return DEFAULT_TIMEOUT;
|
|
53
|
+
}
|
|
54
|
+
timeout() {
|
|
55
|
+
if (__classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f") !== null) {
|
|
56
|
+
return __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f");
|
|
57
|
+
}
|
|
58
|
+
return DEFAULT_TIMEOUT;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TimeoutSettings = TimeoutSettings;
|
|
62
|
+
_TimeoutSettings_defaultTimeout = new WeakMap(), _TimeoutSettings_defaultNavigationTimeout = new WeakMap();
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Asserts that the given value is truthy.
|
|
18
|
+
* @param value - some conditional statement
|
|
19
|
+
* @param message - the error message to throw if the value is not truthy.
|
|
20
|
+
*/
|
|
21
|
+
export declare const assert: (value: unknown, message?: string) => asserts value;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 });
|
|
18
|
+
exports.assert = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* Asserts that the given value is truthy.
|
|
21
|
+
* @param value - some conditional statement
|
|
22
|
+
* @param message - the error message to throw if the value is not truthy.
|
|
23
|
+
*/
|
|
24
|
+
const assert = (value, message) => {
|
|
25
|
+
if (!value) {
|
|
26
|
+
throw new Error(message);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.assert = assert;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.puppeteerDirname = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
let puppeteerDirname;
|
|
6
|
+
exports.puppeteerDirname = puppeteerDirname;
|
|
7
|
+
try {
|
|
8
|
+
// In some environments, like esbuild, this will throw an error.
|
|
9
|
+
// We suppress the error since the bundled binary is not expected
|
|
10
|
+
// to be used or installed in this case and, therefore, the
|
|
11
|
+
// root directory does not have to be known.
|
|
12
|
+
exports.puppeteerDirname = puppeteerDirname = (0, path_1.dirname)(require.resolve('./compat'));
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
// Fallback to __dirname.
|
|
16
|
+
exports.puppeteerDirname = puppeteerDirname = __dirname;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { Product } from './Product';
|
|
17
|
+
export declare function downloadBrowser(product: Product): Promise<void>;
|
|
@@ -0,0 +1,127 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.downloadBrowser = void 0;
|
|
22
|
+
const https_1 = __importDefault(require("https"));
|
|
23
|
+
const node_1 = require("./node");
|
|
24
|
+
const revisions_1 = require("./revisions");
|
|
25
|
+
const supportedProducts = {
|
|
26
|
+
chrome: 'Chromium',
|
|
27
|
+
firefox: 'Firefox Nightly',
|
|
28
|
+
};
|
|
29
|
+
async function downloadBrowser(product) {
|
|
30
|
+
const browserFetcher = node_1.puppeteer.createBrowserFetcher({
|
|
31
|
+
product,
|
|
32
|
+
path: null,
|
|
33
|
+
platform: null,
|
|
34
|
+
});
|
|
35
|
+
const revision = await getRevision();
|
|
36
|
+
await fetchBinary(revision);
|
|
37
|
+
async function getRevision() {
|
|
38
|
+
if (product === 'chrome') {
|
|
39
|
+
return Promise.resolve(revisions_1.PUPPETEER_REVISIONS.chromium);
|
|
40
|
+
}
|
|
41
|
+
if (product === 'firefox') {
|
|
42
|
+
node_1.puppeteer._preferredRevision = revisions_1.PUPPETEER_REVISIONS.firefox;
|
|
43
|
+
try {
|
|
44
|
+
return await getFirefoxNightlyVersion();
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error(error);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`Unsupported product ${product}`);
|
|
52
|
+
}
|
|
53
|
+
function fetchBinary(_revision) {
|
|
54
|
+
const revisionInfo = browserFetcher.revisionInfo(_revision);
|
|
55
|
+
// Do nothing if the revision is already downloaded.
|
|
56
|
+
if (revisionInfo.local) {
|
|
57
|
+
logPolitely(`${supportedProducts[product]} is already in ${revisionInfo.folderPath}; skipping download.`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
function onSuccess(localRevisions) {
|
|
61
|
+
logPolitely(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
|
|
62
|
+
localRevisions = localRevisions.filter((__revision) => {
|
|
63
|
+
return __revision !== revisionInfo.revision;
|
|
64
|
+
});
|
|
65
|
+
const cleanupOldVersions = localRevisions.map((__revision) => {
|
|
66
|
+
return browserFetcher.remove(__revision);
|
|
67
|
+
});
|
|
68
|
+
Promise.all([...cleanupOldVersions]);
|
|
69
|
+
}
|
|
70
|
+
function onError(error) {
|
|
71
|
+
console.error(`ERROR: Failed to set up ${supportedProducts[product]} r${_revision}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`);
|
|
72
|
+
console.error(error);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
function onProgress(downloadedBytes, totalBytes) {
|
|
76
|
+
console.log('Downloading', supportedProducts[product], toMegabytes(downloadedBytes) + '/' + toMegabytes(totalBytes));
|
|
77
|
+
}
|
|
78
|
+
return browserFetcher
|
|
79
|
+
.download(revisionInfo.revision, onProgress)
|
|
80
|
+
.then(() => {
|
|
81
|
+
return browserFetcher.localRevisions();
|
|
82
|
+
})
|
|
83
|
+
.then(onSuccess)
|
|
84
|
+
.catch(onError);
|
|
85
|
+
}
|
|
86
|
+
function toMegabytes(bytes) {
|
|
87
|
+
const mb = bytes / 1024 / 1024;
|
|
88
|
+
return `${Math.round(mb * 10) / 10} Mb`;
|
|
89
|
+
}
|
|
90
|
+
function getFirefoxNightlyVersion() {
|
|
91
|
+
const firefoxVersionsUrl = 'https://product-details.mozilla.org/1.0/firefox_versions.json';
|
|
92
|
+
const requestOptions = {};
|
|
93
|
+
const promise = new Promise((resolve, reject) => {
|
|
94
|
+
let data = '';
|
|
95
|
+
logPolitely(`Requesting latest Firefox Nightly version from ${firefoxVersionsUrl}`);
|
|
96
|
+
https_1.default
|
|
97
|
+
.get(firefoxVersionsUrl, requestOptions, (r) => {
|
|
98
|
+
if (r.statusCode && r.statusCode >= 400) {
|
|
99
|
+
return reject(new Error(`Got status code ${r.statusCode}`));
|
|
100
|
+
}
|
|
101
|
+
r.on('data', (chunk) => {
|
|
102
|
+
data += chunk;
|
|
103
|
+
});
|
|
104
|
+
r.on('end', () => {
|
|
105
|
+
try {
|
|
106
|
+
const versions = JSON.parse(data);
|
|
107
|
+
return resolve(versions.FIREFOX_NIGHTLY);
|
|
108
|
+
}
|
|
109
|
+
catch (_a) {
|
|
110
|
+
return reject(new Error('Firefox version not found'));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
})
|
|
114
|
+
.on('error', reject);
|
|
115
|
+
});
|
|
116
|
+
return promise;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.downloadBrowser = downloadBrowser;
|
|
120
|
+
function logPolitely(toBeLogged) {
|
|
121
|
+
const logLevel = process.env.npm_config_loglevel || '';
|
|
122
|
+
const logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1;
|
|
123
|
+
// eslint-disable-next-line no-console
|
|
124
|
+
if (!logLevelDisplay) {
|
|
125
|
+
console.log(toBeLogged);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export declare const isNode: boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 });
|
|
18
|
+
exports.isNode = void 0;
|
|
19
|
+
exports.isNode = Boolean(typeof process !== 'undefined' && process.version);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getDownloadsCacheDir: () => string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDownloadsCacheDir = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const getDownloadsCacheDir = () => {
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
let dir = cwd;
|
|
12
|
+
for (;;) {
|
|
13
|
+
try {
|
|
14
|
+
if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
// eslint-disable-next-line no-empty
|
|
18
|
+
}
|
|
19
|
+
catch (e) { }
|
|
20
|
+
const parent = path_1.default.dirname(dir);
|
|
21
|
+
if (dir === parent) {
|
|
22
|
+
dir = undefined;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
dir = parent;
|
|
26
|
+
}
|
|
27
|
+
if (!dir) {
|
|
28
|
+
return path_1.default.resolve(cwd, '.remotion');
|
|
29
|
+
}
|
|
30
|
+
if (process.versions.pnp === '1') {
|
|
31
|
+
return path_1.default.resolve(dir, '.pnp/.remotion');
|
|
32
|
+
}
|
|
33
|
+
if (process.versions.pnp === '3') {
|
|
34
|
+
return path_1.default.resolve(dir, '.yarn/.remotion');
|
|
35
|
+
}
|
|
36
|
+
return path_1.default.resolve(dir, 'node_modules/.remotion');
|
|
37
|
+
};
|
|
38
|
+
exports.getDownloadsCacheDir = getDownloadsCacheDir;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare type EventType = string | symbol;
|
|
2
|
+
export declare type Handler<T = any> = (event?: T) => void;
|
|
3
|
+
declare type WildcardHandler = (type: EventType, event?: any) => void;
|
|
4
|
+
declare type EventHandlerList = Array<Handler>;
|
|
5
|
+
declare type WildCardEventHandlerList = Array<WildcardHandler>;
|
|
6
|
+
declare type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;
|
|
7
|
+
export interface Emitter {
|
|
8
|
+
all: EventHandlerMap;
|
|
9
|
+
on<T = any>(type: EventType, handler: Handler<T>): void;
|
|
10
|
+
on(type: '*', handler: WildcardHandler): void;
|
|
11
|
+
off<T = any>(type: EventType, handler: Handler<T>): void;
|
|
12
|
+
off(type: '*', handler: WildcardHandler): void;
|
|
13
|
+
emit<T = any>(type: EventType, event?: T): void;
|
|
14
|
+
emit(type: '*', event?: any): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Mitt: Tiny (~200b) functional event emitter / pubsub.
|
|
18
|
+
* @name mitt
|
|
19
|
+
* @returns {Mitt}
|
|
20
|
+
*/
|
|
21
|
+
export default function mitt(all?: EventHandlerMap): Emitter;
|
|
22
|
+
export {};
|