lighthouse 9.5.0-dev.20220417 → 9.5.0-dev.20220420
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/dist/report/bundle.esm.js +117 -70
- package/dist/report/flow.js +23 -23
- package/dist/report/standalone.js +14 -14
- package/flow-report/src/summary/category.tsx +1 -1
- package/lighthouse-cli/.eslintrc.cjs +3 -4
- package/lighthouse-cli/bin.js +0 -1
- package/lighthouse-cli/cli-flags.js +0 -1
- package/lighthouse-cli/commands/commands.js +0 -1
- package/lighthouse-cli/commands/list-audits.js +0 -1
- package/lighthouse-cli/commands/list-locales.js +0 -1
- package/lighthouse-cli/commands/list-trace-categories.js +0 -1
- package/lighthouse-cli/index.js +0 -1
- package/lighthouse-cli/printer.js +0 -1
- package/lighthouse-cli/run.js +0 -1
- package/lighthouse-cli/sentry-prompt.js +0 -1
- package/lighthouse-cli/test/smokehouse/core-tests.js +0 -1
- package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +0 -1
- package/lighthouse-cli/test/smokehouse/frontends/lib.js +0 -1
- package/lighthouse-cli/test/smokehouse/frontends/node.js +0 -1
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -1
- package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +0 -1
- package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +0 -1
- package/lighthouse-cli/test/smokehouse/lib/local-console.js +0 -1
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +0 -1
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +0 -1
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +0 -1
- package/lighthouse-cli/test/smokehouse/report-assert.js +0 -1
- package/lighthouse-cli/test/smokehouse/smokehouse.js +0 -1
- package/lighthouse-core/audits/accessibility/accesskeys.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-allowed-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-command-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-hidden-body.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-hidden-focus.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-input-field-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-meter-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-progressbar-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-required-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-required-children.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-required-parent.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-roles.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-toggle-field-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-tooltip-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-valid-attr-value.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-valid-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/button-name.js +1 -1
- package/lighthouse-core/audits/accessibility/bypass.js +1 -1
- package/lighthouse-core/audits/accessibility/color-contrast.js +1 -1
- package/lighthouse-core/audits/accessibility/definition-list.js +1 -1
- package/lighthouse-core/audits/accessibility/dlitem.js +1 -1
- package/lighthouse-core/audits/accessibility/document-title.js +1 -1
- package/lighthouse-core/audits/accessibility/duplicate-id-active.js +1 -1
- package/lighthouse-core/audits/accessibility/duplicate-id-aria.js +1 -1
- package/lighthouse-core/audits/accessibility/form-field-multiple-labels.js +1 -1
- package/lighthouse-core/audits/accessibility/frame-title.js +1 -1
- package/lighthouse-core/audits/accessibility/heading-order.js +1 -1
- package/lighthouse-core/audits/accessibility/html-has-lang.js +1 -1
- package/lighthouse-core/audits/accessibility/html-lang-valid.js +1 -1
- package/lighthouse-core/audits/accessibility/image-alt.js +1 -1
- package/lighthouse-core/audits/accessibility/input-image-alt.js +1 -1
- package/lighthouse-core/audits/accessibility/label.js +1 -1
- package/lighthouse-core/audits/accessibility/link-name.js +1 -1
- package/lighthouse-core/audits/accessibility/list.js +1 -1
- package/lighthouse-core/audits/accessibility/listitem.js +1 -1
- package/lighthouse-core/audits/accessibility/meta-refresh.js +1 -1
- package/lighthouse-core/audits/accessibility/meta-viewport.js +1 -1
- package/lighthouse-core/audits/accessibility/object-alt.js +1 -1
- package/lighthouse-core/audits/accessibility/tabindex.js +1 -1
- package/lighthouse-core/audits/accessibility/td-headers-attr.js +1 -1
- package/lighthouse-core/audits/accessibility/th-has-data-cells.js +1 -1
- package/lighthouse-core/audits/accessibility/valid-lang.js +1 -1
- package/lighthouse-core/audits/accessibility/video-caption.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +1 -1
- package/lighthouse-core/config/default-config.js +1 -1
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +16 -2
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +3 -2
- package/lighthouse-core/index.js +2 -9
- package/lighthouse-core/lib/stack-packs.js +4 -0
- package/lighthouse-core/scripts/manual-chrome-launcher.js +0 -1
- package/lighthouse-core/util-commonjs.js +14 -8
- package/package.json +3 -3
- package/report/.eslintrc.cjs +3 -1
- package/report/assets/styles.css +10 -5
- package/report/assets/templates.html +10 -9
- package/report/clients/bundle.js +0 -1
- package/report/clients/standalone.js +0 -1
- package/report/renderer/api.js +0 -1
- package/report/renderer/category-renderer.js +0 -1
- package/report/renderer/components.js +13 -14
- package/report/renderer/crc-details-renderer.js +0 -1
- package/report/renderer/details-renderer.js +0 -1
- package/report/renderer/dom.js +0 -1
- package/report/renderer/drop-down-menu.js +0 -1
- package/report/renderer/element-screenshot-renderer.js +0 -4
- package/report/renderer/features-util.js +0 -1
- package/report/renderer/i18n.js +91 -49
- package/report/renderer/logger.js +0 -1
- package/report/renderer/open-tab.js +0 -1
- package/report/renderer/performance-category-renderer.js +0 -1
- package/report/renderer/pwa-category-renderer.js +0 -1
- package/report/renderer/report-renderer.js +0 -1
- package/report/renderer/report-ui-features.js +0 -1
- package/report/renderer/snippet-renderer.js +0 -1
- package/report/renderer/swap-locale-feature.js +0 -1
- package/report/renderer/text-encoding.js +0 -1
- package/report/renderer/topbar-features.js +0 -1
- package/report/renderer/util.js +13 -8
- package/report/test/clients/bundle-test.js +0 -1
- package/report/test/renderer/category-renderer-test.js +0 -1
- package/report/test/renderer/components-test.js +0 -1
- package/report/test/renderer/crc-details-renderer-test.js +0 -1
- package/report/test/renderer/details-renderer-test.js +0 -1
- package/report/test/renderer/dom-test.js +0 -1
- package/report/test/renderer/element-screenshot-renderer-test.js +3 -4
- package/report/test/renderer/i18n-test.js +26 -8
- package/report/test/renderer/performance-category-renderer-test.js +0 -1
- package/report/test/renderer/pwa-category-renderer-test.js +0 -1
- package/report/test/renderer/report-renderer-axe-test.js +0 -1
- package/report/test/renderer/report-renderer-test.js +0 -1
- package/report/test/renderer/report-ui-features-test.js +0 -1
- package/report/test/renderer/snippet-renderer-test.js +0 -1
- package/report/test/renderer/text-encoding-test.js +0 -1
- package/report/test/renderer/util-test.js +2 -3
- package/report/test-assets/faux-psi.js +2 -1
- package/shared/localization/locales/en-US.json +71 -50
- package/shared/localization/locales/en-XL.json +71 -50
- package/third-party/snyk/snapshot.json +2 -3
- package/types/config.d.ts +2 -0
|
@@ -21,7 +21,7 @@ const UIStrings = {
|
|
|
21
21
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
22
22
|
description: 'When an image is being used as an `<input>` button, providing alternative ' +
|
|
23
23
|
'text can help screen reader users understand the purpose of the button. ' +
|
|
24
|
-
'[Learn more](https://
|
|
24
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/input-image-alt).',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -21,7 +21,7 @@ const UIStrings = {
|
|
|
21
21
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
22
22
|
description: 'Labels ensure that form controls are announced properly by assistive ' +
|
|
23
23
|
'technologies, like screen readers. [Learn ' +
|
|
24
|
-
'more](https://
|
|
24
|
+
'more](https://dequeuniversity.com/rules/axe/4.4/label).',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -22,7 +22,7 @@ const UIStrings = {
|
|
|
22
22
|
description: 'Link text (and alternate text for images, when used as links) that is ' +
|
|
23
23
|
'discernible, unique, and focusable improves the navigation experience for ' +
|
|
24
24
|
'screen reader users. ' +
|
|
25
|
-
'[Learn more](https://
|
|
25
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/link-name).',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -23,7 +23,7 @@ const UIStrings = {
|
|
|
23
23
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
24
24
|
description: 'Screen readers have a specific way of announcing lists. Ensuring proper list ' +
|
|
25
25
|
'structure aids screen reader output. ' +
|
|
26
|
-
'[Learn more](https://
|
|
26
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/list).',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -22,7 +22,7 @@ const UIStrings = {
|
|
|
22
22
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
23
23
|
description: 'Screen readers require list items (`<li>`) to be contained within a ' +
|
|
24
24
|
'parent `<ul>` or `<ol>` to be announced properly. ' +
|
|
25
|
-
'[Learn more](https://
|
|
25
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/listitem).',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -22,7 +22,7 @@ const UIStrings = {
|
|
|
22
22
|
description: 'Users do not expect a page to refresh automatically, and doing so will move ' +
|
|
23
23
|
'focus back to the top of the page. This may create a frustrating or ' +
|
|
24
24
|
'confusing experience. ' +
|
|
25
|
-
'[Learn more](https://
|
|
25
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/meta-refresh).',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -23,7 +23,7 @@ const UIStrings = {
|
|
|
23
23
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
24
24
|
description: 'Disabling zooming is problematic for users with low vision who rely on ' +
|
|
25
25
|
'screen magnification to properly see the contents of a web page. ' +
|
|
26
|
-
'[Learn more](https://
|
|
26
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/meta-viewport).',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -21,7 +21,7 @@ const UIStrings = {
|
|
|
21
21
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
22
22
|
description: 'Screen readers cannot translate non-text content. Adding alternate text to ' +
|
|
23
23
|
'`<object>` elements helps screen readers convey meaning to users. ' +
|
|
24
|
-
'[Learn more](https://
|
|
24
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/object-alt).',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -21,7 +21,7 @@ const UIStrings = {
|
|
|
21
21
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
22
22
|
description: 'A value greater than 0 implies an explicit navigation ordering. ' +
|
|
23
23
|
'Although technically valid, this often creates frustrating experiences ' +
|
|
24
|
-
'for users who rely on assistive technologies. [Learn more](https://
|
|
24
|
+
'for users who rely on assistive technologies. [Learn more](https://dequeuniversity.com/rules/axe/4.4/tabindex).',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -25,7 +25,7 @@ const UIStrings = {
|
|
|
25
25
|
description: 'Screen readers have features to make navigating tables easier. Ensuring ' +
|
|
26
26
|
'`<td>` cells using the `[headers]` attribute only refer to other cells in the same ' +
|
|
27
27
|
'table may improve the experience for screen reader users. ' +
|
|
28
|
-
'[Learn more](https://
|
|
28
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/td-headers-attr).',
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -24,7 +24,7 @@ const UIStrings = {
|
|
|
24
24
|
description: 'Screen readers have features to make navigating tables easier. Ensuring ' +
|
|
25
25
|
'table headers always refer to some set of cells may improve the experience for screen ' +
|
|
26
26
|
'reader users. ' +
|
|
27
|
-
'[Learn more](https://
|
|
27
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/th-has-data-cells).',
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -21,7 +21,7 @@ const UIStrings = {
|
|
|
21
21
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
22
22
|
description: 'Specifying a valid [BCP 47 language](https://www.w3.org/International/questions/qa-choosing-language-tags#question) ' +
|
|
23
23
|
'on elements helps ensure that text is pronounced correctly by a screen reader. ' +
|
|
24
|
-
'[Learn more](https://
|
|
24
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/valid-lang).',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -22,7 +22,7 @@ const UIStrings = {
|
|
|
22
22
|
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
23
23
|
description: 'When a video provides a caption it is easier for deaf and hearing impaired ' +
|
|
24
24
|
'users to access its information. ' +
|
|
25
|
-
'[Learn more](https://
|
|
25
|
+
'[Learn more](https://dequeuniversity.com/rules/axe/4.4/video-caption).',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -30,7 +30,7 @@ const UIStrings = {
|
|
|
30
30
|
// eslint-disable-next-line max-len
|
|
31
31
|
// TODO: web.dev article. this codelab is good starting place: https://web.dev/codelab-serve-modern-code/
|
|
32
32
|
/** Description of a Lighthouse audit that tells the user about old JavaScript that is no longer needed. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
33
|
-
description: 'Polyfills and transforms enable legacy browsers to use new JavaScript features. However, many aren\'t necessary for modern browsers. For your bundled JavaScript, adopt a modern script deployment strategy using module/nomodule feature detection to reduce the amount of code shipped to modern browsers, while retaining support for legacy browsers. [Learn More](https://
|
|
33
|
+
description: 'Polyfills and transforms enable legacy browsers to use new JavaScript features. However, many aren\'t necessary for modern browsers. For your bundled JavaScript, adopt a modern script deployment strategy using module/nomodule feature detection to reduce the amount of code shipped to modern browsers, while retaining support for legacy browsers. [Learn More](https://web.dev/publish-modern-javascript/)',
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
@@ -41,7 +41,7 @@ const UIStrings = {
|
|
|
41
41
|
/** Description of the Accessibility category. This is displayed at the top of a list of audits focused on making web content accessible to all users. No character length limits. 'improve the accessibility of your web app' becomes link text to additional documentation. */
|
|
42
42
|
a11yCategoryDescription: 'These checks highlight opportunities to [improve the accessibility of your web app](https://web.dev/lighthouse-accessibility/). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.',
|
|
43
43
|
/** Description of the Accessibility manual checks category. This description is displayed above a list of accessibility audits that currently have no automated test and so must be verified manually by the user. No character length limits. 'conducting an accessibility review' becomes link text to additional documentation. */
|
|
44
|
-
a11yCategoryManualDescription: 'These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://
|
|
44
|
+
a11yCategoryManualDescription: '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/).',
|
|
45
45
|
/** Title of the best practices section of the Accessibility category. Within this section are audits with descriptive titles that highlight common accessibility best practices. */
|
|
46
46
|
a11yBestPracticesGroupTitle: 'Best practices',
|
|
47
47
|
/** Description of the best practices section within the Accessibility category. Within this section are audits with descriptive titles that highlight common accessibility best practices. */
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
+
const puppeteer = require('puppeteer-core');
|
|
8
9
|
const log = require('lighthouse-logger');
|
|
9
10
|
const Driver = require('./driver.js');
|
|
10
11
|
const Runner = require('../../runner.js');
|
|
@@ -43,6 +44,9 @@ const NetworkRecords = require('../../computed/network-records.js');
|
|
|
43
44
|
|
|
44
45
|
/** @typedef {Omit<Parameters<typeof collectPhaseArtifacts>[0], 'phase'>} PhaseState */
|
|
45
46
|
|
|
47
|
+
const DEFAULT_HOSTNAME = '127.0.0.1';
|
|
48
|
+
const DEFAULT_PORT = 9222;
|
|
49
|
+
|
|
46
50
|
/**
|
|
47
51
|
* @param {{driver: Driver, config: LH.Config.FRConfig, options?: InternalOptions}} args
|
|
48
52
|
* @return {Promise<{baseArtifacts: LH.FRBaseArtifacts}>}
|
|
@@ -299,11 +303,11 @@ async function _cleanup({requestedUrl, driver, config}) {
|
|
|
299
303
|
|
|
300
304
|
/**
|
|
301
305
|
* @param {LH.NavigationRequestor|undefined} requestor
|
|
302
|
-
* @param {{page
|
|
306
|
+
* @param {{page?: LH.Puppeteer.Page, config?: LH.Config.Json, configContext?: LH.Config.FRContext}} options
|
|
303
307
|
* @return {Promise<LH.Gatherer.FRGatherResult>}
|
|
304
308
|
*/
|
|
305
309
|
async function navigationGather(requestor, options) {
|
|
306
|
-
const {
|
|
310
|
+
const {configContext = {}} = options;
|
|
307
311
|
log.setLevel(configContext.logLevel || 'error');
|
|
308
312
|
|
|
309
313
|
const {config} = initializeConfig(options.config, {...configContext, gatherMode: 'navigation'});
|
|
@@ -321,6 +325,16 @@ async function navigationGather(requestor, options) {
|
|
|
321
325
|
const runnerOptions = {config, computedCache};
|
|
322
326
|
const artifacts = await Runner.gather(
|
|
323
327
|
async () => {
|
|
328
|
+
let {page} = options;
|
|
329
|
+
|
|
330
|
+
// For navigation mode, we shouldn't connect to a browser in audit mode,
|
|
331
|
+
// therefore we connect to the browser in the gatherFn callback.
|
|
332
|
+
if (!page) {
|
|
333
|
+
const {hostname = DEFAULT_HOSTNAME, port = DEFAULT_PORT} = configContext;
|
|
334
|
+
const browser = await puppeteer.connect({browserURL: `http://${hostname}:${port}`});
|
|
335
|
+
page = await browser.newPage();
|
|
336
|
+
}
|
|
337
|
+
|
|
324
338
|
const driver = new Driver(page);
|
|
325
339
|
const context = {
|
|
326
340
|
driver,
|
|
@@ -15,6 +15,7 @@ const {waitForNetworkIdle} = require('../driver/wait-for-condition.js');
|
|
|
15
15
|
|
|
16
16
|
// JPEG quality setting
|
|
17
17
|
// Exploration and examples of reports using different quality settings: https://docs.google.com/document/d/1ZSffucIca9XDW2eEwfoevrk-OTl7WQFeMf0CgeJAA8M/edit#
|
|
18
|
+
// Note: this analysis was done for JPEG, but now we use WEBP.
|
|
18
19
|
const FULL_PAGE_SCREENSHOT_QUALITY = 30;
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -118,10 +119,10 @@ class FullPageScreenshot extends FRGatherer {
|
|
|
118
119
|
await context.driver.executionContext.evaluate(waitForDoubleRaf, {args: []});
|
|
119
120
|
|
|
120
121
|
const result = await session.sendCommand('Page.captureScreenshot', {
|
|
121
|
-
format: '
|
|
122
|
+
format: 'webp',
|
|
122
123
|
quality: FULL_PAGE_SCREENSHOT_QUALITY,
|
|
123
124
|
});
|
|
124
|
-
const data = 'data:image/
|
|
125
|
+
const data = 'data:image/webp;base64,' + result.data;
|
|
125
126
|
|
|
126
127
|
return {
|
|
127
128
|
data,
|
package/lighthouse-core/index.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const puppeteer = require('puppeteer-core');
|
|
9
8
|
const Runner = require('./runner.js');
|
|
10
9
|
const log = require('lighthouse-logger');
|
|
11
10
|
const ChromeProtocol = require('./gather/connections/cri.js');
|
|
@@ -15,9 +14,6 @@ const fraggleRock = require('./fraggle-rock/api.js');
|
|
|
15
14
|
|
|
16
15
|
/** @typedef {import('./gather/connections/connection.js')} Connection */
|
|
17
16
|
|
|
18
|
-
const DEFAULT_HOSTNAME = '127.0.0.1';
|
|
19
|
-
const DEFAULT_PORT = 9222;
|
|
20
|
-
|
|
21
17
|
/*
|
|
22
18
|
* The relationship between these root modules:
|
|
23
19
|
*
|
|
@@ -42,15 +38,12 @@ const DEFAULT_PORT = 9222;
|
|
|
42
38
|
* @return {Promise<LH.RunnerResult|undefined>}
|
|
43
39
|
*/
|
|
44
40
|
async function lighthouse(url, flags = {}, configJSON, page) {
|
|
45
|
-
if (!page) {
|
|
46
|
-
const {hostname = DEFAULT_HOSTNAME, port = DEFAULT_PORT} = flags;
|
|
47
|
-
const browser = await puppeteer.connect({browserURL: `http://${hostname}:${port}`});
|
|
48
|
-
page = await browser.newPage();
|
|
49
|
-
}
|
|
50
41
|
const configContext = {
|
|
51
42
|
configPath: flags.configPath,
|
|
52
43
|
settingsOverrides: flags,
|
|
53
44
|
logLevel: flags.logLevel,
|
|
45
|
+
hostname: flags.hostname,
|
|
46
|
+
port: flags.port,
|
|
54
47
|
};
|
|
55
48
|
return fraggleRock.navigation(url, {page, config: configJSON, configContext});
|
|
56
49
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Auto-generated by lighthouse-core/scripts/copy-util-commonjs.sh
|
|
3
3
|
// Temporary solution until all our code uses esmodules
|
|
4
|
+
'use strict';
|
|
4
5
|
/**
|
|
5
6
|
* @license
|
|
6
7
|
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -17,7 +18,6 @@
|
|
|
17
18
|
* See the License for the specific language governing permissions and
|
|
18
19
|
* limitations under the License.
|
|
19
20
|
*/
|
|
20
|
-
'use strict';
|
|
21
21
|
|
|
22
22
|
/** @template T @typedef {import('./i18n').I18n<T>} I18n */
|
|
23
23
|
|
|
@@ -433,10 +433,13 @@ class Util {
|
|
|
433
433
|
break;
|
|
434
434
|
case 'devtools': {
|
|
435
435
|
const {cpuSlowdownMultiplier, requestLatencyMs} = throttling;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
// TODO: better api in i18n formatter such that this isn't needed.
|
|
437
|
+
const cpuGranularity = Number.isInteger(cpuSlowdownMultiplier) ? 1 : 0.1;
|
|
438
|
+
// eslint-disable-next-line max-len
|
|
439
|
+
cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier, cpuGranularity)}x slowdown (DevTools)`;
|
|
440
|
+
networkThrottling = `${Util.i18n.formatMilliseconds(requestLatencyMs, 1)} HTTP RTT, ` +
|
|
441
|
+
`${Util.i18n.formatKbps(throttling.downloadThroughputKbps)} down, ` +
|
|
442
|
+
`${Util.i18n.formatKbps(throttling.uploadThroughputKbps)} up (DevTools)`;
|
|
440
443
|
|
|
441
444
|
const isSlow4G = () => {
|
|
442
445
|
return requestLatencyMs === 150 * 3.75 &&
|
|
@@ -448,9 +451,12 @@ class Util {
|
|
|
448
451
|
}
|
|
449
452
|
case 'simulate': {
|
|
450
453
|
const {cpuSlowdownMultiplier, rttMs, throughputKbps} = throttling;
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
+
// TODO: better api in i18n formatter such that this isn't needed.
|
|
455
|
+
const cpuGranularity = Number.isInteger(cpuSlowdownMultiplier) ? 1 : 0.1;
|
|
456
|
+
// eslint-disable-next-line max-len
|
|
457
|
+
cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier, cpuGranularity)}x slowdown (Simulated)`;
|
|
458
|
+
networkThrottling = `${Util.i18n.formatMilliseconds(rttMs)} TCP RTT, ` +
|
|
459
|
+
`${Util.i18n.formatKbps(throughputKbps)} throughput (Simulated)`;
|
|
454
460
|
|
|
455
461
|
const isSlow4G = () => {
|
|
456
462
|
return rttMs === 150 && throughputKbps === 1.6 * 1024;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "9.5.0-dev.
|
|
3
|
+
"version": "9.5.0-dev.20220420",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
"jpeg-js": "^0.4.3",
|
|
194
194
|
"js-library-detector": "^6.4.0",
|
|
195
195
|
"lighthouse-logger": "^1.3.0",
|
|
196
|
-
"lighthouse-stack-packs": "^1.
|
|
196
|
+
"lighthouse-stack-packs": "^1.8.1",
|
|
197
197
|
"lodash": "^4.17.21",
|
|
198
198
|
"lookup-closest-locale": "6.2.0",
|
|
199
199
|
"metaviewport-parser": "0.2.0",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"robots-parser": "^3.0.0",
|
|
205
205
|
"semver": "^5.3.0",
|
|
206
206
|
"speedline-core": "^1.4.3",
|
|
207
|
-
"third-party-web": "^0.
|
|
207
|
+
"third-party-web": "^0.17.1",
|
|
208
208
|
"ws": "^7.0.0",
|
|
209
209
|
"yargs": "^17.3.1",
|
|
210
210
|
"yargs-parser": "^21.0.0"
|
package/report/.eslintrc.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
|
-
'use strict';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* eslint does not support ESM rc files, so this must be a .cjs file.
|
|
@@ -32,4 +31,7 @@ module.exports = {
|
|
|
32
31
|
'import/group-exports': 2,
|
|
33
32
|
'import/exports-last': 2,
|
|
34
33
|
},
|
|
34
|
+
parserOptions: {
|
|
35
|
+
sourceType: 'module',
|
|
36
|
+
},
|
|
35
37
|
};
|
package/report/assets/styles.css
CHANGED
|
@@ -695,11 +695,10 @@
|
|
|
695
695
|
border-top: 1px solid var(--report-border-color-secondary);
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
-
.lh-metric:nth-last-child(-n+2) {
|
|
698
|
+
.lh-category:not(.lh--hoisted-meta) .lh-metric:nth-last-child(-n+2) {
|
|
699
699
|
border-bottom: 1px solid var(--report-border-color-secondary);
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
-
|
|
703
702
|
.lh-metric__innerwrap {
|
|
704
703
|
display: grid;
|
|
705
704
|
/**
|
|
@@ -746,7 +745,7 @@
|
|
|
746
745
|
.lh-metric {
|
|
747
746
|
border-bottom: none !important;
|
|
748
747
|
}
|
|
749
|
-
.lh-metric:nth-last-child(1) {
|
|
748
|
+
.lh-category:not(.lh--hoisted-meta) .lh-metric:nth-last-child(1) {
|
|
750
749
|
border-bottom: 1px solid var(--report-border-color-secondary) !important;
|
|
751
750
|
}
|
|
752
751
|
|
|
@@ -1419,6 +1418,9 @@
|
|
|
1419
1418
|
.lh-category-wrapper {
|
|
1420
1419
|
border-bottom: 1px solid var(--color-gray-200);
|
|
1421
1420
|
}
|
|
1421
|
+
.lh-category-wrapper:last-of-type {
|
|
1422
|
+
border-bottom: 0;
|
|
1423
|
+
}
|
|
1422
1424
|
|
|
1423
1425
|
.lh-category-header {
|
|
1424
1426
|
margin-bottom: var(--section-padding-vertical);
|
|
@@ -1745,15 +1747,18 @@ details[open] .lh-clump-toggletext--hide { display: block;}
|
|
|
1745
1747
|
|
|
1746
1748
|
/* Element screenshot */
|
|
1747
1749
|
.lh-element-screenshot {
|
|
1748
|
-
position: relative;
|
|
1749
|
-
overflow: hidden;
|
|
1750
1750
|
float: left;
|
|
1751
1751
|
margin-right: 20px;
|
|
1752
1752
|
}
|
|
1753
1753
|
.lh-element-screenshot__content {
|
|
1754
1754
|
overflow: hidden;
|
|
1755
|
+
min-width: 110px;
|
|
1756
|
+
display: flex;
|
|
1757
|
+
justify-content: center;
|
|
1758
|
+
background-color: var(--report-background-color);
|
|
1755
1759
|
}
|
|
1756
1760
|
.lh-element-screenshot__image {
|
|
1761
|
+
position: relative;
|
|
1757
1762
|
/* Set by ElementScreenshotRenderer.installFullPageScreenshotCssVariable */
|
|
1758
1763
|
background-image: var(--element-screenshot-url);
|
|
1759
1764
|
outline: 2px solid #777;
|
|
@@ -893,16 +893,17 @@ limitations under the License.
|
|
|
893
893
|
<template id="elementScreenshot">
|
|
894
894
|
<div class="lh-element-screenshot">
|
|
895
895
|
<div class="lh-element-screenshot__content">
|
|
896
|
-
<div class="lh-element-
|
|
897
|
-
<
|
|
898
|
-
<
|
|
899
|
-
<
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
896
|
+
<div class="lh-element-screenshot__image">
|
|
897
|
+
<div class="lh-element-screenshot__mask">
|
|
898
|
+
<svg height="0" width="0">
|
|
899
|
+
<defs>
|
|
900
|
+
<clipPath clipPathUnits="objectBoundingBox"></clipPath>
|
|
901
|
+
<!-- clipPath filled by ElementScreenshotRenderer.renderClipPath -->
|
|
902
|
+
</defs>
|
|
903
|
+
</svg>
|
|
904
|
+
</div>
|
|
905
|
+
<div class="lh-element-screenshot__element-marker"></div>
|
|
903
906
|
</div>
|
|
904
|
-
<div class="lh-element-screenshot__image"></div>
|
|
905
|
-
<div class="lh-element-screenshot__element-marker"></div>
|
|
906
907
|
</div>
|
|
907
908
|
</div>
|
|
908
909
|
</template>
|
package/report/clients/bundle.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
|
-
'use strict';
|
|
7
6
|
|
|
8
7
|
// This file is used to generate a bundle that can be imported
|
|
9
8
|
// into an esmodules codebase to render the lighthouse report.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
|
-
'use strict';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @fileoverview The entry point for rendering the Lighthouse report for the HTML
|
package/report/renderer/api.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
4
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
5
|
*/
|
|
6
|
-
'use strict';
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
import {DOM} from '../renderer/dom.js';
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
'use strict';
|
|
18
17
|
|
|
19
18
|
/** @typedef {import('./dom.js').DOM} DOM */
|
|
20
19
|
/** @typedef {import('./report-renderer.js').ReportRenderer} ReportRenderer */
|