lighthouse 10.4.0 → 11.0.0
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 +17 -24
- 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
|
@@ -1,70 +1,45 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export default BaseGatherer;
|
|
2
2
|
/**
|
|
3
3
|
* Base class for all gatherers.
|
|
4
4
|
*
|
|
5
5
|
* @implements {LH.Gatherer.GathererInstance}
|
|
6
|
-
* @implements {LH.Gatherer.FRGathererInstance}
|
|
7
6
|
*/
|
|
8
|
-
declare class
|
|
7
|
+
declare class BaseGatherer implements LH.Gatherer.GathererInstance {
|
|
9
8
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
10
9
|
meta: LH.Gatherer.GathererMeta;
|
|
11
10
|
/**
|
|
12
11
|
* Method to start observing a page for an arbitrary period of time.
|
|
13
|
-
* @param {LH.Gatherer.
|
|
12
|
+
* @param {LH.Gatherer.Context} passContext
|
|
14
13
|
* @return {Promise<void>|void}
|
|
15
14
|
*/
|
|
16
|
-
startInstrumentation(passContext: LH.Gatherer.
|
|
15
|
+
startInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
|
|
17
16
|
/**
|
|
18
17
|
* Method to start observing a page when the measurements are very sensitive and
|
|
19
18
|
* should observe as little Lighthouse-induced work as possible.
|
|
20
|
-
* @param {LH.Gatherer.
|
|
19
|
+
* @param {LH.Gatherer.Context} passContext
|
|
21
20
|
* @return {Promise<void>|void}
|
|
22
21
|
*/
|
|
23
|
-
startSensitiveInstrumentation(passContext: LH.Gatherer.
|
|
22
|
+
startSensitiveInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
|
|
24
23
|
/**
|
|
25
24
|
* Method to stop observing a page when the measurements are very sensitive and
|
|
26
25
|
* should observe as little Lighthouse-induced work as possible.
|
|
27
26
|
*
|
|
28
|
-
* @param {LH.Gatherer.
|
|
27
|
+
* @param {LH.Gatherer.Context} passContext
|
|
29
28
|
* @return {Promise<void>|void}
|
|
30
29
|
*/
|
|
31
|
-
stopSensitiveInstrumentation(passContext: LH.Gatherer.
|
|
30
|
+
stopSensitiveInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
|
|
32
31
|
/**
|
|
33
32
|
* Method to end observing a page after an arbitrary period of time.
|
|
34
|
-
* @param {LH.Gatherer.
|
|
33
|
+
* @param {LH.Gatherer.Context} passContext
|
|
35
34
|
* @return {Promise<void>|void}
|
|
36
35
|
*/
|
|
37
|
-
stopInstrumentation(passContext: LH.Gatherer.
|
|
36
|
+
stopInstrumentation(passContext: LH.Gatherer.Context): Promise<void> | void;
|
|
38
37
|
/**
|
|
39
38
|
* Method to gather results about a page.
|
|
40
|
-
* @param {LH.Gatherer.
|
|
39
|
+
* @param {LH.Gatherer.Context} passContext
|
|
41
40
|
* @return {LH.Gatherer.PhaseResult}
|
|
42
41
|
*/
|
|
43
|
-
getArtifact(passContext: LH.Gatherer.
|
|
44
|
-
/**
|
|
45
|
-
* Legacy property used to define the artifact ID. In Fraggle Rock, the artifact ID lives on the config.
|
|
46
|
-
* @return {keyof LH.GathererArtifacts}
|
|
47
|
-
*/
|
|
48
|
-
get name(): keyof LH.GathererArtifacts;
|
|
49
|
-
/**
|
|
50
|
-
* Legacy method. Called before navigation to target url, roughly corresponds to `startInstrumentation`.
|
|
51
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
52
|
-
* @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
|
|
53
|
-
*/
|
|
54
|
-
beforePass(passContext: LH.Gatherer.PassContext): Promise<LH.Gatherer.PhaseResultNonPromise>;
|
|
55
|
-
/**
|
|
56
|
-
* Legacy method. Should never be used by a Fraggle Rock gatherer, here for compat only.
|
|
57
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
58
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
59
|
-
*/
|
|
60
|
-
pass(passContext: LH.Gatherer.PassContext): LH.Gatherer.PhaseResult;
|
|
61
|
-
/**
|
|
62
|
-
* Legacy method. Roughly corresponds to `stopInstrumentation` or `getArtifact` depending on type of gatherer.
|
|
63
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
64
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
65
|
-
* @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
|
|
66
|
-
*/
|
|
67
|
-
afterPass(passContext: LH.Gatherer.PassContext, loadData: LH.Gatherer.LoadData): Promise<LH.Gatherer.PhaseResultNonPromise>;
|
|
42
|
+
getArtifact(passContext: LH.Gatherer.Context): LH.Gatherer.PhaseResult;
|
|
68
43
|
}
|
|
69
44
|
import * as LH from '../../types/lh.js';
|
|
70
45
|
//# sourceMappingURL=base-gatherer.d.ts.map
|
|
@@ -12,15 +12,14 @@ import * as LH from '../../types/lh.js';
|
|
|
12
12
|
* Base class for all gatherers.
|
|
13
13
|
*
|
|
14
14
|
* @implements {LH.Gatherer.GathererInstance}
|
|
15
|
-
* @implements {LH.Gatherer.FRGathererInstance}
|
|
16
15
|
*/
|
|
17
|
-
class
|
|
16
|
+
class BaseGatherer {
|
|
18
17
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
19
18
|
meta = {supportedModes: []};
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Method to start observing a page for an arbitrary period of time.
|
|
23
|
-
* @param {LH.Gatherer.
|
|
22
|
+
* @param {LH.Gatherer.Context} passContext
|
|
24
23
|
* @return {Promise<void>|void}
|
|
25
24
|
*/
|
|
26
25
|
startInstrumentation(passContext) { }
|
|
@@ -28,7 +27,7 @@ class FRGatherer {
|
|
|
28
27
|
/**
|
|
29
28
|
* Method to start observing a page when the measurements are very sensitive and
|
|
30
29
|
* should observe as little Lighthouse-induced work as possible.
|
|
31
|
-
* @param {LH.Gatherer.
|
|
30
|
+
* @param {LH.Gatherer.Context} passContext
|
|
32
31
|
* @return {Promise<void>|void}
|
|
33
32
|
*/
|
|
34
33
|
startSensitiveInstrumentation(passContext) { }
|
|
@@ -37,70 +36,24 @@ class FRGatherer {
|
|
|
37
36
|
* Method to stop observing a page when the measurements are very sensitive and
|
|
38
37
|
* should observe as little Lighthouse-induced work as possible.
|
|
39
38
|
*
|
|
40
|
-
* @param {LH.Gatherer.
|
|
39
|
+
* @param {LH.Gatherer.Context} passContext
|
|
41
40
|
* @return {Promise<void>|void}
|
|
42
41
|
*/
|
|
43
42
|
stopSensitiveInstrumentation(passContext) { }
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
45
|
* Method to end observing a page after an arbitrary period of time.
|
|
47
|
-
* @param {LH.Gatherer.
|
|
46
|
+
* @param {LH.Gatherer.Context} passContext
|
|
48
47
|
* @return {Promise<void>|void}
|
|
49
48
|
*/
|
|
50
49
|
stopInstrumentation(passContext) { }
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
52
|
* Method to gather results about a page.
|
|
54
|
-
* @param {LH.Gatherer.
|
|
53
|
+
* @param {LH.Gatherer.Context} passContext
|
|
55
54
|
* @return {LH.Gatherer.PhaseResult}
|
|
56
55
|
*/
|
|
57
56
|
getArtifact(passContext) { }
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Legacy property used to define the artifact ID. In Fraggle Rock, the artifact ID lives on the config.
|
|
61
|
-
* @return {keyof LH.GathererArtifacts}
|
|
62
|
-
*/
|
|
63
|
-
get name() {
|
|
64
|
-
let name = this.constructor.name;
|
|
65
|
-
// Rollup will mangle class names in an known way–just trim until `$`.
|
|
66
|
-
if (name.includes('$')) {
|
|
67
|
-
name = name.substr(0, name.indexOf('$'));
|
|
68
|
-
}
|
|
69
|
-
// @ts-expect-error - assume that class name has been added to LH.GathererArtifacts.
|
|
70
|
-
return name;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Legacy method. Called before navigation to target url, roughly corresponds to `startInstrumentation`.
|
|
75
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
76
|
-
* @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
|
|
77
|
-
*/
|
|
78
|
-
async beforePass(passContext) {
|
|
79
|
-
await this.startInstrumentation({...passContext, dependencies: {}});
|
|
80
|
-
await this.startSensitiveInstrumentation({...passContext, dependencies: {}});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Legacy method. Should never be used by a Fraggle Rock gatherer, here for compat only.
|
|
85
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
86
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
87
|
-
*/
|
|
88
|
-
pass(passContext) { }
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Legacy method. Roughly corresponds to `stopInstrumentation` or `getArtifact` depending on type of gatherer.
|
|
92
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
93
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
94
|
-
* @return {Promise<LH.Gatherer.PhaseResultNonPromise>}
|
|
95
|
-
*/
|
|
96
|
-
async afterPass(passContext, loadData) {
|
|
97
|
-
if ('dependencies' in this.meta) {
|
|
98
|
-
throw Error('Gatherer with dependencies should override afterPass');
|
|
99
|
-
}
|
|
100
|
-
await this.stopSensitiveInstrumentation({...passContext, dependencies: {}});
|
|
101
|
-
await this.stopInstrumentation({...passContext, dependencies: {}});
|
|
102
|
-
return this.getArtifact({...passContext, dependencies: {}});
|
|
103
|
-
}
|
|
104
57
|
}
|
|
105
58
|
|
|
106
|
-
export default
|
|
59
|
+
export default BaseGatherer;
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* Resolves a backend node ID (from a trace event, protocol, etc) to the object ID for use with
|
|
3
3
|
* `Runtime.callFunctionOn`. `undefined` means the node could not be found.
|
|
4
4
|
*
|
|
5
|
-
* @param {LH.Gatherer.
|
|
5
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
6
6
|
* @param {number} backendNodeId
|
|
7
7
|
* @return {Promise<string|undefined>}
|
|
8
8
|
*/
|
|
9
|
-
export function resolveNodeIdToObjectId(session: LH.Gatherer.
|
|
9
|
+
export function resolveNodeIdToObjectId(session: LH.Gatherer.ProtocolSession, backendNodeId: number): Promise<string | undefined>;
|
|
10
10
|
/**
|
|
11
11
|
* Resolves a proprietary devtools node path (created from page-function.js) to the object ID for use
|
|
12
12
|
* with `Runtime.callFunctionOn`. `undefined` means the node could not be found.
|
|
13
13
|
* Requires `DOM.getDocument` to have been called since the object's creation or it will always be `undefined`.
|
|
14
14
|
*
|
|
15
|
-
* @param {LH.Gatherer.
|
|
15
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
16
16
|
* @param {string} path
|
|
17
17
|
* @return {Promise<string|undefined>}
|
|
18
18
|
*/
|
|
19
|
-
export function resolveDevtoolsNodePathToObjectId(session: LH.Gatherer.
|
|
19
|
+
export function resolveDevtoolsNodePathToObjectId(session: LH.Gatherer.ProtocolSession, path: string): Promise<string | undefined>;
|
|
20
20
|
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -22,7 +22,7 @@ function handlePotentialMissingNodeError(err) {
|
|
|
22
22
|
* Resolves a backend node ID (from a trace event, protocol, etc) to the object ID for use with
|
|
23
23
|
* `Runtime.callFunctionOn`. `undefined` means the node could not be found.
|
|
24
24
|
*
|
|
25
|
-
* @param {LH.Gatherer.
|
|
25
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
26
26
|
* @param {number} backendNodeId
|
|
27
27
|
* @return {Promise<string|undefined>}
|
|
28
28
|
*/
|
|
@@ -40,7 +40,7 @@ async function resolveNodeIdToObjectId(session, backendNodeId) {
|
|
|
40
40
|
* with `Runtime.callFunctionOn`. `undefined` means the node could not be found.
|
|
41
41
|
* Requires `DOM.getDocument` to have been called since the object's creation or it will always be `undefined`.
|
|
42
42
|
*
|
|
43
|
-
* @param {LH.Gatherer.
|
|
43
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
44
44
|
* @param {string} path
|
|
45
45
|
* @return {Promise<string|undefined>}
|
|
46
46
|
*/
|
|
@@ -2,18 +2,18 @@ export namespace UIStrings {
|
|
|
2
2
|
const warningSlowHostCpu: string;
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
|
-
* @param {LH.Gatherer.
|
|
5
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
6
6
|
* @return {Promise<LH.Crdp.Browser.GetVersionResponse & {milestone: number}>}
|
|
7
7
|
*/
|
|
8
|
-
export function getBrowserVersion(session: LH.Gatherer.
|
|
8
|
+
export function getBrowserVersion(session: LH.Gatherer.ProtocolSession): Promise<import("devtools-protocol").Protocol.Browser.GetVersionResponse & {
|
|
9
9
|
milestone: number;
|
|
10
10
|
}>;
|
|
11
11
|
/**
|
|
12
12
|
* Computes the benchmark index to get a rough estimate of device class.
|
|
13
|
-
* @param {LH.Gatherer.
|
|
13
|
+
* @param {LH.Gatherer.Driver['executionContext']} executionContext
|
|
14
14
|
* @return {Promise<number>}
|
|
15
15
|
*/
|
|
16
|
-
export function getBenchmarkIndex(executionContext: LH.Gatherer.
|
|
16
|
+
export function getBenchmarkIndex(executionContext: LH.Gatherer.Driver['executionContext']): Promise<number>;
|
|
17
17
|
/**
|
|
18
18
|
* Returns a warning if the host device appeared to be underpowered according to BenchmarkIndex.
|
|
19
19
|
*
|
|
@@ -30,7 +30,7 @@ const SLOW_CPU_BENCHMARK_INDEX_THRESHOLD = 1000;
|
|
|
30
30
|
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @param {LH.Gatherer.
|
|
33
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
34
34
|
* @return {Promise<LH.Crdp.Browser.GetVersionResponse & {milestone: number}>}
|
|
35
35
|
*/
|
|
36
36
|
async function getBrowserVersion(session) {
|
|
@@ -45,7 +45,7 @@ async function getBrowserVersion(session) {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Computes the benchmark index to get a rough estimate of device class.
|
|
48
|
-
* @param {LH.Gatherer.
|
|
48
|
+
* @param {LH.Gatherer.Driver['executionContext']} executionContext
|
|
49
49
|
* @return {Promise<number>}
|
|
50
50
|
*/
|
|
51
51
|
async function getBenchmarkIndex(executionContext) {
|
|
@@ -11,9 +11,18 @@ export class ExecutionContext {
|
|
|
11
11
|
* @return {string}
|
|
12
12
|
*/
|
|
13
13
|
static serializeArguments(args: unknown[]): string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Serializes an array of functions or strings.
|
|
16
|
+
*
|
|
17
|
+
* Also makes sure that an esbuild-bundled version of Lighthouse will
|
|
18
|
+
* continue to create working code to be executed within the browser.
|
|
19
|
+
* @param {Array<Function|string>=} deps
|
|
20
|
+
* @return {string}
|
|
21
|
+
*/
|
|
22
|
+
static serializeDeps(deps?: Array<Function | string> | undefined): string;
|
|
23
|
+
/** @param {LH.Gatherer.ProtocolSession} session */
|
|
24
|
+
constructor(session: LH.Gatherer.ProtocolSession);
|
|
25
|
+
_session: LH.Gatherer.ProtocolSession;
|
|
17
26
|
/** @type {number|undefined} */
|
|
18
27
|
_executionContextId: number | undefined;
|
|
19
28
|
/**
|
|
@@ -10,7 +10,7 @@ import * as LH from '../../../types/lh.js';
|
|
|
10
10
|
import {pageFunctions} from '../../lib/page-functions.js';
|
|
11
11
|
|
|
12
12
|
class ExecutionContext {
|
|
13
|
-
/** @param {LH.Gatherer.
|
|
13
|
+
/** @param {LH.Gatherer.ProtocolSession} session */
|
|
14
14
|
constructor(session) {
|
|
15
15
|
this._session = session;
|
|
16
16
|
|
|
@@ -108,6 +108,7 @@ class ExecutionContext {
|
|
|
108
108
|
${ExecutionContext._cachedNativesPreamble};
|
|
109
109
|
globalThis.__lighthouseExecutionContextUniqueIdentifier =
|
|
110
110
|
${uniqueExecutionContextIdentifier};
|
|
111
|
+
${pageFunctions.esbuildFunctionWrapperString}
|
|
111
112
|
return new Promise(function (resolve) {
|
|
112
113
|
return Promise.resolve()
|
|
113
114
|
.then(_ => ${expression})
|
|
@@ -196,7 +197,8 @@ class ExecutionContext {
|
|
|
196
197
|
*/
|
|
197
198
|
evaluate(mainFn, options) {
|
|
198
199
|
const argsSerialized = ExecutionContext.serializeArguments(options.args);
|
|
199
|
-
const depsSerialized =
|
|
200
|
+
const depsSerialized = ExecutionContext.serializeDeps(options.deps);
|
|
201
|
+
|
|
200
202
|
const expression = `(() => {
|
|
201
203
|
${depsSerialized}
|
|
202
204
|
return (${mainFn})(${argsSerialized});
|
|
@@ -215,7 +217,7 @@ class ExecutionContext {
|
|
|
215
217
|
*/
|
|
216
218
|
async evaluateOnNewDocument(mainFn, options) {
|
|
217
219
|
const argsSerialized = ExecutionContext.serializeArguments(options.args);
|
|
218
|
-
const depsSerialized =
|
|
220
|
+
const depsSerialized = ExecutionContext.serializeDeps(options.deps);
|
|
219
221
|
|
|
220
222
|
const expression = `(() => {
|
|
221
223
|
${ExecutionContext._cachedNativesPreamble};
|
|
@@ -265,6 +267,35 @@ class ExecutionContext {
|
|
|
265
267
|
static serializeArguments(args) {
|
|
266
268
|
return args.map(arg => arg === undefined ? 'undefined' : JSON.stringify(arg)).join(',');
|
|
267
269
|
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Serializes an array of functions or strings.
|
|
273
|
+
*
|
|
274
|
+
* Also makes sure that an esbuild-bundled version of Lighthouse will
|
|
275
|
+
* continue to create working code to be executed within the browser.
|
|
276
|
+
* @param {Array<Function|string>=} deps
|
|
277
|
+
* @return {string}
|
|
278
|
+
*/
|
|
279
|
+
static serializeDeps(deps) {
|
|
280
|
+
deps = [pageFunctions.esbuildFunctionWrapperString, ...deps || []];
|
|
281
|
+
return deps.map(dep => {
|
|
282
|
+
if (typeof dep === 'function') {
|
|
283
|
+
// esbuild will change the actual function name (ie. function actualName() {})
|
|
284
|
+
// always, and preserve the real name in `actualName.name`.
|
|
285
|
+
// See esbuildFunctionWrapperString.
|
|
286
|
+
const output = dep.toString();
|
|
287
|
+
const runtimeName = pageFunctions.getRuntimeFunctionName(dep);
|
|
288
|
+
if (runtimeName !== dep.name) {
|
|
289
|
+
// In addition to exposing the mangled name, also expose the original as an alias.
|
|
290
|
+
return `${output}; const ${dep.name} = ${runtimeName};`;
|
|
291
|
+
} else {
|
|
292
|
+
return output;
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
return dep;
|
|
296
|
+
}
|
|
297
|
+
}).join('\n');
|
|
298
|
+
}
|
|
268
299
|
}
|
|
269
300
|
|
|
270
301
|
export {ExecutionContext};
|
|
@@ -7,12 +7,12 @@ export type NavigationOptions = {
|
|
|
7
7
|
* Typical use of this method involves navigating to a neutral page such as `about:blank` in between
|
|
8
8
|
* navigations.
|
|
9
9
|
*
|
|
10
|
-
* @param {LH.Gatherer.
|
|
10
|
+
* @param {LH.Gatherer.Driver} driver
|
|
11
11
|
* @param {LH.NavigationRequestor} requestor
|
|
12
12
|
* @param {NavigationOptions} options
|
|
13
13
|
* @return {Promise<{requestedUrl: string, mainDocumentUrl: string, warnings: Array<LH.IcuMessage>}>}
|
|
14
14
|
*/
|
|
15
|
-
export function gotoURL(driver: LH.Gatherer.
|
|
15
|
+
export function gotoURL(driver: LH.Gatherer.Driver, requestor: LH.NavigationRequestor, options: NavigationOptions): Promise<{
|
|
16
16
|
requestedUrl: string;
|
|
17
17
|
mainDocumentUrl: string;
|
|
18
18
|
warnings: Array<LH.IcuMessage>;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import log from 'lighthouse-logger';
|
|
8
8
|
|
|
9
|
-
import {NetworkMonitor} from './network-monitor.js';
|
|
10
9
|
import {waitForFullyLoaded, waitForFrameNavigated, waitForUserToContinue} from './wait-for-condition.js'; // eslint-disable-line max-len
|
|
11
10
|
import * as constants from '../../config/constants.js';
|
|
12
11
|
import * as i18n from '../../lib/i18n/i18n.js';
|
|
@@ -77,7 +76,7 @@ function resolveWaitForFullyLoadedOptions(options) {
|
|
|
77
76
|
* Typical use of this method involves navigating to a neutral page such as `about:blank` in between
|
|
78
77
|
* navigations.
|
|
79
78
|
*
|
|
80
|
-
* @param {LH.Gatherer.
|
|
79
|
+
* @param {LH.Gatherer.Driver} driver
|
|
81
80
|
* @param {LH.NavigationRequestor} requestor
|
|
82
81
|
* @param {NavigationOptions} options
|
|
83
82
|
* @return {Promise<{requestedUrl: string, mainDocumentUrl: string, warnings: Array<LH.IcuMessage>}>}
|
|
@@ -89,10 +88,9 @@ async function gotoURL(driver, requestor, options) {
|
|
|
89
88
|
log.time(status);
|
|
90
89
|
|
|
91
90
|
const session = driver.defaultSession;
|
|
92
|
-
const networkMonitor =
|
|
91
|
+
const networkMonitor = driver.networkMonitor;
|
|
93
92
|
|
|
94
93
|
// Enable the events and network monitor needed to track navigation progress.
|
|
95
|
-
await networkMonitor.enable();
|
|
96
94
|
await session.sendCommand('Page.enable');
|
|
97
95
|
await session.sendCommand('Page.setLifecycleEventsEnabled', {enabled: true});
|
|
98
96
|
|
|
@@ -144,7 +142,6 @@ async function gotoURL(driver, requestor, options) {
|
|
|
144
142
|
|
|
145
143
|
// Bring `Page.navigate` errors back into the promise chain. See https://github.com/GoogleChrome/lighthouse/pull/6739.
|
|
146
144
|
await waitForNavigationTriggered;
|
|
147
|
-
await networkMonitor.disable();
|
|
148
145
|
|
|
149
146
|
if (options.debugNavigation) {
|
|
150
147
|
await waitForUserToContinue(driver);
|
|
@@ -17,16 +17,16 @@ export class NetworkMonitor extends NetworkMonitor_base {
|
|
|
17
17
|
start: number;
|
|
18
18
|
end: number;
|
|
19
19
|
}>;
|
|
20
|
-
/** @param {LH.Gatherer.
|
|
21
|
-
constructor(targetManager: LH.Gatherer.
|
|
20
|
+
/** @param {LH.Gatherer.Driver['targetManager']} targetManager */
|
|
21
|
+
constructor(targetManager: LH.Gatherer.Driver['targetManager']);
|
|
22
22
|
/** @type {NetworkRecorder|undefined} */
|
|
23
23
|
_networkRecorder: NetworkRecorder | undefined;
|
|
24
24
|
/** @type {Array<LH.Crdp.Page.Frame>} */
|
|
25
25
|
_frameNavigations: Array<LH.Crdp.Page.Frame>;
|
|
26
|
-
/** @type {LH.Gatherer.
|
|
27
|
-
_targetManager: LH.Gatherer.
|
|
28
|
-
/** @type {LH.Gatherer.
|
|
29
|
-
_session: LH.Gatherer.
|
|
26
|
+
/** @type {LH.Gatherer.Driver['targetManager']} */
|
|
27
|
+
_targetManager: LH.Gatherer.Driver['targetManager'];
|
|
28
|
+
/** @type {LH.Gatherer.ProtocolSession} */
|
|
29
|
+
_session: LH.Gatherer.ProtocolSession;
|
|
30
30
|
/** @param {LH.Crdp.Page.FrameNavigatedEvent} event */
|
|
31
31
|
_onFrameNavigated: (event: LH.Crdp.Page.FrameNavigatedEvent) => number;
|
|
32
32
|
/** @param {LH.Protocol.RawEventMessage} event */
|
|
@@ -76,6 +76,7 @@ export class NetworkMonitor extends NetworkMonitor_base {
|
|
|
76
76
|
*/
|
|
77
77
|
_emitNetworkStatus(): void;
|
|
78
78
|
}
|
|
79
|
+
import * as LH from '../../../types/lh.js';
|
|
79
80
|
import { NetworkRecorder } from '../../lib/network-recorder.js';
|
|
80
81
|
import { NetworkRequest } from '../../lib/network-request.js';
|
|
81
82
|
export {};
|
|
@@ -13,6 +13,7 @@ import {EventEmitter} from 'events';
|
|
|
13
13
|
|
|
14
14
|
import log from 'lighthouse-logger';
|
|
15
15
|
|
|
16
|
+
import * as LH from '../../../types/lh.js';
|
|
16
17
|
import {NetworkRecorder} from '../../lib/network-recorder.js';
|
|
17
18
|
import {NetworkRequest} from '../../lib/network-request.js';
|
|
18
19
|
import UrlUtils from '../../lib/url-utils.js';
|
|
@@ -30,15 +31,14 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
|
|
|
30
31
|
/** @type {Array<LH.Crdp.Page.Frame>} */
|
|
31
32
|
_frameNavigations = [];
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
/** @param {LH.Gatherer.FRTransitionalDriver['targetManager']} targetManager */
|
|
34
|
+
/** @param {LH.Gatherer.Driver['targetManager']} targetManager */
|
|
35
35
|
constructor(targetManager) {
|
|
36
36
|
super();
|
|
37
37
|
|
|
38
|
-
/** @type {LH.Gatherer.
|
|
38
|
+
/** @type {LH.Gatherer.Driver['targetManager']} */
|
|
39
39
|
this._targetManager = targetManager;
|
|
40
40
|
|
|
41
|
-
/** @type {LH.Gatherer.
|
|
41
|
+
/** @type {LH.Gatherer.ProtocolSession} */
|
|
42
42
|
this._session = targetManager.rootSession();
|
|
43
43
|
|
|
44
44
|
/** @param {LH.Crdp.Page.FrameNavigatedEvent} event */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Return the body of the response with the given ID. Rejects if getting the
|
|
3
3
|
* body times out.
|
|
4
|
-
* @param {LH.Gatherer.
|
|
4
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
5
5
|
* @param {string} requestId
|
|
6
6
|
* @param {number} [timeout]
|
|
7
7
|
* @return {Promise<string>}
|
|
8
8
|
*/
|
|
9
|
-
export function fetchResponseBodyFromCache(session: LH.Gatherer.
|
|
9
|
+
export function fetchResponseBodyFromCache(session: LH.Gatherer.ProtocolSession, requestId: string, timeout?: number | undefined): Promise<string>;
|
|
10
10
|
//# sourceMappingURL=network.d.ts.map
|
|
@@ -9,7 +9,7 @@ import {NetworkRequest} from '../../lib/network-request.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* Return the body of the response with the given ID. Rejects if getting the
|
|
11
11
|
* body times out.
|
|
12
|
-
* @param {LH.Gatherer.
|
|
12
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
13
13
|
* @param {string} requestId
|
|
14
14
|
* @param {number} [timeout]
|
|
15
15
|
* @return {Promise<string>}
|
|
@@ -3,42 +3,42 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This method assumes `prepareTargetForNavigationMode` or `prepareTargetForTimespanMode` has already been invoked.
|
|
5
5
|
*
|
|
6
|
-
* @param {LH.Gatherer.
|
|
6
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
7
7
|
* @param {LH.Config.Settings} settings
|
|
8
8
|
* @param {{disableThrottling: boolean, blockedUrlPatterns?: string[]}} options
|
|
9
9
|
*/
|
|
10
|
-
export function prepareThrottlingAndNetwork(session: LH.Gatherer.
|
|
10
|
+
export function prepareThrottlingAndNetwork(session: LH.Gatherer.ProtocolSession, settings: LH.Config.Settings, options: {
|
|
11
11
|
disableThrottling: boolean;
|
|
12
12
|
blockedUrlPatterns?: string[];
|
|
13
13
|
}): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Prepares a target to be analyzed in timespan mode by enabling protocol domains, emulation, and throttling.
|
|
16
16
|
*
|
|
17
|
-
* @param {LH.Gatherer.
|
|
17
|
+
* @param {LH.Gatherer.Driver} driver
|
|
18
18
|
* @param {LH.Config.Settings} settings
|
|
19
19
|
*/
|
|
20
|
-
export function prepareTargetForTimespanMode(driver: LH.Gatherer.
|
|
20
|
+
export function prepareTargetForTimespanMode(driver: LH.Gatherer.Driver, settings: LH.Config.Settings): Promise<void>;
|
|
21
21
|
/**
|
|
22
22
|
* Prepares a target to be analyzed in navigation mode by enabling protocol domains, emulation, and new document
|
|
23
23
|
* handlers for global APIs or error handling.
|
|
24
24
|
*
|
|
25
25
|
* This method should be used in combination with `prepareTargetForIndividualNavigation` before a specific navigation occurs.
|
|
26
26
|
*
|
|
27
|
-
* @param {LH.Gatherer.
|
|
27
|
+
* @param {LH.Gatherer.Driver} driver
|
|
28
28
|
* @param {LH.Config.Settings} settings
|
|
29
29
|
*/
|
|
30
|
-
export function prepareTargetForNavigationMode(driver: LH.Gatherer.
|
|
30
|
+
export function prepareTargetForNavigationMode(driver: LH.Gatherer.Driver, settings: LH.Config.Settings): Promise<void>;
|
|
31
31
|
/**
|
|
32
32
|
* Prepares a target for a particular navigation by resetting storage and setting network.
|
|
33
33
|
*
|
|
34
34
|
* This method assumes `prepareTargetForNavigationMode` has already been invoked.
|
|
35
35
|
*
|
|
36
|
-
* @param {LH.Gatherer.
|
|
36
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
37
37
|
* @param {LH.Config.Settings} settings
|
|
38
38
|
* @param {Pick<LH.Config.NavigationDefn, 'disableThrottling'|'disableStorageReset'|'blockedUrlPatterns'> & {requestor: LH.NavigationRequestor}} navigation
|
|
39
39
|
* @return {Promise<{warnings: Array<LH.IcuMessage>}>}
|
|
40
40
|
*/
|
|
41
|
-
export function prepareTargetForIndividualNavigation(session: LH.Gatherer.
|
|
41
|
+
export function prepareTargetForIndividualNavigation(session: LH.Gatherer.ProtocolSession, settings: LH.Config.Settings, navigation: Pick<import("../../../types/config.js").default.NavigationDefn, "blockedUrlPatterns" | "disableStorageReset" | "disableThrottling"> & {
|
|
42
42
|
requestor: LH.NavigationRequestor;
|
|
43
43
|
}): Promise<{
|
|
44
44
|
warnings: Array<LH.IcuMessage>;
|
|
@@ -46,7 +46,7 @@ export function prepareTargetForIndividualNavigation(session: LH.Gatherer.FRProt
|
|
|
46
46
|
/**
|
|
47
47
|
* Enables `Debugger` domain to receive async stacktrace information on network request initiators.
|
|
48
48
|
* This is critical for tracking attribution of tasks and performance simulation accuracy.
|
|
49
|
-
* @param {LH.Gatherer.
|
|
49
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
50
50
|
*/
|
|
51
|
-
export function enableAsyncStacks(session: LH.Gatherer.
|
|
51
|
+
export function enableAsyncStacks(session: LH.Gatherer.ProtocolSession): Promise<() => Promise<void>>;
|
|
52
52
|
//# sourceMappingURL=prepare.d.ts.map
|
|
@@ -13,7 +13,7 @@ import {pageFunctions} from '../../lib/page-functions.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* Enables `Debugger` domain to receive async stacktrace information on network request initiators.
|
|
15
15
|
* This is critical for tracking attribution of tasks and performance simulation accuracy.
|
|
16
|
-
* @param {LH.Gatherer.
|
|
16
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
17
17
|
*/
|
|
18
18
|
async function enableAsyncStacks(session) {
|
|
19
19
|
const enable = async () => {
|
|
@@ -54,7 +54,7 @@ async function enableAsyncStacks(session) {
|
|
|
54
54
|
/**
|
|
55
55
|
* Use a RequestIdleCallback shim for tests run with simulated throttling, so that the deadline can be used without
|
|
56
56
|
* a penalty.
|
|
57
|
-
* @param {LH.Gatherer.
|
|
57
|
+
* @param {LH.Gatherer.Driver} driver
|
|
58
58
|
* @param {LH.Config.Settings} settings
|
|
59
59
|
* @return {Promise<void>}
|
|
60
60
|
*/
|
|
@@ -67,7 +67,7 @@ async function shimRequestIdleCallbackOnNewDocument(driver, settings) {
|
|
|
67
67
|
/**
|
|
68
68
|
* Dismiss JavaScript dialogs (alert, confirm, prompt), providing a
|
|
69
69
|
* generic promptText in case the dialog is a prompt.
|
|
70
|
-
* @param {LH.Gatherer.
|
|
70
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
71
71
|
* @return {Promise<void>}
|
|
72
72
|
*/
|
|
73
73
|
async function dismissJavaScriptDialogs(session) {
|
|
@@ -87,7 +87,7 @@ async function dismissJavaScriptDialogs(session) {
|
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* Reset the storage and warn if any stored data could be affecting the scores.
|
|
90
|
-
* @param {LH.Gatherer.
|
|
90
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
91
91
|
* @param {string} url
|
|
92
92
|
* @return {Promise<{warnings: Array<LH.IcuMessage>}>}
|
|
93
93
|
*/
|
|
@@ -112,7 +112,7 @@ async function resetStorageForUrl(session, url) {
|
|
|
112
112
|
*
|
|
113
113
|
* This method assumes `prepareTargetForNavigationMode` or `prepareTargetForTimespanMode` has already been invoked.
|
|
114
114
|
*
|
|
115
|
-
* @param {LH.Gatherer.
|
|
115
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
116
116
|
* @param {LH.Config.Settings} settings
|
|
117
117
|
* @param {{disableThrottling: boolean, blockedUrlPatterns?: string[]}} options
|
|
118
118
|
*/
|
|
@@ -141,7 +141,7 @@ async function prepareThrottlingAndNetwork(session, settings, options) {
|
|
|
141
141
|
* Prepares a target to be analyzed by setting up device emulation (screen/UA, not throttling) and
|
|
142
142
|
* async stack traces for network initiators.
|
|
143
143
|
*
|
|
144
|
-
* @param {LH.Gatherer.
|
|
144
|
+
* @param {LH.Gatherer.Driver} driver
|
|
145
145
|
* @param {LH.Config.Settings} settings
|
|
146
146
|
*/
|
|
147
147
|
async function prepareDeviceEmulation(driver, settings) {
|
|
@@ -155,7 +155,7 @@ async function prepareDeviceEmulation(driver, settings) {
|
|
|
155
155
|
/**
|
|
156
156
|
* Prepares a target to be analyzed in timespan mode by enabling protocol domains, emulation, and throttling.
|
|
157
157
|
*
|
|
158
|
-
* @param {LH.Gatherer.
|
|
158
|
+
* @param {LH.Gatherer.Driver} driver
|
|
159
159
|
* @param {LH.Config.Settings} settings
|
|
160
160
|
*/
|
|
161
161
|
async function prepareTargetForTimespanMode(driver, settings) {
|
|
@@ -176,7 +176,7 @@ async function prepareTargetForTimespanMode(driver, settings) {
|
|
|
176
176
|
* Ensure the `Intl.Segmenter` created in `pageFunctions.truncate` is cached by v8 before
|
|
177
177
|
* recording the trace begins.
|
|
178
178
|
*
|
|
179
|
-
* @param {LH.Gatherer.
|
|
179
|
+
* @param {LH.Gatherer.Driver} driver
|
|
180
180
|
*/
|
|
181
181
|
async function warmUpIntlSegmenter(driver) {
|
|
182
182
|
await driver.executionContext.evaluate(pageFunctions.truncate, {
|
|
@@ -190,7 +190,7 @@ async function warmUpIntlSegmenter(driver) {
|
|
|
190
190
|
*
|
|
191
191
|
* This method should be used in combination with `prepareTargetForIndividualNavigation` before a specific navigation occurs.
|
|
192
192
|
*
|
|
193
|
-
* @param {LH.Gatherer.
|
|
193
|
+
* @param {LH.Gatherer.Driver} driver
|
|
194
194
|
* @param {LH.Config.Settings} settings
|
|
195
195
|
*/
|
|
196
196
|
async function prepareTargetForNavigationMode(driver, settings) {
|
|
@@ -220,7 +220,7 @@ async function prepareTargetForNavigationMode(driver, settings) {
|
|
|
220
220
|
*
|
|
221
221
|
* This method assumes `prepareTargetForNavigationMode` has already been invoked.
|
|
222
222
|
*
|
|
223
|
-
* @param {LH.Gatherer.
|
|
223
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
224
224
|
* @param {LH.Config.Settings} settings
|
|
225
225
|
* @param {Pick<LH.Config.NavigationDefn, 'disableThrottling'|'disableStorageReset'|'blockedUrlPatterns'> & {requestor: LH.NavigationRequestor}} navigation
|
|
226
226
|
* @return {Promise<{warnings: Array<LH.IcuMessage>}>}
|