lighthouse 10.1.0-dev.20230327 → 10.1.0-dev.20230329
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.
|
@@ -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
|
|
@@ -126,7 +139,21 @@ class LinkElements extends FRGatherer {
|
|
|
126
139
|
for (const header of mainDocument.responseHeaders) {
|
|
127
140
|
if (header.name.toLowerCase() !== 'link') continue;
|
|
128
141
|
|
|
129
|
-
|
|
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) {
|
|
130
157
|
linkElements.push({
|
|
131
158
|
rel: link.rel || '',
|
|
132
159
|
href: normalizeUrlOrNull(link.uri, context.baseArtifacts.URL.finalDisplayedUrl),
|
|
@@ -181,3 +208,4 @@ class LinkElements extends FRGatherer {
|
|
|
181
208
|
}
|
|
182
209
|
|
|
183
210
|
export default LinkElements;
|
|
211
|
+
export {UIStrings};
|
package/package.json
CHANGED
|
@@ -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
|
},
|