lighthouse 10.1.0 → 10.1.1

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.
@@ -109,6 +109,7 @@ export const UIStrings: {
109
109
  /** Message logged when the web app has been uninstalled o desktop, signalling that the install banner state is being reset. */
110
110
  'pipeline-restarted': string;
111
111
  /**
112
+ * TODO: This error was removed in M114, we can remove this message when it hits stable.
112
113
  * @description Error message explaining that the URL of the manifest uses a scheme that is not supported on Android.
113
114
  * @example {data:} scheme
114
115
  */
@@ -44,6 +44,7 @@ const UIStrings = {
44
44
  'manifest-display-not-supported': `Manifest 'display' property must be one of 'standalone', 'fullscreen', or 'minimal-ui'`,
45
45
  /** Error message explaining that the manifest could not be fetched, might be empty, or could not be parsed. */
46
46
  'manifest-empty': `Manifest could not be fetched, is empty, or could not be parsed`,
47
+ // TODO: This error was removed in M114, we can remove this message when it hits stable.
47
48
  /** Error message explaining that no matching service worker was detected,
48
49
  * and provides a suggestion to reload the page or check whether the scope of the service worker
49
50
  * for the current page encloses the scope and start URL from the manifest. */
@@ -97,6 +98,7 @@ const UIStrings = {
97
98
  /** Message logged when the web app has been uninstalled o desktop, signalling that the install banner state is being reset. */
98
99
  'pipeline-restarted': 'PWA has been uninstalled and installability checks resetting.',
99
100
  /**
101
+ * TODO: This error was removed in M114, we can remove this message when it hits stable.
100
102
  * @description Error message explaining that the URL of the manifest uses a scheme that is not supported on Android.
101
103
  * @example {data:} scheme
102
104
  */
@@ -84,6 +84,7 @@ function getHTMLImages(allElements) {
84
84
  isPicture,
85
85
  loading: element.loading,
86
86
  isInShadowDOM: element.getRootNode() instanceof ShadowRoot,
87
+ fetchPriority: element.fetchPriority,
87
88
  // @ts-expect-error - getNodeDetails put into scope via stringification
88
89
  node: getNodeDetails(element),
89
90
  };
@@ -61,6 +61,7 @@ class InspectorIssues extends FRGatherer {
61
61
  const artifact = {
62
62
  attributionReportingIssue: [],
63
63
  blockedByResponseIssue: [],
64
+ bounceTrackingIssue: [],
64
65
  clientHintIssue: [],
65
66
  contentSecurityPolicyIssue: [],
66
67
  corsIssue: [],
@@ -35,5 +35,8 @@ declare class LinkElements extends FRGatherer {
35
35
  */
36
36
  getArtifact(context: LH.Gatherer.FRTransitionalContext<'DevtoolsLog'>): Promise<LH.Artifacts['LinkElements']>;
37
37
  }
38
+ export namespace UIStrings {
39
+ const headerParseWarning: string;
40
+ }
38
41
  import FRGatherer from "../base-gatherer.js";
39
42
  //# sourceMappingURL=link-elements.d.ts.map
@@ -10,6 +10,8 @@ import FRGatherer from '../base-gatherer.js';
10
10
  import {pageFunctions} from '../../lib/page-functions.js';
11
11
  import DevtoolsLog from './devtools-log.js';
12
12
  import {MainResource} from '../../computed/main-resource.js';
13
+ import {Util} from '../../../shared/util.js';
14
+ import * as i18n from '../../lib/i18n/i18n.js';
13
15
 
14
16
  /* globals HTMLLinkElement getNodeDetails */
15
17
 
@@ -19,6 +21,17 @@ import {MainResource} from '../../computed/main-resource.js';
19
21
  * headers of the main resource.
20
22
  */
21
23
 
24
+ const UIStrings = {
25
+ /**
26
+ * @description Warning message explaining that there was an error parsing a link header in an HTTP response. `error` will be an english string with more details on the error. `header` will be the value of the header that caused the error. `link` is a type of HTTP header and should not be translated.
27
+ * @example {Expected attribute delimiter at offset 94} error
28
+ * @example {<https://assets.calendly.com/assets/booking/css/booking-d0ac32b1.css>; rel=preload; as=style; nopush} error
29
+ */
30
+ headerParseWarning: 'Error parsing `link` header ({error}): `{header}`',
31
+ };
32
+
33
+ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
34
+
22
35
  /**
23
36
  *
24
37
  * @param {string} url
@@ -70,6 +83,7 @@ function getLinkElementsInDOM() {
70
83
  crossOrigin: link.crossOrigin,
71
84
  hrefRaw,
72
85
  source,
86
+ fetchPriority: link.fetchPriority,
73
87
  // @ts-expect-error - put into scope via stringification
74
88
  node: getNodeDetails(link),
75
89
  });
@@ -125,7 +139,21 @@ class LinkElements extends FRGatherer {
125
139
  for (const header of mainDocument.responseHeaders) {
126
140
  if (header.name.toLowerCase() !== 'link') continue;
127
141
 
128
- for (const link of LinkHeader.parse(header.value).refs) {
142
+ /** @type {LinkHeader.Reference[]} */
143
+ let parsedRefs = [];
144
+
145
+ try {
146
+ parsedRefs = LinkHeader.parse(header.value).refs;
147
+ } catch (err) {
148
+ const truncatedHeader = Util.truncate(header.value, 100);
149
+ const warning = str_(UIStrings.headerParseWarning, {
150
+ error: err.message,
151
+ header: truncatedHeader,
152
+ });
153
+ context.baseArtifacts.LighthouseRunWarnings.push(warning);
154
+ }
155
+
156
+ for (const link of parsedRefs) {
129
157
  linkElements.push({
130
158
  rel: link.rel || '',
131
159
  href: normalizeUrlOrNull(link.uri, context.baseArtifacts.URL.finalDisplayedUrl),
@@ -134,6 +162,7 @@ class LinkElements extends FRGatherer {
134
162
  as: link.as || '',
135
163
  crossOrigin: getCrossoriginFromHeader(link.crossorigin),
136
164
  source: 'headers',
165
+ fetchPriority: link.fetchpriority,
137
166
  node: null,
138
167
  });
139
168
  }
@@ -179,3 +208,4 @@ class LinkElements extends FRGatherer {
179
208
  }
180
209
 
181
210
  export default LinkElements;
211
+ export {UIStrings};
@@ -3,12 +3,12 @@
3
3
  */
4
4
  declare function getDescription(issueDetails: LH.Crdp.Audits.DeprecationIssueDetails): {
5
5
  file: string;
6
- substitutions: Map<string, import("../index.js").IcuMessage>;
6
+ substitutions: Map<string, import("../index.js").IcuMessage | undefined>;
7
7
  links: {
8
8
  link: string;
9
9
  linkTitle: import("../index.js").IcuMessage;
10
10
  }[];
11
- message: import("../index.js").IcuMessage;
11
+ message: import("../index.js").IcuMessage | undefined;
12
12
  };
13
13
  export namespace UIStrings {
14
14
  const feature: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "10.1.0",
4
+ "version": "10.1.1",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {
@@ -142,7 +142,6 @@
142
142
  "cpy": "^8.1.2",
143
143
  "cross-env": "^7.0.2",
144
144
  "csv-validator": "^0.0.3",
145
- "devtools-protocol": "0.0.1081726",
146
145
  "es-main": "^1.0.2",
147
146
  "eslint": "^8.4.1",
148
147
  "eslint-config-google": "^0.14.0",
@@ -191,8 +190,9 @@
191
190
  "chrome-launcher": "^0.15.1",
192
191
  "configstore": "^5.0.1",
193
192
  "csp_evaluator": "1.1.1",
193
+ "devtools-protocol": "0.0.1130274",
194
194
  "enquirer": "^2.3.6",
195
- "http-link-header": "^1.1.0",
195
+ "http-link-header": "^1.1.1",
196
196
  "intl-messageformat": "^4.4.0",
197
197
  "jpeg-js": "^0.4.4",
198
198
  "js-library-detector": "^6.6.0",
@@ -214,8 +214,8 @@
214
214
  "yargs-parser": "^21.0.0"
215
215
  },
216
216
  "resolutions": {
217
- "puppeteer/**/devtools-protocol": "0.0.1081726",
218
- "puppeteer-core/**/devtools-protocol": "0.0.1081726"
217
+ "puppeteer/**/devtools-protocol": "0.0.1130274",
218
+ "puppeteer-core/**/devtools-protocol": "0.0.1130274"
219
219
  },
220
220
  "repository": "GoogleChrome/lighthouse",
221
221
  "keywords": [
@@ -1715,6 +1715,9 @@
1715
1715
  "core/gather/driver/storage.js | warningOriginDataTimeout": {
1716
1716
  "message": "Clearing the origin data timed out. Try auditing this page again and file a bug if the issue persists."
1717
1717
  },
1718
+ "core/gather/gatherers/link-elements.js | headerParseWarning": {
1719
+ "message": "Error parsing `link` header ({error}): `{header}`"
1720
+ },
1718
1721
  "core/lib/bf-cache-strings.js | appBanner": {
1719
1722
  "message": "Pages that requested an AppBanner are not currently eligible for back/forward cache."
1720
1723
  },
@@ -1715,6 +1715,9 @@
1715
1715
  "core/gather/driver/storage.js | warningOriginDataTimeout": {
1716
1716
  "message": "Ĉĺêár̂ín̂ǵ t̂h́ê ór̂íĝín̂ d́ât́â t́îḿêd́ ôút̂. T́r̂ý âúd̂ít̂ín̂ǵ t̂h́îś p̂áĝé âǵâín̂ án̂d́ f̂íl̂é â b́ûǵ îf́ t̂h́ê íŝśûé p̂ér̂śîśt̂ś."
1717
1717
  },
1718
+ "core/gather/gatherers/link-elements.js | headerParseWarning": {
1719
+ "message": "Êŕr̂ór̂ ṕâŕŝín̂ǵ `link` ĥéâd́êŕ ({error}): `{header}`"
1720
+ },
1718
1721
  "core/lib/bf-cache-strings.js | appBanner": {
1719
1722
  "message": "P̂áĝéŝ t́ĥát̂ ŕêq́ûéŝt́êd́ âń Âṕp̂B́âńn̂ér̂ ár̂é n̂ót̂ ćûŕr̂én̂t́l̂ý êĺîǵîb́l̂é f̂ór̂ b́âćk̂/f́ôŕŵár̂d́ ĉáĉh́ê."
1720
1723
  },
@@ -34,6 +34,7 @@ describe('issueAdded types', () => {
34
34
  Array [
35
35
  "attributionReportingIssueDetails",
36
36
  "blockedByResponseIssueDetails",
37
+ "bounceTrackingIssueDetails",
37
38
  "clientHintIssueDetails",
38
39
  "contentSecurityPolicyIssueDetails",
39
40
  "cookieIssueDetails",
@@ -57,7 +57,6 @@ Array [
57
57
  "no-icon-available",
58
58
  "no-id-specified",
59
59
  "no-manifest",
60
- "no-matching-service-worker",
61
60
  "no-url-for-service-worker",
62
61
  "not-from-secure-origin",
63
62
  "not-offline-capable",
@@ -65,7 +64,6 @@ Array [
65
64
  "platform-not-supported-on-android",
66
65
  "prefer-related-applications",
67
66
  "prefer-related-applications-only-beta-stable",
68
- "scheme-not-supported-for-webapk",
69
67
  "start-url-not-valid",
70
68
  "url-not-supported-for-webapk",
71
69
  "warn-not-offline-capable",
@@ -308,6 +308,8 @@ declare module Artifacts {
308
308
  /** Where the link was found, either in the DOM or in the headers of the main document */
309
309
  source: 'head'|'body'|'headers'
310
310
  node: NodeDetails | null
311
+ /** The fetch priority hint for preload links. */
312
+ fetchPriority?: string;
311
313
  }
312
314
 
313
315
  interface Script extends Omit<Crdp.Debugger.ScriptParsedEvent, 'url'|'embedderName'> {
@@ -534,6 +536,8 @@ declare module Artifacts {
534
536
  node: NodeDetails;
535
537
  /** The loading attribute of the image. */
536
538
  loading?: string;
539
+ /** The fetch priority hint for HTMLImageElements. */
540
+ fetchPriority?: string;
537
541
  }
538
542
 
539
543
  interface OptimizedImage {
@@ -599,6 +603,7 @@ declare module Artifacts {
599
603
  interface InspectorIssues {
600
604
  attributionReportingIssue: Crdp.Audits.AttributionReportingIssueDetails[];
601
605
  blockedByResponseIssue: Crdp.Audits.BlockedByResponseIssueDetails[];
606
+ bounceTrackingIssue: Crdp.Audits.BounceTrackingIssueDetails[];
602
607
  clientHintIssue: Crdp.Audits.ClientHintIssueDetails[];
603
608
  contentSecurityPolicyIssue: Crdp.Audits.ContentSecurityPolicyIssueDetails[];
604
609
  corsIssue: Crdp.Audits.CorsIssueDetails[];
@@ -35,9 +35,22 @@ declare global {
35
35
 
36
36
  /** Injected into the page when the `--debug` flag is used. */
37
37
  continueLighthouseRun(): void;
38
+ }
38
39
 
39
- // Not defined in tsc yet: https://github.com/microsoft/TypeScript/issues/40807
40
- requestIdleCallback(callback: (deadline: {didTimeout: boolean, timeRemaining: () => DOMHighResTimeStamp}) => void, options?: {timeout: number}): number;
40
+ // `fetchPriority` not defined in tsc as of 4.9.4.
41
+ interface HTMLImageElement {
42
+ /**
43
+ * Sets the priority for fetches initiated by the element.
44
+ * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-fetchpriority
45
+ */
46
+ fetchPriority: string;
47
+ }
48
+ interface HTMLLinkElement {
49
+ /**
50
+ * Sets the priority for fetches initiated by the element.
51
+ * @see https://html.spec.whatwg.org/multipage/semantics.html#dom-link-fetchpriority
52
+ */
53
+ fetchPriority: string;
41
54
  }
42
55
  }
43
56