lighthouse 8.0.0-dev.20210709 → 8.0.0
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/docs/architecture.md +101 -0
- package/docs/authenticated-pages.md +44 -0
- package/docs/bug-labels.md +35 -0
- package/docs/configuration.md +213 -0
- package/docs/emulation.md +32 -0
- package/docs/error-reporting.md +42 -0
- package/docs/hacking-tips.md +55 -0
- package/docs/headless-chrome.md +119 -0
- package/docs/lantern.md +55 -0
- package/docs/new-audits.md +99 -0
- package/docs/performance-budgets.md +187 -0
- package/docs/plugins.md +374 -0
- package/docs/puppeteer.md +95 -0
- package/docs/readme.md +164 -0
- package/docs/recipes/auth/README.md +129 -0
- package/docs/recipes/auth/example-lh-auth.js +81 -0
- package/docs/recipes/auth/package.json +11 -0
- package/docs/recipes/auth/server/public/dashboard-unauthenticated.html +21 -0
- package/docs/recipes/auth/server/public/dashboard.html +25 -0
- package/docs/recipes/auth/server/public/home-unauthenticated.html +27 -0
- package/docs/recipes/auth/server/public/home.html +17 -0
- package/docs/recipes/auth/server/public/unauthenticated.html +22 -0
- package/docs/recipes/auth/server/server.js +85 -0
- package/docs/recipes/custom-audit/custom-config.js +36 -0
- package/docs/recipes/custom-audit/package.json +8 -0
- package/docs/recipes/custom-audit/readme.md +32 -0
- package/docs/recipes/custom-audit/searchable-audit.js +46 -0
- package/docs/recipes/custom-audit/searchable-gatherer.js +32 -0
- package/docs/recipes/custom-gatherer-puppeteer/custom-audit.js +34 -0
- package/{root.js → docs/recipes/custom-gatherer-puppeteer/custom-config.js} +23 -2
- package/docs/recipes/custom-gatherer-puppeteer/custom-gatherer.js +51 -0
- package/docs/recipes/custom-gatherer-puppeteer/package.json +13 -0
- package/docs/recipes/custom-gatherer-puppeteer/readme.md +7 -0
- package/docs/recipes/custom-gatherer-puppeteer/test.sh +9 -0
- package/docs/recipes/gulp/gulpfile.js +79 -0
- package/docs/recipes/gulp/package.json +12 -0
- package/docs/recipes/gulp/public/index.html +22 -0
- package/docs/recipes/gulp/readme.md +6 -0
- package/docs/recipes/integration-test/README.md +14 -0
- package/docs/recipes/integration-test/example-lh-auth.test.js +160 -0
- package/docs/recipes/integration-test/package.json +9 -0
- package/docs/recipes/lighthouse-plugin-example/audits/preload-as.js +46 -0
- package/docs/recipes/lighthouse-plugin-example/package.json +11 -0
- package/docs/recipes/lighthouse-plugin-example/plugin-recipe-screenshot.png +0 -0
- package/docs/recipes/lighthouse-plugin-example/plugin.js +24 -0
- package/docs/recipes/lighthouse-plugin-example/readme.md +53 -0
- package/docs/releasing.md +164 -0
- package/docs/scoring.md +79 -0
- package/docs/throttling.md +150 -0
- package/docs/understanding-results.md +209 -0
- package/docs/v8-perf-faq.md +244 -0
- package/docs/variability.md +150 -0
- package/jest.config.js +0 -3
- package/lighthouse-cli/bin.js +8 -6
- package/lighthouse-core/audits/accessibility/aria-command-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-tooltip-name.js +1 -1
- package/lighthouse-core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/lighthouse-core/audits/apple-touch-icon.js +0 -1
- package/lighthouse-core/audits/audit.js +3 -3
- package/lighthouse-core/audits/autocomplete.js +2 -2
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +14 -29
- package/lighthouse-core/audits/byte-efficiency/duplicated-javascript.js +2 -3
- package/lighthouse-core/audits/byte-efficiency/efficient-animated-content.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/legacy-javascript.js +2 -3
- package/lighthouse-core/audits/byte-efficiency/modern-image-formats.js +15 -55
- package/lighthouse-core/audits/byte-efficiency/offscreen-images.js +4 -8
- package/lighthouse-core/audits/byte-efficiency/render-blocking-resources.js +8 -15
- package/lighthouse-core/audits/byte-efficiency/total-byte-weight.js +9 -10
- package/lighthouse-core/audits/byte-efficiency/unminified-css.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/unminified-javascript.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/unused-css-rules.js +1 -1
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -2
- package/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js +2 -2
- package/lighthouse-core/audits/byte-efficiency/uses-optimized-images.js +1 -2
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images.js +24 -46
- package/lighthouse-core/audits/byte-efficiency/uses-text-compression.js +1 -1
- package/lighthouse-core/audits/critical-request-chains.js +0 -1
- package/lighthouse-core/audits/csp-xss.js +1 -1
- package/lighthouse-core/audits/diagnostics.js +0 -1
- package/lighthouse-core/audits/dobetterweb/geolocation-on-start.js +0 -1
- package/lighthouse-core/audits/dobetterweb/inspector-issues.js +1 -1
- package/lighthouse-core/audits/dobetterweb/notification-on-start.js +0 -1
- package/lighthouse-core/audits/dobetterweb/uses-http2.js +0 -1
- package/lighthouse-core/audits/final-screenshot.js +4 -8
- package/lighthouse-core/audits/font-display.js +0 -1
- package/lighthouse-core/audits/installable-manifest.js +3 -4
- package/lighthouse-core/audits/largest-contentful-paint-element.js +0 -1
- package/lighthouse-core/audits/long-tasks.js +1 -1
- package/lighthouse-core/audits/maskable-icon.js +0 -1
- package/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +2 -4
- package/lighthouse-core/audits/metrics/first-contentful-paint.js +2 -4
- package/lighthouse-core/audits/metrics/first-meaningful-paint.js +2 -4
- package/lighthouse-core/audits/metrics/interactive.js +2 -4
- package/lighthouse-core/audits/metrics/largest-contentful-paint.js +2 -4
- package/lighthouse-core/audits/metrics/max-potential-fid.js +2 -4
- package/lighthouse-core/audits/metrics/speed-index.js +2 -4
- package/lighthouse-core/audits/metrics/total-blocking-time.js +2 -10
- package/lighthouse-core/audits/metrics.js +2 -4
- package/lighthouse-core/audits/performance-budget.js +0 -1
- package/lighthouse-core/audits/predictive-perf.js +6 -9
- package/lighthouse-core/audits/preload-fonts.js +1 -11
- package/lighthouse-core/audits/preload-lcp-image.js +5 -18
- package/lighthouse-core/audits/redirects.js +8 -10
- package/lighthouse-core/audits/screenshot-thumbnails.js +13 -28
- package/lighthouse-core/audits/seo/canonical.js +1 -2
- package/lighthouse-core/audits/seo/font-size.js +4 -4
- package/lighthouse-core/audits/seo/hreflang.js +2 -3
- package/lighthouse-core/audits/seo/http-status-code.js +16 -21
- package/lighthouse-core/audits/seo/is-crawlable.js +3 -4
- package/lighthouse-core/audits/seo/robots-txt.js +2 -2
- package/lighthouse-core/audits/seo/tap-targets.js +5 -5
- package/lighthouse-core/audits/server-response-time.js +2 -20
- package/lighthouse-core/audits/splash-screen.js +0 -1
- package/lighthouse-core/audits/themed-omnibox.js +0 -1
- package/lighthouse-core/audits/third-party-facades.js +0 -1
- package/lighthouse-core/audits/third-party-summary.js +3 -1
- package/lighthouse-core/audits/timing-budget.js +2 -4
- package/lighthouse-core/audits/uses-rel-preconnect.js +9 -14
- package/lighthouse-core/audits/uses-rel-preload.js +2 -13
- package/lighthouse-core/computed/main-thread-tasks.js +2 -2
- package/lighthouse-core/computed/metrics/cumulative-layout-shift.js +3 -3
- package/lighthouse-core/computed/metrics/first-contentful-paint-all-frames.js +6 -6
- package/lighthouse-core/computed/metrics/first-contentful-paint.js +8 -9
- package/lighthouse-core/computed/metrics/first-meaningful-paint.js +9 -10
- package/lighthouse-core/computed/metrics/interactive.js +24 -25
- package/lighthouse-core/computed/metrics/lantern-first-contentful-paint.js +6 -6
- package/lighthouse-core/computed/metrics/lantern-first-meaningful-paint.js +6 -6
- package/lighthouse-core/computed/metrics/lantern-largest-contentful-paint.js +6 -6
- package/lighthouse-core/computed/metrics/lantern-metric.js +8 -16
- package/lighthouse-core/computed/metrics/largest-contentful-paint-all-frames.js +7 -7
- package/lighthouse-core/computed/metrics/largest-contentful-paint.js +9 -10
- package/lighthouse-core/computed/metrics/max-potential-fid.js +11 -8
- package/lighthouse-core/computed/metrics/metric.js +5 -32
- package/lighthouse-core/computed/metrics/speed-index.js +5 -6
- package/lighthouse-core/computed/metrics/timing-summary.js +45 -55
- package/lighthouse-core/computed/metrics/total-blocking-time.js +29 -36
- package/lighthouse-core/computed/page-dependency-graph.js +14 -14
- package/lighthouse-core/computed/resource-summary.js +7 -3
- package/lighthouse-core/computed/speedline.js +3 -3
- package/lighthouse-core/computed/trace-of-tab.js +86 -15
- package/lighthouse-core/computed/user-timings.js +5 -5
- package/lighthouse-core/config/default-config.js +0 -1
- package/lighthouse-core/fraggle-rock/config/config.js +7 -9
- package/lighthouse-core/fraggle-rock/config/default-config.js +2 -40
- package/lighthouse-core/fraggle-rock/config/filters.js +6 -39
- package/lighthouse-core/fraggle-rock/config/validation.js +4 -4
- package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +19 -54
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +10 -21
- package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +2 -2
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +2 -2
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +2 -2
- package/lighthouse-core/gather/driver/prepare.js +0 -3
- package/lighthouse-core/gather/fetcher.js +2 -0
- package/lighthouse-core/gather/gather-runner.js +14 -2
- package/lighthouse-core/gather/gatherers/image-elements.js +61 -24
- package/lighthouse-core/gather/gatherers/inspector-issues.js +2 -2
- package/lighthouse-core/gather/gatherers/script-elements.js +12 -45
- package/lighthouse-core/gather/gatherers/seo/font-size.js +5 -5
- package/lighthouse-core/gather/gatherers/seo/tap-targets.js +12 -64
- package/lighthouse-core/gather/gatherers/service-worker.js +3 -20
- package/lighthouse-core/gather/gatherers/trace-compat.js +1 -1
- package/lighthouse-core/gather/gatherers/trace-elements.js +3 -15
- package/lighthouse-core/gather/gatherers/trace.js +4 -13
- package/lighthouse-core/gather/gatherers/viewport-dimensions.js +1 -1
- package/lighthouse-core/lib/dependency-graph/simulator/network-analyzer.js +2 -13
- package/lighthouse-core/lib/emulation.js +2 -0
- package/lighthouse-core/lib/i18n/i18n.js +2 -2
- package/lighthouse-core/lib/i18n/locales/ar-XB.json +141 -141
- package/lighthouse-core/lib/i18n/locales/ar.json +143 -143
- package/lighthouse-core/lib/i18n/locales/bg.json +143 -143
- package/lighthouse-core/lib/i18n/locales/ca.json +141 -141
- package/lighthouse-core/lib/i18n/locales/cs.json +141 -141
- package/lighthouse-core/lib/i18n/locales/da.json +141 -141
- package/lighthouse-core/lib/i18n/locales/de.json +142 -142
- package/lighthouse-core/lib/i18n/locales/el.json +141 -141
- package/lighthouse-core/lib/i18n/locales/en-GB.json +141 -141
- package/lighthouse-core/lib/i18n/locales/en-US.ctc.json +6659 -0
- package/lighthouse-core/lib/i18n/locales/en-US.json +144 -150
- package/lighthouse-core/lib/i18n/locales/en-XA.json +141 -141
- package/lighthouse-core/lib/i18n/locales/en-XL.ctc.json +6628 -0
- package/lighthouse-core/lib/i18n/locales/en-XL.json +144 -150
- package/lighthouse-core/lib/i18n/locales/es-419.json +141 -141
- package/lighthouse-core/lib/i18n/locales/es.json +141 -141
- package/lighthouse-core/lib/i18n/locales/fi.json +143 -143
- package/lighthouse-core/lib/i18n/locales/fil.json +142 -142
- package/lighthouse-core/lib/i18n/locales/fr.json +141 -141
- package/lighthouse-core/lib/i18n/locales/he.json +142 -142
- package/lighthouse-core/lib/i18n/locales/hi.json +143 -143
- package/lighthouse-core/lib/i18n/locales/hr.json +141 -141
- package/lighthouse-core/lib/i18n/locales/hu.json +143 -143
- package/lighthouse-core/lib/i18n/locales/id.json +143 -143
- package/lighthouse-core/lib/i18n/locales/it.json +143 -143
- package/lighthouse-core/lib/i18n/locales/ja.json +143 -143
- package/lighthouse-core/lib/i18n/locales/ko.json +143 -143
- package/lighthouse-core/lib/i18n/locales/lt.json +143 -143
- package/lighthouse-core/lib/i18n/locales/lv.json +143 -143
- package/lighthouse-core/lib/i18n/locales/nl.json +141 -141
- package/lighthouse-core/lib/i18n/locales/no.json +141 -141
- package/lighthouse-core/lib/i18n/locales/pl.json +141 -141
- package/lighthouse-core/lib/i18n/locales/pt-PT.json +141 -141
- package/lighthouse-core/lib/i18n/locales/pt.json +141 -141
- package/lighthouse-core/lib/i18n/locales/ro.json +144 -144
- package/lighthouse-core/lib/i18n/locales/ru.json +143 -143
- package/lighthouse-core/lib/i18n/locales/sk.json +142 -142
- package/lighthouse-core/lib/i18n/locales/sl.json +141 -141
- package/lighthouse-core/lib/i18n/locales/sr-Latn.json +143 -143
- package/lighthouse-core/lib/i18n/locales/sr.json +143 -143
- package/lighthouse-core/lib/i18n/locales/sv.json +142 -142
- package/lighthouse-core/lib/i18n/locales/ta.json +141 -141
- package/lighthouse-core/lib/i18n/locales/te.json +143 -143
- package/lighthouse-core/lib/i18n/locales/th.json +143 -143
- package/lighthouse-core/lib/i18n/locales/tr.json +143 -143
- package/lighthouse-core/lib/i18n/locales/uk.json +141 -141
- package/lighthouse-core/lib/i18n/locales/vi.json +143 -143
- package/lighthouse-core/lib/i18n/locales/zh-HK.json +141 -141
- package/lighthouse-core/lib/i18n/locales/zh-TW.json +143 -143
- package/lighthouse-core/lib/i18n/locales/zh.json +143 -143
- package/lighthouse-core/lib/lh-error.js +2 -2
- package/lighthouse-core/lib/minify-trace.js +1 -1
- package/lighthouse-core/lib/network-request.js +1 -17
- package/lighthouse-core/lib/page-functions.js +5 -6
- package/lighthouse-core/lib/rect-helpers.js +3 -3
- package/lighthouse-core/lib/sd-validation/assets/jsonldcontext.json +7137 -0
- package/lighthouse-core/lib/sd-validation/assets/schema-tree.json +9900 -0
- package/{report/report-assets.js → lighthouse-core/lib/sd-validation/helpers/walk-object.js} +20 -12
- package/lighthouse-core/lib/sd-validation/json-expander.js +56 -0
- package/lighthouse-core/lib/sd-validation/json-linter.js +49 -0
- package/lighthouse-core/lib/sd-validation/jsonld-keyword-validator.js +50 -0
- package/lighthouse-core/lib/sd-validation/line-number-from-jsonld-path.js +60 -0
- package/lighthouse-core/lib/sd-validation/schema-validator.js +146 -0
- package/lighthouse-core/lib/sd-validation/scripts/download-jsonldcontext.js +30 -0
- package/lighthouse-core/lib/sd-validation/scripts/generate-schema-tree.js +97 -0
- package/lighthouse-core/lib/sd-validation/sd-validation.js +77 -0
- package/lighthouse-core/lib/tappable-rects.js +1 -1
- package/lighthouse-core/lib/tracehouse/trace-processor.js +42 -116
- package/lighthouse-core/lib/url-shim.js +2 -29
- package/lighthouse-core/report/html/html-report-assets.js +38 -0
- package/{report/README.md → lighthouse-core/report/html/readme.md} +11 -7
- package/{report → lighthouse-core/report/html}/renderer/category-renderer.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/crc-details-renderer.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/details-renderer.js +1 -1
- package/{report → lighthouse-core/report/html}/renderer/dom.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/element-screenshot-renderer.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/i18n.js +1 -1
- package/{report → lighthouse-core/report/html}/renderer/logger.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/performance-category-renderer.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/psi.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/pwa-category-renderer.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/report-renderer.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/report-ui-features.js +3 -3
- package/{report → lighthouse-core/report/html}/renderer/snippet-renderer.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/text-encoding.js +0 -0
- package/{report → lighthouse-core/report/html}/renderer/util.js +4 -7
- package/{report/assets/styles.css → lighthouse-core/report/html/report-styles.css} +0 -0
- package/{report/assets/standalone-template.html → lighthouse-core/report/html/report-template.html} +41 -1
- package/{report/assets → lighthouse-core/report/html}/templates.html +0 -0
- package/{report → lighthouse-core/report}/report-generator.js +1 -1
- package/lighthouse-core/runner.js +1 -1
- package/package.json +12 -13
- package/readme.md +2 -2
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +2 -3
- package/third-party/chromium-synchronization/installability-errors-test.js +2 -2
- package/third-party/download-content-shell/download-content-shell.js +1 -2
- package/third-party/snyk/snapshot.json +1 -1
- package/tsconfig.json +1 -0
- package/types/artifacts.d.ts +21 -41
- package/types/audit.d.ts +0 -2
- package/types/config.d.ts +2 -16
- package/types/externs.d.ts +0 -1
- package/types/gatherer.d.ts +13 -13
- package/types/html-renderer.d.ts +14 -14
- package/types/i18n.d.ts +1 -1
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js +0 -94
- package/lighthouse-core/computed/image-records.js +0 -62
- package/lighthouse-core/computed/metrics/navigation-metric.js +0 -46
- package/lighthouse-core/computed/processed-navigation.js +0 -21
- package/lighthouse-core/computed/processed-trace.js +0 -21
- package/lighthouse-core/gather/gatherers/gather-context.js +0 -25
- package/lighthouse-core/gather/gatherers/host-form-factor.js +0 -31
- package/lighthouse-core/gather/gatherers/host-user-agent.js +0 -29
- package/lighthouse-core/lib/lh-trace-processor.js +0 -46
- package/report/clients/standalone.js +0 -52
- package/report/test/renderer/category-renderer-test.js +0 -488
- package/report/test/renderer/crc-details-renderer-test.js +0 -115
- package/report/test/renderer/details-renderer-test.js +0 -843
- package/report/test/renderer/dom-test.js +0 -157
- package/report/test/renderer/element-screenshot-renderer-test.js +0 -189
- package/report/test/renderer/i18n-test.js +0 -146
- package/report/test/renderer/performance-category-renderer-test.js +0 -332
- package/report/test/renderer/psi-test.js +0 -152
- package/report/test/renderer/pwa-category-renderer-test.js +0 -303
- package/report/test/renderer/report-renderer-test.js +0 -325
- package/report/test/renderer/report-ui-features-test.js +0 -572
- package/report/test/renderer/snippet-renderer-test.js +0 -291
- package/report/test/renderer/text-encoding-test.js +0 -41
- package/report/test/renderer/util-test.js +0 -388
- package/report/test/report-generator-test.js +0 -145
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build-all": "npm-run-posix-or-windows build-all:task",
|
|
16
|
-
"build-all:task": "yarn build-
|
|
17
|
-
"build-all:task:windows": "yarn build-
|
|
16
|
+
"build-all:task": "yarn build-cdt-lib && yarn build-devtools && (yarn build-extension & yarn build-lr & yarn build-viewer & yarn build-treemap & yarn build-smokehouse-bundle & wait) && yarn build-pack",
|
|
17
|
+
"build-all:task:windows": "yarn build-cdt-lib && yarn build-extension && yarn build-devtools && yarn build-lr && yarn build-viewer && yarn build-treemap && yarn build-smokehouse-bundle",
|
|
18
18
|
"build-cdt-lib": "node ./build/build-cdt-lib.js",
|
|
19
19
|
"build-extension": "yarn build-extension-chrome && yarn build-extension-firefox",
|
|
20
20
|
"build-extension-chrome": "node ./build/build-extension.js chrome",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
|
|
24
24
|
"build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js",
|
|
25
25
|
"build-pack": "bash build/build-pack.sh",
|
|
26
|
-
"build-report": "node build/build-report.js",
|
|
27
26
|
"build-treemap": "node ./build/build-treemap.js",
|
|
28
27
|
"build-viewer": "node ./build/build-viewer.js",
|
|
29
28
|
"reset-link": "(yarn unlink || true) && yarn link && yarn link lighthouse",
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
"lint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .",
|
|
33
32
|
"smoke": "node lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js",
|
|
34
33
|
"debug": "node --inspect-brk ./lighthouse-cli/index.js",
|
|
35
|
-
"start": "
|
|
34
|
+
"start": "node ./lighthouse-cli/index.js",
|
|
36
35
|
"test": "yarn diff:sample-json && yarn lint --quiet && yarn unit && yarn type-check",
|
|
37
36
|
"test-bundle": "yarn smoke --runner bundle -j=1 --retries=2 --invert-match forms",
|
|
38
37
|
"test-clients": "jest \"clients/\"",
|
|
@@ -44,11 +43,10 @@
|
|
|
44
43
|
"test-proto": "yarn compile-proto && yarn build-proto-roundtrip",
|
|
45
44
|
"unit-core": "jest \"lighthouse-core\"",
|
|
46
45
|
"unit-cli": "jest \"lighthouse-cli/\"",
|
|
47
|
-
"unit-report": "jest \"report/\"",
|
|
48
46
|
"unit-treemap": "jest \"lighthouse-treemap/.*-test.js\"",
|
|
49
47
|
"unit-viewer": "jest \"lighthouse-viewer/.*-test.js\"",
|
|
50
|
-
"unit": "yarn unit-core && yarn unit-cli && yarn unit-
|
|
51
|
-
"unit:ci": "NODE_OPTIONS=--max-old-space-size=8192 npm run unit-core -- --ci && npm run unit-cli -- --ci && npm run unit-
|
|
48
|
+
"unit": "yarn unit-core && yarn unit-cli && yarn unit-viewer && yarn unit-treemap",
|
|
49
|
+
"unit:ci": "NODE_OPTIONS=--max-old-space-size=8192 npm run unit-core -- --ci && npm run unit-cli -- --ci && npm run unit-viewer -- --ci && npm run unit-treemap -- --ci",
|
|
52
50
|
"core-unit": "yarn unit-core",
|
|
53
51
|
"cli-unit": "yarn unit-cli",
|
|
54
52
|
"viewer-unit": "yarn unit-viewer",
|
|
@@ -115,7 +113,7 @@
|
|
|
115
113
|
"@types/semver": "^5.5.0",
|
|
116
114
|
"@types/tabulator-tables": "^4.9.1",
|
|
117
115
|
"@types/update-notifier": "^4.1.0",
|
|
118
|
-
"@types/ws": "^
|
|
116
|
+
"@types/ws": "^4.0.1",
|
|
119
117
|
"@types/yargs": "^15.0.11",
|
|
120
118
|
"@types/yargs-parser": "^15.0.0",
|
|
121
119
|
"@typescript-eslint/parser": "^4.21.0",
|
|
@@ -142,7 +140,7 @@
|
|
|
142
140
|
"glob": "^7.1.3",
|
|
143
141
|
"idb-keyval": "2.2.0",
|
|
144
142
|
"intl-messageformat-parser": "^1.8.1",
|
|
145
|
-
"jest": "^
|
|
143
|
+
"jest": "^26.6.1",
|
|
146
144
|
"jsdom": "^12.2.0",
|
|
147
145
|
"jsonld": "^5.2.0",
|
|
148
146
|
"jsonlint-mod": "^1.7.6",
|
|
@@ -152,16 +150,17 @@
|
|
|
152
150
|
"npm-run-posix-or-windows": "^2.0.2",
|
|
153
151
|
"package-json-versionify": "^1.0.4",
|
|
154
152
|
"pako": "^2.0.3",
|
|
153
|
+
"prettier": "^1.14.3",
|
|
155
154
|
"pretty-json-stringify": "^0.0.2",
|
|
156
155
|
"puppeteer": "^9.1.1",
|
|
157
156
|
"tabulator-tables": "^4.9.3",
|
|
158
157
|
"terser": "^5.3.8",
|
|
159
158
|
"typed-query-selector": "^2.4.0",
|
|
160
159
|
"typescript": "4.2.3",
|
|
161
|
-
"webtreemap-cdt": "^3.2.
|
|
160
|
+
"webtreemap-cdt": "^3.2.0"
|
|
162
161
|
},
|
|
163
162
|
"dependencies": {
|
|
164
|
-
"axe-core": "4.2.
|
|
163
|
+
"axe-core": "4.2.1",
|
|
165
164
|
"chrome-launcher": "^0.14.0",
|
|
166
165
|
"configstore": "^5.0.1",
|
|
167
166
|
"csp_evaluator": "^1.0.1",
|
|
@@ -188,7 +187,7 @@
|
|
|
188
187
|
"speedline-core": "^1.4.3",
|
|
189
188
|
"third-party-web": "^0.12.2",
|
|
190
189
|
"update-notifier": "^4.1.0",
|
|
191
|
-
"ws": "
|
|
190
|
+
"ws": "3.3.2",
|
|
192
191
|
"yargs": "^16.1.1",
|
|
193
192
|
"yargs-parser": "^20.2.4"
|
|
194
193
|
},
|
package/readme.md
CHANGED
|
@@ -383,11 +383,11 @@ Other awesome open source projects that use Lighthouse.
|
|
|
383
383
|
* **[lighthouse-badges](https://github.com/emazzotta/lighthouse-badges)** - Generate gh-badges (shields.io) based on Lighthouse performance.
|
|
384
384
|
* **[lighthouse-batch](https://www.npmjs.com/package/lighthouse-batch)** - Run Lighthouse over a number of sites and generate a summary of their metrics/scores.
|
|
385
385
|
* **[lighthouse-batch-parallel](https://www.npmjs.com/package/lighthouse-batch-parallel)** - Run multiple Lighthouse runs in parallel to accelerate the data collecting process, get the result stream (csv, json, js object) in your own process (warning: performance results may be volatile).
|
|
386
|
-
* **[lighthouse-check-action](https://github.com/foo-software/lighthouse-check-action)** - A
|
|
386
|
+
* **[lighthouse-check-action](https://github.com/foo-software/lighthouse-check-action)** - A Github Action to run Lighthouse in a workflow, featuring Slack notifications and report upload to S3.
|
|
387
387
|
* **[lighthouse-check-orb](https://circleci.com/orbs/registry/orb/foo-software/lighthouse-check)** - A CircleCI Orb to run Lighthouse in a workflow, featuring Slack notifications and report upload to S3.
|
|
388
388
|
* **[andreasonny83/lighthouse-ci](https://github.com/andreasonny83/lighthouse-ci)** - Run Lighthouse and assert scores satisfy your custom thresholds.
|
|
389
389
|
* **[GoogleChrome/lighthouse-ci](https://github.com/GoogleChrome/lighthouse-ci)** - (**official**) Automate running Lighthouse for every commit, viewing the changes, and preventing regressions.
|
|
390
|
-
* **[lighthouse-ci-action](https://github.com/treosh/lighthouse-ci-action)** - A
|
|
390
|
+
* **[lighthouse-ci-action](https://github.com/treosh/lighthouse-ci-action)** - A Github Action that makes it easy to run Lighthouse in CI and keep your pages small using performance budgets.
|
|
391
391
|
* **[lighthouse-cron](https://github.com/thearegee/lighthouse-cron)** - Cron multiple batch Lighthouse audits and emit results for sending to remote server.
|
|
392
392
|
* **[lighthouse-gh-reporter](https://github.com/carlesnunez/lighthouse-gh-reporter)** - Run Lighthouse in CI and report back in a comment on your pull requests
|
|
393
393
|
* **[lighthouse-hue](https://github.com/ebidel/lighthouse-hue)** - Set the color of Philips Hue lights based on a Lighthouse score
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const fetch = require('node-fetch');
|
|
10
|
-
const {LH_ROOT} = require('../../../root.js');
|
|
11
10
|
|
|
12
|
-
const inspectorIssuesGathererPath =
|
|
13
|
-
|
|
11
|
+
const inspectorIssuesGathererPath = __dirname +
|
|
12
|
+
'/../../lighthouse-core/gather/gatherers/inspector-issues.js';
|
|
14
13
|
const inspectorIssuesGathererSource = fs.readFileSync(inspectorIssuesGathererPath, 'utf-8');
|
|
15
14
|
|
|
16
15
|
/* eslint-env jest */
|
|
@@ -16,7 +16,7 @@ describe('installabilityErrors', () => {
|
|
|
16
16
|
|
|
17
17
|
beforeAll(async () => {
|
|
18
18
|
const installableLoggingGitTilesUrl =
|
|
19
|
-
'https://chromium.googlesource.com/chromium/src/+/
|
|
19
|
+
'https://chromium.googlesource.com/chromium/src/+/master/components/webapps/browser/installable/installable_logging.cc?format=TEXT';
|
|
20
20
|
const resp = await fetch(installableLoggingGitTilesUrl);
|
|
21
21
|
if (!resp.ok) {
|
|
22
22
|
throw new Error(`Chromium source fetch failed: ${resp.status} ${resp.statusText}`);
|
|
@@ -25,7 +25,7 @@ describe('installabilityErrors', () => {
|
|
|
25
25
|
const buff = Buffer.from(base64, 'base64');
|
|
26
26
|
const text = buff.toString('utf-8');
|
|
27
27
|
|
|
28
|
-
// Apply some *beautiful* regexes to parse the C++ of https://chromium.googlesource.com/chromium/src/+/
|
|
28
|
+
// Apply some *beautiful* regexes to parse the C++ of https://chromium.googlesource.com/chromium/src/+/master/chrome/browser/installable/installable_logging.cc
|
|
29
29
|
const handledErrorConsts = [...text.matchAll(/error_id = (k.*?);/g)].map(([_, match]) => match);
|
|
30
30
|
const errorConstsToIdsCode = [...text.matchAll(/static const char k.*?Id\[\](.|\n)*?;/g)].map(
|
|
31
31
|
([match]) => match.replace(/\n/, '')
|
|
@@ -11,13 +11,12 @@ const fs = require('fs');
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
const shell = require('child_process').execSync;
|
|
13
13
|
const utils = require('./utils.js');
|
|
14
|
-
const {LH_ROOT} = require('../../root.js');
|
|
15
14
|
|
|
16
15
|
const TARGET = 'Release';
|
|
17
16
|
const CONTENT_SHELL_ZIP = 'content-shell.zip';
|
|
18
17
|
const MAX_CONTENT_SHELLS = 10;
|
|
19
18
|
const PLATFORM = getPlatform();
|
|
20
|
-
|
|
19
|
+
const LH_ROOT = `${__dirname}/../..`;
|
|
21
20
|
const CACHE_PATH = path.resolve(LH_ROOT, '.tmp', 'chromium-web-tests', 'content-shells');
|
|
22
21
|
const COMMIT_POSITION_UPDATE_PERIOD = 420;
|
|
23
22
|
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
{"id":"SNYK-JS-THREE-1064931","severity":"high","semver":{"vulnerable":["<0.125.0"]}}
|
|
155
155
|
],
|
|
156
156
|
"underscore":[
|
|
157
|
-
{"id":"SNYK-JS-UNDERSCORE-1080984","severity":"
|
|
157
|
+
{"id":"SNYK-JS-UNDERSCORE-1080984","severity":"low","semver":{"vulnerable":[">=1.13.0-0 <1.13.0-2",">=1.3.2 <1.12.1"]}}
|
|
158
158
|
],
|
|
159
159
|
"vue":[
|
|
160
160
|
{"id":"npm:vue:20170829","severity":"medium","semver":{"vulnerable":["<2.4.3"]}},
|
package/tsconfig.json
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"lighthouse-core/lib/cdt",
|
|
25
25
|
"lighthouse-core/test/audits/**/*.js",
|
|
26
26
|
"lighthouse-core/test/fixtures/**/*.js",
|
|
27
|
+
"lighthouse-core/test/report/**/*.js",
|
|
27
28
|
"lighthouse-core/test/computed/**/*.js",
|
|
28
29
|
"clients/test/**/*.js",
|
|
29
30
|
"lighthouse-cli/test/fixtures/**/*.js",
|
package/types/artifacts.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ declare global {
|
|
|
24
24
|
| 'HTTPRedirect'
|
|
25
25
|
| 'Manifest'
|
|
26
26
|
| 'MixedContent'
|
|
27
|
+
| 'ScriptElements'
|
|
28
|
+
| 'ServiceWorker'
|
|
27
29
|
| keyof FRBaseArtifacts
|
|
28
30
|
>;
|
|
29
31
|
|
|
@@ -44,6 +46,10 @@ declare global {
|
|
|
44
46
|
fetchTime: string;
|
|
45
47
|
/** A set of warnings about unexpected things encountered while loading and testing the page. */
|
|
46
48
|
LighthouseRunWarnings: Array<string | IcuMessage>;
|
|
49
|
+
/** Device which Chrome is running on. */
|
|
50
|
+
HostFormFactor: 'desktop'|'mobile';
|
|
51
|
+
/** The user agent string of the version of Chrome used. */
|
|
52
|
+
HostUserAgent: string;
|
|
47
53
|
/** The benchmark index that indicates rough device class. */
|
|
48
54
|
BenchmarkIndex: number;
|
|
49
55
|
/** An object containing information about the testing configuration used by Lighthouse. */
|
|
@@ -66,10 +72,6 @@ declare global {
|
|
|
66
72
|
* The set of base artifacts that were replaced by standard gatherers in Fraggle Rock.
|
|
67
73
|
*/
|
|
68
74
|
export interface LegacyBaseArtifacts {
|
|
69
|
-
/** Device which Chrome is running on. */
|
|
70
|
-
HostFormFactor: 'desktop'|'mobile';
|
|
71
|
-
/** The user agent string of the version of Chrome used. */
|
|
72
|
-
HostUserAgent: string;
|
|
73
75
|
/** The user agent string that Lighthouse used to load the page. Set to the empty string if unknown. */
|
|
74
76
|
NetworkUserAgent: string;
|
|
75
77
|
/** Information on detected tech stacks (e.g. JS libraries) used by the page. */
|
|
@@ -112,7 +114,7 @@ declare global {
|
|
|
112
114
|
* Artifacts provided by the default gatherers. Augment this interface when adding additional
|
|
113
115
|
* gatherers. Changes to these artifacts are not considered a breaking Lighthouse change.
|
|
114
116
|
*/
|
|
115
|
-
export interface GathererArtifacts extends PublicGathererArtifacts
|
|
117
|
+
export interface GathererArtifacts extends PublicGathererArtifacts {
|
|
116
118
|
/** The results of running the aXe accessibility tests on the page. */
|
|
117
119
|
Accessibility: Artifacts.Accessibility;
|
|
118
120
|
/** Array of all anchors on the page. */
|
|
@@ -140,8 +142,6 @@ declare global {
|
|
|
140
142
|
FormElements: Artifacts.Form[];
|
|
141
143
|
/** Screenshot of the entire page (rather than just the above the fold content). */
|
|
142
144
|
FullPageScreenshot: Artifacts.FullPageScreenshot | null;
|
|
143
|
-
/** Information about how Lighthouse artifacts were gathered. */
|
|
144
|
-
GatherContext: {gatherMode: LH.Gatherer.GatherMode};
|
|
145
145
|
/** Information about event listeners registered on the global object. */
|
|
146
146
|
GlobalListeners: Array<Artifacts.GlobalListener>;
|
|
147
147
|
/** Whether the page ended up on an HTTPS page after attempting to load the HTTP version. */
|
|
@@ -612,18 +612,12 @@ declare global {
|
|
|
612
612
|
devtoolsLog: DevtoolsLog;
|
|
613
613
|
trace: Trace;
|
|
614
614
|
settings: Immutable<Config.Settings>;
|
|
615
|
-
gatherContext: Artifacts['GatherContext'];
|
|
616
615
|
simulator?: LanternSimulator;
|
|
617
616
|
}
|
|
618
617
|
|
|
619
618
|
export interface MetricComputationData extends MetricComputationDataInput {
|
|
620
619
|
networkRecords: Array<Artifacts.NetworkRequest>;
|
|
621
|
-
|
|
622
|
-
processedNavigation?: ProcessedNavigation;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
export interface NavigationMetricComputationData extends MetricComputationData {
|
|
626
|
-
processedNavigation: ProcessedNavigation;
|
|
620
|
+
traceOfTab: TraceOfTab;
|
|
627
621
|
}
|
|
628
622
|
|
|
629
623
|
export interface Metric {
|
|
@@ -650,11 +644,6 @@ declare global {
|
|
|
650
644
|
export type Speedline = speedline.Output<'speedIndex'>;
|
|
651
645
|
|
|
652
646
|
export interface TraceTimes {
|
|
653
|
-
timeOrigin: number;
|
|
654
|
-
traceEnd: number;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
export interface NavigationTraceTimes {
|
|
658
647
|
timeOrigin: number;
|
|
659
648
|
firstPaint?: number;
|
|
660
649
|
firstContentfulPaint: number;
|
|
@@ -667,32 +656,23 @@ declare global {
|
|
|
667
656
|
domContentLoaded?: number;
|
|
668
657
|
}
|
|
669
658
|
|
|
670
|
-
export interface
|
|
671
|
-
/** The raw timestamps of key events, in microseconds. */
|
|
659
|
+
export interface TraceOfTab {
|
|
660
|
+
/** The raw timestamps of key metric events, in microseconds. */
|
|
672
661
|
timestamps: TraceTimes;
|
|
673
|
-
/** The relative times from
|
|
662
|
+
/** The relative times from navigationStart to key metric events, in milliseconds. */
|
|
674
663
|
timings: TraceTimes;
|
|
675
664
|
/** The subset of trace events from the page's process, sorted by timestamp. */
|
|
676
665
|
processEvents: Array<TraceEvent>;
|
|
677
666
|
/** The subset of trace events from the page's main thread, sorted by timestamp. */
|
|
678
667
|
mainThreadEvents: Array<TraceEvent>;
|
|
679
|
-
/** The subset of trace events from the main frame, sorted by timestamp. */
|
|
680
|
-
frameEvents: Array<TraceEvent>;
|
|
681
668
|
/** The subset of trace events from the main frame and any child frames, sorted by timestamp. */
|
|
682
669
|
frameTreeEvents: Array<TraceEvent>;
|
|
683
670
|
/** IDs for the trace's main frame, process, and thread. */
|
|
684
671
|
mainFrameIds: {pid: number, tid: number, frameId: string};
|
|
685
672
|
/** The list of frames committed in the trace. */
|
|
686
673
|
frames: Array<{id: string, url: string}>;
|
|
687
|
-
/** The trace event marking the time at which the
|
|
674
|
+
/** The trace event marking the time at which the page load should consider to have begun. Typically the same as the navigationStart but might differ due to SPA navigations, client-side redirects, etc. */
|
|
688
675
|
timeOriginEvt: TraceEvent;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
export interface ProcessedNavigation {
|
|
692
|
-
/** The raw timestamps of key metric events, in microseconds. */
|
|
693
|
-
timestamps: NavigationTraceTimes;
|
|
694
|
-
/** The relative times from navigationStart to key metric events, in milliseconds. */
|
|
695
|
-
timings: NavigationTraceTimes;
|
|
696
676
|
/** The trace event marking firstPaint, if it was found. */
|
|
697
677
|
firstPaintEvt?: TraceEvent;
|
|
698
678
|
/** The trace event marking firstContentfulPaint, if it was found. */
|
|
@@ -743,11 +723,11 @@ declare global {
|
|
|
743
723
|
}
|
|
744
724
|
|
|
745
725
|
export interface TimingSummary {
|
|
746
|
-
firstContentfulPaint: number
|
|
726
|
+
firstContentfulPaint: number;
|
|
747
727
|
firstContentfulPaintTs: number | undefined;
|
|
748
728
|
firstContentfulPaintAllFrames: number | undefined;
|
|
749
729
|
firstContentfulPaintAllFramesTs: number | undefined;
|
|
750
|
-
firstMeaningfulPaint: number
|
|
730
|
+
firstMeaningfulPaint: number;
|
|
751
731
|
firstMeaningfulPaintTs: number | undefined;
|
|
752
732
|
largestContentfulPaint: number | undefined;
|
|
753
733
|
largestContentfulPaintTs: number | undefined;
|
|
@@ -761,20 +741,20 @@ declare global {
|
|
|
761
741
|
cumulativeLayoutShift: number | undefined;
|
|
762
742
|
cumulativeLayoutShiftMainFrame: number | undefined;
|
|
763
743
|
totalCumulativeLayoutShift: number | undefined;
|
|
764
|
-
totalBlockingTime: number
|
|
744
|
+
totalBlockingTime: number;
|
|
765
745
|
observedTimeOrigin: number;
|
|
766
746
|
observedTimeOriginTs: number;
|
|
767
|
-
observedNavigationStart: number
|
|
768
|
-
observedNavigationStartTs: number
|
|
747
|
+
observedNavigationStart: number;
|
|
748
|
+
observedNavigationStartTs: number;
|
|
769
749
|
observedCumulativeLayoutShift: number | undefined;
|
|
770
750
|
observedCumulativeLayoutShiftMainFrame: number | undefined;
|
|
771
751
|
observedTotalCumulativeLayoutShift: number | undefined;
|
|
772
752
|
observedFirstPaint: number | undefined;
|
|
773
753
|
observedFirstPaintTs: number | undefined;
|
|
774
|
-
observedFirstContentfulPaint: number
|
|
775
|
-
observedFirstContentfulPaintTs: number
|
|
776
|
-
observedFirstContentfulPaintAllFrames: number
|
|
777
|
-
observedFirstContentfulPaintAllFramesTs: number
|
|
754
|
+
observedFirstContentfulPaint: number;
|
|
755
|
+
observedFirstContentfulPaintTs: number;
|
|
756
|
+
observedFirstContentfulPaintAllFrames: number;
|
|
757
|
+
observedFirstContentfulPaintAllFramesTs: number;
|
|
778
758
|
observedFirstMeaningfulPaint: number | undefined;
|
|
779
759
|
observedFirstMeaningfulPaintTs: number | undefined;
|
|
780
760
|
observedLargestContentfulPaint: number | undefined;
|
package/types/audit.d.ts
CHANGED
|
@@ -57,8 +57,6 @@ declare global {
|
|
|
57
57
|
__internalOptionalArtifacts?: Array<keyof Artifacts>;
|
|
58
58
|
/** A string identifying how the score should be interpreted for display. */
|
|
59
59
|
scoreDisplayMode?: Audit.ScoreDisplayMode;
|
|
60
|
-
/** A list of gather modes that this audit is applicable to. */
|
|
61
|
-
supportedModes?: Gatherer.GatherMode[],
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
export interface ByteEfficiencyItem extends Audit.Details.OpportunityItem {
|
package/types/config.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare global {
|
|
|
49
49
|
*/
|
|
50
50
|
export interface FRConfig {
|
|
51
51
|
settings: Settings;
|
|
52
|
-
artifacts:
|
|
52
|
+
artifacts: ArtifactDefn[] | null;
|
|
53
53
|
navigations: NavigationDefn[] | null;
|
|
54
54
|
audits: AuditDefn[] | null;
|
|
55
55
|
categories: Record<string, Category> | null;
|
|
@@ -160,7 +160,7 @@ declare global {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export interface NavigationDefn extends Omit<Required<NavigationJson>, 'artifacts'> {
|
|
163
|
-
artifacts:
|
|
163
|
+
artifacts: ArtifactDefn[];
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export interface ArtifactDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
|
|
@@ -171,26 +171,12 @@ declare global {
|
|
|
171
171
|
Record<Exclude<TDependencies, Gatherer.DefaultDependenciesKey>, {id: string}>;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
type ArtifactDefnExpander<TDependencies extends Gatherer.DependencyKey> =
|
|
175
|
-
// Lack of brackets intentional here to convert to the union of all individual dependencies.
|
|
176
|
-
TDependencies extends Gatherer.DefaultDependenciesKey ?
|
|
177
|
-
ArtifactDefn<Gatherer.DefaultDependenciesKey> :
|
|
178
|
-
ArtifactDefn<TDependencies>
|
|
179
|
-
export type AnyArtifactDefn = ArtifactDefnExpander<Gatherer.DefaultDependenciesKey>|ArtifactDefnExpander<Gatherer.DependencyKey>
|
|
180
|
-
|
|
181
174
|
export interface FRGathererDefn<TDependencies extends Gatherer.DependencyKey = Gatherer.DependencyKey> {
|
|
182
175
|
implementation?: ClassOf<Gatherer.FRGathererInstance<TDependencies>>;
|
|
183
176
|
instance: Gatherer.FRGathererInstance<TDependencies>;
|
|
184
177
|
path?: string;
|
|
185
178
|
}
|
|
186
179
|
|
|
187
|
-
type FRGathererDefnExpander<TDependencies extends Gatherer.DependencyKey> =
|
|
188
|
-
// Lack of brackets intentional here to convert to the union of all individual dependencies.
|
|
189
|
-
TDependencies extends Gatherer.DefaultDependenciesKey ?
|
|
190
|
-
FRGathererDefn<Gatherer.DefaultDependenciesKey> :
|
|
191
|
-
FRGathererDefn<TDependencies>
|
|
192
|
-
export type AnyFRGathererDefn = FRGathererDefnExpander<Gatherer.DefaultDependenciesKey>|FRGathererDefnExpander<Gatherer.DependencyKey>
|
|
193
|
-
|
|
194
180
|
export interface GathererDefn {
|
|
195
181
|
implementation?: ClassOf<Gatherer.GathererInstance>;
|
|
196
182
|
instance: Gatherer.GathererInstance;
|
package/types/externs.d.ts
CHANGED
package/types/gatherer.d.ts
CHANGED
|
@@ -69,7 +69,14 @@ declare global {
|
|
|
69
69
|
trace?: Trace;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export type
|
|
72
|
+
export type PhaseArtifact = |
|
|
73
|
+
LH.GathererArtifacts[keyof LH.GathererArtifacts] |
|
|
74
|
+
LH.Artifacts['devtoolsLogs'] |
|
|
75
|
+
LH.Artifacts['traces'] |
|
|
76
|
+
LH.Artifacts['WebAppManifest'] |
|
|
77
|
+
LH.Artifacts['InstallabilityErrors'] |
|
|
78
|
+
LH.Artifacts['Stacks'];
|
|
79
|
+
export type PhaseResultNonPromise = void|PhaseArtifact
|
|
73
80
|
export type PhaseResult = PhaseResultNonPromise | Promise<PhaseResultNonPromise>
|
|
74
81
|
|
|
75
82
|
export type GatherMode = 'snapshot'|'timespan'|'navigation';
|
|
@@ -87,7 +94,7 @@ declare global {
|
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
interface GathererMetaWithDependencies<
|
|
90
|
-
TDependencies extends
|
|
97
|
+
TDependencies extends DependencyKey = DefaultDependenciesKey
|
|
91
98
|
> extends GathererMetaNoDependencies {
|
|
92
99
|
/**
|
|
93
100
|
* The set of required dependencies that this gatherer needs before it can compute its results.
|
|
@@ -96,9 +103,9 @@ declare global {
|
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
export type GathererMeta<TDependencies extends DependencyKey = DefaultDependenciesKey> =
|
|
99
|
-
|
|
106
|
+
TDependencies extends DefaultDependenciesKey ?
|
|
100
107
|
GathererMetaNoDependencies :
|
|
101
|
-
GathererMetaWithDependencies<
|
|
108
|
+
GathererMetaWithDependencies<TDependencies>;
|
|
102
109
|
|
|
103
110
|
export interface GathererInstance {
|
|
104
111
|
name: keyof LH.GathererArtifacts;
|
|
@@ -114,18 +121,11 @@ declare global {
|
|
|
114
121
|
meta: GathererMeta<TDependencies>;
|
|
115
122
|
startInstrumentation(context: FRTransitionalContext<DefaultDependenciesKey>): Promise<void>|void;
|
|
116
123
|
startSensitiveInstrumentation(context: FRTransitionalContext<DefaultDependenciesKey>): Promise<void>|void;
|
|
117
|
-
stopSensitiveInstrumentation(context: FRTransitionalContext<
|
|
118
|
-
stopInstrumentation(context: FRTransitionalContext<
|
|
124
|
+
stopSensitiveInstrumentation(context: FRTransitionalContext<TDependencies>): Promise<void>|void;
|
|
125
|
+
stopInstrumentation(context: FRTransitionalContext<TDependencies>): Promise<void>|void;
|
|
119
126
|
getArtifact(context: FRTransitionalContext<TDependencies>): PhaseResult;
|
|
120
127
|
}
|
|
121
128
|
|
|
122
|
-
type FRGathererInstanceExpander<TDependencies extends Gatherer.DependencyKey> =
|
|
123
|
-
// Lack of brackets intentional here to convert to the union of all individual dependencies.
|
|
124
|
-
TDependencies extends Gatherer.DefaultDependenciesKey ?
|
|
125
|
-
FRGathererInstance<Gatherer.DefaultDependenciesKey> :
|
|
126
|
-
FRGathererInstance<Exclude<TDependencies, DefaultDependenciesKey>>
|
|
127
|
-
export type AnyFRGathererInstance = FRGathererInstanceExpander<Gatherer.DependencyKey>
|
|
128
|
-
|
|
129
129
|
namespace Simulation {
|
|
130
130
|
export type GraphNode = import('../lighthouse-core/lib/dependency-graph/base-node').Node;
|
|
131
131
|
export type GraphNetworkNode = _NetworkNode;
|
package/types/html-renderer.d.ts
CHANGED
|
@@ -4,20 +4,20 @@
|
|
|
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 _CategoryRenderer = require('../report/renderer/category-renderer.js');
|
|
8
|
-
import _CriticalRequestChainRenderer = require('../report/renderer/crc-details-renderer.js');
|
|
9
|
-
import _SnippetRenderer = require('../report/renderer/snippet-renderer.js');
|
|
10
|
-
import _ElementScreenshotRenderer = require('../report/renderer/element-screenshot-renderer.js');
|
|
11
|
-
import _DetailsRenderer = require('../report/renderer/details-renderer.js');
|
|
12
|
-
import _DOM = require('../report/renderer/dom.js');
|
|
13
|
-
import _I18n = require('../report/renderer/i18n.js');
|
|
14
|
-
import _PerformanceCategoryRenderer = require('../report/renderer/performance-category-renderer.js');
|
|
15
|
-
import _PwaCategoryRenderer = require('../report/renderer/pwa-category-renderer.js');
|
|
16
|
-
import _ReportRenderer = require('../report/renderer/report-renderer.js');
|
|
17
|
-
import _ReportUIFeatures = require('../report/renderer/report-ui-features.js');
|
|
18
|
-
import _Util = require('../report/renderer/util.js');
|
|
19
|
-
import _TextEncoding = require('../report/renderer/text-encoding.js');
|
|
20
|
-
import _prepareLabData = require('../report/renderer/psi.js');
|
|
7
|
+
import _CategoryRenderer = require('../lighthouse-core/report/html/renderer/category-renderer.js');
|
|
8
|
+
import _CriticalRequestChainRenderer = require('../lighthouse-core/report/html/renderer/crc-details-renderer.js');
|
|
9
|
+
import _SnippetRenderer = require('../lighthouse-core/report/html/renderer/snippet-renderer.js');
|
|
10
|
+
import _ElementScreenshotRenderer = require('../lighthouse-core/report/html/renderer/element-screenshot-renderer.js');
|
|
11
|
+
import _DetailsRenderer = require('../lighthouse-core/report/html/renderer/details-renderer.js');
|
|
12
|
+
import _DOM = require('../lighthouse-core/report/html/renderer/dom.js');
|
|
13
|
+
import _I18n = require('../lighthouse-core/report/html/renderer/i18n.js');
|
|
14
|
+
import _PerformanceCategoryRenderer = require('../lighthouse-core/report/html/renderer/performance-category-renderer.js');
|
|
15
|
+
import _PwaCategoryRenderer = require('../lighthouse-core/report/html/renderer/pwa-category-renderer.js');
|
|
16
|
+
import _ReportRenderer = require('../lighthouse-core/report/html/renderer/report-renderer.js');
|
|
17
|
+
import _ReportUIFeatures = require('../lighthouse-core/report/html/renderer/report-ui-features.js');
|
|
18
|
+
import _Util = require('../lighthouse-core/report/html/renderer/util.js');
|
|
19
|
+
import _TextEncoding = require('../lighthouse-core/report/html/renderer/text-encoding.js');
|
|
20
|
+
import _prepareLabData = require('../lighthouse-core/report/html/renderer/psi.js');
|
|
21
21
|
import _FileNamer = require('../lighthouse-core/lib/file-namer.js');
|
|
22
22
|
|
|
23
23
|
declare global {
|
package/types/i18n.d.ts
CHANGED
|
@@ -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 Util = require('../report/renderer/util.js');
|
|
7
|
+
import Util = require('../lighthouse-core/report/html/renderer/util.js');
|
|
8
8
|
|
|
9
9
|
declare global {
|
|
10
10
|
module LH {
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @fileoverview Checks to see if the images used on the page are larger than
|
|
8
|
-
* their display sizes. The audit will list all images that are larger than
|
|
9
|
-
* their display size with DPR (a 1000px wide image displayed as a
|
|
10
|
-
* 500px high-res image on a Retina display is 100% used);
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
const Audit = require('../audit.js');
|
|
15
|
-
const UsesResponsiveImages = require('./uses-responsive-images.js');
|
|
16
|
-
const URL = require('../../lib/url-shim.js');
|
|
17
|
-
const i18n = require('../../lib/i18n/i18n.js');
|
|
18
|
-
|
|
19
|
-
const UIStrings = {
|
|
20
|
-
/** Label for a column in a data table; entries will be the dimensions of an image as it appears on the page. */
|
|
21
|
-
columnDisplayedDimensions: 'Displayed dimensions',
|
|
22
|
-
/** Label for a column in a data table; entries will be the dimensions of an image from it's source file. */
|
|
23
|
-
columnActualDimensions: 'Actual dimensions',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
27
|
-
|
|
28
|
-
// Based on byte threshold of 4096, with 3 bytes per pixel.
|
|
29
|
-
const IGNORE_THRESHOLD_IN_PIXELS = 1365;
|
|
30
|
-
|
|
31
|
-
class UsesResponsiveImagesSnapshot extends Audit {
|
|
32
|
-
/**
|
|
33
|
-
* @return {LH.Audit.Meta}
|
|
34
|
-
*/
|
|
35
|
-
static get meta() {
|
|
36
|
-
return {
|
|
37
|
-
id: 'uses-responsive-images-snapshot',
|
|
38
|
-
title: UsesResponsiveImages.str_(UsesResponsiveImages.UIStrings.title),
|
|
39
|
-
description: UsesResponsiveImages.str_(UsesResponsiveImages.UIStrings.description),
|
|
40
|
-
supportedModes: ['snapshot'],
|
|
41
|
-
requiredArtifacts: ['ImageElements', 'ViewportDimensions'],
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @param {LH.Artifacts} artifacts
|
|
47
|
-
* @return {Promise<LH.Audit.Product>}
|
|
48
|
-
*/
|
|
49
|
-
static async audit(artifacts) {
|
|
50
|
-
let score = 1;
|
|
51
|
-
/** @type {LH.Audit.Details.TableItem[]} */
|
|
52
|
-
const items = [];
|
|
53
|
-
for (const image of artifacts.ImageElements) {
|
|
54
|
-
if (!image.naturalDimensions) continue;
|
|
55
|
-
const actual = image.naturalDimensions;
|
|
56
|
-
const displayed = UsesResponsiveImages.getDisplayedDimensions(
|
|
57
|
-
{...image, naturalWidth: actual.width, naturalHeight: actual.height},
|
|
58
|
-
artifacts.ViewportDimensions
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const actualPixels = actual.width * actual.height;
|
|
62
|
-
const usedPixels = displayed.width * displayed.height;
|
|
63
|
-
|
|
64
|
-
if (actualPixels <= usedPixels) continue;
|
|
65
|
-
if (actualPixels - usedPixels > IGNORE_THRESHOLD_IN_PIXELS) score = 0;
|
|
66
|
-
|
|
67
|
-
items.push({
|
|
68
|
-
url: URL.elideDataURI(image.src),
|
|
69
|
-
displayedDimensions: `${displayed.width}x${displayed.height}`,
|
|
70
|
-
actualDimensions: `${actual.width}x${actual.height}`,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** @type {LH.Audit.Details.Table['headings']} */
|
|
75
|
-
const headings = [
|
|
76
|
-
/* eslint-disable max-len */
|
|
77
|
-
{key: 'url', itemType: 'thumbnail', text: ''},
|
|
78
|
-
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
|
|
79
|
-
{key: 'displayedDimensions', itemType: 'text', text: str_(UIStrings.columnDisplayedDimensions)},
|
|
80
|
-
{key: 'actualDimensions', itemType: 'text', text: str_(UIStrings.columnActualDimensions)},
|
|
81
|
-
/* eslint-enable max-len */
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
const details = Audit.makeTableDetails(headings, items);
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
score,
|
|
88
|
-
details,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
module.exports = UsesResponsiveImagesSnapshot;
|
|
94
|
-
module.exports.UIStrings = UIStrings;
|