@remotion/renderer 4.0.0-imgloading.2 → 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.
- package/dist/assets/calculate-asset-positions.d.ts.map +1 -0
- package/dist/assets/calculate-asset-positions.js.map +1 -0
- package/dist/assets/calculate-atempo.d.ts.map +1 -0
- package/dist/assets/calculate-atempo.js.map +1 -0
- package/dist/assets/cleanup-assets.d.ts +2 -0
- package/dist/assets/cleanup-assets.js +2 -0
- package/dist/assets/convert-assets-to-file-urls.d.ts.map +1 -0
- package/dist/assets/convert-assets-to-file-urls.js.map +1 -0
- package/dist/assets/download-and-map-assets-to-file.d.ts +6 -0
- package/dist/assets/download-and-map-assets-to-file.d.ts.map +1 -0
- package/dist/assets/download-and-map-assets-to-file.js +46 -19
- package/dist/assets/download-and-map-assets-to-file.js.map +1 -0
- package/dist/assets/download-file.d.ts.map +1 -0
- package/dist/assets/download-file.js.map +1 -0
- package/dist/assets/ffmpeg-volume-expression.d.ts +2 -1
- package/dist/assets/ffmpeg-volume-expression.d.ts.map +1 -0
- package/dist/assets/ffmpeg-volume-expression.js +15 -12
- package/dist/assets/ffmpeg-volume-expression.js.map +1 -0
- package/dist/assets/flatten-volume-array.d.ts.map +1 -0
- package/dist/assets/flatten-volume-array.js.map +1 -0
- package/dist/assets/get-audio-channels.d.ts +5 -2
- package/dist/assets/get-audio-channels.d.ts.map +1 -0
- package/dist/assets/get-audio-channels.js +15 -4
- package/dist/assets/get-audio-channels.js.map +1 -0
- package/dist/assets/read-file.d.ts.map +1 -0
- package/dist/assets/read-file.js.map +1 -0
- package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts.map +1 -0
- package/dist/assets/round-volume-to-avoid-stack-overflow.js.map +1 -0
- package/dist/assets/sanitize-filename.d.ts.map +1 -0
- package/dist/assets/sanitize-filename.js.map +1 -0
- package/dist/assets/sanitize-filepath.d.ts.map +1 -0
- package/dist/assets/sanitize-filepath.js.map +1 -0
- package/dist/assets/truncate-utf8-bytes.d.ts.map +1 -0
- package/dist/assets/truncate-utf8-bytes.js.map +1 -0
- package/dist/assets/types.d.ts.map +1 -0
- package/dist/assets/types.js.map +1 -0
- package/dist/browser/Accessibility.d.ts +175 -0
- package/dist/browser/Accessibility.js +423 -0
- package/dist/browser/AriaQueryHandler.d.ts +20 -0
- package/dist/browser/AriaQueryHandler.js +108 -0
- package/dist/browser/Browser.d.ts +209 -0
- package/dist/browser/Browser.js +402 -0
- package/dist/browser/BrowserConnector.d.ts +26 -0
- package/dist/browser/BrowserConnector.js +49 -0
- package/dist/browser/BrowserFetcher.d.ts +89 -0
- package/dist/browser/BrowserFetcher.js +512 -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 +55 -0
- package/dist/browser/ConsoleMessage.js +75 -0
- package/dist/browser/Coverage.d.ts +180 -0
- package/dist/browser/Coverage.js +371 -0
- package/dist/browser/DOMWorld.d.ts +50 -0
- package/dist/browser/DOMWorld.js +280 -0
- package/dist/browser/Debug.d.ts +19 -0
- package/dist/browser/Debug.js +42 -0
- package/dist/browser/DeviceDescriptors.d.ts +40 -0
- package/dist/browser/DeviceDescriptors.js +1407 -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 +35 -0
- package/dist/browser/ExecutionContext.js +190 -0
- package/dist/browser/FileChooser.d.ts +56 -0
- package/dist/browser/FileChooser.js +86 -0
- package/dist/browser/FrameManager.d.ts +96 -0
- package/dist/browser/FrameManager.js +512 -0
- package/dist/browser/HTTPRequest.d.ts +42 -0
- package/dist/browser/HTTPRequest.js +82 -0
- package/dist/browser/HTTPResponse.d.ts +100 -0
- package/dist/browser/HTTPResponse.js +196 -0
- package/dist/browser/Input.d.ts +355 -0
- package/dist/browser/Input.js +592 -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/NetworkConditions.d.ts +26 -0
- package/dist/browser/NetworkConditions.js +33 -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 +284 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +11 -0
- package/dist/browser/NodeWebSocketTransport.js +90 -0
- package/dist/browser/PDFOptions.d.ts +165 -0
- package/dist/browser/PDFOptions.js +34 -0
- package/dist/browser/PipeTransport.d.ts +10 -0
- package/dist/browser/PipeTransport.js +86 -0
- package/dist/browser/Product.d.ts +16 -0
- package/dist/browser/Product.js +17 -0
- package/dist/browser/Puppeteer.d.ts +35 -0
- package/dist/browser/Puppeteer.js +17 -0
- package/dist/browser/PuppeteerNode.d.ts +92 -0
- package/dist/browser/PuppeteerNode.js +143 -0
- package/dist/browser/PuppeteerViewport.d.ts +5 -0
- package/dist/browser/PuppeteerViewport.js +2 -0
- package/dist/browser/QueryHandler.d.ts +64 -0
- package/dist/browser/QueryHandler.js +183 -0
- package/dist/browser/ScreenshotOptions.d.ts +14 -0
- package/dist/browser/ScreenshotOptions.js +2 -0
- package/dist/browser/SecurityDetails.d.ts +55 -0
- package/dist/browser/SecurityDetails.js +95 -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/Tracing.d.ts +45 -0
- package/dist/browser/Tracing.js +136 -0
- package/dist/browser/USKeyboardLayout.d.ts +39 -0
- package/dist/browser/USKeyboardLayout.js +406 -0
- package/dist/browser/WebWorker.d.ts +96 -0
- package/dist/browser/WebWorker.js +122 -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 +140 -0
- package/dist/browser/dialog.d.ts +70 -0
- package/dist/browser/dialog.js +114 -0
- package/dist/browser/environment.d.ts +16 -0
- package/dist/browser/environment.js +19 -0
- package/dist/browser/fetch.d.ts +16 -0
- package/dist/browser/fetch.js +46 -0
- package/dist/browser/find-up.d.ts +4 -0
- package/dist/browser/find-up.js +85 -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/page.d.ts +78 -0
- package/dist/browser/page.js +277 -0
- package/dist/browser/pkg-dir.d.ts +3 -0
- package/dist/browser/pkg-dir.js +13 -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/browser-log.d.ts.map +1 -0
- package/dist/browser-log.js.map +1 -0
- package/dist/calculate-ffmpeg-filters.d.ts.map +1 -0
- package/dist/calculate-ffmpeg-filters.js +2 -2
- package/dist/calculate-ffmpeg-filters.js.map +1 -0
- package/dist/can-use-parallel-encoding.d.ts.map +1 -0
- package/dist/can-use-parallel-encoding.js.map +1 -0
- package/dist/chunk.d.ts.map +1 -0
- package/dist/chunk.js.map +1 -0
- package/dist/combine-videos.d.ts +2 -1
- package/dist/combine-videos.d.ts.map +1 -0
- package/dist/combine-videos.js +8 -1
- package/dist/combine-videos.js.map +1 -0
- package/dist/convert-to-pcm.d.ts.map +1 -0
- package/dist/convert-to-pcm.js.map +1 -0
- package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
- package/dist/create-ffmpeg-complex-filter.d.ts.map +1 -0
- package/dist/create-ffmpeg-complex-filter.js.map +1 -0
- package/dist/create-ffmpeg-merge-filter.d.ts.map +1 -0
- package/dist/create-ffmpeg-merge-filter.js.map +1 -0
- package/dist/create-silent-audio.d.ts.map +1 -0
- package/dist/create-silent-audio.js.map +1 -0
- package/dist/cycle-browser-tabs.d.ts +2 -1
- package/dist/cycle-browser-tabs.d.ts.map +1 -0
- package/dist/cycle-browser-tabs.js +9 -2
- package/dist/cycle-browser-tabs.js.map +1 -0
- package/dist/delay-render-embedded-stack.d.ts.map +1 -0
- package/dist/delay-render-embedded-stack.js.map +1 -0
- package/dist/delete-directory.d.ts.map +1 -0
- package/dist/delete-directory.js.map +1 -0
- package/dist/ensure-frames-in-order.d.ts.map +1 -0
- package/dist/ensure-frames-in-order.js.map +1 -0
- package/dist/ensure-output-directory.d.ts.map +1 -0
- package/dist/ensure-output-directory.js.map +1 -0
- package/dist/ensure-presentation-timestamp.d.ts +1 -0
- package/dist/ensure-presentation-timestamp.js +57 -0
- package/dist/error-handling/handle-javascript-exception.d.ts.map +1 -0
- package/dist/error-handling/handle-javascript-exception.js.map +1 -0
- package/dist/error-handling/symbolicate-error.d.ts.map +1 -0
- package/dist/error-handling/symbolicate-error.js.map +1 -0
- package/dist/error-handling/symbolicateable-error.d.ts.map +1 -0
- package/dist/error-handling/symbolicateable-error.js.map +1 -0
- package/dist/extract-frame-from-video.d.ts +11 -0
- package/dist/extract-frame-from-video.js +197 -0
- package/dist/ffmpeg-filter-file.d.ts.map +1 -0
- package/dist/ffmpeg-filter-file.js.map +1 -0
- package/dist/ffmpeg-flags.d.ts.map +1 -0
- package/dist/ffmpeg-flags.js.map +1 -0
- package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
- package/dist/frame-to-ffmpeg-timestamp.js +8 -0
- package/dist/get-audio-codec-name.d.ts.map +1 -0
- package/dist/get-audio-codec-name.js.map +1 -0
- package/dist/get-browser-instance.d.ts.map +1 -0
- package/dist/get-browser-instance.js.map +1 -0
- package/dist/get-codec-name.d.ts.map +1 -0
- package/dist/get-codec-name.js.map +1 -0
- package/dist/get-compositions.d.ts +5 -2
- package/dist/get-compositions.d.ts.map +1 -0
- package/dist/get-compositions.js +23 -5
- package/dist/get-compositions.js.map +1 -0
- package/dist/get-concurrency.d.ts.map +1 -0
- package/dist/get-concurrency.js.map +1 -0
- package/dist/get-duration-from-frame-range.d.ts.map +1 -0
- package/dist/get-duration-from-frame-range.js.map +1 -0
- package/dist/get-duration-of-asset.d.ts +7 -0
- package/dist/get-duration-of-asset.js +36 -0
- package/dist/get-extension-from-codec.d.ts.map +1 -0
- package/dist/get-extension-from-codec.js.map +1 -0
- package/dist/get-frame-to-render.d.ts.map +1 -0
- package/dist/get-frame-to-render.js.map +1 -0
- package/dist/get-local-browser-executable.d.ts.map +1 -0
- package/dist/get-local-browser-executable.js.map +1 -0
- package/dist/get-port.d.ts.map +1 -0
- package/dist/get-port.js +26 -24
- package/dist/get-port.js.map +1 -0
- package/dist/get-prores-profile-name.d.ts.map +1 -0
- package/dist/get-prores-profile-name.js.map +1 -0
- package/dist/image-format.d.ts.map +1 -0
- package/dist/image-format.js.map +1 -0
- package/dist/index.d.ts +33 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -0
- package/dist/is-beyond-last-frame.d.ts +2 -0
- package/dist/is-beyond-last-frame.js +12 -0
- package/dist/is-serve-url.d.ts.map +1 -0
- package/dist/is-serve-url.js.map +1 -0
- package/dist/last-frame-from-video-cache.d.ts +10 -0
- package/dist/last-frame-from-video-cache.js +50 -0
- package/dist/legacy-webpack-config.d.ts.map +1 -0
- package/dist/legacy-webpack-config.js.map +1 -0
- package/dist/make-assets-download-dir.d.ts.map +1 -0
- package/dist/make-assets-download-dir.js +6 -1
- package/dist/make-assets-download-dir.js.map +1 -0
- package/dist/make-cancel-signal.d.ts +7 -0
- package/dist/make-cancel-signal.js +25 -0
- package/dist/merge-audio-track.d.ts.map +1 -0
- package/dist/merge-audio-track.js +2 -2
- package/dist/merge-audio-track.js.map +1 -0
- package/dist/normalize-serve-url.d.ts.map +1 -0
- package/dist/normalize-serve-url.js.map +1 -0
- package/dist/offthread-video-server.d.ts +14 -0
- package/dist/offthread-video-server.js +67 -0
- package/dist/open-browser.d.ts +5 -5
- package/dist/open-browser.d.ts.map +1 -0
- package/dist/open-browser.js +3 -3
- package/dist/open-browser.js.map +1 -0
- package/dist/p-limit.d.ts.map +1 -0
- package/dist/p-limit.js.map +1 -0
- package/dist/parse-browser-error-stack.d.ts.map +1 -0
- package/dist/parse-browser-error-stack.js.map +1 -0
- package/dist/parse-ffmpeg-progress.d.ts.map +1 -0
- package/dist/parse-ffmpeg-progress.js.map +1 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js.map +1 -0
- package/dist/prepare-server.d.ts +13 -2
- package/dist/prepare-server.d.ts.map +1 -0
- package/dist/prepare-server.js +35 -5
- package/dist/prepare-server.js.map +1 -0
- package/dist/preprocess-audio-track.d.ts +1 -0
- package/dist/preprocess-audio-track.d.ts.map +1 -0
- package/dist/preprocess-audio-track.js +2 -2
- package/dist/preprocess-audio-track.js.map +1 -0
- package/dist/prespawn-ffmpeg.d.ts +2 -0
- package/dist/prespawn-ffmpeg.d.ts.map +1 -0
- package/dist/prespawn-ffmpeg.js +10 -9
- package/dist/prespawn-ffmpeg.js.map +1 -0
- package/dist/provide-screenshot.d.ts +0 -1
- package/dist/provide-screenshot.d.ts.map +1 -0
- package/dist/provide-screenshot.js +1 -1
- package/dist/provide-screenshot.js.map +1 -0
- package/dist/puppeteer-evaluate.d.ts.map +1 -0
- package/dist/puppeteer-evaluate.js.map +1 -0
- package/dist/puppeteer-screenshot.d.ts +0 -1
- package/dist/puppeteer-screenshot.d.ts.map +1 -0
- package/dist/puppeteer-screenshot.js +5 -1
- package/dist/puppeteer-screenshot.js.map +1 -0
- package/dist/render-frames.d.ts +6 -1
- package/dist/render-frames.d.ts.map +1 -0
- package/dist/render-frames.js +96 -37
- package/dist/render-frames.js.map +1 -0
- package/dist/render-media.d.ts +12 -2
- package/dist/render-media.d.ts.map +1 -0
- package/dist/render-media.js +127 -54
- package/dist/render-media.js.map +1 -0
- package/dist/render-still.d.ts +14 -4
- package/dist/render-still.d.ts.map +1 -0
- package/dist/render-still.js +58 -19
- package/dist/render-still.js.map +1 -0
- package/dist/resolve-asset-src.d.ts.map +1 -0
- package/dist/resolve-asset-src.js.map +1 -0
- package/dist/sample-rate.d.ts.map +1 -0
- package/dist/sample-rate.js.map +1 -0
- package/dist/screenshot-dom-element.d.ts +0 -1
- package/dist/screenshot-dom-element.d.ts.map +1 -0
- package/dist/screenshot-dom-element.js.map +1 -0
- package/dist/screenshot-task.d.ts +0 -1
- package/dist/screenshot-task.d.ts.map +1 -0
- package/dist/screenshot-task.js.map +1 -0
- package/dist/seek-to-frame.d.ts.map +1 -0
- package/dist/seek-to-frame.js.map +1 -0
- package/dist/serve-handler/glob-slash.d.ts +1 -0
- package/dist/serve-handler/glob-slash.js +12 -0
- package/dist/serve-handler/index.d.ts +4 -0
- package/dist/serve-handler/index.js +205 -0
- package/dist/serve-handler/is-path-inside.d.ts +1 -0
- package/dist/serve-handler/is-path-inside.js +27 -0
- package/dist/serve-handler/range-parser.d.ts +13 -0
- package/dist/serve-handler/range-parser.js +57 -0
- package/dist/serve-static.d.ts +10 -3
- package/dist/serve-static.d.ts.map +1 -0
- package/dist/serve-static.js +22 -4
- package/dist/serve-static.js.map +1 -0
- package/dist/set-props-and-env.d.ts +3 -1
- package/dist/set-props-and-env.d.ts.map +1 -0
- package/dist/set-props-and-env.js +25 -3
- package/dist/set-props-and-env.js.map +1 -0
- package/dist/stitch-frames-to-video.d.ts +4 -1
- package/dist/stitch-frames-to-video.d.ts.map +1 -0
- package/dist/stitch-frames-to-video.js +36 -15
- package/dist/stitch-frames-to-video.js.map +1 -0
- package/dist/stringify-ffmpeg-filter.d.ts.map +1 -0
- package/dist/stringify-ffmpeg-filter.js +3 -0
- package/dist/stringify-ffmpeg-filter.js.map +1 -0
- package/dist/symbolicate-stacktrace.d.ts.map +1 -0
- package/dist/symbolicate-stacktrace.js.map +1 -0
- package/dist/tmp-dir.d.ts.map +1 -0
- package/dist/tmp-dir.js +5 -1
- package/dist/tmp-dir.js.map +1 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js.map +1 -0
- package/dist/validate-even-dimensions-with-codec.d.ts.map +1 -0
- package/dist/validate-even-dimensions-with-codec.js.map +1 -0
- package/dist/validate-ffmpeg.d.ts.map +1 -0
- package/dist/validate-ffmpeg.js.map +1 -0
- package/dist/validate-fps-for-gif.d.ts +2 -0
- package/dist/validate-fps-for-gif.js +9 -0
- package/dist/validate-puppeteer-timeout.d.ts.map +1 -0
- package/dist/validate-puppeteer-timeout.js.map +1 -0
- package/dist/validate-scale.d.ts.map +1 -0
- package/dist/validate-scale.js.map +1 -0
- package/package.json +6 -7
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
import { Protocol } from 'devtools-protocol';
|
|
17
|
+
import { CDPSession } from './Connection';
|
|
18
|
+
import { ConsoleMessageType } from './ConsoleMessage';
|
|
19
|
+
import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes';
|
|
20
|
+
import { EventEmitter } from './EventEmitter';
|
|
21
|
+
import { ExecutionContext } from './ExecutionContext';
|
|
22
|
+
import { JSHandle } from './JSHandle';
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare type ConsoleAPICalledCallback = (eventType: ConsoleMessageType, handles: JSHandle[], trace: Protocol.Runtime.StackTrace) => void;
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare type ExceptionThrownCallback = (details: Protocol.Runtime.ExceptionDetails) => void;
|
|
31
|
+
/**
|
|
32
|
+
* The WebWorker class represents a
|
|
33
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* The events `workercreated` and `workerdestroyed` are emitted on the page
|
|
37
|
+
* object to signal the worker lifecycle.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```js
|
|
41
|
+
* page.on('workercreated', worker => console.log('Worker created: ' + worker.url()));
|
|
42
|
+
* page.on('workerdestroyed', worker => console.log('Worker destroyed: ' + worker.url()));
|
|
43
|
+
*
|
|
44
|
+
* console.log('Current workers:');
|
|
45
|
+
* for (const worker of page.workers()) {
|
|
46
|
+
* console.log(' ' + worker.url());
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export declare class WebWorker extends EventEmitter {
|
|
53
|
+
#private;
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
constructor(client: CDPSession, url: string, consoleAPICalled: ConsoleAPICalledCallback, exceptionThrown: ExceptionThrownCallback);
|
|
59
|
+
/**
|
|
60
|
+
* @returns The URL of this web worker.
|
|
61
|
+
*/
|
|
62
|
+
url(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the ExecutionContext the WebWorker runs in
|
|
65
|
+
* @returns The ExecutionContext the web worker runs in.
|
|
66
|
+
*/
|
|
67
|
+
executionContext(): Promise<ExecutionContext>;
|
|
68
|
+
/**
|
|
69
|
+
* If the function passed to the `worker.evaluate` returns a Promise, then
|
|
70
|
+
* `worker.evaluate` would wait for the promise to resolve and return its
|
|
71
|
+
* value. If the function passed to the `worker.evaluate` returns a
|
|
72
|
+
* non-serializable value, then `worker.evaluate` resolves to `undefined`.
|
|
73
|
+
* DevTools Protocol also supports transferring some additional values that
|
|
74
|
+
* are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and
|
|
75
|
+
* bigint literals.
|
|
76
|
+
* Shortcut for `await worker.executionContext()).evaluate(pageFunction, ...args)`.
|
|
77
|
+
*
|
|
78
|
+
* @param pageFunction - Function to be evaluated in the worker context.
|
|
79
|
+
* @param args - Arguments to pass to `pageFunction`.
|
|
80
|
+
* @returns Promise which resolves to the return value of `pageFunction`.
|
|
81
|
+
*/
|
|
82
|
+
evaluate<ReturnType>(pageFunction: Function | string, ...args: any[]): Promise<ReturnType>;
|
|
83
|
+
/**
|
|
84
|
+
* The only difference between `worker.evaluate` and `worker.evaluateHandle`
|
|
85
|
+
* is that `worker.evaluateHandle` returns in-page object (JSHandle). If the
|
|
86
|
+
* function passed to the `worker.evaluateHandle` returns a `Promise`, then
|
|
87
|
+
* `worker.evaluateHandle` would wait for the promise to resolve and return
|
|
88
|
+
* its value. Shortcut for
|
|
89
|
+
* `await worker.executionContext()).evaluateHandle(pageFunction, ...args)`
|
|
90
|
+
*
|
|
91
|
+
* @param pageFunction - Function to be evaluated in the page context.
|
|
92
|
+
* @param args - Arguments to pass to `pageFunction`.
|
|
93
|
+
* @returns Promise which resolves to the return value of `pageFunction`.
|
|
94
|
+
*/
|
|
95
|
+
evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
|
|
96
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
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 _WebWorker_client, _WebWorker_url, _WebWorker_executionContextPromise, _WebWorker_executionContextCallback;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.WebWorker = void 0;
|
|
16
|
+
const EventEmitter_1 = require("./EventEmitter");
|
|
17
|
+
const ExecutionContext_1 = require("./ExecutionContext");
|
|
18
|
+
const JSHandle_1 = require("./JSHandle");
|
|
19
|
+
const util_1 = require("./util");
|
|
20
|
+
/**
|
|
21
|
+
* The WebWorker class represents a
|
|
22
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* The events `workercreated` and `workerdestroyed` are emitted on the page
|
|
26
|
+
* object to signal the worker lifecycle.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```js
|
|
30
|
+
* page.on('workercreated', worker => console.log('Worker created: ' + worker.url()));
|
|
31
|
+
* page.on('workerdestroyed', worker => console.log('Worker destroyed: ' + worker.url()));
|
|
32
|
+
*
|
|
33
|
+
* console.log('Current workers:');
|
|
34
|
+
* for (const worker of page.workers()) {
|
|
35
|
+
* console.log(' ' + worker.url());
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
class WebWorker extends EventEmitter_1.EventEmitter {
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
constructor(client, url, consoleAPICalled, exceptionThrown) {
|
|
47
|
+
super();
|
|
48
|
+
_WebWorker_client.set(this, void 0);
|
|
49
|
+
_WebWorker_url.set(this, void 0);
|
|
50
|
+
_WebWorker_executionContextPromise.set(this, void 0);
|
|
51
|
+
_WebWorker_executionContextCallback.set(this, void 0);
|
|
52
|
+
__classPrivateFieldSet(this, _WebWorker_client, client, "f");
|
|
53
|
+
__classPrivateFieldSet(this, _WebWorker_url, url, "f");
|
|
54
|
+
__classPrivateFieldSet(this, _WebWorker_executionContextPromise, new Promise((x) => {
|
|
55
|
+
__classPrivateFieldSet(this, _WebWorker_executionContextCallback, x, "f");
|
|
56
|
+
}), "f");
|
|
57
|
+
let jsHandleFactory;
|
|
58
|
+
__classPrivateFieldGet(this, _WebWorker_client, "f").once('Runtime.executionContextCreated', async (event) => {
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
60
|
+
jsHandleFactory = (remoteObject) => {
|
|
61
|
+
return new JSHandle_1.JSHandle(executionContext, client, remoteObject);
|
|
62
|
+
};
|
|
63
|
+
const executionContext = new ExecutionContext_1.ExecutionContext(client, event.context);
|
|
64
|
+
__classPrivateFieldGet(this, _WebWorker_executionContextCallback, "f").call(this, executionContext);
|
|
65
|
+
});
|
|
66
|
+
// This might fail if the target is closed before we receive all execution contexts.
|
|
67
|
+
__classPrivateFieldGet(this, _WebWorker_client, "f").send('Runtime.enable').catch(util_1.debugError);
|
|
68
|
+
__classPrivateFieldGet(this, _WebWorker_client, "f").on('Runtime.consoleAPICalled', (event) => {
|
|
69
|
+
return consoleAPICalled(event.type, event.args.map(jsHandleFactory), event.stackTrace);
|
|
70
|
+
});
|
|
71
|
+
__classPrivateFieldGet(this, _WebWorker_client, "f").on('Runtime.exceptionThrown', (exception) => {
|
|
72
|
+
return exceptionThrown(exception.exceptionDetails);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @returns The URL of this web worker.
|
|
77
|
+
*/
|
|
78
|
+
url() {
|
|
79
|
+
return __classPrivateFieldGet(this, _WebWorker_url, "f");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Returns the ExecutionContext the WebWorker runs in
|
|
83
|
+
* @returns The ExecutionContext the web worker runs in.
|
|
84
|
+
*/
|
|
85
|
+
async executionContext() {
|
|
86
|
+
return __classPrivateFieldGet(this, _WebWorker_executionContextPromise, "f");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* If the function passed to the `worker.evaluate` returns a Promise, then
|
|
90
|
+
* `worker.evaluate` would wait for the promise to resolve and return its
|
|
91
|
+
* value. If the function passed to the `worker.evaluate` returns a
|
|
92
|
+
* non-serializable value, then `worker.evaluate` resolves to `undefined`.
|
|
93
|
+
* DevTools Protocol also supports transferring some additional values that
|
|
94
|
+
* are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and
|
|
95
|
+
* bigint literals.
|
|
96
|
+
* Shortcut for `await worker.executionContext()).evaluate(pageFunction, ...args)`.
|
|
97
|
+
*
|
|
98
|
+
* @param pageFunction - Function to be evaluated in the worker context.
|
|
99
|
+
* @param args - Arguments to pass to `pageFunction`.
|
|
100
|
+
* @returns Promise which resolves to the return value of `pageFunction`.
|
|
101
|
+
*/
|
|
102
|
+
async evaluate(pageFunction, ...args) {
|
|
103
|
+
return (await __classPrivateFieldGet(this, _WebWorker_executionContextPromise, "f")).evaluate(pageFunction, ...args);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The only difference between `worker.evaluate` and `worker.evaluateHandle`
|
|
107
|
+
* is that `worker.evaluateHandle` returns in-page object (JSHandle). If the
|
|
108
|
+
* function passed to the `worker.evaluateHandle` returns a `Promise`, then
|
|
109
|
+
* `worker.evaluateHandle` would wait for the promise to resolve and return
|
|
110
|
+
* its value. Shortcut for
|
|
111
|
+
* `await worker.executionContext()).evaluateHandle(pageFunction, ...args)`
|
|
112
|
+
*
|
|
113
|
+
* @param pageFunction - Function to be evaluated in the page context.
|
|
114
|
+
* @param args - Arguments to pass to `pageFunction`.
|
|
115
|
+
* @returns Promise which resolves to the return value of `pageFunction`.
|
|
116
|
+
*/
|
|
117
|
+
async evaluateHandle(pageFunction, ...args) {
|
|
118
|
+
return (await __classPrivateFieldGet(this, _WebWorker_executionContextPromise, "f")).evaluateHandle(pageFunction, ...args);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.WebWorker = WebWorker;
|
|
122
|
+
_WebWorker_client = new WeakMap(), _WebWorker_url = new WeakMap(), _WebWorker_executionContextPromise = new WeakMap(), _WebWorker_executionContextCallback = 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,140 @@
|
|
|
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 progress_1 = __importDefault(require("progress"));
|
|
24
|
+
const node_1 = require("./node");
|
|
25
|
+
const revisions_1 = require("./revisions");
|
|
26
|
+
const supportedProducts = {
|
|
27
|
+
chrome: 'Chromium',
|
|
28
|
+
firefox: 'Firefox Nightly',
|
|
29
|
+
};
|
|
30
|
+
async function downloadBrowser(product) {
|
|
31
|
+
const browserFetcher = node_1.puppeteer.createBrowserFetcher({
|
|
32
|
+
product,
|
|
33
|
+
path: null,
|
|
34
|
+
platform: null,
|
|
35
|
+
});
|
|
36
|
+
const revision = await getRevision();
|
|
37
|
+
await fetchBinary(revision);
|
|
38
|
+
async function getRevision() {
|
|
39
|
+
if (product === 'chrome') {
|
|
40
|
+
return Promise.resolve(revisions_1.PUPPETEER_REVISIONS.chromium);
|
|
41
|
+
}
|
|
42
|
+
if (product === 'firefox') {
|
|
43
|
+
node_1.puppeteer._preferredRevision = revisions_1.PUPPETEER_REVISIONS.firefox;
|
|
44
|
+
try {
|
|
45
|
+
return await getFirefoxNightlyVersion();
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error(error);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Unsupported product ${product}`);
|
|
53
|
+
}
|
|
54
|
+
function fetchBinary(_revision) {
|
|
55
|
+
const revisionInfo = browserFetcher.revisionInfo(_revision);
|
|
56
|
+
// Do nothing if the revision is already downloaded.
|
|
57
|
+
if (revisionInfo.local) {
|
|
58
|
+
logPolitely(`${supportedProducts[product]} is already in ${revisionInfo.folderPath}; skipping download.`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
function onSuccess(localRevisions) {
|
|
62
|
+
logPolitely(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
|
|
63
|
+
localRevisions = localRevisions.filter((__revision) => {
|
|
64
|
+
return __revision !== revisionInfo.revision;
|
|
65
|
+
});
|
|
66
|
+
const cleanupOldVersions = localRevisions.map((__revision) => {
|
|
67
|
+
return browserFetcher.remove(__revision);
|
|
68
|
+
});
|
|
69
|
+
Promise.all([...cleanupOldVersions]);
|
|
70
|
+
}
|
|
71
|
+
function onError(error) {
|
|
72
|
+
console.error(`ERROR: Failed to set up ${supportedProducts[product]} r${_revision}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`);
|
|
73
|
+
console.error(error);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
let progressBar = null;
|
|
77
|
+
let lastDownloadedBytes = 0;
|
|
78
|
+
function onProgress(downloadedBytes, totalBytes) {
|
|
79
|
+
if (!progressBar) {
|
|
80
|
+
progressBar = new progress_1.default(`Downloading ${supportedProducts[product]} r${_revision} - ${toMegabytes(totalBytes)} [:bar] :percent :etas `, {
|
|
81
|
+
complete: '=',
|
|
82
|
+
incomplete: ' ',
|
|
83
|
+
width: 20,
|
|
84
|
+
total: totalBytes,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const delta = downloadedBytes - lastDownloadedBytes;
|
|
88
|
+
lastDownloadedBytes = downloadedBytes;
|
|
89
|
+
progressBar.tick(delta);
|
|
90
|
+
}
|
|
91
|
+
return browserFetcher
|
|
92
|
+
.download(revisionInfo.revision, onProgress)
|
|
93
|
+
.then(() => {
|
|
94
|
+
return browserFetcher.localRevisions();
|
|
95
|
+
})
|
|
96
|
+
.then(onSuccess)
|
|
97
|
+
.catch(onError);
|
|
98
|
+
}
|
|
99
|
+
function toMegabytes(bytes) {
|
|
100
|
+
const mb = bytes / 1024 / 1024;
|
|
101
|
+
return `${Math.round(mb * 10) / 10} Mb`;
|
|
102
|
+
}
|
|
103
|
+
function getFirefoxNightlyVersion() {
|
|
104
|
+
const firefoxVersionsUrl = 'https://product-details.mozilla.org/1.0/firefox_versions.json';
|
|
105
|
+
const requestOptions = {};
|
|
106
|
+
const promise = new Promise((resolve, reject) => {
|
|
107
|
+
let data = '';
|
|
108
|
+
logPolitely(`Requesting latest Firefox Nightly version from ${firefoxVersionsUrl}`);
|
|
109
|
+
https_1.default
|
|
110
|
+
.get(firefoxVersionsUrl, requestOptions, (r) => {
|
|
111
|
+
if (r.statusCode && r.statusCode >= 400) {
|
|
112
|
+
return reject(new Error(`Got status code ${r.statusCode}`));
|
|
113
|
+
}
|
|
114
|
+
r.on('data', (chunk) => {
|
|
115
|
+
data += chunk;
|
|
116
|
+
});
|
|
117
|
+
r.on('end', () => {
|
|
118
|
+
try {
|
|
119
|
+
const versions = JSON.parse(data);
|
|
120
|
+
return resolve(versions.FIREFOX_NIGHTLY);
|
|
121
|
+
}
|
|
122
|
+
catch (_a) {
|
|
123
|
+
return reject(new Error('Firefox version not found'));
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
})
|
|
127
|
+
.on('error', reject);
|
|
128
|
+
});
|
|
129
|
+
return promise;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.downloadBrowser = downloadBrowser;
|
|
133
|
+
function logPolitely(toBeLogged) {
|
|
134
|
+
const logLevel = process.env.npm_config_loglevel || '';
|
|
135
|
+
const logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1;
|
|
136
|
+
// eslint-disable-next-line no-console
|
|
137
|
+
if (!logLevelDisplay) {
|
|
138
|
+
console.log(toBeLogged);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
/**
|
|
19
|
+
* Dialog instances are dispatched by the {@link Page} via the `dialog` event.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```js
|
|
25
|
+
* const puppeteer = require('puppeteer');
|
|
26
|
+
*
|
|
27
|
+
* (async () => {
|
|
28
|
+
* const browser = await puppeteer.launch();
|
|
29
|
+
* const page = await browser.newPage();
|
|
30
|
+
* page.on('dialog', async dialog => {
|
|
31
|
+
* console.log(dialog.message());
|
|
32
|
+
* await dialog.dismiss();
|
|
33
|
+
* await browser.close();
|
|
34
|
+
* });
|
|
35
|
+
* page.evaluate(() => alert('1'));
|
|
36
|
+
* })();
|
|
37
|
+
* ```
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare class Dialog {
|
|
41
|
+
#private;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
constructor(client: CDPSession, type: Protocol.Page.DialogType, message: string, defaultValue?: string);
|
|
46
|
+
/**
|
|
47
|
+
* @returns The type of the dialog.
|
|
48
|
+
*/
|
|
49
|
+
type(): Protocol.Page.DialogType;
|
|
50
|
+
/**
|
|
51
|
+
* @returns The message displayed in the dialog.
|
|
52
|
+
*/
|
|
53
|
+
message(): string;
|
|
54
|
+
/**
|
|
55
|
+
* @returns The default value of the prompt, or an empty string if the dialog
|
|
56
|
+
* is not a `prompt`.
|
|
57
|
+
*/
|
|
58
|
+
defaultValue(): string;
|
|
59
|
+
/**
|
|
60
|
+
* @param promptText - optional text that will be entered in the dialog
|
|
61
|
+
* prompt. Has no effect if the dialog's type is not `prompt`.
|
|
62
|
+
*
|
|
63
|
+
* @returns A promise that resolves when the dialog has been accepted.
|
|
64
|
+
*/
|
|
65
|
+
accept(promptText?: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* @returns A promise which will resolve once the dialog has been dismissed
|
|
68
|
+
*/
|
|
69
|
+
dismiss(): Promise<void>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2017 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 _Dialog_client, _Dialog_type, _Dialog_message, _Dialog_defaultValue, _Dialog_handled;
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.Dialog = void 0;
|
|
31
|
+
const assert_1 = require("./assert");
|
|
32
|
+
/**
|
|
33
|
+
* Dialog instances are dispatched by the {@link Page} via the `dialog` event.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```js
|
|
39
|
+
* const puppeteer = require('puppeteer');
|
|
40
|
+
*
|
|
41
|
+
* (async () => {
|
|
42
|
+
* const browser = await puppeteer.launch();
|
|
43
|
+
* const page = await browser.newPage();
|
|
44
|
+
* page.on('dialog', async dialog => {
|
|
45
|
+
* console.log(dialog.message());
|
|
46
|
+
* await dialog.dismiss();
|
|
47
|
+
* await browser.close();
|
|
48
|
+
* });
|
|
49
|
+
* page.evaluate(() => alert('1'));
|
|
50
|
+
* })();
|
|
51
|
+
* ```
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
class Dialog {
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
constructor(client, type, message, defaultValue = '') {
|
|
59
|
+
_Dialog_client.set(this, void 0);
|
|
60
|
+
_Dialog_type.set(this, void 0);
|
|
61
|
+
_Dialog_message.set(this, void 0);
|
|
62
|
+
_Dialog_defaultValue.set(this, void 0);
|
|
63
|
+
_Dialog_handled.set(this, false);
|
|
64
|
+
__classPrivateFieldSet(this, _Dialog_client, client, "f");
|
|
65
|
+
__classPrivateFieldSet(this, _Dialog_type, type, "f");
|
|
66
|
+
__classPrivateFieldSet(this, _Dialog_message, message, "f");
|
|
67
|
+
__classPrivateFieldSet(this, _Dialog_defaultValue, defaultValue, "f");
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @returns The type of the dialog.
|
|
71
|
+
*/
|
|
72
|
+
type() {
|
|
73
|
+
return __classPrivateFieldGet(this, _Dialog_type, "f");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @returns The message displayed in the dialog.
|
|
77
|
+
*/
|
|
78
|
+
message() {
|
|
79
|
+
return __classPrivateFieldGet(this, _Dialog_message, "f");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @returns The default value of the prompt, or an empty string if the dialog
|
|
83
|
+
* is not a `prompt`.
|
|
84
|
+
*/
|
|
85
|
+
defaultValue() {
|
|
86
|
+
return __classPrivateFieldGet(this, _Dialog_defaultValue, "f");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @param promptText - optional text that will be entered in the dialog
|
|
90
|
+
* prompt. Has no effect if the dialog's type is not `prompt`.
|
|
91
|
+
*
|
|
92
|
+
* @returns A promise that resolves when the dialog has been accepted.
|
|
93
|
+
*/
|
|
94
|
+
async accept(promptText) {
|
|
95
|
+
(0, assert_1.assert)(!__classPrivateFieldGet(this, _Dialog_handled, "f"), 'Cannot accept dialog which is already handled!');
|
|
96
|
+
__classPrivateFieldSet(this, _Dialog_handled, true, "f");
|
|
97
|
+
await __classPrivateFieldGet(this, _Dialog_client, "f").send('Page.handleJavaScriptDialog', {
|
|
98
|
+
accept: true,
|
|
99
|
+
promptText,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @returns A promise which will resolve once the dialog has been dismissed
|
|
104
|
+
*/
|
|
105
|
+
async dismiss() {
|
|
106
|
+
(0, assert_1.assert)(!__classPrivateFieldGet(this, _Dialog_handled, "f"), 'Cannot dismiss dialog which is already handled!');
|
|
107
|
+
__classPrivateFieldSet(this, _Dialog_handled, true, "f");
|
|
108
|
+
await __classPrivateFieldGet(this, _Dialog_client, "f").send('Page.handleJavaScriptDialog', {
|
|
109
|
+
accept: false,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.Dialog = Dialog;
|
|
114
|
+
_Dialog_client = new WeakMap(), _Dialog_type = new WeakMap(), _Dialog_message = new WeakMap(), _Dialog_defaultValue = new WeakMap(), _Dialog_handled = new WeakMap();
|
|
@@ -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);
|