lighthouse 13.4.1-dev.20260731 → 13.4.1-dev.20260820

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.
Files changed (31) hide show
  1. package/build-tracker.config.js +1 -1
  2. package/cli/test/smokehouse/lighthouse-runners/bundle.js +3 -3
  3. package/cli/test/smokehouse/lighthouse-runners/devtools-mcp.js +2 -1
  4. package/core/audits/webmcp-schema-validity.js +1 -1
  5. package/core/computed/metrics/interactive.js +1 -1
  6. package/core/computed/metrics/lantern-metric.js +1 -1
  7. package/core/computed/trace-engine-result.d.ts +3 -3
  8. package/core/computed/trace-engine-result.js +3 -3
  9. package/core/computed/unused-javascript-summary.d.ts +0 -1
  10. package/core/computed/unused-javascript-summary.js +0 -1
  11. package/core/gather/driver/wait-for-condition.d.ts +3 -6
  12. package/core/gather/driver/wait-for-condition.js +2 -2
  13. package/core/gather/gatherers/accessibility.js +1 -1
  14. package/core/gather/gatherers/image-elements.js +1 -1
  15. package/core/gather/gatherers/stacks.d.ts +1 -1
  16. package/core/gather/gatherers/stacks.js +1 -1
  17. package/core/index.cjs +5 -5
  18. package/core/index.d.cts +5 -5
  19. package/core/lib/arbitrary-equality-map.d.ts +2 -2
  20. package/core/lib/arbitrary-equality-map.js +1 -1
  21. package/core/lib/deprecation-description.js +1 -1
  22. package/dist/report/bundle.esm.js +1 -1
  23. package/dist/report/flow.js +1 -1
  24. package/dist/report/standalone.js +1 -1
  25. package/package.json +3 -3
  26. package/report/renderer/details-renderer.js +7 -5
  27. package/report/renderer/drop-down-menu.d.ts +2 -2
  28. package/report/renderer/drop-down-menu.js +1 -1
  29. package/report/renderer/snippet-renderer.d.ts +4 -4
  30. package/report/renderer/snippet-renderer.js +3 -3
  31. package/report/renderer/text-encoding.js +2 -2
@@ -6,7 +6,7 @@ module.exports = {
6
6
  artifacts: [
7
7
  'dist/lightrider/lighthouse-lr-bundle.js',
8
8
  'dist/extension/scripts/lighthouse-ext-bundle.js',
9
- 'dist/lighthouse-dt-bundle.js',
9
+ 'dist/devtools/lighthouse-dt-bundle.js',
10
10
  'dist/gh-pages/viewer/src/bundled.js',
11
11
  'dist/gh-pages/treemap/src/bundled.js',
12
12
  'dist/lightrider/report-generator-bundle.js',
@@ -65,17 +65,17 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
65
65
  }
66
66
 
67
67
  // Load bundle, which creates a `global.runBundledLighthouse`.
68
- await import(LH_ROOT + '/dist/lighthouse-dt-bundle.js');
68
+ await import(LH_ROOT + '/dist/devtools/lighthouse-dt-bundle.js');
69
69
 
70
70
  global.require = originalRequire;
71
71
  global.Buffer = originalBuffer;
72
72
  global.process = originalProcess;
73
73
 
74
- /** @type {import('../../../../core/index.js')['default']} */
74
+ /** @type {typeof import('../../../../core/index.js')['default']} */
75
75
  // @ts-expect-error - not worth giving test global an actual type.
76
76
  const lighthouse = global.runBundledLighthouse;
77
77
 
78
- /** @type {import('../../../../core/lib/third-party-web.js')['default']} */
78
+ /** @type {typeof import('../../../../core/lib/third-party-web.js')['default']} */
79
79
  // @ts-expect-error
80
80
  const thirdPartyWeb = global.thirdPartyWeb;
81
81
  thirdPartyWeb.provideThirdPartyWeb(thirdPartyWebLib);
@@ -54,7 +54,8 @@ async function runBundledLighthouse(url, config, testRunnerOptions) {
54
54
  }
55
55
 
56
56
  // Load bundle.
57
- const {navigation} = await import(LH_ROOT + '/dist/lighthouse-devtools-mcp-bundle.js');
57
+ const {navigation} =
58
+ await import(LH_ROOT + '/dist/devtools-mcp/lighthouse-devtools-mcp-bundle.js');
58
59
 
59
60
  const chromeFlags = [];
60
61
  if (testRunnerOptions?.headless) chromeFlags.push('--headless=new');
@@ -70,7 +70,7 @@ class WebMcpSchemaValidity extends Audit {
70
70
  WARNING: 2,
71
71
  };
72
72
 
73
- /** @type {Record<string, {severity: Severity, description: LH.IcuMessage}>} */
73
+ /** @type {Record<string, {severity: typeof Severity[keyof typeof Severity], description: LH.IcuMessage}>} */
74
74
  const issueConfigs = {
75
75
  'FormModelContextMissingToolName': {
76
76
  severity: Severity.ERROR,
@@ -88,7 +88,7 @@ class Interactive extends NavigationMetric {
88
88
  static findOverlappingQuietPeriods(longTasks, networkRecords, processedNavigation) {
89
89
  const FcpTsInMs = processedNavigation.timestamps.firstContentfulPaint / 1000;
90
90
 
91
- /** @type {function(TimePeriod):boolean} */
91
+ /** @type {(period: TimePeriod) => boolean} */
92
92
  const isLongEnoughQuietPeriod = period =>
93
93
  period.end > FcpTsInMs + REQUIRED_QUIET_WINDOW &&
94
94
  period.end - period.start >= REQUIRED_QUIET_WINDOW;
@@ -61,7 +61,7 @@ function lanternErrorAdapter(err) {
61
61
  throw err;
62
62
  }
63
63
 
64
- const code = /** @type {keyof LighthouseError.errors} */ (err.message);
64
+ const code = /** @type {keyof typeof LighthouseError.errors} */ (err.message);
65
65
  if (LighthouseError.errors[code]) {
66
66
  throw new LighthouseError(LighthouseError.errors[code]);
67
67
  }
@@ -25,7 +25,7 @@ declare class TraceEngineResult {
25
25
  *
26
26
  * @template {any[]} Args
27
27
  * @template {import('../lib/trace-engine.js').DevToolsIcuMessage} Ret
28
- * @param {ReturnType<i18n.createIcuMessageFn>} str_
28
+ * @param {ReturnType<typeof i18n.createIcuMessageFn>} str_
29
29
  * @param {(...args: Args) => Ret} fn
30
30
  * @return {(...args: Args) => LH.IcuMessage}
31
31
  */
@@ -34,7 +34,7 @@ declare class TraceEngineResult {
34
34
  * Converts the input parameters given to `i18nString` usages in DevTools to a
35
35
  * LH.IcuMessage.
36
36
  *
37
- * @param {ReturnType<i18n.createIcuMessageFn>} str_
37
+ * @param {ReturnType<typeof i18n.createIcuMessageFn>} str_
38
38
  * @param {import('../lib/trace-engine.js').DevToolsIcuMessage} traceEngineI18nObject
39
39
  * @return {LH.IcuMessage}
40
40
  */
@@ -42,7 +42,7 @@ declare class TraceEngineResult {
42
42
  /**
43
43
  * Recursively finds all DevToolsIcuMessage objects and replaces them with LH.IcuMessage.
44
44
  *
45
- * @param {ReturnType<i18n.createIcuMessageFn>} str_
45
+ * @param {ReturnType<typeof i18n.createIcuMessageFn>} str_
46
46
  * @param {object} object
47
47
  */
48
48
  static localizeObject(str_: ReturnType<typeof i18n.createIcuMessageFn>, object: object): void;
@@ -76,7 +76,7 @@ class TraceEngineResult {
76
76
  *
77
77
  * @template {any[]} Args
78
78
  * @template {import('../lib/trace-engine.js').DevToolsIcuMessage} Ret
79
- * @param {ReturnType<i18n.createIcuMessageFn>} str_
79
+ * @param {ReturnType<typeof i18n.createIcuMessageFn>} str_
80
80
  * @param {(...args: Args) => Ret} fn
81
81
  * @return {(...args: Args) => LH.IcuMessage}
82
82
  */
@@ -88,7 +88,7 @@ class TraceEngineResult {
88
88
  * Converts the input parameters given to `i18nString` usages in DevTools to a
89
89
  * LH.IcuMessage.
90
90
  *
91
- * @param {ReturnType<i18n.createIcuMessageFn>} str_
91
+ * @param {ReturnType<typeof i18n.createIcuMessageFn>} str_
92
92
  * @param {import('../lib/trace-engine.js').DevToolsIcuMessage} traceEngineI18nObject
93
93
  * @return {LH.IcuMessage}
94
94
  */
@@ -121,7 +121,7 @@ class TraceEngineResult {
121
121
  /**
122
122
  * Recursively finds all DevToolsIcuMessage objects and replaces them with LH.IcuMessage.
123
123
  *
124
- * @param {ReturnType<i18n.createIcuMessageFn>} str_
124
+ * @param {ReturnType<typeof i18n.createIcuMessageFn>} str_
125
125
  * @param {object} object
126
126
  */
127
127
  static localizeObject(str_, object) {
@@ -39,7 +39,6 @@ declare const UnusedJavascriptSummaryComputed: typeof UnusedJavascriptSummary &
39
39
  * @property {string} scriptId
40
40
  * @property {number} wastedBytes
41
41
  * @property {number} totalBytes
42
- * @property {number} wastedBytes
43
42
  * @property {number=} wastedPercent
44
43
  * @property {Record<string, number>=} sourcesWastedBytes Keyed by file name. Includes (unmapped) key too.
45
44
  */
@@ -24,7 +24,6 @@ import {makeComputedArtifact} from './computed-artifact.js';
24
24
  * @property {string} scriptId
25
25
  * @property {number} wastedBytes
26
26
  * @property {number} totalBytes
27
- * @property {number} wastedBytes
28
27
  * @property {number=} wastedPercent
29
28
  * @property {Record<string, number>=} sourcesWastedBytes Keyed by file name. Includes (unmapped) key too.
30
29
  */
@@ -18,7 +18,7 @@ export type WaitOptions = {
18
18
  waitForCPUIdle: typeof waitForCPUIdle;
19
19
  } | undefined;
20
20
  };
21
- /** @typedef {InstanceType<import('./network-monitor.js')['NetworkMonitor']>} NetworkMonitor */
21
+ /** @typedef {InstanceType<typeof import('./network-monitor.js')['NetworkMonitor']>} NetworkMonitor */
22
22
  /** @typedef {import('./network-monitor.js').NetworkMonitorEvent} NetworkMonitorEvent */
23
23
  /**
24
24
  * @template [T=void]
@@ -40,12 +40,9 @@ export type WaitOptions = {
40
40
  * Returns a promise that resolves immediately.
41
41
  * Used for placeholder conditions that we don't want to start waiting for just yet, but still want
42
42
  * to satisfy the same interface.
43
- * @return {{promise: Promise<void>, cancel: function(): void}}
43
+ * @return {CancellableWait<void>}
44
44
  */
45
- export function waitForNothing(): {
46
- promise: Promise<void>;
47
- cancel: () => void;
48
- };
45
+ export function waitForNothing(): CancellableWait<void>;
49
46
  /**
50
47
  * Returns a promise that resolve when a frame has been navigated.
51
48
  * Used for detecting that our about:blank reset has been completed.
@@ -11,7 +11,7 @@ import log from 'lighthouse-logger';
11
11
  import {LighthouseError} from '../../lib/lh-error.js';
12
12
  import {ExecutionContext} from './execution-context.js';
13
13
 
14
- /** @typedef {InstanceType<import('./network-monitor.js')['NetworkMonitor']>} NetworkMonitor */
14
+ /** @typedef {InstanceType<typeof import('./network-monitor.js')['NetworkMonitor']>} NetworkMonitor */
15
15
  /** @typedef {import('./network-monitor.js').NetworkMonitorEvent} NetworkMonitorEvent */
16
16
 
17
17
  /**
@@ -36,7 +36,7 @@ import {ExecutionContext} from './execution-context.js';
36
36
  * Returns a promise that resolves immediately.
37
37
  * Used for placeholder conditions that we don't want to start waiting for just yet, but still want
38
38
  * to satisfy the same interface.
39
- * @return {{promise: Promise<void>, cancel: function(): void}}
39
+ * @return {CancellableWait<void>}
40
40
  */
41
41
  function waitForNothing() {
42
42
  return {promise: Promise.resolve(), cancel() {}};
@@ -15,7 +15,7 @@ import {pageFunctions} from '../../lib/page-functions.js';
15
15
  */
16
16
  /* c8 ignore start */
17
17
  async function runA11yChecks() {
18
- /** @type {import('axe-core/axe')} */
18
+ /** @type {typeof import('axe-core/axe')} */
19
19
  // @ts-expect-error - axe defined by axeLibSource
20
20
  const axe = window.axe;
21
21
  const application = `lighthouse-${Math.random()}`;
@@ -189,7 +189,7 @@ function findSizeDeclaration(rule, property) {
189
189
  * Finds the most specific directly matched CSS font-size rule from the list.
190
190
  *
191
191
  * @param {Array<LH.Crdp.CSS.RuleMatch>} matchedCSSRules
192
- * @param {function(LH.Crdp.CSS.CSSStyle):boolean|string|undefined} isDeclarationOfInterest
192
+ * @param {(style: LH.Crdp.CSS.CSSStyle) => boolean|string|undefined} isDeclarationOfInterest
193
193
  */
194
194
  function findMostSpecificMatchedCSSRule(matchedCSSRules = [], isDeclarationOfInterest) {
195
195
  let mostSpecificRule;
@@ -13,7 +13,7 @@ export type JSLibraryDetectorTest = {
13
13
  /**
14
14
  * Returns false if library is not present, otherwise returns an object that contains the library version (set to null if the version is not detected).
15
15
  */
16
- test: (arg0: Window) => JSLibraryDetectorTestResult | Promise<JSLibraryDetectorTestResult>;
16
+ test: (w: Window) => JSLibraryDetectorTestResult | Promise<JSLibraryDetectorTestResult>;
17
17
  };
18
18
  export type JSLibrary = {
19
19
  id: string;
@@ -32,7 +32,7 @@ const libDetectorSource = fs.readFileSync(
32
32
  * @property {string} icon
33
33
  * @property {string} url
34
34
  * @property {string|null} npm npm module name, if applicable to library.
35
- * @property {function(Window): JSLibraryDetectorTestResult | Promise<JSLibraryDetectorTestResult>} test Returns false if library is not present, otherwise returns an object that contains the library version (set to null if the version is not detected).
35
+ * @property {(w: Window) => JSLibraryDetectorTestResult | Promise<JSLibraryDetectorTestResult>} test Returns false if library is not present, otherwise returns an object that contains the library version (set to null if the version is not detected).
36
36
  */
37
37
 
38
38
  /**
package/core/index.cjs CHANGED
@@ -6,13 +6,13 @@
6
6
 
7
7
  /**
8
8
  * @typedef ExportType
9
- * @property {import('./index.js')['startFlow']} startFlow
10
- * @property {import('./index.js')['navigation']} navigation
11
- * @property {import('./index.js')['startTimespan']} startTimespan
12
- * @property {import('./index.js')['snapshot']} snapshot
9
+ * @property {typeof import('./index.js')['startFlow']} startFlow
10
+ * @property {typeof import('./index.js')['navigation']} navigation
11
+ * @property {typeof import('./index.js')['startTimespan']} startTimespan
12
+ * @property {typeof import('./index.js')['snapshot']} snapshot
13
13
  */
14
14
 
15
- /** @type {import('./index.js')['default'] & ExportType} */
15
+ /** @type {typeof import('./index.js')['default'] & ExportType} */
16
16
  const lighthouse = async function lighthouse(...args) {
17
17
  const {default: lighthouse} = await import('./index.js');
18
18
  return lighthouse(...args);
package/core/index.d.cts CHANGED
@@ -6,11 +6,11 @@ export = lighthouse;
6
6
  */
7
7
  /**
8
8
  * @typedef ExportType
9
- * @property {import('./index.js')['startFlow']} startFlow
10
- * @property {import('./index.js')['navigation']} navigation
11
- * @property {import('./index.js')['startTimespan']} startTimespan
12
- * @property {import('./index.js')['snapshot']} snapshot
9
+ * @property {typeof import('./index.js')['startFlow']} startFlow
10
+ * @property {typeof import('./index.js')['navigation']} navigation
11
+ * @property {typeof import('./index.js')['startTimespan']} startTimespan
12
+ * @property {typeof import('./index.js')['snapshot']} snapshot
13
13
  */
14
- /** @type {import('./index.js')['default'] & ExportType} */
14
+ /** @type {typeof import('./index.js')['default'] & ExportType} */
15
15
  declare const lighthouse: typeof import("./index.js")["default"] & ExportType;
16
16
  //# sourceMappingURL=index.d.cts.map
@@ -20,9 +20,9 @@ export class ArbitraryEqualityMap {
20
20
  value: any;
21
21
  }>;
22
22
  /**
23
- * @param {function(*,*):boolean} equalsFn
23
+ * @param {(a: any, b: any) => boolean} equalsFn
24
24
  */
25
- setEqualityFn(equalsFn: (arg0: any, arg1: any) => boolean): void;
25
+ setEqualityFn(equalsFn: (a: any, b: any) => boolean): void;
26
26
  /**
27
27
  * @param {*} key
28
28
  * @return {boolean}
@@ -19,7 +19,7 @@ class ArbitraryEqualityMap {
19
19
  }
20
20
 
21
21
  /**
22
- * @param {function(*,*):boolean} equalsFn
22
+ * @param {(a: any, b: any) => boolean} equalsFn
23
23
  */
24
24
  setEqualityFn(equalsFn) {
25
25
  this._equalsFn = equalsFn;
@@ -33,7 +33,7 @@ const deprecationsStr_ = i18n.createIcuMessageFn(
33
33
  */
34
34
  function getIssueDetailDescription(issueDetails) {
35
35
  let message;
36
- const type = /** @type {keyof DEPRECATIONS_METADATA} */ (issueDetails.type);
36
+ const type = /** @type {keyof typeof DEPRECATIONS_METADATA} */ (issueDetails.type);
37
37
  const maybeEnglishMessage = DeprecationUIStrings[type];
38
38
  if (maybeEnglishMessage) {
39
39
  message = deprecationsStr_(maybeEnglishMessage);