lighthouse 8.5.1 → 8.6.0-dev.20211016
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.
- package/changelog.md +5490 -0
- package/dist/report/flow.js +35 -12
- package/dist/report/standalone.js +20 -21
- package/flow-report/.eslintrc.cjs +49 -0
- package/flow-report/assets/styles.css +272 -9
- package/flow-report/jest.config.js +1 -1
- package/flow-report/package.json +4 -0
- package/flow-report/src/app.tsx +31 -9
- package/flow-report/src/common.tsx +86 -7
- package/flow-report/src/header.tsx +88 -0
- package/flow-report/src/help-dialog.tsx +120 -0
- package/flow-report/src/i18n/i18n.tsx +52 -0
- package/flow-report/src/i18n/localized-strings.js +11 -0
- package/flow-report/src/i18n/ui-strings.js +134 -0
- package/flow-report/src/icons.tsx +20 -3
- package/flow-report/src/sidebar/sidebar.tsx +11 -16
- package/flow-report/src/summary/category.tsx +39 -24
- package/flow-report/src/summary/summary.tsx +35 -32
- package/flow-report/src/topbar.tsx +54 -4
- package/flow-report/src/util.ts +26 -1
- package/flow-report/src/wrappers/report-renderer.tsx +1 -1
- package/flow-report/src/wrappers/report.tsx +6 -21
- package/flow-report/test/app-test.tsx +17 -13
- package/flow-report/test/common-test.tsx +89 -0
- package/flow-report/test/header-test.tsx +55 -0
- package/flow-report/test/sample-flow.ts +17 -0
- package/flow-report/test/setup/env-setup.ts +1 -0
- package/flow-report/test/sidebar/flow-test.tsx +6 -12
- package/flow-report/test/sidebar/sidebar-test.tsx +7 -13
- package/flow-report/test/summary/category-test.tsx +83 -34
- package/flow-report/test/summary/summary-test.tsx +12 -18
- package/flow-report/test/topbar-test.tsx +68 -0
- package/flow-report/test/util-test.tsx +1 -12
- package/flow-report/tsconfig.json +2 -0
- package/flow-report/types/flow-report.d.ts +2 -1
- package/jest.config.js +1 -15
- package/lighthouse-cli/bin.js +5 -0
- package/lighthouse-cli/cli-flags.js +10 -3
- package/lighthouse-cli/commands/commands.js +1 -0
- package/lighthouse-cli/commands/list-locales.js +16 -0
- package/lighthouse-cli/run.js +2 -2
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
- package/lighthouse-cli/test/smokehouse/report-assert.js +20 -4
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +2 -1
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
- package/lighthouse-core/audits/seo/crawlable-anchors.js +10 -12
- package/lighthouse-core/computed/js-bundles.js +1 -2
- package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
- package/lighthouse-core/config/config-helpers.js +1 -0
- package/lighthouse-core/config/config.js +2 -2
- package/lighthouse-core/config/default-config.js +5 -0
- package/lighthouse-core/fraggle-rock/api.js +10 -0
- package/lighthouse-core/fraggle-rock/config/filters.js +22 -3
- package/lighthouse-core/fraggle-rock/gather/driver.js +4 -0
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
- package/lighthouse-core/fraggle-rock/user-flow.js +35 -6
- package/lighthouse-core/gather/driver/navigation.js +5 -0
- package/lighthouse-core/gather/driver/prepare.js +14 -0
- package/lighthouse-core/gather/driver/storage.js +5 -0
- package/lighthouse-core/gather/gather-runner.js +2 -2
- package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +5 -1
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +30 -24
- package/lighthouse-core/lib/cdt/Platform.js +55 -0
- package/lighthouse-core/lib/cdt/SDK.js +3 -123
- package/lighthouse-core/lib/cdt/generated/SourceMap.js +148 -312
- package/lighthouse-core/lib/csp-evaluator.js +2 -1
- package/lighthouse-core/lib/i18n/README.md +6 -6
- package/lighthouse-core/lib/i18n/i18n.js +26 -348
- package/lighthouse-core/lib/page-functions.js +4 -4
- package/lighthouse-core/lib/stack-packs.js +1 -13
- package/lighthouse-core/runner.js +6 -6
- package/lighthouse-core/scripts/manual-chrome-launcher.js +4 -1
- package/lighthouse-core/scripts/package.json +4 -0
- package/lighthouse-core/util-commonjs.js +20 -4
- package/package.json +19 -16
- package/readme.md +1 -1
- package/report/assets/standalone-template.html +0 -1
- package/report/assets/styles.css +16 -41
- package/report/assets/templates.html +42 -4
- package/report/clients/psi.js +1 -0
- package/report/clients/standalone.js +1 -2
- package/report/generator/file-namer.js +17 -8
- package/report/generator/report-generator.js +0 -1
- package/report/renderer/category-renderer.js +4 -16
- package/report/renderer/components.js +107 -71
- package/report/renderer/dom.js +19 -0
- package/report/renderer/logger.js +35 -2
- package/report/renderer/performance-category-renderer.js +23 -21
- package/report/renderer/pwa-category-renderer.js +1 -2
- package/report/renderer/report-renderer.js +21 -0
- package/report/renderer/report-ui-features.js +7 -19
- package/report/renderer/swap-locale-feature.js +82 -0
- package/report/renderer/util.js +20 -4
- package/report/test/clients/psi-test.js +0 -4
- package/report/test/generator/file-namer-test.js +2 -2
- package/report/test/renderer/category-renderer-test.js +1 -1
- package/report/test/renderer/performance-category-renderer-test.js +12 -0
- package/report/test/renderer/report-renderer-axe-test.js +86 -0
- package/report/test/renderer/report-renderer-test.js +0 -55
- package/report/test/renderer/util-test.js +68 -8
- package/report/test-assets/faux-psi-template.html +0 -1
- package/report/tsconfig.json +2 -1
- package/report/types/html-renderer.d.ts +2 -1
- package/root.js +18 -0
- package/shared/localization/format.js +455 -0
- package/{lighthouse-core/lib/cdt/Common.js → shared/localization/i18n-module.js} +3 -8
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar-XB.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ar.json +141 -6
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/bg.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ca.json +140 -5
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/cs.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/da.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/de.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/el.json +141 -6
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-GB.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-US.json +129 -0
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XA.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/en-XL.json +129 -0
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/es-419.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/es.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/fi.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/fil.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/fr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/he.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/hi.json +142 -7
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/hr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/hu.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/id.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/it.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ja.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ko.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/lt.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/lv.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/nl.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/no.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/pl.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt-PT.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/pt.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ro.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ru.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sk.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sl.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr-Latn.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/sv.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/ta.json +146 -11
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/te.json +179 -44
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/th.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/tr.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/uk.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/vi.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-HK.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh-TW.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales/zh.json +139 -4
- package/{lighthouse-core/lib/i18n → shared/localization}/locales.js +8 -1
- package/shared/localization/swap-flow-locale.js +20 -0
- package/{lighthouse-core/lib/i18n → shared/localization}/swap-locale.js +9 -7
- package/shared/test/localization/format-test.js +421 -0
- package/shared/test/localization/locales-test.js +47 -0
- package/shared/test/localization/swap-locale-test.js +140 -0
- package/shared/tsconfig.json +22 -0
- package/{lighthouse-core/lib → shared}/type-verifiers.js +0 -0
- package/shared/types/shared.d.ts +24 -0
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +5 -3
- package/third-party/chromium-synchronization/installability-errors-test.js +2 -1
- package/tsconfig-all.json +1 -0
- package/tsconfig-base.json +1 -1
- package/tsconfig.json +2 -3
- package/types/config.d.ts +1 -0
- package/types/es-main.d.ts +18 -0
- package/types/externs.d.ts +2 -0
- package/types/lhr/flow.d.ts +7 -0
- package/types/lhr/i18n.d.ts +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Terminology
|
|
2
2
|
|
|
3
3
|
* **CTC format**: The [Chrome extension & Chrome app i18n format](https://developer.chrome.com/extensions/i18n-messages) with some minor changes. JSON with their specified model for declaring placeholders, examples, etc. Used as an interchange data format.
|
|
4
|
-
* **LHL syntax** (Lighthouse Localizable syntax): The ICU-friendly string syntax that is used to author `UIStrings` and is seen in the locale files in `
|
|
4
|
+
* **LHL syntax** (Lighthouse Localizable syntax): The ICU-friendly string syntax that is used to author `UIStrings` and is seen in the locale files in `shared/localization/locales/*.json`. Lighthouse has a custom syntax these strings combines many ICU message features along with some markdown.
|
|
5
5
|
* **ICU**: ICU (International Components for Unicode) is a localization project and standard defined by the Unicode consortium. In general, we refer to "ICU" as the [ICU message formatting](http://userguide.icu-project.org/formatparse/messages) syntax.
|
|
6
6
|
|
|
7
7
|
# The Lighthouse i18n pipeline
|
|
@@ -12,11 +12,11 @@ The collection and translation pipeline:
|
|
|
12
12
|
```
|
|
13
13
|
Source files: Locale files:
|
|
14
14
|
+---------------------------+ +----------------------------------------------
|
|
15
|
-
| ++ |
|
|
16
|
-
| const UIStrings = { ... };|-+ +---> |
|
|
15
|
+
| ++ | shared/localization/locales/en-US.json |
|
|
16
|
+
| const UIStrings = { ... };|-+ +---> | shared/localization/locales/en-XL.json |
|
|
17
17
|
| |-| | +----------------------------------------------+
|
|
18
18
|
+-----------------------------| | | ||
|
|
19
|
-
+----------------------------| | |
|
|
19
|
+
+----------------------------| | | shared/localization/locales/*.json |-<+
|
|
20
20
|
+---------------------------+ | | || |
|
|
21
21
|
| | +----------------------------------------------| |
|
|
22
22
|
$ yarn | | +---------------------------------------------+ |
|
|
@@ -218,7 +218,7 @@ CTC is a name that is distinct and identifies this as the Chrome translation for
|
|
|
218
218
|
1. String called in `.js` file, converted to `LH.IcuMessage` object.
|
|
219
219
|
|
|
220
220
|
1. Message object is replaced with the localized string via
|
|
221
|
-
`
|
|
221
|
+
`format.replaceIcuMessages` and `format.getFormatted`.
|
|
222
222
|
|
|
223
223
|
#### Example:
|
|
224
224
|
|
|
@@ -251,7 +251,7 @@ CTC is a name that is distinct and identifies this as the Chrome translation for
|
|
|
251
251
|
}
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
-
3. Lookup in `
|
|
254
|
+
3. Lookup in `format.replaceIcuMessages` and `format.getFormatted` will attempt to find the message in this order:
|
|
255
255
|
|
|
256
256
|
1. `locales/{locale}.json` The best result. `icuMessage.i18nId` is found in the target locale and the resulting string should appear correct.
|
|
257
257
|
|
|
@@ -5,22 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
/** @typedef {import('
|
|
8
|
+
/** @typedef {import('../../../shared/localization/locales').LhlMessages} LhlMessages */
|
|
9
9
|
|
|
10
10
|
const path = require('path');
|
|
11
|
-
const MessageFormat = require('intl-messageformat').default;
|
|
12
11
|
const lookupClosestLocale = require('lookup-closest-locale');
|
|
13
|
-
const
|
|
14
|
-
const {isObjectOfUnknownValues, isObjectOrArrayOfUnknownValues} = require('../type-verifiers.js');
|
|
12
|
+
const {getAvailableLocales} = require('../../../shared/localization/format.js');
|
|
15
13
|
const log = require('lighthouse-logger');
|
|
16
14
|
const {LH_ROOT} = require('../../../root.js');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const MESSAGE_I18N_ID_REGEX = / | [^\s]+$/;
|
|
15
|
+
const {
|
|
16
|
+
isIcuMessage,
|
|
17
|
+
formatMessage,
|
|
18
|
+
DEFAULT_LOCALE,
|
|
19
|
+
} = require('../../../shared/localization/format.js');
|
|
24
20
|
|
|
25
21
|
const UIStrings = {
|
|
26
22
|
/** Used to show the duration in milliseconds that something lasted. The `{timeInMs}` placeholder will be replaced with the time duration, shown in milliseconds (e.g. 63 ms) */
|
|
@@ -117,27 +113,6 @@ const UIStrings = {
|
|
|
117
113
|
itemSeverityHigh: 'High',
|
|
118
114
|
};
|
|
119
115
|
|
|
120
|
-
const formats = {
|
|
121
|
-
number: {
|
|
122
|
-
bytes: {
|
|
123
|
-
maximumFractionDigits: 0,
|
|
124
|
-
},
|
|
125
|
-
milliseconds: {
|
|
126
|
-
maximumFractionDigits: 0,
|
|
127
|
-
},
|
|
128
|
-
seconds: {
|
|
129
|
-
// Force the seconds to the tenths place for limited output and ease of scanning
|
|
130
|
-
minimumFractionDigits: 1,
|
|
131
|
-
maximumFractionDigits: 1,
|
|
132
|
-
},
|
|
133
|
-
extendedPercent: {
|
|
134
|
-
// Force allow up to two digits after decimal place in percentages. (Intl.NumberFormat options)
|
|
135
|
-
maximumFractionDigits: 2,
|
|
136
|
-
style: 'percent',
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
|
|
141
116
|
/**
|
|
142
117
|
* Look up the best available locale for the requested language through these fall backs:
|
|
143
118
|
* - exact match
|
|
@@ -145,22 +120,36 @@ const formats = {
|
|
|
145
120
|
* - supported locales in Intl formatters
|
|
146
121
|
*
|
|
147
122
|
* If `locale` isn't provided or one could not be found, DEFAULT_LOCALE is returned.
|
|
123
|
+
*
|
|
124
|
+
* By default any of the locales Lighthouse has strings for can be returned, but this
|
|
125
|
+
* can be overriden with `possibleLocales`, useful e.g. when Lighthouse is bundled and
|
|
126
|
+
* only DEFAULT_LOCALE is available, but `possibleLocales` can be used to select a
|
|
127
|
+
* locale available to be downloaded on demand.
|
|
148
128
|
* @param {string|string[]=} locales
|
|
129
|
+
* @param {Array<string>=} possibleLocales
|
|
149
130
|
* @return {LH.Locale}
|
|
150
131
|
*/
|
|
151
|
-
function lookupLocale(locales) {
|
|
152
|
-
//
|
|
132
|
+
function lookupLocale(locales, possibleLocales) {
|
|
133
|
+
// TODO: lookupLocale may need to be split into two functions, one that canonicalizes
|
|
134
|
+
// locales and one that looks up the best locale filename for a given locale.
|
|
135
|
+
// e.g. `en-IE` is canonical, but uses `en-GB.json`. See TODO in locales.js
|
|
136
|
+
|
|
153
137
|
if (typeof Intl !== 'object') {
|
|
138
|
+
// If Node was built with `--with-intl=none`, `Intl` won't exist.
|
|
154
139
|
throw new Error('Lighthouse must be run in Node with `Intl` support. See https://nodejs.org/api/intl.html for help');
|
|
155
140
|
}
|
|
156
141
|
|
|
157
|
-
// TODO: could do more work to sniff out the user's locale
|
|
158
142
|
const canonicalLocales = Intl.getCanonicalLocales(locales);
|
|
159
143
|
|
|
160
144
|
// Filter by what's available in this runtime.
|
|
161
145
|
const availableLocales = Intl.NumberFormat.supportedLocalesOf(canonicalLocales);
|
|
162
146
|
|
|
163
|
-
|
|
147
|
+
// Get available locales and transform into object to match `lookupClosestLocale`'s API.
|
|
148
|
+
const localesWithMessages = possibleLocales || getAvailableLocales();
|
|
149
|
+
const localesWithmessagesObj = /** @type {Record<LH.Locale, LhlMessages>} */ (
|
|
150
|
+
Object.fromEntries(localesWithMessages.map(l => [l, {}])));
|
|
151
|
+
|
|
152
|
+
const closestLocale = lookupClosestLocale(availableLocales, localesWithmessagesObj);
|
|
164
153
|
|
|
165
154
|
if (!closestLocale) {
|
|
166
155
|
// Log extra info if we're pretty sure this version of Node was built with `--with-intl=small-icu`.
|
|
@@ -174,191 +163,6 @@ function lookupLocale(locales) {
|
|
|
174
163
|
return closestLocale || DEFAULT_LOCALE;
|
|
175
164
|
}
|
|
176
165
|
|
|
177
|
-
/**
|
|
178
|
-
* Function to retrieve all 'argumentElement's from an ICU message. An argumentElement
|
|
179
|
-
* is an ICU element with an argument in it, like '{varName}' or '{varName, number, bytes}'. This
|
|
180
|
-
* differs from 'messageElement's which are just arbitrary text in a message.
|
|
181
|
-
*
|
|
182
|
-
* Notes:
|
|
183
|
-
* This function will recursively inspect plural elements for nested argumentElements.
|
|
184
|
-
*
|
|
185
|
-
* We need to find all the elements from the plural format sections, but
|
|
186
|
-
* they need to be deduplicated. I.e. "=1{hello {icu}} =other{hello {icu}}"
|
|
187
|
-
* the variable "icu" would appear twice if it wasn't de duplicated. And they cannot
|
|
188
|
-
* be stored in a set because they are not equal since their locations are different,
|
|
189
|
-
* thus they are stored via a Map keyed on the "id" which is the ICU varName.
|
|
190
|
-
*
|
|
191
|
-
* @param {Array<MessageElement>} icuElements
|
|
192
|
-
* @param {Map<string, ArgumentElement>} [seenElementsById]
|
|
193
|
-
* @return {Map<string, ArgumentElement>}
|
|
194
|
-
*/
|
|
195
|
-
function collectAllCustomElementsFromICU(icuElements, seenElementsById = new Map()) {
|
|
196
|
-
for (const el of icuElements) {
|
|
197
|
-
// We are only interested in elements that need ICU formatting (argumentElements)
|
|
198
|
-
if (el.type !== 'argumentElement') continue;
|
|
199
|
-
|
|
200
|
-
seenElementsById.set(el.id, el);
|
|
201
|
-
|
|
202
|
-
// Plurals need to be inspected recursively
|
|
203
|
-
if (!el.format || el.format.type !== 'pluralFormat') continue;
|
|
204
|
-
// Look at all options of the plural (=1{} =other{}...)
|
|
205
|
-
for (const option of el.format.options) {
|
|
206
|
-
// Run collections on each option's elements
|
|
207
|
-
collectAllCustomElementsFromICU(option.value.elements, seenElementsById);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return seenElementsById;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Returns a copy of the `values` object, with the values formatted based on how
|
|
216
|
-
* they will be used in their icuMessage, e.g. KB or milliseconds. The original
|
|
217
|
-
* object is unchanged.
|
|
218
|
-
* @param {MessageFormat} messageFormatter
|
|
219
|
-
* @param {Readonly<Record<string, string | number>>} values
|
|
220
|
-
* @param {string} lhlMessage Used for clear error logging.
|
|
221
|
-
* @return {Record<string, string | number>}
|
|
222
|
-
*/
|
|
223
|
-
function _preformatValues(messageFormatter, values, lhlMessage) {
|
|
224
|
-
const elementMap = collectAllCustomElementsFromICU(messageFormatter.getAst().elements);
|
|
225
|
-
const argumentElements = [...elementMap.values()];
|
|
226
|
-
|
|
227
|
-
/** @type {Record<string, string | number>} */
|
|
228
|
-
const formattedValues = {};
|
|
229
|
-
|
|
230
|
-
for (const {id, format} of argumentElements) {
|
|
231
|
-
// Throw an error if a message's value isn't provided
|
|
232
|
-
if (id && (id in values) === false) {
|
|
233
|
-
throw new Error(`ICU Message "${lhlMessage}" contains a value reference ("${id}") ` +
|
|
234
|
-
`that wasn't provided`);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const value = values[id];
|
|
238
|
-
|
|
239
|
-
// Direct `{id}` replacement and non-numeric values need no formatting.
|
|
240
|
-
if (!format || format.type !== 'numberFormat') {
|
|
241
|
-
formattedValues[id] = value;
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (typeof value !== 'number') {
|
|
246
|
-
throw new Error(`ICU Message "${lhlMessage}" contains a numeric reference ("${id}") ` +
|
|
247
|
-
'but provided value was not a number');
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Format values for known styles.
|
|
251
|
-
if (format.style === 'milliseconds') {
|
|
252
|
-
// Round all milliseconds to the nearest 10.
|
|
253
|
-
formattedValues[id] = Math.round(value / 10) * 10;
|
|
254
|
-
} else if (format.style === 'seconds' && id === 'timeInMs') {
|
|
255
|
-
// Convert all seconds to the correct unit (currently only for `timeInMs`).
|
|
256
|
-
formattedValues[id] = Math.round(value / 100) / 10;
|
|
257
|
-
} else if (format.style === 'bytes') {
|
|
258
|
-
// Replace all the bytes with KB.
|
|
259
|
-
formattedValues[id] = value / 1024;
|
|
260
|
-
} else {
|
|
261
|
-
// For all other number styles, the value isn't changed.
|
|
262
|
-
formattedValues[id] = value;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// Throw an error if a value is provided but has no placeholder in the message.
|
|
267
|
-
for (const valueId of Object.keys(values)) {
|
|
268
|
-
if (valueId in formattedValues) continue;
|
|
269
|
-
|
|
270
|
-
// errorCode is a special case always allowed to help LHError ease-of-use.
|
|
271
|
-
if (valueId === 'errorCode') {
|
|
272
|
-
formattedValues.errorCode = values.errorCode;
|
|
273
|
-
continue;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
throw new Error(`Provided value "${valueId}" does not match any placeholder in ` +
|
|
277
|
-
`ICU message "${lhlMessage}"`);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return formattedValues;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Format string `message` by localizing `values` and inserting them.
|
|
285
|
-
* @param {string} message
|
|
286
|
-
* @param {Record<string, string | number>} values
|
|
287
|
-
* @param {LH.Locale} locale
|
|
288
|
-
* @return {string}
|
|
289
|
-
*/
|
|
290
|
-
function _formatMessage(message, values = {}, locale) {
|
|
291
|
-
// When using accented english, force the use of a different locale for number formatting.
|
|
292
|
-
const localeForMessageFormat = (locale === 'en-XA' || locale === 'en-XL') ? 'de-DE' : locale;
|
|
293
|
-
|
|
294
|
-
const formatter = new MessageFormat(message, localeForMessageFormat, formats);
|
|
295
|
-
|
|
296
|
-
// Preformat values for the message format like KB and milliseconds.
|
|
297
|
-
const valuesForMessageFormat = _preformatValues(formatter, values, message);
|
|
298
|
-
|
|
299
|
-
return formatter.format(valuesForMessageFormat);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Retrieves the localized version of `icuMessage` and formats with any given
|
|
304
|
-
* value replacements.
|
|
305
|
-
* @param {LH.IcuMessage} icuMessage
|
|
306
|
-
* @param {LH.Locale} locale
|
|
307
|
-
* @return {string}
|
|
308
|
-
*/
|
|
309
|
-
function _localizeIcuMessage(icuMessage, locale) {
|
|
310
|
-
const localeMessages = LOCALES[locale];
|
|
311
|
-
if (!localeMessages) throw new Error(`Unsupported locale '${locale}'`);
|
|
312
|
-
const localeMessage = localeMessages[icuMessage.i18nId];
|
|
313
|
-
|
|
314
|
-
// Fall back to the default (usually the original english message) if we couldn't find a
|
|
315
|
-
// message in the specified locale. This could be because of string drift between
|
|
316
|
-
// Lighthouse versions or because new strings haven't been updated yet. Better to have
|
|
317
|
-
// an english message than no message at all; in some cases it won't even matter.
|
|
318
|
-
if (!localeMessage) {
|
|
319
|
-
return icuMessage.formattedDefault;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return _formatMessage(localeMessage.message, icuMessage.values, locale);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/** @param {string[]} pathInLHR */
|
|
326
|
-
function _formatPathAsString(pathInLHR) {
|
|
327
|
-
let pathAsString = '';
|
|
328
|
-
for (const property of pathInLHR) {
|
|
329
|
-
if (/^[a-z]+$/i.test(property)) {
|
|
330
|
-
if (pathAsString.length) pathAsString += '.';
|
|
331
|
-
pathAsString += property;
|
|
332
|
-
} else {
|
|
333
|
-
if (/]|"|'|\s/.test(property)) throw new Error(`Cannot handle "${property}" in i18n`);
|
|
334
|
-
pathAsString += `[${property}]`;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
return pathAsString;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* @param {LH.Locale} locale
|
|
343
|
-
* @return {Record<string, string>}
|
|
344
|
-
*/
|
|
345
|
-
function getRendererFormattedStrings(locale) {
|
|
346
|
-
const localeMessages = LOCALES[locale];
|
|
347
|
-
if (!localeMessages) throw new Error(`Unsupported locale '${locale}'`);
|
|
348
|
-
|
|
349
|
-
const icuMessageIds = Object.keys(localeMessages).filter(f => f.startsWith('report/'));
|
|
350
|
-
/** @type {Record<string, string>} */
|
|
351
|
-
const strings = {};
|
|
352
|
-
for (const icuMessageId of icuMessageIds) {
|
|
353
|
-
const [filename, key] = icuMessageId.split(' | ');
|
|
354
|
-
if (!filename.endsWith('util.js')) throw new Error(`Unexpected message: ${icuMessageId}`);
|
|
355
|
-
|
|
356
|
-
strings[key] = localeMessages[icuMessageId].message;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
return strings;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
166
|
/**
|
|
363
167
|
* Returns a function that generates `LH.IcuMessage` objects to localize the
|
|
364
168
|
* messages in `fileStrings` and the shared `i18n.UIStrings`.
|
|
@@ -389,132 +193,13 @@ function createIcuMessageFn(filename, fileStrings) {
|
|
|
389
193
|
return {
|
|
390
194
|
i18nId,
|
|
391
195
|
values,
|
|
392
|
-
formattedDefault:
|
|
196
|
+
formattedDefault: formatMessage(message, values, DEFAULT_LOCALE),
|
|
393
197
|
};
|
|
394
198
|
};
|
|
395
199
|
|
|
396
200
|
return getIcuMessageFn;
|
|
397
201
|
}
|
|
398
202
|
|
|
399
|
-
/**
|
|
400
|
-
* Returns whether `icuMessageOrNot`` is an `LH.IcuMessage` instance.
|
|
401
|
-
* @param {unknown} icuMessageOrNot
|
|
402
|
-
* @return {icuMessageOrNot is LH.IcuMessage}
|
|
403
|
-
*/
|
|
404
|
-
function isIcuMessage(icuMessageOrNot) {
|
|
405
|
-
if (!isObjectOfUnknownValues(icuMessageOrNot)) {
|
|
406
|
-
return false;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
const {i18nId, values, formattedDefault} = icuMessageOrNot;
|
|
410
|
-
if (typeof i18nId !== 'string') {
|
|
411
|
-
return false;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// formattedDefault is required.
|
|
415
|
-
if (typeof formattedDefault !== 'string') {
|
|
416
|
-
return false;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// Values is optional.
|
|
420
|
-
if (values !== undefined) {
|
|
421
|
-
if (!isObjectOfUnknownValues(values)) {
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
for (const value of Object.values(values)) {
|
|
425
|
-
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// Finally return true if i18nId seems correct.
|
|
432
|
-
return MESSAGE_I18N_ID_REGEX.test(i18nId);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Get the localized and formatted form of `icuMessageOrRawString` if it's an
|
|
437
|
-
* LH.IcuMessage, or get it back directly if it's already a string.
|
|
438
|
-
* Warning: this function throws if `icuMessageOrRawString` is not the expected
|
|
439
|
-
* type (use function from `createIcuMessageFn` to create a valid LH.IcuMessage)
|
|
440
|
-
* or `locale` isn't supported (use `lookupLocale` to find a valid locale).
|
|
441
|
-
* @param {LH.IcuMessage | string} icuMessageOrRawString
|
|
442
|
-
* @param {LH.Locale} locale
|
|
443
|
-
* @return {string}
|
|
444
|
-
*/
|
|
445
|
-
function getFormatted(icuMessageOrRawString, locale) {
|
|
446
|
-
if (isIcuMessage(icuMessageOrRawString)) {
|
|
447
|
-
return _localizeIcuMessage(icuMessageOrRawString, locale);
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (typeof icuMessageOrRawString === 'string') {
|
|
451
|
-
return icuMessageOrRawString;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// Should be impossible from types, but do a strict check in case malformed JSON makes it this far.
|
|
455
|
-
throw new Error('Attempted to format invalid icuMessage type');
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Recursively walk the input object, looking for property values that are
|
|
460
|
-
* `LH.IcuMessage`s and replace them with their localized values. Primarily
|
|
461
|
-
* used with the full LHR or a Config as input.
|
|
462
|
-
* Returns a map of locations that were replaced to the `IcuMessage` that was at
|
|
463
|
-
* that location.
|
|
464
|
-
* @param {unknown} inputObject
|
|
465
|
-
* @param {LH.Locale} locale
|
|
466
|
-
* @return {LH.Result.IcuMessagePaths}
|
|
467
|
-
*/
|
|
468
|
-
function replaceIcuMessages(inputObject, locale) {
|
|
469
|
-
/**
|
|
470
|
-
* @param {unknown} subObject
|
|
471
|
-
* @param {LH.Result.IcuMessagePaths} icuMessagePaths
|
|
472
|
-
* @param {string[]} pathInLHR
|
|
473
|
-
*/
|
|
474
|
-
function replaceInObject(subObject, icuMessagePaths, pathInLHR = []) {
|
|
475
|
-
if (!isObjectOrArrayOfUnknownValues(subObject)) return;
|
|
476
|
-
|
|
477
|
-
for (const [property, possibleIcuMessage] of Object.entries(subObject)) {
|
|
478
|
-
const currentPathInLHR = pathInLHR.concat([property]);
|
|
479
|
-
|
|
480
|
-
// Replace any IcuMessages with a localized string.
|
|
481
|
-
if (isIcuMessage(possibleIcuMessage)) {
|
|
482
|
-
const formattedString = _localizeIcuMessage(possibleIcuMessage, locale);
|
|
483
|
-
const messageInstancesInLHR = icuMessagePaths[possibleIcuMessage.i18nId] || [];
|
|
484
|
-
const currentPathAsString = _formatPathAsString(currentPathInLHR);
|
|
485
|
-
|
|
486
|
-
messageInstancesInLHR.push(
|
|
487
|
-
possibleIcuMessage.values ?
|
|
488
|
-
{values: possibleIcuMessage.values, path: currentPathAsString} :
|
|
489
|
-
currentPathAsString
|
|
490
|
-
);
|
|
491
|
-
|
|
492
|
-
// @ts-ignore - tsc doesn't like that `property` can be either string key or array index.
|
|
493
|
-
subObject[property] = formattedString;
|
|
494
|
-
icuMessagePaths[possibleIcuMessage.i18nId] = messageInstancesInLHR;
|
|
495
|
-
} else {
|
|
496
|
-
replaceInObject(possibleIcuMessage, icuMessagePaths, currentPathInLHR);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/** @type {LH.Result.IcuMessagePaths} */
|
|
502
|
-
const icuMessagePaths = {};
|
|
503
|
-
replaceInObject(inputObject, icuMessagePaths);
|
|
504
|
-
return icuMessagePaths;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Populate the i18n string lookup dict with locale data
|
|
509
|
-
* Used when the host environment selects the locale and serves lighthouse the intended locale file
|
|
510
|
-
* @see https://docs.google.com/document/d/1jnt3BqKB-4q3AE94UWFA0Gqspx8Sd_jivlB7gQMlmfk/edit
|
|
511
|
-
* @param {LH.Locale} locale
|
|
512
|
-
* @param {LhlMessages} lhlMessages
|
|
513
|
-
*/
|
|
514
|
-
function registerLocaleData(locale, lhlMessages) {
|
|
515
|
-
LOCALES[locale] = lhlMessages;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
203
|
/**
|
|
519
204
|
* Returns true if the given value is a string or an LH.IcuMessage.
|
|
520
205
|
* @param {unknown} value
|
|
@@ -525,16 +210,9 @@ function isStringOrIcuMessage(value) {
|
|
|
525
210
|
}
|
|
526
211
|
|
|
527
212
|
module.exports = {
|
|
528
|
-
_formatPathAsString,
|
|
529
213
|
UIStrings,
|
|
530
214
|
lookupLocale,
|
|
531
|
-
getRendererFormattedStrings,
|
|
532
215
|
createIcuMessageFn,
|
|
533
|
-
getFormatted,
|
|
534
|
-
replaceIcuMessages,
|
|
535
|
-
isIcuMessage,
|
|
536
|
-
collectAllCustomElementsFromICU,
|
|
537
|
-
registerLocaleData,
|
|
538
216
|
isStringOrIcuMessage,
|
|
539
217
|
// TODO: exported for backwards compatibility. Consider removing on future breaking change.
|
|
540
218
|
createMessageInstanceIdFn: createIcuMessageFn,
|
|
@@ -530,8 +530,8 @@ module.exports = {
|
|
|
530
530
|
getElementsInDocument,
|
|
531
531
|
getElementsInDocumentString: getElementsInDocument.toString(),
|
|
532
532
|
getOuterHTMLSnippetString: getOuterHTMLSnippet.toString(),
|
|
533
|
-
getOuterHTMLSnippet
|
|
534
|
-
computeBenchmarkIndex
|
|
533
|
+
getOuterHTMLSnippet,
|
|
534
|
+
computeBenchmarkIndex,
|
|
535
535
|
computeBenchmarkIndexString: computeBenchmarkIndex.toString(),
|
|
536
536
|
getMaxTextureSize,
|
|
537
537
|
getNodeDetailsString,
|
|
@@ -539,8 +539,8 @@ module.exports = {
|
|
|
539
539
|
getNodePathString: getNodePath.toString(),
|
|
540
540
|
getNodeSelectorString: getNodeSelector.toString(),
|
|
541
541
|
getNodePath,
|
|
542
|
-
getNodeSelector
|
|
543
|
-
getNodeLabel
|
|
542
|
+
getNodeSelector,
|
|
543
|
+
getNodeLabel,
|
|
544
544
|
getNodeLabelString: getNodeLabel.toString(),
|
|
545
545
|
isPositionFixedString: isPositionFixed.toString(),
|
|
546
546
|
wrapRequestIdleCallback,
|
|
@@ -9,18 +9,6 @@ const log = require('lighthouse-logger');
|
|
|
9
9
|
const stackPacks = require('lighthouse-stack-packs');
|
|
10
10
|
const i18n = require('./i18n/i18n.js');
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Resolve a module on web and node
|
|
14
|
-
* @param {string} module
|
|
15
|
-
*/
|
|
16
|
-
function resolve(module) {
|
|
17
|
-
if (!require.resolve) {
|
|
18
|
-
return `node_modules/${module}`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return require.resolve(module);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
12
|
/**
|
|
25
13
|
* Pairs consisting of a stack pack's ID and the set of stacks needed to be
|
|
26
14
|
* detected in a page to display that pack's advice.
|
|
@@ -87,7 +75,7 @@ function getStackPacks(pageStacks) {
|
|
|
87
75
|
|
|
88
76
|
// Create i18n handler to get translated strings.
|
|
89
77
|
const str_ = i18n.createMessageInstanceIdFn(
|
|
90
|
-
|
|
78
|
+
`node_modules/lighthouse-stack-packs/packs/${matchedPack.id}.js`,
|
|
91
79
|
matchedPack.UIStrings
|
|
92
80
|
);
|
|
93
81
|
|
|
@@ -11,7 +11,7 @@ const GatherRunner = require('./gather/gather-runner.js');
|
|
|
11
11
|
const ReportScoring = require('./scoring.js');
|
|
12
12
|
const Audit = require('./audits/audit.js');
|
|
13
13
|
const log = require('lighthouse-logger');
|
|
14
|
-
const
|
|
14
|
+
const format = require('../shared/localization/format.js');
|
|
15
15
|
const stackPacks = require('./lib/stack-packs.js');
|
|
16
16
|
const assetSaver = require('./lib/asset-saver.js');
|
|
17
17
|
const fs = require('fs');
|
|
@@ -152,14 +152,14 @@ class Runner {
|
|
|
152
152
|
categoryGroups: runOpts.config.groups || undefined,
|
|
153
153
|
timing: this._getTiming(artifacts),
|
|
154
154
|
i18n: {
|
|
155
|
-
rendererFormattedStrings:
|
|
155
|
+
rendererFormattedStrings: format.getRendererFormattedStrings(settings.locale),
|
|
156
156
|
icuMessagePaths: {},
|
|
157
157
|
},
|
|
158
158
|
stackPacks: stackPacks.getStackPacks(artifacts.Stacks),
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
// Replace ICU message references with localized strings; save replaced paths in lhr.
|
|
162
|
-
i18nLhr.i18n.icuMessagePaths =
|
|
162
|
+
i18nLhr.i18n.icuMessagePaths = format.replaceIcuMessages(i18nLhr, settings.locale);
|
|
163
163
|
|
|
164
164
|
// LHR has now been localized.
|
|
165
165
|
const lhr = /** @type {LH.Result} */ (i18nLhr);
|
|
@@ -177,7 +177,7 @@ class Runner {
|
|
|
177
177
|
} catch (err) {
|
|
178
178
|
// i18n LighthouseError strings.
|
|
179
179
|
if (err.friendlyMessage) {
|
|
180
|
-
err.friendlyMessage =
|
|
180
|
+
err.friendlyMessage = format.getFormatted(err.friendlyMessage, settings.locale);
|
|
181
181
|
}
|
|
182
182
|
await Sentry.captureException(err, {level: 'fatal'});
|
|
183
183
|
throw err;
|
|
@@ -211,7 +211,7 @@ class Runner {
|
|
|
211
211
|
duration: parseFloat(entry.duration.toFixed(2)),
|
|
212
212
|
entryType: entry.entryType,
|
|
213
213
|
};
|
|
214
|
-
});
|
|
214
|
+
}).sort((a, b) => a.startTime - b.startTime);
|
|
215
215
|
const runnerEntry = timingEntries.find(e => e.name === 'lh:runner:run');
|
|
216
216
|
return {entries: timingEntries, total: runnerEntry && runnerEntry.duration || 0};
|
|
217
217
|
}
|
|
@@ -301,7 +301,7 @@ class Runner {
|
|
|
301
301
|
static async _runAudit(auditDefn, artifacts, sharedAuditContext, runWarnings) {
|
|
302
302
|
const audit = auditDefn.implementation;
|
|
303
303
|
const status = {
|
|
304
|
-
msg: `Auditing: ${
|
|
304
|
+
msg: `Auditing: ${format.getFormatted(audit.meta.title, 'en-US')}`,
|
|
305
305
|
id: `lh:audit:${audit.meta.id}`,
|
|
306
306
|
};
|
|
307
307
|
log.time(status);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* @fileoverview Script to launch a clean Chrome instance on-demand.
|
|
6
7
|
*
|
|
8
|
+
* node lighthouse-core/scripts/manual-chrome-launcher.js
|
|
9
|
+
*
|
|
7
10
|
* Assuming Lighthouse is installed globally or `npm link`ed, use via:
|
|
8
11
|
* chrome-debug
|
|
9
12
|
* Optionally enable extensions or pass a port, additional chrome flags, and/or a URL
|
|
@@ -13,7 +16,7 @@
|
|
|
13
16
|
* chrome-debug --enable-extensions
|
|
14
17
|
*/
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
import {Launcher, launch} from 'chrome-launcher';
|
|
17
20
|
|
|
18
21
|
const args = process.argv.slice(2);
|
|
19
22
|
const chromeFlags = [];
|
|
@@ -521,15 +521,31 @@ class Util {
|
|
|
521
521
|
* @param {LH.ReportResult.Category} category
|
|
522
522
|
*/
|
|
523
523
|
static calculateCategoryFraction(category) {
|
|
524
|
-
|
|
525
|
-
|
|
524
|
+
let numPassableAudits = 0;
|
|
526
525
|
let numPassed = 0;
|
|
526
|
+
let numInformative = 0;
|
|
527
527
|
let totalWeight = 0;
|
|
528
528
|
for (const auditRef of category.auditRefs) {
|
|
529
|
+
const auditPassed = Util.showAsPassed(auditRef.result);
|
|
530
|
+
const notDisplayed = !auditRef.group && category.id === 'performance';
|
|
531
|
+
|
|
532
|
+
// Don't count the audit if it's manual, N/A, or isn't displayed.
|
|
533
|
+
if (notDisplayed ||
|
|
534
|
+
auditRef.result.scoreDisplayMode === 'manual' ||
|
|
535
|
+
auditRef.result.scoreDisplayMode === 'notApplicable') {
|
|
536
|
+
continue;
|
|
537
|
+
} else if (auditRef.result.scoreDisplayMode === 'informative') {
|
|
538
|
+
if (!auditPassed) {
|
|
539
|
+
++numInformative;
|
|
540
|
+
}
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
++numPassableAudits;
|
|
529
545
|
totalWeight += auditRef.weight;
|
|
530
|
-
if (
|
|
546
|
+
if (auditPassed) numPassed++;
|
|
531
547
|
}
|
|
532
|
-
return {numPassed,
|
|
548
|
+
return {numPassed, numPassableAudits, numInformative, totalWeight};
|
|
533
549
|
}
|
|
534
550
|
}
|
|
535
551
|
|