lighthouse 13.6.0-dev.20261111 → 13.6.0-dev.20261116
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/.agents/skills/update-ard-port/SKILL.md +1 -1
- package/cli/bin.js +8 -3
- package/cli/open-file.d.ts +7 -0
- package/cli/open-file.js +48 -0
- package/cli/printer.js +1 -1
- package/cli/run.js +6 -4
- package/cli/sentry-prompt.js +2 -1
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +1 -1
- package/cli/test/smokehouse/lighthouse-runners/cli.js +1 -2
- package/cli/test/smokehouse/report-assert.js +1 -2
- package/cli/test/smokehouse/smokehouse.js +1 -2
- package/core/audits/autocomplete.js +1 -2
- package/core/audits/bootup-time.js +1 -2
- package/core/audits/errors-in-console.js +1 -2
- package/core/audits/mainthread-work-breakdown.js +1 -2
- package/core/audits/metrics.d.ts +2 -2
- package/core/audits/metrics.js +1 -1
- package/core/computed/computed-artifact.js +1 -2
- package/core/computed/entity-classification.d.ts +3 -3
- package/core/computed/entity-classification.js +5 -3
- package/core/computed/js-bundles.js +1 -2
- package/core/computed/load-simulator.d.ts +5 -3
- package/core/computed/load-simulator.js +9 -2
- package/core/computed/metrics/responsiveness.d.ts +5 -3
- package/core/computed/metrics/responsiveness.js +1 -1
- package/core/computed/metrics/time-to-first-byte.js +3 -1
- package/core/computed/metrics/timing-summary.d.ts +7 -5
- package/core/computed/metrics/timing-summary.js +3 -4
- package/core/computed/navigation-insights.d.ts +5 -3
- package/core/computed/navigation-insights.js +1 -1
- package/core/computed/network-analysis.js +1 -2
- package/core/computed/page-dependency-graph.d.ts +5 -3
- package/core/computed/page-dependency-graph.js +1 -1
- package/core/computed/trace-engine-result.d.ts +7 -5
- package/core/computed/trace-engine-result.js +9 -5
- package/core/computed/unused-css.d.ts +2 -2
- package/core/computed/unused-css.js +1 -1
- package/core/config/config.js +1 -2
- package/core/gather/base-artifacts.js +1 -2
- package/core/gather/driver/environment.js +1 -2
- package/core/gather/driver/execution-context.js +2 -0
- package/core/gather/driver/navigation.js +1 -2
- package/core/gather/driver/network-monitor.js +1 -2
- package/core/gather/driver/prepare.js +1 -2
- package/core/gather/driver/storage.js +1 -2
- package/core/gather/driver/target-manager.js +1 -2
- package/core/gather/driver/wait-for-condition.js +6 -5
- package/core/gather/driver.js +1 -2
- package/core/gather/gatherers/agentic/ard.js +1 -1
- package/core/gather/gatherers/agentic/llms-txt.js +1 -2
- package/core/gather/gatherers/css-usage.js +5 -1
- package/core/gather/gatherers/image-elements.js +1 -2
- package/core/gather/gatherers/seo/robots-txt.js +1 -2
- package/core/gather/gatherers/stacks.js +1 -2
- package/core/gather/gatherers/stylesheets.js +10 -3
- package/core/gather/navigation-runner.js +1 -1
- package/core/gather/runner-helpers.js +1 -2
- package/core/gather/session.js +1 -2
- package/core/gather/snapshot-runner.js +1 -2
- package/core/gather/timespan-runner.js +1 -2
- package/core/lib/asset-saver.js +1 -2
- package/core/lib/csp-evaluator.js +1 -1
- package/core/lib/i18n/i18n.js +1 -2
- package/core/lib/lantern-trace-saver.js +19 -13
- package/core/lib/lighthouse-logger.d.ts +127 -0
- package/core/lib/lighthouse-logger.js +319 -0
- package/core/lib/median-run.d.ts +16 -6
- package/core/lib/median-run.js +13 -6
- package/core/lib/network-recorder.js +1 -2
- package/core/lib/network-request.d.ts +2 -2
- package/core/lib/network-request.js +1 -1
- package/core/lib/page-functions.js +4 -3
- package/core/lib/script-helpers.d.ts +23 -8
- package/core/lib/script-helpers.js +7 -6
- package/core/lib/sentry-reporter.d.ts +59 -0
- package/core/lib/sentry-reporter.js +281 -0
- package/core/lib/sentry.d.ts +7 -7
- package/core/lib/sentry.js +31 -39
- package/core/lib/stack-packs.js +1 -1
- package/core/lib/timing-trace-saver.d.ts +2 -2
- package/core/lib/timing-trace-saver.js +1 -1
- package/core/lib/tracehouse/main-thread-tasks.d.ts +7 -0
- package/core/lib/tracehouse/main-thread-tasks.js +18 -6
- package/core/lib/tracehouse/task-summary.d.ts +16 -4
- package/core/lib/tracehouse/task-summary.js +6 -5
- package/core/lib/tracehouse/trace-processor.d.ts +6 -6
- package/core/lib/tracehouse/trace-processor.js +1 -1
- package/core/lib/traces/metric-trace-events.js +1 -2
- package/core/lib/url-utils.d.ts +4 -4
- package/core/lib/url-utils.js +1 -1
- package/core/runner.js +1 -2
- package/dist/report/bundle.esm.js +10 -10
- package/dist/report/flow.js +13 -13
- package/dist/report/standalone.js +11 -11
- package/package.json +9 -12
- package/report/renderer/text-encoding.d.ts +3 -5
- package/report/renderer/text-encoding.js +19 -33
- package/report/types/augment-dom.d.ts +0 -4
- package/shared/util.js +10 -2
- package/third-party/ard/README.md +2 -2
- package/third-party/ard/ard.js +1 -1
- package/third-party/ard/schema-validator.js +42 -2
- package/tsconfig.json +2 -42
- package/types/artifacts.d.ts +7 -1
- package/types/internal/node.d.ts +1 -0
- package/types/internal/test.d.ts +5 -0
- package/report/types/buffer.d.ts +0 -19
|
@@ -79,7 +79,7 @@ For every hunk in the upstream `conformance-test` diff decide whether it touches
|
|
|
79
79
|
Rules to preserve:
|
|
80
80
|
- Treat non-object roots/entries as empty instead of throwing.
|
|
81
81
|
- Push `{element, message}` objects; never return formatted strings.
|
|
82
|
-
- Log through `lighthouse-logger`, not `console`.
|
|
82
|
+
- Log through `core/lib/lighthouse-logger.js`, not `console`.
|
|
83
83
|
- Only `ARD_VERSION`, `ConformanceTester` and `classify_media_type` are exported; add exports only if
|
|
84
84
|
tests need them.
|
|
85
85
|
|
package/cli/bin.js
CHANGED
|
@@ -21,8 +21,7 @@ import fs from 'fs';
|
|
|
21
21
|
import path from 'path';
|
|
22
22
|
import url from 'url';
|
|
23
23
|
|
|
24
|
-
import log from 'lighthouse-logger';
|
|
25
|
-
|
|
24
|
+
import log from '../core/lib/lighthouse-logger.js';
|
|
26
25
|
import * as commands from './commands/commands.js';
|
|
27
26
|
import * as Printer from './printer.js';
|
|
28
27
|
import {getFlags} from './cli-flags.js';
|
|
@@ -132,7 +131,13 @@ async function begin() {
|
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
try {
|
|
135
|
+
return await runLighthouse(urlsUnderTest, cliFlags, config);
|
|
136
|
+
} catch (err) {
|
|
137
|
+
// Report fatal CLI errors before Node exits (unhandled rejections are reported in run.js).
|
|
138
|
+
await Sentry.captureException(err, {level: 'fatal'});
|
|
139
|
+
throw err;
|
|
140
|
+
}
|
|
136
141
|
}
|
|
137
142
|
|
|
138
143
|
export {
|
package/cli/open-file.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Opens a file (e.g. the HTML report for `--view`) with the OS default application.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {spawn} from 'child_process';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
|
|
14
|
+
import log from '../core/lib/lighthouse-logger.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Opens a file with its default application, without waiting for it. Failures are logged, not
|
|
18
|
+
* thrown.
|
|
19
|
+
* @param {string} filePath
|
|
20
|
+
*/
|
|
21
|
+
function openFile(filePath) {
|
|
22
|
+
const absolutePath = path.resolve(filePath);
|
|
23
|
+
|
|
24
|
+
/** @type {import('child_process').SpawnOptions} */
|
|
25
|
+
const options = {stdio: 'ignore', detached: true};
|
|
26
|
+
let command = 'xdg-open';
|
|
27
|
+
let args = [absolutePath];
|
|
28
|
+
if (process.platform === 'darwin') {
|
|
29
|
+
command = 'open';
|
|
30
|
+
} else if (process.platform === 'win32') {
|
|
31
|
+
// explorer.exe (unlike `cmd /c start`) doesn't expand `%VAR%` or treat `&` specially, but it
|
|
32
|
+
// does split unquoted `,` and `=`, which report filenames can contain. Windows paths can't
|
|
33
|
+
// contain `"`, so quoting verbatim is safe.
|
|
34
|
+
command = 'explorer.exe';
|
|
35
|
+
args = [`"${absolutePath}"`];
|
|
36
|
+
options.windowsVerbatimArguments = true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Detached and unref'd so the CLI can exit without waiting for (or killing) the child.
|
|
40
|
+
const child = spawn(command, args, options);
|
|
41
|
+
child.on('error', err => {
|
|
42
|
+
log.warn('CLI', `Unable to open ${absolutePath} with \`${command}\` (${err.message}). ` +
|
|
43
|
+
'Open it manually in your browser.');
|
|
44
|
+
});
|
|
45
|
+
child.unref();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {openFile};
|
package/cli/printer.js
CHANGED
package/cli/run.js
CHANGED
|
@@ -12,14 +12,15 @@ import os from 'os';
|
|
|
12
12
|
|
|
13
13
|
import * as ChromeLauncher from 'chrome-launcher';
|
|
14
14
|
import yargsParser from 'yargs-parser';
|
|
15
|
-
import log from 'lighthouse-logger';
|
|
16
|
-
import open from 'open';
|
|
17
15
|
|
|
16
|
+
import log from '../core/lib/lighthouse-logger.js';
|
|
18
17
|
import * as Printer from './printer.js';
|
|
18
|
+
import {openFile} from './open-file.js';
|
|
19
19
|
import lighthouse from '../core/index.js';
|
|
20
20
|
import {getLhrFilenamePrefix} from '../report/generator/file-namer.js';
|
|
21
21
|
import * as assetSaver from '../core/lib/asset-saver.js';
|
|
22
22
|
import UrlUtils from '../core/lib/url-utils.js';
|
|
23
|
+
import {Sentry} from '../core/lib/sentry.js';
|
|
23
24
|
|
|
24
25
|
/** @typedef {Error & {code: string, friendlyMessage?: string}} ExitError */
|
|
25
26
|
|
|
@@ -196,9 +197,10 @@ async function saveResults(runnerResult, flags) {
|
|
|
196
197
|
*/
|
|
197
198
|
async function runLighthouse(urlOrUrls, flags, config) {
|
|
198
199
|
/** @param {any} reason */
|
|
199
|
-
function handleTheUnhandled(reason) {
|
|
200
|
+
async function handleTheUnhandled(reason) {
|
|
200
201
|
process.stderr.write(`Unhandled Rejection. Reason: ${reason}\n`);
|
|
201
202
|
launchedChrome?.kill();
|
|
203
|
+
await Sentry.captureException(reason, {level: 'fatal'});
|
|
202
204
|
process.exit(1);
|
|
203
205
|
}
|
|
204
206
|
process.on('unhandledRejection', handleTheUnhandled);
|
|
@@ -272,7 +274,7 @@ async function runLighthouse(urlOrUrls, flags, config) {
|
|
|
272
274
|
if (htmlReportPaths.length > 0) {
|
|
273
275
|
if (flags.view) {
|
|
274
276
|
for (const htmlPath of htmlReportPaths) {
|
|
275
|
-
|
|
277
|
+
openFile(htmlPath);
|
|
276
278
|
}
|
|
277
279
|
} else {
|
|
278
280
|
// eslint-disable-next-line max-len
|
package/cli/sentry-prompt.js
CHANGED
|
@@ -16,8 +16,8 @@ import url from 'url';
|
|
|
16
16
|
|
|
17
17
|
import yargs from 'yargs';
|
|
18
18
|
import * as yargsHelpers from 'yargs/helpers';
|
|
19
|
-
import log from 'lighthouse-logger';
|
|
20
19
|
|
|
20
|
+
import log from '../../../../core/lib/lighthouse-logger.js';
|
|
21
21
|
import {runSmokehouse, getShardedDefinitions, DEFAULT_RETRIES, DEFAULT_CONCURRENT_RUNS} from '../smokehouse.js';
|
|
22
22
|
import {updateTestDefnFormat} from './back-compat-util.js';
|
|
23
23
|
import {LH_ROOT} from '../../../../shared/root.js';
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
import {promises as fs} from 'fs';
|
|
15
15
|
import {spawn} from 'child_process';
|
|
16
16
|
|
|
17
|
-
import log from 'lighthouse-logger';
|
|
18
|
-
|
|
17
|
+
import log from '../../../../core/lib/lighthouse-logger.js';
|
|
19
18
|
import * as assetSaver from '../../../../core/lib/asset-saver.js';
|
|
20
19
|
import {LocalConsole} from '../lib/local-console.js';
|
|
21
20
|
import {ChildProcessError} from '../lib/child-process-error.js';
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
* against the results actually collected from Lighthouse.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import log from 'lighthouse-logger';
|
|
13
|
-
|
|
12
|
+
import log from '../../../core/lib/lighthouse-logger.js';
|
|
14
13
|
import {LocalConsole} from './lib/local-console.js';
|
|
15
14
|
import {chromiumVersionCheck} from './version-check.js';
|
|
16
15
|
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
import assert from 'assert/strict';
|
|
31
31
|
|
|
32
|
-
import log from 'lighthouse-logger';
|
|
33
|
-
|
|
32
|
+
import log from '../../../core/lib/lighthouse-logger.js';
|
|
34
33
|
import {runLighthouse as cliLighthouseRunner} from './lighthouse-runners/cli.js';
|
|
35
34
|
import {getAssertionReport} from './report-assert.js';
|
|
36
35
|
import {LocalConsole} from './lib/local-console.js';
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import log from 'lighthouse-logger';
|
|
8
|
-
|
|
7
|
+
import log from '../lib/lighthouse-logger.js';
|
|
9
8
|
import {Audit} from './audit.js';
|
|
10
9
|
import {taskGroups} from '../lib/tracehouse/task-groups.js';
|
|
11
10
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
* This is done by collecting Chrome console log messages and filtering out the non-error ones.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import log from 'lighthouse-logger';
|
|
13
|
-
|
|
12
|
+
import log from '../lib/lighthouse-logger.js';
|
|
14
13
|
import {Audit} from './audit.js';
|
|
15
14
|
import {JSBundles} from '../computed/js-bundles.js';
|
|
16
15
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
* @fileoverview Audit a page to show a breakdown of execution timings on the main thread
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import log from 'lighthouse-logger';
|
|
12
|
-
|
|
11
|
+
import log from '../lib/lighthouse-logger.js';
|
|
13
12
|
import {Audit} from './audit.js';
|
|
14
13
|
import {taskGroups} from '../lib/tracehouse/task-groups.js';
|
|
15
14
|
import * as i18n from '../lib/i18n/i18n.js';
|
package/core/audits/metrics.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export default Metrics;
|
|
2
2
|
declare class Metrics extends Audit {
|
|
3
3
|
/**
|
|
4
|
-
* @param {LH.Artifacts} artifacts
|
|
4
|
+
* @param {Pick<LH.Artifacts, 'GatherContext'|'Trace'|'DevtoolsLog'|'URL'|'SourceMaps'|'HostDPR'>} artifacts
|
|
5
5
|
* @param {LH.Audit.Context} context
|
|
6
6
|
* @return {Promise<LH.Audit.Product>}
|
|
7
7
|
*/
|
|
8
|
-
static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
8
|
+
static audit(artifacts: Pick<LH.Artifacts, "GatherContext" | "Trace" | "DevtoolsLog" | "URL" | "SourceMaps" | "HostDPR">, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
9
9
|
}
|
|
10
10
|
import { Audit } from './audit.js';
|
|
11
11
|
//# sourceMappingURL=metrics.d.ts.map
|
package/core/audits/metrics.js
CHANGED
|
@@ -31,7 +31,7 @@ class Metrics extends Audit {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @param {LH.Artifacts} artifacts
|
|
34
|
+
* @param {Pick<LH.Artifacts, 'GatherContext'|'Trace'|'DevtoolsLog'|'URL'|'SourceMaps'|'HostDPR'>} artifacts
|
|
35
35
|
* @param {LH.Audit.Context} context
|
|
36
36
|
* @return {Promise<LH.Audit.Product>}
|
|
37
37
|
*/
|
|
@@ -2,7 +2,7 @@ export { EntityClassificationComputed as EntityClassification };
|
|
|
2
2
|
export type EntityCache = Map<string, LH.Artifacts.Entity>;
|
|
3
3
|
declare const EntityClassificationComputed: typeof EntityClassification & {
|
|
4
4
|
request: (dependencies: {
|
|
5
|
-
URL: LH.Artifacts["URL"]
|
|
5
|
+
URL: Partial<LH.Artifacts["URL"]>;
|
|
6
6
|
devtoolsLog: LH.DevtoolsLog;
|
|
7
7
|
}, context: LH.Artifacts.ComputedContext) => Promise<import("../index.js").Artifacts.EntityClassification>;
|
|
8
8
|
};
|
|
@@ -28,12 +28,12 @@ declare class EntityClassification {
|
|
|
28
28
|
*/
|
|
29
29
|
static _preloadChromeExtensionsToCache(entityCache: EntityCache, devtoolsLog: LH.DevtoolsLog): void;
|
|
30
30
|
/**
|
|
31
|
-
* @param {{URL: LH.Artifacts['URL']
|
|
31
|
+
* @param {{URL: Partial<LH.Artifacts['URL']>, devtoolsLog: LH.DevtoolsLog}} data
|
|
32
32
|
* @param {LH.Artifacts.ComputedContext} context
|
|
33
33
|
* @return {Promise<LH.Artifacts.EntityClassification>}
|
|
34
34
|
*/
|
|
35
35
|
static compute_(data: {
|
|
36
|
-
URL: LH.Artifacts["URL"]
|
|
36
|
+
URL: Partial<LH.Artifacts["URL"]>;
|
|
37
37
|
devtoolsLog: LH.DevtoolsLog;
|
|
38
38
|
}, context: LH.Artifacts.ComputedContext): Promise<LH.Artifacts.EntityClassification>;
|
|
39
39
|
}
|
|
@@ -97,7 +97,7 @@ class EntityClassification {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* @param {{URL: LH.Artifacts['URL']
|
|
100
|
+
* @param {{URL: Partial<LH.Artifacts['URL']>, devtoolsLog: LH.DevtoolsLog}} data
|
|
101
101
|
* @param {LH.Artifacts.ComputedContext} context
|
|
102
102
|
* @return {Promise<LH.Artifacts.EntityClassification>}
|
|
103
103
|
*/
|
|
@@ -130,8 +130,10 @@ class EntityClassification {
|
|
|
130
130
|
// `mainDocumentUrl` (for navigations), and falls back to `finalDisplayedUrl` (for timespan/snapshot).
|
|
131
131
|
// See https://github.com/GoogleChrome/lighthouse/issues/13706
|
|
132
132
|
const firstPartyUrl = data.URL.mainDocumentUrl || data.URL.finalDisplayedUrl;
|
|
133
|
-
const firstParty =
|
|
134
|
-
|
|
133
|
+
const firstParty = firstPartyUrl ?
|
|
134
|
+
(thirdPartyWeb.getEntity(firstPartyUrl) ||
|
|
135
|
+
EntityClassification._makeUpAnEntity(madeUpEntityCache, firstPartyUrl)) :
|
|
136
|
+
undefined;
|
|
135
137
|
|
|
136
138
|
/**
|
|
137
139
|
* Convenience function to check if a URL belongs to first party.
|
|
@@ -2,18 +2,20 @@ export { LoadSimulatorComputed as LoadSimulator };
|
|
|
2
2
|
declare const LoadSimulatorComputed: typeof LoadSimulator & {
|
|
3
3
|
request: (dependencies: {
|
|
4
4
|
devtoolsLog: LH.DevtoolsLog;
|
|
5
|
-
settings:
|
|
5
|
+
settings: import("../index.js").Util.ImmutableObject<Pick<import("../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
|
|
6
|
+
throttling?: Partial<import("../index.js").Config.Settings["throttling"]>;
|
|
7
|
+
}>;
|
|
6
8
|
}, context: LH.Artifacts.ComputedContext) => Promise<import("../../types.js").Gatherer.Simulation.Simulator>;
|
|
7
9
|
};
|
|
8
10
|
declare class LoadSimulator {
|
|
9
11
|
/**
|
|
10
|
-
* @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.
|
|
12
|
+
* @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Artifacts.ComputedSettings}} data
|
|
11
13
|
* @param {LH.Artifacts.ComputedContext} context
|
|
12
14
|
* @return {Promise<LH.Gatherer.Simulation.Simulator>}
|
|
13
15
|
*/
|
|
14
16
|
static compute_(data: {
|
|
15
17
|
devtoolsLog: LH.DevtoolsLog;
|
|
16
|
-
settings: LH.
|
|
18
|
+
settings: LH.Artifacts.ComputedSettings;
|
|
17
19
|
}, context: LH.Artifacts.ComputedContext): Promise<LH.Gatherer.Simulation.Simulator>;
|
|
18
20
|
/**
|
|
19
21
|
* @param {LH.Artifacts.NetworkAnalysis} networkAnalysis
|
|
@@ -10,13 +10,20 @@ import {NetworkAnalysis} from './network-analysis.js';
|
|
|
10
10
|
|
|
11
11
|
class LoadSimulator {
|
|
12
12
|
/**
|
|
13
|
-
* @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.
|
|
13
|
+
* @param {{devtoolsLog: LH.DevtoolsLog, settings: LH.Artifacts.ComputedSettings}} data
|
|
14
14
|
* @param {LH.Artifacts.ComputedContext} context
|
|
15
15
|
* @return {Promise<LH.Gatherer.Simulation.Simulator>}
|
|
16
16
|
*/
|
|
17
17
|
static async compute_(data, context) {
|
|
18
18
|
const networkAnalysis = await NetworkAnalysis.request(data.devtoolsLog, context);
|
|
19
|
-
|
|
19
|
+
const throttling = data.settings.throttling ?
|
|
20
|
+
{...Lantern.Simulation.Constants.throttling.mobileSlow4G, ...data.settings.throttling} :
|
|
21
|
+
undefined;
|
|
22
|
+
return Lantern.Simulation.Simulator.createSimulator({
|
|
23
|
+
...data.settings,
|
|
24
|
+
throttling,
|
|
25
|
+
networkAnalysis,
|
|
26
|
+
});
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
/**
|
|
@@ -41,7 +41,9 @@ export type EventTimingEvent = LH.Trace.AsyncEvent & {
|
|
|
41
41
|
declare const ResponsivenessComputed: typeof Responsiveness & {
|
|
42
42
|
request: (dependencies: {
|
|
43
43
|
trace: LH.Trace;
|
|
44
|
-
settings:
|
|
44
|
+
settings: import("../../index.js").Util.ImmutableObject<Pick<import("../../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
|
|
45
|
+
throttling?: Partial<import("../../index.js").Config.Settings["throttling"]>;
|
|
46
|
+
}>;
|
|
45
47
|
}, context: LH.Artifacts.ComputedContext) => Promise<EventTimingEvent | null>;
|
|
46
48
|
};
|
|
47
49
|
declare class Responsiveness {
|
|
@@ -64,13 +66,13 @@ declare class Responsiveness {
|
|
|
64
66
|
*/
|
|
65
67
|
static findInteractionEvent(responsivenessEvent: ResponsivenessEvent, { traceEvents }: LH.Trace): EventTimingEvent;
|
|
66
68
|
/**
|
|
67
|
-
* @param {{trace: LH.Trace, settings: LH.
|
|
69
|
+
* @param {{trace: LH.Trace, settings: LH.Artifacts.ComputedSettings}} data
|
|
68
70
|
* @param {LH.Artifacts.ComputedContext} context
|
|
69
71
|
* @return {Promise<EventTimingEvent|null>}
|
|
70
72
|
*/
|
|
71
73
|
static compute_(data: {
|
|
72
74
|
trace: LH.Trace;
|
|
73
|
-
settings: LH.
|
|
75
|
+
settings: LH.Artifacts.ComputedSettings;
|
|
74
76
|
}, context: LH.Artifacts.ComputedContext): Promise<EventTimingEvent | null>;
|
|
75
77
|
}
|
|
76
78
|
//# sourceMappingURL=responsiveness.d.ts.map
|
|
@@ -130,7 +130,7 @@ class Responsiveness {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
* @param {{trace: LH.Trace, settings: LH.
|
|
133
|
+
* @param {{trace: LH.Trace, settings: LH.Artifacts.ComputedSettings}} data
|
|
134
134
|
* @param {LH.Artifacts.ComputedContext} context
|
|
135
135
|
* @return {Promise<EventTimingEvent|null>}
|
|
136
136
|
*/
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import {calculateDocFirstByteTs} from '@paulirish/trace_engine/models/trace/insights/Common.js';
|
|
8
8
|
|
|
9
9
|
import {Helpers} from '../../lib/trace-engine.js';
|
|
10
|
+
import {throttling} from '../../config/constants.js';
|
|
10
11
|
import {makeComputedArtifact} from '../computed-artifact.js';
|
|
11
12
|
import {NavigationMetric} from './navigation-metric.js';
|
|
12
13
|
import {MainResource} from '../main-resource.js';
|
|
@@ -34,7 +35,8 @@ class TimeToFirstByte extends NavigationMetric {
|
|
|
34
35
|
let roundTrips = 2;
|
|
35
36
|
if (!mainResource.protocol.startsWith('h3')) roundTrips += 1; // TCP
|
|
36
37
|
if (mainResource.parsedURL.scheme === 'https') roundTrips += 1;
|
|
37
|
-
const
|
|
38
|
+
const rttMs = data.settings.throttling?.rttMs ?? throttling.mobileSlow4G.rttMs;
|
|
39
|
+
const estimatedTTFB = rttMs * roundTrips + observedResponseTime;
|
|
38
40
|
|
|
39
41
|
const timing = Math.max(observedTTFB, estimatedTTFB);
|
|
40
42
|
return {timing};
|
|
@@ -4,7 +4,9 @@ declare const TimingSummaryComputed: typeof TimingSummary & {
|
|
|
4
4
|
trace: LH.Trace;
|
|
5
5
|
devtoolsLog: LH.DevtoolsLog;
|
|
6
6
|
gatherContext: LH.Artifacts["GatherContext"];
|
|
7
|
-
settings:
|
|
7
|
+
settings: import("../../index.js").Util.ImmutableObject<Pick<import("../../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
|
|
8
|
+
throttling?: Partial<import("../../index.js").Config.Settings["throttling"]>;
|
|
9
|
+
}>;
|
|
8
10
|
URL: LH.Artifacts["URL"];
|
|
9
11
|
SourceMaps: LH.Artifacts["SourceMaps"];
|
|
10
12
|
HostDPR: LH.Artifacts["HostDPR"];
|
|
@@ -18,19 +20,19 @@ declare class TimingSummary {
|
|
|
18
20
|
* @param {LH.Trace} trace
|
|
19
21
|
* @param {LH.DevtoolsLog} devtoolsLog
|
|
20
22
|
* @param {LH.Artifacts['GatherContext']} gatherContext
|
|
21
|
-
* @param {LH.
|
|
23
|
+
* @param {LH.Artifacts.ComputedSettings} settings
|
|
22
24
|
* @param {LH.Artifacts['URL']} URL
|
|
23
25
|
* @param {LH.Artifacts['SourceMaps']} SourceMaps
|
|
24
26
|
* @param {LH.Artifacts['HostDPR']} HostDPR
|
|
25
27
|
* @param {LH.Artifacts.ComputedContext} context
|
|
26
28
|
* @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
|
|
27
29
|
*/
|
|
28
|
-
static summarize(trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts["GatherContext"], settings: LH.
|
|
30
|
+
static summarize(trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts["GatherContext"], settings: LH.Artifacts.ComputedSettings, URL: LH.Artifacts["URL"], SourceMaps: LH.Artifacts["SourceMaps"], HostDPR: LH.Artifacts["HostDPR"], context: LH.Artifacts.ComputedContext): Promise<{
|
|
29
31
|
metrics: LH.Artifacts.TimingSummary;
|
|
30
32
|
debugInfo: Record<string, boolean>;
|
|
31
33
|
}>;
|
|
32
34
|
/**
|
|
33
|
-
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.
|
|
35
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.Artifacts.ComputedSettings, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
|
|
34
36
|
* @param {LH.Artifacts.ComputedContext} context
|
|
35
37
|
* @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
|
|
36
38
|
*/
|
|
@@ -38,7 +40,7 @@ declare class TimingSummary {
|
|
|
38
40
|
trace: LH.Trace;
|
|
39
41
|
devtoolsLog: LH.DevtoolsLog;
|
|
40
42
|
gatherContext: LH.Artifacts["GatherContext"];
|
|
41
|
-
settings: LH.
|
|
43
|
+
settings: LH.Artifacts.ComputedSettings;
|
|
42
44
|
URL: LH.Artifacts["URL"];
|
|
43
45
|
SourceMaps: LH.Artifacts["SourceMaps"];
|
|
44
46
|
HostDPR: LH.Artifacts["HostDPR"];
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import log from 'lighthouse-logger';
|
|
8
|
-
|
|
7
|
+
import log from '../../lib/lighthouse-logger.js';
|
|
9
8
|
import {ProcessedTrace} from '../processed-trace.js';
|
|
10
9
|
import {ProcessedNavigation} from '../processed-navigation.js';
|
|
11
10
|
import {Speedline} from '../speedline.js';
|
|
@@ -28,7 +27,7 @@ class TimingSummary {
|
|
|
28
27
|
* @param {LH.Trace} trace
|
|
29
28
|
* @param {LH.DevtoolsLog} devtoolsLog
|
|
30
29
|
* @param {LH.Artifacts['GatherContext']} gatherContext
|
|
31
|
-
* @param {LH.
|
|
30
|
+
* @param {LH.Artifacts.ComputedSettings} settings
|
|
32
31
|
* @param {LH.Artifacts['URL']} URL
|
|
33
32
|
* @param {LH.Artifacts['SourceMaps']} SourceMaps
|
|
34
33
|
* @param {LH.Artifacts['HostDPR']} HostDPR
|
|
@@ -149,7 +148,7 @@ class TimingSummary {
|
|
|
149
148
|
return {metrics, debugInfo};
|
|
150
149
|
}
|
|
151
150
|
/**
|
|
152
|
-
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.
|
|
151
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, gatherContext: LH.Artifacts['GatherContext']; settings: LH.Artifacts.ComputedSettings, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
|
|
153
152
|
* @param {LH.Artifacts.ComputedContext} context
|
|
154
153
|
* @return {Promise<{metrics: LH.Artifacts.TimingSummary, debugInfo: Record<string,boolean>}>}
|
|
155
154
|
*/
|
|
@@ -2,7 +2,9 @@ export { NavigationInsightsComputed as NavigationInsights };
|
|
|
2
2
|
declare const NavigationInsightsComputed: typeof NavigationInsights & {
|
|
3
3
|
request: (dependencies: {
|
|
4
4
|
trace: LH.Trace;
|
|
5
|
-
settings:
|
|
5
|
+
settings: Partial<import("../index.js").Util.ImmutableObject<Pick<import("../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
|
|
6
|
+
throttling?: Partial<import("../index.js").Config.Settings["throttling"]>;
|
|
7
|
+
}>>;
|
|
6
8
|
SourceMaps: LH.Artifacts["SourceMaps"];
|
|
7
9
|
HostDPR: LH.Artifacts["HostDPR"];
|
|
8
10
|
}, context: LH.Artifacts.ComputedContext) => Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").InsightSet>;
|
|
@@ -13,12 +15,12 @@ declare const NavigationInsightsComputed: typeof NavigationInsights & {
|
|
|
13
15
|
*/
|
|
14
16
|
declare class NavigationInsights {
|
|
15
17
|
/**
|
|
16
|
-
* @param {{trace: LH.Trace, settings: LH.
|
|
18
|
+
* @param {{trace: LH.Trace, settings: Partial<LH.Artifacts.ComputedSettings>, SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
|
|
17
19
|
* @param {LH.Artifacts.ComputedContext} context
|
|
18
20
|
*/
|
|
19
21
|
static compute_(data: {
|
|
20
22
|
trace: LH.Trace;
|
|
21
|
-
settings: LH.
|
|
23
|
+
settings: Partial<LH.Artifacts.ComputedSettings>;
|
|
22
24
|
SourceMaps: LH.Artifacts["SourceMaps"];
|
|
23
25
|
HostDPR: LH.Artifacts["HostDPR"];
|
|
24
26
|
}, context: LH.Artifacts.ComputedContext): Promise<import("@paulirish/trace_engine/models/trace/insights/types.js").InsightSet>;
|
|
@@ -15,7 +15,7 @@ import {TraceEngineResult} from './trace-engine-result.js';
|
|
|
15
15
|
*/
|
|
16
16
|
class NavigationInsights {
|
|
17
17
|
/**
|
|
18
|
-
* @param {{trace: LH.Trace, settings: LH.
|
|
18
|
+
* @param {{trace: LH.Trace, settings: Partial<LH.Artifacts.ComputedSettings>, SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR']}} data
|
|
19
19
|
* @param {LH.Artifacts.ComputedContext} context
|
|
20
20
|
*/
|
|
21
21
|
static async compute_(data, context) {
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import log from 'lighthouse-logger';
|
|
8
|
-
|
|
7
|
+
import log from '../lib/lighthouse-logger.js';
|
|
9
8
|
import * as Lantern from '../lib/lantern/lantern.js';
|
|
10
9
|
import {makeComputedArtifact} from './computed-artifact.js';
|
|
11
10
|
import {NetworkRecords} from './network-records.js';
|
|
@@ -3,7 +3,9 @@ declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
|
|
|
3
3
|
request: (dependencies: {
|
|
4
4
|
trace: LH.Trace;
|
|
5
5
|
devtoolsLog: LH.DevtoolsLog;
|
|
6
|
-
settings:
|
|
6
|
+
settings: Partial<import("../index.js").Util.ImmutableObject<Pick<import("../../types/lhr/settings.js").ConfigSettings, "throttlingMethod"> & Partial<Omit<import("../../types/lhr/settings.js").ConfigSettings, "throttling">> & {
|
|
7
|
+
throttling?: Partial<import("../index.js").Config.Settings["throttling"]>;
|
|
8
|
+
}>>;
|
|
7
9
|
URL: LH.Artifacts["URL"];
|
|
8
10
|
SourceMaps: LH.Artifacts["SourceMaps"];
|
|
9
11
|
HostDPR: LH.Artifacts["HostDPR"];
|
|
@@ -12,14 +14,14 @@ declare const PageDependencyGraphComputed: typeof PageDependencyGraph & {
|
|
|
12
14
|
};
|
|
13
15
|
declare class PageDependencyGraph {
|
|
14
16
|
/**
|
|
15
|
-
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: LH.
|
|
17
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: Partial<LH.Artifacts.ComputedSettings>, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR'], fromTrace: boolean}} data
|
|
16
18
|
* @param {LH.Artifacts.ComputedContext} context
|
|
17
19
|
* @return {Promise<LH.Gatherer.Simulation.GraphNode>}
|
|
18
20
|
*/
|
|
19
21
|
static compute_(data: {
|
|
20
22
|
trace: LH.Trace;
|
|
21
23
|
devtoolsLog: LH.DevtoolsLog;
|
|
22
|
-
settings: LH.
|
|
24
|
+
settings: Partial<LH.Artifacts.ComputedSettings>;
|
|
23
25
|
URL: LH.Artifacts["URL"];
|
|
24
26
|
SourceMaps: LH.Artifacts["SourceMaps"];
|
|
25
27
|
HostDPR: LH.Artifacts["HostDPR"];
|
|
@@ -13,7 +13,7 @@ import {TraceEngineResult} from './trace-engine-result.js';
|
|
|
13
13
|
|
|
14
14
|
class PageDependencyGraph {
|
|
15
15
|
/**
|
|
16
|
-
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: LH.
|
|
16
|
+
* @param {{trace: LH.Trace, devtoolsLog: LH.DevtoolsLog, settings: Partial<LH.Artifacts.ComputedSettings>, URL: LH.Artifacts['URL'], SourceMaps: LH.Artifacts['SourceMaps'], HostDPR: LH.Artifacts['HostDPR'], fromTrace: boolean}} data
|
|
17
17
|
* @param {LH.Artifacts.ComputedContext} context
|
|
18
18
|
* @return {Promise<LH.Gatherer.Simulation.GraphNode>}
|
|
19
19
|
*/
|