lighthouse 9.5.0-dev.20220814 → 9.5.0-dev.20220817
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/cli/commands/list-locales.js +1 -1
- package/cli/run.js +13 -0
- package/core/config/config-helpers.js +0 -15
- package/core/config/config.js +1 -1
- package/core/config/constants.js +1 -0
- package/core/config/default-config.js +0 -2
- package/core/fraggle-rock/api.js +1 -1
- package/core/fraggle-rock/config/config.js +12 -13
- package/core/fraggle-rock/gather/navigation-runner.js +17 -26
- package/core/fraggle-rock/gather/snapshot-runner.js +4 -5
- package/core/fraggle-rock/gather/timespan-runner.js +4 -5
- package/core/fraggle-rock/replay/stringify-extension.js +105 -0
- package/core/fraggle-rock/user-flow.js +10 -12
- package/core/gather/driver/execution-context.js +19 -2
- package/core/gather/gather-runner.js +1 -1
- package/core/index.js +2 -5
- package/core/lib/asset-saver.js +2 -2
- package/core/lib/cdt/generated/SourceMap.js +113 -27
- package/core/lib/deprecations-strings.js +74 -10
- package/core/lib/network-request.js +1 -0
- package/core/lib/page-functions.js +15 -3
- package/core/lib/traces/{pwmetrics-events.js → metric-trace-events.js} +3 -4
- package/core/runner.js +2 -2
- package/dist/report/bundle.esm.js +1 -14
- package/dist/report/flow.js +28 -27
- package/dist/report/standalone.js +4 -4
- package/flow-report/test/flow-report-pptr-test.ts +1 -1
- package/package.json +6 -5
- package/report/generator/file-namer.js +5 -1
- package/report/generator/flow-report-assets.js +10 -6
- package/report/generator/report-assets.js +8 -5
- package/report/generator/report-generator.js +7 -7
- package/report/generator/tsconfig.json +1 -0
- package/report/test/generator/file-namer-test.js +2 -2
- package/report/test/generator/report-generator-test.js +8 -9
- package/report/test/renderer/report-renderer-axe-test.js +2 -2
- package/report/test/renderer/report-ui-features-test.js +1 -1
- package/shared/localization/format.js +11 -13
- package/shared/localization/i18n-module.js +7 -2
- package/shared/localization/locales/ar-XB.json +0 -21
- package/shared/localization/locales/ar.json +0 -21
- package/shared/localization/locales/bg.json +0 -21
- package/shared/localization/locales/ca.json +0 -21
- package/shared/localization/locales/cs.json +0 -21
- package/shared/localization/locales/da.json +0 -21
- package/shared/localization/locales/de.json +0 -21
- package/shared/localization/locales/el.json +0 -21
- package/shared/localization/locales/en-GB.json +0 -21
- package/shared/localization/locales/en-US.json +13 -22
- package/shared/localization/locales/en-XA.json +0 -21
- package/shared/localization/locales/en-XL.json +13 -22
- package/shared/localization/locales/es-419.json +0 -21
- package/shared/localization/locales/es.json +0 -21
- package/shared/localization/locales/fi.json +0 -21
- package/shared/localization/locales/fil.json +0 -21
- package/shared/localization/locales/fr.json +0 -21
- package/shared/localization/locales/he.json +0 -21
- package/shared/localization/locales/hi.json +0 -21
- package/shared/localization/locales/hr.json +0 -21
- package/shared/localization/locales/hu.json +0 -21
- package/shared/localization/locales/id.json +0 -21
- package/shared/localization/locales/it.json +0 -21
- package/shared/localization/locales/ja.json +0 -21
- package/shared/localization/locales/ko.json +0 -21
- package/shared/localization/locales/lt.json +0 -21
- package/shared/localization/locales/lv.json +0 -21
- package/shared/localization/locales/nl.json +0 -21
- package/shared/localization/locales/no.json +0 -21
- package/shared/localization/locales/pl.json +0 -21
- package/shared/localization/locales/pt-PT.json +0 -21
- package/shared/localization/locales/pt.json +0 -21
- package/shared/localization/locales/ro.json +0 -21
- package/shared/localization/locales/ru.json +0 -21
- package/shared/localization/locales/sk.json +0 -21
- package/shared/localization/locales/sl.json +0 -21
- package/shared/localization/locales/sr-Latn.json +0 -21
- package/shared/localization/locales/sr.json +0 -21
- package/shared/localization/locales/sv.json +0 -21
- package/shared/localization/locales/ta.json +0 -21
- package/shared/localization/locales/te.json +0 -21
- package/shared/localization/locales/th.json +0 -21
- package/shared/localization/locales/tr.json +0 -21
- package/shared/localization/locales/uk.json +0 -21
- package/shared/localization/locales/vi.json +0 -21
- package/shared/localization/locales/zh-HK.json +0 -21
- package/shared/localization/locales/zh-TW.json +0 -21
- package/shared/localization/locales/zh.json +0 -21
- package/shared/localization/locales.js +53 -50
- package/shared/localization/swap-flow-locale.js +6 -2
- package/shared/localization/swap-locale.js +4 -4
- package/shared/test/localization/format-test.js +17 -20
- package/shared/test/localization/locales-test.js +2 -2
- package/shared/test/localization/swap-locale-test.js +3 -2
- package/shared/tsconfig.json +1 -0
- package/shared/type-verifiers.js +1 -1
- package/tsconfig.json +1 -5
- package/types/config.d.ts +0 -13
- package/types/externs.d.ts +1 -1
- package/types/lhr/settings.d.ts +2 -0
- package/types/user-flow.d.ts +1 -1
- package/core/audits/dobetterweb/no-vulnerable-libraries.js +0 -229
- package/report/generator/package.json +0 -4
- package/report/test/generator/package.json +0 -4
- package/shared/package.json +0 -4
- package/third-party/snyk/snapshot.json +0 -182
|
@@ -854,27 +854,6 @@
|
|
|
854
854
|
"core/audits/dobetterweb/no-document-write.js | title": {
|
|
855
855
|
"message": "请勿使用 `document.write()`"
|
|
856
856
|
},
|
|
857
|
-
"core/audits/dobetterweb/no-vulnerable-libraries.js | columnSeverity": {
|
|
858
|
-
"message": "最高严重程度"
|
|
859
|
-
},
|
|
860
|
-
"core/audits/dobetterweb/no-vulnerable-libraries.js | columnVersion": {
|
|
861
|
-
"message": "库版本"
|
|
862
|
-
},
|
|
863
|
-
"core/audits/dobetterweb/no-vulnerable-libraries.js | columnVuln": {
|
|
864
|
-
"message": "漏洞数量"
|
|
865
|
-
},
|
|
866
|
-
"core/audits/dobetterweb/no-vulnerable-libraries.js | description": {
|
|
867
|
-
"message": "某些第三方脚本可能包含已知的安全漏洞,攻击者很容易识别和利用这些漏洞。[了解详情](https://web.dev/no-vulnerable-libraries/)。"
|
|
868
|
-
},
|
|
869
|
-
"core/audits/dobetterweb/no-vulnerable-libraries.js | displayValue": {
|
|
870
|
-
"message": "{itemCount,plural, =1{检测到 1 个漏洞}other{检测到 # 个漏洞}}"
|
|
871
|
-
},
|
|
872
|
-
"core/audits/dobetterweb/no-vulnerable-libraries.js | failureTitle": {
|
|
873
|
-
"message": "包含有已知安全漏洞的前端 JavaScript 库"
|
|
874
|
-
},
|
|
875
|
-
"core/audits/dobetterweb/no-vulnerable-libraries.js | title": {
|
|
876
|
-
"message": "避免使用含已知安全漏洞的前端 JavaScript 库"
|
|
877
|
-
},
|
|
878
857
|
"core/audits/dobetterweb/notification-on-start.js | description": {
|
|
879
858
|
"message": "如果网站在缺少上下文的情况下请求发送通知,会导致用户不信任网站或感到困惑。建议将请求与用户手势进行绑定。[了解详情](https://web.dev/notification-on-start/)。"
|
|
880
859
|
},
|
|
@@ -22,61 +22,64 @@
|
|
|
22
22
|
|
|
23
23
|
// TODO(paulirish): Centralize locale inheritance (combining this & i18n.lookupLocale()), adopt cldr parentLocale rules.
|
|
24
24
|
|
|
25
|
+
import fs from 'fs';
|
|
26
|
+
import {getModuleDirectory} from '../../esm-utils.js';
|
|
27
|
+
|
|
25
28
|
/** @typedef {import('../../types/lhr/settings').Locale} Locale */
|
|
26
29
|
/** @typedef {Record<string, {message: string}>} LhlMessages */
|
|
27
30
|
|
|
28
|
-
const
|
|
31
|
+
const moduleDir = getModuleDirectory(import.meta);
|
|
29
32
|
|
|
30
33
|
/** @type {Record<string, LhlMessages>} */
|
|
31
34
|
const files = {
|
|
32
|
-
'ar': JSON.parse(fs.readFileSync(`${
|
|
33
|
-
'ar-XB': JSON.parse(fs.readFileSync(`${
|
|
34
|
-
'bg': JSON.parse(fs.readFileSync(`${
|
|
35
|
-
'ca': JSON.parse(fs.readFileSync(`${
|
|
36
|
-
'cs': JSON.parse(fs.readFileSync(`${
|
|
37
|
-
'da': JSON.parse(fs.readFileSync(`${
|
|
38
|
-
'de': JSON.parse(fs.readFileSync(`${
|
|
39
|
-
'el': JSON.parse(fs.readFileSync(`${
|
|
40
|
-
'en-GB': JSON.parse(fs.readFileSync(`${
|
|
41
|
-
'en-US': JSON.parse(fs.readFileSync(`${
|
|
42
|
-
'en-XA': JSON.parse(fs.readFileSync(`${
|
|
43
|
-
'en-XL': JSON.parse(fs.readFileSync(`${
|
|
44
|
-
'es': JSON.parse(fs.readFileSync(`${
|
|
45
|
-
'es-419': JSON.parse(fs.readFileSync(`${
|
|
46
|
-
'fi': JSON.parse(fs.readFileSync(`${
|
|
47
|
-
'fil': JSON.parse(fs.readFileSync(`${
|
|
48
|
-
'fr': JSON.parse(fs.readFileSync(`${
|
|
49
|
-
'he': JSON.parse(fs.readFileSync(`${
|
|
50
|
-
'hi': JSON.parse(fs.readFileSync(`${
|
|
51
|
-
'hr': JSON.parse(fs.readFileSync(`${
|
|
52
|
-
'hu': JSON.parse(fs.readFileSync(`${
|
|
53
|
-
'id': JSON.parse(fs.readFileSync(`${
|
|
54
|
-
'it': JSON.parse(fs.readFileSync(`${
|
|
55
|
-
'ja': JSON.parse(fs.readFileSync(`${
|
|
56
|
-
'ko': JSON.parse(fs.readFileSync(`${
|
|
57
|
-
'lt': JSON.parse(fs.readFileSync(`${
|
|
58
|
-
'lv': JSON.parse(fs.readFileSync(`${
|
|
59
|
-
'nl': JSON.parse(fs.readFileSync(`${
|
|
60
|
-
'no': JSON.parse(fs.readFileSync(`${
|
|
61
|
-
'pl': JSON.parse(fs.readFileSync(`${
|
|
62
|
-
'pt': JSON.parse(fs.readFileSync(`${
|
|
63
|
-
'pt-PT': JSON.parse(fs.readFileSync(`${
|
|
64
|
-
'ro': JSON.parse(fs.readFileSync(`${
|
|
65
|
-
'ru': JSON.parse(fs.readFileSync(`${
|
|
66
|
-
'sk': JSON.parse(fs.readFileSync(`${
|
|
67
|
-
'sl': JSON.parse(fs.readFileSync(`${
|
|
68
|
-
'sr': JSON.parse(fs.readFileSync(`${
|
|
69
|
-
'sr-Latn': JSON.parse(fs.readFileSync(`${
|
|
70
|
-
'sv': JSON.parse(fs.readFileSync(`${
|
|
71
|
-
'ta': JSON.parse(fs.readFileSync(`${
|
|
72
|
-
'te': JSON.parse(fs.readFileSync(`${
|
|
73
|
-
'th': JSON.parse(fs.readFileSync(`${
|
|
74
|
-
'tr': JSON.parse(fs.readFileSync(`${
|
|
75
|
-
'uk': JSON.parse(fs.readFileSync(`${
|
|
76
|
-
'vi': JSON.parse(fs.readFileSync(`${
|
|
77
|
-
'zh': JSON.parse(fs.readFileSync(`${
|
|
78
|
-
'zh-HK': JSON.parse(fs.readFileSync(`${
|
|
79
|
-
'zh-TW': JSON.parse(fs.readFileSync(`${
|
|
35
|
+
'ar': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ar.json`, 'utf8')),
|
|
36
|
+
'ar-XB': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ar-XB.json`, 'utf8')),
|
|
37
|
+
'bg': JSON.parse(fs.readFileSync(`${moduleDir}/locales/bg.json`, 'utf8')),
|
|
38
|
+
'ca': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ca.json`, 'utf8')),
|
|
39
|
+
'cs': JSON.parse(fs.readFileSync(`${moduleDir}/locales/cs.json`, 'utf8')),
|
|
40
|
+
'da': JSON.parse(fs.readFileSync(`${moduleDir}/locales/da.json`, 'utf8')),
|
|
41
|
+
'de': JSON.parse(fs.readFileSync(`${moduleDir}/locales/de.json`, 'utf8')),
|
|
42
|
+
'el': JSON.parse(fs.readFileSync(`${moduleDir}/locales/el.json`, 'utf8')),
|
|
43
|
+
'en-GB': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-GB.json`, 'utf8')),
|
|
44
|
+
'en-US': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-US.json`, 'utf8')),
|
|
45
|
+
'en-XA': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-XA.json`, 'utf8')),
|
|
46
|
+
'en-XL': JSON.parse(fs.readFileSync(`${moduleDir}/locales/en-XL.json`, 'utf8')),
|
|
47
|
+
'es': JSON.parse(fs.readFileSync(`${moduleDir}/locales/es.json`, 'utf8')),
|
|
48
|
+
'es-419': JSON.parse(fs.readFileSync(`${moduleDir}/locales/es-419.json`, 'utf8')),
|
|
49
|
+
'fi': JSON.parse(fs.readFileSync(`${moduleDir}/locales/fi.json`, 'utf8')),
|
|
50
|
+
'fil': JSON.parse(fs.readFileSync(`${moduleDir}/locales/fil.json`, 'utf8')),
|
|
51
|
+
'fr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/fr.json`, 'utf8')),
|
|
52
|
+
'he': JSON.parse(fs.readFileSync(`${moduleDir}/locales/he.json`, 'utf8')),
|
|
53
|
+
'hi': JSON.parse(fs.readFileSync(`${moduleDir}/locales/hi.json`, 'utf8')),
|
|
54
|
+
'hr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/hr.json`, 'utf8')),
|
|
55
|
+
'hu': JSON.parse(fs.readFileSync(`${moduleDir}/locales/hu.json`, 'utf8')),
|
|
56
|
+
'id': JSON.parse(fs.readFileSync(`${moduleDir}/locales/id.json`, 'utf8')),
|
|
57
|
+
'it': JSON.parse(fs.readFileSync(`${moduleDir}/locales/it.json`, 'utf8')),
|
|
58
|
+
'ja': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ja.json`, 'utf8')),
|
|
59
|
+
'ko': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ko.json`, 'utf8')),
|
|
60
|
+
'lt': JSON.parse(fs.readFileSync(`${moduleDir}/locales/lt.json`, 'utf8')),
|
|
61
|
+
'lv': JSON.parse(fs.readFileSync(`${moduleDir}/locales/lv.json`, 'utf8')),
|
|
62
|
+
'nl': JSON.parse(fs.readFileSync(`${moduleDir}/locales/nl.json`, 'utf8')),
|
|
63
|
+
'no': JSON.parse(fs.readFileSync(`${moduleDir}/locales/no.json`, 'utf8')),
|
|
64
|
+
'pl': JSON.parse(fs.readFileSync(`${moduleDir}/locales/pl.json`, 'utf8')),
|
|
65
|
+
'pt': JSON.parse(fs.readFileSync(`${moduleDir}/locales/pt.json`, 'utf8')),
|
|
66
|
+
'pt-PT': JSON.parse(fs.readFileSync(`${moduleDir}/locales/pt-PT.json`, 'utf8')),
|
|
67
|
+
'ro': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ro.json`, 'utf8')),
|
|
68
|
+
'ru': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ru.json`, 'utf8')),
|
|
69
|
+
'sk': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sk.json`, 'utf8')),
|
|
70
|
+
'sl': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sl.json`, 'utf8')),
|
|
71
|
+
'sr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sr.json`, 'utf8')),
|
|
72
|
+
'sr-Latn': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sr-Latn.json`, 'utf8')),
|
|
73
|
+
'sv': JSON.parse(fs.readFileSync(`${moduleDir}/locales/sv.json`, 'utf8')),
|
|
74
|
+
'ta': JSON.parse(fs.readFileSync(`${moduleDir}/locales/ta.json`, 'utf8')),
|
|
75
|
+
'te': JSON.parse(fs.readFileSync(`${moduleDir}/locales/te.json`, 'utf8')),
|
|
76
|
+
'th': JSON.parse(fs.readFileSync(`${moduleDir}/locales/th.json`, 'utf8')),
|
|
77
|
+
'tr': JSON.parse(fs.readFileSync(`${moduleDir}/locales/tr.json`, 'utf8')),
|
|
78
|
+
'uk': JSON.parse(fs.readFileSync(`${moduleDir}/locales/uk.json`, 'utf8')),
|
|
79
|
+
'vi': JSON.parse(fs.readFileSync(`${moduleDir}/locales/vi.json`, 'utf8')),
|
|
80
|
+
'zh': JSON.parse(fs.readFileSync(`${moduleDir}/locales/zh.json`, 'utf8')),
|
|
81
|
+
'zh-HK': JSON.parse(fs.readFileSync(`${moduleDir}/locales/zh-HK.json`, 'utf8')),
|
|
82
|
+
'zh-TW': JSON.parse(fs.readFileSync(`${moduleDir}/locales/zh-TW.json`, 'utf8')),
|
|
80
83
|
};
|
|
81
84
|
|
|
82
85
|
// The keys within this const must exactly match the LH.Locale type in externs.d.ts
|
|
@@ -172,4 +175,4 @@ const locales = {
|
|
|
172
175
|
'zh-TW': files['zh-TW'], // aka zh-Hant, zh-Hant-TW, Traditional Chinese
|
|
173
176
|
};
|
|
174
177
|
|
|
175
|
-
|
|
178
|
+
export {locales};
|
|
@@ -5,16 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import {swapLocale} from './swap-locale.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {LH.FlowResult} flowResult
|
|
12
12
|
* @param {LH.Locale} locale
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
function swapFlowLocale(flowResult, locale) {
|
|
15
15
|
const localizedFlowResult = JSON.parse(JSON.stringify(flowResult));
|
|
16
16
|
localizedFlowResult.steps = flowResult.steps.map(step => {
|
|
17
17
|
return {...step, lhr: swapLocale(step.lhr, locale).lhr};
|
|
18
18
|
});
|
|
19
19
|
return localizedFlowResult;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
swapFlowLocale,
|
|
20
24
|
};
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import _set from 'lodash/set.js';
|
|
9
|
+
import _get from 'lodash/get.js';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
import * as format from './format.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @fileoverview Use the lhr.i18n.icuMessagePaths object to change locales.
|
|
@@ -110,4 +110,4 @@ function swapLocale(lhr, requestedLocale) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
export {swapLocale};
|
|
@@ -5,18 +5,16 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import path from 'path';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import * as i18n from '../../../core/lib/i18n/i18n.js';
|
|
11
|
+
import * as constants from '../../../core/config/constants.js';
|
|
12
|
+
import * as format from '../../localization/format.js';
|
|
13
|
+
import {locales} from '../../localization/locales.js';
|
|
14
|
+
import {getModuleDirectory, getModulePath} from '../../../esm-utils.js';
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let constants;
|
|
16
|
-
before(async () => {
|
|
17
|
-
i18n = await import('../../../core/lib/i18n/i18n.js');
|
|
18
|
-
constants = await import('../../../core/config/constants.js');
|
|
19
|
-
});
|
|
16
|
+
const moduleDir = getModuleDirectory(import.meta);
|
|
17
|
+
const modulePath = getModulePath(import.meta);
|
|
20
18
|
|
|
21
19
|
describe('format', () => {
|
|
22
20
|
describe('DEFAULT_LOCALE', () => {
|
|
@@ -83,7 +81,7 @@ describe('format', () => {
|
|
|
83
81
|
|
|
84
82
|
describe('#replaceIcuMessages', () => {
|
|
85
83
|
it('replaces the references in the LHR', () => {
|
|
86
|
-
const fakeFile = path.join(
|
|
84
|
+
const fakeFile = path.join(moduleDir, 'fake-file-number-2.js');
|
|
87
85
|
const UIStrings = {aString: 'different {x}!'};
|
|
88
86
|
const formatter = i18n.createIcuMessageFn(fakeFile, UIStrings);
|
|
89
87
|
|
|
@@ -115,14 +113,14 @@ describe('format', () => {
|
|
|
115
113
|
describe('#getFormatted', () => {
|
|
116
114
|
it('returns the formatted string', () => {
|
|
117
115
|
const UIStrings = {testMessage: 'happy test'};
|
|
118
|
-
const str_ = i18n.createIcuMessageFn(
|
|
116
|
+
const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
|
|
119
117
|
const formattedStr = format.getFormatted(str_(UIStrings.testMessage), 'en');
|
|
120
118
|
expect(formattedStr).toEqual('happy test');
|
|
121
119
|
});
|
|
122
120
|
|
|
123
121
|
it('returns the formatted string with replacements', () => {
|
|
124
122
|
const UIStrings = {testMessage: 'replacement test ({errorCode})'};
|
|
125
|
-
const str_ = i18n.createIcuMessageFn(
|
|
123
|
+
const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
|
|
126
124
|
const formattedStr = format.getFormatted(str_(UIStrings.testMessage,
|
|
127
125
|
{errorCode: 'BOO'}), 'en');
|
|
128
126
|
expect(formattedStr).toEqual('replacement test (BOO)');
|
|
@@ -131,7 +129,7 @@ describe('format', () => {
|
|
|
131
129
|
it('throws an error for invalid locales', () => {
|
|
132
130
|
// Populate a string to try to localize to a bad locale.
|
|
133
131
|
const UIStrings = {testMessage: 'testy test'};
|
|
134
|
-
const str_ = i18n.createIcuMessageFn(
|
|
132
|
+
const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
|
|
135
133
|
|
|
136
134
|
expect(_ => format.getFormatted(str_(UIStrings.testMessage), 'still-not-a-locale'))
|
|
137
135
|
.toThrow(`Unsupported locale 'still-not-a-locale'`);
|
|
@@ -141,7 +139,7 @@ describe('format', () => {
|
|
|
141
139
|
const UIStrings = {
|
|
142
140
|
testMessage: 'needs {count, number, bytes}KB test {str} in {timeInMs, number, seconds}s',
|
|
143
141
|
};
|
|
144
|
-
const str_ = i18n.createIcuMessageFn(
|
|
142
|
+
const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
|
|
145
143
|
|
|
146
144
|
const replacements = {
|
|
147
145
|
count: 2555,
|
|
@@ -172,8 +170,7 @@ describe('format', () => {
|
|
|
172
170
|
|
|
173
171
|
describe('#registerLocaleData', () => {
|
|
174
172
|
// Store original locale data so we can restore at the end
|
|
175
|
-
const
|
|
176
|
-
const clonedLocales = JSON.parse(JSON.stringify(moduleLocales));
|
|
173
|
+
const clonedLocales = JSON.parse(JSON.stringify(locales));
|
|
177
174
|
|
|
178
175
|
it('installs new locale strings', () => {
|
|
179
176
|
const localeData = {
|
|
@@ -184,7 +181,7 @@ describe('format', () => {
|
|
|
184
181
|
format.registerLocaleData('en-XZ', localeData);
|
|
185
182
|
|
|
186
183
|
const UIStrings = {testString: 'en-US string!'};
|
|
187
|
-
const str_ = i18n.createIcuMessageFn(
|
|
184
|
+
const str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
|
|
188
185
|
const formattedStr = format.getFormatted(str_(UIStrings.testString), 'en-XZ');
|
|
189
186
|
expect(formattedStr).toEqual('en-XZ cuerda!');
|
|
190
187
|
});
|
|
@@ -217,7 +214,7 @@ describe('format', () => {
|
|
|
217
214
|
expect(newFailureTitle).toEqual('Does not use HTTPS');
|
|
218
215
|
|
|
219
216
|
// Restore overwritten strings to avoid messing with other tests
|
|
220
|
-
|
|
217
|
+
locales['es-419'] = clonedLocales['es-419'];
|
|
221
218
|
const title = format.getFormatted(str_(UIStrings.title), 'es-419');
|
|
222
219
|
expect(title).toEqual('Usa HTTPS');
|
|
223
220
|
});
|
|
@@ -324,7 +321,7 @@ describe('format', () => {
|
|
|
324
321
|
|
|
325
322
|
let str_;
|
|
326
323
|
before(() => {
|
|
327
|
-
str_ = i18n.createIcuMessageFn(
|
|
324
|
+
str_ = i18n.createIcuMessageFn(modulePath, UIStrings);
|
|
328
325
|
});
|
|
329
326
|
|
|
330
327
|
it('formats a basic message', () => {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import {locales} from '../../localization/locales.js';
|
|
9
|
+
import {strict as assert} from 'assert';
|
|
10
10
|
|
|
11
11
|
describe('locales', () => {
|
|
12
12
|
it('has only canonical (or expected-deprecated) language tags', () => {
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import {swapLocale} from '../../localization/swap-locale.js';
|
|
9
|
+
import {readJson} from '../../../core/test/test-utils.js';
|
|
9
10
|
|
|
10
|
-
const lhr =
|
|
11
|
+
const lhr = readJson('core/test/results/sample_v2.json');
|
|
11
12
|
|
|
12
13
|
describe('swap-locale', () => {
|
|
13
14
|
it('does not mutate the original lhr', () => {
|
package/shared/tsconfig.json
CHANGED
package/shared/type-verifiers.js
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "./tsconfig-base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
// TODO(esmodules): included to support require('file.json'). Remove on the switch to ES Modules.
|
|
5
4
|
"resolveJsonModule": true,
|
|
6
5
|
},
|
|
7
6
|
"references": [
|
|
@@ -24,13 +23,10 @@
|
|
|
24
23
|
"eslint-local-rules.cjs",
|
|
25
24
|
"third-party/axe/valid-langs.js",
|
|
26
25
|
|
|
27
|
-
// TODO(esmodules): JSON files included via resolveJsonModule. Removable on the switch to ES Modules.
|
|
28
|
-
"package.json",
|
|
29
26
|
"core/test/results/sample_v2.json",
|
|
30
27
|
"core/lib/sd-validation/assets/*.json",
|
|
31
28
|
"core/test/fixtures/unresolved-perflog.json",
|
|
32
29
|
"core/test/fixtures/traces/lcp-m78.devtools.log.json",
|
|
33
|
-
"third-party/snyk/snapshot.json",
|
|
34
30
|
"core/audits/byte-efficiency/polyfill-graph-data.json",
|
|
35
31
|
"shared/localization/locales/en-US.json",
|
|
36
32
|
],
|
|
@@ -102,7 +98,7 @@
|
|
|
102
98
|
"core/test/lib/tracehouse/main-thread-tasks-test.js",
|
|
103
99
|
"core/test/lib/tracehouse/task-summary-test.js",
|
|
104
100
|
"core/test/lib/tracehouse/trace-processor-test.js",
|
|
105
|
-
"core/test/lib/traces/
|
|
101
|
+
"core/test/lib/traces/metrics-trace-events-test.js",
|
|
106
102
|
"core/test/lib/url-shim-test.js",
|
|
107
103
|
"core/test/network-records-to-devtools-log-test.js",
|
|
108
104
|
"core/test/runner-test.js",
|
package/types/config.d.ts
CHANGED
|
@@ -57,19 +57,6 @@ declare module Config {
|
|
|
57
57
|
groups: Record<string, Group> | null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* Additional information about the context in which a Fraggle Rock config should be interpreted.
|
|
62
|
-
* This information is typically set by the CLI or other channel integrations.
|
|
63
|
-
*/
|
|
64
|
-
interface FRContext {
|
|
65
|
-
configPath?: string;
|
|
66
|
-
settingsOverrides?: SharedFlagsSettings & Pick<LH.Flags, 'plugins'>;
|
|
67
|
-
skipAboutBlank?: boolean;
|
|
68
|
-
logLevel?: string;
|
|
69
|
-
hostname?: string;
|
|
70
|
-
port?: number;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
60
|
interface SharedPassNavigationJson {
|
|
74
61
|
/**
|
|
75
62
|
* Controls the behavior when the navigation fails to complete (due to server error, no FCP, etc).
|
package/types/externs.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ declare global {
|
|
|
30
30
|
|
|
31
31
|
/** Used by FullPageScreenshot gatherer. */
|
|
32
32
|
__lighthouseNodesDontTouchOrAllVarianceGoesAway: Map<Element, string>;
|
|
33
|
-
|
|
33
|
+
__lighthouseExecutionContextUniqueIdentifier?: number;
|
|
34
34
|
|
|
35
35
|
/** Injected into the page when the `--debug` flag is used. */
|
|
36
36
|
continueLighthouseRun(): void;
|
package/types/lhr/settings.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export type ScreenEmulationSettings = {
|
|
|
71
71
|
disableStorageReset?: boolean;
|
|
72
72
|
/** Flag indicating that Lighthouse should pause after page load to wait for the user's permission to continue the audit. */
|
|
73
73
|
debugNavigation?: boolean;
|
|
74
|
+
/** If set to true, will skip the initial navigation to about:blank. This option is ignored when using the legacy navigation runner. */
|
|
75
|
+
skipAboutBlank?: boolean;
|
|
74
76
|
|
|
75
77
|
/** How Lighthouse should interpret this run in regards to scoring performance metrics and skipping mobile-only tests in desktop. Must be set even if throttling/emulation is being applied outside of Lighthouse. */
|
|
76
78
|
formFactor?: 'mobile'|'desktop';
|