@remotion/renderer 4.0.0-fastlambda.8 → 4.0.0-lambda.3

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.
Files changed (191) hide show
  1. package/dist/assets/cleanup-assets.d.ts +2 -0
  2. package/dist/assets/cleanup-assets.js +2 -0
  3. package/dist/assets/download-and-map-assets-to-file.d.ts +6 -0
  4. package/dist/assets/download-and-map-assets-to-file.js +46 -19
  5. package/dist/assets/ffmpeg-volume-expression.d.ts +2 -1
  6. package/dist/assets/ffmpeg-volume-expression.js +15 -12
  7. package/dist/assets/get-audio-channels.d.ts +5 -2
  8. package/dist/assets/get-audio-channels.js +15 -4
  9. package/dist/browser/Accessibility.d.ts +175 -0
  10. package/dist/browser/Accessibility.js +423 -0
  11. package/dist/browser/AriaQueryHandler.d.ts +20 -0
  12. package/dist/browser/AriaQueryHandler.js +108 -0
  13. package/dist/browser/Browser.d.ts +209 -0
  14. package/dist/browser/Browser.js +402 -0
  15. package/dist/browser/BrowserConnector.d.ts +26 -0
  16. package/dist/browser/BrowserConnector.js +49 -0
  17. package/dist/browser/BrowserFetcher.d.ts +89 -0
  18. package/dist/browser/BrowserFetcher.js +512 -0
  19. package/dist/browser/BrowserRunner.d.ts +39 -0
  20. package/dist/browser/BrowserRunner.js +308 -0
  21. package/dist/browser/Connection.d.ts +49 -0
  22. package/dist/browser/Connection.js +262 -0
  23. package/dist/browser/ConnectionTransport.d.ts +21 -0
  24. package/dist/browser/ConnectionTransport.js +17 -0
  25. package/dist/browser/ConsoleMessage.d.ts +55 -0
  26. package/dist/browser/ConsoleMessage.js +75 -0
  27. package/dist/browser/Coverage.d.ts +180 -0
  28. package/dist/browser/Coverage.js +371 -0
  29. package/dist/browser/DOMWorld.d.ts +50 -0
  30. package/dist/browser/DOMWorld.js +280 -0
  31. package/dist/browser/Debug.d.ts +19 -0
  32. package/dist/browser/Debug.js +42 -0
  33. package/dist/browser/DeviceDescriptors.d.ts +40 -0
  34. package/dist/browser/DeviceDescriptors.js +1407 -0
  35. package/dist/browser/EmulationManager.d.ts +7 -0
  36. package/dist/browser/EmulationManager.js +40 -0
  37. package/dist/browser/Errors.d.ts +25 -0
  38. package/dist/browser/Errors.js +35 -0
  39. package/dist/browser/EvalTypes.d.ts +27 -0
  40. package/dist/browser/EvalTypes.js +17 -0
  41. package/dist/browser/EventEmitter.d.ts +70 -0
  42. package/dist/browser/EventEmitter.js +102 -0
  43. package/dist/browser/ExecutionContext.d.ts +35 -0
  44. package/dist/browser/ExecutionContext.js +190 -0
  45. package/dist/browser/FileChooser.d.ts +56 -0
  46. package/dist/browser/FileChooser.js +86 -0
  47. package/dist/browser/FrameManager.d.ts +96 -0
  48. package/dist/browser/FrameManager.js +512 -0
  49. package/dist/browser/HTTPRequest.d.ts +42 -0
  50. package/dist/browser/HTTPRequest.js +82 -0
  51. package/dist/browser/HTTPResponse.d.ts +100 -0
  52. package/dist/browser/HTTPResponse.js +196 -0
  53. package/dist/browser/Input.d.ts +355 -0
  54. package/dist/browser/Input.js +592 -0
  55. package/dist/browser/JSHandle.d.ts +36 -0
  56. package/dist/browser/JSHandle.js +93 -0
  57. package/dist/browser/LaunchOptions.d.ts +117 -0
  58. package/dist/browser/LaunchOptions.js +17 -0
  59. package/dist/browser/Launcher.d.ts +9 -0
  60. package/dist/browser/Launcher.js +602 -0
  61. package/dist/browser/LifecycleWatcher.d.ts +29 -0
  62. package/dist/browser/LifecycleWatcher.js +193 -0
  63. package/dist/browser/NetworkConditions.d.ts +26 -0
  64. package/dist/browser/NetworkConditions.js +33 -0
  65. package/dist/browser/NetworkEventManager.d.ts +35 -0
  66. package/dist/browser/NetworkEventManager.js +128 -0
  67. package/dist/browser/NetworkManager.d.ts +36 -0
  68. package/dist/browser/NetworkManager.js +284 -0
  69. package/dist/browser/NodeWebSocketTransport.d.ts +11 -0
  70. package/dist/browser/NodeWebSocketTransport.js +90 -0
  71. package/dist/browser/PDFOptions.d.ts +165 -0
  72. package/dist/browser/PDFOptions.js +34 -0
  73. package/dist/browser/PipeTransport.d.ts +10 -0
  74. package/dist/browser/PipeTransport.js +86 -0
  75. package/dist/browser/Product.d.ts +16 -0
  76. package/dist/browser/Product.js +17 -0
  77. package/dist/browser/Puppeteer.d.ts +35 -0
  78. package/dist/browser/Puppeteer.js +17 -0
  79. package/dist/browser/PuppeteerNode.d.ts +92 -0
  80. package/dist/browser/PuppeteerNode.js +143 -0
  81. package/dist/browser/PuppeteerViewport.d.ts +5 -0
  82. package/dist/browser/PuppeteerViewport.js +2 -0
  83. package/dist/browser/QueryHandler.d.ts +64 -0
  84. package/dist/browser/QueryHandler.js +183 -0
  85. package/dist/browser/ScreenshotOptions.d.ts +14 -0
  86. package/dist/browser/ScreenshotOptions.js +2 -0
  87. package/dist/browser/SecurityDetails.d.ts +55 -0
  88. package/dist/browser/SecurityDetails.js +95 -0
  89. package/dist/browser/Target.d.ts +61 -0
  90. package/dist/browser/Target.js +146 -0
  91. package/dist/browser/TaskQueue.d.ts +20 -0
  92. package/dist/browser/TaskQueue.js +47 -0
  93. package/dist/browser/TimeoutSettings.d.ts +23 -0
  94. package/dist/browser/TimeoutSettings.js +62 -0
  95. package/dist/browser/Tracing.d.ts +45 -0
  96. package/dist/browser/Tracing.js +136 -0
  97. package/dist/browser/USKeyboardLayout.d.ts +39 -0
  98. package/dist/browser/USKeyboardLayout.js +406 -0
  99. package/dist/browser/WebWorker.d.ts +96 -0
  100. package/dist/browser/WebWorker.js +122 -0
  101. package/dist/browser/assert.d.ts +21 -0
  102. package/dist/browser/assert.js +29 -0
  103. package/dist/browser/compat.d.ts +2 -0
  104. package/dist/browser/compat.js +17 -0
  105. package/dist/browser/create-browser-fetcher.d.ts +17 -0
  106. package/dist/browser/create-browser-fetcher.js +140 -0
  107. package/dist/browser/dialog.d.ts +70 -0
  108. package/dist/browser/dialog.js +114 -0
  109. package/dist/browser/environment.d.ts +16 -0
  110. package/dist/browser/environment.js +19 -0
  111. package/dist/browser/fetch.d.ts +16 -0
  112. package/dist/browser/fetch.js +46 -0
  113. package/dist/browser/find-up.d.ts +4 -0
  114. package/dist/browser/find-up.js +85 -0
  115. package/dist/browser/get-download-destination.d.ts +1 -0
  116. package/dist/browser/get-download-destination.js +38 -0
  117. package/dist/browser/mitt/index.d.ts +22 -0
  118. package/dist/browser/mitt/index.js +49 -0
  119. package/dist/browser/node.d.ts +2 -0
  120. package/dist/browser/node.js +9 -0
  121. package/dist/browser/page.d.ts +78 -0
  122. package/dist/browser/page.js +277 -0
  123. package/dist/browser/pkg-dir.d.ts +3 -0
  124. package/dist/browser/pkg-dir.js +13 -0
  125. package/dist/browser/revisions.d.ts +21 -0
  126. package/dist/browser/revisions.js +22 -0
  127. package/dist/browser/util.d.ts +46 -0
  128. package/dist/browser/util.js +161 -0
  129. package/dist/calculate-ffmpeg-filters.js +2 -2
  130. package/dist/combine-videos.d.ts +2 -1
  131. package/dist/combine-videos.js +8 -1
  132. package/dist/cycle-browser-tabs.d.ts +2 -1
  133. package/dist/cycle-browser-tabs.js +9 -2
  134. package/dist/ensure-presentation-timestamp.d.ts +1 -0
  135. package/dist/ensure-presentation-timestamp.js +57 -0
  136. package/dist/extract-frame-from-video.d.ts +11 -0
  137. package/dist/extract-frame-from-video.js +197 -0
  138. package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
  139. package/dist/frame-to-ffmpeg-timestamp.js +8 -0
  140. package/dist/get-compositions.d.ts +5 -2
  141. package/dist/get-compositions.js +23 -5
  142. package/dist/get-duration-of-asset.d.ts +7 -0
  143. package/dist/get-duration-of-asset.js +36 -0
  144. package/dist/get-port.js +26 -24
  145. package/dist/index.d.ts +33 -9
  146. package/dist/index.js +14 -5
  147. package/dist/is-beyond-last-frame.d.ts +2 -0
  148. package/dist/is-beyond-last-frame.js +12 -0
  149. package/dist/last-frame-from-video-cache.d.ts +10 -0
  150. package/dist/last-frame-from-video-cache.js +50 -0
  151. package/dist/make-assets-download-dir.js +6 -1
  152. package/dist/make-cancel-signal.d.ts +7 -0
  153. package/dist/make-cancel-signal.js +25 -0
  154. package/dist/merge-audio-track.js +2 -2
  155. package/dist/offthread-video-server.d.ts +14 -0
  156. package/dist/offthread-video-server.js +67 -0
  157. package/dist/open-browser.d.ts +6 -6
  158. package/dist/open-browser.js +24 -20
  159. package/dist/prepare-server.d.ts +13 -2
  160. package/dist/prepare-server.js +35 -5
  161. package/dist/preprocess-audio-track.d.ts +1 -0
  162. package/dist/preprocess-audio-track.js +2 -2
  163. package/dist/prespawn-ffmpeg.d.ts +2 -0
  164. package/dist/prespawn-ffmpeg.js +10 -9
  165. package/dist/provide-screenshot.js +1 -1
  166. package/dist/puppeteer-screenshot.js +5 -1
  167. package/dist/render-frames.d.ts +6 -1
  168. package/dist/render-frames.js +96 -37
  169. package/dist/render-media.d.ts +12 -2
  170. package/dist/render-media.js +127 -54
  171. package/dist/render-still.d.ts +14 -4
  172. package/dist/render-still.js +58 -19
  173. package/dist/serve-handler/glob-slash.d.ts +1 -0
  174. package/dist/serve-handler/glob-slash.js +12 -0
  175. package/dist/serve-handler/index.d.ts +4 -0
  176. package/dist/serve-handler/index.js +205 -0
  177. package/dist/serve-handler/is-path-inside.d.ts +1 -0
  178. package/dist/serve-handler/is-path-inside.js +27 -0
  179. package/dist/serve-handler/range-parser.d.ts +13 -0
  180. package/dist/serve-handler/range-parser.js +57 -0
  181. package/dist/serve-static.d.ts +10 -3
  182. package/dist/serve-static.js +22 -4
  183. package/dist/set-props-and-env.d.ts +3 -1
  184. package/dist/set-props-and-env.js +28 -6
  185. package/dist/stitch-frames-to-video.d.ts +4 -1
  186. package/dist/stitch-frames-to-video.js +36 -15
  187. package/dist/stringify-ffmpeg-filter.js +3 -0
  188. package/dist/tmp-dir.js +5 -1
  189. package/dist/validate-fps-for-gif.d.ts +2 -0
  190. package/dist/validate-fps-for-gif.js +9 -0
  191. package/package.json +6 -7
@@ -0,0 +1,100 @@
1
+ /// <reference types="node" />
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
+ import { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping';
18
+ import { Protocol } from 'devtools-protocol';
19
+ import { Frame } from './FrameManager';
20
+ import { HTTPRequest } from './HTTPRequest';
21
+ interface RemoteAddress {
22
+ ip?: string;
23
+ port?: number;
24
+ }
25
+ interface CDPSession {
26
+ send<T extends keyof ProtocolMapping.Commands>(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise<ProtocolMapping.Commands[T]['returnType']>;
27
+ }
28
+ export declare class HTTPResponse {
29
+ #private;
30
+ constructor(client: CDPSession, request: HTTPRequest, responsePayload: Protocol.Network.Response, extraInfo: Protocol.Network.ResponseReceivedExtraInfoEvent | null);
31
+ _resolveBody(err: Error | null): void;
32
+ /**
33
+ * @returns The IP address and port number used to connect to the remote
34
+ * server.
35
+ */
36
+ remoteAddress(): RemoteAddress;
37
+ /**
38
+ * @returns The URL of the response.
39
+ */
40
+ url(): string;
41
+ /**
42
+ * @returns True if the response was successful (status in the range 200-299).
43
+ */
44
+ ok(): boolean;
45
+ /**
46
+ * @returns The status code of the response (e.g., 200 for a success).
47
+ */
48
+ status(): number;
49
+ /**
50
+ * @returns The status text of the response (e.g. usually an "OK" for a
51
+ * success).
52
+ */
53
+ statusText(): string;
54
+ /**
55
+ * @returns An object with HTTP headers associated with the response. All
56
+ * header names are lower-case.
57
+ */
58
+ headers(): Record<string, string>;
59
+ /**
60
+ * @returns Timing information related to the response.
61
+ */
62
+ timing(): Protocol.Network.ResourceTiming | null;
63
+ /**
64
+ * @returns Promise which resolves to a buffer with response body.
65
+ */
66
+ buffer(): Promise<Buffer>;
67
+ /**
68
+ * @returns Promise which resolves to a text representation of response body.
69
+ */
70
+ text(): Promise<string>;
71
+ /**
72
+ *
73
+ * @returns Promise which resolves to a JSON representation of response body.
74
+ *
75
+ * @remarks
76
+ *
77
+ * This method will throw if the response body is not parsable via
78
+ * `JSON.parse`.
79
+ */
80
+ json(): Promise<any>;
81
+ /**
82
+ * @returns A matching {@link HTTPRequest} object.
83
+ */
84
+ request(): HTTPRequest;
85
+ /**
86
+ * @returns True if the response was served from either the browser's disk
87
+ * cache or memory cache.
88
+ */
89
+ fromCache(): boolean;
90
+ /**
91
+ * @returns True if the response was served by a service worker.
92
+ */
93
+ fromServiceWorker(): boolean;
94
+ /**
95
+ * @returns A {@link Frame} that initiated this response, or `null` if
96
+ * navigating to error pages.
97
+ */
98
+ frame(): Frame | null;
99
+ }
100
+ export {};
@@ -0,0 +1,196 @@
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 _HTTPResponse_instances, _HTTPResponse_client, _HTTPResponse_request, _HTTPResponse_contentPromise, _HTTPResponse_bodyLoadedPromise, _HTTPResponse_bodyLoadedPromiseFulfill, _HTTPResponse_remoteAddress, _HTTPResponse_status, _HTTPResponse_statusText, _HTTPResponse_url, _HTTPResponse_fromDiskCache, _HTTPResponse_fromServiceWorker, _HTTPResponse_headers, _HTTPResponse_timing, _HTTPResponse_parseStatusTextFromExtrInfo;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.HTTPResponse = void 0;
16
+ const Errors_1 = require("./Errors");
17
+ class HTTPResponse {
18
+ constructor(client, request, responsePayload, extraInfo) {
19
+ _HTTPResponse_instances.add(this);
20
+ _HTTPResponse_client.set(this, void 0);
21
+ _HTTPResponse_request.set(this, void 0);
22
+ _HTTPResponse_contentPromise.set(this, null);
23
+ _HTTPResponse_bodyLoadedPromise.set(this, void 0);
24
+ _HTTPResponse_bodyLoadedPromiseFulfill.set(this, () => undefined);
25
+ _HTTPResponse_remoteAddress.set(this, void 0);
26
+ _HTTPResponse_status.set(this, void 0);
27
+ _HTTPResponse_statusText.set(this, void 0);
28
+ _HTTPResponse_url.set(this, void 0);
29
+ _HTTPResponse_fromDiskCache.set(this, void 0);
30
+ _HTTPResponse_fromServiceWorker.set(this, void 0);
31
+ _HTTPResponse_headers.set(this, {});
32
+ _HTTPResponse_timing.set(this, void 0);
33
+ __classPrivateFieldSet(this, _HTTPResponse_client, client, "f");
34
+ __classPrivateFieldSet(this, _HTTPResponse_request, request, "f");
35
+ __classPrivateFieldSet(this, _HTTPResponse_bodyLoadedPromise, new Promise((fulfill) => {
36
+ __classPrivateFieldSet(this, _HTTPResponse_bodyLoadedPromiseFulfill, fulfill, "f");
37
+ }), "f");
38
+ __classPrivateFieldSet(this, _HTTPResponse_remoteAddress, {
39
+ ip: responsePayload.remoteIPAddress,
40
+ port: responsePayload.remotePort,
41
+ }, "f");
42
+ __classPrivateFieldSet(this, _HTTPResponse_statusText, __classPrivateFieldGet(this, _HTTPResponse_instances, "m", _HTTPResponse_parseStatusTextFromExtrInfo).call(this, extraInfo) ||
43
+ responsePayload.statusText, "f");
44
+ __classPrivateFieldSet(this, _HTTPResponse_url, request.url(), "f");
45
+ __classPrivateFieldSet(this, _HTTPResponse_fromDiskCache, Boolean(responsePayload.fromDiskCache), "f");
46
+ __classPrivateFieldSet(this, _HTTPResponse_fromServiceWorker, Boolean(responsePayload.fromServiceWorker), "f");
47
+ __classPrivateFieldSet(this, _HTTPResponse_status, extraInfo ? extraInfo.statusCode : responsePayload.status, "f");
48
+ const headers = extraInfo ? extraInfo.headers : responsePayload.headers;
49
+ for (const [key, value] of Object.entries(headers)) {
50
+ __classPrivateFieldGet(this, _HTTPResponse_headers, "f")[key.toLowerCase()] = value;
51
+ }
52
+ __classPrivateFieldSet(this, _HTTPResponse_timing, responsePayload.timing || null, "f");
53
+ }
54
+ _resolveBody(err) {
55
+ if (err) {
56
+ return __classPrivateFieldGet(this, _HTTPResponse_bodyLoadedPromiseFulfill, "f").call(this, err);
57
+ }
58
+ return __classPrivateFieldGet(this, _HTTPResponse_bodyLoadedPromiseFulfill, "f").call(this);
59
+ }
60
+ /**
61
+ * @returns The IP address and port number used to connect to the remote
62
+ * server.
63
+ */
64
+ remoteAddress() {
65
+ return __classPrivateFieldGet(this, _HTTPResponse_remoteAddress, "f");
66
+ }
67
+ /**
68
+ * @returns The URL of the response.
69
+ */
70
+ url() {
71
+ return __classPrivateFieldGet(this, _HTTPResponse_url, "f");
72
+ }
73
+ /**
74
+ * @returns True if the response was successful (status in the range 200-299).
75
+ */
76
+ ok() {
77
+ return __classPrivateFieldGet(this, _HTTPResponse_status, "f") === 0 || (__classPrivateFieldGet(this, _HTTPResponse_status, "f") >= 200 && __classPrivateFieldGet(this, _HTTPResponse_status, "f") <= 299);
78
+ }
79
+ /**
80
+ * @returns The status code of the response (e.g., 200 for a success).
81
+ */
82
+ status() {
83
+ return __classPrivateFieldGet(this, _HTTPResponse_status, "f");
84
+ }
85
+ /**
86
+ * @returns The status text of the response (e.g. usually an "OK" for a
87
+ * success).
88
+ */
89
+ statusText() {
90
+ return __classPrivateFieldGet(this, _HTTPResponse_statusText, "f");
91
+ }
92
+ /**
93
+ * @returns An object with HTTP headers associated with the response. All
94
+ * header names are lower-case.
95
+ */
96
+ headers() {
97
+ return __classPrivateFieldGet(this, _HTTPResponse_headers, "f");
98
+ }
99
+ /**
100
+ * @returns Timing information related to the response.
101
+ */
102
+ timing() {
103
+ return __classPrivateFieldGet(this, _HTTPResponse_timing, "f");
104
+ }
105
+ /**
106
+ * @returns Promise which resolves to a buffer with response body.
107
+ */
108
+ buffer() {
109
+ if (!__classPrivateFieldGet(this, _HTTPResponse_contentPromise, "f")) {
110
+ __classPrivateFieldSet(this, _HTTPResponse_contentPromise, __classPrivateFieldGet(this, _HTTPResponse_bodyLoadedPromise, "f").then(async (error) => {
111
+ if (error) {
112
+ throw error;
113
+ }
114
+ try {
115
+ const response = await __classPrivateFieldGet(this, _HTTPResponse_client, "f").send('Network.getResponseBody', {
116
+ requestId: __classPrivateFieldGet(this, _HTTPResponse_request, "f")._requestId,
117
+ });
118
+ return Buffer.from(response.body, response.base64Encoded ? 'base64' : 'utf8');
119
+ }
120
+ catch (_error) {
121
+ if (_error instanceof Errors_1.ProtocolError &&
122
+ _error.originalMessage === 'No resource with given identifier found') {
123
+ throw new Errors_1.ProtocolError('Could not load body for this request. This might happen if the request is a preflight request.');
124
+ }
125
+ throw _error;
126
+ }
127
+ }), "f");
128
+ }
129
+ return __classPrivateFieldGet(this, _HTTPResponse_contentPromise, "f");
130
+ }
131
+ /**
132
+ * @returns Promise which resolves to a text representation of response body.
133
+ */
134
+ async text() {
135
+ const content = await this.buffer();
136
+ return content.toString('utf8');
137
+ }
138
+ /**
139
+ *
140
+ * @returns Promise which resolves to a JSON representation of response body.
141
+ *
142
+ * @remarks
143
+ *
144
+ * This method will throw if the response body is not parsable via
145
+ * `JSON.parse`.
146
+ */
147
+ async json() {
148
+ const content = await this.text();
149
+ return JSON.parse(content);
150
+ }
151
+ /**
152
+ * @returns A matching {@link HTTPRequest} object.
153
+ */
154
+ request() {
155
+ return __classPrivateFieldGet(this, _HTTPResponse_request, "f");
156
+ }
157
+ /**
158
+ * @returns True if the response was served from either the browser's disk
159
+ * cache or memory cache.
160
+ */
161
+ fromCache() {
162
+ return __classPrivateFieldGet(this, _HTTPResponse_fromDiskCache, "f") || __classPrivateFieldGet(this, _HTTPResponse_request, "f")._fromMemoryCache;
163
+ }
164
+ /**
165
+ * @returns True if the response was served by a service worker.
166
+ */
167
+ fromServiceWorker() {
168
+ return __classPrivateFieldGet(this, _HTTPResponse_fromServiceWorker, "f");
169
+ }
170
+ /**
171
+ * @returns A {@link Frame} that initiated this response, or `null` if
172
+ * navigating to error pages.
173
+ */
174
+ frame() {
175
+ return __classPrivateFieldGet(this, _HTTPResponse_request, "f").frame();
176
+ }
177
+ }
178
+ exports.HTTPResponse = HTTPResponse;
179
+ _HTTPResponse_client = new WeakMap(), _HTTPResponse_request = new WeakMap(), _HTTPResponse_contentPromise = new WeakMap(), _HTTPResponse_bodyLoadedPromise = new WeakMap(), _HTTPResponse_bodyLoadedPromiseFulfill = new WeakMap(), _HTTPResponse_remoteAddress = new WeakMap(), _HTTPResponse_status = new WeakMap(), _HTTPResponse_statusText = new WeakMap(), _HTTPResponse_url = new WeakMap(), _HTTPResponse_fromDiskCache = new WeakMap(), _HTTPResponse_fromServiceWorker = new WeakMap(), _HTTPResponse_headers = new WeakMap(), _HTTPResponse_timing = new WeakMap(), _HTTPResponse_instances = new WeakSet(), _HTTPResponse_parseStatusTextFromExtrInfo = function _HTTPResponse_parseStatusTextFromExtrInfo(extraInfo) {
180
+ if (!extraInfo || !extraInfo.headersText) {
181
+ return;
182
+ }
183
+ const firstLine = extraInfo.headersText.split('\r', 1)[0];
184
+ if (!firstLine) {
185
+ return;
186
+ }
187
+ const match = firstLine.match(/[^ ]* [^ ]* (.*)/);
188
+ if (!match) {
189
+ return;
190
+ }
191
+ const statusText = match[1];
192
+ if (!statusText) {
193
+ return;
194
+ }
195
+ return statusText;
196
+ };
@@ -0,0 +1,355 @@
1
+ /**
2
+ * Copyright 2017 Google Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the 'License');
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an 'AS IS' BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Protocol } from 'devtools-protocol';
17
+ import { CDPSession } from './Connection';
18
+ import { Point } from './JSHandle';
19
+ import { KeyInput } from './USKeyboardLayout';
20
+ /**
21
+ * Keyboard provides an api for managing a virtual keyboard.
22
+ * The high level api is {@link Keyboard."type"},
23
+ * which takes raw characters and generates proper keydown, keypress/input,
24
+ * and keyup events on your page.
25
+ *
26
+ * @remarks
27
+ * For finer control, you can use {@link Keyboard.down},
28
+ * {@link Keyboard.up}, and {@link Keyboard.sendCharacter}
29
+ * to manually fire events as if they were generated from a real keyboard.
30
+ *
31
+ * On MacOS, keyboard shortcuts like `⌘ A` -\> Select All do not work.
32
+ * See {@link https://github.com/puppeteer/puppeteer/issues/1313 | #1313}.
33
+ *
34
+ * @example
35
+ * An example of holding down `Shift` in order to select and delete some text:
36
+ * ```js
37
+ * await page.keyboard.type('Hello World!');
38
+ * await page.keyboard.press('ArrowLeft');
39
+ *
40
+ * await page.keyboard.down('Shift');
41
+ * for (let i = 0; i < ' World'.length; i++)
42
+ * await page.keyboard.press('ArrowLeft');
43
+ * await page.keyboard.up('Shift');
44
+ *
45
+ * await page.keyboard.press('Backspace');
46
+ * // Result text will end up saying 'Hello!'
47
+ * ```
48
+ *
49
+ * @example
50
+ * An example of pressing `A`
51
+ * ```js
52
+ * await page.keyboard.down('Shift');
53
+ * await page.keyboard.press('KeyA');
54
+ * await page.keyboard.up('Shift');
55
+ * ```
56
+ *
57
+ * @public
58
+ */
59
+ export declare class Keyboard {
60
+ #private;
61
+ /**
62
+ * @internal
63
+ */
64
+ _modifiers: number;
65
+ /**
66
+ * @internal
67
+ */
68
+ constructor(client: CDPSession);
69
+ /**
70
+ * Dispatches a `keydown` event.
71
+ *
72
+ * @remarks
73
+ * If `key` is a single character and no modifier keys besides `Shift`
74
+ * are being held down, a `keypress`/`input` event will also generated.
75
+ * The `text` option can be specified to force an input event to be generated.
76
+ * If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`,
77
+ * subsequent key presses will be sent with that modifier active.
78
+ * To release the modifier key, use {@link Keyboard.up}.
79
+ *
80
+ * After the key is pressed once, subsequent calls to
81
+ * {@link Keyboard.down} will have
82
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat | repeat}
83
+ * set to true. To release the key, use {@link Keyboard.up}.
84
+ *
85
+ * Modifier keys DO influence {@link Keyboard.down}.
86
+ * Holding down `Shift` will type the text in upper case.
87
+ *
88
+ * @param key - Name of key to press, such as `ArrowLeft`.
89
+ * See {@link KeyInput} for a list of all key names.
90
+ *
91
+ * @param options - An object of options. Accepts text which, if specified,
92
+ * generates an input event with this text.
93
+ */
94
+ down(key: KeyInput, options?: {
95
+ text?: string;
96
+ }): Promise<void>;
97
+ /**
98
+ * Dispatches a `keyup` event.
99
+ *
100
+ * @param key - Name of key to release, such as `ArrowLeft`.
101
+ * See {@link KeyInput | KeyInput}
102
+ * for a list of all key names.
103
+ */
104
+ up(key: KeyInput): Promise<void>;
105
+ /**
106
+ * Dispatches a `keypress` and `input` event.
107
+ * This does not send a `keydown` or `keyup` event.
108
+ *
109
+ * @remarks
110
+ * Modifier keys DO NOT effect {@link Keyboard.sendCharacter | Keyboard.sendCharacter}.
111
+ * Holding down `Shift` will not type the text in upper case.
112
+ *
113
+ * @example
114
+ * ```js
115
+ * page.keyboard.sendCharacter('嗨');
116
+ * ```
117
+ *
118
+ * @param char - Character to send into the page.
119
+ */
120
+ sendCharacter(char: string): Promise<void>;
121
+ private charIsKey;
122
+ /**
123
+ * Sends a `keydown`, `keypress`/`input`,
124
+ * and `keyup` event for each character in the text.
125
+ *
126
+ * @remarks
127
+ * To press a special key, like `Control` or `ArrowDown`,
128
+ * use {@link Keyboard.press}.
129
+ *
130
+ * Modifier keys DO NOT effect `keyboard.type`.
131
+ * Holding down `Shift` will not type the text in upper case.
132
+ *
133
+ * @example
134
+ * ```js
135
+ * await page.keyboard.type('Hello'); // Types instantly
136
+ * await page.keyboard.type('World', {delay: 100}); // Types slower, like a user
137
+ * ```
138
+ *
139
+ * @param text - A text to type into a focused element.
140
+ * @param options - An object of options. Accepts delay which,
141
+ * if specified, is the time to wait between `keydown` and `keyup` in milliseconds.
142
+ * Defaults to 0.
143
+ */
144
+ type(text: string, options?: {
145
+ delay?: number;
146
+ }): Promise<void>;
147
+ /**
148
+ * Shortcut for {@link Keyboard.down}
149
+ * and {@link Keyboard.up}.
150
+ *
151
+ * @remarks
152
+ * If `key` is a single character and no modifier keys besides `Shift`
153
+ * are being held down, a `keypress`/`input` event will also generated.
154
+ * The `text` option can be specified to force an input event to be generated.
155
+ *
156
+ * Modifier keys DO effect {@link Keyboard.press}.
157
+ * Holding down `Shift` will type the text in upper case.
158
+ *
159
+ * @param key - Name of key to press, such as `ArrowLeft`.
160
+ * See {@link KeyInput} for a list of all key names.
161
+ *
162
+ * @param options - An object of options. Accepts text which, if specified,
163
+ * generates an input event with this text. Accepts delay which,
164
+ * if specified, is the time to wait between `keydown` and `keyup` in milliseconds.
165
+ * Defaults to 0.
166
+ */
167
+ press(key: KeyInput, options?: {
168
+ delay?: number;
169
+ text?: string;
170
+ }): Promise<void>;
171
+ }
172
+ /**
173
+ * @public
174
+ */
175
+ export declare type MouseButton = 'left' | 'right' | 'middle' | 'back' | 'forward';
176
+ /**
177
+ * @public
178
+ */
179
+ interface MouseOptions {
180
+ button?: MouseButton;
181
+ clickCount?: number;
182
+ }
183
+ /**
184
+ * @public
185
+ */
186
+ interface MouseWheelOptions {
187
+ deltaX?: number;
188
+ deltaY?: number;
189
+ }
190
+ /**
191
+ * The Mouse class operates in main-frame CSS pixels
192
+ * relative to the top-left corner of the viewport.
193
+ * @remarks
194
+ * Every `page` object has its own Mouse, accessible with [`page.mouse`](#pagemouse).
195
+ *
196
+ * @example
197
+ * ```js
198
+ * // Using ‘page.mouse’ to trace a 100x100 square.
199
+ * await page.mouse.move(0, 0);
200
+ * await page.mouse.down();
201
+ * await page.mouse.move(0, 100);
202
+ * await page.mouse.move(100, 100);
203
+ * await page.mouse.move(100, 0);
204
+ * await page.mouse.move(0, 0);
205
+ * await page.mouse.up();
206
+ * ```
207
+ *
208
+ * **Note**: The mouse events trigger synthetic `MouseEvent`s.
209
+ * This means that it does not fully replicate the functionality of what a normal user
210
+ * would be able to do with their mouse.
211
+ *
212
+ * For example, dragging and selecting text is not possible using `page.mouse`.
213
+ * Instead, you can use the {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/getSelection | `DocumentOrShadowRoot.getSelection()`} functionality implemented in the platform.
214
+ *
215
+ * @example
216
+ * For example, if you want to select all content between nodes:
217
+ * ```js
218
+ * await page.evaluate((from, to) => {
219
+ * const selection = from.getRootNode().getSelection();
220
+ * const range = document.createRange();
221
+ * range.setStartBefore(from);
222
+ * range.setEndAfter(to);
223
+ * selection.removeAllRanges();
224
+ * selection.addRange(range);
225
+ * }, fromJSHandle, toJSHandle);
226
+ * ```
227
+ * If you then would want to copy-paste your selection, you can use the clipboard api:
228
+ * ```js
229
+ * // The clipboard api does not allow you to copy, unless the tab is focused.
230
+ * await page.bringToFront();
231
+ * await page.evaluate(() => {
232
+ * // Copy the selected content to the clipboard
233
+ * document.execCommand('copy');
234
+ * // Obtain the content of the clipboard as a string
235
+ * return navigator.clipboard.readText();
236
+ * });
237
+ * ```
238
+ * **Note**: If you want access to the clipboard API,
239
+ * you have to give it permission to do so:
240
+ * ```js
241
+ * await browser.defaultBrowserContext().overridePermissions(
242
+ * '<your origin>', ['clipboard-read', 'clipboard-write']
243
+ * );
244
+ * ```
245
+ * @public
246
+ */
247
+ export declare class Mouse {
248
+ #private;
249
+ /**
250
+ * @internal
251
+ */
252
+ constructor(client: CDPSession, keyboard: Keyboard);
253
+ /**
254
+ * Dispatches a `mousemove` event.
255
+ * @param x - Horizontal position of the mouse.
256
+ * @param y - Vertical position of the mouse.
257
+ * @param options - Optional object. If specified, the `steps` property
258
+ * sends intermediate `mousemove` events when set to `1` (default).
259
+ */
260
+ move(x: number, y: number, options?: {
261
+ steps?: number;
262
+ }): Promise<void>;
263
+ /**
264
+ * Shortcut for `mouse.move`, `mouse.down` and `mouse.up`.
265
+ * @param x - Horizontal position of the mouse.
266
+ * @param y - Vertical position of the mouse.
267
+ * @param options - Optional `MouseOptions`.
268
+ */
269
+ click(x: number, y: number, options?: MouseOptions & {
270
+ delay?: number;
271
+ }): Promise<void>;
272
+ /**
273
+ * Dispatches a `mousedown` event.
274
+ * @param options - Optional `MouseOptions`.
275
+ */
276
+ down(options?: MouseOptions): Promise<void>;
277
+ /**
278
+ * Dispatches a `mouseup` event.
279
+ * @param options - Optional `MouseOptions`.
280
+ */
281
+ up(options?: MouseOptions): Promise<void>;
282
+ /**
283
+ * Dispatches a `mousewheel` event.
284
+ * @param options - Optional: `MouseWheelOptions`.
285
+ *
286
+ * @example
287
+ * An example of zooming into an element:
288
+ * ```js
289
+ * await page.goto('https://mdn.mozillademos.org/en-US/docs/Web/API/Element/wheel_event$samples/Scaling_an_element_via_the_wheel?revision=1587366');
290
+ *
291
+ * const elem = await page.$('div');
292
+ * const boundingBox = await elem.boundingBox();
293
+ * await page.mouse.move(
294
+ * boundingBox.x + boundingBox.width / 2,
295
+ * boundingBox.y + boundingBox.height / 2
296
+ * );
297
+ *
298
+ * await page.mouse.wheel({ deltaY: -100 })
299
+ * ```
300
+ */
301
+ wheel(options?: MouseWheelOptions): Promise<void>;
302
+ /**
303
+ * Dispatches a `drag` event.
304
+ * @param start - starting point for drag
305
+ * @param target - point to drag to
306
+ */
307
+ drag(start: Point, target: Point): Promise<Protocol.Input.DragData>;
308
+ /**
309
+ * Dispatches a `dragenter` event.
310
+ * @param target - point for emitting `dragenter` event
311
+ * @param data - drag data containing items and operations mask
312
+ */
313
+ dragEnter(target: Point, data: Protocol.Input.DragData): Promise<void>;
314
+ /**
315
+ * Dispatches a `dragover` event.
316
+ * @param target - point for emitting `dragover` event
317
+ * @param data - drag data containing items and operations mask
318
+ */
319
+ dragOver(target: Point, data: Protocol.Input.DragData): Promise<void>;
320
+ /**
321
+ * Performs a dragenter, dragover, and drop in sequence.
322
+ * @param target - point to drop on
323
+ * @param data - drag data containing items and operations mask
324
+ */
325
+ drop(target: Point, data: Protocol.Input.DragData): Promise<void>;
326
+ /**
327
+ * Performs a drag, dragenter, dragover, and drop in sequence.
328
+ * @param target - point to drag from
329
+ * @param target - point to drop on
330
+ * @param options - An object of options. Accepts delay which,
331
+ * if specified, is the time to wait between `dragover` and `drop` in milliseconds.
332
+ * Defaults to 0.
333
+ */
334
+ dragAndDrop(start: Point, target: Point, options?: {
335
+ delay?: number;
336
+ }): Promise<void>;
337
+ }
338
+ /**
339
+ * The Touchscreen class exposes touchscreen events.
340
+ * @public
341
+ */
342
+ export declare class Touchscreen {
343
+ #private;
344
+ /**
345
+ * @internal
346
+ */
347
+ constructor(client: CDPSession, keyboard: Keyboard);
348
+ /**
349
+ * Dispatches a `touchstart` and `touchend` event.
350
+ * @param x - Horizontal position of the tap.
351
+ * @param y - Vertical position of the tap.
352
+ */
353
+ tap(x: number, y: number): Promise<void>;
354
+ }
355
+ export {};