lighthouse 10.4.0 → 11.0.0-dev.20230804
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/CONTRIBUTING.md +1 -1
- package/cli/cli-flags.d.ts +1 -6
- package/cli/cli-flags.js +0 -5
- package/cli/run.js +3 -10
- package/cli/sentry-prompt.js +4 -2
- package/cli/test/smokehouse/core-tests.js +0 -2
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +24 -14
- package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +1 -2
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +12 -21
- package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +1 -3
- package/cli/test/smokehouse/lighthouse-runners/cli.js +3 -7
- package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +1 -5
- package/cli/test/smokehouse/lighthouse-runners/devtools.js +1 -12
- package/cli/test/smokehouse/readme.md +0 -2
- package/cli/test/smokehouse/report-assert.d.ts +1 -3
- package/cli/test/smokehouse/report-assert.js +2 -19
- package/cli/test/smokehouse/smokehouse.js +3 -32
- package/core/audits/accessibility/aria-allowed-role.d.ts +10 -0
- package/core/audits/accessibility/aria-allowed-role.js +46 -0
- package/core/audits/accessibility/image-redundant-alt.d.ts +10 -0
- package/core/audits/accessibility/image-redundant-alt.js +45 -0
- package/core/audits/accessibility/label-content-name-mismatch.d.ts +10 -0
- package/core/audits/accessibility/label-content-name-mismatch.js +44 -0
- package/core/audits/accessibility/skip-link.d.ts +10 -0
- package/core/audits/accessibility/skip-link.js +43 -0
- package/core/audits/accessibility/table-duplicate-name.d.ts +10 -0
- package/core/audits/accessibility/table-duplicate-name.js +44 -0
- package/core/audits/accessibility/target-size.js +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.js +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.js +1 -0
- package/core/audits/dobetterweb/uses-http2.d.ts +18 -1
- package/core/audits/dobetterweb/uses-http2.js +62 -16
- package/core/audits/installable-manifest.d.ts +1 -5
- package/core/audits/installable-manifest.js +2 -7
- package/core/audits/largest-contentful-paint-element.d.ts +0 -6
- package/core/audits/largest-contentful-paint-element.js +13 -15
- package/core/audits/metrics/{experimental-interaction-to-next-paint.d.ts → interaction-to-next-paint.d.ts} +3 -3
- package/core/audits/metrics/{experimental-interaction-to-next-paint.js → interaction-to-next-paint.js} +3 -3
- package/core/audits/uses-rel-preconnect.js +23 -8
- package/core/audits/work-during-interaction.js +2 -2
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/config/config-helpers.d.ts +3 -3
- package/core/config/config-helpers.js +5 -12
- package/core/config/config.js +1 -7
- package/core/config/constants.d.ts +0 -2
- package/core/config/constants.js +2 -18
- package/core/config/default-config.js +59 -53
- package/core/config/filters.js +1 -1
- package/core/config/validation.d.ts +7 -12
- package/core/config/validation.js +16 -26
- package/core/gather/base-artifacts.d.ts +4 -4
- package/core/gather/base-artifacts.js +2 -6
- package/core/gather/base-gatherer.d.ts +12 -37
- package/core/gather/base-gatherer.js +7 -54
- package/core/gather/driver/dom.d.ts +4 -4
- package/core/gather/driver/dom.js +2 -2
- package/core/gather/driver/environment.d.ts +4 -4
- package/core/gather/driver/environment.js +2 -2
- package/core/gather/driver/execution-context.d.ts +12 -3
- package/core/gather/driver/execution-context.js +34 -3
- package/core/gather/driver/navigation.d.ts +2 -2
- package/core/gather/driver/navigation.js +2 -5
- package/core/gather/driver/network-monitor.d.ts +7 -6
- package/core/gather/driver/network-monitor.js +4 -4
- package/core/gather/driver/network.d.ts +2 -2
- package/core/gather/driver/network.js +1 -1
- package/core/gather/driver/prepare.d.ts +10 -10
- package/core/gather/driver/prepare.js +10 -10
- package/core/gather/driver/service-workers.d.ts +4 -4
- package/core/gather/driver/service-workers.js +2 -2
- package/core/gather/driver/storage.d.ts +6 -6
- package/core/gather/driver/storage.js +3 -3
- package/core/gather/driver/target-manager.d.ts +6 -5
- package/core/gather/driver/target-manager.js +3 -3
- package/core/gather/driver/wait-for-condition.d.ts +14 -14
- package/core/gather/driver/wait-for-condition.js +8 -8
- package/core/gather/driver.d.ts +9 -6
- package/core/gather/driver.js +14 -4
- package/core/gather/fetcher.d.ts +3 -3
- package/core/gather/fetcher.js +1 -1
- package/core/gather/gatherers/accessibility.d.ts +4 -4
- package/core/gather/gatherers/accessibility.js +8 -3
- package/core/gather/gatherers/anchor-elements.d.ts +4 -4
- package/core/gather/gatherers/anchor-elements.js +4 -4
- package/core/gather/gatherers/bf-cache-failures.d.ts +8 -14
- package/core/gather/gatherers/bf-cache-failures.js +5 -14
- package/core/gather/gatherers/cache-contents.d.ts +4 -4
- package/core/gather/gatherers/cache-contents.js +3 -3
- package/core/gather/gatherers/console-messages.d.ts +6 -6
- package/core/gather/gatherers/console-messages.js +4 -4
- package/core/gather/gatherers/css-usage.d.ts +14 -14
- package/core/gather/gatherers/css-usage.js +9 -9
- package/core/gather/gatherers/devtools-log-compat.d.ts +5 -5
- package/core/gather/gatherers/devtools-log-compat.js +4 -4
- package/core/gather/gatherers/devtools-log.d.ts +6 -6
- package/core/gather/gatherers/devtools-log.js +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +10 -22
- package/core/gather/gatherers/dobetterweb/optimized-images.js +10 -27
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +6 -12
- package/core/gather/gatherers/dobetterweb/response-compression.js +14 -21
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +8 -14
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +5 -14
- package/core/gather/gatherers/full-page-screenshot.d.ts +10 -10
- package/core/gather/gatherers/full-page-screenshot.js +7 -10
- package/core/gather/gatherers/global-listeners.d.ts +4 -4
- package/core/gather/gatherers/global-listeners.js +3 -3
- package/core/gather/gatherers/iframe-elements.d.ts +4 -4
- package/core/gather/gatherers/iframe-elements.js +3 -3
- package/core/gather/gatherers/image-elements.d.ts +10 -10
- package/core/gather/gatherers/image-elements.js +6 -6
- package/core/gather/gatherers/inputs.d.ts +4 -4
- package/core/gather/gatherers/inputs.js +3 -3
- package/core/gather/gatherers/inspector-issues.d.ts +8 -19
- package/core/gather/gatherers/inspector-issues.js +9 -26
- package/core/gather/gatherers/installability-errors.d.ts +6 -6
- package/core/gather/gatherers/installability-errors.js +4 -4
- package/core/gather/gatherers/js-usage.d.ts +6 -6
- package/core/gather/gatherers/js-usage.js +4 -4
- package/core/gather/gatherers/link-elements.d.ts +8 -20
- package/core/gather/gatherers/link-elements.js +7 -24
- package/core/gather/gatherers/main-document-content.d.ts +4 -16
- package/core/gather/gatherers/main-document-content.js +5 -23
- package/core/gather/gatherers/meta-elements.d.ts +4 -4
- package/core/gather/gatherers/meta-elements.js +3 -3
- package/core/gather/gatherers/network-user-agent.d.ts +5 -5
- package/core/gather/gatherers/network-user-agent.js +4 -4
- package/core/gather/gatherers/script-elements.d.ts +6 -11
- package/core/gather/gatherers/script-elements.js +4 -13
- package/core/gather/gatherers/scripts.d.ts +7 -6
- package/core/gather/gatherers/scripts.js +7 -9
- package/core/gather/gatherers/seo/embedded-content.d.ts +4 -4
- package/core/gather/gatherers/seo/embedded-content.js +3 -3
- package/core/gather/gatherers/seo/font-size.d.ts +6 -6
- package/core/gather/gatherers/seo/font-size.js +5 -5
- package/core/gather/gatherers/seo/robots-txt.d.ts +4 -4
- package/core/gather/gatherers/seo/robots-txt.js +3 -3
- package/core/gather/gatherers/seo/tap-targets.d.ts +8 -8
- package/core/gather/gatherers/seo/tap-targets.js +5 -5
- package/core/gather/gatherers/service-worker.d.ts +4 -10
- package/core/gather/gatherers/service-worker.js +3 -15
- package/core/gather/gatherers/source-maps.d.ts +11 -23
- package/core/gather/gatherers/source-maps.js +22 -53
- package/core/gather/gatherers/stacks.d.ts +7 -7
- package/core/gather/gatherers/stacks.js +6 -6
- package/core/gather/gatherers/trace-compat.d.ts +5 -5
- package/core/gather/gatherers/trace-compat.js +4 -4
- package/core/gather/gatherers/trace-elements.d.ts +13 -25
- package/core/gather/gatherers/trace-elements.js +19 -32
- package/core/gather/gatherers/trace.d.ts +8 -8
- package/core/gather/gatherers/trace.js +5 -5
- package/core/gather/gatherers/viewport-dimensions.d.ts +4 -4
- package/core/gather/gatherers/viewport-dimensions.js +3 -3
- package/core/gather/gatherers/web-app-manifest.d.ts +8 -8
- package/core/gather/gatherers/web-app-manifest.js +5 -5
- package/core/gather/navigation-runner.d.ts +9 -9
- package/core/gather/navigation-runner.js +14 -8
- package/core/gather/runner-helpers.d.ts +3 -3
- package/core/gather/runner-helpers.js +12 -4
- package/core/gather/session.d.ts +2 -2
- package/core/gather/session.js +1 -1
- package/core/gather/snapshot-runner.d.ts +2 -2
- package/core/gather/snapshot-runner.js +1 -1
- package/core/gather/timespan-runner.d.ts +2 -2
- package/core/gather/timespan-runner.js +1 -1
- package/core/index.cjs +0 -7
- package/core/index.d.ts +0 -15
- package/core/index.js +2 -40
- package/core/lib/asset-saver.js +14 -4
- package/core/lib/axe.js +1 -1
- package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +28 -12
- package/core/lib/dependency-graph/simulator/network-analyzer.js +128 -100
- package/core/lib/emulation.d.ts +14 -14
- package/core/lib/emulation.js +7 -7
- package/core/lib/navigation-error.js +5 -0
- package/core/lib/network-recorder.d.ts +2 -1
- package/core/lib/network-recorder.js +1 -0
- package/core/lib/network-request.js +12 -3
- package/core/lib/page-functions.d.ts +10 -2
- package/core/lib/page-functions.js +85 -8
- package/core/lib/sentry.js +9 -2
- package/core/lib/stack-packs.js +4 -0
- package/core/runner.d.ts +8 -30
- package/core/runner.js +8 -39
- package/core/user-flow.d.ts +4 -4
- package/core/user-flow.js +2 -2
- package/dist/report/bundle.esm.js +2221 -5832
- package/dist/report/flow.js +2631 -235
- package/dist/report/standalone.js +2586 -234
- package/flow-report/src/i18n/i18n.d.ts +2 -2
- package/package.json +19 -25
- package/readme.md +3 -1
- package/report/assets/templates.html +3 -1
- package/report/renderer/category-renderer.d.ts +3 -2
- package/report/renderer/category-renderer.js +8 -4
- package/report/renderer/components.js +11 -5
- package/report/renderer/pwa-category-renderer.js +1 -1
- package/report/renderer/report-ui-features.js +9 -6
- package/report/renderer/report-utils.d.ts +1 -1
- package/report/renderer/report-utils.js +2 -2
- package/report/renderer/topbar-features.js +3 -0
- package/shared/localization/locales/ar-XB.json +185 -44
- package/shared/localization/locales/ar.json +185 -44
- package/shared/localization/locales/bg.json +185 -44
- package/shared/localization/locales/ca.json +190 -49
- package/shared/localization/locales/cs.json +185 -44
- package/shared/localization/locales/da.json +185 -44
- package/shared/localization/locales/de.json +185 -44
- package/shared/localization/locales/el.json +185 -44
- package/shared/localization/locales/en-GB.json +185 -44
- package/shared/localization/locales/en-US.json +99 -45
- package/shared/localization/locales/en-XA.json +185 -44
- package/shared/localization/locales/en-XL.json +99 -45
- package/shared/localization/locales/es-419.json +185 -44
- package/shared/localization/locales/es.json +185 -44
- package/shared/localization/locales/fi.json +185 -44
- package/shared/localization/locales/fil.json +185 -44
- package/shared/localization/locales/fr.json +185 -44
- package/shared/localization/locales/he.json +186 -45
- package/shared/localization/locales/hi.json +185 -44
- package/shared/localization/locales/hr.json +185 -44
- package/shared/localization/locales/hu.json +185 -44
- package/shared/localization/locales/id.json +185 -44
- package/shared/localization/locales/it.json +185 -44
- package/shared/localization/locales/ja.json +185 -44
- package/shared/localization/locales/ko.json +185 -44
- package/shared/localization/locales/lt.json +185 -44
- package/shared/localization/locales/lv.json +185 -44
- package/shared/localization/locales/nl.json +185 -44
- package/shared/localization/locales/no.json +185 -44
- package/shared/localization/locales/pl.json +185 -44
- package/shared/localization/locales/pt-PT.json +185 -44
- package/shared/localization/locales/pt.json +190 -49
- package/shared/localization/locales/ro.json +185 -44
- package/shared/localization/locales/ru.json +185 -44
- package/shared/localization/locales/sk.json +185 -44
- package/shared/localization/locales/sl.json +185 -44
- package/shared/localization/locales/sr-Latn.json +185 -44
- package/shared/localization/locales/sr.json +185 -44
- package/shared/localization/locales/sv.json +185 -44
- package/shared/localization/locales/ta.json +185 -44
- package/shared/localization/locales/te.json +185 -44
- package/shared/localization/locales/th.json +185 -44
- package/shared/localization/locales/tr.json +185 -44
- package/shared/localization/locales/uk.json +185 -44
- package/shared/localization/locales/vi.json +185 -44
- package/shared/localization/locales/zh-HK.json +185 -44
- package/shared/localization/locales/zh-TW.json +185 -44
- package/shared/localization/locales/zh.json +185 -44
- package/third-party/esbuild-plugins-polyfills/LICENSE +3 -0
- package/third-party/esbuild-plugins-polyfills/README.md +7 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +9 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +129 -0
- package/tsconfig.json +2 -1
- package/types/artifacts.d.ts +16 -45
- package/types/config.d.ts +10 -52
- package/types/externs.d.ts +0 -2
- package/types/gatherer.d.ts +24 -47
- package/types/internal/rxjs.d.ts +26 -0
- package/types/internal/smokehouse.d.ts +1 -3
- package/types/lh.d.ts +0 -2
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/metrics/first-contentful-paint-3g.d.ts +0 -15
- package/core/audits/metrics/first-contentful-paint-3g.js +0 -69
- package/core/audits/resource-summary.d.ts +0 -16
- package/core/audits/resource-summary.js +0 -104
- package/core/audits/service-worker.d.ts +0 -46
- package/core/audits/service-worker.js +0 -182
- package/core/gather/gatherers/gatherer.d.ts +0 -46
- package/core/gather/gatherers/gatherer.js +0 -58
- package/core/legacy/config/config.d.ts +0 -107
- package/core/legacy/config/config.js +0 -566
- package/core/legacy/config/legacy-default-config.d.ts +0 -4
- package/core/legacy/config/legacy-default-config.js +0 -87
- package/core/legacy/gather/connections/connection.d.ts +0 -77
- package/core/legacy/gather/connections/connection.js +0 -196
- package/core/legacy/gather/connections/cri.d.ts +0 -27
- package/core/legacy/gather/connections/cri.js +0 -162
- package/core/legacy/gather/connections/raw.d.ts +0 -20
- package/core/legacy/gather/connections/raw.js +0 -57
- package/core/legacy/gather/driver.d.ts +0 -216
- package/core/legacy/gather/driver.js +0 -480
- package/core/legacy/gather/gather-runner.d.ts +0 -166
- package/core/legacy/gather/gather-runner.js +0 -590
- package/types/internal/lighthouse-logger.d.ts +0 -34
package/core/index.cjs
CHANGED
|
@@ -11,12 +11,6 @@ const lighthouse = async function lighthouse(...args) {
|
|
|
11
11
|
return lighthouse(...args);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
/** @type {import('./index.js')['legacyNavigation']} */
|
|
15
|
-
const legacyNavigation = async function legacyNavigation(...args) {
|
|
16
|
-
const {legacyNavigation} = await import('./index.js');
|
|
17
|
-
return legacyNavigation(...args);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
14
|
/** @type {import('./index.js')['startFlow']} */
|
|
21
15
|
const startFlow = async function startFlow(...args) {
|
|
22
16
|
const {startFlow} = await import('./index.js');
|
|
@@ -42,7 +36,6 @@ const snapshot = async function snapshot(...args) {
|
|
|
42
36
|
};
|
|
43
37
|
|
|
44
38
|
module.exports = lighthouse;
|
|
45
|
-
module.exports.legacyNavigation = legacyNavigation;
|
|
46
39
|
module.exports.startFlow = startFlow;
|
|
47
40
|
module.exports.navigation = navigation;
|
|
48
41
|
module.exports.startTimespan = startTimespan;
|
package/core/index.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ export { NetworkRecords } from "./computed/network-records.js";
|
|
|
5
5
|
export { default as defaultConfig } from "./config/default-config.js";
|
|
6
6
|
export { default as desktopConfig } from "./config/desktop-config.js";
|
|
7
7
|
export * from "../types/lh.js";
|
|
8
|
-
export type Connection = import('./legacy/gather/connections/connection.js').Connection;
|
|
9
|
-
/** @typedef {import('./legacy/gather/connections/connection.js').Connection} Connection */
|
|
10
8
|
/**
|
|
11
9
|
* Run Lighthouse.
|
|
12
10
|
* @param {string=} url The URL to test. Optional if running in auditMode.
|
|
@@ -18,19 +16,6 @@ export type Connection = import('./legacy/gather/connections/connection.js').Con
|
|
|
18
16
|
* @return {Promise<LH.RunnerResult|undefined>}
|
|
19
17
|
*/
|
|
20
18
|
declare function lighthouse(url?: string | undefined, flags?: LH.Flags | undefined, config?: LH.Config | undefined, page?: LH.Puppeteer.Page | undefined): Promise<LH.RunnerResult | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Run Lighthouse using the legacy navigation runner.
|
|
23
|
-
* This is left in place for any clients that don't support FR navigations yet (e.g. Lightrider)
|
|
24
|
-
* @deprecated
|
|
25
|
-
* @param {string=} url The URL to test. Optional if running in auditMode.
|
|
26
|
-
* @param {LH.Flags=} flags Optional settings for the Lighthouse run. If present,
|
|
27
|
-
* they will override any settings in the config.
|
|
28
|
-
* @param {LH.Config=} config Configuration for the Lighthouse run. If
|
|
29
|
-
* not present, the default config is used.
|
|
30
|
-
* @param {Connection=} userConnection
|
|
31
|
-
* @return {Promise<LH.RunnerResult|undefined>}
|
|
32
|
-
*/
|
|
33
|
-
export function legacyNavigation(url?: string | undefined, flags?: LH.Flags | undefined, config?: LH.Config | undefined, userConnection?: Connection | undefined): Promise<LH.RunnerResult | undefined>;
|
|
34
19
|
/**
|
|
35
20
|
* @param {LH.Puppeteer.Page} page
|
|
36
21
|
* @param {LH.UserFlow.Options} [options]
|
package/core/index.js
CHANGED
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
* 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.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import Trace from './gather/gatherers/trace.js';
|
|
9
8
|
import {Runner} from './runner.js';
|
|
10
|
-
import {CriConnection} from './legacy/gather/connections/cri.js';
|
|
11
|
-
import {LegacyResolvedConfig} from './legacy/config/config.js';
|
|
12
|
-
import UrlUtils from './lib/url-utils.js';
|
|
13
|
-
import {Driver} from './legacy/gather/driver.js';
|
|
14
9
|
import {UserFlow, auditGatherSteps} from './user-flow.js';
|
|
15
10
|
import {ReportGenerator} from '../report/generator/report-generator.js';
|
|
16
11
|
import {startTimespanGather} from './gather/timespan-runner.js';
|
|
@@ -18,8 +13,6 @@ import {snapshotGather} from './gather/snapshot-runner.js';
|
|
|
18
13
|
import {navigationGather} from './gather/navigation-runner.js';
|
|
19
14
|
import * as LH from '../types/lh.js';
|
|
20
15
|
|
|
21
|
-
/** @typedef {import('./legacy/gather/connections/connection.js').Connection} Connection */
|
|
22
|
-
|
|
23
16
|
/*
|
|
24
17
|
* The relationship between these root modules:
|
|
25
18
|
*
|
|
@@ -47,36 +40,6 @@ async function lighthouse(url, flags = {}, config, page) {
|
|
|
47
40
|
return navigation(page, url, {config, flags});
|
|
48
41
|
}
|
|
49
42
|
|
|
50
|
-
/**
|
|
51
|
-
* Run Lighthouse using the legacy navigation runner.
|
|
52
|
-
* This is left in place for any clients that don't support FR navigations yet (e.g. Lightrider)
|
|
53
|
-
* @deprecated
|
|
54
|
-
* @param {string=} url The URL to test. Optional if running in auditMode.
|
|
55
|
-
* @param {LH.Flags=} flags Optional settings for the Lighthouse run. If present,
|
|
56
|
-
* they will override any settings in the config.
|
|
57
|
-
* @param {LH.Config=} config Configuration for the Lighthouse run. If
|
|
58
|
-
* not present, the default config is used.
|
|
59
|
-
* @param {Connection=} userConnection
|
|
60
|
-
* @return {Promise<LH.RunnerResult|undefined>}
|
|
61
|
-
*/
|
|
62
|
-
async function legacyNavigation(url, flags = {}, config, userConnection) {
|
|
63
|
-
// set logging preferences, assume quiet
|
|
64
|
-
flags.logLevel = flags.logLevel || 'error';
|
|
65
|
-
log.setLevel(flags.logLevel);
|
|
66
|
-
|
|
67
|
-
const resolvedConfig = await LegacyResolvedConfig.fromJson(config, flags);
|
|
68
|
-
const computedCache = new Map();
|
|
69
|
-
const options = {resolvedConfig, computedCache};
|
|
70
|
-
const connection = userConnection || new CriConnection(flags.port, flags.hostname);
|
|
71
|
-
|
|
72
|
-
// kick off a lighthouse run
|
|
73
|
-
const artifacts = await Runner.gather(() => {
|
|
74
|
-
const requestedUrl = UrlUtils.normalizeUrl(url);
|
|
75
|
-
return Runner._gatherArtifactsFromBrowser(requestedUrl, options, connection);
|
|
76
|
-
}, options);
|
|
77
|
-
return Runner.audit(artifacts, options);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
43
|
/**
|
|
81
44
|
* @param {LH.Puppeteer.Page} page
|
|
82
45
|
* @param {LH.UserFlow.Options} [options]
|
|
@@ -150,7 +113,7 @@ function getAuditList() {
|
|
|
150
113
|
return Runner.getAuditList();
|
|
151
114
|
}
|
|
152
115
|
|
|
153
|
-
const traceCategories =
|
|
116
|
+
const traceCategories = Trace.getDefaultTraceCategories();
|
|
154
117
|
|
|
155
118
|
export default lighthouse;
|
|
156
119
|
export {Audit} from './audits/audit.js';
|
|
@@ -160,7 +123,6 @@ export {default as defaultConfig} from './config/default-config.js';
|
|
|
160
123
|
export {default as desktopConfig} from './config/desktop-config.js';
|
|
161
124
|
export * from '../types/lh.js';
|
|
162
125
|
export {
|
|
163
|
-
legacyNavigation,
|
|
164
126
|
startFlow,
|
|
165
127
|
navigation,
|
|
166
128
|
startTimespan,
|
package/core/lib/asset-saver.js
CHANGED
|
@@ -62,6 +62,9 @@ function loadArtifacts(basePath) {
|
|
|
62
62
|
if (passName === 'defaultPass') {
|
|
63
63
|
artifacts.DevtoolsLog = devtoolsLog;
|
|
64
64
|
}
|
|
65
|
+
if (passName === 'pageLoadError-defaultPass') {
|
|
66
|
+
artifacts.DevtoolsLogError = devtoolsLog;
|
|
67
|
+
}
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
// load traces
|
|
@@ -74,6 +77,9 @@ function loadArtifacts(basePath) {
|
|
|
74
77
|
if (passName === 'defaultPass') {
|
|
75
78
|
artifacts.Trace = artifacts.traces[passName];
|
|
76
79
|
}
|
|
80
|
+
if (passName === 'pageLoadError-defaultPass') {
|
|
81
|
+
artifacts.TraceError = artifacts.traces[passName];
|
|
82
|
+
}
|
|
77
83
|
});
|
|
78
84
|
|
|
79
85
|
if (Array.isArray(artifacts.Timing)) {
|
|
@@ -220,13 +226,17 @@ async function saveArtifacts(artifacts, basePath) {
|
|
|
220
226
|
const {traces, devtoolsLogs, DevtoolsLog, Trace, ...restArtifacts} = artifacts;
|
|
221
227
|
|
|
222
228
|
// save traces
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
if (traces) {
|
|
230
|
+
for (const [passName, trace] of Object.entries(traces)) {
|
|
231
|
+
await saveTrace(trace, `${basePath}/${passName}${traceSuffix}`);
|
|
232
|
+
}
|
|
225
233
|
}
|
|
226
234
|
|
|
227
235
|
// save devtools log
|
|
228
|
-
|
|
229
|
-
|
|
236
|
+
if (devtoolsLogs) {
|
|
237
|
+
for (const [passName, devtoolsLog] of Object.entries(devtoolsLogs)) {
|
|
238
|
+
await saveDevtoolsLog(devtoolsLog, `${basePath}/${passName}${devtoolsLogSuffix}`);
|
|
239
|
+
}
|
|
230
240
|
}
|
|
231
241
|
|
|
232
242
|
// save everything else, using a replacer to serialize LighthouseErrors in the artifacts.
|
package/core/lib/axe.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import {createRequire} from 'module';
|
|
9
9
|
|
|
10
|
-
// This is removed by
|
|
10
|
+
// This is removed by esbuild (if minified), because the only usage is to resolve a module path
|
|
11
11
|
// but that is replaced by the inline-fs plugin, leaving `require` unused.
|
|
12
12
|
const require = /* #__PURE__ */ createRequire(import.meta.url);
|
|
13
13
|
const axeSource = fs.readFileSync(require.resolve('axe-core/axe.min.js'), 'utf8');
|
|
@@ -65,39 +65,55 @@ export class NetworkAnalyzer {
|
|
|
65
65
|
* single handshake.
|
|
66
66
|
* This is the most accurate and preferred method of measurement when the data is available.
|
|
67
67
|
*
|
|
68
|
-
* @param {
|
|
69
|
-
* @return {
|
|
68
|
+
* @param {RequestInfo} info
|
|
69
|
+
* @return {number[]|number|undefined}
|
|
70
70
|
*/
|
|
71
|
-
static
|
|
71
|
+
static _estimateRTTViaConnectionTiming(info: {
|
|
72
|
+
record: LH.Artifacts.NetworkRequest;
|
|
73
|
+
timing: LH.Crdp.Network.ResourceTiming;
|
|
74
|
+
connectionReused?: boolean | undefined;
|
|
75
|
+
}): number[] | number | undefined;
|
|
72
76
|
/**
|
|
73
77
|
* Estimates the observed RTT to each origin based on how long a download took on a fresh connection.
|
|
74
78
|
* NOTE: this will tend to overestimate the actual RTT quite significantly as the download can be
|
|
75
79
|
* slow for other reasons as well such as bandwidth constraints.
|
|
76
80
|
*
|
|
77
|
-
* @param {
|
|
78
|
-
* @return {
|
|
81
|
+
* @param {RequestInfo} info
|
|
82
|
+
* @return {number|undefined}
|
|
79
83
|
*/
|
|
80
|
-
static
|
|
84
|
+
static _estimateRTTViaDownloadTiming(info: {
|
|
85
|
+
record: LH.Artifacts.NetworkRequest;
|
|
86
|
+
timing: LH.Crdp.Network.ResourceTiming;
|
|
87
|
+
connectionReused?: boolean | undefined;
|
|
88
|
+
}): number | undefined;
|
|
81
89
|
/**
|
|
82
90
|
* Estimates the observed RTT to each origin based on how long it took until Chrome could
|
|
83
91
|
* start sending the actual request when a new connection was required.
|
|
84
92
|
* NOTE: this will tend to overestimate the actual RTT as the request can be delayed for other
|
|
85
93
|
* reasons as well such as more SSL handshakes if TLS False Start is not enabled.
|
|
86
94
|
*
|
|
87
|
-
* @param {
|
|
88
|
-
* @return {
|
|
95
|
+
* @param {RequestInfo} info
|
|
96
|
+
* @return {number|undefined}
|
|
89
97
|
*/
|
|
90
|
-
static
|
|
98
|
+
static _estimateRTTViaSendStartTiming(info: {
|
|
99
|
+
record: LH.Artifacts.NetworkRequest;
|
|
100
|
+
timing: LH.Crdp.Network.ResourceTiming;
|
|
101
|
+
connectionReused?: boolean | undefined;
|
|
102
|
+
}): number | undefined;
|
|
91
103
|
/**
|
|
92
104
|
* Estimates the observed RTT to each origin based on how long it took until Chrome received the
|
|
93
105
|
* headers of the response (~TTFB).
|
|
94
106
|
* NOTE: this is the most inaccurate way to estimate the RTT, but in some environments it's all
|
|
95
107
|
* we have access to :(
|
|
96
108
|
*
|
|
97
|
-
* @param {
|
|
98
|
-
* @return {
|
|
109
|
+
* @param {RequestInfo} info
|
|
110
|
+
* @return {number|undefined}
|
|
99
111
|
*/
|
|
100
|
-
static
|
|
112
|
+
static _estimateRTTViaHeadersEndTiming(info: {
|
|
113
|
+
record: LH.Artifacts.NetworkRequest;
|
|
114
|
+
timing: LH.Crdp.Network.ResourceTiming;
|
|
115
|
+
connectionReused?: boolean | undefined;
|
|
116
|
+
}): number | undefined;
|
|
101
117
|
/**
|
|
102
118
|
* Given the RTT to each origin, estimates the observed server response times.
|
|
103
119
|
*
|
|
@@ -132,33 +132,32 @@ class NetworkAnalyzer {
|
|
|
132
132
|
* single handshake.
|
|
133
133
|
* This is the most accurate and preferred method of measurement when the data is available.
|
|
134
134
|
*
|
|
135
|
-
* @param {
|
|
136
|
-
* @return {
|
|
135
|
+
* @param {RequestInfo} info
|
|
136
|
+
* @return {number[]|number|undefined}
|
|
137
137
|
*/
|
|
138
|
-
static
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
138
|
+
static _estimateRTTViaConnectionTiming(info) {
|
|
139
|
+
const {timing, connectionReused, record} = info;
|
|
140
|
+
if (connectionReused) return;
|
|
141
|
+
|
|
142
|
+
// In LR, network records are missing connection timing, but we've smuggled it in via headers.
|
|
143
|
+
if (global.isLightrider && record.lrStatistics) {
|
|
144
|
+
if (record.protocol.startsWith('h3')) {
|
|
145
|
+
return record.lrStatistics.TCPMs;
|
|
146
|
+
} else {
|
|
147
|
+
return [record.lrStatistics.TCPMs / 2, record.lrStatistics.TCPMs / 2];
|
|
149
148
|
}
|
|
149
|
+
}
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
151
|
+
const {connectStart, sslStart, sslEnd, connectEnd} = timing;
|
|
152
|
+
if (connectEnd >= 0 && connectStart >= 0 && record.protocol.startsWith('h3')) {
|
|
153
|
+
// These values are equal to sslStart and sslEnd for h3.
|
|
154
|
+
return connectEnd - connectStart;
|
|
155
|
+
} else if (sslStart >= 0 && sslEnd >= 0 && sslStart !== connectStart) {
|
|
156
|
+
// SSL can also be more than 1 RT but assume False Start was used.
|
|
157
|
+
return [connectEnd - sslStart, sslStart - connectStart];
|
|
158
|
+
} else if (connectStart >= 0 && connectEnd >= 0) {
|
|
159
|
+
return connectEnd - connectStart;
|
|
160
|
+
}
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
/**
|
|
@@ -166,26 +165,27 @@ class NetworkAnalyzer {
|
|
|
166
165
|
* NOTE: this will tend to overestimate the actual RTT quite significantly as the download can be
|
|
167
166
|
* slow for other reasons as well such as bandwidth constraints.
|
|
168
167
|
*
|
|
169
|
-
* @param {
|
|
170
|
-
* @return {
|
|
168
|
+
* @param {RequestInfo} info
|
|
169
|
+
* @return {number|undefined}
|
|
171
170
|
*/
|
|
172
|
-
static
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// Only look at downloads that went past the initial congestion window
|
|
176
|
-
if (record.transferSize <= INITIAL_CWD) return;
|
|
177
|
-
if (!Number.isFinite(timing.receiveHeadersEnd) || timing.receiveHeadersEnd < 0) return;
|
|
171
|
+
static _estimateRTTViaDownloadTiming(info) {
|
|
172
|
+
const {timing, connectionReused, record} = info;
|
|
173
|
+
if (connectionReused) return;
|
|
178
174
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const numberOfRoundTrips = Math.log2(record.transferSize / INITIAL_CWD);
|
|
175
|
+
// Only look at downloads that went past the initial congestion window
|
|
176
|
+
if (record.transferSize <= INITIAL_CWD) return;
|
|
177
|
+
if (!Number.isFinite(timing.receiveHeadersEnd) || timing.receiveHeadersEnd < 0) return;
|
|
183
178
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
179
|
+
// Compute the amount of time downloading everything after the first congestion window took
|
|
180
|
+
const totalTime = record.networkEndTime - record.networkRequestTime;
|
|
181
|
+
const downloadTimeAfterFirstByte = totalTime - timing.receiveHeadersEnd;
|
|
182
|
+
const numberOfRoundTrips = Math.log2(record.transferSize / INITIAL_CWD);
|
|
183
|
+
|
|
184
|
+
// Ignore requests that required a high number of round trips since bandwidth starts to play
|
|
185
|
+
// a larger role than latency
|
|
186
|
+
if (numberOfRoundTrips > 5) return;
|
|
187
|
+
|
|
188
|
+
return downloadTimeAfterFirstByte / numberOfRoundTrips;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
@@ -194,21 +194,21 @@ class NetworkAnalyzer {
|
|
|
194
194
|
* NOTE: this will tend to overestimate the actual RTT as the request can be delayed for other
|
|
195
195
|
* reasons as well such as more SSL handshakes if TLS False Start is not enabled.
|
|
196
196
|
*
|
|
197
|
-
* @param {
|
|
198
|
-
* @return {
|
|
197
|
+
* @param {RequestInfo} info
|
|
198
|
+
* @return {number|undefined}
|
|
199
199
|
*/
|
|
200
|
-
static
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
200
|
+
static _estimateRTTViaSendStartTiming(info) {
|
|
201
|
+
const {timing, connectionReused, record} = info;
|
|
202
|
+
if (connectionReused) return;
|
|
203
|
+
|
|
204
|
+
if (!Number.isFinite(timing.sendStart) || timing.sendStart < 0) return;
|
|
205
|
+
|
|
206
|
+
// Assume everything before sendStart was just DNS + (SSL)? + TCP handshake
|
|
207
|
+
// 1 RT for DNS, 1 RT (maybe) for SSL, 1 RT for TCP
|
|
208
|
+
let roundTrips = 1;
|
|
209
|
+
if (!record.protocol.startsWith('h3')) roundTrips += 1; // TCP
|
|
210
|
+
if (record.parsedURL.scheme === 'https') roundTrips += 1;
|
|
211
|
+
return timing.sendStart / roundTrips;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/**
|
|
@@ -217,34 +217,33 @@ class NetworkAnalyzer {
|
|
|
217
217
|
* NOTE: this is the most inaccurate way to estimate the RTT, but in some environments it's all
|
|
218
218
|
* we have access to :(
|
|
219
219
|
*
|
|
220
|
-
* @param {
|
|
221
|
-
* @return {
|
|
220
|
+
* @param {RequestInfo} info
|
|
221
|
+
* @return {number|undefined}
|
|
222
222
|
*/
|
|
223
|
-
static
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
223
|
+
static _estimateRTTViaHeadersEndTiming(info) {
|
|
224
|
+
const {timing, connectionReused, record} = info;
|
|
225
|
+
if (!Number.isFinite(timing.receiveHeadersEnd) || timing.receiveHeadersEnd < 0) return;
|
|
226
|
+
if (!record.resourceType) return;
|
|
227
|
+
|
|
228
|
+
const serverResponseTimePercentage =
|
|
229
|
+
SERVER_RESPONSE_PERCENTAGE_OF_TTFB[record.resourceType] ||
|
|
230
|
+
DEFAULT_SERVER_RESPONSE_PERCENTAGE;
|
|
231
|
+
const estimatedServerResponseTime = timing.receiveHeadersEnd * serverResponseTimePercentage;
|
|
232
|
+
|
|
233
|
+
// When connection was reused...
|
|
234
|
+
// TTFB = 1 RT for request + server response time
|
|
235
|
+
let roundTrips = 1;
|
|
236
|
+
|
|
237
|
+
// When connection was fresh...
|
|
238
|
+
// TTFB = DNS + (SSL)? + TCP handshake + 1 RT for request + server response time
|
|
239
|
+
if (!connectionReused) {
|
|
240
|
+
roundTrips += 1; // DNS
|
|
241
|
+
if (!record.protocol.startsWith('h3')) roundTrips += 1; // TCP
|
|
242
|
+
if (record.parsedURL.scheme === 'https') roundTrips += 1; // SSL
|
|
243
|
+
}
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
});
|
|
245
|
+
// subtract out our estimated server response time
|
|
246
|
+
return Math.max((timing.receiveHeadersEnd - estimatedServerResponseTime) / roundTrips, 3);
|
|
248
247
|
}
|
|
249
248
|
|
|
250
249
|
/**
|
|
@@ -350,32 +349,61 @@ class NetworkAnalyzer {
|
|
|
350
349
|
useHeadersEndEstimates = true,
|
|
351
350
|
} = options || {};
|
|
352
351
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
estimatesByOrigin = new Map();
|
|
356
|
-
const estimatesViaDownload = NetworkAnalyzer._estimateRTTByOriginViaDownloadTiming(records);
|
|
357
|
-
const estimatesViaSendStart = NetworkAnalyzer._estimateRTTByOriginViaSendStartTiming(records);
|
|
358
|
-
const estimatesViaTTFB = NetworkAnalyzer._estimateRTTByOriginViaHeadersEndTiming(records);
|
|
352
|
+
const connectionWasReused = NetworkAnalyzer.estimateIfConnectionWasReused(records);
|
|
353
|
+
const groupedByOrigin = NetworkAnalyzer.groupByOrigin(records);
|
|
359
354
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
355
|
+
const estimatesByOrigin = new Map();
|
|
356
|
+
for (const [origin, originRecords] of groupedByOrigin.entries()) {
|
|
357
|
+
/** @type {number[]} */
|
|
358
|
+
const originEstimates = [];
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* @param {(e: RequestInfo) => number[]|number|undefined} estimator
|
|
362
|
+
*/
|
|
363
|
+
// eslint-disable-next-line no-inner-declarations
|
|
364
|
+
function collectEstimates(estimator, multiplier = 1) {
|
|
365
|
+
for (const record of originRecords) {
|
|
366
|
+
const timing = record.timing;
|
|
367
|
+
if (!timing) continue;
|
|
368
|
+
|
|
369
|
+
const estimates = estimator({
|
|
370
|
+
record,
|
|
371
|
+
timing,
|
|
372
|
+
connectionReused: connectionWasReused.get(record.requestId),
|
|
373
|
+
});
|
|
374
|
+
if (estimates === undefined) continue;
|
|
375
|
+
|
|
376
|
+
if (!Array.isArray(estimates)) {
|
|
377
|
+
originEstimates.push(estimates * multiplier);
|
|
378
|
+
} else {
|
|
379
|
+
originEstimates.push(...estimates.map(e => e * multiplier));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
363
382
|
}
|
|
364
383
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const existing = estimatesByOrigin.get(origin) || [];
|
|
368
|
-
estimatesByOrigin.set(origin, existing.concat(estimates));
|
|
384
|
+
if (!forceCoarseEstimates) {
|
|
385
|
+
collectEstimates(this._estimateRTTViaConnectionTiming);
|
|
369
386
|
}
|
|
370
387
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
388
|
+
// Connection timing can be missing for a few reasons:
|
|
389
|
+
// - Origin was preconnected, which we don't have instrumentation for.
|
|
390
|
+
// - Trace began recording after a connection has already been established (for example, in timespan mode)
|
|
391
|
+
// - Perhaps Chrome established a connection already in the background (service worker? Just guessing here)
|
|
392
|
+
// - Not provided in LR netstack.
|
|
393
|
+
if (!originEstimates.length) {
|
|
394
|
+
if (useDownloadEstimates) {
|
|
395
|
+
collectEstimates(this._estimateRTTViaDownloadTiming, coarseEstimateMultiplier);
|
|
396
|
+
}
|
|
397
|
+
if (useSendStartEstimates) {
|
|
398
|
+
collectEstimates(this._estimateRTTViaSendStartTiming, coarseEstimateMultiplier);
|
|
399
|
+
}
|
|
400
|
+
if (useHeadersEndEstimates) {
|
|
401
|
+
collectEstimates(this._estimateRTTViaHeadersEndTiming, coarseEstimateMultiplier);
|
|
402
|
+
}
|
|
375
403
|
}
|
|
376
404
|
|
|
377
|
-
|
|
378
|
-
|
|
405
|
+
if (originEstimates.length) {
|
|
406
|
+
estimatesByOrigin.set(origin, originEstimates);
|
|
379
407
|
}
|
|
380
408
|
}
|
|
381
409
|
|
package/core/lib/emulation.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {LH.Gatherer.
|
|
2
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
3
3
|
* @param {LH.Config.Settings} settings
|
|
4
4
|
* @return {Promise<void>}
|
|
5
5
|
*/
|
|
6
|
-
export function emulate(session: LH.Gatherer.
|
|
6
|
+
export function emulate(session: LH.Gatherer.ProtocolSession, settings: LH.Config.Settings): Promise<void>;
|
|
7
7
|
/**
|
|
8
8
|
* Sets the throttling options specified in config settings, clearing existing network throttling if
|
|
9
9
|
* throttlingMethod is not `devtools` (but not CPU throttling, suspected requirement of WPT-compat).
|
|
10
10
|
*
|
|
11
|
-
* @param {LH.Gatherer.
|
|
11
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
12
12
|
* @param {LH.Config.Settings} settings
|
|
13
13
|
* @return {Promise<void>}
|
|
14
14
|
*/
|
|
15
|
-
export function throttle(session: LH.Gatherer.
|
|
15
|
+
export function throttle(session: LH.Gatherer.ProtocolSession, settings: LH.Config.Settings): Promise<void>;
|
|
16
16
|
/**
|
|
17
|
-
* @param {LH.Gatherer.
|
|
17
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
18
18
|
* @return {Promise<void>}
|
|
19
19
|
*/
|
|
20
|
-
export function clearThrottling(session: LH.Gatherer.
|
|
20
|
+
export function clearThrottling(session: LH.Gatherer.ProtocolSession): Promise<void>;
|
|
21
21
|
/**
|
|
22
|
-
* @param {LH.Gatherer.
|
|
22
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
23
23
|
* @param {Required<LH.ThrottlingSettings>} throttlingSettings
|
|
24
24
|
* @return {Promise<void>}
|
|
25
25
|
*/
|
|
26
|
-
export function enableNetworkThrottling(session: LH.Gatherer.
|
|
26
|
+
export function enableNetworkThrottling(session: LH.Gatherer.ProtocolSession, throttlingSettings: Required<LH.ThrottlingSettings>): Promise<void>;
|
|
27
27
|
/**
|
|
28
|
-
* @param {LH.Gatherer.
|
|
28
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
29
29
|
* @return {Promise<void>}
|
|
30
30
|
*/
|
|
31
|
-
export function clearNetworkThrottling(session: LH.Gatherer.
|
|
31
|
+
export function clearNetworkThrottling(session: LH.Gatherer.ProtocolSession): Promise<void>;
|
|
32
32
|
/**
|
|
33
|
-
* @param {LH.Gatherer.
|
|
33
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
34
34
|
* @param {Required<LH.ThrottlingSettings>} throttlingSettings
|
|
35
35
|
* @return {Promise<void>}
|
|
36
36
|
*/
|
|
37
|
-
export function enableCPUThrottling(session: LH.Gatherer.
|
|
37
|
+
export function enableCPUThrottling(session: LH.Gatherer.ProtocolSession, throttlingSettings: Required<LH.ThrottlingSettings>): Promise<void>;
|
|
38
38
|
/**
|
|
39
|
-
* @param {LH.Gatherer.
|
|
39
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
40
40
|
* @return {Promise<void>}
|
|
41
41
|
*/
|
|
42
|
-
export function clearCPUThrottling(session: LH.Gatherer.
|
|
42
|
+
export function clearCPUThrottling(session: LH.Gatherer.ProtocolSession): Promise<void>;
|
|
43
43
|
//# sourceMappingURL=emulation.d.ts.map
|
package/core/lib/emulation.js
CHANGED
|
@@ -58,7 +58,7 @@ function parseUseragentIntoMetadata(userAgent, formFactor) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* @param {LH.Gatherer.
|
|
61
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
62
62
|
* @param {LH.Config.Settings} settings
|
|
63
63
|
* @return {Promise<void>}
|
|
64
64
|
*/
|
|
@@ -85,7 +85,7 @@ async function emulate(session, settings) {
|
|
|
85
85
|
* Sets the throttling options specified in config settings, clearing existing network throttling if
|
|
86
86
|
* throttlingMethod is not `devtools` (but not CPU throttling, suspected requirement of WPT-compat).
|
|
87
87
|
*
|
|
88
|
-
* @param {LH.Gatherer.
|
|
88
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
89
89
|
* @param {LH.Config.Settings} settings
|
|
90
90
|
* @return {Promise<void>}
|
|
91
91
|
*/
|
|
@@ -99,7 +99,7 @@ async function throttle(session, settings) {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* @param {LH.Gatherer.
|
|
102
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
103
103
|
* @return {Promise<void>}
|
|
104
104
|
*/
|
|
105
105
|
async function clearThrottling(session) {
|
|
@@ -107,7 +107,7 @@ async function clearThrottling(session) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* @param {LH.Gatherer.
|
|
110
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
111
111
|
* @param {Required<LH.ThrottlingSettings>} throttlingSettings
|
|
112
112
|
* @return {Promise<void>}
|
|
113
113
|
*/
|
|
@@ -127,7 +127,7 @@ function enableNetworkThrottling(session, throttlingSettings) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* @param {LH.Gatherer.
|
|
130
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
131
131
|
* @return {Promise<void>}
|
|
132
132
|
*/
|
|
133
133
|
function clearNetworkThrottling(session) {
|
|
@@ -135,7 +135,7 @@ function clearNetworkThrottling(session) {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* @param {LH.Gatherer.
|
|
138
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
139
139
|
* @param {Required<LH.ThrottlingSettings>} throttlingSettings
|
|
140
140
|
* @return {Promise<void>}
|
|
141
141
|
*/
|
|
@@ -145,7 +145,7 @@ function enableCPUThrottling(session, throttlingSettings) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
|
-
* @param {LH.Gatherer.
|
|
148
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
149
149
|
* @return {Promise<void>}
|
|
150
150
|
*/
|
|
151
151
|
function clearCPUThrottling(session) {
|