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
|
@@ -9,7 +9,7 @@ export type TraceElementData = {
|
|
|
9
9
|
}[];
|
|
10
10
|
type?: string;
|
|
11
11
|
};
|
|
12
|
-
declare class TraceElements extends
|
|
12
|
+
declare class TraceElements extends BaseGatherer {
|
|
13
13
|
/**
|
|
14
14
|
* @param {Array<number>} rect
|
|
15
15
|
* @return {LH.Artifacts.Rect}
|
|
@@ -27,16 +27,16 @@ declare class TraceElements extends FRGatherer {
|
|
|
27
27
|
static getTopLayoutShiftElements(processedTrace: LH.Artifacts.ProcessedTrace): Array<TraceElementData>;
|
|
28
28
|
/**
|
|
29
29
|
* @param {LH.Trace} trace
|
|
30
|
-
* @param {LH.Gatherer.
|
|
30
|
+
* @param {LH.Gatherer.Context} context
|
|
31
31
|
* @return {Promise<TraceElementData|undefined>}
|
|
32
32
|
*/
|
|
33
|
-
static getResponsivenessElement(trace: LH.Trace, context: LH.Gatherer.
|
|
33
|
+
static getResponsivenessElement(trace: LH.Trace, context: LH.Gatherer.Context): Promise<TraceElementData | undefined>;
|
|
34
34
|
/**
|
|
35
35
|
* @param {LH.Trace} trace
|
|
36
|
-
* @param {LH.Gatherer.
|
|
36
|
+
* @param {LH.Gatherer.Context} context
|
|
37
37
|
* @return {Promise<{nodeId: number, type: string} | undefined>}
|
|
38
38
|
*/
|
|
39
|
-
static getLcpElement(trace: LH.Trace, context: LH.Gatherer.
|
|
39
|
+
static getLcpElement(trace: LH.Trace, context: LH.Gatherer.Context): Promise<{
|
|
40
40
|
nodeId: number;
|
|
41
41
|
type: string;
|
|
42
42
|
} | undefined>;
|
|
@@ -53,32 +53,20 @@ declare class TraceElements extends FRGatherer {
|
|
|
53
53
|
*/
|
|
54
54
|
getAnimatedElements(mainThreadEvents: Array<LH.TraceEvent>): Promise<Array<TraceElementData>>;
|
|
55
55
|
/**
|
|
56
|
-
* @param {LH.Gatherer.
|
|
56
|
+
* @param {LH.Gatherer.Context} context
|
|
57
57
|
*/
|
|
58
|
-
startInstrumentation(context: LH.Gatherer.
|
|
58
|
+
startInstrumentation(context: LH.Gatherer.Context): Promise<void>;
|
|
59
59
|
/**
|
|
60
|
-
* @param {LH.Gatherer.
|
|
60
|
+
* @param {LH.Gatherer.Context} context
|
|
61
61
|
*/
|
|
62
|
-
stopInstrumentation(context: LH.Gatherer.
|
|
62
|
+
stopInstrumentation(context: LH.Gatherer.Context): Promise<void>;
|
|
63
63
|
/**
|
|
64
|
-
* @param {LH.Gatherer.
|
|
65
|
-
* @param {LH.Trace|undefined} trace
|
|
66
|
-
* @return {Promise<LH.Artifacts['TraceElements']>}
|
|
67
|
-
*/
|
|
68
|
-
_getArtifact(context: LH.Gatherer.FRTransitionalContext, trace: LH.Trace | undefined): Promise<LH.Artifacts['TraceElements']>;
|
|
69
|
-
/**
|
|
70
|
-
* @param {LH.Gatherer.FRTransitionalContext<'Trace'>} context
|
|
64
|
+
* @param {LH.Gatherer.Context<'Trace'>} context
|
|
71
65
|
* @return {Promise<LH.Artifacts.TraceElement[]>}
|
|
72
66
|
*/
|
|
73
|
-
getArtifact(context: LH.Gatherer.
|
|
74
|
-
/**
|
|
75
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
76
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
77
|
-
* @return {Promise<LH.Artifacts.TraceElement[]>}
|
|
78
|
-
*/
|
|
79
|
-
afterPass(passContext: LH.Gatherer.PassContext, loadData: LH.Gatherer.LoadData): Promise<LH.Artifacts.TraceElement[]>;
|
|
67
|
+
getArtifact(context: LH.Gatherer.Context<'Trace'>): Promise<LH.Artifacts.TraceElement[]>;
|
|
80
68
|
}
|
|
81
|
-
import
|
|
82
|
-
import Trace from './trace.js';
|
|
69
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
83
70
|
import { ProcessedTrace } from '../../computed/processed-trace.js';
|
|
71
|
+
import Trace from './trace.js';
|
|
84
72
|
//# sourceMappingURL=trace-elements.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* We take the backend nodeId from the trace and use it to find the corresponding element in the DOM.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
16
16
|
import {resolveNodeIdToObjectId} from '../driver/dom.js';
|
|
17
17
|
import {pageFunctions} from '../../lib/page-functions.js';
|
|
18
18
|
import * as RectHelpers from '../../lib/rect-helpers.js';
|
|
@@ -23,6 +23,7 @@ import {ProcessedNavigation} from '../../computed/processed-navigation.js';
|
|
|
23
23
|
import {LighthouseError} from '../../lib/lh-error.js';
|
|
24
24
|
import {Responsiveness} from '../../computed/metrics/responsiveness.js';
|
|
25
25
|
import {CumulativeLayoutShift} from '../../computed/metrics/cumulative-layout-shift.js';
|
|
26
|
+
import {ExecutionContext} from '../driver/execution-context.js';
|
|
26
27
|
|
|
27
28
|
/** @typedef {{nodeId: number, score?: number, animations?: {name?: string, failureReasonsMask?: number, unsupportedProperties?: string[]}[], type?: string}} TraceElementData */
|
|
28
29
|
|
|
@@ -41,7 +42,7 @@ function getNodeDetailsData() {
|
|
|
41
42
|
}
|
|
42
43
|
/* c8 ignore stop */
|
|
43
44
|
|
|
44
|
-
class TraceElements extends
|
|
45
|
+
class TraceElements extends BaseGatherer {
|
|
45
46
|
/** @type {LH.Gatherer.GathererMeta<'Trace'>} */
|
|
46
47
|
meta = {
|
|
47
48
|
supportedModes: ['timespan', 'navigation'],
|
|
@@ -135,7 +136,7 @@ class TraceElements extends FRGatherer {
|
|
|
135
136
|
|
|
136
137
|
/**
|
|
137
138
|
* @param {LH.Trace} trace
|
|
138
|
-
* @param {LH.Gatherer.
|
|
139
|
+
* @param {LH.Gatherer.Context} context
|
|
139
140
|
* @return {Promise<TraceElementData|undefined>}
|
|
140
141
|
*/
|
|
141
142
|
static async getResponsivenessElement(trace, context) {
|
|
@@ -205,7 +206,7 @@ class TraceElements extends FRGatherer {
|
|
|
205
206
|
|
|
206
207
|
/**
|
|
207
208
|
* @param {LH.Trace} trace
|
|
208
|
-
* @param {LH.Gatherer.
|
|
209
|
+
* @param {LH.Gatherer.Context} context
|
|
209
210
|
* @return {Promise<{nodeId: number, type: string} | undefined>}
|
|
210
211
|
*/
|
|
211
212
|
static async getLcpElement(trace, context) {
|
|
@@ -233,7 +234,7 @@ class TraceElements extends FRGatherer {
|
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
/**
|
|
236
|
-
* @param {LH.Gatherer.
|
|
237
|
+
* @param {LH.Gatherer.Context} context
|
|
237
238
|
*/
|
|
238
239
|
async startInstrumentation(context) {
|
|
239
240
|
await context.driver.defaultSession.sendCommand('Animation.enable');
|
|
@@ -241,7 +242,7 @@ class TraceElements extends FRGatherer {
|
|
|
241
242
|
}
|
|
242
243
|
|
|
243
244
|
/**
|
|
244
|
-
* @param {LH.Gatherer.
|
|
245
|
+
* @param {LH.Gatherer.Context} context
|
|
245
246
|
*/
|
|
246
247
|
async stopInstrumentation(context) {
|
|
247
248
|
context.driver.defaultSession.off('Animation.animationStarted', this._onAnimationStarted);
|
|
@@ -249,12 +250,13 @@ class TraceElements extends FRGatherer {
|
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
/**
|
|
252
|
-
* @param {LH.Gatherer.
|
|
253
|
-
* @
|
|
254
|
-
* @return {Promise<LH.Artifacts['TraceElements']>}
|
|
253
|
+
* @param {LH.Gatherer.Context<'Trace'>} context
|
|
254
|
+
* @return {Promise<LH.Artifacts.TraceElement[]>}
|
|
255
255
|
*/
|
|
256
|
-
async
|
|
256
|
+
async getArtifact(context) {
|
|
257
257
|
const session = context.driver.defaultSession;
|
|
258
|
+
|
|
259
|
+
const trace = context.dependencies.Trace;
|
|
258
260
|
if (!trace) {
|
|
259
261
|
throw new Error('Trace is missing!');
|
|
260
262
|
}
|
|
@@ -283,11 +285,15 @@ class TraceElements extends FRGatherer {
|
|
|
283
285
|
try {
|
|
284
286
|
const objectId = await resolveNodeIdToObjectId(session, backendNodeId);
|
|
285
287
|
if (!objectId) continue;
|
|
288
|
+
|
|
289
|
+
const deps = ExecutionContext.serializeDeps([
|
|
290
|
+
pageFunctions.getNodeDetails,
|
|
291
|
+
getNodeDetailsData,
|
|
292
|
+
]);
|
|
286
293
|
response = await session.sendCommand('Runtime.callFunctionOn', {
|
|
287
294
|
objectId,
|
|
288
295
|
functionDeclaration: `function () {
|
|
289
|
-
${
|
|
290
|
-
${pageFunctions.getNodeDetails};
|
|
296
|
+
${deps}
|
|
291
297
|
return getNodeDetailsData.call(this);
|
|
292
298
|
}`,
|
|
293
299
|
returnByValue: true,
|
|
@@ -295,7 +301,7 @@ class TraceElements extends FRGatherer {
|
|
|
295
301
|
});
|
|
296
302
|
} catch (err) {
|
|
297
303
|
Sentry.captureException(err, {
|
|
298
|
-
tags: {gatherer:
|
|
304
|
+
tags: {gatherer: 'TraceElements'},
|
|
299
305
|
level: 'error',
|
|
300
306
|
});
|
|
301
307
|
continue;
|
|
@@ -316,25 +322,6 @@ class TraceElements extends FRGatherer {
|
|
|
316
322
|
|
|
317
323
|
return traceElements;
|
|
318
324
|
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* @param {LH.Gatherer.FRTransitionalContext<'Trace'>} context
|
|
322
|
-
* @return {Promise<LH.Artifacts.TraceElement[]>}
|
|
323
|
-
*/
|
|
324
|
-
async getArtifact(context) {
|
|
325
|
-
return this._getArtifact(context, context.dependencies.Trace);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
330
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
331
|
-
* @return {Promise<LH.Artifacts.TraceElement[]>}
|
|
332
|
-
*/
|
|
333
|
-
async afterPass(passContext, loadData) {
|
|
334
|
-
const context = {...passContext, dependencies: {}};
|
|
335
|
-
await this.stopInstrumentation(context);
|
|
336
|
-
return this._getArtifact(context, loadData.trace);
|
|
337
|
-
}
|
|
338
325
|
}
|
|
339
326
|
|
|
340
327
|
export default TraceElements;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export default Trace;
|
|
2
|
-
declare class Trace extends
|
|
2
|
+
declare class Trace extends BaseGatherer {
|
|
3
3
|
static getDefaultTraceCategories(): string[];
|
|
4
4
|
/**
|
|
5
|
-
* @param {LH.Gatherer.
|
|
5
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
6
6
|
* @return {Promise<LH.Trace>}
|
|
7
7
|
*/
|
|
8
|
-
static endTraceAndCollectEvents(session: LH.Gatherer.
|
|
8
|
+
static endTraceAndCollectEvents(session: LH.Gatherer.ProtocolSession): Promise<LH.Trace>;
|
|
9
9
|
static symbol: symbol;
|
|
10
10
|
/** @type {LH.Trace} */
|
|
11
11
|
_trace: LH.Trace;
|
|
12
12
|
/**
|
|
13
|
-
* @param {LH.Gatherer.
|
|
13
|
+
* @param {LH.Gatherer.Context} passContext
|
|
14
14
|
*/
|
|
15
|
-
startSensitiveInstrumentation({ driver, gatherMode, settings }: LH.Gatherer.
|
|
15
|
+
startSensitiveInstrumentation({ driver, gatherMode, settings }: LH.Gatherer.Context): Promise<void>;
|
|
16
16
|
/**
|
|
17
|
-
* @param {LH.Gatherer.
|
|
17
|
+
* @param {LH.Gatherer.Context} passContext
|
|
18
18
|
*/
|
|
19
|
-
stopSensitiveInstrumentation({ driver }: LH.Gatherer.
|
|
19
|
+
stopSensitiveInstrumentation({ driver }: LH.Gatherer.Context): Promise<void>;
|
|
20
20
|
getArtifact(): import("../../index.js").Trace;
|
|
21
21
|
}
|
|
22
|
-
import
|
|
22
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
23
23
|
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* This protocol log can be used to recreate the network records using lib/network-recorder.js.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
14
14
|
import {TraceProcessor} from '../../lib/tracehouse/trace-processor.js';
|
|
15
15
|
|
|
16
|
-
class Trace extends
|
|
16
|
+
class Trace extends BaseGatherer {
|
|
17
17
|
/** @type {LH.Trace} */
|
|
18
18
|
_trace = {traceEvents: []};
|
|
19
19
|
|
|
@@ -63,7 +63,7 @@ class Trace extends FRGatherer {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* @param {LH.Gatherer.
|
|
66
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
67
67
|
* @return {Promise<LH.Trace>}
|
|
68
68
|
*/
|
|
69
69
|
static async endTraceAndCollectEvents(session) {
|
|
@@ -98,7 +98,7 @@ class Trace extends FRGatherer {
|
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* @param {LH.Gatherer.
|
|
101
|
+
* @param {LH.Gatherer.Context} passContext
|
|
102
102
|
*/
|
|
103
103
|
async startSensitiveInstrumentation({driver, gatherMode, settings}) {
|
|
104
104
|
const traceCategories = Trace.getDefaultTraceCategories()
|
|
@@ -116,7 +116,7 @@ class Trace extends FRGatherer {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* @param {LH.Gatherer.
|
|
119
|
+
* @param {LH.Gatherer.Context} passContext
|
|
120
120
|
*/
|
|
121
121
|
async stopSensitiveInstrumentation({driver}) {
|
|
122
122
|
this._trace = await Trace.endTraceAndCollectEvents(driver.defaultSession);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default ViewportDimensions;
|
|
2
|
-
declare class ViewportDimensions extends
|
|
2
|
+
declare class ViewportDimensions extends BaseGatherer {
|
|
3
3
|
/**
|
|
4
|
-
* @param {LH.Gatherer.
|
|
4
|
+
* @param {LH.Gatherer.Context} passContext
|
|
5
5
|
* @return {Promise<LH.Artifacts.ViewportDimensions>}
|
|
6
6
|
*/
|
|
7
|
-
getArtifact(passContext: LH.Gatherer.
|
|
7
|
+
getArtifact(passContext: LH.Gatherer.Context): Promise<LH.Artifacts.ViewportDimensions>;
|
|
8
8
|
}
|
|
9
|
-
import
|
|
9
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
10
10
|
//# sourceMappingURL=viewport-dimensions.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
|
7
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
8
8
|
|
|
9
9
|
/* global window */
|
|
10
10
|
|
|
@@ -26,14 +26,14 @@ function getViewportDimensions() {
|
|
|
26
26
|
}
|
|
27
27
|
/* c8 ignore stop */
|
|
28
28
|
|
|
29
|
-
class ViewportDimensions extends
|
|
29
|
+
class ViewportDimensions extends BaseGatherer {
|
|
30
30
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
31
31
|
meta = {
|
|
32
32
|
supportedModes: ['snapshot', 'timespan', 'navigation'],
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* @param {LH.Gatherer.
|
|
36
|
+
* @param {LH.Gatherer.Context} passContext
|
|
37
37
|
* @return {Promise<LH.Artifacts.ViewportDimensions>}
|
|
38
38
|
*/
|
|
39
39
|
async getArtifact(passContext) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default WebAppManifest;
|
|
2
|
-
declare class WebAppManifest extends
|
|
2
|
+
declare class WebAppManifest extends BaseGatherer {
|
|
3
3
|
/**
|
|
4
|
-
* @param {LH.Gatherer.
|
|
4
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
5
5
|
* @return {Promise<{url: string, data: string}|null>}
|
|
6
6
|
*/
|
|
7
|
-
static fetchAppManifest(session: LH.Gatherer.
|
|
7
|
+
static fetchAppManifest(session: LH.Gatherer.ProtocolSession): Promise<{
|
|
8
8
|
url: string;
|
|
9
9
|
data: string;
|
|
10
10
|
} | null>;
|
|
@@ -17,16 +17,16 @@ declare class WebAppManifest extends FRGatherer {
|
|
|
17
17
|
* was unparseable as JSON, manifest.value will be undefined and manifest.warning
|
|
18
18
|
* will have the reason. See manifest-parser.js for more information.
|
|
19
19
|
*
|
|
20
|
-
* @param {LH.Gatherer.
|
|
20
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
21
21
|
* @param {string} pageUrl
|
|
22
22
|
* @return {Promise<LH.Artifacts.Manifest|null>}
|
|
23
23
|
*/
|
|
24
|
-
static getWebAppManifest(session: LH.Gatherer.
|
|
24
|
+
static getWebAppManifest(session: LH.Gatherer.ProtocolSession, pageUrl: string): Promise<LH.Artifacts.Manifest | null>;
|
|
25
25
|
/**
|
|
26
|
-
* @param {LH.Gatherer.
|
|
26
|
+
* @param {LH.Gatherer.Context} context
|
|
27
27
|
* @return {Promise<LH.Artifacts['WebAppManifest']>}
|
|
28
28
|
*/
|
|
29
|
-
getArtifact(context: LH.Gatherer.
|
|
29
|
+
getArtifact(context: LH.Gatherer.Context): Promise<LH.Artifacts['WebAppManifest']>;
|
|
30
30
|
}
|
|
31
|
-
import
|
|
31
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
32
32
|
//# sourceMappingURL=web-app-manifest.d.ts.map
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
import log from 'lighthouse-logger';
|
|
8
8
|
|
|
9
9
|
import {parseManifest} from '../../lib/manifest-parser.js';
|
|
10
|
-
import
|
|
10
|
+
import BaseGatherer from '../base-gatherer.js';
|
|
11
11
|
|
|
12
|
-
class WebAppManifest extends
|
|
12
|
+
class WebAppManifest extends BaseGatherer {
|
|
13
13
|
/** @type {LH.Gatherer.GathererMeta} */
|
|
14
14
|
meta = {
|
|
15
15
|
supportedModes: ['snapshot', 'navigation'],
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @param {LH.Gatherer.
|
|
19
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
20
20
|
* @return {Promise<{url: string, data: string}|null>}
|
|
21
21
|
*/
|
|
22
22
|
static async fetchAppManifest(session) {
|
|
@@ -74,7 +74,7 @@ class WebAppManifest extends FRGatherer {
|
|
|
74
74
|
* was unparseable as JSON, manifest.value will be undefined and manifest.warning
|
|
75
75
|
* will have the reason. See manifest-parser.js for more information.
|
|
76
76
|
*
|
|
77
|
-
* @param {LH.Gatherer.
|
|
77
|
+
* @param {LH.Gatherer.ProtocolSession} session
|
|
78
78
|
* @param {string} pageUrl
|
|
79
79
|
* @return {Promise<LH.Artifacts.Manifest|null>}
|
|
80
80
|
*/
|
|
@@ -89,7 +89,7 @@ class WebAppManifest extends FRGatherer {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* @param {LH.Gatherer.
|
|
92
|
+
* @param {LH.Gatherer.Context} context
|
|
93
93
|
* @return {Promise<LH.Artifacts['WebAppManifest']>}
|
|
94
94
|
*/
|
|
95
95
|
async getArtifact(context) {
|
|
@@ -4,7 +4,7 @@ export type NavigationContext = {
|
|
|
4
4
|
resolvedConfig: LH.Config.ResolvedConfig;
|
|
5
5
|
navigation: LH.Config.NavigationDefn;
|
|
6
6
|
requestor: LH.NavigationRequestor;
|
|
7
|
-
baseArtifacts: LH.
|
|
7
|
+
baseArtifacts: LH.BaseArtifacts;
|
|
8
8
|
computedCache: Map<string, LH.ArbitraryEqualityMap>;
|
|
9
9
|
};
|
|
10
10
|
export type PhaseState = Omit<Parameters<typeof collectPhaseArtifacts>[0], 'phase'>;
|
|
@@ -12,22 +12,22 @@ export type PhaseState = Omit<Parameters<typeof collectPhaseArtifacts>[0], 'phas
|
|
|
12
12
|
* @param {LH.Puppeteer.Page|undefined} page
|
|
13
13
|
* @param {LH.NavigationRequestor|undefined} requestor
|
|
14
14
|
* @param {{config?: LH.Config, flags?: LH.Flags}} [options]
|
|
15
|
-
* @return {Promise<LH.Gatherer.
|
|
15
|
+
* @return {Promise<LH.Gatherer.GatherResult>}
|
|
16
16
|
*/
|
|
17
17
|
export function navigationGather(page: LH.Puppeteer.Page | undefined, requestor: LH.NavigationRequestor | undefined, options?: {
|
|
18
18
|
config?: import("../../types/config.js").default | undefined;
|
|
19
19
|
flags?: import("../index.js").Flags | undefined;
|
|
20
|
-
} | undefined): Promise<LH.Gatherer.
|
|
20
|
+
} | undefined): Promise<LH.Gatherer.GatherResult>;
|
|
21
21
|
/**
|
|
22
22
|
* @param {{driver: Driver, resolvedConfig: LH.Config.ResolvedConfig, requestor: LH.NavigationRequestor}} args
|
|
23
|
-
* @return {Promise<{baseArtifacts: LH.
|
|
23
|
+
* @return {Promise<{baseArtifacts: LH.BaseArtifacts}>}
|
|
24
24
|
*/
|
|
25
25
|
export function _setup({ driver, resolvedConfig, requestor }: {
|
|
26
26
|
driver: Driver;
|
|
27
27
|
resolvedConfig: LH.Config.ResolvedConfig;
|
|
28
28
|
requestor: LH.NavigationRequestor;
|
|
29
29
|
}): Promise<{
|
|
30
|
-
baseArtifacts: LH.
|
|
30
|
+
baseArtifacts: LH.BaseArtifacts;
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
33
|
* @param {NavigationContext} navigationContext
|
|
@@ -52,18 +52,18 @@ export function _navigate(navigationContext: NavigationContext): Promise<{
|
|
|
52
52
|
*/
|
|
53
53
|
export function _navigation(navigationContext: NavigationContext): ReturnType<typeof _computeNavigationResult>;
|
|
54
54
|
/**
|
|
55
|
-
* @param {{driver: Driver, page: LH.Puppeteer.Page, resolvedConfig: LH.Config.ResolvedConfig, requestor: LH.NavigationRequestor; baseArtifacts: LH.
|
|
56
|
-
* @return {Promise<{artifacts: Partial<LH.
|
|
55
|
+
* @param {{driver: Driver, page: LH.Puppeteer.Page, resolvedConfig: LH.Config.ResolvedConfig, requestor: LH.NavigationRequestor; baseArtifacts: LH.BaseArtifacts, computedCache: NavigationContext['computedCache']}} args
|
|
56
|
+
* @return {Promise<{artifacts: Partial<LH.Artifacts & LH.BaseArtifacts>}>}
|
|
57
57
|
*/
|
|
58
58
|
export function _navigations(args: {
|
|
59
59
|
driver: Driver;
|
|
60
60
|
page: LH.Puppeteer.Page;
|
|
61
61
|
resolvedConfig: LH.Config.ResolvedConfig;
|
|
62
62
|
requestor: LH.NavigationRequestor;
|
|
63
|
-
baseArtifacts: LH.
|
|
63
|
+
baseArtifacts: LH.BaseArtifacts;
|
|
64
64
|
computedCache: NavigationContext['computedCache'];
|
|
65
65
|
}): Promise<{
|
|
66
|
-
artifacts: Partial<LH.
|
|
66
|
+
artifacts: Partial<LH.Artifacts & LH.BaseArtifacts>;
|
|
67
67
|
}>;
|
|
68
68
|
/**
|
|
69
69
|
* @param {{requestedUrl?: string, driver: Driver, resolvedConfig: LH.Config.ResolvedConfig, lhBrowser?: LH.Puppeteer.Browser, lhPage?: LH.Puppeteer.Page}} args
|
|
@@ -32,7 +32,7 @@ import {NetworkRecords} from '../computed/network-records.js';
|
|
|
32
32
|
* @property {LH.Config.ResolvedConfig} resolvedConfig
|
|
33
33
|
* @property {LH.Config.NavigationDefn} navigation
|
|
34
34
|
* @property {LH.NavigationRequestor} requestor
|
|
35
|
-
* @property {LH.
|
|
35
|
+
* @property {LH.BaseArtifacts} baseArtifacts
|
|
36
36
|
* @property {Map<string, LH.ArbitraryEqualityMap>} computedCache
|
|
37
37
|
*/
|
|
38
38
|
|
|
@@ -43,7 +43,7 @@ const DEFAULT_PORT = 9222;
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* @param {{driver: Driver, resolvedConfig: LH.Config.ResolvedConfig, requestor: LH.NavigationRequestor}} args
|
|
46
|
-
* @return {Promise<{baseArtifacts: LH.
|
|
46
|
+
* @return {Promise<{baseArtifacts: LH.BaseArtifacts}>}
|
|
47
47
|
*/
|
|
48
48
|
async function _setup({driver, resolvedConfig, requestor}) {
|
|
49
49
|
await driver.connect();
|
|
@@ -188,8 +188,14 @@ async function _computeNavigationResult(
|
|
|
188
188
|
/** @type {Partial<LH.GathererArtifacts>} */
|
|
189
189
|
const artifacts = {};
|
|
190
190
|
const pageLoadErrorId = `pageLoadError-${navigationContext.navigation.id}`;
|
|
191
|
-
if (debugData.devtoolsLog)
|
|
192
|
-
|
|
191
|
+
if (debugData.devtoolsLog) {
|
|
192
|
+
artifacts.DevtoolsLogError = debugData.devtoolsLog;
|
|
193
|
+
artifacts.devtoolsLogs = {[pageLoadErrorId]: debugData.devtoolsLog};
|
|
194
|
+
}
|
|
195
|
+
if (debugData.trace) {
|
|
196
|
+
artifacts.TraceError = debugData.trace;
|
|
197
|
+
artifacts.traces = {[pageLoadErrorId]: debugData.trace};
|
|
198
|
+
}
|
|
193
199
|
|
|
194
200
|
return {
|
|
195
201
|
pageLoadError,
|
|
@@ -260,8 +266,8 @@ async function _navigation(navigationContext) {
|
|
|
260
266
|
}
|
|
261
267
|
|
|
262
268
|
/**
|
|
263
|
-
* @param {{driver: Driver, page: LH.Puppeteer.Page, resolvedConfig: LH.Config.ResolvedConfig, requestor: LH.NavigationRequestor; baseArtifacts: LH.
|
|
264
|
-
* @return {Promise<{artifacts: Partial<LH.
|
|
269
|
+
* @param {{driver: Driver, page: LH.Puppeteer.Page, resolvedConfig: LH.Config.ResolvedConfig, requestor: LH.NavigationRequestor; baseArtifacts: LH.BaseArtifacts, computedCache: NavigationContext['computedCache']}} args
|
|
270
|
+
* @return {Promise<{artifacts: Partial<LH.Artifacts & LH.BaseArtifacts>}>}
|
|
265
271
|
*/
|
|
266
272
|
async function _navigations(args) {
|
|
267
273
|
const {
|
|
@@ -277,7 +283,7 @@ async function _navigations(args) {
|
|
|
277
283
|
throw new Error('No artifacts were defined on the config');
|
|
278
284
|
}
|
|
279
285
|
|
|
280
|
-
/** @type {Partial<LH.
|
|
286
|
+
/** @type {Partial<LH.Artifacts & LH.BaseArtifacts>} */
|
|
281
287
|
const artifacts = {};
|
|
282
288
|
/** @type {Array<LH.IcuMessage>} */
|
|
283
289
|
const LighthouseRunWarnings = [];
|
|
@@ -328,7 +334,7 @@ async function _cleanup({requestedUrl, driver, resolvedConfig, lhBrowser, lhPage
|
|
|
328
334
|
* @param {LH.Puppeteer.Page|undefined} page
|
|
329
335
|
* @param {LH.NavigationRequestor|undefined} requestor
|
|
330
336
|
* @param {{config?: LH.Config, flags?: LH.Flags}} [options]
|
|
331
|
-
* @return {Promise<LH.Gatherer.
|
|
337
|
+
* @return {Promise<LH.Gatherer.GatherResult>}
|
|
332
338
|
*/
|
|
333
339
|
async function navigationGather(page, requestor, options = {}) {
|
|
334
340
|
const {flags = {}, config} = options;
|
|
@@ -3,15 +3,15 @@ export type CollectPhaseArtifactOptions = {
|
|
|
3
3
|
page: LH.Puppeteer.Page;
|
|
4
4
|
artifactDefinitions: Array<LH.Config.AnyArtifactDefn>;
|
|
5
5
|
artifactState: ArtifactState;
|
|
6
|
-
baseArtifacts: LH.
|
|
7
|
-
phase: LH.Gatherer.
|
|
6
|
+
baseArtifacts: LH.BaseArtifacts;
|
|
7
|
+
phase: LH.Gatherer.GatherPhase;
|
|
8
8
|
gatherMode: LH.Gatherer.GatherMode;
|
|
9
9
|
computedCache: Map<string, LH.ArbitraryEqualityMap>;
|
|
10
10
|
settings: LH.Config.Settings;
|
|
11
11
|
};
|
|
12
12
|
export type IntermediateArtifacts = Record<string, Promise<any>>;
|
|
13
13
|
export type ArtifactState = Record<CollectPhaseArtifactOptions['phase'], IntermediateArtifacts>;
|
|
14
|
-
export type Dependencies = LH.Gatherer.
|
|
14
|
+
export type Dependencies = LH.Gatherer.Context<LH.Gatherer.DependencyKey>['dependencies'];
|
|
15
15
|
/** @return {ArtifactState} */
|
|
16
16
|
export function getEmptyArtifactState(): ArtifactState;
|
|
17
17
|
/**
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* @property {LH.Puppeteer.Page} page
|
|
11
11
|
* @property {Array<LH.Config.AnyArtifactDefn>} artifactDefinitions
|
|
12
12
|
* @property {ArtifactState} artifactState
|
|
13
|
-
* @property {LH.
|
|
14
|
-
* @property {LH.Gatherer.
|
|
13
|
+
* @property {LH.BaseArtifacts} baseArtifacts
|
|
14
|
+
* @property {LH.Gatherer.GatherPhase} phase
|
|
15
15
|
* @property {LH.Gatherer.GatherMode} gatherMode
|
|
16
16
|
* @property {Map<string, LH.ArbitraryEqualityMap>} computedCache
|
|
17
17
|
* @property {LH.Config.Settings} settings
|
|
@@ -21,10 +21,12 @@
|
|
|
21
21
|
|
|
22
22
|
/** @typedef {Record<CollectPhaseArtifactOptions['phase'], IntermediateArtifacts>} ArtifactState */
|
|
23
23
|
|
|
24
|
-
/** @typedef {LH.Gatherer.
|
|
24
|
+
/** @typedef {LH.Gatherer.Context<LH.Gatherer.DependencyKey>['dependencies']} Dependencies */
|
|
25
25
|
|
|
26
26
|
import log from 'lighthouse-logger';
|
|
27
27
|
|
|
28
|
+
import {Sentry} from '../lib/sentry.js';
|
|
29
|
+
|
|
28
30
|
/**
|
|
29
31
|
*
|
|
30
32
|
* @param {{id: string}} dependency
|
|
@@ -115,7 +117,13 @@ async function collectPhaseArtifacts(options) {
|
|
|
115
117
|
return artifact;
|
|
116
118
|
});
|
|
117
119
|
|
|
118
|
-
await artifactPromise.catch(() => {
|
|
120
|
+
await artifactPromise.catch((err) => {
|
|
121
|
+
Sentry.captureException(err, {
|
|
122
|
+
tags: {gatherer: artifactDefn.id, phase},
|
|
123
|
+
level: 'error',
|
|
124
|
+
});
|
|
125
|
+
log.error(artifactDefn.id, err.message);
|
|
126
|
+
});
|
|
119
127
|
artifactState[phase][artifactDefn.id] = artifactPromise;
|
|
120
128
|
}
|
|
121
129
|
}
|
package/core/gather/session.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type CrdpEventMessageEmitter = LH.Protocol.StrictEventEmitterClass<LH.CrdpEvents>;
|
|
2
2
|
declare const ProtocolSession_base: CrdpEventMessageEmitter;
|
|
3
|
-
/** @implements {LH.Gatherer.
|
|
4
|
-
export class ProtocolSession extends ProtocolSession_base implements LH.Gatherer.
|
|
3
|
+
/** @implements {LH.Gatherer.ProtocolSession} */
|
|
4
|
+
export class ProtocolSession extends ProtocolSession_base implements LH.Gatherer.ProtocolSession {
|
|
5
5
|
/**
|
|
6
6
|
* @param {LH.Puppeteer.CDPSession} cdpSession
|
|
7
7
|
*/
|
package/core/gather/session.js
CHANGED
|
@@ -14,7 +14,7 @@ const DEFAULT_PROTOCOL_TIMEOUT = 30000;
|
|
|
14
14
|
/** @typedef {LH.Protocol.StrictEventEmitterClass<LH.CrdpEvents>} CrdpEventMessageEmitter */
|
|
15
15
|
const CrdpEventEmitter = /** @type {CrdpEventMessageEmitter} */ (EventEmitter);
|
|
16
16
|
|
|
17
|
-
/** @implements {LH.Gatherer.
|
|
17
|
+
/** @implements {LH.Gatherer.ProtocolSession} */
|
|
18
18
|
class ProtocolSession extends CrdpEventEmitter {
|
|
19
19
|
/**
|
|
20
20
|
* @param {LH.Puppeteer.CDPSession} cdpSession
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {LH.Puppeteer.Page} page
|
|
3
3
|
* @param {{config?: LH.Config, flags?: LH.Flags}} [options]
|
|
4
|
-
* @return {Promise<LH.Gatherer.
|
|
4
|
+
* @return {Promise<LH.Gatherer.GatherResult>}
|
|
5
5
|
*/
|
|
6
6
|
export function snapshotGather(page: LH.Puppeteer.Page, options?: {
|
|
7
7
|
config?: import("../../types/config.js").default | undefined;
|
|
8
8
|
flags?: import("../index.js").Flags | undefined;
|
|
9
|
-
} | undefined): Promise<LH.Gatherer.
|
|
9
|
+
} | undefined): Promise<LH.Gatherer.GatherResult>;
|
|
10
10
|
//# sourceMappingURL=snapshot-runner.d.ts.map
|
|
@@ -15,7 +15,7 @@ import {getBaseArtifacts, finalizeArtifacts} from './base-artifacts.js';
|
|
|
15
15
|
/**
|
|
16
16
|
* @param {LH.Puppeteer.Page} page
|
|
17
17
|
* @param {{config?: LH.Config, flags?: LH.Flags}} [options]
|
|
18
|
-
* @return {Promise<LH.Gatherer.
|
|
18
|
+
* @return {Promise<LH.Gatherer.GatherResult>}
|
|
19
19
|
*/
|
|
20
20
|
async function snapshotGather(page, options = {}) {
|
|
21
21
|
const {flags = {}, config} = options;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {LH.Puppeteer.Page} page
|
|
3
3
|
* @param {{config?: LH.Config, flags?: LH.Flags}} [options]
|
|
4
|
-
* @return {Promise<{endTimespanGather(): Promise<LH.Gatherer.
|
|
4
|
+
* @return {Promise<{endTimespanGather(): Promise<LH.Gatherer.GatherResult>}>}
|
|
5
5
|
*/
|
|
6
6
|
export function startTimespanGather(page: LH.Puppeteer.Page, options?: {
|
|
7
7
|
config?: import("../../types/config.js").default | undefined;
|
|
8
8
|
flags?: import("../index.js").Flags | undefined;
|
|
9
9
|
} | undefined): Promise<{
|
|
10
|
-
endTimespanGather(): Promise<LH.Gatherer.
|
|
10
|
+
endTimespanGather(): Promise<LH.Gatherer.GatherResult>;
|
|
11
11
|
}>;
|
|
12
12
|
//# sourceMappingURL=timespan-runner.d.ts.map
|
|
@@ -16,7 +16,7 @@ import {getBaseArtifacts, finalizeArtifacts} from './base-artifacts.js';
|
|
|
16
16
|
/**
|
|
17
17
|
* @param {LH.Puppeteer.Page} page
|
|
18
18
|
* @param {{config?: LH.Config, flags?: LH.Flags}} [options]
|
|
19
|
-
* @return {Promise<{endTimespanGather(): Promise<LH.Gatherer.
|
|
19
|
+
* @return {Promise<{endTimespanGather(): Promise<LH.Gatherer.GatherResult>}>}
|
|
20
20
|
*/
|
|
21
21
|
async function startTimespanGather(page, options = {}) {
|
|
22
22
|
const {flags = {}, config} = options;
|