lighthouse 13.6.0-dev.20261109 → 13.6.0-dev.20261111

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.
@@ -78,8 +78,6 @@ const exclusions = {
78
78
  };
79
79
 
80
80
  for (const array of Object.values(exclusions)) {
81
- // https://github.com/GoogleChrome/lighthouse/issues/17277
82
- array.push('webmcp');
83
81
  // https://github.com/GoogleChrome/lighthouse/issues/14271
84
82
  array.push('lantern-idle-callback-short');
85
83
  // glitch is gone.
@@ -8,7 +8,7 @@
8
8
  * @fileoverview A runner that launches Chrome and executes Lighthouse via a
9
9
  * bundle to test that bundling has produced correct and runnable code.
10
10
  * Currently uses `lighthouse-dt-bundle.js`.
11
- * Runs in a worker to avoid messing up marky's global state.
11
+ * Runs in a worker to avoid messing up global state.
12
12
  */
13
13
 
14
14
  import fs from 'fs';
@@ -45,6 +45,10 @@ export class NetworkMonitor extends NetworkMonitor_base {
45
45
  requestedUrl?: string;
46
46
  mainDocumentUrl?: string;
47
47
  }>;
48
+ /**
49
+ * @return {Array<NetworkRequest>}
50
+ */
51
+ getRawRecords(): Array<NetworkRequest>;
48
52
  /**
49
53
  * @return {Array<NetworkRequest>}
50
54
  */
@@ -120,9 +120,16 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
120
120
  /**
121
121
  * @return {Array<NetworkRequest>}
122
122
  */
123
- getInflightRequests() {
123
+ getRawRecords() {
124
124
  if (!this._networkRecorder) return [];
125
- return this._networkRecorder.getRawRecords().filter(request => !request.finished);
125
+ return this._networkRecorder.getRawRecords();
126
+ }
127
+
128
+ /**
129
+ * @return {Array<NetworkRequest>}
130
+ */
131
+ getInflightRequests() {
132
+ return this.getRawRecords().filter(request => !request.finished);
126
133
  }
127
134
 
128
135
  /**
@@ -16,6 +16,7 @@ import LinkHeader from 'http-link-header';
16
16
 
17
17
  import BaseGatherer from '../../base-gatherer.js';
18
18
  import RobotsTxt from '../seo/robots-txt.js';
19
+ import * as Lantern from '../../../lib/lantern/lantern.js';
19
20
 
20
21
  /**
21
22
  * Link relations for ARD entry sources. `ai-catalog` is the predecessor relation, which
@@ -161,15 +162,26 @@ class AgentResourceDiscovery extends BaseGatherer {
161
162
  static async getHttpHeaderLinks(context, finalDisplayedUrl) {
162
163
  if (context.gatherMode !== 'navigation') return NO_LINKS;
163
164
 
164
- try {
165
- const mainResourceResponse = await context.driver.fetcher.fetchResource(finalDisplayedUrl);
166
- const linkHeader = mainResourceResponse.headers?.link;
167
- if (!linkHeader) return NO_LINKS;
165
+ const {mainDocumentUrl} = context.baseArtifacts.URL;
166
+ if (!mainDocumentUrl) return NO_LINKS;
168
167
 
169
- const parsed = LinkHeader.parse(linkHeader.replace(/\n/g, ','));
168
+ try {
169
+ // Read the headers from the network monitor rather than a DevtoolsLog dependency, since
170
+ // this gatherer also supports snapshot mode and so cannot depend on DevtoolsLog.
171
+ const records = context.driver.networkMonitor.getRawRecords();
172
+ const mainResource = Lantern.Core.NetworkAnalyzer.findLastDocumentForUrl(
173
+ records,
174
+ mainDocumentUrl
175
+ );
176
+ if (!mainResource) return NO_LINKS;
177
+
178
+ // NetworkRequest already splits multi-value headers into separate entries.
179
+ const refs = mainResource.responseHeaders
180
+ .filter(header => header.name.toLowerCase() === 'link')
181
+ .flatMap(header => LinkHeader.parse(header.value).refs);
170
182
  /** @param {string} rel */
171
183
  const getUri = rel =>
172
- resolveUrl(parsed.refs.find(ref => ref.rel?.toLowerCase() === rel)?.uri, finalDisplayedUrl);
184
+ resolveUrl(refs.find(ref => ref.rel?.toLowerCase() === rel)?.uri, finalDisplayedUrl);
173
185
  return {ard: getUri(REL_ARD), legacy: getUri(REL_LEGACY)};
174
186
  } catch (err) {
175
187
  log.verbose('AgentResourceDiscovery', `Could not read Link header: ${err.message}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "13.6.0-dev.20261109",
4
+ "version": "13.6.0-dev.20261111",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {
@@ -148,7 +148,6 @@
148
148
  "typed-query-selector": "^2.12.3",
149
149
  "typescript": "6.0.3",
150
150
  "typescript-eslint": "^8.60.1",
151
- "wait-for-expect": "^4.0.0",
152
151
  "web-features": "^3.44.0",
153
152
  "webtreemap-cdt": "^3.2.1"
154
153
  },
package/tsconfig.json CHANGED
@@ -41,6 +41,8 @@
41
41
  "clients/test/**/*.js",
42
42
  "cli/test/fixtures/**/*.js",
43
43
  "core/scripts/legacy-javascript/variants",
44
+ // Imports the local lighthouse-logger source, which isn't type checked (core uses its published types).
45
+ "core/test/lib/lighthouse-logger-test.js",
44
46
  // These test files require further changes before they can be type checked.
45
47
  "core/test/config/config-helpers-test.js",
46
48
  "core/test/config/config-plugin-test.js",