2022-09-19 10:49:13 +00:00
|
|
|
/**
|
|
|
|
* Copyright 2022 Google Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-10-21 13:09:21 +00:00
|
|
|
import {Product} from './Product.js';
|
2022-05-09 11:17:24 +00:00
|
|
|
|
2022-06-27 07:24:23 +00:00
|
|
|
/**
|
2022-10-24 07:07:05 +00:00
|
|
|
* Defines experiment options for Puppeteer.
|
|
|
|
*
|
|
|
|
* See individual properties for more information.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
*/
|
2023-05-02 06:53:40 +00:00
|
|
|
export type ExperimentsConfiguration = Record<string, never>;
|
2022-10-24 07:07:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines options to configure Puppeteer's behavior during installation and
|
|
|
|
* runtime.
|
|
|
|
*
|
|
|
|
* See individual properties for more information.
|
|
|
|
*
|
2022-10-21 13:09:21 +00:00
|
|
|
* @public
|
2022-06-27 07:24:23 +00:00
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
export interface Configuration {
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Specifies a certain version of the browser you'd like Puppeteer to use.
|
|
|
|
*
|
|
|
|
* Can be overridden by `PUPPETEER_BROWSER_REVISION`.
|
|
|
|
*
|
|
|
|
* See {@link PuppeteerNode.launch | puppeteer.launch} on how executable path
|
|
|
|
* is inferred.
|
|
|
|
*
|
|
|
|
* @defaultValue A compatible-revision of the browser.
|
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
browserRevision?: string;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Defines the directory to be used by Puppeteer for caching.
|
|
|
|
*
|
|
|
|
* Can be overridden by `PUPPETEER_CACHE_DIR`.
|
|
|
|
*
|
|
|
|
* @defaultValue `path.join(os.homedir(), '.cache', 'puppeteer')`
|
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
cacheDirectory?: string;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
2023-05-02 06:53:40 +00:00
|
|
|
* Specifies the URL prefix that is used to download the browser.
|
2022-10-24 07:07:05 +00:00
|
|
|
*
|
2023-05-05 08:32:58 +00:00
|
|
|
* Can be overridden by `PUPPETEER_DOWNLOAD_BASE_URL`.
|
2022-10-24 07:07:05 +00:00
|
|
|
*
|
|
|
|
* @remarks
|
|
|
|
* This must include the protocol and may even need a path prefix.
|
|
|
|
*
|
2023-05-05 08:32:58 +00:00
|
|
|
* @defaultValue Either https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing or
|
2022-10-24 07:07:05 +00:00
|
|
|
* https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central,
|
|
|
|
* depending on the product.
|
|
|
|
*/
|
2023-05-05 08:32:58 +00:00
|
|
|
downloadBaseUrl?: string;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Specifies the path for the downloads folder.
|
|
|
|
*
|
|
|
|
* Can be overridden by `PUPPETEER_DOWNLOAD_PATH`.
|
|
|
|
*
|
2023-05-11 17:09:24 +00:00
|
|
|
* @defaultValue `<cacheDirectory>`
|
2022-10-24 07:07:05 +00:00
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
downloadPath?: string;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Specifies an executable path to be used in
|
|
|
|
* {@link PuppeteerNode.launch | puppeteer.launch}.
|
|
|
|
*
|
|
|
|
* Can be overridden by `PUPPETEER_EXECUTABLE_PATH`.
|
|
|
|
*
|
2023-03-29 13:27:29 +00:00
|
|
|
* @defaultValue **Auto-computed.**
|
2022-10-24 07:07:05 +00:00
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
executablePath?: string;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Specifies which browser you'd like Puppeteer to use.
|
|
|
|
*
|
|
|
|
* Can be overridden by `PUPPETEER_PRODUCT`.
|
|
|
|
*
|
2023-03-29 13:27:29 +00:00
|
|
|
* @defaultValue `chrome`
|
2022-10-24 07:07:05 +00:00
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
defaultProduct?: Product;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Defines the directory to be used by Puppeteer for creating temporary files.
|
|
|
|
*
|
|
|
|
* Can be overridden by `PUPPETEER_TMP_DIR`.
|
|
|
|
*
|
|
|
|
* @defaultValue `os.tmpdir()`
|
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
temporaryDirectory?: string;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Tells Puppeteer to not download during installation.
|
|
|
|
*
|
|
|
|
* Can be overridden by `PUPPETEER_SKIP_DOWNLOAD`.
|
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
skipDownload?: boolean;
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Tells Puppeteer to log at the given level.
|
|
|
|
*
|
2023-05-05 08:32:58 +00:00
|
|
|
* @defaultValue `warn`
|
2022-10-24 07:07:05 +00:00
|
|
|
*/
|
2022-10-21 13:09:21 +00:00
|
|
|
logLevel?: 'silent' | 'error' | 'warn';
|
2022-10-24 07:07:05 +00:00
|
|
|
/**
|
|
|
|
* Defines experimental options for Puppeteer.
|
|
|
|
*/
|
|
|
|
experiments?: ExperimentsConfiguration;
|
2022-10-21 13:09:21 +00:00
|
|
|
}
|