lighthouse 13.6.0-dev.20261112 → 13.6.0-dev.20261117
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.js +1 -1
- package/cli/printer.js +1 -1
- package/cli/run.d.ts +7 -0
- package/cli/run.js +42 -5
- 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/baseline.d.ts +3 -0
- 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/lcp-network-record.js +1 -1
- package/core/computed/load-simulator.d.ts +5 -3
- package/core/computed/load-simulator.js +9 -2
- package/core/computed/metrics/lcp-breakdown.d.ts +19 -0
- package/core/computed/metrics/lcp-breakdown.js +71 -8
- 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 +5 -2
- package/core/computed/trace-engine-result.d.ts +7 -5
- package/core/computed/trace-engine-result.js +9 -14
- 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/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 +1 -2
- 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/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 +1 -2
- 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/baseline/web-features-data.json +12 -3
- package/core/lib/baseline/web-features-metadata.json +1 -1
- package/core/lib/csp-evaluator.js +1 -1
- package/core/lib/deprecations-strings.d.ts +0 -2
- package/core/lib/deprecations-strings.js +1 -18
- package/core/lib/i18n/i18n.js +1 -2
- 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 +2 -2
- 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 +23 -40
- 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/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 +12 -12
- package/dist/report/standalone.js +11 -11
- package/package.json +19 -21
- 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/localization/locales/ar-XB.json +3 -0
- package/shared/localization/locales/ar.json +3 -0
- package/shared/localization/locales/bg.json +3 -0
- package/shared/localization/locales/ca.json +75 -72
- package/shared/localization/locales/cs.json +3 -0
- package/shared/localization/locales/da.json +3 -0
- package/shared/localization/locales/de.json +3 -0
- package/shared/localization/locales/el.json +3 -0
- package/shared/localization/locales/en-GB.json +3 -0
- package/shared/localization/locales/es-419.json +3 -0
- package/shared/localization/locales/es.json +3 -0
- package/shared/localization/locales/fi.json +3 -0
- package/shared/localization/locales/fil.json +3 -0
- package/shared/localization/locales/fr.json +3 -0
- package/shared/localization/locales/he.json +3 -0
- package/shared/localization/locales/hi.json +11 -8
- package/shared/localization/locales/hr.json +3 -0
- package/shared/localization/locales/hu.json +3 -0
- package/shared/localization/locales/id.json +3 -0
- package/shared/localization/locales/it.json +3 -0
- package/shared/localization/locales/ja.json +3 -0
- package/shared/localization/locales/ko.json +3 -0
- package/shared/localization/locales/lt.json +3 -0
- package/shared/localization/locales/lv.json +5 -2
- package/shared/localization/locales/nl.json +3 -0
- package/shared/localization/locales/no.json +3 -0
- package/shared/localization/locales/pl.json +3 -0
- package/shared/localization/locales/pt-PT.json +3 -0
- package/shared/localization/locales/pt.json +32 -29
- package/shared/localization/locales/ro.json +3 -0
- package/shared/localization/locales/ru.json +3 -0
- package/shared/localization/locales/sk.json +3 -0
- package/shared/localization/locales/sl.json +3 -0
- package/shared/localization/locales/sr-Latn.json +3 -0
- package/shared/localization/locales/sr.json +3 -0
- package/shared/localization/locales/sv.json +3 -0
- package/shared/localization/locales/ta.json +3 -0
- package/shared/localization/locales/te.json +3 -0
- package/shared/localization/locales/th.json +3 -0
- package/shared/localization/locales/tr.json +3 -0
- package/shared/localization/locales/uk.json +3 -0
- package/shared/localization/locales/vi.json +3 -0
- package/shared/localization/locales/zh-HK.json +3 -0
- package/shared/localization/locales/zh-TW.json +3 -0
- package/shared/localization/locales/zh.json +3 -0
- package/third-party/ard/README.md +1 -1
- package/third-party/ard/ard.js +1 -1
- package/tsconfig.json +2 -42
- package/types/artifacts.d.ts +7 -1
- package/types/internal/test.d.ts +5 -0
- package/report/types/buffer.d.ts +0 -19
|
@@ -685,6 +685,7 @@
|
|
|
685
685
|
"document-caretpositionfrompoint": "2025-12-12",
|
|
686
686
|
"event-timing": "2025-12-12",
|
|
687
687
|
"ext-texture-compression-rgtc": "2025-05-12",
|
|
688
|
+
"ext-texture-norm16": "2026-10-27",
|
|
688
689
|
"fetch-priority": "2024-10-29",
|
|
689
690
|
"field-sizing": "2026-06-16",
|
|
690
691
|
"float16array": "2025-04-04",
|
|
@@ -737,7 +738,9 @@
|
|
|
737
738
|
"ruby-align": "2024-12-11",
|
|
738
739
|
"ruby-position": "2024-12-11",
|
|
739
740
|
"scope": "2026-03-24",
|
|
741
|
+
"scoped-custom-element-registries": "2026-10-27",
|
|
740
742
|
"screen-wake-lock": "2025-03-31",
|
|
743
|
+
"scroll-driven-animations": "2026-10-27",
|
|
741
744
|
"scroll-to-text-fragment": "2024-10-01",
|
|
742
745
|
"scrollbar-color": "2025-12-12",
|
|
743
746
|
"scrollbar-gutter": "2024-12-11",
|
|
@@ -885,7 +888,9 @@
|
|
|
885
888
|
"display-contents",
|
|
886
889
|
"display-mode",
|
|
887
890
|
"display-ruby",
|
|
891
|
+
"display-state",
|
|
888
892
|
"document-colors",
|
|
893
|
+
"document-isolation-policy",
|
|
889
894
|
"document-modelcontext",
|
|
890
895
|
"document-picture-in-picture",
|
|
891
896
|
"document-write",
|
|
@@ -902,7 +907,6 @@
|
|
|
902
907
|
"ext-float-blend",
|
|
903
908
|
"ext-frag-depth",
|
|
904
909
|
"ext-texture-compression-bptc",
|
|
905
|
-
"ext-texture-norm16",
|
|
906
910
|
"external",
|
|
907
911
|
"eyedropper",
|
|
908
912
|
"fast-seek",
|
|
@@ -996,6 +1000,7 @@
|
|
|
996
1000
|
"link-parameters",
|
|
997
1001
|
"link-rel-expect",
|
|
998
1002
|
"link-rel-prefetch",
|
|
1003
|
+
"link-to",
|
|
999
1004
|
"loading-lazy-media",
|
|
1000
1005
|
"local-fonts",
|
|
1001
1006
|
"local-network-access",
|
|
@@ -1021,6 +1026,7 @@
|
|
|
1021
1026
|
"move-before",
|
|
1022
1027
|
"mutation-events",
|
|
1023
1028
|
"navigation-precommit-handlers",
|
|
1029
|
+
"navigation-source",
|
|
1024
1030
|
"navigation-timing-confidence",
|
|
1025
1031
|
"navigator-install",
|
|
1026
1032
|
"network-information",
|
|
@@ -1029,6 +1035,7 @@
|
|
|
1029
1035
|
"numeric-factory-functions",
|
|
1030
1036
|
"object-view-box",
|
|
1031
1037
|
"observable",
|
|
1038
|
+
"offline-audio-context-incremental-rendering",
|
|
1032
1039
|
"opaquerange",
|
|
1033
1040
|
"orientation-sensor",
|
|
1034
1041
|
"origin",
|
|
@@ -1083,6 +1090,7 @@
|
|
|
1083
1090
|
"reporting-interventions",
|
|
1084
1091
|
"reporting-permissions-policy-violations",
|
|
1085
1092
|
"requestidlecallback",
|
|
1093
|
+
"resizable",
|
|
1086
1094
|
"resize",
|
|
1087
1095
|
"retriable-module-loading",
|
|
1088
1096
|
"rhythmic-sizing",
|
|
@@ -1090,18 +1098,17 @@
|
|
|
1090
1098
|
"sanitizer",
|
|
1091
1099
|
"savedata",
|
|
1092
1100
|
"scheduler",
|
|
1093
|
-
"scoped-custom-element-registries",
|
|
1094
1101
|
"screen-capture",
|
|
1095
1102
|
"screen-orientation-lock",
|
|
1096
1103
|
"scroll-axis-lock",
|
|
1097
1104
|
"scroll-buttons",
|
|
1098
|
-
"scroll-driven-animations",
|
|
1099
1105
|
"scroll-initial-target",
|
|
1100
1106
|
"scroll-into-view-container",
|
|
1101
1107
|
"scroll-marker-targets",
|
|
1102
1108
|
"scroll-markers",
|
|
1103
1109
|
"scroll-promises",
|
|
1104
1110
|
"scroll-snap-events",
|
|
1111
|
+
"scroll-snap-type-pair",
|
|
1105
1112
|
"scroll-target-group",
|
|
1106
1113
|
"scroll-triggered-animations",
|
|
1107
1114
|
"secure-payment-confirmation",
|
|
@@ -1109,6 +1116,7 @@
|
|
|
1109
1116
|
"serial",
|
|
1110
1117
|
"serializable-errors",
|
|
1111
1118
|
"service-workers-static-routes",
|
|
1119
|
+
"shapes-polygon-round",
|
|
1112
1120
|
"share",
|
|
1113
1121
|
"shared-storage",
|
|
1114
1122
|
"shared-storage-locks",
|
|
@@ -1217,6 +1225,7 @@
|
|
|
1217
1225
|
"window-controls-overlay",
|
|
1218
1226
|
"window-drag",
|
|
1219
1227
|
"window-management",
|
|
1228
|
+
"window-management-resizing",
|
|
1220
1229
|
"with",
|
|
1221
1230
|
"word-break-auto-phrase",
|
|
1222
1231
|
"word-break-break-word",
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
import {Type} from 'csp_evaluator/dist/finding.js';
|
|
13
13
|
import {CspParser} from 'csp_evaluator/dist/parser.js';
|
|
14
14
|
import {Directive} from 'csp_evaluator/dist/csp.js';
|
|
15
|
-
import log from 'lighthouse-logger';
|
|
16
15
|
|
|
16
|
+
import log from './lighthouse-logger.js';
|
|
17
17
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
18
18
|
import {isIcuMessage} from '../../shared/localization/format.js';
|
|
19
19
|
|
|
@@ -16,14 +16,12 @@ export namespace UIStrings {
|
|
|
16
16
|
let DocumentCreateEventTransitionEvent: string;
|
|
17
17
|
let ExampleBrowserProcessDeprecation: string;
|
|
18
18
|
let FencedFrame: string;
|
|
19
|
-
let Fledge: string;
|
|
20
19
|
let GeolocationInsecureOrigin: string;
|
|
21
20
|
let GeolocationInsecureOriginDeprecatedNotRemoved: string;
|
|
22
21
|
let GetUserMediaInsecureOrigin: string;
|
|
23
22
|
let HostCandidateAttributeGetter: string;
|
|
24
23
|
let IdentityInCanMakePaymentEvent: string;
|
|
25
24
|
let InsecurePrivateNetworkSubresourceRequest: string;
|
|
26
|
-
let InterestGroupDailyUpdateUrl: string;
|
|
27
25
|
let IntlV8BreakIterator: string;
|
|
28
26
|
let LanguageModel_InputQuota: string;
|
|
29
27
|
let LanguageModel_InputUsage: string;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
// auto-generated by build/build-cdt-strings.js
|
|
2
|
+
// chromium commit: 26fd5b50588a0c10c6611b21493af9c30646cd93
|
|
2
3
|
/* eslint-disable */
|
|
3
|
-
// Copyright 2026 The Chromium Authors
|
|
4
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
5
|
-
// found in the LICENSE file.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
4
|
|
|
10
5
|
export const UIStrings = {
|
|
11
6
|
/**
|
|
@@ -76,10 +71,6 @@ export const UIStrings = {
|
|
|
76
71
|
* @description Warning displayed to developers that they are using the Fenced Frame API which has been deprecated and is scheduled to be removed.
|
|
77
72
|
*/
|
|
78
73
|
FencedFrame: "Fenced Frame API is deprecated and scheduled for removal.",
|
|
79
|
-
/**
|
|
80
|
-
* @description A deprecation warning shown in the DevTools Issues tab. It's shown when one of the Protected Audience APIs like `navigator.joinAdInterestGroup`, `navigator.getInterestGroupAdAuctionData` or `navigator.runAdAuction` are called.
|
|
81
|
-
*/
|
|
82
|
-
Fledge: "The Protected Audience API is deprecated and will be removed in a future release.",
|
|
83
74
|
/**
|
|
84
75
|
* @description Warning displayed to developers when the Geolocation API is used from an insecure origin (one that isn't localhost or doesn't use HTTPS) to notify them that this use is no longer supported.
|
|
85
76
|
*/
|
|
@@ -104,10 +95,6 @@ export const UIStrings = {
|
|
|
104
95
|
* @description This warning occurs when an insecure context (e.g., HTTP) requests a private resource (not on open internet). This is done to mitigate the potential for CSRF and other attacks.
|
|
105
96
|
*/
|
|
106
97
|
InsecurePrivateNetworkSubresourceRequest: "The website requested a subresource from a network that it could only access because of its users' privileged network position. These requests expose non-public devices and servers to the internet, increasing the risk of a cross-site request forgery (CSRF) attack, and/or information leakage. To mitigate these risks, Chrome deprecates requests to non-public subresources when initiated from non-secure contexts, and will start blocking them.",
|
|
107
|
-
/**
|
|
108
|
-
* @description This is a deprecated warning to developers that a field in a structure has been renamed.
|
|
109
|
-
*/
|
|
110
|
-
InterestGroupDailyUpdateUrl: "The `dailyUpdateUrl` field of `InterestGroups` passed to `joinAdInterestGroup()` has been renamed to `updateUrl`, to more accurately reflect its behavior.",
|
|
111
98
|
/**
|
|
112
99
|
* @description Warning displayed to developers that instead of calling the `Intl.v8BreakIterator` constructor, which is not a standard JavaScript API, use ECMA402 standard API Intl.Segmenter shipped in end of 2020 instead.
|
|
113
100
|
*/
|
|
@@ -306,10 +293,6 @@ export const UIStrings = {
|
|
|
306
293
|
XSLT: "XSLTProcessor and XSLT Processing Instructions have been deprecated by all browsers. These features will be removed from this browser soon.",
|
|
307
294
|
};
|
|
308
295
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
296
|
export const DEPRECATIONS_METADATA = {
|
|
314
297
|
"AttributionReporting": {
|
|
315
298
|
"chromeStatusFeature": 6320639375966208
|
package/core/lib/i18n/i18n.js
CHANGED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export default Log;
|
|
2
|
+
export type LoggerFn = {
|
|
3
|
+
(formatter: any, ...args: any[]): void;
|
|
4
|
+
color: string | number;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare class Log {
|
|
8
|
+
static events: Emitter;
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} title
|
|
11
|
+
* @param {Array<any>} argsArray
|
|
12
|
+
*/
|
|
13
|
+
static _logToStdErr(title: string, argsArray: Array<any>): void;
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} title
|
|
16
|
+
* @return {LoggerFn}
|
|
17
|
+
*/
|
|
18
|
+
static loggerfn(title: string): LoggerFn;
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} level
|
|
21
|
+
*/
|
|
22
|
+
static setLevel(level: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* A simple formatting utility for event logging.
|
|
25
|
+
* @param {string} prefix
|
|
26
|
+
* @param {{method?: string, params?: Record<string, any>}} data A JSON-serializable object of event data to log.
|
|
27
|
+
* @param {string=} level Optional logging level. Defaults to 'log'.
|
|
28
|
+
*/
|
|
29
|
+
static formatProtocol(prefix: string, data: {
|
|
30
|
+
method?: string;
|
|
31
|
+
params?: Record<string, any>;
|
|
32
|
+
}, level?: string | undefined): void;
|
|
33
|
+
/**
|
|
34
|
+
* @return {boolean}
|
|
35
|
+
*/
|
|
36
|
+
static isVerbose(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @param {{msg: string, id: string, args?: any[]}} status
|
|
39
|
+
* @param {'log'|'verbose'|'warn'|'error'} [level]
|
|
40
|
+
*/
|
|
41
|
+
static time({ msg, id, args }: {
|
|
42
|
+
msg: string;
|
|
43
|
+
id: string;
|
|
44
|
+
args?: any[];
|
|
45
|
+
}, level?: "log" | "verbose" | "warn" | "error"): void;
|
|
46
|
+
/**
|
|
47
|
+
* @param {{msg: string, id: string, args?: any[]}} status
|
|
48
|
+
* @param {'log'|'verbose'|'warn'|'error'} [level]
|
|
49
|
+
*/
|
|
50
|
+
static timeEnd({ msg, id, args }: {
|
|
51
|
+
msg: string;
|
|
52
|
+
id: string;
|
|
53
|
+
args?: any[];
|
|
54
|
+
}, level?: "log" | "verbose" | "warn" | "error"): void;
|
|
55
|
+
/**
|
|
56
|
+
* @param {string} title
|
|
57
|
+
* @param {...any} args
|
|
58
|
+
*/
|
|
59
|
+
static log(title: string, ...args: any[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* @param {string} title
|
|
62
|
+
* @param {...any} args
|
|
63
|
+
*/
|
|
64
|
+
static warn(title: string, ...args: any[]): void;
|
|
65
|
+
/**
|
|
66
|
+
* @param {string} title
|
|
67
|
+
* @param {...any} args
|
|
68
|
+
*/
|
|
69
|
+
static error(title: string, ...args: any[]): void;
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} title
|
|
72
|
+
* @param {...any} args
|
|
73
|
+
*/
|
|
74
|
+
static verbose(title: string, ...args: any[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Add surrounding escape sequences to turn a string green when logged.
|
|
77
|
+
* @param {string} str
|
|
78
|
+
* @return {string}
|
|
79
|
+
*/
|
|
80
|
+
static greenify(str: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Add surrounding escape sequences to turn a string red when logged.
|
|
83
|
+
* @param {string} str
|
|
84
|
+
* @return {string}
|
|
85
|
+
*/
|
|
86
|
+
static redify(str: string): string;
|
|
87
|
+
static get green(): string;
|
|
88
|
+
static get red(): string;
|
|
89
|
+
static get purple(): string;
|
|
90
|
+
static get reset(): string;
|
|
91
|
+
static get bold(): string;
|
|
92
|
+
static get dim(): string;
|
|
93
|
+
static get tick(): "√" | "✓";
|
|
94
|
+
static get cross(): "×" | "✘";
|
|
95
|
+
/**
|
|
96
|
+
* @return {PerformanceEntry[]}
|
|
97
|
+
*/
|
|
98
|
+
static takeTimeEntries(): PerformanceEntry[];
|
|
99
|
+
/**
|
|
100
|
+
* @return {PerformanceEntry[]}
|
|
101
|
+
*/
|
|
102
|
+
static getTimeEntries(): PerformanceEntry[];
|
|
103
|
+
}
|
|
104
|
+
/** @typedef {{(formatter: any, ...args: any[]): void, color: string|number, enabled: boolean}} LoggerFn */
|
|
105
|
+
/** @extends {EventEmitter<Record<string, any[]>>} */
|
|
106
|
+
declare class Emitter extends EventEmitter<Record<string, any[]>> {
|
|
107
|
+
/**
|
|
108
|
+
* @param {ConstructorParameters<typeof EventEmitter>[0]} [options]
|
|
109
|
+
*/
|
|
110
|
+
constructor(options?: ConstructorParameters<typeof EventEmitter>[0]);
|
|
111
|
+
/**
|
|
112
|
+
* Fires off all status updates. Listen with
|
|
113
|
+
* `log.events.addListener('status', callback)`
|
|
114
|
+
* @param {string} title
|
|
115
|
+
* @param {Array<any>} argsArray
|
|
116
|
+
*/
|
|
117
|
+
issueStatus(title: string, argsArray: Array<any>): void;
|
|
118
|
+
/**
|
|
119
|
+
* Fires off all warnings. Listen with
|
|
120
|
+
* `log.events.addListener('warning', callback)`
|
|
121
|
+
* @param {string} title
|
|
122
|
+
* @param {Array<any>} argsArray
|
|
123
|
+
*/
|
|
124
|
+
issueWarning(title: string, argsArray: Array<any>): void;
|
|
125
|
+
}
|
|
126
|
+
import { EventEmitter } from 'events';
|
|
127
|
+
//# sourceMappingURL=lighthouse-logger.d.ts.map
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2016 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import process from 'process';
|
|
8
|
+
import {EventEmitter} from 'events';
|
|
9
|
+
|
|
10
|
+
import debug from 'debug';
|
|
11
|
+
|
|
12
|
+
const isWindows = process.platform === 'win32';
|
|
13
|
+
|
|
14
|
+
// Capture the high resolution clock at module load, so later replacements of the global
|
|
15
|
+
// (e.g. by fake timers in tests) don't affect timing. `performance` is available in both
|
|
16
|
+
// Node and browsers; fall back to `Date.now` just in case.
|
|
17
|
+
const perf = globalThis.performance;
|
|
18
|
+
/** @type {() => number} */
|
|
19
|
+
const now = perf && typeof perf.now === 'function' ? () => perf.now() : () => Date.now();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Start times of in-progress timings, keyed by id.
|
|
23
|
+
* @type {Map<string, number>}
|
|
24
|
+
*/
|
|
25
|
+
let timeMarks = new Map();
|
|
26
|
+
/**
|
|
27
|
+
* Completed timings, sorted by startTime.
|
|
28
|
+
* @type {PerformanceEntry[]}
|
|
29
|
+
*/
|
|
30
|
+
let timeEntries = [];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} id
|
|
34
|
+
*/
|
|
35
|
+
function markStart(id) {
|
|
36
|
+
timeMarks.set(id, now());
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} id
|
|
41
|
+
*/
|
|
42
|
+
function markEnd(id) {
|
|
43
|
+
const endTime = now();
|
|
44
|
+
const startTime = timeMarks.get(id);
|
|
45
|
+
if (startTime === undefined) {
|
|
46
|
+
throw new Error(`no known mark: ${id}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const entry = /** @type {PerformanceEntry} */ ({
|
|
50
|
+
name: id,
|
|
51
|
+
entryType: 'measure',
|
|
52
|
+
startTime,
|
|
53
|
+
duration: endTime - startTime,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Insert after any existing entries with the same or earlier startTime, keeping the list sorted.
|
|
57
|
+
let index = timeEntries.length;
|
|
58
|
+
while (index > 0 && timeEntries[index - 1].startTime > startTime) index--;
|
|
59
|
+
timeEntries.splice(index, 0, entry);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// @ts-expect-error: process.browser is set via bundler.
|
|
63
|
+
const isBrowser = Boolean(process.browser);
|
|
64
|
+
|
|
65
|
+
const colors = {
|
|
66
|
+
red: isBrowser ? 'crimson' : 1,
|
|
67
|
+
yellow: isBrowser ? 'gold' : 3,
|
|
68
|
+
cyan: isBrowser ? 'darkturquoise' : 6,
|
|
69
|
+
green: isBrowser ? 'forestgreen' : 2,
|
|
70
|
+
blue: isBrowser ? 'steelblue' : 4,
|
|
71
|
+
magenta: isBrowser ? 'palevioletred' : 5,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// allow non-red/yellow colors for debug()
|
|
75
|
+
// @ts-expect-error - `colors` is not declared in @types/debug.
|
|
76
|
+
debug.colors = [colors.cyan, colors.green, colors.blue, colors.magenta];
|
|
77
|
+
|
|
78
|
+
/** @typedef {{(formatter: any, ...args: any[]): void, color: string|number, enabled: boolean}} LoggerFn */
|
|
79
|
+
|
|
80
|
+
/** @extends {EventEmitter<Record<string, any[]>>} */
|
|
81
|
+
class Emitter extends EventEmitter {
|
|
82
|
+
// yarn build-types fails without this!
|
|
83
|
+
// https://github.com/microsoft/TypeScript/issues/41672#issuecomment-2303803072
|
|
84
|
+
/**
|
|
85
|
+
* @param {ConstructorParameters<typeof EventEmitter>[0]} [options]
|
|
86
|
+
*/
|
|
87
|
+
constructor(options) {
|
|
88
|
+
super(options);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Fires off all status updates. Listen with
|
|
93
|
+
* `log.events.addListener('status', callback)`
|
|
94
|
+
* @param {string} title
|
|
95
|
+
* @param {Array<any>} argsArray
|
|
96
|
+
*/
|
|
97
|
+
issueStatus(title, argsArray) {
|
|
98
|
+
if (title === 'status' || title === 'statusEnd') {
|
|
99
|
+
this.emit(title, [title, ...argsArray]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Fires off all warnings. Listen with
|
|
105
|
+
* `log.events.addListener('warning', callback)`
|
|
106
|
+
* @param {string} title
|
|
107
|
+
* @param {Array<any>} argsArray
|
|
108
|
+
*/
|
|
109
|
+
issueWarning(title, argsArray) {
|
|
110
|
+
this.emit('warning', [title, ...argsArray]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** @type {Record<string, LoggerFn>} */
|
|
115
|
+
const loggersByTitle = {};
|
|
116
|
+
const loggingBufferColumns = 25;
|
|
117
|
+
/** @type {string|undefined} */
|
|
118
|
+
let level_;
|
|
119
|
+
|
|
120
|
+
class Log {
|
|
121
|
+
static events = new Emitter();
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {string} title
|
|
125
|
+
* @param {Array<any>} argsArray
|
|
126
|
+
*/
|
|
127
|
+
static _logToStdErr(title, argsArray) {
|
|
128
|
+
const log = Log.loggerfn(title);
|
|
129
|
+
log(argsArray[0], ...argsArray.slice(1));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {string} title
|
|
134
|
+
* @return {LoggerFn}
|
|
135
|
+
*/
|
|
136
|
+
static loggerfn(title) {
|
|
137
|
+
title = `LH:${title}`;
|
|
138
|
+
let log = loggersByTitle[title];
|
|
139
|
+
if (!log) {
|
|
140
|
+
log = debug(title);
|
|
141
|
+
loggersByTitle[title] = log;
|
|
142
|
+
// errors with red, warnings with yellow.
|
|
143
|
+
if (title.endsWith('error')) {
|
|
144
|
+
log.color = colors.red;
|
|
145
|
+
} else if (title.endsWith('warn')) {
|
|
146
|
+
log.color = colors.yellow;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return log;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @param {string} level
|
|
154
|
+
*/
|
|
155
|
+
static setLevel(level) {
|
|
156
|
+
level_ = level;
|
|
157
|
+
switch (level) {
|
|
158
|
+
case 'silent':
|
|
159
|
+
debug.enable('-LH:*');
|
|
160
|
+
break;
|
|
161
|
+
case 'verbose':
|
|
162
|
+
debug.enable('LH:*');
|
|
163
|
+
break;
|
|
164
|
+
case 'warn':
|
|
165
|
+
debug.enable('-LH:*, LH:*:warn, LH:*:error');
|
|
166
|
+
break;
|
|
167
|
+
case 'error':
|
|
168
|
+
debug.enable('-LH:*, LH:*:error');
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
debug.enable('LH:*, -LH:*:verbose');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A simple formatting utility for event logging.
|
|
177
|
+
* @param {string} prefix
|
|
178
|
+
* @param {{method?: string, params?: Record<string, any>}} data A JSON-serializable object of event data to log.
|
|
179
|
+
* @param {string=} level Optional logging level. Defaults to 'log'.
|
|
180
|
+
*/
|
|
181
|
+
static formatProtocol(prefix, data, level) {
|
|
182
|
+
const columns = (!process || isBrowser) ? Infinity : process.stdout.columns;
|
|
183
|
+
const method = data.method || '?????';
|
|
184
|
+
const maxLength = columns - method.length - prefix.length - loggingBufferColumns;
|
|
185
|
+
// IO.read ignored here to avoid logging megabytes of trace data
|
|
186
|
+
const snippet = (data.params && method !== 'IO.read') ?
|
|
187
|
+
JSON.stringify(data.params).slice(0, maxLength) : '';
|
|
188
|
+
Log._logToStdErr(`${prefix}:${level || ''}`, [method, snippet]);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @return {boolean}
|
|
193
|
+
*/
|
|
194
|
+
static isVerbose() {
|
|
195
|
+
return level_ === 'verbose';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @param {{msg: string, id: string, args?: any[]}} status
|
|
200
|
+
* @param {'log'|'verbose'|'warn'|'error'} [level]
|
|
201
|
+
*/
|
|
202
|
+
static time({msg, id, args = []}, level = 'log') {
|
|
203
|
+
markStart(id);
|
|
204
|
+
Log[level]('status', msg, ...args);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @param {{msg: string, id: string, args?: any[]}} status
|
|
209
|
+
* @param {'log'|'verbose'|'warn'|'error'} [level]
|
|
210
|
+
*/
|
|
211
|
+
static timeEnd({msg, id, args = []}, level = 'verbose') {
|
|
212
|
+
Log[level]('statusEnd', msg, ...args);
|
|
213
|
+
markEnd(id);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @param {string} title
|
|
218
|
+
* @param {...any} args
|
|
219
|
+
*/
|
|
220
|
+
static log(title, ...args) {
|
|
221
|
+
Log.events.issueStatus(title, args);
|
|
222
|
+
return Log._logToStdErr(title, args);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @param {string} title
|
|
227
|
+
* @param {...any} args
|
|
228
|
+
*/
|
|
229
|
+
static warn(title, ...args) {
|
|
230
|
+
Log.events.issueWarning(title, args);
|
|
231
|
+
return Log._logToStdErr(`${title}:warn`, args);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @param {string} title
|
|
236
|
+
* @param {...any} args
|
|
237
|
+
*/
|
|
238
|
+
static error(title, ...args) {
|
|
239
|
+
return Log._logToStdErr(`${title}:error`, args);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @param {string} title
|
|
244
|
+
* @param {...any} args
|
|
245
|
+
*/
|
|
246
|
+
static verbose(title, ...args) {
|
|
247
|
+
Log.events.issueStatus(title, args);
|
|
248
|
+
return Log._logToStdErr(`${title}:verbose`, args);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Add surrounding escape sequences to turn a string green when logged.
|
|
253
|
+
* @param {string} str
|
|
254
|
+
* @return {string}
|
|
255
|
+
*/
|
|
256
|
+
static greenify(str) {
|
|
257
|
+
return `${Log.green}${str}${Log.reset}`;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Add surrounding escape sequences to turn a string red when logged.
|
|
262
|
+
* @param {string} str
|
|
263
|
+
* @return {string}
|
|
264
|
+
*/
|
|
265
|
+
static redify(str) {
|
|
266
|
+
return `${Log.red}${str}${Log.reset}`;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
static get green() {
|
|
270
|
+
return '\x1B[32m';
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
static get red() {
|
|
274
|
+
return '\x1B[31m';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
static get purple() {
|
|
278
|
+
return '\x1b[95m';
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
static get reset() {
|
|
282
|
+
return '\x1B[0m';
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
static get bold() {
|
|
286
|
+
return '\x1b[1m';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
static get dim() {
|
|
290
|
+
return '\x1b[2m';
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
static get tick() {
|
|
294
|
+
return isWindows ? '\u221A' : '✓';
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
static get cross() {
|
|
298
|
+
return isWindows ? '\u00D7' : '✘';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* @return {PerformanceEntry[]}
|
|
303
|
+
*/
|
|
304
|
+
static takeTimeEntries() {
|
|
305
|
+
const entries = timeEntries;
|
|
306
|
+
timeMarks = new Map();
|
|
307
|
+
timeEntries = [];
|
|
308
|
+
return entries;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @return {PerformanceEntry[]}
|
|
313
|
+
*/
|
|
314
|
+
static getTimeEntries() {
|
|
315
|
+
return [...timeEntries];
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export default Log;
|
package/core/lib/median-run.d.ts
CHANGED
|
@@ -5,13 +5,23 @@
|
|
|
5
5
|
* We avoid the median of single measures like the performance score because they can still exhibit
|
|
6
6
|
* outlier behavior at the beginning or end of load.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
8
|
+
* @template {{audits: Record<string, {numericValue?: number}>}} T
|
|
9
|
+
* @param {Array<T>} runs
|
|
10
|
+
* @return {T}
|
|
10
11
|
*/
|
|
11
|
-
export function computeMedianRun
|
|
12
|
+
export function computeMedianRun<T extends {
|
|
13
|
+
audits: Record<string, {
|
|
14
|
+
numericValue?: number;
|
|
15
|
+
}>;
|
|
16
|
+
}>(runs: Array<T>): T;
|
|
12
17
|
/**
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
18
|
+
* @template {{audits: Record<string, {numericValue?: number}>}} T
|
|
19
|
+
* @param {Array<T>} runs
|
|
20
|
+
* @return {Array<T>}
|
|
15
21
|
*/
|
|
16
|
-
export function filterToValidRuns
|
|
22
|
+
export function filterToValidRuns<T extends {
|
|
23
|
+
audits: Record<string, {
|
|
24
|
+
numericValue?: number;
|
|
25
|
+
}>;
|
|
26
|
+
}>(runs: Array<T>): Array<T>;
|
|
17
27
|
//# sourceMappingURL=median-run.d.ts.map
|