lighthouse 8.5.1 → 8.6.0-dev.20211013

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 (172) hide show
  1. package/changelog.md +5490 -0
  2. package/flow-report/.eslintrc.cjs +49 -0
  3. package/flow-report/assets/styles.css +272 -9
  4. package/flow-report/jest.config.js +1 -1
  5. package/flow-report/package.json +4 -0
  6. package/flow-report/src/app.tsx +31 -9
  7. package/flow-report/src/common.tsx +86 -7
  8. package/flow-report/src/header.tsx +88 -0
  9. package/flow-report/src/help-dialog.tsx +120 -0
  10. package/flow-report/src/i18n/i18n.tsx +44 -0
  11. package/flow-report/src/i18n/localized-strings.js +11 -0
  12. package/flow-report/src/i18n/ui-strings.js +86 -0
  13. package/flow-report/src/icons.tsx +20 -3
  14. package/flow-report/src/sidebar/sidebar.tsx +11 -16
  15. package/flow-report/src/summary/category.tsx +42 -24
  16. package/flow-report/src/summary/summary.tsx +32 -29
  17. package/flow-report/src/topbar.tsx +54 -4
  18. package/flow-report/src/util.ts +26 -1
  19. package/flow-report/src/wrappers/report-renderer.tsx +1 -1
  20. package/flow-report/src/wrappers/report.tsx +6 -21
  21. package/flow-report/test/app-test.tsx +17 -13
  22. package/flow-report/test/common-test.tsx +89 -0
  23. package/flow-report/test/header-test.tsx +55 -0
  24. package/flow-report/test/sample-flow.ts +17 -0
  25. package/flow-report/test/setup/env-setup.ts +1 -0
  26. package/flow-report/test/sidebar/flow-test.tsx +6 -12
  27. package/flow-report/test/sidebar/sidebar-test.tsx +7 -13
  28. package/flow-report/test/summary/category-test.tsx +79 -34
  29. package/flow-report/test/summary/summary-test.tsx +11 -17
  30. package/flow-report/test/topbar-test.tsx +68 -0
  31. package/flow-report/test/util-test.tsx +1 -12
  32. package/flow-report/tsconfig.json +1 -0
  33. package/flow-report/types/flow-report.d.ts +2 -1
  34. package/jest.config.js +1 -15
  35. package/lighthouse-cli/bin.js +5 -0
  36. package/lighthouse-cli/cli-flags.js +10 -3
  37. package/lighthouse-cli/commands/commands.js +1 -0
  38. package/lighthouse-cli/commands/list-locales.js +16 -0
  39. package/lighthouse-cli/run.js +2 -2
  40. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
  41. package/lighthouse-cli/test/smokehouse/report-assert.js +20 -4
  42. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -1
  43. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
  44. package/lighthouse-core/audits/seo/crawlable-anchors.js +10 -12
  45. package/lighthouse-core/computed/js-bundles.js +1 -2
  46. package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
  47. package/lighthouse-core/config/config.js +2 -2
  48. package/lighthouse-core/config/default-config.js +5 -0
  49. package/lighthouse-core/fraggle-rock/api.js +10 -0
  50. package/lighthouse-core/fraggle-rock/config/filters.js +22 -3
  51. package/lighthouse-core/fraggle-rock/gather/driver.js +4 -0
  52. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
  53. package/lighthouse-core/fraggle-rock/user-flow.js +35 -6
  54. package/lighthouse-core/gather/driver/navigation.js +5 -0
  55. package/lighthouse-core/gather/driver/prepare.js +14 -0
  56. package/lighthouse-core/gather/driver/storage.js +5 -0
  57. package/lighthouse-core/gather/gather-runner.js +2 -2
  58. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +5 -1
  59. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +30 -24
  60. package/lighthouse-core/lib/cdt/Platform.js +55 -0
  61. package/lighthouse-core/lib/cdt/SDK.js +3 -123
  62. package/lighthouse-core/lib/cdt/generated/SourceMap.js +148 -312
  63. package/lighthouse-core/lib/csp-evaluator.js +2 -1
  64. package/lighthouse-core/lib/i18n/README.md +6 -6
  65. package/lighthouse-core/lib/i18n/i18n.js +9 -342
  66. package/lighthouse-core/lib/page-functions.js +4 -4
  67. package/lighthouse-core/lib/stack-packs.js +1 -13
  68. package/lighthouse-core/runner.js +6 -6
  69. package/lighthouse-core/scripts/manual-chrome-launcher.js +4 -1
  70. package/lighthouse-core/scripts/package.json +4 -0
  71. package/lighthouse-core/util-commonjs.js +20 -4
  72. package/package.json +19 -16
  73. package/readme.md +1 -1
  74. package/report/assets/standalone-template.html +0 -1
  75. package/report/assets/styles.css +16 -41
  76. package/report/assets/templates.html +42 -4
  77. package/report/clients/psi.js +1 -0
  78. package/report/clients/standalone.js +1 -2
  79. package/report/generator/file-namer.js +17 -8
  80. package/report/generator/report-generator.js +0 -1
  81. package/report/renderer/category-renderer.js +4 -16
  82. package/report/renderer/components.js +107 -71
  83. package/report/renderer/dom.js +19 -0
  84. package/report/renderer/logger.js +35 -2
  85. package/report/renderer/performance-category-renderer.js +23 -21
  86. package/report/renderer/pwa-category-renderer.js +1 -2
  87. package/report/renderer/report-renderer.js +21 -0
  88. package/report/renderer/report-ui-features.js +7 -19
  89. package/report/renderer/swap-locale-feature.js +82 -0
  90. package/report/renderer/util.js +20 -4
  91. package/report/test/clients/psi-test.js +0 -4
  92. package/report/test/generator/file-namer-test.js +2 -2
  93. package/report/test/renderer/category-renderer-test.js +1 -1
  94. package/report/test/renderer/performance-category-renderer-test.js +12 -0
  95. package/report/test/renderer/report-renderer-axe-test.js +86 -0
  96. package/report/test/renderer/report-renderer-test.js +0 -55
  97. package/report/test/renderer/util-test.js +68 -8
  98. package/report/test-assets/faux-psi-template.html +0 -1
  99. package/report/tsconfig.json +2 -1
  100. package/report/types/html-renderer.d.ts +2 -1
  101. package/root.js +18 -0
  102. package/shared/localization/format.js +422 -0
  103. package/{lighthouse-core/lib/cdt/Common.js → shared/localization/i18n-module.js} +3 -8
  104. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar-XB.json +139 -4
  105. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar.json +141 -6
  106. package/{lighthouse-core/lib/i18n → shared/localization}/locales/bg.json +139 -4
  107. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ca.json +140 -5
  108. package/{lighthouse-core/lib/i18n → shared/localization}/locales/cs.json +139 -4
  109. package/{lighthouse-core/lib/i18n → shared/localization}/locales/da.json +139 -4
  110. package/{lighthouse-core/lib/i18n → shared/localization}/locales/de.json +139 -4
  111. package/{lighthouse-core/lib/i18n → shared/localization}/locales/el.json +141 -6
  112. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-GB.json +139 -4
  113. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-US.json +111 -0
  114. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XA.json +139 -4
  115. package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XL.json +111 -0
  116. package/{lighthouse-core/lib/i18n → shared/localization}/locales/es-419.json +139 -4
  117. package/{lighthouse-core/lib/i18n → shared/localization}/locales/es.json +139 -4
  118. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fi.json +139 -4
  119. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fil.json +139 -4
  120. package/{lighthouse-core/lib/i18n → shared/localization}/locales/fr.json +139 -4
  121. package/{lighthouse-core/lib/i18n → shared/localization}/locales/he.json +139 -4
  122. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hi.json +142 -7
  123. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hr.json +139 -4
  124. package/{lighthouse-core/lib/i18n → shared/localization}/locales/hu.json +139 -4
  125. package/{lighthouse-core/lib/i18n → shared/localization}/locales/id.json +139 -4
  126. package/{lighthouse-core/lib/i18n → shared/localization}/locales/it.json +139 -4
  127. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ja.json +139 -4
  128. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ko.json +139 -4
  129. package/{lighthouse-core/lib/i18n → shared/localization}/locales/lt.json +139 -4
  130. package/{lighthouse-core/lib/i18n → shared/localization}/locales/lv.json +139 -4
  131. package/{lighthouse-core/lib/i18n → shared/localization}/locales/nl.json +139 -4
  132. package/{lighthouse-core/lib/i18n → shared/localization}/locales/no.json +139 -4
  133. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pl.json +139 -4
  134. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt-PT.json +139 -4
  135. package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt.json +139 -4
  136. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ro.json +139 -4
  137. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ru.json +139 -4
  138. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sk.json +139 -4
  139. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sl.json +139 -4
  140. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr-Latn.json +139 -4
  141. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr.json +139 -4
  142. package/{lighthouse-core/lib/i18n → shared/localization}/locales/sv.json +139 -4
  143. package/{lighthouse-core/lib/i18n → shared/localization}/locales/ta.json +146 -11
  144. package/{lighthouse-core/lib/i18n → shared/localization}/locales/te.json +179 -44
  145. package/{lighthouse-core/lib/i18n → shared/localization}/locales/th.json +139 -4
  146. package/{lighthouse-core/lib/i18n → shared/localization}/locales/tr.json +139 -4
  147. package/{lighthouse-core/lib/i18n → shared/localization}/locales/uk.json +139 -4
  148. package/{lighthouse-core/lib/i18n → shared/localization}/locales/vi.json +139 -4
  149. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-HK.json +139 -4
  150. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-TW.json +139 -4
  151. package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh.json +139 -4
  152. package/{lighthouse-core/lib/i18n → shared/localization}/locales.js +2 -1
  153. package/shared/localization/swap-flow-locale.js +20 -0
  154. package/{lighthouse-core/lib/i18n → shared/localization}/swap-locale.js +9 -7
  155. package/shared/test/localization/format-test.js +377 -0
  156. package/shared/test/localization/locales-test.js +47 -0
  157. package/shared/test/localization/swap-locale-test.js +140 -0
  158. package/shared/tsconfig.json +22 -0
  159. package/{lighthouse-core/lib → shared}/type-verifiers.js +0 -0
  160. package/shared/types/shared.d.ts +24 -0
  161. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +5 -3
  162. package/third-party/chromium-synchronization/installability-errors-test.js +2 -1
  163. package/tsconfig-all.json +1 -0
  164. package/tsconfig-base.json +1 -1
  165. package/tsconfig.json +2 -3
  166. package/types/config.d.ts +1 -0
  167. package/types/es-main.d.ts +18 -0
  168. package/types/externs.d.ts +2 -0
  169. package/types/lhr/flow.d.ts +7 -0
  170. package/types/lhr/i18n.d.ts +0 -3
  171. package/dist/report/flow.js +0 -149
  172. package/dist/report/standalone.js +0 -228
@@ -0,0 +1,422 @@
1
+ /**
2
+ * @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
+ */
6
+ 'use strict';
7
+
8
+ const fs = require('fs');
9
+
10
+ const MessageFormat = require('intl-messageformat').default;
11
+ const {isObjectOfUnknownValues, isObjectOrArrayOfUnknownValues} = require('../type-verifiers.js');
12
+
13
+ /** Contains available locales with messages. May be an empty object if bundled. */
14
+ const LOCALE_MESSAGES = require('./locales.js');
15
+
16
+ /**
17
+ * The locale tags for the localized messages available to Lighthouse on disk.
18
+ * When bundled, these will be inlined by brfs.
19
+ * These locales are considered the "canonical" locales. We support other locales which
20
+ * are simply aliases to one of these. ex: es-AR (alias) -> es-419 (canonical)
21
+ */
22
+ let CANONICAL_LOCALES = ['__availableLocales__'];
23
+ // TODO: need brfs in gh-pages-app. For now, above is replaced, see build-i18n.module.js
24
+ if (fs.readdirSync) {
25
+ CANONICAL_LOCALES = fs.readdirSync(__dirname + '/locales/')
26
+ .filter(basename => basename.endsWith('.json') && !basename.endsWith('.ctc.json'))
27
+ .map(locale => locale.replace('.json', ''))
28
+ .sort();
29
+ }
30
+
31
+ /** @typedef {import('intl-messageformat-parser').Element} MessageElement */
32
+ /** @typedef {import('intl-messageformat-parser').ArgumentElement} ArgumentElement */
33
+
34
+ const MESSAGE_I18N_ID_REGEX = / | [^\s]+$/;
35
+
36
+ const formats = {
37
+ number: {
38
+ bytes: {
39
+ maximumFractionDigits: 0,
40
+ },
41
+ milliseconds: {
42
+ maximumFractionDigits: 0,
43
+ },
44
+ seconds: {
45
+ // Force the seconds to the tenths place for limited output and ease of scanning
46
+ minimumFractionDigits: 1,
47
+ maximumFractionDigits: 1,
48
+ },
49
+ extendedPercent: {
50
+ // Force allow up to two digits after decimal place in percentages. (Intl.NumberFormat options)
51
+ maximumFractionDigits: 2,
52
+ style: 'percent',
53
+ },
54
+ },
55
+ };
56
+
57
+ /**
58
+ * Function to retrieve all 'argumentElement's from an ICU message. An argumentElement
59
+ * is an ICU element with an argument in it, like '{varName}' or '{varName, number, bytes}'. This
60
+ * differs from 'messageElement's which are just arbitrary text in a message.
61
+ *
62
+ * Notes:
63
+ * This function will recursively inspect plural elements for nested argumentElements.
64
+ *
65
+ * We need to find all the elements from the plural format sections, but
66
+ * they need to be deduplicated. I.e. "=1{hello {icu}} =other{hello {icu}}"
67
+ * the variable "icu" would appear twice if it wasn't de duplicated. And they cannot
68
+ * be stored in a set because they are not equal since their locations are different,
69
+ * thus they are stored via a Map keyed on the "id" which is the ICU varName.
70
+ *
71
+ * @param {Array<MessageElement>} icuElements
72
+ * @param {Map<string, ArgumentElement>} [seenElementsById]
73
+ * @return {Map<string, ArgumentElement>}
74
+ */
75
+ function collectAllCustomElementsFromICU(icuElements, seenElementsById = new Map()) {
76
+ for (const el of icuElements) {
77
+ // We are only interested in elements that need ICU formatting (argumentElements)
78
+ if (el.type !== 'argumentElement') continue;
79
+
80
+ seenElementsById.set(el.id, el);
81
+
82
+ // Plurals need to be inspected recursively
83
+ if (!el.format || el.format.type !== 'pluralFormat') continue;
84
+ // Look at all options of the plural (=1{} =other{}...)
85
+ for (const option of el.format.options) {
86
+ // Run collections on each option's elements
87
+ collectAllCustomElementsFromICU(option.value.elements, seenElementsById);
88
+ }
89
+ }
90
+
91
+ return seenElementsById;
92
+ }
93
+
94
+ /**
95
+ * Returns a copy of the `values` object, with the values formatted based on how
96
+ * they will be used in their icuMessage, e.g. KB or milliseconds. The original
97
+ * object is unchanged.
98
+ * @param {MessageFormat} messageFormatter
99
+ * @param {Readonly<Record<string, string | number>>} values
100
+ * @param {string} lhlMessage Used for clear error logging.
101
+ * @return {Record<string, string | number>}
102
+ */
103
+ function _preformatValues(messageFormatter, values, lhlMessage) {
104
+ const elementMap = collectAllCustomElementsFromICU(messageFormatter.getAst().elements);
105
+ const argumentElements = [...elementMap.values()];
106
+
107
+ /** @type {Record<string, string | number>} */
108
+ const formattedValues = {};
109
+
110
+ for (const {id, format} of argumentElements) {
111
+ // Throw an error if a message's value isn't provided
112
+ if (id && (id in values) === false) {
113
+ throw new Error(`ICU Message "${lhlMessage}" contains a value reference ("${id}") ` +
114
+ `that wasn't provided`);
115
+ }
116
+
117
+ const value = values[id];
118
+
119
+ // Direct `{id}` replacement and non-numeric values need no formatting.
120
+ if (!format || format.type !== 'numberFormat') {
121
+ formattedValues[id] = value;
122
+ continue;
123
+ }
124
+
125
+ if (typeof value !== 'number') {
126
+ throw new Error(`ICU Message "${lhlMessage}" contains a numeric reference ("${id}") ` +
127
+ 'but provided value was not a number');
128
+ }
129
+
130
+ // Format values for known styles.
131
+ if (format.style === 'milliseconds') {
132
+ // Round all milliseconds to the nearest 10.
133
+ formattedValues[id] = Math.round(value / 10) * 10;
134
+ } else if (format.style === 'seconds' && id === 'timeInMs') {
135
+ // Convert all seconds to the correct unit (currently only for `timeInMs`).
136
+ formattedValues[id] = Math.round(value / 100) / 10;
137
+ } else if (format.style === 'bytes') {
138
+ // Replace all the bytes with KB.
139
+ formattedValues[id] = value / 1024;
140
+ } else {
141
+ // For all other number styles, the value isn't changed.
142
+ formattedValues[id] = value;
143
+ }
144
+ }
145
+
146
+ // Throw an error if a value is provided but has no placeholder in the message.
147
+ for (const valueId of Object.keys(values)) {
148
+ if (valueId in formattedValues) continue;
149
+
150
+ // errorCode is a special case always allowed to help LHError ease-of-use.
151
+ if (valueId === 'errorCode') {
152
+ formattedValues.errorCode = values.errorCode;
153
+ continue;
154
+ }
155
+
156
+ throw new Error(`Provided value "${valueId}" does not match any placeholder in ` +
157
+ `ICU message "${lhlMessage}"`);
158
+ }
159
+
160
+ return formattedValues;
161
+ }
162
+
163
+ /**
164
+ * Format string `message` by localizing `values` and inserting them. `message`
165
+ * is assumed to already be in the given locale.
166
+ * If you need to localize a messagem `getFormatted` is probably what you want.
167
+ * @param {string} message
168
+ * @param {Record<string, string | number>} values
169
+ * @param {LH.Locale} locale
170
+ * @return {string}
171
+ */
172
+ function _formatMessage(message, values = {}, locale) {
173
+ // When using accented english, force the use of a different locale for number formatting.
174
+ const localeForMessageFormat = (locale === 'en-XA' || locale === 'en-XL') ? 'de-DE' : locale;
175
+
176
+ const formatter = new MessageFormat(message, localeForMessageFormat, formats);
177
+
178
+ // Preformat values for the message format like KB and milliseconds.
179
+ const valuesForMessageFormat = _preformatValues(formatter, values, message);
180
+
181
+ return formatter.format(valuesForMessageFormat);
182
+ }
183
+
184
+ /**
185
+ * Retrieves the localized version of `icuMessage` and formats with any given
186
+ * value replacements.
187
+ * @param {LH.IcuMessage} icuMessage
188
+ * @param {LH.Locale} locale
189
+ * @return {string}
190
+ */
191
+ function _localizeIcuMessage(icuMessage, locale) {
192
+ const localeMessages = LOCALE_MESSAGES[locale];
193
+ if (!localeMessages) throw new Error(`Unsupported locale '${locale}'`);
194
+ const localeMessage = localeMessages[icuMessage.i18nId];
195
+
196
+ // Fall back to the default (usually the original english message) if we couldn't find a
197
+ // message in the specified locale. This could be because of string drift between
198
+ // Lighthouse versions or because new strings haven't been updated yet. Better to have
199
+ // an english message than no message at all; in some cases it won't even matter.
200
+ if (!localeMessage) {
201
+ return icuMessage.formattedDefault;
202
+ }
203
+
204
+ return _formatMessage(localeMessage.message, icuMessage.values, locale);
205
+ }
206
+
207
+ /**
208
+ * @param {LH.Locale} locale
209
+ * @return {Record<string, string>}
210
+ */
211
+ function getRendererFormattedStrings(locale) {
212
+ const localeMessages = LOCALE_MESSAGES[locale];
213
+ if (!localeMessages) throw new Error(`Unsupported locale '${locale}'`);
214
+
215
+ const icuMessageIds = Object.keys(localeMessages).filter(f => f.startsWith('report/'));
216
+ /** @type {Record<string, string>} */
217
+ const strings = {};
218
+ for (const icuMessageId of icuMessageIds) {
219
+ const {filename, key} = getIcuMessageIdParts(icuMessageId);
220
+ if (!filename.endsWith('util.js')) throw new Error(`Unexpected message: ${icuMessageId}`);
221
+
222
+ strings[key] = localeMessages[icuMessageId].message;
223
+ }
224
+
225
+ return strings;
226
+ }
227
+
228
+ /**
229
+ * Returns whether `icuMessageOrNot`` is an `LH.IcuMessage` instance.
230
+ * @param {unknown} icuMessageOrNot
231
+ * @return {icuMessageOrNot is LH.IcuMessage}
232
+ */
233
+ function isIcuMessage(icuMessageOrNot) {
234
+ if (!isObjectOfUnknownValues(icuMessageOrNot)) {
235
+ return false;
236
+ }
237
+
238
+ const {i18nId, values, formattedDefault} = icuMessageOrNot;
239
+ if (typeof i18nId !== 'string') {
240
+ return false;
241
+ }
242
+
243
+ // formattedDefault is required.
244
+ if (typeof formattedDefault !== 'string') {
245
+ return false;
246
+ }
247
+
248
+ // Values is optional.
249
+ if (values !== undefined) {
250
+ if (!isObjectOfUnknownValues(values)) {
251
+ return false;
252
+ }
253
+ for (const value of Object.values(values)) {
254
+ if (typeof value !== 'string' && typeof value !== 'number') {
255
+ return false;
256
+ }
257
+ }
258
+ }
259
+
260
+ // Finally return true if i18nId seems correct.
261
+ return MESSAGE_I18N_ID_REGEX.test(i18nId);
262
+ }
263
+
264
+ /**
265
+ * Get the localized and formatted form of `icuMessageOrRawString` if it's an
266
+ * LH.IcuMessage, or get it back directly if it's already a string.
267
+ * Warning: this function throws if `icuMessageOrRawString` is not the expected
268
+ * type (use function from `createIcuMessageFn` to create a valid LH.IcuMessage)
269
+ * or `locale` isn't supported (use `lookupLocale` to find a valid locale).
270
+ * @param {LH.IcuMessage | string} icuMessageOrRawString
271
+ * @param {LH.Locale} locale
272
+ * @return {string}
273
+ */
274
+ function getFormatted(icuMessageOrRawString, locale) {
275
+ if (isIcuMessage(icuMessageOrRawString)) {
276
+ return _localizeIcuMessage(icuMessageOrRawString, locale);
277
+ }
278
+
279
+ if (typeof icuMessageOrRawString === 'string') {
280
+ return icuMessageOrRawString;
281
+ }
282
+
283
+ // Should be impossible from types, but do a strict check in case malformed JSON makes it this far.
284
+ throw new Error('Attempted to format invalid icuMessage type');
285
+ }
286
+
287
+ /** @param {string[]} pathInLHR */
288
+ function _formatPathAsString(pathInLHR) {
289
+ let pathAsString = '';
290
+ for (const property of pathInLHR) {
291
+ if (/^[a-z]+$/i.test(property)) {
292
+ if (pathAsString.length) pathAsString += '.';
293
+ pathAsString += property;
294
+ } else {
295
+ if (/]|"|'|\s/.test(property)) throw new Error(`Cannot handle "${property}" in i18n`);
296
+ pathAsString += `[${property}]`;
297
+ }
298
+ }
299
+
300
+ return pathAsString;
301
+ }
302
+
303
+ /**
304
+ * Recursively walk the input object, looking for property values that are
305
+ * `LH.IcuMessage`s and replace them with their localized values. Primarily
306
+ * used with the full LHR or a Config as input.
307
+ * Returns a map of locations that were replaced to the `IcuMessage` that was at
308
+ * that location.
309
+ * @param {unknown} inputObject
310
+ * @param {LH.Locale} locale
311
+ * @return {LH.Result.IcuMessagePaths}
312
+ */
313
+ function replaceIcuMessages(inputObject, locale) {
314
+ /**
315
+ * @param {unknown} subObject
316
+ * @param {LH.Result.IcuMessagePaths} icuMessagePaths
317
+ * @param {string[]} pathInLHR
318
+ */
319
+ function replaceInObject(subObject, icuMessagePaths, pathInLHR = []) {
320
+ if (!isObjectOrArrayOfUnknownValues(subObject)) return;
321
+
322
+ for (const [property, possibleIcuMessage] of Object.entries(subObject)) {
323
+ const currentPathInLHR = pathInLHR.concat([property]);
324
+
325
+ // Replace any IcuMessages with a localized string.
326
+ if (isIcuMessage(possibleIcuMessage)) {
327
+ const formattedString = getFormatted(possibleIcuMessage, locale);
328
+ const messageInstancesInLHR = icuMessagePaths[possibleIcuMessage.i18nId] || [];
329
+ const currentPathAsString = _formatPathAsString(currentPathInLHR);
330
+
331
+ messageInstancesInLHR.push(
332
+ possibleIcuMessage.values ?
333
+ {values: possibleIcuMessage.values, path: currentPathAsString} :
334
+ currentPathAsString
335
+ );
336
+
337
+ // @ts-ignore - tsc doesn't like that `property` can be either string key or array index.
338
+ subObject[property] = formattedString;
339
+ icuMessagePaths[possibleIcuMessage.i18nId] = messageInstancesInLHR;
340
+ } else {
341
+ replaceInObject(possibleIcuMessage, icuMessagePaths, currentPathInLHR);
342
+ }
343
+ }
344
+ }
345
+
346
+ /** @type {LH.Result.IcuMessagePaths} */
347
+ const icuMessagePaths = {};
348
+ replaceInObject(inputObject, icuMessagePaths);
349
+ return icuMessagePaths;
350
+ }
351
+
352
+ /**
353
+ * Returns whether the `requestedLocale` can be used.
354
+ * @param {LH.Locale} requestedLocale
355
+ * @return {boolean}
356
+ */
357
+ function hasLocale(requestedLocale) {
358
+ const hasIntlSupport = Intl.NumberFormat.supportedLocalesOf([requestedLocale]).length > 0;
359
+ const hasMessages = Boolean(LOCALE_MESSAGES[requestedLocale]);
360
+
361
+ return hasIntlSupport && hasMessages;
362
+ }
363
+
364
+ /**
365
+ * Returns a list of canonical locales (each of which may have aliases, but those would
366
+ * only show in getAvailableLocales)
367
+ * TODO: create a CanonicalLocale type
368
+ * @return {Array<string>}
369
+ */
370
+ function getCanonicalLocales() {
371
+ return CANONICAL_LOCALES;
372
+ }
373
+
374
+ /**
375
+ * Returns a list of available locales.
376
+ * - if full build, this includes all canonical locales, aliases, and any locale added
377
+ * via `registerLocaleData`.
378
+ * - if bundled and locale messages have been stripped (locales.js shimmed), this includes no
379
+ * locales (perhaps available in a separate bundle), and perhaps any locales
380
+ * from `registerLocaleData`.
381
+ * @return {Array<LH.Locale>}
382
+ */
383
+ function getAvailableLocales() {
384
+ return /** @type {Array<LH.Locale>} */ (Object.keys(LOCALE_MESSAGES).sort());
385
+ }
386
+
387
+ /**
388
+ * Populate the i18n string lookup dict with locale data
389
+ * Used when the host environment selects the locale and serves lighthouse the intended locale file
390
+ * @see https://docs.google.com/document/d/1jnt3BqKB-4q3AE94UWFA0Gqspx8Sd_jivlB7gQMlmfk/edit
391
+ * @param {LH.Locale} locale
392
+ * @param {import('./locales').LhlMessages} lhlMessages
393
+ */
394
+ function registerLocaleData(locale, lhlMessages) {
395
+ LOCALE_MESSAGES[locale] = lhlMessages;
396
+ }
397
+
398
+ /**
399
+ * @param {string} i18nMessageId
400
+ */
401
+ function getIcuMessageIdParts(i18nMessageId) {
402
+ if (!MESSAGE_I18N_ID_REGEX.test(i18nMessageId)) {
403
+ throw Error(`"${i18nMessageId}" does not appear to be a valid ICU message id`);
404
+ }
405
+ const [filename, key] = i18nMessageId.split(' | ');
406
+ return {filename, key};
407
+ }
408
+
409
+ module.exports = {
410
+ _formatPathAsString,
411
+ collectAllCustomElementsFromICU,
412
+ isIcuMessage,
413
+ getFormatted,
414
+ getRendererFormattedStrings,
415
+ replaceIcuMessages,
416
+ hasLocale,
417
+ registerLocaleData,
418
+ _formatMessage,
419
+ getIcuMessageIdParts,
420
+ getAvailableLocales,
421
+ getCanonicalLocales,
422
+ };
@@ -1,14 +1,9 @@
1
1
  /**
2
- * @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
2
+ * @license Copyright 2021 Google Inc. All Rights Reserved.
3
3
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4
4
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
5
5
  */
6
6
  'use strict';
7
7
 
8
- /** @fileoverview Needed for the generated/SourceMap.js file */
9
-
10
- const Common = {
11
- console,
12
- };
13
-
14
- module.exports = Common;
8
+ module.exports.swapLocale = require('./swap-locale.js');
9
+ module.exports.format = require('./format.js');
@@ -1,4 +1,115 @@
1
1
  {
2
+ "flow-report/src/i18n/ui-strings.js | allReports": {
3
+ "message": "‏‮All‬‏ ‏‮Reports‬‏"
4
+ },
5
+ "flow-report/src/i18n/ui-strings.js | categories": {
6
+ "message": "‏‮Categories‬‏"
7
+ },
8
+ "flow-report/src/i18n/ui-strings.js | categoryAccessibility": {
9
+ "message": "‏‮Accessibility‬‏"
10
+ },
11
+ "flow-report/src/i18n/ui-strings.js | categoryBestPractices": {
12
+ "message": "‏‮Best‬‏ ‏‮Practices‬‏"
13
+ },
14
+ "flow-report/src/i18n/ui-strings.js | categoryPerformance": {
15
+ "message": "‏‮Performance‬‏"
16
+ },
17
+ "flow-report/src/i18n/ui-strings.js | categoryProgressiveWebApp": {
18
+ "message": "‏‮Progressive‬‏ ‏‮Web‬‏ ‏‮App‬‏"
19
+ },
20
+ "flow-report/src/i18n/ui-strings.js | categorySeo": {
21
+ "message": "‏‮SEO‬‏"
22
+ },
23
+ "flow-report/src/i18n/ui-strings.js | desktop": {
24
+ "message": "‏‮Desktop‬‏"
25
+ },
26
+ "flow-report/src/i18n/ui-strings.js | helpDialogTitle": {
27
+ "message": "‏‮Understanding‬‏ ‏‮the‬‏ ‏‮Lighthouse‬‏ ‏‮Flow‬‏ ‏‮Report‬‏"
28
+ },
29
+ "flow-report/src/i18n/ui-strings.js | helpLabel": {
30
+ "message": "‏‮Understanding‬‏ ‏‮Flows‬‏"
31
+ },
32
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionNavigation": {
33
+ "message": "‏‮Use‬‏ ‏‮Navigation‬‏ ‏‮reports‬‏ ‏‮to‬‏..."
34
+ },
35
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionSnapshot": {
36
+ "message": "‏‮Use‬‏ ‏‮Snapshot‬‏ ‏‮reports‬‏ ‏‮to‬‏..."
37
+ },
38
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseInstructionTimespan": {
39
+ "message": "‏‮Use‬‏ ‏‮Timespan‬‏ ‏‮reports‬‏ ‏‮to‬‏..."
40
+ },
41
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation1": {
42
+ "message": "‏‮Obtain‬‏ ‏‮a‬‏ ‏‮Lighthouse‬‏ ‏‮Performance‬‏ ‏‮score‬‏."
43
+ },
44
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation2": {
45
+ "message": "‏‮Measure‬‏ ‏‮page‬‏ ‏‮load‬‏ ‏‮Performance‬‏ ‏‮metrics‬‏ ‏‮such‬‏ ‏‮as‬‏ ‏‮Largest‬‏ ‏‮Contentful‬‏ ‏‮Paint‬‏ ‏‮and‬‏ ‏‮Speed‬‏ ‏‮Index‬‏."
46
+ },
47
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseNavigation3": {
48
+ "message": "‏‮Assess‬‏ ‏‮Progressive‬‏ ‏‮Web‬‏ ‏‮App‬‏ ‏‮capabilities‬‏."
49
+ },
50
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseSnapshot1": {
51
+ "message": "‏‮Find‬‏ ‏‮accessibility‬‏ ‏‮issues‬‏ ‏‮in‬‏ ‏‮single‬‏ ‏‮page‬‏ ‏‮applications‬‏ ‏‮or‬‏ ‏‮complex‬‏ ‏‮forms‬‏."
52
+ },
53
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseSnapshot2": {
54
+ "message": "‏‮Evaluate‬‏ ‏‮best‬‏ ‏‮practices‬‏ ‏‮of‬‏ ‏‮menus‬‏ ‏‮and‬‏ ‏‮UI‬‏ ‏‮elements‬‏ ‏‮hidden‬‏ ‏‮behind‬‏ ‏‮interaction‬‏."
55
+ },
56
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseTimespan1": {
57
+ "message": "‏‮Measure‬‏ ‏‮layout‬‏ ‏‮shifts‬‏ ‏‮and‬‏ ‏‮JavaScript‬‏ ‏‮execution‬‏ ‏‮time‬‏ ‏‮on‬‏ ‏‮a‬‏ ‏‮series‬‏ ‏‮of‬‏ ‏‮interactions‬‏."
58
+ },
59
+ "flow-report/src/i18n/ui-strings.js | helpUseCaseTimespan2": {
60
+ "message": "‏‮Discover‬‏ ‏‮performance‬‏ ‏‮opportunities‬‏ ‏‮to‬‏ ‏‮improve‬‏ ‏‮the‬‏ ‏‮experience‬‏ ‏‮for‬‏ ‏‮long‬‏-‏‮lived‬‏ ‏‮pages‬‏ ‏‮and‬‏ ‏‮single‬‏-‏‮page‬‏ ‏‮applications‬‏."
61
+ },
62
+ "flow-report/src/i18n/ui-strings.js | mobile": {
63
+ "message": "‏‮Mobile‬‏"
64
+ },
65
+ "flow-report/src/i18n/ui-strings.js | navigationDescription": {
66
+ "message": "‏‮Page‬‏ ‏‮load‬‏"
67
+ },
68
+ "flow-report/src/i18n/ui-strings.js | navigationLongDescription": {
69
+ "message": "‏‮Navigation‬‏ ‏‮reports‬‏ ‏‮analyze‬‏ ‏‮a‬‏ ‏‮single‬‏ ‏‮page‬‏ ‏‮load‬‏, ‏‮exactly‬‏ ‏‮like‬‏ ‏‮the‬‏ ‏‮original‬‏ ‏‮Lighthouse‬‏ ‏‮reports‬‏."
70
+ },
71
+ "flow-report/src/i18n/ui-strings.js | navigationReport": {
72
+ "message": "‏‮Navigation‬‏ ‏‮report‬‏"
73
+ },
74
+ "flow-report/src/i18n/ui-strings.js | ratingAverage": {
75
+ "message": "‏‮Average‬‏"
76
+ },
77
+ "flow-report/src/i18n/ui-strings.js | ratingError": {
78
+ "message": "‏‮Error‬‏"
79
+ },
80
+ "flow-report/src/i18n/ui-strings.js | ratingFail": {
81
+ "message": "‏‮Poor‬‏"
82
+ },
83
+ "flow-report/src/i18n/ui-strings.js | ratingPass": {
84
+ "message": "‏‮Good‬‏"
85
+ },
86
+ "flow-report/src/i18n/ui-strings.js | save": {
87
+ "message": "‏‮Save‬‏"
88
+ },
89
+ "flow-report/src/i18n/ui-strings.js | snapshotDescription": {
90
+ "message": "‏‮Captured‬‏ ‏‮state‬‏ ‏‮of‬‏ ‏‮page‬‏"
91
+ },
92
+ "flow-report/src/i18n/ui-strings.js | snapshotLongDescription": {
93
+ "message": "‏‮Snapshot‬‏ ‏‮reports‬‏ ‏‮analyze‬‏ ‏‮the‬‏ ‏‮page‬‏ ‏‮in‬‏ ‏‮a‬‏ ‏‮particular‬‏ ‏‮state‬‏, ‏‮typically‬‏ ‏‮after‬‏ ‏‮user‬‏ ‏‮interactions‬‏."
94
+ },
95
+ "flow-report/src/i18n/ui-strings.js | snapshotReport": {
96
+ "message": "‏‮Snapshot‬‏ ‏‮report‬‏"
97
+ },
98
+ "flow-report/src/i18n/ui-strings.js | summary": {
99
+ "message": "‏‮Summary‬‏"
100
+ },
101
+ "flow-report/src/i18n/ui-strings.js | timespanDescription": {
102
+ "message": "‏‮User‬‏ ‏‮interactions‬‏"
103
+ },
104
+ "flow-report/src/i18n/ui-strings.js | timespanLongDescription": {
105
+ "message": "‏‮Timespan‬‏ ‏‮reports‬‏ ‏‮analyze‬‏ ‏‮an‬‏ ‏‮arbitrary‬‏ ‏‮period‬‏ ‏‮of‬‏ ‏‮time‬‏, ‏‮typically‬‏ ‏‮containing‬‏ ‏‮user‬‏ ‏‮interactions‬‏."
106
+ },
107
+ "flow-report/src/i18n/ui-strings.js | timespanReport": {
108
+ "message": "‏‮Timespan‬‏ ‏‮report‬‏"
109
+ },
110
+ "flow-report/src/i18n/ui-strings.js | title": {
111
+ "message": "‏‮Lighthouse‬‏ ‏‮User‬‏ ‏‮Flow‬‏ ‏‮Report‬‏"
112
+ },
2
113
  "lighthouse-core/audits/accessibility/accesskeys.js | description": {
3
114
  "message": "‏‮Access‬‏ ‏‮keys‬‏ ‏‮let‬‏ ‏‮users‬‏ ‏‮quickly‬‏ ‏‮focus‬‏ ‏‮a‬‏ ‏‮part‬‏ ‏‮of‬‏ ‏‮the‬‏ ‏‮page‬‏. ‏‮For‬‏ ‏‮proper‬‏ ‏‮navigation‬‏, ‏‮each‬‏ ‏‮access‬‏ ‏‮key‬‏ ‏‮must‬‏ ‏‮be‬‏ ‏‮unique‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/accesskeys/)."
4
115
  },
@@ -554,6 +665,12 @@
554
665
  "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | columnDisplayedDimensions": {
555
666
  "message": "‏‮Displayed‬‏ ‏‮dimensions‬‏"
556
667
  },
668
+ "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | failureTitle": {
669
+ "message": "‏‮Images‬‏ ‏‮were‬‏ ‏‮larger‬‏ ‏‮than‬‏ ‏‮their‬‏ ‏‮displayed‬‏ ‏‮size‬‏"
670
+ },
671
+ "lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js | title": {
672
+ "message": "‏‮Images‬‏ ‏‮were‬‏ ‏‮appropriate‬‏ ‏‮for‬‏ ‏‮their‬‏ ‏‮displayed‬‏ ‏‮size‬‏"
673
+ },
557
674
  "lighthouse-core/audits/byte-efficiency/uses-responsive-images.js | description": {
558
675
  "message": "‏‮Serve‬‏ ‏‮images‬‏ ‏‮that‬‏ ‏‮are‬‏ ‏‮appropriately‬‏-‏‮sized‬‏ ‏‮to‬‏ ‏‮save‬‏ ‏‮cellular‬‏ ‏‮data‬‏ ‏‮and‬‏ ‏‮improve‬‏ ‏‮load‬‏ ‏‮time‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/uses-responsive-images/)."
559
676
  },
@@ -1007,6 +1124,15 @@
1007
1124
  "lighthouse-core/audits/layout-shift-elements.js | title": {
1008
1125
  "message": "‏‮Avoid‬‏ ‏‮large‬‏ ‏‮layout‬‏ ‏‮shifts‬‏"
1009
1126
  },
1127
+ "lighthouse-core/audits/lcp-lazy-loaded.js | description": {
1128
+ "message": "‏‮Above‬‏-‏‮the‬‏-‏‮fold‬‏ ‏‮images‬‏ ‏‮that‬‏ ‏‮are‬‏ ‏‮lazily‬‏ ‏‮loaded‬‏ ‏‮render‬‏ ‏‮later‬‏ ‏‮in‬‏ ‏‮the‬‏ ‏‮page‬‏ ‏‮lifecycle‬‏, ‏‮which‬‏ ‏‮can‬‏ ‏‮delay‬‏ ‏‮the‬‏ ‏‮largest‬‏ ‏‮contentful‬‏ ‏‮paint‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/lcp-lazy-loading/)."
1129
+ },
1130
+ "lighthouse-core/audits/lcp-lazy-loaded.js | failureTitle": {
1131
+ "message": "‏‮Largest‬‏ ‏‮Contentful‬‏ ‏‮Paint‬‏ ‏‮image‬‏ ‏‮was‬‏ ‏‮lazily‬‏ ‏‮loaded‬‏"
1132
+ },
1133
+ "lighthouse-core/audits/lcp-lazy-loaded.js | title": {
1134
+ "message": "‏‮Largest‬‏ ‏‮Contentful‬‏ ‏‮Paint‬‏ ‏‮image‬‏ ‏‮was‬‏ ‏‮not‬‏ ‏‮lazily‬‏ ‏‮loaded‬‏"
1135
+ },
1010
1136
  "lighthouse-core/audits/long-tasks.js | description": {
1011
1137
  "message": "‏‮Lists‬‏ ‏‮the‬‏ ‏‮longest‬‏ ‏‮tasks‬‏ ‏‮on‬‏ ‏‮the‬‏ ‏‮main‬‏ ‏‮thread‬‏, ‏‮useful‬‏ ‏‮for‬‏ ‏‮identifying‬‏ ‏‮worst‬‏ ‏‮contributors‬‏ ‏‮to‬‏ ‏‮input‬‏ ‏‮delay‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/long-tasks-devtools/)"
1012
1138
  },
@@ -1524,7 +1650,7 @@
1524
1650
  "message": "‏‮Page‬‏ ‏‮has‬‏ ‏‮valid‬‏ ‏‮source‬‏ ‏‮maps‬‏"
1525
1651
  },
1526
1652
  "lighthouse-core/audits/viewport.js | description": {
1527
- "message": "‏‮Add‬‏ ‏‮a‬‏ `<meta name=\"viewport\">` ‏‮tag‬‏ ‏‮to‬‏ ‏‮optimize‬‏ ‏‮your‬‏ ‏‮app‬‏ ‏‮for‬‏ ‏‮mobile‬‏ ‏‮screens‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/viewport/)."
1653
+ "message": "‏‮A‬‏ `<meta name=\"viewport\">` ‏‮not‬‏ ‏‮only‬‏ ‏‮optimizes‬‏ ‏‮your‬‏ ‏‮app‬‏ ‏‮for‬‏ ‏‮mobile‬‏ ‏‮screen‬‏ ‏‮sizes‬‏, ‏‮but‬‏ ‏‮also‬‏ ‏‮prevents‬‏ [‏‮a‬‏ 300 ‏‮millisecond‬‏ ‏‮delay‬‏ ‏‮to‬‏ ‏‮user‬‏ ‏‮input‬‏](https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away). [‏‮Learn‬‏ ‏‮more‬‏](https://web.dev/viewport/)."
1528
1654
  },
1529
1655
  "lighthouse-core/audits/viewport.js | explanationNoTag": {
1530
1656
  "message": "‏‮No‬‏ `<meta name=\"viewport\">` ‏‮tag‬‏ ‏‮found‬‏"
@@ -1659,7 +1785,7 @@
1659
1785
  "message": "‏‮PWA‬‏ ‏‮Optimized‬‏"
1660
1786
  },
1661
1787
  "lighthouse-core/config/default-config.js | seoCategoryDescription": {
1662
- "message": "‏‮These‬‏ ‏‮checks‬‏ ‏‮ensure‬‏ ‏‮that‬‏ ‏‮your‬‏ ‏‮page‬‏ ‏‮is‬‏ ‏‮optimized‬‏ ‏‮for‬‏ ‏‮search‬‏ ‏‮engine‬‏ ‏‮results‬‏ ‏‮ranking‬‏. ‏‮There‬‏ ‏‮are‬‏ ‏‮additional‬‏ ‏‮factors‬‏ ‏‮Lighthouse‬‏ ‏‮does‬‏ ‏‮not‬‏ ‏‮check‬‏ ‏‮that‬‏ ‏‮may‬‏ ‏‮affect‬‏ ‏‮your‬‏ ‏‮search‬‏ ‏‮ranking‬‏. [‏‮Learn‬‏ ‏‮more‬‏](https://support.google.com/webmasters/answer/35769)."
1788
+ "message": "‏‮These‬‏ ‏‮checks‬‏ ‏‮ensure‬‏ ‏‮that‬‏ ‏‮your‬‏ ‏‮page‬‏ ‏‮is‬‏ ‏‮following‬‏ ‏‮basic‬‏ ‏‮search‬‏ ‏‮engine‬‏ ‏‮optimization‬‏ ‏‮advice‬‏. ‏‮There‬‏ ‏‮are‬‏ ‏‮many‬‏ ‏‮additional‬‏ ‏‮factors‬‏ ‏‮Lighthouse‬‏ ‏‮does‬‏ ‏‮not‬‏ ‏‮score‬‏ ‏‮here‬‏ ‏‮that‬‏ ‏‮may‬‏ ‏‮affect‬‏ ‏‮your‬‏ ‏‮search‬‏ ‏‮ranking‬‏, ‏‮including‬‏ ‏‮performance‬‏ ‏‮on‬‏ [‏‮Core‬‏ ‏‮Web‬‏ ‏‮Vitals‬‏](https://web.dev/learn-web-vitals/). [‏‮Learn‬‏ ‏‮more‬‏](https://support.google.com/webmasters/answer/35769)."
1663
1789
  },
1664
1790
  "lighthouse-core/config/default-config.js | seoCategoryManualDescription": {
1665
1791
  "message": "‏‮Run‬‏ ‏‮these‬‏ ‏‮additional‬‏ ‏‮validators‬‏ ‏‮on‬‏ ‏‮your‬‏ ‏‮site‬‏ ‏‮to‬‏ ‏‮check‬‏ ‏‮additional‬‏ ‏‮SEO‬‏ ‏‮best‬‏ ‏‮practices‬‏."
@@ -1713,7 +1839,7 @@
1713
1839
  "message": "‏‮Missing‬‏ ‏‮base‬‏-‏‮uri‬‏ ‏‮allows‬‏ ‏‮injected‬‏ <base> ‏‮tags‬‏ ‏‮to‬‏ ‏‮set‬‏ ‏‮the‬‏ ‏‮base‬‏ ‏‮URL‬‏ ‏‮for‬‏ ‏‮all‬‏ ‏‮relative‬‏ ‏‮URLs‬‏ (‏‮e‬‏.‏‮g‬‏. ‏‮scripts‬‏) ‏‮to‬‏ ‏‮an‬‏ ‏‮attacker‬‏ ‏‮controlled‬‏ ‏‮domain‬‏. ‏‮Consider‬‏ ‏‮setting‬‏ ‏‮base‬‏-‏‮uri‬‏ ‏‮to‬‏ '‏‮none‬‏' ‏‮or‬‏ '‏‮self‬‏'."
1714
1840
  },
1715
1841
  "lighthouse-core/lib/csp-evaluator.js | missingObjectSrc": {
1716
- "message": "‏‮Elements‬‏ ‏‮controlled‬‏ ‏‮by‬‏ ‏‮object‬‏-‏‮src‬‏ ‏‮are‬‏ ‏‮considered‬‏ ‏‮legacy‬‏ ‏‮features‬‏. ‏‮Consider‬‏ ‏‮setting‬‏ ‏‮object‬‏-‏‮src‬‏ ‏‮to‬‏ '‏‮none‬‏' ‏‮to‬‏ ‏‮prevent‬‏ ‏‮the‬‏ ‏‮injection‬‏ ‏‮of‬‏ ‏‮plugins‬‏ ‏‮that‬‏ ‏‮execute‬‏ ‏‮unsafe‬‏ ‏‮scripts‬‏."
1842
+ "message": "‏‮Missing‬‏ ‏‮object‬‏-‏‮src‬‏ ‏‮allows‬‏ ‏‮the‬‏ ‏‮injection‬‏ ‏‮of‬‏ ‏‮plugins‬‏ ‏‮that‬‏ ‏‮execute‬‏ ‏‮unsafe‬‏ ‏‮scripts‬‏. ‏‮Consider‬‏ ‏‮setting‬‏ ‏‮object‬‏-‏‮src‬‏ ‏‮to‬‏ '‏‮none‬‏' ‏‮if‬‏ ‏‮you‬‏ ‏‮can‬‏."
1717
1843
  },
1718
1844
  "lighthouse-core/lib/csp-evaluator.js | missingScriptSrc": {
1719
1845
  "message": "‏‮script‬‏-‏‮src‬‏ ‏‮directive‬‏ ‏‮is‬‏ ‏‮missing‬‏. ‏‮This‬‏ ‏‮can‬‏ ‏‮allow‬‏ ‏‮the‬‏ ‏‮execution‬‏ ‏‮of‬‏ ‏‮unsafe‬‏ ‏‮scripts‬‏."
@@ -1727,6 +1853,12 @@
1727
1853
  "lighthouse-core/lib/csp-evaluator.js | nonceLength": {
1728
1854
  "message": "‏‮Nonces‬‏ ‏‮should‬‏ ‏‮be‬‏ ‏‮at‬‏ ‏‮least‬‏ 8 ‏‮characters‬‏ ‏‮long‬‏."
1729
1855
  },
1856
+ "lighthouse-core/lib/csp-evaluator.js | plainUrlScheme": {
1857
+ "message": "‏‮Avoid‬‏ ‏‮using‬‏ ‏‮plain‬‏ ‏‮URL‬‏ ‏‮schemes‬‏ ({keyword}) ‏‮in‬‏ ‏‮this‬‏ ‏‮directive‬‏. ‏‮Plain‬‏ ‏‮URL‬‏ ‏‮schemes‬‏ ‏‮allow‬‏ ‏‮scripts‬‏ ‏‮to‬‏ ‏‮be‬‏ ‏‮sourced‬‏ ‏‮from‬‏ ‏‮an‬‏ ‏‮unsafe‬‏ ‏‮domain‬‏."
1858
+ },
1859
+ "lighthouse-core/lib/csp-evaluator.js | plainWildcards": {
1860
+ "message": "‏‮Avoid‬‏ ‏‮using‬‏ ‏‮plain‬‏ ‏‮wildcards‬‏ ({keyword}) ‏‮in‬‏ ‏‮this‬‏ ‏‮directive‬‏. ‏‮Plain‬‏ ‏‮wildcards‬‏ ‏‮allow‬‏ ‏‮scripts‬‏ ‏‮to‬‏ ‏‮be‬‏ ‏‮sourced‬‏ ‏‮from‬‏ ‏‮an‬‏ ‏‮unsafe‬‏ ‏‮domain‬‏."
1861
+ },
1730
1862
  "lighthouse-core/lib/csp-evaluator.js | reportToOnly": {
1731
1863
  "message": "‏‮The‬‏ ‏‮reporting‬‏ ‏‮destination‬‏ ‏‮is‬‏ ‏‮only‬‏ ‏‮configured‬‏ ‏‮via‬‏ ‏‮the‬‏ ‏‮report‬‏-‏‮to‬‏ ‏‮directive‬‏. ‏‮This‬‏ ‏‮directive‬‏ ‏‮is‬‏ ‏‮only‬‏ ‏‮supported‬‏ ‏‮in‬‏ ‏‮Chromium‬‏-‏‮based‬‏ ‏‮browsers‬‏ ‏‮so‬‏ ‏‮it‬‏ ‏‮is‬‏ ‏‮recommended‬‏ ‏‮to‬‏ ‏‮also‬‏ ‏‮use‬‏ ‏‮a‬‏ ‏‮report‬‏-‏‮uri‬‏ ‏‮directive‬‏."
1732
1864
  },
@@ -1734,7 +1866,7 @@
1734
1866
  "message": "‏‮No‬‏ ‏‮CSP‬‏ ‏‮configures‬‏ ‏‮a‬‏ ‏‮reporting‬‏ ‏‮destination‬‏. ‏‮This‬‏ ‏‮makes‬‏ ‏‮it‬‏ ‏‮difficult‬‏ ‏‮to‬‏ ‏‮maintain‬‏ ‏‮the‬‏ ‏‮CSP‬‏ ‏‮over‬‏ ‏‮time‬‏ ‏‮and‬‏ ‏‮monitor‬‏ ‏‮for‬‏ ‏‮any‬‏ ‏‮breakages‬‏."
1735
1867
  },
1736
1868
  "lighthouse-core/lib/csp-evaluator.js | strictDynamic": {
1737
- "message": "‏‮Host‬‏ ‏‮allowlists‬‏ ‏‮can‬‏ ‏‮frequently‬‏ ‏‮be‬‏ ‏‮bypassed‬‏. ‏‮Consider‬‏ ‏‮using‬‏ '‏‮strict‬‏-‏‮dynamic‬‏' ‏‮in‬‏ ‏‮combination‬‏ ‏‮with‬‏ ‏‮CSP‬‏ ‏‮nonces‬‏ ‏‮or‬‏ ‏‮hashes‬‏."
1869
+ "message": "‏‮Host‬‏ ‏‮allowlists‬‏ ‏‮can‬‏ ‏‮frequently‬‏ ‏‮be‬‏ ‏‮bypassed‬‏. ‏‮Consider‬‏ ‏‮using‬‏ ‏‮CSP‬‏ ‏‮nonces‬‏ ‏‮or‬‏ ‏‮hashes‬‏ ‏‮instead‬‏, ‏‮along‬‏ ‏‮with‬‏ '‏‮strict‬‏-‏‮dynamic‬‏' ‏‮if‬‏ ‏‮necessary‬‏."
1738
1870
  },
1739
1871
  "lighthouse-core/lib/csp-evaluator.js | unknownDirective": {
1740
1872
  "message": "‏‮Unknown‬‏ ‏‮CSP‬‏ ‏‮directive‬‏."
@@ -1742,6 +1874,9 @@
1742
1874
  "lighthouse-core/lib/csp-evaluator.js | unknownKeyword": {
1743
1875
  "message": "{keyword} ‏‮seems‬‏ ‏‮to‬‏ ‏‮be‬‏ ‏‮an‬‏ ‏‮invalid‬‏ ‏‮keyword‬‏."
1744
1876
  },
1877
+ "lighthouse-core/lib/csp-evaluator.js | unsafeInline": {
1878
+ "message": "'‏‮unsafe‬‏-‏‮inline‬‏' ‏‮allows‬‏ ‏‮the‬‏ ‏‮execution‬‏ ‏‮of‬‏ ‏‮unsafe‬‏ ‏‮in‬‏-‏‮page‬‏ ‏‮scripts‬‏ ‏‮and‬‏ ‏‮event‬‏ ‏‮handlers‬‏. ‏‮Consider‬‏ ‏‮using‬‏ ‏‮CSP‬‏ ‏‮nonces‬‏ ‏‮or‬‏ ‏‮hashes‬‏ ‏‮to‬‏ ‏‮allow‬‏ ‏‮scripts‬‏ ‏‮individually‬‏."
1879
+ },
1745
1880
  "lighthouse-core/lib/csp-evaluator.js | unsafeInlineFallback": {
1746
1881
  "message": "‏‮Consider‬‏ ‏‮adding‬‏ '‏‮unsafe‬‏-‏‮inline‬‏' (‏‮ignored‬‏ ‏‮by‬‏ ‏‮browsers‬‏ ‏‮supporting‬‏ ‏‮nonces‬‏/‏‮hashes‬‏) ‏‮to‬‏ ‏‮be‬‏ ‏‮backward‬‏ ‏‮compatible‬‏ ‏‮with‬‏ ‏‮older‬‏ ‏‮browsers‬‏."
1747
1882
  },