lighthouse 9.5.0-dev.20221005 → 9.5.0-dev.20221007
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/test/smokehouse/smokehouse.js +1 -1
- package/core/audits/accessibility/aria-meter-name.js +2 -2
- package/core/audits/accessibility/aria-tooltip-name.js +2 -2
- package/core/audits/accessibility/manual/custom-controls-labels.js +1 -1
- package/core/audits/accessibility/manual/custom-controls-roles.js +1 -1
- package/core/audits/accessibility/manual/focus-traps.js +1 -1
- package/core/audits/accessibility/manual/focusable-controls.js +1 -1
- package/core/audits/accessibility/manual/interactive-element-affordance.js +1 -1
- package/core/audits/accessibility/manual/logical-tab-order.js +1 -1
- package/core/audits/accessibility/manual/managed-focus.js +1 -1
- package/core/audits/accessibility/manual/offscreen-content-hidden.js +1 -1
- package/core/audits/accessibility/manual/use-landmarks.js +1 -1
- package/core/audits/accessibility/manual/visual-order-follows-dom.js +1 -1
- package/core/config/default-config.js +1 -1
- package/core/lib/i18n/README.md +22 -5
- package/dist/report/bundle.esm.js +1 -1
- package/dist/report/flow.js +23 -28
- package/dist/report/standalone.js +1 -1
- package/flow-report/src/i18n/i18n.tsx +1 -1
- package/flow-report/test/flow-report-pptr-test.ts +16 -0
- package/package.json +2 -2
- package/readme.md +2 -2
- package/report/generator/report-generator.js +4 -1
- package/report/renderer/dom.js +1 -1
- package/report/test/generator/file-namer-test.js +1 -1
- package/report/test/generator/report-generator-test.js +1 -1
- package/report/test/renderer/category-renderer-test.js +1 -1
- package/report/test/renderer/crc-details-renderer-test.js +1 -1
- package/report/test/renderer/details-renderer-test.js +1 -1
- package/report/test/renderer/dom-test.js +1 -1
- package/report/test/renderer/i18n-test.js +1 -1
- package/report/test/renderer/performance-category-renderer-test.js +1 -1
- package/report/test/renderer/pwa-category-renderer-test.js +1 -1
- package/report/test/renderer/report-renderer-test.js +2 -2
- package/report/test/renderer/report-ui-features-test.js +1 -1
- package/report/test/renderer/snippet-renderer-test.js +1 -1
- package/report/test/renderer/util-test.js +1 -1
- package/shared/localization/locales/en-US.json +3 -3
- package/shared/localization/locales/en-XL.json +3 -3
- package/shared/test/localization/locales-test.js +1 -1
- package/tsconfig.json +0 -1
- package/types/global-lh.d.ts +2 -2
- package/types/puppeteer.d.ts +22 -0
- package/changelog.md +0 -5902
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import puppeteer, {Browser, Page} from 'puppeteer';
|
|
8
8
|
|
|
9
9
|
import {ReportGenerator} from '../../report/generator/report-generator.js';
|
|
10
|
+
import {swapFlowLocale} from '../../shared/localization/swap-flow-locale.js';
|
|
10
11
|
import {flowResult} from './sample-flow';
|
|
11
12
|
|
|
12
13
|
describe('Lighthouse Flow Report', () => {
|
|
@@ -40,4 +41,19 @@ describe('Lighthouse Flow Report', () => {
|
|
|
40
41
|
expect(pageErrors).toHaveLength(0);
|
|
41
42
|
});
|
|
42
43
|
});
|
|
44
|
+
|
|
45
|
+
describe('Renders the flow report (i18n)', () => {
|
|
46
|
+
before(async () => {
|
|
47
|
+
const html = ReportGenerator.generateFlowReportHtml(swapFlowLocale(flowResult, 'es'));
|
|
48
|
+
await page.setContent(html);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should load with no errors', async () => {
|
|
52
|
+
expect(pageErrors).toHaveLength(0);
|
|
53
|
+
const el = await page.$('.SummarySectionHeader__content');
|
|
54
|
+
if (!el) throw new Error();
|
|
55
|
+
const text = await el.evaluate(el => el.textContent);
|
|
56
|
+
expect(text).toEqual('Todos los informes');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
43
59
|
}).timeout(35_000);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.5.0-dev.
|
|
4
|
+
"version": "9.5.0-dev.20221007",
|
|
5
5
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
6
6
|
"main": "./core/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"smokehouse": "./cli/test/smokehouse/frontends/smokehouse-bin.js"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
|
-
"node": ">=
|
|
13
|
+
"node": ">=16.16"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"prepack": "yarn build-report --standalone --flow --esm",
|
package/readme.md
CHANGED
|
@@ -52,7 +52,7 @@ The Chrome extension was available prior to Lighthouse being available in Chrome
|
|
|
52
52
|
|
|
53
53
|
The Node CLI provides the most flexibility in how Lighthouse runs can be configured and reported. Users who want more advanced usage, or want to run Lighthouse in an automated fashion should use the Node CLI.
|
|
54
54
|
|
|
55
|
-
_Lighthouse requires Node
|
|
55
|
+
_Lighthouse requires Node 16 LTS (16.x) or later._
|
|
56
56
|
|
|
57
57
|
**Installation**:
|
|
58
58
|
|
|
@@ -456,7 +456,7 @@ machine. Report results are never processed or beaconed to a remote server.
|
|
|
456
456
|
|
|
457
457
|
Starting in Lighthouse 8.0, Lighthouse relies entirely on native `Intl` support and no longer uses an `Intl` polyfill. If you're using Node 14 or later, there should be no issue because Node is now [built with `full-icu` by default](https://nodejs.medium.com/node-js-12-to-lts-and-node-js-13-is-here-e28d6a4a2bd#9514).
|
|
458
458
|
|
|
459
|
-
However, if you're using a `small-icu` Node build, you may see Lighthouse log messages about your locale not being available. To remedy this, you can
|
|
459
|
+
However, if you're using a `small-icu` Node build, you may see Lighthouse log messages about your locale not being available. To remedy this, you can manually install ICU data by using the [`full-icu`](https://www.npmjs.com/package/full-icu) module and the [`--icu-data-dir` node flag](https://nodejs.org/api/intl.html#intl_providing_icu_data_at_runtime) at launch.
|
|
460
460
|
|
|
461
461
|
### How do I author custom audits to extend Lighthouse?
|
|
462
462
|
|
|
@@ -65,10 +65,13 @@ class ReportGenerator {
|
|
|
65
65
|
*/
|
|
66
66
|
static generateFlowReportHtml(flow) {
|
|
67
67
|
const sanitizedJson = ReportGenerator.sanitizeJson(flow);
|
|
68
|
+
// terser does its own sanitization, but keep this basic replace for when
|
|
69
|
+
// we want to generate a report without minification.
|
|
70
|
+
const sanitizedJavascript = reportAssets.FLOW_REPORT_JAVASCRIPT.replace(/<\//g, '\\u003c/');
|
|
68
71
|
return ReportGenerator.replaceStrings(reportAssets.FLOW_REPORT_TEMPLATE, [
|
|
69
72
|
/* eslint-disable max-len */
|
|
70
73
|
{search: '%%LIGHTHOUSE_FLOW_JSON%%', replacement: sanitizedJson},
|
|
71
|
-
{search: '%%LIGHTHOUSE_FLOW_JAVASCRIPT%%', replacement:
|
|
74
|
+
{search: '%%LIGHTHOUSE_FLOW_JAVASCRIPT%%', replacement: sanitizedJavascript},
|
|
72
75
|
{search: '/*%%LIGHTHOUSE_FLOW_CSS%%*/', replacement: reportAssets.FLOW_REPORT_CSS},
|
|
73
76
|
/* eslint-enable max-len */
|
|
74
77
|
]);
|
package/report/renderer/dom.js
CHANGED
|
@@ -146,7 +146,7 @@ export class DOM {
|
|
|
146
146
|
// Otherwise, append any links found.
|
|
147
147
|
const url = new URL(segment.linkHref);
|
|
148
148
|
|
|
149
|
-
const DOCS_ORIGINS = ['https://developers.google.com', 'https://web.dev'];
|
|
149
|
+
const DOCS_ORIGINS = ['https://developers.google.com', 'https://web.dev', 'https://developer.chrome.com'];
|
|
150
150
|
if (DOCS_ORIGINS.includes(url.origin)) {
|
|
151
151
|
url.searchParams.set('utm_source', 'lighthouse');
|
|
152
152
|
url.searchParams.set('utm_medium', this._lighthouseChannel);
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jestMock from 'jest-mock';
|
|
10
10
|
import jsdom from 'jsdom';
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import {Util} from '../../renderer/util.js';
|
|
10
10
|
import {I18n} from '../../renderer/i18n.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
import jestMock from 'jest-mock';
|
|
@@ -232,7 +232,7 @@ describe('ReportRenderer', () => {
|
|
|
232
232
|
const container = renderer._dom.document().body;
|
|
233
233
|
const output = renderer.renderReport(sampleResults, container);
|
|
234
234
|
|
|
235
|
-
const DOCS_ORIGINS = ['https://developers.google.com', 'https://web.dev'];
|
|
235
|
+
const DOCS_ORIGINS = ['https://developers.google.com', 'https://web.dev', 'https://developer.chrome.com'];
|
|
236
236
|
const utmChannels = [...output.querySelectorAll('a[href*="utm_source=lighthouse"')]
|
|
237
237
|
.map(a => new URL(a.href))
|
|
238
238
|
.filter(url => DOCS_ORIGINS.includes(url.origin))
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
import jestMock from 'jest-mock';
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import jsdom from 'jsdom';
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import {Util} from '../../renderer/util.js';
|
|
10
10
|
import {I18n} from '../../renderer/i18n.js';
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"message": "ARIA input fields have accessible names"
|
|
55
55
|
},
|
|
56
56
|
"core/audits/accessibility/aria-meter-name.js | description": {
|
|
57
|
-
"message": "When
|
|
57
|
+
"message": "When a meter element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers. [Learn how to name `meter` elements](https://dequeuniversity.com/rules/axe/4.4/aria-meter-name)."
|
|
58
58
|
},
|
|
59
59
|
"core/audits/accessibility/aria-meter-name.js | failureTitle": {
|
|
60
60
|
"message": "ARIA `meter` elements do not have accessible names."
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"message": "ARIA toggle fields have accessible names"
|
|
118
118
|
},
|
|
119
119
|
"core/audits/accessibility/aria-tooltip-name.js | description": {
|
|
120
|
-
"message": "When
|
|
120
|
+
"message": "When a tooltip element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers. [Learn how to name `tooltip` elements](https://dequeuniversity.com/rules/axe/4.4/aria-tooltip-name)."
|
|
121
121
|
},
|
|
122
122
|
"core/audits/accessibility/aria-tooltip-name.js | failureTitle": {
|
|
123
123
|
"message": "ARIA `tooltip` elements do not have accessible names."
|
|
@@ -1536,7 +1536,7 @@
|
|
|
1536
1536
|
"message": "Best practices"
|
|
1537
1537
|
},
|
|
1538
1538
|
"core/config/default-config.js | a11yCategoryDescription": {
|
|
1539
|
-
"message": "These checks highlight opportunities to [improve the accessibility of your web app](https://
|
|
1539
|
+
"message": "These checks highlight opportunities to [improve the accessibility of your web app](https://developer.chrome.com/docs/lighthouse/accessibility/). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged."
|
|
1540
1540
|
},
|
|
1541
1541
|
"core/config/default-config.js | a11yCategoryManualDescription": {
|
|
1542
1542
|
"message": "These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://web.dev/how-to-review/)."
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"message": "ÂŔÎÁ îńp̂út̂ f́îél̂d́ŝ h́âv́ê áĉćêśŝíb̂ĺê ńâḿêś"
|
|
55
55
|
},
|
|
56
56
|
"core/audits/accessibility/aria-meter-name.js | description": {
|
|
57
|
-
"message": "Ŵh́êń â
|
|
57
|
+
"message": "Ŵh́êń â ḿêt́êŕ êĺêḿêńt̂ d́ôéŝń't̂ h́âv́ê án̂ áĉćêśŝíb̂ĺê ńâḿê, śĉŕêén̂ ŕêád̂ér̂ś âńn̂óûńĉé ît́ ŵít̂h́ â ǵêńêŕîć n̂ám̂é, m̂ák̂ín̂ǵ ît́ ûńûśâb́l̂é f̂ór̂ úŝér̂ś ŵh́ô ŕêĺŷ ón̂ śĉŕêén̂ ŕêád̂ér̂ś. [L̂éâŕn̂ h́ôẃ t̂ó n̂ám̂é `meter` êĺêḿêńt̂ś](https://dequeuniversity.com/rules/axe/4.4/aria-meter-name)."
|
|
58
58
|
},
|
|
59
59
|
"core/audits/accessibility/aria-meter-name.js | failureTitle": {
|
|
60
60
|
"message": "ÂŔÎÁ `meter` êĺêḿêńt̂ś d̂ó n̂ót̂ h́âv́ê áĉćêśŝíb̂ĺê ńâḿêś."
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"message": "ÂŔÎÁ t̂óĝǵl̂é f̂íêĺd̂ś ĥáv̂é âćĉéŝśîb́l̂é n̂ám̂éŝ"
|
|
118
118
|
},
|
|
119
119
|
"core/audits/accessibility/aria-tooltip-name.js | description": {
|
|
120
|
-
"message": "Ŵh́êń â
|
|
120
|
+
"message": "Ŵh́êń â t́ôól̂t́îṕ êĺêḿêńt̂ d́ôéŝń't̂ h́âv́ê án̂ áĉćêśŝíb̂ĺê ńâḿê, śĉŕêén̂ ŕêád̂ér̂ś âńn̂óûńĉé ît́ ŵít̂h́ â ǵêńêŕîć n̂ám̂é, m̂ák̂ín̂ǵ ît́ ûńûśâb́l̂é f̂ór̂ úŝér̂ś ŵh́ô ŕêĺŷ ón̂ śĉŕêén̂ ŕêád̂ér̂ś. [L̂éâŕn̂ h́ôẃ t̂ó n̂ám̂é `tooltip` êĺêḿêńt̂ś](https://dequeuniversity.com/rules/axe/4.4/aria-tooltip-name)."
|
|
121
121
|
},
|
|
122
122
|
"core/audits/accessibility/aria-tooltip-name.js | failureTitle": {
|
|
123
123
|
"message": "ÂŔÎÁ `tooltip` êĺêḿêńt̂ś d̂ó n̂ót̂ h́âv́ê áĉćêśŝíb̂ĺê ńâḿêś."
|
|
@@ -1536,7 +1536,7 @@
|
|
|
1536
1536
|
"message": "B̂éŝt́ p̂ŕâćt̂íĉéŝ"
|
|
1537
1537
|
},
|
|
1538
1538
|
"core/config/default-config.js | a11yCategoryDescription": {
|
|
1539
|
-
"message": "T̂h́êśê ćĥéĉḱŝ h́îǵĥĺîǵĥt́ ôṕp̂ór̂t́ûńît́îéŝ t́ô [ím̂ṕr̂óv̂é t̂h́ê áĉćêśŝíb̂íl̂ít̂ý ôf́ ŷóûŕ ŵéb̂ áp̂ṕ](https://
|
|
1539
|
+
"message": "T̂h́êśê ćĥéĉḱŝ h́îǵĥĺîǵĥt́ ôṕp̂ór̂t́ûńît́îéŝ t́ô [ím̂ṕr̂óv̂é t̂h́ê áĉćêśŝíb̂íl̂ít̂ý ôf́ ŷóûŕ ŵéb̂ áp̂ṕ](https://developer.chrome.com/docs/lighthouse/accessibility/). Ôńl̂ý â śûb́ŝét̂ óf̂ áĉćêśŝíb̂íl̂ít̂ý îśŝúêś ĉán̂ b́ê áût́ôḿât́îćâĺl̂ý d̂ét̂éĉt́êd́ ŝó m̂án̂úâĺ t̂éŝt́îńĝ íŝ ál̂śô én̂ćôúr̂áĝéd̂."
|
|
1540
1540
|
},
|
|
1541
1541
|
"core/config/default-config.js | a11yCategoryManualDescription": {
|
|
1542
1542
|
"message": "T̂h́êśê ít̂ém̂ś âd́d̂ŕêśŝ ár̂éâś ŵh́îćĥ án̂ áût́ôḿât́êd́ t̂éŝt́îńĝ t́ôól̂ ćâńn̂ót̂ ćôv́êŕ. L̂éâŕn̂ ḿôŕê ín̂ óûŕ ĝúîd́ê ón̂ [ćôńd̂úĉt́îńĝ án̂ áĉćêśŝíb̂íl̂ít̂ý r̂év̂íêẃ](https://web.dev/how-to-review/)."
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import
|
|
7
|
+
import assert from 'assert/strict';
|
|
8
8
|
|
|
9
9
|
import {locales} from '../../localization/locales.js';
|
|
10
10
|
|
package/tsconfig.json
CHANGED
|
@@ -102,7 +102,6 @@
|
|
|
102
102
|
"core/test/runner-test.js",
|
|
103
103
|
"core/test/scoring-test.js",
|
|
104
104
|
"core/test/scripts/i18n/bake-ctc-to-lhl-test.js",
|
|
105
|
-
"core/test/scripts/i18n/collect-strings-test.js",
|
|
106
105
|
],
|
|
107
106
|
"files": [
|
|
108
107
|
// Opt-in to typechecking for some core tests and test-support files.
|
package/types/global-lh.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import Protocol_ from './protocol';
|
|
|
21
21
|
import * as Settings from './lhr/settings';
|
|
22
22
|
import Treemap_ from './lhr/treemap';
|
|
23
23
|
import UserFlow_ from './user-flow';
|
|
24
|
-
import
|
|
24
|
+
import Puppeteer_ from './puppeteer';
|
|
25
25
|
|
|
26
26
|
// Construct hierarchy of global types under the LH namespace.
|
|
27
27
|
declare global {
|
|
@@ -29,7 +29,7 @@ declare global {
|
|
|
29
29
|
export type ArbitraryEqualityMap = ArbitraryEqualityMap_;
|
|
30
30
|
export type NavigationRequestor = string | (() => Promise<void> | void);
|
|
31
31
|
|
|
32
|
-
export import Puppeteer =
|
|
32
|
+
export import Puppeteer = Puppeteer_;
|
|
33
33
|
|
|
34
34
|
// artifacts.d.ts
|
|
35
35
|
export import Artifacts = Artifacts_.Artifacts;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2022 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 puppeteer from 'puppeteer';
|
|
8
|
+
import puppeteerCore from 'puppeteer-core';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @fileoverview Lighthouse should be compatible with puppeteer and puppeteer-core even though the types can be slightly different between the two packages.
|
|
12
|
+
* Anytime we want to use a Puppeteer type within Lighthouse, we should pull the union type from here rather than one of the packages directly.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
declare module Puppeteer {
|
|
16
|
+
export type Browser = puppeteerCore.Browser | puppeteer.Browser;
|
|
17
|
+
export type Page = puppeteerCore.Page | puppeteer.Page;
|
|
18
|
+
export type CDPSession = puppeteerCore.CDPSession | puppeteer.CDPSession;
|
|
19
|
+
export type Connection = puppeteerCore.Connection | puppeteer.Connection;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Puppeteer;
|