first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

6
node_modules/chrome-launcher/.clang-format generated vendored Normal file
View File

@@ -0,0 +1,6 @@
---
BasedOnStyle: Google
Language: JavaScript
ColumnLimit: 100
ReflowComments: false
SpacesBeforeTrailingComments: 1

56
node_modules/chrome-launcher/.github/workflows/ci.yml generated vendored Normal file
View File

@@ -0,0 +1,56 @@
name: 🛠
on:
push:
branches: [main]
pull_request: # run on all PRs, not just PRs to a particular branch
jobs:
basics:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 'latest', 'lts/*', 'lts/-1' ]
name: basics (node ${{ matrix.node }})
steps:
- name: git clone
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- run: yarn --frozen-lockfile --network-timeout 1000000
- run: yarn build
- run: yarn test-formatting
- run: yarn type-check
# Run tests that require headful Chrome.
- run: sudo apt-get install xvfb
- name: yarn test
run: xvfb-run --auto-servernum yarn test --reporter=spec
unit:
strategy:
matrix:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: unit_${{ matrix.os }}
steps:
- name: git clone
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn --frozen-lockfile --network-timeout 1000000
- run: yarn build
- run: yarn test --reporter=spec

View File

@@ -0,0 +1,48 @@
name: smoke
on:
push:
branches: [main]
pull_request: # run on all PRs, not just PRs to a particular branch
jobs:
# Only run smoke tests for windows against stable chrome.
lh-smoke-windows:
strategy:
matrix:
smoke-test-shard: [1, 2]
# e.g. if set 1 fails, continue with set 2 anyway
fail-fast: false
runs-on: windows-latest
name: Windows smoke ${{ matrix.smoke-test-shard }}/2
steps:
- name: git clone
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
# chrome-launcher
# This'll add lighthouse AND install chrome-launcher's deps
- run: yarn add --frozen-lockfile --network-timeout 1000000 -D https://github.com/GoogleChrome/lighthouse.git#main
- run: yarn build
# lighthouse
- run: yarn --cwd node_modules/lighthouse/ install --frozen-lockfile --network-timeout 1000000
- run: yarn reset-link
- run: yarn --cwd node_modules/lighthouse/ build-report
- name: Run smoke tests
# Windows bots are slow, so only run enough tests to verify matching behavior.
run: yarn --cwd node_modules/lighthouse/ smoke --debug -j=2 --retries=0 --shard=${{ matrix.smoke-test-shard }}/2 dbw oopif offline lantern metrics
- name: Upload failures
if: failure()
uses: actions/upload-artifact@v1
with:
name: Smokehouse (windows)
path: node_modules/lighthouse/.tmp/smokehouse-ci-failures/

202
node_modules/chrome-launcher/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2014 Google Inc.
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.

190
node_modules/chrome-launcher/README.md generated vendored Normal file
View File

@@ -0,0 +1,190 @@
# Chrome Launcher [![GitHub Actions Status Badge](https://github.com/GoogleChrome/chrome-launcher/workflows/🛠/badge.svg)](https://github.com/GoogleChrome/chrome-launcher/actions) [![NPM chrome-launcher package](https://img.shields.io/npm/v/chrome-launcher.svg)](https://npmjs.org/package/chrome-launcher)
<img src="https://user-images.githubusercontent.com/39191/29847271-a7ba82f8-8ccf-11e7-8d54-eb88fdf0b6d0.png" align=right height=200>
Launch Google Chrome with ease from node.
* [Disables many Chrome services](https://github.com/GoogleChrome/chrome-launcher/blob/main/src/flags.ts) that add noise to automated scenarios
* Opens up the browser's `remote-debugging-port` on an available port
* Automagically locates a Chrome binary to launch
* Uses a fresh Chrome profile for each launch, and cleans itself up on `kill()`
* Binds `Ctrl-C` (by default) to terminate the Chrome process
* Exposes a small set of [options](#api) for configurability over these details
Once launched, interacting with the browser must be done over the [devtools protocol](https://chromedevtools.github.io/devtools-protocol/), typically via [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface/). For many cases [Puppeteer](https://github.com/GoogleChrome/puppeteer) is recommended, though it has its own chrome launching mechanism.
### Installing
```sh
yarn add chrome-launcher
# or with npm:
npm install chrome-launcher
```
## API
### `.launch([opts])`
#### Launch options
```js
{
// (optional) remote debugging port number to use. If provided port is already busy, launch() will reject
// Default: an available port is autoselected
port: number;
// (optional) Additional flags to pass to Chrome, for example: ['--headless', '--disable-gpu']
// See: https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
// Do note, many flags are set by default: https://github.com/GoogleChrome/chrome-launcher/blob/main/src/flags.ts
chromeFlags: Array<string>;
// (optional) Additional preferences to be set in Chrome, for example: {'download.default_directory': __dirname}
// See: https://chromium.googlesource.com/chromium/src/+/main/chrome/common/pref_names.cc
// Do note, if you set preferences when using your default profile it will overwrite these
prefs: {[key: string]: Object};
// (optional) Close the Chrome process on `Ctrl-C`
// Default: true
handleSIGINT: boolean;
// (optional) Explicit path of intended Chrome binary
 // * If this `chromePath` option is defined, it will be used.
// * Otherwise, the `CHROME_PATH` env variable will be used if set. (`LIGHTHOUSE_CHROMIUM_PATH` is deprecated)
 // * Otherwise, a detected Chrome Canary will be used if found
// * Otherwise, a detected Chrome (stable) will be used
chromePath: string;
// (optional) Chrome profile path to use, if set to `false` then the default profile will be used.
// By default, a fresh Chrome profile will be created
userDataDir: string | boolean;
// (optional) Starting URL to open the browser with
// Default: `about:blank`
startingUrl: string;
// (optional) Logging level
// Default: 'silent'
logLevel: 'verbose'|'info'|'error'|'silent';
// (optional) Flags specific in [flags.ts](src/flags.ts) will not be included.
// Typically used with the defaultFlags() method and chromeFlags option.
// Default: false
ignoreDefaultFlags: boolean;
// (optional) Interval in ms, which defines how often launcher checks browser port to be ready.
// Default: 500
connectionPollInterval: number;
// (optional) A number of retries, before browser launch considered unsuccessful.
// Default: 50
maxConnectionRetries: number;
// (optional) A dict of environmental key value pairs to pass to the spawned chrome process.
envVars: {[key: string]: string};
};
```
#### Launched chrome interface
#### `.launch().then(chrome => ...`
```js
// The remote debugging port exposed by the launched chrome
chrome.port: number;
// Method to kill Chrome (and cleanup the profile folder)
chrome.kill: () => Promise<void>;
// The process id
chrome.pid: number;
// The childProcess object for the launched Chrome
chrome.process: childProcess
```
### `ChromeLauncher.Launcher.defaultFlags()`
Returns an `Array<string>` of the default [flags](docs/chrome-flags-for-tools.md) Chrome is launched with. Typically used along with the `ignoreDefaultFlags` and `chromeFlags` options.
Note: This array will exclude the following flags: `--remote-debugging-port` `--disable-setuid-sandbox` `--user-data-dir`.
### `ChromeLauncher.Launcher.getInstallations()`
Returns an `Array<string>` of paths to available Chrome installations. When `chromePath` is not provided to `.launch()`, the first installation returned from this method is used instead.
Note: This method performs synchronous I/O operations.
### `.killAll()`
Attempts to kill all Chrome instances created with [`.launch([opts])`](#launchopts). Returns a Promise that resolves to an array of errors that occurred while killing instances. If all instances were killed successfully, the array will be empty.
```js
const ChromeLauncher = require('chrome-launcher');
async function cleanup() {
await ChromeLauncher.killAll();
}
```
## Examples
#### Launching chrome:
```js
const ChromeLauncher = require('chrome-launcher');
ChromeLauncher.launch({
startingUrl: 'https://google.com'
}).then(chrome => {
console.log(`Chrome debugging port running on ${chrome.port}`);
});
```
#### Launching headless chrome:
```js
const ChromeLauncher = require('chrome-launcher');
ChromeLauncher.launch({
startingUrl: 'https://google.com',
chromeFlags: ['--headless', '--disable-gpu']
}).then(chrome => {
console.log(`Chrome debugging port running on ${chrome.port}`);
});
```
#### Launching with support for extensions and audio:
```js
const ChromeLauncher = require('chrome-launcher');
const newFlags = ChromeLauncher.Launcher.defaultFlags().filter(flag => flag !== '--disable-extensions' && flag !== '--mute-audio');
ChromeLauncher.launch({
ignoreDefaultFlags: true,
chromeFlags: newFlags,
}).then(chrome => { ... });
```
### Continuous Integration
In a CI environment like Travis, Chrome may not be installed. If you want to use `chrome-launcher`, Travis can [install Chrome at run time with an addon](https://docs.travis-ci.com/user/chrome). Alternatively, you can also install Chrome using the [`download-chrome.sh`](https://raw.githubusercontent.com/GoogleChrome/chrome-launcher/v0.8.0/scripts/download-chrome.sh) script.
Then in `.travis.yml`, use it like so:
```yaml
language: node_js
install:
- yarn install
before_script:
- export DISPLAY=:99.0
- export CHROME_PATH="$(pwd)/chrome-linux/chrome"
- sh -e /etc/init.d/xvfb start
- sleep 3 # wait for xvfb to boot
addons:
chrome: stable
```

16
node_modules/chrome-launcher/bin/print-chrome-path.js generated vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env node
/**
* @license Copyright 2021 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.
*/
'use strict';
/** @fileoverview Prints the Chrome path that chrome-launcher will use. */
const {getChromePath} = require('../dist/chrome-launcher.js');
const chromePath = getChromePath();
process.stdout.write(chromePath);
process.exit(0);

189
node_modules/chrome-launcher/changelog.md generated vendored Normal file
View File

@@ -0,0 +1,189 @@
## v0.15.1 (Tue, May 31 2022)
* `3724165a` make launcher.kill() synchronous ([#268](https://github.com/GoogleChrome/chrome-launcher/pull/268))
* `3561350a` revise taskkill procedure on windows ([#267](https://github.com/GoogleChrome/chrome-launcher/pull/267))
* `690ae983` add lighthouse smoketests (windows) to CI ([#265](https://github.com/GoogleChrome/chrome-launcher/pull/265))
* `279577fd` docs(chrome-flags-for-tools): add link to overview of features ([#235](https://github.com/GoogleChrome/chrome-launcher/pull/235))
* `ff91c18b` fix: use `wslpath` to resolve Windows paths ([#200](https://github.com/GoogleChrome/chrome-launcher/pull/200))
* `30755cde` test: run latest versions of node in CI ([#257](https://github.com/GoogleChrome/chrome-launcher/pull/257))
## v0.15.0 (Wed, Nov 10 2021)
* `1af60cb` add `getChromePath()` method for printing found chrome path ([#255](https://github.com/GoogleChrome/chrome-launcher/pull/255))
## v0.14.2 (Tue, Nov 2 2021)
* `ba8d76bd` fix chrome connection in node 17, use 127.0.0.1 explicitly ([#253](https://github.com/GoogleChrome/chrome-launcher/pull/253))
* `56731dd8` fix: forward support for fs.rm in node 14.14+ ([#242](https://github.com/GoogleChrome/chrome-launcher/pull/242))
## v0.14.1 (Wed, Oct 6 2021)
* `630bb77f` feat: set browser preferences ([#247](https://github.com/GoogleChrome/chrome-launcher/pull/247))
* `12b2c8e3` docs(flags): note that disable-gpu isnt needed
## v0.14.0 (Tue, May 18 2021)
* `ac1f4aff` move to minimum node 12; remove `rimraf` ([#237](https://github.com/GoogleChrome/chrome-launcher/pull/237))
* `dec646c4` deps: remove `mkdirp` for `fs.mkdirSync` ([#234](https://github.com/GoogleChrome/chrome-launcher/pull/234))
* `83ab178a` update minimum node version ([#222](https://github.com/GoogleChrome/chrome-launcher/pull/222))
* `a5f6eb2f` add additional chrome flags ([#227](https://github.com/GoogleChrome/chrome-launcher/pull/227))
* `3a7c9610` reword unset-`CHROME_PATH` error message
* `b1b8dc74` rename disabled `TranslateUI` to `Translate` to match Chrome ([#225](https://github.com/GoogleChrome/chrome-launcher/pull/225))
* `beb41360` chore: update dependencies and test targets ([#221](https://github.com/GoogleChrome/chrome-launcher/pull/221))
* `df9d564a` tests: migrate from travis to github actions ([#228](https://github.com/GoogleChrome/chrome-launcher/pull/228))
* `673da08b` tests: add mac/win bots to ci ([#232](https://github.com/GoogleChrome/chrome-launcher/pull/232))
* `a700ae0c` docs: fix readme's `getInstallations()` section ([#212](https://github.com/GoogleChrome/chrome-launcher/pull/212))
* [`chrome-flags-for-tools.md`](https://github.com/GoogleChrome/chrome-launcher/blob/b00fa22f94371f6d38d2d23e6e0b32fc7af470f0/docs/chrome-flags-for-tools.md) update
- `4b98587d` massive update and refactor ([#226](https://github.com/GoogleChrome/chrome-launcher/pull/226))
- `e45b100f` minor tweaks to headless and others
- `3a90c21b` fix links
- `8429ca93` add feature flags description
- `21db5f9f` even more documented flags ([#231](https://github.com/GoogleChrome/chrome-launcher/pull/231))
## v0.13.4 (Tue, Jul 7 2020)
* `08406b28` fix: preserve existing getInstallations output
* `f3669f45` perf: check default paths first when running on Mac (#209)
* `aef94948` docs: update defaultFlags() example for new API (#205)
## v0.13.3 (Thu, Jun 4 2020)
* `6a5d0c72` flags: disable background tracing (#203)
* `d9154291` chore(deps): update typescript and types (#202)
* `88e49686` test: use strict version of assert functions (#201)
## v0.13.2 (Thu, May 7 2020)
* `7c1ea547` deps: bump to is-wsl@2.2.0 (#187)
* `2ae5591d` fix: sanitize environment variables used in RegExp (#197)
## v0.13.1 (Wed, Apr 1 2020)
* `bf2957ac` deps: update various dependencies (#192)
## v0.13.0 (Thu, Feb 27 2020)
* `83da1e41` feat: add killAll function (#186)
* `b8c89f84` flags: disable the default browser check (#181) (#182)
* `6112555c` fix: log taskkill error based on logging opts (#178) (#179)
* `7c935efa` docs: add missing quote in README.md example (#180)
* `2e829c7d` Skip --disable-setuid-sandbox flag when ignoreDefaultFlags = true (#171)
## v0.12.0 (Wed, Oct 30 2019)
* `66a5e226` flags: add new --disable flags to reduce noise and disable backgrounding (#170)
- --disable-component-extensions-with-background-pages
- --disable-backgrounding-occluded-windows
- --disable-renderer-backgrounding
- --disable-background-timer-throttling
* `c4890ee3` feat: expose public interface for locating Chrome installations (#177)
- `Launcher.getInstallations()` returns an array of paths to available Chrome binaries
* `a5ccaa4e` deps: update assorted dependencies (#175)
* `e67a10df` --disable-translation is now --disable-features=TranslateUI (#167)
## v0.11.2 (Mon, Jul 29 2019)
* `1928187` fix: prevent mutation of default flags (#162)
* `02a23c2` docs: fix launcher example in README (#160)
* `90dc0e4` update manual-chrome-launcher with fixes from LH
## v0.11.1 (Tue, Jul 09 2019)
* `ec80f0ca` tests: drop support for node 9. continue supporting node 8 LTS (#159)
* `4865f3af` deps(security): bump mocha to latest (#158)
* `e0d2b09b` deps(security): bump handlebars from 4.0.11 to 4.1.2 (#157)
* `982be53f` update changelog for v0.10.7 and v0.11.0
## v0.11.0 (Tue, Jul 09 2019)
* `a860504f` [Breaking change] remove enableExtensions. add ignoreDefaultFlags & defaultFlags() (#124)
* `448a1d48` chrome-finder: Add support for MacOS Catalina (#149)
* `55b891bb` deps(is-wsl): add support for WSL 2; drop Node 6 (#152)
* `57e18181` deps: upgrade typescript and ts-node (#155)
* `a8848116` deps(security): bump lodash from 4.17.4 to 4.17.11 (#147)
* `0a775dab` Document that --enable-automation disables automatic page reloads (#140)
* `c9f653e2` Removing dead --safebrowsing-disable-auto-update flag. (#139)
* `be12d564` yarn.lock add integrity
* `e361aa43` Update changelog.md (#137)
## v0.10.7 (Wed, May 01 2019)
* `55397e0c` deps: update yarn.lock from #142
* `179a3f33` silence grep (#138)
* `d2f6037a` fix: move unneeded ts types to devDeps (#142)
* `984d61ce` docs(flags): remove a few flags that are gone.
* `6316362c` docs: fix link to chrome-launcher's flags (#128)
* `f1f6d162` Update chrome-flags-for-tools.md
## v0.10.5 (Tue, Sep 25 2018)
* `1328319b` fix: set the `which` command's stdio to pipe (#125)
## v0.10.4 (Mon, Sep 17 2018)
* `35842ba4` fix: ignore stdio on `which` call (#121)
* `f126c3a0` fix: reject promise on failed kill() (#112)
* `5ee0fde2` Set custom error codes for all errors.
* `841bdf3f` Fix picking CHROME_PATH priority over other matches.
* `6b10d748` Fix Travis CI build: GCE for chrome bug (#87)
* `d4aa8295` Fix readme's default logLevel (#85)
* `5be71243` Type improvements (#102)
* `dd5fdd49` Stricter typing for logLevel (#105)
* `c9394cf7` Fix README typo: booelan ==> boolean (#104)
* Update chrome-flags-for-tools.md
## v0.10.3 (Mon, Sep 17 2018)
Bad release. Had a breaking change (#70). Unpublished.
## v0.10.2 (Mon, Jan 8 2018)
* `ef91605f` Fix TS typing (#82)
* `baf2205f` tests(travis): test on Node 9, drop testing on Node 7 (#80)
## v0.10.1 (Fri, Jan 5 2018)
* `a5bc8180` Fix getLocalAppDataPath for wsl (#75)
* `70a91885` readme: recommend use of cri with chrome-launcher (#78)
* `d3ee63bd` folder refactor: ts in /src, js in /dist (#69)
## 0.10.0 (Fri, Dec 8 2017)
* `449c5238` Expose launched chrome child process object. (#67)
* `0978891c` Enable users to pass env vars into spawned chrome. (#66)
* `0261f43b` Add document covering the various chrome flags
* `5617473c` Make launcher the default export. (#63)
* `483acff5` fix: support alpine linux by retrying grep with -r (#61)
* `eaa0bb87` docs: update maxConnectionRetries default to 50 (#58)
## 0.9.0 (Mon, 27 Nov 2017)
* `4cc9c075` New: Add `userDataDir` flag to use default user profile instead (#48)
* `94137051` Avoid selecting google-emacs (#35)
## 0.8.0 (Wed, 20 Sept 2017)
* `256399c` Add support for Windows Subsystem for Linux / BashOnWindows (#27)
## 0.7.0 (Thu, 14 Sept 2017)
* Project moved to its own repo: https://github.com/GoogleChrome/chrome-launcher
* `8d0766eb` Retry connection for longer (#21)
* `52cb50af` only include PROGRAMFILES(X86) if present (#20)
* `530822b9` log pid to kill (#22)
* `1d617ab3` add support for `connectionPollInterval ` and `maxConnectionRetries` (#19)
* `7474971f` Fix errors inside spawnPromise being ignored (https://github.com/GoogleChrome/lighthouse/pull/2939)
## 0.6.0 (Thu, 17 Aug 2017)
* `43baee69` mute any audio (#3028)
* `ae6e9551` Better SIGINT handling (#2959)
* `3ab3a117` docs: add changelog to launcher (#2987)
## 0.5.0 (Mon, 14 Aug 2017)
* `494f9911` clarify priority of chromePath options
* `1c11021a` add support for finding Chromium on Linux (#2950)
* `391e2043` Publish type definitions instead of source TypeScript files (#2898)
* `de408ad3` readme: update example using deprecated `LIGHTHOUSE_CHROMIUM_PATH` (#2929)
* `8bc6d18e` add license file to launcher package. (#2849)
## 0.4.0 (Tue, 1 Aug 2017)
* `37fd38ce` pass --enable-extensions on from manual-chrome-launcher (#2735)
* `c942d17e` support enabling extension loading (#2650)
## 0.3.2 (Wed, 19 Jul 2017)
* `112c2c7f` Fix chrome finder on linux/osx when process.env isn't populated (#2687)
* `5728695f` Added CHROME_PATH to readme (#2694)
* `fedc76a3` test: fix clang-format error (#2691)
* `a6bbcaba` nuke 'as string'
* `41df647f` cli: remove --select-chrome,--skip-autolaunch. Support CHROME_PATH env (#2659)
* `8c9724e2` fix launcher w/ arbitrary flags (#2670)
* `9c0c0788` Expose LHR to modules consuming cli/run.ts (#2654)
* `6df6b0e2` support custom port via chrome-debug binary (#2644)
* `3f143b19` log the specific chrome spawn command.
## 0.3.1 (Wed, 5 Jul 2017)
* `ef081063` upgrade rimraf to latest (#2641)
## 0.3.0 (Fri, 30 Jun 2017)
* `edbb40d9` fix(driver): move performance observer registration to setupDriver (#2611)

View File

@@ -0,0 +1,4 @@
// This provides legacy support for a previously documented require pattern
// const chromeLauncher = require('chrome-launcher/chrome-launcher');
module.exports = require('../');

13
node_modules/chrome-launcher/compiled-check.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
'use strict'
const fs = require('fs');
const path = require('path');
module.exports = function(filename) {
if (!fs.existsSync(path.join(__dirname, filename))) {
console.log(
'Oops! Looks like the chrome-launcher files needs to be compiled. Please run:');
console.log(' yarn; yarn build;');
process.exit(1);
}
}

7
node_modules/chrome-launcher/contributing.md generated vendored Normal file
View File

@@ -0,0 +1,7 @@
# Release Procedure
1. When good, do `npm publish`. it'll run the prepublish script (build & test)
* complete publishing to npm. (we now have the tagged commit, too).
1. To complete the changelog: Do `git log --oneline` and then edit the resulting text to match the style in `changelog.md`. it's pretty manual. update that file. commit.
1. Push back up to origin. Do `git push --tags` to ensure the tag is there.
1. Open up https://github.com/GoogleChrome/chrome-launcher/releases and _Draft a New Release_. Use the same changelog.md markdown. Publish.

14
node_modules/chrome-launcher/dist/chrome-finder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/**
* check for MacOS default app paths first to avoid waiting for the slow lsregister command
*/
export declare function darwinFast(): string | undefined;
export declare function darwin(): string[];
/**
* Look for linux executables in 3 ways
* 1. Look into CHROME_PATH env variable
* 2. Look into the directories where .desktop are saved on gnome based distro's
* 3. Look for google-chrome-stable & google-chrome executables by using the which command
*/
export declare function linux(): string[];
export declare function wsl(): string[];
export declare function win32(): string[];

233
node_modules/chrome-launcher/dist/chrome-finder.js generated vendored Normal file

File diff suppressed because one or more lines are too long

79
node_modules/chrome-launcher/dist/chrome-launcher.d.ts generated vendored Normal file
View File

@@ -0,0 +1,79 @@
/// <reference types="node" />
import * as childProcess from 'child_process';
import * as fs from 'fs';
import { ChildProcess } from 'child_process';
declare type JSONLike = {
[property: string]: JSONLike;
} | readonly JSONLike[] | string | number | boolean | null;
export interface Options {
startingUrl?: string;
chromeFlags?: Array<string>;
prefs?: Record<string, JSONLike>;
port?: number;
handleSIGINT?: boolean;
chromePath?: string;
userDataDir?: string | boolean;
logLevel?: 'verbose' | 'info' | 'error' | 'warn' | 'silent';
ignoreDefaultFlags?: boolean;
connectionPollInterval?: number;
maxConnectionRetries?: number;
envVars?: {
[key: string]: string | undefined;
};
}
export interface LaunchedChrome {
pid: number;
port: number;
process: ChildProcess;
kill: () => void;
}
export interface ModuleOverrides {
fs?: typeof fs;
spawn?: typeof childProcess.spawn;
}
declare function launch(opts?: Options): Promise<LaunchedChrome>;
/** Returns Chrome installation path that chrome-launcher will launch by default. */
declare function getChromePath(): string;
declare function killAll(): Array<Error>;
declare class Launcher {
private opts;
private tmpDirandPidFileReady;
private pidFile;
private startingUrl;
private outFile?;
private errFile?;
private chromePath?;
private ignoreDefaultFlags?;
private chromeFlags;
private prefs;
private requestedPort?;
private connectionPollInterval;
private maxConnectionRetries;
private fs;
private spawn;
private useDefaultProfile;
private envVars;
chromeProcess?: childProcess.ChildProcess;
userDataDir?: string;
port?: number;
pid?: number;
constructor(opts?: Options, moduleOverrides?: ModuleOverrides);
private get flags();
static defaultFlags(): string[];
/** Returns the highest priority chrome installation. */
static getFirstInstallation(): string | undefined;
/** Returns all available chrome installations in decreasing priority order. */
static getInstallations(): string[];
makeTmpDir(): string;
prepare(): void;
private setBrowserPrefs;
launch(): Promise<void>;
private spawnProcess;
private cleanup;
private isDebuggerReady;
waitUntilReady(): Promise<void>;
kill(): void;
destroyTmp(): void;
}
export default Launcher;
export { Launcher, launch, killAll, getChromePath };

336
node_modules/chrome-launcher/dist/chrome-launcher.js generated vendored Normal file

File diff suppressed because one or more lines are too long

5
node_modules/chrome-launcher/dist/flags.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/**
* See the following `chrome-flags-for-tools.md` for exhaustive coverage of these and related flags
* @url https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
*/
export declare const DEFAULT_FLAGS: ReadonlyArray<string>;

61
node_modules/chrome-launcher/dist/flags.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
/**
* @license Copyright 2017 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.
*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_FLAGS = void 0;
/**
* See the following `chrome-flags-for-tools.md` for exhaustive coverage of these and related flags
* @url https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
*/
exports.DEFAULT_FLAGS = [
'--disable-features=' +
[
// Disable built-in Google Translate service
'Translate',
// Disable the Chrome Optimization Guide background networking
'OptimizationHints',
// Disable the Chrome Media Router (cast target discovery) background networking
'MediaRouter',
].join(','),
// Disable all chrome extensions
'--disable-extensions',
// Disable some extensions that aren't affected by --disable-extensions
'--disable-component-extensions-with-background-pages',
// Disable various background network services, including extension updating,
// safe browsing service, upgrade detector, translate, UMA
'--disable-background-networking',
// Don't update the browser 'components' listed at chrome://components/
'--disable-component-update',
// Disables client-side phishing detection.
'--disable-client-side-phishing-detection',
// Disable syncing to a Google account
'--disable-sync',
// Disable reporting to UMA, but allows for collection
'--metrics-recording-only',
// Disable installation of default apps on first run
'--disable-default-apps',
// Mute any audio
'--mute-audio',
// Disable the default browser check, do not prompt to set it as such
'--no-default-browser-check',
// Skip first run wizards
'--no-first-run',
// Disable backgrounding renders for occluded windows
'--disable-backgrounding-occluded-windows',
// Disable renderer process backgrounding
'--disable-renderer-backgrounding',
// Disable task throttling of timer tasks from background pages.
'--disable-background-timer-throttling',
// Disable the default throttling of IPC between renderer & browser processes.
'--disable-ipc-flooding-protection',
// Avoid potential instability of using Gnome Keyring or KDE wallet. crbug.com/571003 crbug.com/991424
'--password-store=basic',
// Use mock keychain on Mac to prevent blocking permissions dialogs
'--use-mock-keychain',
// Disable background tracing (aka slow reports & deep reports) to avoid 'Tracing already started'
'--force-fieldtrials=*BackgroundTracing/default/',
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmxhZ3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZmxhZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILFlBQVksQ0FBQzs7O0FBRWI7OztHQUdHO0FBRVUsUUFBQSxhQUFhLEdBQTBCO0lBQ2xELHFCQUFxQjtRQUNqQjtZQUNFLDRDQUE0QztZQUM1QyxXQUFXO1lBQ1gsOERBQThEO1lBQzlELG1CQUFtQjtZQUNuQixpRkFBaUY7WUFDakYsYUFBYTtTQUNkLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQztJQUVmLGdDQUFnQztJQUNoQyxzQkFBc0I7SUFDdEIsdUVBQXVFO0lBQ3ZFLHNEQUFzRDtJQUN0RCw2RUFBNkU7SUFDN0UsNERBQTREO0lBQzVELGlDQUFpQztJQUNqQyx1RUFBdUU7SUFDdkUsNEJBQTRCO0lBQzVCLDJDQUEyQztJQUMzQywwQ0FBMEM7SUFDMUMsc0NBQXNDO0lBQ3RDLGdCQUFnQjtJQUNoQixzREFBc0Q7SUFDdEQsMEJBQTBCO0lBQzFCLG9EQUFvRDtJQUNwRCx3QkFBd0I7SUFDeEIsaUJBQWlCO0lBQ2pCLGNBQWM7SUFDZCxxRUFBcUU7SUFDckUsNEJBQTRCO0lBQzVCLHlCQUF5QjtJQUN6QixnQkFBZ0I7SUFDaEIscURBQXFEO0lBQ3JELDBDQUEwQztJQUMxQyx5Q0FBeUM7SUFDekMsa0NBQWtDO0lBQ2xDLGdFQUFnRTtJQUNoRSx1Q0FBdUM7SUFDdkMsOEVBQThFO0lBQzlFLG1DQUFtQztJQUNuQyxzR0FBc0c7SUFDdEcsd0JBQXdCO0lBQ3hCLG1FQUFtRTtJQUNuRSxxQkFBcUI7SUFDckIsa0dBQWtHO0lBQ2xHLGlEQUFpRDtDQUNsRCxDQUFDIn0=

1
node_modules/chrome-launcher/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './chrome-launcher';

14
node_modules/chrome-launcher/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./chrome-launcher"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsb0RBQWtDIn0=

4
node_modules/chrome-launcher/dist/random-port.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
/**
* Return a random, unused port.
*/
export declare function getRandomPort(): Promise<number>;

25
node_modules/chrome-launcher/dist/random-port.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
/**
* @license Copyright 2016 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.
*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRandomPort = void 0;
const http_1 = require("http");
/**
* Return a random, unused port.
*/
function getRandomPort() {
return new Promise((resolve, reject) => {
const server = http_1.createServer();
server.listen(0);
server.once('listening', () => {
const { port } = server.address();
server.close(() => resolve(port));
});
server.once('error', reject);
});
}
exports.getRandomPort = getRandomPort;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmFuZG9tLXBvcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcmFuZG9tLXBvcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILFlBQVksQ0FBQzs7O0FBRWIsK0JBQWtDO0FBR2xDOztHQUVHO0FBQ0gsU0FBZ0IsYUFBYTtJQUMzQixPQUFPLElBQUksT0FBTyxDQUFDLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxFQUFFO1FBQ3JDLE1BQU0sTUFBTSxHQUFHLG1CQUFZLEVBQUUsQ0FBQztRQUM5QixNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ2pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxFQUFFLEdBQUcsRUFBRTtZQUM1QixNQUFNLEVBQUMsSUFBSSxFQUFDLEdBQUcsTUFBTSxDQUFDLE9BQU8sRUFBaUIsQ0FBQztZQUMvQyxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO1FBQ3BDLENBQUMsQ0FBQyxDQUFDO1FBQ0gsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFDL0IsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDO0FBVkQsc0NBVUMifQ==

34
node_modules/chrome-launcher/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
export declare const enum LaunchErrorCodes {
ERR_LAUNCHER_PATH_NOT_SET = "ERR_LAUNCHER_PATH_NOT_SET",
ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY = "ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY",
ERR_LAUNCHER_UNSUPPORTED_PLATFORM = "ERR_LAUNCHER_UNSUPPORTED_PLATFORM",
ERR_LAUNCHER_NOT_INSTALLED = "ERR_LAUNCHER_NOT_INSTALLED"
}
export declare function defaults<T>(val: T | undefined, def: T): T;
export declare function delay(time: number): Promise<unknown>;
export declare class LauncherError extends Error {
message: string;
code?: string | undefined;
constructor(message?: string, code?: string | undefined);
}
export declare class ChromePathNotSetError extends LauncherError {
message: string;
code: LaunchErrorCodes;
}
export declare class InvalidUserDataDirectoryError extends LauncherError {
message: string;
code: LaunchErrorCodes;
}
export declare class UnsupportedPlatformError extends LauncherError {
message: string;
code: LaunchErrorCodes;
}
export declare class ChromeNotInstalledError extends LauncherError {
message: string;
code: LaunchErrorCodes;
}
export declare function getPlatform(): "wsl" | "aix" | "android" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32" | "cygwin" | "netbsd";
export declare function makeTmpDir(): string;
export declare function toWin32Path(dir?: string): string;
export declare function toWSLPath(dir: string, fallback: string): string;
export declare function getWSLLocalAppDataPath(path: string): string;

134
node_modules/chrome-launcher/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
/**
* @license Copyright 2017 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.
*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWSLLocalAppDataPath = exports.toWSLPath = exports.toWin32Path = exports.makeTmpDir = exports.getPlatform = exports.ChromeNotInstalledError = exports.UnsupportedPlatformError = exports.InvalidUserDataDirectoryError = exports.ChromePathNotSetError = exports.LauncherError = exports.delay = exports.defaults = void 0;
const path_1 = require("path");
const child_process_1 = require("child_process");
const fs_1 = require("fs");
const isWsl = require("is-wsl");
function defaults(val, def) {
return typeof val === 'undefined' ? def : val;
}
exports.defaults = defaults;
async function delay(time) {
return new Promise(resolve => setTimeout(resolve, time));
}
exports.delay = delay;
class LauncherError extends Error {
constructor(message = 'Unexpected error', code) {
super();
this.message = message;
this.code = code;
this.stack = new Error().stack;
return this;
}
}
exports.LauncherError = LauncherError;
class ChromePathNotSetError extends LauncherError {
constructor() {
super(...arguments);
this.message = 'The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.';
this.code = "ERR_LAUNCHER_PATH_NOT_SET" /* ERR_LAUNCHER_PATH_NOT_SET */;
}
}
exports.ChromePathNotSetError = ChromePathNotSetError;
class InvalidUserDataDirectoryError extends LauncherError {
constructor() {
super(...arguments);
this.message = 'userDataDir must be false or a path.';
this.code = "ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY" /* ERR_LAUNCHER_INVALID_USER_DATA_DIRECTORY */;
}
}
exports.InvalidUserDataDirectoryError = InvalidUserDataDirectoryError;
class UnsupportedPlatformError extends LauncherError {
constructor() {
super(...arguments);
this.message = `Platform ${getPlatform()} is not supported.`;
this.code = "ERR_LAUNCHER_UNSUPPORTED_PLATFORM" /* ERR_LAUNCHER_UNSUPPORTED_PLATFORM */;
}
}
exports.UnsupportedPlatformError = UnsupportedPlatformError;
class ChromeNotInstalledError extends LauncherError {
constructor() {
super(...arguments);
this.message = 'No Chrome installations found.';
this.code = "ERR_LAUNCHER_NOT_INSTALLED" /* ERR_LAUNCHER_NOT_INSTALLED */;
}
}
exports.ChromeNotInstalledError = ChromeNotInstalledError;
function getPlatform() {
return isWsl ? 'wsl' : process.platform;
}
exports.getPlatform = getPlatform;
function makeTmpDir() {
switch (getPlatform()) {
case 'darwin':
case 'linux':
return makeUnixTmpDir();
case 'wsl':
// We populate the user's Windows temp dir so the folder is correctly created later
process.env.TEMP = getWSLLocalAppDataPath(`${process.env.PATH}`);
case 'win32':
return makeWin32TmpDir();
default:
throw new UnsupportedPlatformError();
}
}
exports.makeTmpDir = makeTmpDir;
function toWinDirFormat(dir = '') {
const results = /\/mnt\/([a-z])\//.exec(dir);
if (!results) {
return dir;
}
const driveLetter = results[1];
return dir.replace(`/mnt/${driveLetter}/`, `${driveLetter.toUpperCase()}:\\`)
.replace(/\//g, '\\');
}
function toWin32Path(dir = '') {
if (/[a-z]:\\/iu.test(dir)) {
return dir;
}
try {
return child_process_1.execFileSync('wslpath', ['-w', dir]).toString().trim();
}
catch {
return toWinDirFormat(dir);
}
}
exports.toWin32Path = toWin32Path;
function toWSLPath(dir, fallback) {
try {
return child_process_1.execFileSync('wslpath', ['-u', dir]).toString().trim();
}
catch {
return fallback;
}
}
exports.toWSLPath = toWSLPath;
function getLocalAppDataPath(path) {
const userRegExp = /\/mnt\/([a-z])\/Users\/([^\/:]+)\/AppData\//;
const results = userRegExp.exec(path) || [];
return `/mnt/${results[1]}/Users/${results[2]}/AppData/Local`;
}
function getWSLLocalAppDataPath(path) {
const userRegExp = /\/([a-z])\/Users\/([^\/:]+)\/AppData\//;
const results = userRegExp.exec(path) || [];
return toWSLPath(`${results[1]}:\\Users\\${results[2]}\\AppData\\Local`, getLocalAppDataPath(path));
}
exports.getWSLLocalAppDataPath = getWSLLocalAppDataPath;
function makeUnixTmpDir() {
return child_process_1.execSync('mktemp -d -t lighthouse.XXXXXXX').toString().trim();
}
function makeWin32TmpDir() {
const winTmpPath = process.env.TEMP || process.env.TMP ||
(process.env.SystemRoot || process.env.windir) + '\\temp';
const randomNumber = Math.floor(Math.random() * 9e7 + 1e7);
const tmpdir = path_1.join(winTmpPath, 'lighthouse.' + randomNumber);
fs_1.mkdirSync(tmpdir, { recursive: true });
return tmpdir;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILFlBQVksQ0FBQzs7O0FBRWIsK0JBQTBCO0FBQzFCLGlEQUFxRDtBQUNyRCwyQkFBNkI7QUFDN0IsZ0NBQWlDO0FBU2pDLFNBQWdCLFFBQVEsQ0FBSSxHQUFnQixFQUFFLEdBQU07SUFDbEQsT0FBTyxPQUFPLEdBQUcsS0FBSyxXQUFXLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDO0FBQ2hELENBQUM7QUFGRCw0QkFFQztBQUVNLEtBQUssVUFBVSxLQUFLLENBQUMsSUFBWTtJQUN0QyxPQUFPLElBQUksT0FBTyxDQUFDLE9BQU8sQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLE9BQU8sRUFBRSxJQUFJLENBQUMsQ0FBQyxDQUFDO0FBQzNELENBQUM7QUFGRCxzQkFFQztBQUVELE1BQWEsYUFBYyxTQUFRLEtBQUs7SUFDdEMsWUFBbUIsVUFBa0Isa0JBQWtCLEVBQVMsSUFBYTtRQUMzRSxLQUFLLEVBQUUsQ0FBQztRQURTLFlBQU8sR0FBUCxPQUFPLENBQTZCO1FBQVMsU0FBSSxHQUFKLElBQUksQ0FBUztRQUUzRSxJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksS0FBSyxFQUFFLENBQUMsS0FBSyxDQUFDO1FBQy9CLE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztDQUNGO0FBTkQsc0NBTUM7QUFFRCxNQUFhLHFCQUFzQixTQUFRLGFBQWE7SUFBeEQ7O1FBQ0UsWUFBTyxHQUNILCtHQUErRyxDQUFDO1FBQ3BILFNBQUksK0RBQThDO0lBQ3BELENBQUM7Q0FBQTtBQUpELHNEQUlDO0FBRUQsTUFBYSw2QkFBOEIsU0FBUSxhQUFhO0lBQWhFOztRQUNFLFlBQU8sR0FBRyxzQ0FBc0MsQ0FBQztRQUNqRCxTQUFJLDZGQUE2RDtJQUNuRSxDQUFDO0NBQUE7QUFIRCxzRUFH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

View File

@@ -0,0 +1,188 @@
# Chrome Flags for Tooling
Many tools maintain a list of runtime flags for Chrome to configure the environment. This file
is an attempt to document all chrome flags that are relevant to tools, automation, benchmarking, etc.
All use cases are different, so you'll have to choose which flags are most appropriate.
Here's a **[Nov 2022 comparison of what flags](https://docs.google.com/spreadsheets/d/1n-vw_PCPS45jX3Jt9jQaAhFqBY6Ge1vWF_Pa0k7dCk4/edit#gid=1265672696)** all these [tools](#sources) use.
## Commonly unwanted browser features
* `--disable-client-side-phishing-detection`: Disables client-side phishing detection
* `--disable-component-extensions-with-background-pages`: Disable some built-in extensions that aren't affected by `--disable-extensions`
* `--disable-default-apps`: Disable installation of default apps
* `--disable-extensions`: Disable all chrome extensions
* `--disable-features=InterestFeedContentSuggestions`: Disables the Discover feed on NTP
* `--disable-features=Translate`: Disables Chrome translation, both the manual option and the popup prompt when a page with differing language is detected.
* `--hide-scrollbars`: Hide scrollbars from screenshots.
* `--mute-audio`: Mute any audio
* `--no-default-browser-check`: Disable the default browser check, do not prompt to set it as such
* `--no-first-run`: Skip first run wizards
## Task throttling
* `--disable-background-timer-throttling`: Disable timers being throttled in background pages/tabs
* `--disable-backgrounding-occluded-windows`: Normally, Chrome will treat a 'foreground' tab instead as _backgrounded_ if the surrounding window is occluded (aka visually covered) by another window. This flag disables that.
* `--disable-features=CalculateNativeWinOcclusion`: Disable the feature of: Calculate window occlusion on Windows will be used in the future to throttle and potentially unload foreground tabs in occluded windows.
* `--disable-hang-monitor`: Suppresses hang monitor dialogs in renderer processes. This flag may allow slow unload handlers on a page to prevent the tab from closing.
* `--disable-ipc-flooding-protection`: Some javascript functions can be used to flood the browser process with IPC. By default, protection is on to limit the number of IPC sent to 10 per second per frame. This flag disables it. https://crrev.com/604305
* `--disable-renderer-backgrounding`: This disables non-foreground tabs from getting a lower process priority This doesn't (on its own) affect timers or painting behavior. [karma-chrome-launcher#123](https://github.com/karma-runner/karma-chrome-launcher/issues/123)
## Web platform behavior
* `--aggressive-cache-discard`
* `--allow-running-insecure-content`
* `--disable-back-forward-cache`: Disables the BackForwardCache feature.
* `--disable-features=AcceptCHFrame`: Disable accepting h2/h3 [ACCEPT_CH](https://datatracker.ietf.org/doc/html/draft-davidben-http-client-hint-reliability-02#section-4.3) Client Hints frames.
* `--disable-features=AutoExpandDetailsElement`: Removed in [Sept 2022](https://bugs.chromium.org/p/chromium/issues/detail?id=1185950#c62).
* `--disable-features=AvoidUnnecessaryBeforeUnloadCheckSync`: If enabled, this feature results in the browser process only asking the renderer process to run beforeunload handlers if it knows such handlers are registered. With `kAvoidUnnecessaryBeforeUnloadCheckSync`, content does not report a beforeunload handler is present. A ramification of this is navigations that would normally check beforeunload handlers before continuing will not, and navigation will synchronously continue.
* `--disable-features=BackForwardCache`: Disable the bfcache.
* `--disable-features=HeavyAdPrivacyMitigations`: Disables the privacy mitigations for the heavy ad intervention. This throttles the amount of interventions that can occur on a given host in a time period. It also adds noise to the thresholds used. This is separate from the intervention feature so it does not interfere with field trial activation, as this blocklist is created for every user, and noise is decided prior to seeing a heavy ad.
* `--disable-features=IsolateOrigins`
* `--disable-features=LazyFrameLoading`
* `--disable-features=ScriptStreaming`: V8 script streaming
* `--enable-precise-memory-info`: Make the values returned to window.performance.memory more granular and more up to date in shared worker. Without this flag, the memory information is still available, but it is bucketized and updated less frequently. This flag also applys to workers.
* `--js-flags=--random-seed=1157259157`: Initialize V8's RNG with a fixed seed.
* `--use-fake-device-for-media-stream`: Use fake device for Media Stream to replace camera and microphone
* `--use-fake-ui-for-media-stream`: Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). Works with --use-fake-device-for-media-stream.
* `--use-file-for-fake-video-capture=<path-to-file>`: Use file for fake video capture (.y4m or .mjpeg) Needs `--use-fake-device-for-media-stream`
## Interactivity suppression
* `--autoplay-policy=...`: Value of `user-gesture-required` to not autoplay video. Value of `no-user-gesture-required` to always autoplay video.
* `--deny-permission-prompts`: Suppress all permission prompts by automatically denying them.
* `--disable-external-intent-requests`: Disallow opening links in external applications
* `--disable-features=GlobalMediaControls`: Hide toolbar button that opens dialog for controlling media sessions.
* `--disable-features=ImprovedCookieControls`: Disables an improved UI for third-party cookie blocking in incognito mode.
* `--disable-notifications`: Disables the Web Notification and the Push APIs.
* `--disable-popup-blocking`: Disable popup blocking. `--block-new-web-contents` is the strict version of this.
* `--disable-prompt-on-repost`: Reloading a page that came from a POST normally prompts the user.
* `--noerrdialogs`: Suppresses all error dialogs when present.
## Catch-all automation
* `--enable-automation`: Disable a few things considered not appropriate for automation. ([Original design doc](https://docs.google.com/a/google.com/document/d/1JYj9K61UyxIYavR8_HATYIglR9T_rDwAtLLsD3fbDQg/preview), though renamed [here](https://codereview.chromium.org/2564973002#msg24)) [codesearch](https://cs.chromium.org/search/?q=kEnableAutomation&type=cs). Note that some projects have chosen to **avoid** using this flag: [web-platform-tests/wpt/#6348](https://github.com/web-platform-tests/wpt/pull/6348), [crbug.com/1277272](https://crbug.com/1277272)
- sets `window.navigator.webdriver` to `true` within all JS contexts. This is also set [when using](https://source.chromium.org/chromium/chromium/src/+/main:content/child/runtime_features.cc;l=374-376;drc=4a843634b8b3006e431add55968f6f45ee54d35e) `--headless`, `--remote-debugging-pipe` and `--remote-debugging-port=0` (yes, [_specifically_ 0](https://source.chromium.org/chromium/chromium/src/+/main:content/child/runtime_features.cc;l=412-427;drc=4a843634b8b3006e431add55968f6f45ee54d35e)).
- disables bubble notification about running development/unpacked extensions ([source](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/extensions/extension_message_bubble_factory.cc;l=71-76;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed))
- disables the password saving UI (which [covers](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/password_manager/chrome_password_manager_client.cc;l=301-308;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed) the usecase of the [defunct](https://bugs.chromium.org/p/chromedriver/issues/detail?id=1015) `--disable-save-password-bubble` flag)
- disables infobar animations ([source](https://source.chromium.org/chromium/chromium/src/+/main:components/infobars/content/content_infobar_manager.cc;l=48-52;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed))
- disables auto-reloading on network errors ([source](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/chrome_content_browser_client.cc;l=1328-1331;drc=1e6c1a39cbbc1dcad6e7828661d74d76463465ed))
- enables the CDP method [`Browser.getBrowserCommandLine`](https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-getBrowserCommandLine).
- avoids showing these 4 infobars: ShowBadFlagsPrompt, GoogleApiKeysInfoBarDelegate, ObsoleteSystemInfoBarDelegate, LacrosButterBar
- adds this infobar: ![image](https://user-images.githubusercontent.com/39191/30349667-92a7a086-97c8-11e7-86b2-1365e3d407e3.png) ... which is known to [adversely affect screenshots](https://bugs.chromium.org/p/chromium/issues/detail?id=1277272).
* `--test-type`: Basically the 2014 version of `--enable-automation`. [codesearch](https://cs.chromium.org/search/?q=kTestType%5Cb&type=cs)
- It avoids creating application stubs in ~/Applications on mac.
- It makes exit codes slightly more correct
- windows navigation jumplists arent updated https://crbug.com/389375
- doesn't start some chrome StartPageService
- disables initializing chromecast service
- "Component extensions with background pages are not enabled during tests because they generate a lot of background behavior that can interfere."
- when quitting the browser, it disables additional checks that may stop that quitting process. (like unsaved form modifications or unhandled profile notifications..)
* `--remote-debugging-pipe`: more secure than using protocol over a websocket
* `--remote-debugging-port=...`: With a value of 0, Chrome will automatically select a useable port _and_ will set `navigator.webdriver` to `true`.
* `--silent-debugger-extension-api`: Does not show an infobar when a Chrome extension attaches to a page using `chrome.debugger` page. Required to attach to extension background pages.
## General
* `--enable-logging=stderr`: Logging behavior slightly more appropriate for a server-type process.
* `--log-level=0`: 0 means INFO and higher. `2` is the most verbose. Protip: Use `--enable-logging=stderr --v=2` and you may spot additional components active that you may want to disable.
* `--user-data-dir=...`: Directory where the browser stores the user profile.
## Chromium Annoyances
* `--disable-features=DialMediaRouteProvider`: Avoid the startup dialog for _Do you want the application “Chromium.app” to accept incoming network connections?_. This is a sub-component of the MediaRouter.
* `--password-store=basic`: Avoid potential instability of using Gnome Keyring or KDE wallet. [chromium/linux/password_storage.md](https://chromium.googlesource.com/chromium/src/+/main/docs/linux/password_storage.md) https://crbug.com/571003
* `--use-mock-keychain`: Use mock keychain on Mac to prevent the blocking permissions dialog abou: _Chrome wants to use your confidential information stored in your keychain_
## Background networking
* `--disable-background-networking`: Disable various background network services, including extension updating,safe browsing service, upgrade detector, translate, UMA
* `--disable-breakpad`: Disable crashdump collection (reporting is already disabled in Chromium)
* `--disable-component-update`: Don't update the browser 'components' listed at chrome://components/
* `--disable-domain-reliability`: Disables Domain Reliability Monitoring, which tracks whether the browser has difficulty contacting Google-owned sites and uploads reports to Google.
* `--disable-features=AutofillServerCommunication`: Disables (mostly for hermetic testing) autofill server communication. The URL of the autofill server can further be controlled via the autofill-server-url param. The given URL should specify the complete autofill server API url up to the parent "directory" of the "query" and "upload" resources. i.e., https://other.autofill.server:port/tbproxy/af/
* `--disable-features=CertificateTransparencyComponentUpdater`
* `--disable-sync`: Disable syncing to a Google account
* `--enable-crash-reporter-for-testing`: Used for turning on Breakpad crash reporting in a debug environment where crash reporting is typically compiled but disabled.
* `--metrics-recording-only`: Disable reporting to UMA, but allows for collection
* `--disable-features=OptimizationHints`: Disable the [Chrome Optimization Guide](https://chromium.googlesource.com/chromium/src/+/HEAD/components/optimization_guide/) and networking with its service API
* `--disable-features=MediaRouter`: Disable the [Chrome Media Router](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/media/media_router.md) which creates some background network activity to discover castable targets.
* `--no-pings`: Don't send hyperlink auditing pings
## Rendering & GPU
* `--allow-pre-commit-input`: Allows processing of input before a frame has been committed. Used by headless. https://crbug.com/987626
* `--deterministic-mode`: An experimental meta flag. This sets the below indented flags which put the browser into a mode where rendering (border radius, etc) is deterministic and begin frames should be issued over DevTools Protocol. [codesearch](https://source.chromium.org/chromium/chromium/src/+/main:headless/app/headless_shell.cc;drc=df45d1abbc20abc7670643adda6d9625eea55b4d)
- `--run-all-compositor-stages-before-draw`
- `--disable-new-content-rendering-timeout`
- `--enable-begin-frame-control`
- `--disable-threaded-animation`
- `--disable-threaded-scrolling`
- `--disable-checker-imaging`
- `--disable-image-animation-resync`
* `--disable-features=PaintHolding`: Don't defer paint commits (normally used to avoid flash of unstyled content)
* `--disable-partial-raster`: https://crbug.com/919955
* `--disable-skia-runtime-opts`: Do not use runtime-detected high-end CPU optimizations in Skia.
* `--in-process-gpu`: Saves some memory by moving GPU process into a browser process thread
* `--use-gl="swiftshader"`: Select which implementation of GL the GPU process should use. Options are: `desktop`: whatever desktop OpenGL the user has installed (Linux and Mac default). `egl`: whatever EGL / GLES2 the user has installed (Windows default - actually ANGLE). `swiftshader`: The SwiftShader software renderer.
## Window & screen management
* `--block-new-web-contents`: All pop-ups and calls to window.open will fail.
* `--force-color-profile=srgb`: Force all monitors to be treated as though they have the specified color profile.
* `--new-window`: Launches URL in new browser window.
* `--window-position=0,0`: Specify the initial window position: --window-position=x,y
* `--window-size=1600,1024`: Sets the initial window size. Provided as string in the format "800,600".
## Process management
* `--disable-features=DestroyProfileOnBrowserClose`: Disable the feature of: Destroy profiles when their last browser window is closed, instead of when the browser exits.
* `--disable-features=site-per-process`: Disables OOPIF. https://www.chromium.org/Home/chromium-security/site-isolation
* `--no-service-autorun`: Disables the service process from adding itself as an autorun process. This does not delete existing autorun registrations, it just prevents the service from registering a new one.
* `--process-per-tab`: [Doesn't do anything](https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_switches.cc;l=602-605;drc=2149a93144ce2030ab20863c2983b6c9d7bfd177). Use --single-process instead.
* `--single-process`: Runs the renderer and plugins in the same process as the browser.
## Headless
* `--headless`: Run in headless mode, i.e., without a UI or display server dependencies.
* `--headless=new`: New, native Headless mode. ([previously](https://bugs.chromium.org/p/chromium/issues/detail?id=1380881), `--headless=chrome`)
* `--no-sandbox`: [Sometimes used](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#setting-up-chrome-linux-sandbox) with headless, though not recommended.
* `--disable-dev-shm-usage`: Often used in Lambda, Cloud Functions scenarios. ([pptr issue](https://github.com/GoogleChrome/puppeteer/issues/1834), [crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=736452))
* `--disable-gpu`: Was often [used](https://bugs.chromium.org/p/chromium/issues/detail?id=737678) along with `--headless`, but as of 2021, isn't needed.
# ~Removed~ flags
* `--disable-add-to-shelf`: [Removed June 2017](https://codereview.chromium.org/2944283002)
* `--disable-background-downloads`: [Removed Oct 2014](https://codereview.chromium.org/607843002).
* `--disable-browser-side-navigation`: Removed. It disabled PlzNavigate.
* `--disable-datasaver-prompt`: Removed
* `--disable-desktop-notifications`: Removed
* `--disable-device-discovery-notifications`: Removed. Avoided messages like "New printer on your network". [Replaced](https://crbug.com/1020447#c1) with `--disable-features=MediaRouter`.
* `--disable-features=TranslateUI`: Removed as `TranslateUI` changed to `Translate` in [Sept 2020](https://chromium-review.googlesource.com/c/chromium/src/+/2404484).
* `--disable-infobars`: [Removed April 2014](https://codereview.chromium.org/240193003)
* `--disable-save-password-bubble`: [Removed May 2016](https://codereview.chromium.org/1978563002)
* `--disable-search-geolocation-disclosure`: Removed.
* `--disable-translate`: [Removed April 2017](https://codereview.chromium.org/2819813002/) Used to disable built-in Google Translate service.
* `--ignore-autoplay-restrictions`: [Removed December 2017](https://chromium-review.googlesource.com/#/c/816855/) Can use `--autoplay-policy=no-user-gesture-required` instead.
* `--safebrowsing-disable-auto-update`: [Removed Nov 2017](https://bugs.chromium.org/p/chromium/issues/detail?id=74848#c26)
# Sources
* [chrome-launcher's flags](https://github.com/GoogleChrome/chrome-launcher/blob/main/src/flags.ts)
* [Chromedriver's flags](https://cs.chromium.org/chromium/src/chrome/test/chromedriver/chrome_launcher.cc?type=cs&q=f:chrome_launcher++kDesktopSwitches&sq=package:chromium)
* [Puppeteer's flags](https://github.com/puppeteer/puppeteer/blob/3f2c0590f154aefd2ad3449a3f943ee79d1e33a9/packages/puppeteer-core/src/node/ChromeLauncher.ts#L159)
* [WebpageTest's flags](https://github.com/WPO-Foundation/wptagent/blob/master/internal/chrome_desktop.py)
* [Catapult's flags](https://source.chromium.org/chromium/chromium/src/+/main:third_party/catapult/telemetry/telemetry/internal/backends/chrome/chrome_startup_args.py) and [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/catapult/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py;l=218;drc=4a0e6f034e9756605cfc837c8526588d6c13436b)
* [Karma's flags](https://github.com/karma-runner/karma-chrome-launcher/blob/master/index.js)
[The canonical list of Chrome command-line switches on peter.sh](http://peter.sh/experiments/chromium-command-line-switches/) (maintained by the Chromium team)
FYI: (Probably) all flags are defined in files matching the pattern of [`*_switches.cc`](https://source.chromium.org/search?q=f:_switches%5C.cc&ss=chromium%2Fchromium%2Fsrc).
## Feature Flags FYI
Chromium and Blink use feature flags to disable/enable many features at runtime. Chromium has [~400 features](https://source.chromium.org/search?q=%22const%20base::Feature%22%20f:%5C.cc&sq=&ss=chromium%2Fchromium%2Fsrc) that can be toggled with `--enable-features` / `--disable-features`. https://niek.github.io/chrome-features/ presents all of them very clearly.
Independently, Blink has [many features](https://source.chromium.org/chromium/chromium/src/+/main:out/Debug/gen/third_party/blink/renderer/platform/runtime_enabled_features.cc;l=1969;drc=d6e91a65ded605d8577f0651b3665c8206ae6ce3) that can be toggled [with commandline switches](https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/platform/RuntimeEnabledFeatures.md#command_line-switches): `--enable-blink-features` / `--disable-blink-features`.

52
node_modules/chrome-launcher/manual-chrome-launcher.js generated vendored Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env node
'use strict';
// Keep this file in sync with lighthouse
// TODO: have LH depend on this one.
/**
* @fileoverview Script to launch a clean Chrome instance on-demand.
*
* Assuming Lighthouse is installed globally or `npm link`ed, use via:
* chrome-debug
* Optionally enable extensions or pass a port, additional chrome flags, and/or a URL
* chrome-debug --port=9222
* chrome-debug http://goat.com
* chrome-debug --show-paint-rects
* chrome-debug --enable-extensions
*/
require('./compiled-check.js')('./dist/chrome-launcher.js');
const {Launcher, launch} = require('./dist/chrome-launcher');
const args = process.argv.slice(2);
const chromeFlags = [];
let startingUrl;
let port;
let ignoreDefaultFlags;
if (args.length) {
const providedFlags = args.filter(flag => flag.startsWith('--'));
const portFlag = providedFlags.find(flag => flag.startsWith('--port='));
if (portFlag) port = parseInt(portFlag.replace('--port=', ''), 10);
const enableExtensions = !!providedFlags.find(flag => flag === '--enable-extensions');
// The basic pattern for enabling Chrome extensions
if (enableExtensions) {
ignoreDefaultFlags = true;
chromeFlags.push(...Launcher.defaultFlags().filter(flag => flag !== '--disable-extensions'));
}
chromeFlags.push(...providedFlags);
startingUrl = args.find(flag => !flag.startsWith('--'));
}
launch({
startingUrl,
port,
ignoreDefaultFlags,
chromeFlags,
})
// eslint-disable-next-line no-console
.then(v => console.log(`✨ Chrome debugging port: ${v.port}`));

41
node_modules/chrome-launcher/package.json generated vendored Normal file
View File

@@ -0,0 +1,41 @@
{
"name": "chrome-launcher",
"main": "./dist/index.js",
"engines": {
"node": ">=12.13.0"
},
"scripts": {
"build": "tsc",
"dev": "tsc -w",
"test": "mocha --require ts-node/register --reporter=dot test/**/*-test.ts --timeout=10000",
"test-formatting": "test/check-formatting.sh",
"format": "scripts/format.sh",
"type-check": "tsc --allowJs --checkJs --noEmit --target es2019 *.js",
"prepublishOnly": "npm run build && npm run test",
"reset-link": "(yarn unlink || true) && yarn link && yarn --cwd node_modules/lighthouse/ link chrome-launcher"
},
"bin": {
"print-chrome-path": "bin/print-chrome-path.js"
},
"devDependencies": {
"@types/mocha": "^8.0.4",
"@types/sinon": "^9.0.1",
"clang-format": "^1.0.50",
"mocha": "^8.2.1",
"sinon": "^9.0.1",
"ts-node": "^9.1.0",
"typescript": "^4.1.2"
},
"dependencies": {
"@types/node": "*",
"escape-string-regexp": "^4.0.0",
"is-wsl": "^2.2.0",
"lighthouse-logger": "^1.0.0"
},
"version": "0.15.2",
"types": "./dist/index.d.ts",
"description": "Launch latest Chrome with the Devtools Protocol port open",
"repository": "https://github.com/GoogleChrome/chrome-launcher/",
"author": "The Chromium Authors",
"license": "Apache-2.0"
}

26
node_modules/chrome-launcher/scripts/download-chrome.sh generated vendored Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
##
# @license Copyright 2017 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.
##
# Download chrome inside of our CI env.
if [ "$APPVEYOR" == "True" ]; then
url="https://download-chromium.appspot.com/dl/Win?type=snapshots"
else
url="https://download-chromium.appspot.com/dl/Linux_x64?type=snapshots"
fi
if [ x"$LIGHTHOUSE_CHROMIUM_PATH" == x ]; then
echo "Error: Environment variable LIGHTHOUSE_CHROMIUM_PATH not set"
exit 1
fi
if [ -e "$LIGHTHOUSE_CHROMIUM_PATH" ]; then
echo "cached chrome found"
else
wget "$url" --no-check-certificate -q -O chrome.zip && unzip chrome.zip
fi

5
node_modules/chrome-launcher/scripts/format.sh generated vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
FILES="`find src -type f -name '*.ts'`"
./node_modules/.bin/clang-format -i -style=file $FILES

21
node_modules/chrome-launcher/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"outDir": "dist",
"target": "es2019",
"declaration": true,
"noImplicitAny": true,
"inlineSourceMap": true,
"noEmitOnError": false,
"strictNullChecks": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true
},
"exclude": [
"node_modules"
],
"include": [
"src"
]
}