lighthouse 9.5.0-dev.20220509 → 9.6.1
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 +70 -0
- package/dist/report/bundle.esm.js +400 -808
- package/dist/report/flow.js +22 -27
- package/dist/report/standalone.js +18 -23
- package/flow-report/src/summary/category.tsx +1 -1
- package/jest.config.js +1 -1
- package/lighthouse-cli/.eslintrc.cjs +4 -3
- package/lighthouse-cli/bin.js +1 -0
- package/lighthouse-cli/cli-flags.js +4 -3
- package/lighthouse-cli/commands/commands.js +1 -0
- package/lighthouse-cli/commands/list-audits.js +1 -0
- package/lighthouse-cli/commands/list-locales.js +1 -0
- package/lighthouse-cli/commands/list-trace-categories.js +1 -0
- package/lighthouse-cli/index.js +1 -0
- package/lighthouse-cli/printer.js +1 -0
- package/lighthouse-cli/run.js +24 -9
- package/lighthouse-cli/sentry-prompt.js +1 -0
- package/lighthouse-cli/test/smokehouse/core-tests.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/lib.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/node.js +1 -0
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +1 -0
- package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +1 -0
- package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +1 -0
- package/lighthouse-cli/test/smokehouse/lib/local-console.js +1 -0
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +23 -109
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +3 -2
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/devtools.js +19 -28
- package/lighthouse-cli/test/smokehouse/report-assert.js +4 -3
- package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
- package/lighthouse-cli/test/smokehouse/version-check-test.js +3 -0
- package/lighthouse-cli/test/smokehouse/version-check.js +1 -0
- 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 +5 -5
- 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/byte-efficiency-audit.js +1 -2
- package/lighthouse-core/audits/byte-efficiency/duplicated-javascript.js +12 -11
- package/lighthouse-core/audits/byte-efficiency/efficient-animated-content.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +24 -22
- package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +2 -3
- package/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +3 -2
- package/lighthouse-core/audits/byte-efficiency/unminified-css.js +5 -3
- package/lighthouse-core/audits/byte-efficiency/unminified-javascript.js +11 -10
- package/lighthouse-core/audits/byte-efficiency/unused-css-rules.js +1 -0
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +8 -11
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/uses-text-compression.js +1 -1
- package/lighthouse-core/audits/deprecations.js +598 -8
- package/lighthouse-core/audits/diagnostics.js +3 -4
- package/lighthouse-core/audits/dobetterweb/doctype.js +9 -20
- package/lighthouse-core/audits/dobetterweb/geolocation-on-start.js +1 -1
- package/lighthouse-core/audits/dobetterweb/no-document-write.js +1 -1
- package/lighthouse-core/audits/dobetterweb/notification-on-start.js +1 -1
- package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -2
- package/lighthouse-core/audits/dobetterweb/uses-passive-event-listeners.js +1 -1
- package/lighthouse-core/audits/errors-in-console.js +2 -2
- package/lighthouse-core/audits/long-tasks.js +2 -3
- package/lighthouse-core/audits/metrics/experimental-interaction-to-next-paint.js +3 -1
- package/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +2 -2
- package/lighthouse-core/audits/metrics/first-contentful-paint.js +2 -3
- package/lighthouse-core/audits/metrics/first-meaningful-paint.js +2 -3
- package/lighthouse-core/audits/metrics/interactive.js +2 -3
- package/lighthouse-core/audits/metrics/largest-contentful-paint.js +2 -3
- package/lighthouse-core/audits/metrics/max-potential-fid.js +2 -3
- package/lighthouse-core/audits/metrics/speed-index.js +2 -3
- package/lighthouse-core/audits/metrics/total-blocking-time.js +2 -3
- package/lighthouse-core/audits/metrics.js +2 -3
- package/lighthouse-core/audits/no-unload-listeners.js +15 -7
- package/lighthouse-core/audits/predictive-perf.js +1 -2
- package/lighthouse-core/audits/preload-lcp-image.js +3 -3
- package/lighthouse-core/audits/redirects.js +1 -1
- package/lighthouse-core/audits/script-treemap-data.js +45 -45
- package/lighthouse-core/audits/seo/http-status-code.js +4 -2
- package/lighthouse-core/audits/seo/link-text.js +0 -2
- package/lighthouse-core/audits/server-response-time.js +17 -2
- package/lighthouse-core/audits/service-worker.js +2 -7
- package/lighthouse-core/audits/timing-budget.js +2 -3
- package/lighthouse-core/audits/uses-rel-preconnect.js +1 -1
- package/lighthouse-core/audits/uses-rel-preload.js +1 -1
- package/lighthouse-core/audits/valid-source-maps.js +14 -12
- package/lighthouse-core/audits/violation-audit.js +1 -1
- package/lighthouse-core/audits/work-during-interaction.js +280 -0
- package/lighthouse-core/computed/critical-request-chains.js +9 -5
- package/lighthouse-core/computed/js-bundles.js +11 -11
- package/lighthouse-core/computed/main-resource.js +2 -3
- package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +1 -1
- package/lighthouse-core/computed/metrics/first-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/first-meaningful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/interactive.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-interactive.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-max-potential-fid.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-metric.js +5 -3
- package/lighthouse-core/computed/metrics/lantern-speed-index.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +1 -1
- package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +1 -1
- package/lighthouse-core/computed/metrics/largest-contentful-paint.js +1 -1
- package/lighthouse-core/computed/metrics/max-potential-fid.js +1 -1
- package/lighthouse-core/computed/metrics/metric.js +0 -1
- package/lighthouse-core/computed/metrics/responsiveness.js +12 -9
- package/lighthouse-core/computed/metrics/speed-index.js +1 -1
- package/lighthouse-core/computed/metrics/timing-summary.js +6 -13
- package/lighthouse-core/computed/metrics/total-blocking-time.js +1 -1
- package/lighthouse-core/computed/module-duplication.js +5 -6
- package/lighthouse-core/computed/page-dependency-graph.js +28 -55
- package/lighthouse-core/computed/resource-summary.js +5 -5
- package/lighthouse-core/computed/unused-css.js +7 -6
- package/lighthouse-core/computed/unused-javascript-summary.js +36 -16
- package/lighthouse-core/config/budget.js +2 -2
- package/lighthouse-core/config/default-config.js +1 -2
- package/lighthouse-core/config/metrics-to-audits.js +5 -0
- package/lighthouse-core/fraggle-rock/api.js +1 -1
- package/lighthouse-core/fraggle-rock/config/default-config.js +8 -5
- package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +3 -6
- package/lighthouse-core/fraggle-rock/gather/driver.js +2 -2
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +26 -51
- package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +3 -0
- package/lighthouse-core/fraggle-rock/gather/session.js +2 -2
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -5
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +6 -6
- package/lighthouse-core/gather/connections/cri.js +0 -1
- package/lighthouse-core/gather/driver/execution-context.js +2 -4
- package/lighthouse-core/gather/driver/navigation.js +9 -9
- package/lighthouse-core/gather/driver/network-monitor.js +3 -16
- package/lighthouse-core/gather/driver.js +1 -6
- package/lighthouse-core/gather/fetcher.js +210 -34
- package/lighthouse-core/gather/gather-runner.js +17 -13
- package/lighthouse-core/gather/gatherers/accessibility.js +4 -16
- package/lighthouse-core/gather/gatherers/console-messages.js +2 -4
- package/lighthouse-core/gather/gatherers/dobetterweb/doctype.js +2 -4
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +2 -3
- package/lighthouse-core/gather/gatherers/js-usage.js +87 -12
- package/lighthouse-core/gather/gatherers/link-elements.js +14 -12
- package/lighthouse-core/gather/gatherers/main-document-content.js +8 -8
- package/lighthouse-core/gather/gatherers/script-elements.js +56 -7
- package/lighthouse-core/gather/gatherers/seo/robots-txt.js +30 -2
- package/lighthouse-core/gather/gatherers/source-maps.js +1 -3
- package/lighthouse-core/gather/gatherers/trace-elements.js +21 -2
- package/lighthouse-core/gather/gatherers/web-app-manifest.js +2 -2
- package/lighthouse-core/index.js +2 -26
- package/lighthouse-core/lib/cdt/generated/SourceMap.js +1 -1
- package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +29 -8
- package/lighthouse-core/lib/navigation-error.js +4 -13
- package/lighthouse-core/lib/script-helpers.js +6 -11
- package/lighthouse-core/lib/url-shim.js +2 -2
- package/lighthouse-core/runner.js +5 -0
- package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -0
- package/lighthouse-core/util-commonjs.js +24 -28
- package/package.json +12 -12
- package/readme.md +1 -1
- package/report/.eslintrc.cjs +1 -3
- package/report/assets/styles.css +10 -12
- package/report/assets/templates.html +9 -10
- package/report/clients/bundle.js +1 -0
- package/report/clients/standalone.js +1 -0
- package/report/generator/report-generator.js +21 -46
- package/report/renderer/api.js +1 -0
- package/report/renderer/category-renderer.js +1 -0
- package/report/renderer/components.js +304 -303
- package/report/renderer/crc-details-renderer.js +1 -0
- package/report/renderer/details-renderer.js +10 -10
- package/report/renderer/dom.js +1 -0
- package/report/renderer/drop-down-menu.js +1 -0
- package/report/renderer/element-screenshot-renderer.js +4 -0
- package/report/renderer/features-util.js +1 -0
- package/report/renderer/i18n.js +62 -118
- package/report/renderer/logger.js +1 -0
- package/report/renderer/open-tab.js +3 -1
- package/report/renderer/performance-category-renderer.js +1 -0
- package/report/renderer/pwa-category-renderer.js +1 -0
- package/report/renderer/report-renderer.js +1 -0
- package/report/renderer/report-ui-features.js +1 -0
- package/report/renderer/snippet-renderer.js +1 -0
- package/report/renderer/swap-locale-feature.js +1 -0
- package/report/renderer/text-encoding.js +1 -0
- package/report/renderer/topbar-features.js +1 -0
- package/report/renderer/util.js +24 -27
- package/report/test/clients/bundle-test.js +4 -0
- package/report/test/generator/file-namer-test.js +1 -0
- package/report/test/generator/report-generator-test.js +20 -25
- package/report/test/renderer/category-renderer-test.js +3 -0
- package/report/test/renderer/components-test.js +3 -0
- package/report/test/renderer/crc-details-renderer-test.js +3 -0
- package/report/test/renderer/details-renderer-test.js +12 -58
- package/report/test/renderer/dom-test.js +3 -0
- package/report/test/renderer/element-screenshot-renderer-test.js +6 -3
- package/report/test/renderer/i18n-test.js +25 -70
- package/report/test/renderer/performance-category-renderer-test.js +4 -11
- package/report/test/renderer/pwa-category-renderer-test.js +3 -0
- package/report/test/renderer/report-renderer-axe-test.js +3 -0
- package/report/test/renderer/report-renderer-test.js +3 -0
- package/report/test/renderer/report-ui-features-test.js +3 -0
- package/report/test/renderer/snippet-renderer-test.js +3 -0
- package/report/test/renderer/text-encoding-test.js +3 -0
- package/report/test/renderer/util-test.js +5 -2
- package/report/test-assets/faux-psi.js +1 -2
- package/shared/localization/locales/en-US.json +260 -53
- package/shared/localization/locales/en-XL.json +260 -53
- package/shared/test/localization/format-test.js +2 -0
- package/shared/test/localization/locales-test.js +2 -0
- package/shared/test/localization/swap-locale-test.js +2 -0
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +2 -0
- package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
- package/tsconfig.json +0 -1
- package/types/artifacts.d.ts +9 -48
- package/types/config.d.ts +0 -2
- package/types/externs.d.ts +2 -2
- package/types/gatherer.d.ts +2 -1
- package/types/global-lh.d.ts +0 -3
- package/types/lhr/audit-details.d.ts +3 -1
- package/types/lhr/lhr.d.ts +2 -2
- package/types/lhr/treemap.d.ts +1 -0
- package/lighthouse-core/audits/script-elements-test-audit.js +0 -30
- package/lighthouse-core/gather/gatherers/scripts.js +0 -154
- package/report/test/.eslintrc.cjs +0 -11
- package/shared/test/localization/.eslintrc.cjs +0 -11
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
/**
|
|
6
5
|
* @license
|
|
7
6
|
* Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
@@ -18,6 +17,7 @@
|
|
|
18
17
|
* See the License for the specific language governing permissions and
|
|
19
18
|
* limitations under the License.
|
|
20
19
|
*/
|
|
20
|
+
'use strict';
|
|
21
21
|
|
|
22
22
|
/** @template T @typedef {import('./i18n').I18n<T>} I18n */
|
|
23
23
|
|
|
@@ -318,26 +318,24 @@ class Util {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
const MAX_LENGTH = 64;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
name = name.replace(/\?.*/, `?${ELLIPSIS}`);
|
|
340
|
-
}
|
|
321
|
+
// Always elide hexadecimal hash
|
|
322
|
+
name = name.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, `$1${ELLIPSIS}`);
|
|
323
|
+
// Also elide other hash-like mixed-case strings
|
|
324
|
+
name = name.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,
|
|
325
|
+
`$1${ELLIPSIS}`);
|
|
326
|
+
// Also elide long number sequences
|
|
327
|
+
name = name.replace(/(\d{3})\d{6,}/g, `$1${ELLIPSIS}`);
|
|
328
|
+
// Merge any adjacent ellipses
|
|
329
|
+
name = name.replace(/\u2026+/g, ELLIPSIS);
|
|
330
|
+
|
|
331
|
+
// Elide query params first
|
|
332
|
+
if (name.length > MAX_LENGTH && name.includes('?')) {
|
|
333
|
+
// Try to leave the first query parameter intact
|
|
334
|
+
name = name.replace(/\?([^=]*)(=)?.*/, `?$1$2${ELLIPSIS}`);
|
|
335
|
+
|
|
336
|
+
// Remove it all if it's still too long
|
|
337
|
+
if (name.length > MAX_LENGTH) {
|
|
338
|
+
name = name.replace(/\?.*/, `?${ELLIPSIS}`);
|
|
341
339
|
}
|
|
342
340
|
}
|
|
343
341
|
|
|
@@ -433,11 +431,10 @@ class Util {
|
|
|
433
431
|
break;
|
|
434
432
|
case 'devtools': {
|
|
435
433
|
const {cpuSlowdownMultiplier, requestLatencyMs} = throttling;
|
|
436
|
-
// eslint-disable-next-line max-len
|
|
437
434
|
cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier)}x slowdown (DevTools)`;
|
|
438
|
-
networkThrottling = `${Util.i18n.
|
|
439
|
-
`${Util.i18n.
|
|
440
|
-
`${Util.i18n.
|
|
435
|
+
networkThrottling = `${Util.i18n.formatNumber(requestLatencyMs)}${NBSP}ms HTTP RTT, ` +
|
|
436
|
+
`${Util.i18n.formatNumber(throttling.downloadThroughputKbps)}${NBSP}Kbps down, ` +
|
|
437
|
+
`${Util.i18n.formatNumber(throttling.uploadThroughputKbps)}${NBSP}Kbps up (DevTools)`;
|
|
441
438
|
|
|
442
439
|
const isSlow4G = () => {
|
|
443
440
|
return requestLatencyMs === 150 * 3.75 &&
|
|
@@ -449,10 +446,9 @@ class Util {
|
|
|
449
446
|
}
|
|
450
447
|
case 'simulate': {
|
|
451
448
|
const {cpuSlowdownMultiplier, rttMs, throughputKbps} = throttling;
|
|
452
|
-
// eslint-disable-next-line max-len
|
|
453
449
|
cpuThrottling = `${Util.i18n.formatNumber(cpuSlowdownMultiplier)}x slowdown (Simulated)`;
|
|
454
|
-
networkThrottling = `${Util.i18n.
|
|
455
|
-
`${Util.i18n.
|
|
450
|
+
networkThrottling = `${Util.i18n.formatNumber(rttMs)}${NBSP}ms TCP RTT, ` +
|
|
451
|
+
`${Util.i18n.formatNumber(throughputKbps)}${NBSP}Kbps throughput (Simulated)`;
|
|
456
452
|
|
|
457
453
|
const isSlow4G = () => {
|
|
458
454
|
return rttMs === 150 && throughputKbps === 1.6 * 1024;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.1",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
|
|
25
25
|
"build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js",
|
|
26
26
|
"build-pack": "bash build/build-pack.sh",
|
|
27
|
-
"build-report": "node build/build-report-components.js && bash lighthouse-core/scripts/copy-util-commonjs.sh && node build/build-report.js",
|
|
27
|
+
"build-report": "node build/build-report-components.js && yarn eslint --fix report/renderer/components.js && bash lighthouse-core/scripts/copy-util-commonjs.sh && node build/build-report.js",
|
|
28
28
|
"build-sample-reports": "yarn build-report && node build/build-sample-reports.js",
|
|
29
29
|
"build-treemap": "node ./build/build-treemap.js",
|
|
30
30
|
"build-viewer": "node ./build/build-viewer.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"start": "yarn build-report --standalone && node ./lighthouse-cli/index.js",
|
|
38
38
|
"jest": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
|
|
39
39
|
"test": "yarn diff:sample-json && yarn lint --quiet && yarn unit && yarn type-check",
|
|
40
|
-
"test-bundle": "yarn smoke --runner bundle --retries=2",
|
|
40
|
+
"test-bundle": "yarn smoke --runner bundle -j=1 --retries=2 --invert-match forms",
|
|
41
41
|
"test-clients": "yarn jest \"$PWD/clients/\" && yarn jest --testMatch=\"**/clients/test/**/*-test-pptr.js\"",
|
|
42
42
|
"test-viewer": "yarn unit-viewer && yarn jest --testMatch=\"**/viewer/**/*-test-pptr.js\"",
|
|
43
43
|
"test-treemap": "yarn unit-treemap && yarn jest --testMatch=\"**/treemap/**/*-test-pptr.js\"",
|
|
@@ -68,28 +68,28 @@
|
|
|
68
68
|
"vercel-build": "yarn build-sample-reports && yarn build-viewer && yarn build-treemap",
|
|
69
69
|
"dogfood-lhci": "./lighthouse-core/scripts/dogfood-lhci.sh",
|
|
70
70
|
"timing-trace": "node lighthouse-core/scripts/generate-timing-trace.js",
|
|
71
|
-
"changelog": "conventional-changelog --config ./build/changelog-generator/index.
|
|
71
|
+
"changelog": "conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md --same-file",
|
|
72
72
|
"type-check": "tsc --build ./tsconfig-all.json",
|
|
73
73
|
"i18n:checks": "./lighthouse-core/scripts/i18n/assert-strings-collected.sh",
|
|
74
74
|
"i18n:collect-strings": "node lighthouse-core/scripts/i18n/collect-strings.js",
|
|
75
75
|
"update:lantern-baseline": "node lighthouse-core/scripts/lantern/update-baseline-lantern-values.js",
|
|
76
76
|
"update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js",
|
|
77
|
-
"update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --config-path=./lighthouse-core/test/results/sample-config.js --output=json --output-path=./lighthouse-core/test/results/sample_v2.json && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing
|
|
78
|
-
"update:flow-sample-json": "
|
|
77
|
+
"update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --config-path=./lighthouse-core/test/results/sample-config.js --output=json --output-path=./lighthouse-core/test/results/sample_v2.json && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing",
|
|
78
|
+
"update:flow-sample-json": "node ./lighthouse-core/scripts/update-flow-fixtures.js",
|
|
79
|
+
"update:snapshot-sample-json": "node ./lighthouse-core/scripts/update-snapshot-sample.js",
|
|
79
80
|
"update:test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh --reset-results",
|
|
80
81
|
"test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh",
|
|
81
82
|
"open-devtools": "bash lighthouse-core/scripts/open-devtools.sh",
|
|
82
83
|
"run-devtools": "node lighthouse-core/scripts/pptr-run-devtools.js",
|
|
83
84
|
"diff:sample-json": "yarn i18n:checks && bash lighthouse-core/scripts/assert-golden-lhr-unchanged.sh",
|
|
84
|
-
"diff:flow-sample-json": "yarn i18n:collect-strings && bash lighthouse-core/scripts/assert-baseline-flow-result-unchanged.sh",
|
|
85
85
|
"computeBenchmarkIndex": "./lighthouse-core/scripts/benchmark.js",
|
|
86
86
|
"minify-latest-run": "./lighthouse-core/scripts/lantern/minify-trace.js ./latest-run/defaultPass.trace.json ./latest-run/defaultPass.trace.min.json && ./lighthouse-core/scripts/lantern/minify-devtoolslog.js ./latest-run/defaultPass.devtoolslog.json ./latest-run/defaultPass.devtoolslog.min.json",
|
|
87
87
|
"save-latest-run": "./lighthouse-core/scripts/save-latest-run.sh",
|
|
88
88
|
"compile-proto": "protoc --python_out=./ ./proto/lighthouse-result.proto && mv ./proto/*_pb2.py ./proto/scripts || (echo \"❌ Install protobuf ≥ 3.7.1 to compile the proto file.\" && false)",
|
|
89
89
|
"build-proto-roundtrip": "mkdir -p .tmp && cross-env PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 python proto/scripts/json_roundtrip_via_proto.py",
|
|
90
90
|
"static-server": "node lighthouse-cli/test/fixtures/static-server.js",
|
|
91
|
-
"serve-dist": "cd dist &&
|
|
92
|
-
"serve-gh-pages": "cd dist/gh-pages &&
|
|
91
|
+
"serve-dist": "cd dist && python -m SimpleHTTPServer",
|
|
92
|
+
"serve-gh-pages": "cd dist/gh-pages && python -m SimpleHTTPServer",
|
|
93
93
|
"serve-treemap": "yarn serve-gh-pages",
|
|
94
94
|
"serve-viewer": "yarn serve-gh-pages",
|
|
95
95
|
"flow-report": "yarn build-report --flow && node ./lighthouse-core/scripts/build-test-flow-report.js"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"cpy": "^8.1.2",
|
|
139
139
|
"cross-env": "^7.0.2",
|
|
140
140
|
"csv-validator": "^0.0.3",
|
|
141
|
-
"devtools-protocol": "0.0.
|
|
141
|
+
"devtools-protocol": "0.0.999451",
|
|
142
142
|
"es-main": "^1.0.2",
|
|
143
143
|
"eslint": "^8.4.1",
|
|
144
144
|
"eslint-config-google": "^0.14.0",
|
|
@@ -209,8 +209,8 @@
|
|
|
209
209
|
"yargs-parser": "^21.0.0"
|
|
210
210
|
},
|
|
211
211
|
"resolutions": {
|
|
212
|
-
"puppeteer/**/devtools-protocol": "0.0.
|
|
213
|
-
"puppeteer-core/**/devtools-protocol": "0.0.
|
|
212
|
+
"puppeteer/**/devtools-protocol": "0.0.999451",
|
|
213
|
+
"puppeteer-core/**/devtools-protocol": "0.0.999451"
|
|
214
214
|
},
|
|
215
215
|
"repository": "GoogleChrome/lighthouse",
|
|
216
216
|
"keywords": [
|
package/readme.md
CHANGED
|
@@ -99,7 +99,7 @@ Configuration:
|
|
|
99
99
|
--screenEmulation Sets screen emulation parameters. See also --preset. Use --screenEmulation.disabled to disable. Otherwise set these 4 parameters individually: --screenEmulation.mobile --screenEmulation.width=360 --screenEmulation.height=640 --screenEmulation.deviceScaleFactor=2
|
|
100
100
|
--emulatedUserAgent Sets useragent emulation [string]
|
|
101
101
|
--max-wait-for-load The timeout (in milliseconds) to wait before the page is considered done loading and the run should continue. WARNING: Very high values can lead to large traces and instability [number]
|
|
102
|
-
--enable-error-reporting Enables error reporting, overriding any saved preference. --no-enable-error-reporting will do the opposite. More: https://
|
|
102
|
+
--enable-error-reporting Enables error reporting, overriding any saved preference. --no-enable-error-reporting will do the opposite. More: https://git.io/vFFTO [boolean]
|
|
103
103
|
--gather-mode, -G Collect artifacts from a connected browser and save to disk. (Artifacts folder path may optionally be provided). If audit-mode is not also enabled, the run will quit early.
|
|
104
104
|
--audit-mode, -A Process saved artifacts from disk. (Artifacts folder path may be provided, otherwise defaults to ./latest-run/)
|
|
105
105
|
--only-audits Only run the specified audits [array]
|
package/report/.eslintrc.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
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';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* eslint does not support ESM rc files, so this must be a .cjs file.
|
|
@@ -31,7 +32,4 @@ module.exports = {
|
|
|
31
32
|
'import/group-exports': 2,
|
|
32
33
|
'import/exports-last': 2,
|
|
33
34
|
},
|
|
34
|
-
parserOptions: {
|
|
35
|
-
sourceType: 'module',
|
|
36
|
-
},
|
|
37
35
|
};
|
package/report/assets/styles.css
CHANGED
|
@@ -300,6 +300,9 @@
|
|
|
300
300
|
/* This is normally the height of the topbar, but we want it to stick to the top of our scroll container .lh-container` */
|
|
301
301
|
top: 0;
|
|
302
302
|
}
|
|
303
|
+
.lh-devtools .lh-element-screenshot__overlay {
|
|
304
|
+
position: absolute;
|
|
305
|
+
}
|
|
303
306
|
|
|
304
307
|
@keyframes fadeIn {
|
|
305
308
|
0% { opacity: 0;}
|
|
@@ -695,10 +698,11 @@
|
|
|
695
698
|
border-top: 1px solid var(--report-border-color-secondary);
|
|
696
699
|
}
|
|
697
700
|
|
|
698
|
-
.lh-
|
|
701
|
+
.lh-metric:nth-last-child(-n+2) {
|
|
699
702
|
border-bottom: 1px solid var(--report-border-color-secondary);
|
|
700
703
|
}
|
|
701
704
|
|
|
705
|
+
|
|
702
706
|
.lh-metric__innerwrap {
|
|
703
707
|
display: grid;
|
|
704
708
|
/**
|
|
@@ -745,7 +749,7 @@
|
|
|
745
749
|
.lh-metric {
|
|
746
750
|
border-bottom: none !important;
|
|
747
751
|
}
|
|
748
|
-
.lh-
|
|
752
|
+
.lh-metric:nth-last-child(1) {
|
|
749
753
|
border-bottom: 1px solid var(--report-border-color-secondary) !important;
|
|
750
754
|
}
|
|
751
755
|
|
|
@@ -1061,8 +1065,8 @@
|
|
|
1061
1065
|
}
|
|
1062
1066
|
|
|
1063
1067
|
/* Report */
|
|
1064
|
-
.lh-list >
|
|
1065
|
-
|
|
1068
|
+
.lh-list > :not(:last-child) {
|
|
1069
|
+
margin-bottom: calc(var(--default-padding) * 2);
|
|
1066
1070
|
}
|
|
1067
1071
|
|
|
1068
1072
|
.lh-header-container {
|
|
@@ -1418,9 +1422,6 @@
|
|
|
1418
1422
|
.lh-category-wrapper {
|
|
1419
1423
|
border-bottom: 1px solid var(--color-gray-200);
|
|
1420
1424
|
}
|
|
1421
|
-
.lh-category-wrapper:last-of-type {
|
|
1422
|
-
border-bottom: 0;
|
|
1423
|
-
}
|
|
1424
1425
|
|
|
1425
1426
|
.lh-category-header {
|
|
1426
1427
|
margin-bottom: var(--section-padding-vertical);
|
|
@@ -1747,18 +1748,15 @@ details[open] .lh-clump-toggletext--hide { display: block;}
|
|
|
1747
1748
|
|
|
1748
1749
|
/* Element screenshot */
|
|
1749
1750
|
.lh-element-screenshot {
|
|
1751
|
+
position: relative;
|
|
1752
|
+
overflow: hidden;
|
|
1750
1753
|
float: left;
|
|
1751
1754
|
margin-right: 20px;
|
|
1752
1755
|
}
|
|
1753
1756
|
.lh-element-screenshot__content {
|
|
1754
1757
|
overflow: hidden;
|
|
1755
|
-
min-width: 110px;
|
|
1756
|
-
display: flex;
|
|
1757
|
-
justify-content: center;
|
|
1758
|
-
background-color: var(--report-background-color);
|
|
1759
1758
|
}
|
|
1760
1759
|
.lh-element-screenshot__image {
|
|
1761
|
-
position: relative;
|
|
1762
1760
|
/* Set by ElementScreenshotRenderer.installFullPageScreenshotCssVariable */
|
|
1763
1761
|
background-image: var(--element-screenshot-url);
|
|
1764
1762
|
outline: 2px solid #777;
|
|
@@ -893,17 +893,16 @@ 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
|
-
|
|
903
|
-
</svg>
|
|
904
|
-
</div>
|
|
905
|
-
<div class="lh-element-screenshot__element-marker"></div>
|
|
896
|
+
<div class="lh-element-screenshot__mask">
|
|
897
|
+
<svg height="0" width="0">
|
|
898
|
+
<defs>
|
|
899
|
+
<clipPath clipPathUnits="objectBoundingBox"></clipPath>
|
|
900
|
+
<!-- clipPath filled by ElementScreenshotRenderer.renderClipPath -->
|
|
901
|
+
</defs>
|
|
902
|
+
</svg>
|
|
906
903
|
</div>
|
|
904
|
+
<div class="lh-element-screenshot__image"></div>
|
|
905
|
+
<div class="lh-element-screenshot__element-marker"></div>
|
|
907
906
|
</div>
|
|
908
907
|
</div>
|
|
909
908
|
</template>
|
package/report/clients/bundle.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
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';
|
|
6
7
|
|
|
7
8
|
// This file is used to generate a bundle that can be imported
|
|
8
9
|
// into an esmodules codebase to render the lighthouse report.
|
|
@@ -3,6 +3,7 @@
|
|
|
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';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @fileoverview The entry point for rendering the Lighthouse report for the HTML
|
|
@@ -93,54 +93,29 @@ class ReportGenerator {
|
|
|
93
93
|
const separator = ',';
|
|
94
94
|
/** @param {string} value @return {string} */
|
|
95
95
|
const escape = value => `"${value.replace(/"/g, '""')}"`;
|
|
96
|
-
/** @param {
|
|
97
|
-
const rowFormatter = row => row.map(value =>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// Some spacing.
|
|
111
|
-
rows.push([]);
|
|
112
|
-
|
|
113
|
-
// Categories.
|
|
114
|
-
rows.push(['category', 'score']);
|
|
115
|
-
for (const category of Object.values(lhr.categories)) {
|
|
116
|
-
rows.push(rowFormatter([
|
|
117
|
-
category.id,
|
|
118
|
-
category.score,
|
|
119
|
-
]));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
rows.push([]);
|
|
123
|
-
|
|
124
|
-
// Audits.
|
|
125
|
-
rows.push(['category', 'audit', 'score', 'displayValue', 'description']);
|
|
126
|
-
for (const category of Object.values(lhr.categories)) {
|
|
127
|
-
for (const auditRef of category.auditRefs) {
|
|
96
|
+
/** @param {Array<string | number>} row @return {string[]} */
|
|
97
|
+
const rowFormatter = row => row.map(value => value.toString()).map(escape);
|
|
98
|
+
|
|
99
|
+
// Possible TODO: tightly couple headers and row values
|
|
100
|
+
const header = ['requestedUrl', 'finalUrl', 'category', 'name', 'title', 'type', 'score'];
|
|
101
|
+
const table = Object.keys(lhr.categories).map(categoryId => {
|
|
102
|
+
const rows = [];
|
|
103
|
+
const category = lhr.categories[categoryId];
|
|
104
|
+
const overallCategoryScore = category.score === null ? -1 : category.score;
|
|
105
|
+
rows.push(rowFormatter([lhr.requestedUrl, lhr.finalUrl, category.title,
|
|
106
|
+
`${categoryId}-score`, `Overall ${category.title} Category Score`, 'numeric',
|
|
107
|
+
overallCategoryScore]));
|
|
108
|
+
return rows.concat(category.auditRefs.map(auditRef => {
|
|
128
109
|
const audit = lhr.audits[auditRef.id];
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
audit.displayValue || '',
|
|
136
|
-
audit.description,
|
|
137
|
-
]));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
110
|
+
// CSV validator wants all scores to be numeric, use -1 for now
|
|
111
|
+
const numericScore = audit.score === null ? -1 : audit.score;
|
|
112
|
+
return rowFormatter([lhr.requestedUrl, lhr.finalUrl, category.title, audit.id, audit.title,
|
|
113
|
+
audit.scoreDisplayMode, numericScore]);
|
|
114
|
+
}));
|
|
115
|
+
});
|
|
140
116
|
|
|
141
|
-
return
|
|
142
|
-
.map(row => row.join(separator))
|
|
143
|
-
.join(CRLF);
|
|
117
|
+
return [header].concat(...table)
|
|
118
|
+
.map(row => row.join(separator)).join(CRLF);
|
|
144
119
|
}
|
|
145
120
|
|
|
146
121
|
/**
|
package/report/renderer/api.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
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';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
import {DOM} from '../renderer/dom.js';
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
'use strict';
|
|
17
18
|
|
|
18
19
|
/** @typedef {import('./dom.js').DOM} DOM */
|
|
19
20
|
/** @typedef {import('./report-renderer.js').ReportRenderer} ReportRenderer */
|