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.
- package/changelog.md +5490 -0
- 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 +44 -0
- package/flow-report/src/i18n/localized-strings.js +11 -0
- package/flow-report/src/i18n/ui-strings.js +86 -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 +42 -24
- package/flow-report/src/summary/summary.tsx +32 -29
- 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 +79 -34
- package/flow-report/test/summary/summary-test.tsx +11 -17
- package/flow-report/test/topbar-test.tsx +68 -0
- package/flow-report/test/util-test.tsx +1 -12
- package/flow-report/tsconfig.json +1 -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.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 +9 -342
- 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 +422 -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 +111 -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 +111 -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 +2 -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 +377 -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
- package/dist/report/flow.js +0 -149
- package/dist/report/standalone.js +0 -228
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2018 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 locales = require('../../localization/locales.js');
|
|
9
|
+
const assert = require('assert').strict;
|
|
10
|
+
|
|
11
|
+
/* eslint-env jest */
|
|
12
|
+
|
|
13
|
+
describe('locales', () => {
|
|
14
|
+
it('has only canonical (or expected-deprecated) language tags', () => {
|
|
15
|
+
// Map of deprecated codes to their canonical version. Depending on the ICU
|
|
16
|
+
// version used to run Lighthouse/this test, these *may* come back as their
|
|
17
|
+
// substitute, not themselves.
|
|
18
|
+
const deprecatedCodes = {
|
|
19
|
+
in: 'id',
|
|
20
|
+
iw: 'he',
|
|
21
|
+
mo: 'ro',
|
|
22
|
+
tl: 'fil',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
for (const locale of Object.keys(locales)) {
|
|
26
|
+
const canonicalLocale = Intl.getCanonicalLocales(locale)[0];
|
|
27
|
+
const substitute = deprecatedCodes[locale];
|
|
28
|
+
assert.ok(locale === canonicalLocale || substitute === canonicalLocale,
|
|
29
|
+
`locale code '${locale}' not canonical ('${canonicalLocale}' found instead)`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Deprecation subsitutes should be removed from the test if no longer used.
|
|
33
|
+
for (const locale of Object.keys(deprecatedCodes)) {
|
|
34
|
+
assert.ok(locales[locale], `${locale} substitute should be removed from test`);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('has a base language prefix fallback for all supported languages', () => {
|
|
39
|
+
for (const locale of Object.keys(locales)) {
|
|
40
|
+
const basePrefix = locale.split('-')[0];
|
|
41
|
+
// The internet sez there is no canonical Chinese, so we exclude that one.
|
|
42
|
+
if (basePrefix !== 'zh') {
|
|
43
|
+
assert.ok(locales[basePrefix], `${locale} is missing a base fallback`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2019 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 swapLocale = require('../../localization/swap-locale.js');
|
|
9
|
+
const {isNode12SmallIcu} = require('../../../lighthouse-core/test/test-utils.js');
|
|
10
|
+
|
|
11
|
+
const lhr = require('../../../lighthouse-core/test/results/sample_v2.json');
|
|
12
|
+
|
|
13
|
+
/* eslint-env jest */
|
|
14
|
+
describe('swap-locale', () => {
|
|
15
|
+
// COMPAT: Node 12 only has 'en' by default. Skip these tests since they're all about swapping locales.
|
|
16
|
+
if (isNode12SmallIcu()) {
|
|
17
|
+
// Jest requires at least one test per suite.
|
|
18
|
+
it('throws if locale is not supported', () => {
|
|
19
|
+
// Even though 'pt' is requested, 'en' is all that's available.
|
|
20
|
+
expect(() => swapLocale(lhr, 'pt')).toThrow('Unsupported locale \'pt\'');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
it('does not mutate the original lhr', () => {
|
|
27
|
+
/** @type {LH.Result} */
|
|
28
|
+
const lhrClone = JSON.parse(JSON.stringify(lhr));
|
|
29
|
+
|
|
30
|
+
const lhrPt = swapLocale(lhr, 'pt').lhr;
|
|
31
|
+
expect(lhrPt).not.toStrictEqual(lhr);
|
|
32
|
+
expect(lhr).toStrictEqual(lhrClone);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('can change golden LHR english strings into german', () => {
|
|
36
|
+
/** @type {LH.Result} */
|
|
37
|
+
const lhrEn = JSON.parse(JSON.stringify(lhr));
|
|
38
|
+
const lhrDe = swapLocale(lhrEn, 'de').lhr;
|
|
39
|
+
|
|
40
|
+
// Basic replacement
|
|
41
|
+
expect(lhrEn.audits.plugins.title).toEqual('Document avoids plugins');
|
|
42
|
+
expect(lhrDe.audits.plugins.title).toEqual('Dokument verwendet keine Plug-ins');
|
|
43
|
+
|
|
44
|
+
// With ICU string argument values
|
|
45
|
+
expect(lhrEn.audits['dom-size'].displayValue).toMatchInlineSnapshot(`"153 elements"`);
|
|
46
|
+
/* eslint-disable no-irregular-whitespace */
|
|
47
|
+
expect(lhrDe.audits['dom-size'].displayValue).toMatchInlineSnapshot(`"153 Elemente"`);
|
|
48
|
+
|
|
49
|
+
// Renderer formatted strings
|
|
50
|
+
expect(lhrEn.i18n.rendererFormattedStrings.labDataTitle).toEqual('Lab Data');
|
|
51
|
+
expect(lhrDe.i18n.rendererFormattedStrings.labDataTitle).toEqual('Labdaten');
|
|
52
|
+
|
|
53
|
+
// Formatted numbers in placeholders.
|
|
54
|
+
expect(lhrEn.audits['mainthread-work-breakdown'].displayValue).
|
|
55
|
+
toMatchInlineSnapshot(`"2.2 s"`);
|
|
56
|
+
expect(lhrDe.audits['mainthread-work-breakdown'].displayValue).
|
|
57
|
+
toMatchInlineSnapshot(`"2,2 s"`);
|
|
58
|
+
/* eslint-enable no-irregular-whitespace */
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('can roundtrip back to english correctly', () => {
|
|
62
|
+
/** @type {LH.Result} */
|
|
63
|
+
const lhrEn = JSON.parse(JSON.stringify(lhr));
|
|
64
|
+
|
|
65
|
+
// via Spanish
|
|
66
|
+
const lhrEnEsRT = swapLocale(swapLocale(lhrEn, 'es').lhr, 'en-US').lhr;
|
|
67
|
+
expect(lhrEnEsRT).toEqual(lhrEn);
|
|
68
|
+
|
|
69
|
+
// via Arabic
|
|
70
|
+
const lhrEnArRT = swapLocale(swapLocale(lhrEn, 'ar').lhr, 'en-US').lhr;
|
|
71
|
+
expect(lhrEnArRT).toEqual(lhrEn);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('leaves alone messages where there is no translation available', () => {
|
|
75
|
+
const miniLHR = {
|
|
76
|
+
audits: {
|
|
77
|
+
redirects: {
|
|
78
|
+
id: 'redirects',
|
|
79
|
+
title: 'Avoid multiple page redirects',
|
|
80
|
+
doesntExist: 'A string that does not have localized versions',
|
|
81
|
+
},
|
|
82
|
+
fakeaudit: {
|
|
83
|
+
id: 'fakeaudit',
|
|
84
|
+
title: 'An audit without translations',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
configSettings: {
|
|
88
|
+
locale: 'en-US',
|
|
89
|
+
},
|
|
90
|
+
i18n: {
|
|
91
|
+
icuMessagePaths: {
|
|
92
|
+
'lighthouse-core/audits/redirects.js | title': ['audits.redirects.title'],
|
|
93
|
+
// File that exists, but `doesntExist` message within it does not.
|
|
94
|
+
'lighthouse-core/audits/redirects.js | doesntExist': ['audits.redirects.doesntExist'],
|
|
95
|
+
// File and message which do not exist.
|
|
96
|
+
'lighthouse-core/audits/fakeaudit.js | title': ['audits.fakeaudit.title'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
const {missingIcuMessageIds} = swapLocale(miniLHR, 'es');
|
|
101
|
+
|
|
102
|
+
// Updated strings are not found, so these remain in the original language
|
|
103
|
+
expect(missingIcuMessageIds).toMatchInlineSnapshot(`
|
|
104
|
+
Array [
|
|
105
|
+
"lighthouse-core/audits/redirects.js | doesntExist",
|
|
106
|
+
"lighthouse-core/audits/fakeaudit.js | title",
|
|
107
|
+
]
|
|
108
|
+
`);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('does not change properties that are not strings', () => {
|
|
112
|
+
// Unlikely, but possible e.g. if an audit details changed shape over LH versions.
|
|
113
|
+
const miniLhr = {
|
|
114
|
+
audits: {
|
|
115
|
+
redirects: {
|
|
116
|
+
id: 'redirects',
|
|
117
|
+
title: 'Avoid multiple page redirects',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
configSettings: {
|
|
121
|
+
locale: 'en-US',
|
|
122
|
+
},
|
|
123
|
+
i18n: {
|
|
124
|
+
icuMessagePaths: {
|
|
125
|
+
// Points to audit object, not string.
|
|
126
|
+
'lighthouse-core/audits/redirects.js | title': ['audits.redirects'],
|
|
127
|
+
// Path does not point to anything in LHR.
|
|
128
|
+
'lighthouse-core/audits/redirects.js | description': ['gatherers..X'],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
const testLocale = 'ru';
|
|
133
|
+
const {lhr} = swapLocale(miniLhr, testLocale);
|
|
134
|
+
|
|
135
|
+
// LHR remains unchanged except for locale and injected `rendererFormattedStrings`.
|
|
136
|
+
miniLhr.configSettings.locale = testLocale;
|
|
137
|
+
miniLhr.i18n.rendererFormattedStrings = expect.any(Object);
|
|
138
|
+
expect(lhr).toEqual(miniLhr);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig-base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../.tmp/tsbuildinfo/shared/",
|
|
5
|
+
|
|
6
|
+
// Limit defs to base JS.
|
|
7
|
+
"lib": ["es2020"],
|
|
8
|
+
// Only include `@types/node` from node_modules/.
|
|
9
|
+
"types": ["node"],
|
|
10
|
+
// "listFiles": true,
|
|
11
|
+
},
|
|
12
|
+
"references": [
|
|
13
|
+
{"path": "../types/lhr/"},
|
|
14
|
+
],
|
|
15
|
+
"include": [
|
|
16
|
+
"**/*.js",
|
|
17
|
+
"types/**/*.d.ts",
|
|
18
|
+
],
|
|
19
|
+
"exclude": [
|
|
20
|
+
"test/**/*.js",
|
|
21
|
+
],
|
|
22
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
7
|
+
import {IcuMessage as IcuMessage_} from '../../types/lhr/i18n';
|
|
8
|
+
import LHResult from '../../types/lhr/lhr';
|
|
9
|
+
import FlowResult_ from '../../types/lhr/flow';
|
|
10
|
+
|
|
11
|
+
import {Locale as Locale_} from '../../types/lhr/settings';
|
|
12
|
+
|
|
13
|
+
declare global {
|
|
14
|
+
// Expose global types in LH namespace.
|
|
15
|
+
module LH {
|
|
16
|
+
export import Result = LHResult;
|
|
17
|
+
export import FlowResult = FlowResult_;
|
|
18
|
+
export type IcuMessage = IcuMessage_;
|
|
19
|
+
export type IcuMessagePaths = LHResult.IcuMessagePaths;
|
|
20
|
+
export type Locale = Locale_;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const fetch = require('node-fetch');
|
|
10
|
-
const {LH_ROOT} = require('
|
|
10
|
+
const {LH_ROOT} = require('../../root.js');
|
|
11
11
|
|
|
12
12
|
const inspectorIssuesGathererPath = LH_ROOT +
|
|
13
13
|
'/lighthouse-core/gather/gatherers/inspector-issues.js';
|
|
@@ -31,7 +31,8 @@ describe('issueAdded types', () => {
|
|
|
31
31
|
.sort();
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
// TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
|
|
35
|
+
it.skip('should notify us if something changed', () => {
|
|
35
36
|
expect(inspectorIssueDetailsTypes).toMatchInlineSnapshot(`
|
|
36
37
|
Array [
|
|
37
38
|
"blockedByResponseIssueDetails",
|
|
@@ -44,7 +45,8 @@ describe('issueAdded types', () => {
|
|
|
44
45
|
`);
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
// TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
|
|
49
|
+
it.skip('are each handled explicitly in the gatherer', () => {
|
|
48
50
|
// Regex relies on the typecasts
|
|
49
51
|
const sourceTypeMatches = inspectorIssuesGathererSource.matchAll(
|
|
50
52
|
/LH\.Crdp\.Audits\.(.*?Details)>/g
|
|
@@ -74,7 +74,8 @@ Array [
|
|
|
74
74
|
`);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
// TODO: https://github.com/GoogleChrome/lighthouse/issues/13147
|
|
78
|
+
it.skip('are each handled explicitly in the gatherer', () => {
|
|
78
79
|
const errorStrings = Object.keys(InstallableManifestAudit.UIStrings)
|
|
79
80
|
.filter(key => chromiumErrorIds.includes(key))
|
|
80
81
|
.sort();
|
package/tsconfig-all.json
CHANGED
package/tsconfig-base.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
{"path": "./types/lhr/"},
|
|
11
11
|
{"path": "./report/"},
|
|
12
12
|
{"path": "./report/generator/"},
|
|
13
|
+
{"path": "./shared/"},
|
|
13
14
|
],
|
|
14
15
|
"include": [
|
|
15
16
|
"root.js",
|
|
@@ -22,13 +23,13 @@
|
|
|
22
23
|
|
|
23
24
|
// TODO(esmodules): JSON files included via resolveJsonModule. Removable on the switch to ES Modules.
|
|
24
25
|
"package.json",
|
|
25
|
-
"lighthouse-core/lib/i18n/locales/en-US.json",
|
|
26
26
|
"lighthouse-core/test/results/sample_v2.json",
|
|
27
27
|
"lighthouse-core/lib/sd-validation/assets/*.json",
|
|
28
28
|
"lighthouse-core/test/fixtures/unresolved-perflog.json",
|
|
29
29
|
"lighthouse-core/test/fixtures/traces/lcp-m78.devtools.log.json",
|
|
30
30
|
"third-party/snyk/snapshot.json",
|
|
31
31
|
"lighthouse-core/audits/byte-efficiency/polyfill-graph-data.json",
|
|
32
|
+
"shared/localization/locales/en-US.json",
|
|
32
33
|
],
|
|
33
34
|
"exclude": [
|
|
34
35
|
"lighthouse-core/test/audits/**/*.js",
|
|
@@ -79,8 +80,6 @@
|
|
|
79
80
|
"lighthouse-core/test/lib/dependency-graph/simulator/simulator-test.js",
|
|
80
81
|
"lighthouse-core/test/lib/emulation-test.js",
|
|
81
82
|
"lighthouse-core/test/lib/i18n/i18n-test.js",
|
|
82
|
-
"lighthouse-core/test/lib/i18n/locales-test.js",
|
|
83
|
-
"lighthouse-core/test/lib/i18n/swap-locale-test.js",
|
|
84
83
|
"lighthouse-core/test/lib/icons-test.js",
|
|
85
84
|
"lighthouse-core/test/lib/lh-element-test.js",
|
|
86
85
|
"lighthouse-core/test/lib/manifest-parser-test.js",
|
package/types/config.d.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Types for the `es-main` npm module.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Test if an ES module is run directly with Node.js.
|
|
13
|
+
* @param importMeta `import.meta`
|
|
14
|
+
*/
|
|
15
|
+
declare function esMain(importMeta: ImportMeta): boolean;
|
|
16
|
+
declare module 'es-main' {
|
|
17
|
+
export = esMain;
|
|
18
|
+
}
|
package/types/externs.d.ts
CHANGED
|
@@ -155,6 +155,8 @@ export interface CliFlags extends Flags {
|
|
|
155
155
|
enableErrorReporting?: boolean;
|
|
156
156
|
/** Flag to print a list of all audits + categories. */
|
|
157
157
|
listAllAudits: boolean;
|
|
158
|
+
/** Flag to print a list of all supported locales. */
|
|
159
|
+
listLocales: boolean;
|
|
158
160
|
/** Flag to print a list of all required trace categories. */
|
|
159
161
|
listTraceCategories: boolean;
|
|
160
162
|
/** A preset audit of selected audit categories to run. */
|
package/types/lhr/flow.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ declare module FlowResult {
|
|
|
11
11
|
lhr: Result;
|
|
12
12
|
name: string;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
interface LhrRef {
|
|
16
|
+
value: Result;
|
|
17
|
+
index: number;
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
/**
|
|
@@ -19,6 +24,8 @@ declare module FlowResult {
|
|
|
19
24
|
interface FlowResult {
|
|
20
25
|
/** Ordered list of flow steps, each corresponding to a navigation, timespan, or snapshot. */
|
|
21
26
|
steps: FlowResult.Step[];
|
|
27
|
+
/** Name given to this user flow. */
|
|
28
|
+
name: string;
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
export default FlowResult;
|
package/types/lhr/i18n.d.ts
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
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
|
|
|
7
|
-
// TODO(bckenny): i18n types should not be necessary for the LHR, but too difficult
|
|
8
|
-
// to unravel from audit-details right now.
|
|
9
|
-
|
|
10
7
|
export type IcuMessage = {
|
|
11
8
|
// NOTE: `i18nId` rather than just `id` to make tsc typing easier (vs type branding which won't survive JSON roundtrip).
|
|
12
9
|
/** The id locating this message in the locale message json files. */
|