lighthouse 11.7.1 → 12.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/CONTRIBUTING.md +2 -2
- package/cli/bin.js +0 -7
- package/cli/cli-flags.d.ts +1 -5
- package/cli/cli-flags.js +4 -8
- package/cli/test/smokehouse/__snapshots__/report-assert-test.js.snap +14 -14
- package/cli/test/smokehouse/config/exclusions.js +3 -0
- package/cli/test/smokehouse/core-tests.js +6 -20
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +2 -2
- package/core/audits/accessibility/aria-conditional-attr.d.ts +10 -0
- package/core/audits/accessibility/aria-conditional-attr.js +43 -0
- package/core/audits/accessibility/{duplicate-id-active.d.ts → aria-deprecated-role.d.ts} +3 -3
- package/core/audits/accessibility/aria-deprecated-role.js +43 -0
- package/core/audits/accessibility/aria-prohibited-attr.d.ts +10 -0
- package/core/audits/accessibility/aria-prohibited-attr.js +44 -0
- package/core/audits/accessibility/target-size.js +0 -1
- package/core/audits/byte-efficiency/byte-efficiency-audit.d.ts +0 -16
- package/core/audits/byte-efficiency/byte-efficiency-audit.js +1 -38
- package/core/audits/byte-efficiency/offscreen-images.d.ts +0 -11
- package/core/audits/byte-efficiency/offscreen-images.js +0 -15
- package/core/audits/byte-efficiency/render-blocking-resources.js +27 -26
- package/core/audits/byte-efficiency/unminified-css.js +2 -2
- package/core/audits/byte-efficiency/unused-css-rules.js +3 -1
- package/core/audits/dobetterweb/uses-http2.d.ts +0 -13
- package/core/audits/dobetterweb/uses-http2.js +4 -38
- package/core/audits/font-display.js +2 -2
- package/core/audits/layout-shifts.js +1 -1
- package/core/audits/preload-fonts.d.ts +1 -5
- package/core/audits/preload-fonts.js +1 -10
- package/core/audits/prioritize-lcp-image.js +2 -2
- package/core/audits/redirects-http.d.ts +19 -0
- package/core/audits/redirects-http.js +75 -0
- package/core/audits/resource-summary.d.ts +2 -0
- package/core/audits/resource-summary.js +5 -4
- package/core/audits/seo/is-crawlable.d.ts +2 -1
- package/core/audits/seo/link-text.js +12 -0
- package/core/audits/uses-rel-preload.d.ts +1 -5
- package/core/audits/uses-rel-preload.js +5 -15
- package/core/audits/work-during-interaction.d.ts +2 -2
- package/core/audits/work-during-interaction.js +2 -2
- package/core/computed/js-bundles.d.ts +1 -1
- package/core/computed/metrics/lantern-first-contentful-paint.d.ts +13 -82
- package/core/computed/metrics/lantern-first-contentful-paint.js +16 -178
- package/core/computed/metrics/lantern-first-meaningful-paint.d.ts +13 -12
- package/core/computed/metrics/lantern-first-meaningful-paint.js +11 -49
- package/core/computed/metrics/lantern-interactive.d.ts +13 -21
- package/core/computed/metrics/lantern-interactive.js +12 -84
- package/core/computed/metrics/lantern-largest-contentful-paint.d.ts +13 -25
- package/core/computed/metrics/lantern-largest-contentful-paint.js +13 -80
- package/core/computed/metrics/lantern-max-potential-fid.d.ts +13 -24
- package/core/computed/metrics/lantern-max-potential-fid.js +12 -64
- package/core/computed/metrics/lantern-metric.d.ts +14 -18
- package/core/computed/metrics/lantern-metric.js +34 -30
- package/core/computed/metrics/lantern-speed-index.d.ts +13 -32
- package/core/computed/metrics/lantern-speed-index.js +13 -116
- package/core/computed/metrics/lantern-total-blocking-time.d.ts +13 -25
- package/core/computed/metrics/lantern-total-blocking-time.js +10 -94
- package/core/computed/metrics/metric.js +1 -3
- package/core/computed/module-duplication.d.ts +1 -1
- package/core/computed/navigation-insights.d.ts +36 -0
- package/core/computed/navigation-insights.js +35 -0
- package/core/computed/page-dependency-graph.js +3 -7
- package/core/computed/resource-summary.d.ts +10 -12
- package/core/computed/resource-summary.js +12 -19
- package/core/computed/trace-engine-result.d.ts +16 -3
- package/core/computed/trace-engine-result.js +19 -14
- package/core/computed/unused-css.d.ts +3 -1
- package/core/computed/unused-css.js +6 -5
- package/core/config/config-helpers.js +0 -4
- package/core/config/constants.js +0 -1
- package/core/config/default-config.js +63 -142
- package/core/config/experimental-config.js +11 -0
- package/core/config/filters.js +0 -1
- package/core/gather/driver/navigation.js +4 -1
- package/core/gather/driver/prepare.js +1 -1
- package/core/gather/driver/target-manager.js +4 -3
- package/core/gather/driver/wait-for-condition.js +2 -3
- package/core/gather/driver.d.ts +12 -0
- package/core/gather/driver.js +27 -0
- package/core/gather/gatherers/accessibility.js +4 -6
- package/core/gather/gatherers/css-usage.d.ts +0 -21
- package/core/gather/gatherers/css-usage.js +9 -119
- package/core/gather/gatherers/root-causes.d.ts +2 -2
- package/core/gather/gatherers/root-causes.js +6 -5
- package/core/gather/gatherers/stylesheets.d.ts +26 -0
- package/core/gather/gatherers/stylesheets.js +138 -0
- package/core/gather/gatherers/trace-elements.d.ts +2 -12
- package/core/gather/gatherers/trace-elements.js +2 -21
- package/core/gather/navigation-runner.js +3 -1
- package/core/gather/session.d.ts +8 -0
- package/core/gather/session.js +14 -1
- package/core/lib/emulation.js +2 -2
- package/core/lib/i18n/i18n.d.ts +0 -1
- package/core/lib/i18n/i18n.js +0 -2
- package/core/lib/lantern/cpu-node.d.ts +7 -1
- package/core/lib/lantern/cpu-node.js +12 -2
- package/core/lib/lantern/lantern-error.d.ts +8 -0
- package/core/lib/lantern/lantern-error.js +9 -0
- package/core/lib/lantern/metric.js +2 -6
- package/core/lib/lantern/metrics/first-contentful-paint.d.ts +79 -0
- package/core/lib/lantern/metrics/first-contentful-paint.js +200 -0
- package/core/lib/lantern/metrics/first-meaningful-paint.d.ts +6 -0
- package/core/lib/lantern/metrics/first-meaningful-paint.js +64 -0
- package/core/lib/lantern/metrics/interactive.d.ts +26 -0
- package/core/lib/lantern/metrics/interactive.js +112 -0
- package/core/lib/lantern/metrics/largest-contentful-paint.d.ts +19 -0
- package/core/lib/lantern/metrics/largest-contentful-paint.js +108 -0
- package/core/lib/lantern/metrics/max-potential-fid.d.ts +30 -0
- package/core/lib/lantern/metrics/max-potential-fid.js +92 -0
- package/core/lib/lantern/metrics/speed-index.d.ts +38 -0
- package/core/lib/lantern/metrics/speed-index.js +144 -0
- package/core/lib/lantern/metrics/total-blocking-time.d.ts +31 -0
- package/core/lib/lantern/metrics/total-blocking-time.js +128 -0
- package/core/lib/lantern/network-node.js +28 -4
- package/core/lib/lantern/page-dependency-graph.d.ts +4 -4
- package/core/lib/lantern/page-dependency-graph.js +19 -7
- package/core/lib/lantern/simulator/connection-pool.d.ts +2 -12
- package/core/lib/lantern/simulator/connection-pool.js +3 -22
- package/core/lib/lantern/simulator/network-analyzer.js +1 -12
- package/core/lib/lantern/simulator/simulator.d.ts +2 -4
- package/core/lib/lantern/simulator/simulator.js +7 -14
- package/core/lib/lantern/types/lantern.d.ts +5 -3
- package/core/lib/lantern-trace-saver.js +0 -1
- package/core/lib/lh-error.d.ts +9 -0
- package/core/lib/lh-error.js +13 -3
- package/core/lib/lighthouse-compatibility.js +53 -10
- package/core/lib/navigation-error.js +3 -0
- package/core/lib/network-request.d.ts +1 -0
- package/core/lib/network-request.js +28 -0
- package/core/runner.js +18 -25
- package/dist/report/bundle.esm.js +11 -112
- package/dist/report/flow.js +16 -117
- package/dist/report/standalone.js +12 -113
- package/flow-report/src/help-dialog.tsx +0 -1
- package/flow-report/src/i18n/i18n.d.ts +0 -4
- package/flow-report/src/i18n/ui-strings.d.ts +0 -1
- package/flow-report/src/i18n/ui-strings.js +0 -2
- package/flow-report/src/summary/category.tsx +10 -12
- package/package.json +5 -5
- package/readme.md +4 -4
- package/report/assets/styles.css +1 -60
- package/report/assets/templates.html +0 -95
- package/report/renderer/category-renderer.js +1 -1
- package/report/renderer/components.d.ts +2 -2
- package/report/renderer/components.js +2 -103
- package/report/renderer/dom.d.ts +1 -1
- package/report/renderer/dom.js +1 -1
- package/report/renderer/performance-category-renderer.d.ts +0 -7
- package/report/renderer/performance-category-renderer.js +1 -32
- package/report/renderer/report-renderer.js +3 -13
- package/report/renderer/report-ui-features.js +1 -1
- package/report/renderer/report-utils.d.ts +0 -1
- package/report/renderer/report-utils.js +13 -13
- package/shared/localization/locales/ar-XB.json +62 -329
- package/shared/localization/locales/ar.json +62 -329
- package/shared/localization/locales/bg.json +62 -329
- package/shared/localization/locales/ca.json +62 -329
- package/shared/localization/locales/cs.json +62 -329
- package/shared/localization/locales/da.json +62 -329
- package/shared/localization/locales/de.json +62 -329
- package/shared/localization/locales/el.json +62 -329
- package/shared/localization/locales/en-GB.json +62 -329
- package/shared/localization/locales/en-US.json +41 -272
- package/shared/localization/locales/en-XA.json +62 -329
- package/shared/localization/locales/en-XL.json +41 -272
- package/shared/localization/locales/es-419.json +62 -329
- package/shared/localization/locales/es.json +62 -329
- package/shared/localization/locales/fi.json +62 -329
- package/shared/localization/locales/fil.json +61 -328
- package/shared/localization/locales/fr.json +62 -329
- package/shared/localization/locales/he.json +62 -329
- package/shared/localization/locales/hi.json +62 -329
- package/shared/localization/locales/hr.json +63 -330
- package/shared/localization/locales/hu.json +62 -329
- package/shared/localization/locales/id.json +62 -329
- package/shared/localization/locales/it.json +62 -329
- package/shared/localization/locales/ja.json +62 -329
- package/shared/localization/locales/ko.json +62 -329
- package/shared/localization/locales/lt.json +62 -329
- package/shared/localization/locales/lv.json +62 -329
- package/shared/localization/locales/nl.json +62 -329
- package/shared/localization/locales/no.json +62 -329
- package/shared/localization/locales/pl.json +61 -328
- package/shared/localization/locales/pt-PT.json +62 -329
- package/shared/localization/locales/pt.json +64 -331
- package/shared/localization/locales/ro.json +62 -329
- package/shared/localization/locales/ru.json +62 -329
- package/shared/localization/locales/sk.json +62 -329
- package/shared/localization/locales/sl.json +62 -329
- package/shared/localization/locales/sr-Latn.json +62 -329
- package/shared/localization/locales/sr.json +62 -329
- package/shared/localization/locales/sv.json +62 -329
- package/shared/localization/locales/ta.json +61 -328
- package/shared/localization/locales/te.json +62 -329
- package/shared/localization/locales/th.json +62 -329
- package/shared/localization/locales/tr.json +62 -329
- package/shared/localization/locales/uk.json +62 -329
- package/shared/localization/locales/vi.json +61 -328
- package/shared/localization/locales/zh-HK.json +62 -329
- package/shared/localization/locales/zh-TW.json +61 -328
- package/shared/localization/locales/zh.json +62 -329
- package/tsconfig.json +1 -3
- package/types/artifacts.d.ts +21 -110
- package/types/audit.d.ts +0 -10
- package/types/config.d.ts +0 -1
- package/types/externs.d.ts +0 -2
- package/types/gatherer.d.ts +3 -0
- package/types/internal/smokehouse.d.ts +1 -1
- package/types/lh.d.ts +0 -2
- package/types/lhr/audit-details.d.ts +9 -4
- package/types/lhr/lhr.d.ts +0 -4
- package/types/lhr/settings.d.ts +0 -4
- package/core/audits/accessibility/duplicate-id-active.js +0 -42
- package/core/audits/content-width.d.ts +0 -17
- package/core/audits/content-width.js +0 -76
- package/core/audits/installable-manifest.d.ts +0 -111
- package/core/audits/installable-manifest.js +0 -248
- package/core/audits/layout-shift-elements.d.ts +0 -16
- package/core/audits/layout-shift-elements.js +0 -101
- package/core/audits/manual/pwa-cross-browser.d.ts +0 -12
- package/core/audits/manual/pwa-cross-browser.js +0 -40
- package/core/audits/manual/pwa-each-page-has-url.d.ts +0 -12
- package/core/audits/manual/pwa-each-page-has-url.js +0 -38
- package/core/audits/manual/pwa-page-transitions.d.ts +0 -12
- package/core/audits/manual/pwa-page-transitions.js +0 -38
- package/core/audits/maskable-icon.d.ts +0 -25
- package/core/audits/maskable-icon.js +0 -70
- package/core/audits/multi-check-audit.d.ts +0 -28
- package/core/audits/multi-check-audit.js +0 -82
- package/core/audits/no-unload-listeners.d.ts +0 -16
- package/core/audits/no-unload-listeners.js +0 -86
- package/core/audits/performance-budget.d.ts +0 -39
- package/core/audits/performance-budget.js +0 -154
- package/core/audits/script-elements-test-audit.d.ts +0 -14
- package/core/audits/script-elements-test-audit.js +0 -29
- package/core/audits/seo/plugins.d.ts +0 -15
- package/core/audits/seo/plugins.js +0 -150
- package/core/audits/seo/tap-targets.d.ts +0 -50
- package/core/audits/seo/tap-targets.js +0 -352
- package/core/audits/splash-screen.d.ts +0 -37
- package/core/audits/splash-screen.js +0 -98
- package/core/audits/themed-omnibox.d.ts +0 -42
- package/core/audits/themed-omnibox.js +0 -102
- package/core/audits/timing-budget.d.ts +0 -43
- package/core/audits/timing-budget.js +0 -175
- package/core/computed/manifest-values.d.ts +0 -24
- package/core/computed/manifest-values.js +0 -136
- package/core/config/budget.d.ts +0 -74
- package/core/config/budget.js +0 -340
- package/core/config/metrics-to-audits.d.ts +0 -19
- package/core/config/metrics-to-audits.js +0 -62
- package/core/gather/driver/service-workers.d.ts +0 -16
- package/core/gather/driver/service-workers.js +0 -52
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +0 -47
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +0 -233
- package/core/gather/gatherers/global-listeners.d.ts +0 -27
- package/core/gather/gatherers/global-listeners.js +0 -108
- package/core/gather/gatherers/installability-errors.d.ts +0 -17
- package/core/gather/gatherers/installability-errors.js +0 -56
- package/core/gather/gatherers/script-elements.d.ts +0 -21
- package/core/gather/gatherers/script-elements.js +0 -100
- package/core/gather/gatherers/seo/embedded-content.d.ts +0 -10
- package/core/gather/gatherers/seo/embedded-content.js +0 -63
- package/core/gather/gatherers/seo/tap-targets.d.ts +0 -21
- package/core/gather/gatherers/seo/tap-targets.js +0 -389
- package/core/gather/gatherers/service-worker.d.ts +0 -10
- package/core/gather/gatherers/service-worker.js +0 -32
- package/core/gather/gatherers/web-app-manifest.d.ts +0 -32
- package/core/gather/gatherers/web-app-manifest.js +0 -106
- package/report/renderer/pwa-category-renderer.d.ts +0 -55
- package/report/renderer/pwa-category-renderer.js +0 -184
- package/third-party/chromium-synchronization/installability-errors-test.js +0 -79
- package/types/lhr/budget.d.ts +0 -60
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export default ThemedOmnibox;
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* Audits if a page is configured for a themed address bar
|
|
5
|
-
*
|
|
6
|
-
* Requirements:
|
|
7
|
-
* * manifest is not empty
|
|
8
|
-
* * manifest has a theme_color
|
|
9
|
-
* * HTML has a theme-color meta
|
|
10
|
-
*
|
|
11
|
-
* Color validity is explicitly not checked.
|
|
12
|
-
*/
|
|
13
|
-
declare class ThemedOmnibox extends MultiCheckAudit {
|
|
14
|
-
/**
|
|
15
|
-
* @param {LH.Artifacts.MetaElement|undefined} themeColorMeta
|
|
16
|
-
* @param {Array<string>} failures
|
|
17
|
-
*/
|
|
18
|
-
static assessMetaThemecolor(themeColorMeta: LH.Artifacts.MetaElement | undefined, failures: Array<string>): void;
|
|
19
|
-
/**
|
|
20
|
-
* @param {LH.Artifacts.ManifestValues} manifestValues
|
|
21
|
-
* @param {Array<string>} failures
|
|
22
|
-
*/
|
|
23
|
-
static assessManifest(manifestValues: LH.Artifacts.ManifestValues, failures: Array<string>): void;
|
|
24
|
-
/**
|
|
25
|
-
* @param {LH.Artifacts} artifacts
|
|
26
|
-
* @param {LH.Audit.Context} context
|
|
27
|
-
* @return {Promise<{failures: Array<string>, manifestValues: LH.Artifacts.ManifestValues, themeColor: ?string}>}
|
|
28
|
-
*/
|
|
29
|
-
static audit_(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<{
|
|
30
|
-
failures: Array<string>;
|
|
31
|
-
manifestValues: LH.Artifacts.ManifestValues;
|
|
32
|
-
themeColor: string | null;
|
|
33
|
-
}>;
|
|
34
|
-
}
|
|
35
|
-
export namespace UIStrings {
|
|
36
|
-
const title: string;
|
|
37
|
-
const failureTitle: string;
|
|
38
|
-
const description: string;
|
|
39
|
-
}
|
|
40
|
-
import MultiCheckAudit from './multi-check-audit.js';
|
|
41
|
-
import { ManifestValues } from '../computed/manifest-values.js';
|
|
42
|
-
//# sourceMappingURL=themed-omnibox.d.ts.map
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import MultiCheckAudit from './multi-check-audit.js';
|
|
8
|
-
import {ManifestValues} from '../computed/manifest-values.js';
|
|
9
|
-
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
|
-
|
|
11
|
-
const UIStrings = {
|
|
12
|
-
/** Title of a Lighthouse audit that provides detail on the theme color the web page has set for the browser's address bar. This descriptive title is shown to users when an address-bar theme color has been set. */
|
|
13
|
-
title: 'Sets a theme color for the address bar.',
|
|
14
|
-
/** Title of a Lighthouse audit that provides detail on the theme color the web page has set for the browser's address bar. This descriptive title is shown to users when an address-bar theme color has not been set. */
|
|
15
|
-
failureTitle: 'Does not set a theme color for the address bar.',
|
|
16
|
-
/** Description of a Lighthouse audit that tells the user why they should set a theme color for the browser's address bar. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
17
|
-
description: 'The browser address bar can be themed to match your site. ' +
|
|
18
|
-
'[Learn more about theming the address bar](https://developer.chrome.com/docs/lighthouse/pwa/themed-omnibox/).',
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @fileoverview
|
|
25
|
-
* Audits if a page is configured for a themed address bar
|
|
26
|
-
*
|
|
27
|
-
* Requirements:
|
|
28
|
-
* * manifest is not empty
|
|
29
|
-
* * manifest has a theme_color
|
|
30
|
-
* * HTML has a theme-color meta
|
|
31
|
-
*
|
|
32
|
-
* Color validity is explicitly not checked.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
class ThemedOmnibox extends MultiCheckAudit {
|
|
36
|
-
/**
|
|
37
|
-
* @return {LH.Audit.Meta}
|
|
38
|
-
*/
|
|
39
|
-
static get meta() {
|
|
40
|
-
return {
|
|
41
|
-
id: 'themed-omnibox',
|
|
42
|
-
title: str_(UIStrings.title),
|
|
43
|
-
failureTitle: str_(UIStrings.failureTitle),
|
|
44
|
-
description: str_(UIStrings.description),
|
|
45
|
-
supportedModes: ['navigation'],
|
|
46
|
-
requiredArtifacts: ['WebAppManifest', 'InstallabilityErrors', 'MetaElements'],
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @param {LH.Artifacts.MetaElement|undefined} themeColorMeta
|
|
52
|
-
* @param {Array<string>} failures
|
|
53
|
-
*/
|
|
54
|
-
static assessMetaThemecolor(themeColorMeta, failures) {
|
|
55
|
-
if (!themeColorMeta) {
|
|
56
|
-
// TODO(#7238): i18n
|
|
57
|
-
failures.push('No `<meta name="theme-color">` tag found');
|
|
58
|
-
} else if (!themeColorMeta.content) {
|
|
59
|
-
failures.push('The theme-color meta tag did not contain a content value');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @param {LH.Artifacts.ManifestValues} manifestValues
|
|
65
|
-
* @param {Array<string>} failures
|
|
66
|
-
*/
|
|
67
|
-
static assessManifest(manifestValues, failures) {
|
|
68
|
-
if (manifestValues.isParseFailure && manifestValues.parseFailureReason) {
|
|
69
|
-
failures.push(manifestValues.parseFailureReason);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const themeColorCheck = manifestValues.allChecks.find(i => i.id === 'hasThemeColor');
|
|
74
|
-
if (themeColorCheck && !themeColorCheck.passing) {
|
|
75
|
-
failures.push(themeColorCheck.failureText);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @param {LH.Artifacts} artifacts
|
|
81
|
-
* @param {LH.Audit.Context} context
|
|
82
|
-
* @return {Promise<{failures: Array<string>, manifestValues: LH.Artifacts.ManifestValues, themeColor: ?string}>}
|
|
83
|
-
*/
|
|
84
|
-
static async audit_(artifacts, context) {
|
|
85
|
-
/** @type {Array<string>} */
|
|
86
|
-
const failures = [];
|
|
87
|
-
|
|
88
|
-
const themeColorMeta = artifacts.MetaElements.find(meta => meta.name === 'theme-color');
|
|
89
|
-
const manifestValues = await ManifestValues.request(artifacts, context);
|
|
90
|
-
ThemedOmnibox.assessManifest(manifestValues, failures);
|
|
91
|
-
ThemedOmnibox.assessMetaThemecolor(themeColorMeta, failures);
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
failures,
|
|
95
|
-
manifestValues,
|
|
96
|
-
themeColor: themeColorMeta?.content || null,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default ThemedOmnibox;
|
|
102
|
-
export {UIStrings};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export default TimingBudget;
|
|
2
|
-
export type BudgetItem = {
|
|
3
|
-
metric: LH.Budget.TimingMetric;
|
|
4
|
-
label: LH.IcuMessage;
|
|
5
|
-
measurement?: LH.Audit.Details.NumericValue | number;
|
|
6
|
-
overBudget?: LH.Audit.Details.NumericValue | number;
|
|
7
|
-
};
|
|
8
|
-
/** @typedef {{metric: LH.Budget.TimingMetric, label: LH.IcuMessage, measurement?: LH.Audit.Details.NumericValue|number, overBudget?: LH.Audit.Details.NumericValue|number}} BudgetItem */
|
|
9
|
-
declare class TimingBudget extends Audit {
|
|
10
|
-
/**
|
|
11
|
-
* @param {LH.Budget.TimingMetric} timingMetric
|
|
12
|
-
* @return {LH.IcuMessage}
|
|
13
|
-
*/
|
|
14
|
-
static getRowLabel(timingMetric: LH.Budget.TimingMetric): LH.IcuMessage;
|
|
15
|
-
/**
|
|
16
|
-
* @param {LH.Budget.TimingMetric} timingMetric
|
|
17
|
-
* @param {LH.Artifacts.TimingSummary} summary
|
|
18
|
-
* @return {number|undefined}
|
|
19
|
-
*/
|
|
20
|
-
static getMeasurement(timingMetric: LH.Budget.TimingMetric, summary: LH.Artifacts.TimingSummary): number | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* @param {LH.Util.Immutable<LH.Budget>} budget
|
|
23
|
-
* @param {LH.Artifacts.TimingSummary} summary
|
|
24
|
-
* @return {Array<BudgetItem>}
|
|
25
|
-
*/
|
|
26
|
-
static tableItems(budget: LH.Util.Immutable<LH.Budget>, summary: LH.Artifacts.TimingSummary): Array<BudgetItem>;
|
|
27
|
-
/**
|
|
28
|
-
* @param {LH.Artifacts} artifacts
|
|
29
|
-
* @param {LH.Audit.Context} context
|
|
30
|
-
* @return {Promise<LH.Audit.Product>}
|
|
31
|
-
*/
|
|
32
|
-
static audit(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<LH.Audit.Product>;
|
|
33
|
-
}
|
|
34
|
-
export namespace UIStrings {
|
|
35
|
-
const title: string;
|
|
36
|
-
const description: string;
|
|
37
|
-
const columnTimingMetric: string;
|
|
38
|
-
const columnMeasurement: string;
|
|
39
|
-
}
|
|
40
|
-
import { Budget } from '../config/budget.js';
|
|
41
|
-
import { Audit } from './audit.js';
|
|
42
|
-
import { TimingSummary } from '../computed/metrics/timing-summary.js';
|
|
43
|
-
//# sourceMappingURL=timing-budget.d.ts.map
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {Audit} from './audit.js';
|
|
8
|
-
import {TimingSummary} from '../computed/metrics/timing-summary.js';
|
|
9
|
-
import {MainResource} from '../computed/main-resource.js';
|
|
10
|
-
import {Budget} from '../config/budget.js';
|
|
11
|
-
import * as i18n from '../lib/i18n/i18n.js';
|
|
12
|
-
|
|
13
|
-
const UIStrings = {
|
|
14
|
-
/** Title of a Lighthouse audit that compares how quickly the page loads against targets set by the user. Timing budgets are a type of performance budget. */
|
|
15
|
-
title: 'Timing budget',
|
|
16
|
-
/** Description of a Lighthouse audit where a user sets budgets for how quickly the page loads. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
17
|
-
description: 'Set a timing budget to help you keep an eye on the performance of your site. Performant sites load fast and respond to user input events quickly. [Learn more about performance budgets](https://developers.google.com/web/tools/lighthouse/audits/budgets).',
|
|
18
|
-
/** Label for a column in a data table; entries will be the names of different timing metrics, e.g. "Time to Interactive", "First Contentful Paint", etc. */
|
|
19
|
-
columnTimingMetric: 'Metric',
|
|
20
|
-
/** Label for a column in a data table; entries will be the measured value of a particular timing metric. Most entries will have a unit of milliseconds, but units could be other things as well. */
|
|
21
|
-
columnMeasurement: 'Measurement',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
25
|
-
|
|
26
|
-
/** @typedef {{metric: LH.Budget.TimingMetric, label: LH.IcuMessage, measurement?: LH.Audit.Details.NumericValue|number, overBudget?: LH.Audit.Details.NumericValue|number}} BudgetItem */
|
|
27
|
-
|
|
28
|
-
class TimingBudget extends Audit {
|
|
29
|
-
/**
|
|
30
|
-
* @return {LH.Audit.Meta}
|
|
31
|
-
*/
|
|
32
|
-
static get meta() {
|
|
33
|
-
return {
|
|
34
|
-
id: 'timing-budget',
|
|
35
|
-
title: str_(UIStrings.title),
|
|
36
|
-
description: str_(UIStrings.description),
|
|
37
|
-
scoreDisplayMode: Audit.SCORING_MODES.INFORMATIVE,
|
|
38
|
-
supportedModes: ['navigation'],
|
|
39
|
-
requiredArtifacts: ['devtoolsLogs', 'traces', 'URL', 'GatherContext'],
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param {LH.Budget.TimingMetric} timingMetric
|
|
45
|
-
* @return {LH.IcuMessage}
|
|
46
|
-
*/
|
|
47
|
-
static getRowLabel(timingMetric) {
|
|
48
|
-
/** @type {Record<LH.Budget.TimingMetric, string>} */
|
|
49
|
-
const strMappings = {
|
|
50
|
-
'first-contentful-paint': i18n.UIStrings.firstContentfulPaintMetric,
|
|
51
|
-
'interactive': i18n.UIStrings.interactiveMetric,
|
|
52
|
-
'first-meaningful-paint': i18n.UIStrings.firstMeaningfulPaintMetric,
|
|
53
|
-
'max-potential-fid': i18n.UIStrings.maxPotentialFIDMetric,
|
|
54
|
-
'total-blocking-time': i18n.UIStrings.totalBlockingTimeMetric,
|
|
55
|
-
'speed-index': i18n.UIStrings.speedIndexMetric,
|
|
56
|
-
'largest-contentful-paint': i18n.UIStrings.largestContentfulPaintMetric,
|
|
57
|
-
'cumulative-layout-shift': i18n.UIStrings.cumulativeLayoutShiftMetric,
|
|
58
|
-
};
|
|
59
|
-
return str_(strMappings[timingMetric]);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @param {LH.Budget.TimingMetric} timingMetric
|
|
64
|
-
* @param {LH.Artifacts.TimingSummary} summary
|
|
65
|
-
* @return {number|undefined}
|
|
66
|
-
*/
|
|
67
|
-
static getMeasurement(timingMetric, summary) {
|
|
68
|
-
/** @type {Record<LH.Budget.TimingMetric, number|undefined>} */
|
|
69
|
-
const measurements = {
|
|
70
|
-
'first-contentful-paint': summary.firstContentfulPaint,
|
|
71
|
-
'interactive': summary.interactive,
|
|
72
|
-
'first-meaningful-paint': summary.firstMeaningfulPaint,
|
|
73
|
-
'max-potential-fid': summary.maxPotentialFID,
|
|
74
|
-
'total-blocking-time': summary.totalBlockingTime,
|
|
75
|
-
'speed-index': summary.speedIndex,
|
|
76
|
-
'largest-contentful-paint': summary.largestContentfulPaint,
|
|
77
|
-
'cumulative-layout-shift': summary.cumulativeLayoutShift,
|
|
78
|
-
};
|
|
79
|
-
return measurements[timingMetric];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @param {LH.Util.Immutable<LH.Budget>} budget
|
|
84
|
-
* @param {LH.Artifacts.TimingSummary} summary
|
|
85
|
-
* @return {Array<BudgetItem>}
|
|
86
|
-
*/
|
|
87
|
-
static tableItems(budget, summary) {
|
|
88
|
-
/** @type {Array<BudgetItem>} */
|
|
89
|
-
let items = [];
|
|
90
|
-
if (!budget.timings) {
|
|
91
|
-
return items;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
items = budget.timings.map((timingBudget) => {
|
|
95
|
-
const metricName = timingBudget.metric;
|
|
96
|
-
const label = this.getRowLabel(metricName);
|
|
97
|
-
const measurement = this.getMeasurement(metricName, summary);
|
|
98
|
-
const overBudget = measurement && (measurement > timingBudget.budget)
|
|
99
|
-
? (measurement - timingBudget.budget) : undefined;
|
|
100
|
-
return {
|
|
101
|
-
metric: metricName,
|
|
102
|
-
label,
|
|
103
|
-
measurement,
|
|
104
|
-
overBudget,
|
|
105
|
-
};
|
|
106
|
-
}).sort((a, b) => {
|
|
107
|
-
return (b.overBudget || 0) - (a.overBudget || 0);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// CLS requires a different granularity and should be a numeric type.
|
|
111
|
-
// Defining type here overrides the column setting so that it doesn't receive ms units.
|
|
112
|
-
const clsItem = items.find(item => item.metric === 'cumulative-layout-shift');
|
|
113
|
-
if (clsItem) {
|
|
114
|
-
if (typeof clsItem.measurement === 'number') {
|
|
115
|
-
clsItem.measurement = {
|
|
116
|
-
type: 'numeric',
|
|
117
|
-
value: Number(clsItem.measurement),
|
|
118
|
-
granularity: 0.01,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (typeof clsItem.overBudget === 'number') {
|
|
122
|
-
clsItem.overBudget = {
|
|
123
|
-
type: 'numeric',
|
|
124
|
-
value: Number(clsItem.overBudget),
|
|
125
|
-
granularity: 0.01,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return items;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @param {LH.Artifacts} artifacts
|
|
135
|
-
* @param {LH.Audit.Context} context
|
|
136
|
-
* @return {Promise<LH.Audit.Product>}
|
|
137
|
-
*/
|
|
138
|
-
static async audit(artifacts, context) {
|
|
139
|
-
const gatherContext = artifacts.GatherContext;
|
|
140
|
-
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
141
|
-
const trace = artifacts.traces[Audit.DEFAULT_PASS];
|
|
142
|
-
const URL = artifacts.URL;
|
|
143
|
-
const mainResource = await MainResource.request({URL, devtoolsLog}, context);
|
|
144
|
-
const data = {trace, devtoolsLog, gatherContext, settings: context.settings, URL};
|
|
145
|
-
const summary = (await TimingSummary.request(data, context)).metrics;
|
|
146
|
-
const budget = Budget.getMatchingBudget(context.settings.budgets, mainResource.url);
|
|
147
|
-
|
|
148
|
-
if (!budget) {
|
|
149
|
-
return {
|
|
150
|
-
score: 0,
|
|
151
|
-
notApplicable: true,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** @type {LH.Audit.Details.Table['headings']} */
|
|
156
|
-
const headers = [
|
|
157
|
-
{key: 'label', valueType: 'text', label: str_(UIStrings.columnTimingMetric)},
|
|
158
|
-
/**
|
|
159
|
-
* Note: SpeedIndex, unlike other timing metrics, is not measured in milliseconds.
|
|
160
|
-
* The renderer applies the correct units to the 'measurement' and 'overBudget' columns for SpeedIndex.
|
|
161
|
-
*/
|
|
162
|
-
{key: 'measurement', valueType: 'ms', label: str_(UIStrings.columnMeasurement)},
|
|
163
|
-
{key: 'overBudget', valueType: 'ms', label: str_(i18n.UIStrings.columnOverBudget)},
|
|
164
|
-
];
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
details: Audit.makeTableDetails(headers, this.tableItems(budget, summary),
|
|
168
|
-
{sortedBy: ['overBudget']}),
|
|
169
|
-
score: 1,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export default TimingBudget;
|
|
175
|
-
export {UIStrings};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { ManifestValuesComputed as ManifestValues };
|
|
2
|
-
declare const ManifestValuesComputed: typeof ManifestValues & {
|
|
3
|
-
request: (dependencies: Pick<import("../index.js").Artifacts, "InstallabilityErrors" | "WebAppManifest">, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
4
|
-
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
5
|
-
}>) => Promise<import("../index.js").Artifacts.ManifestValues>;
|
|
6
|
-
};
|
|
7
|
-
declare class ManifestValues {
|
|
8
|
-
/** @typedef {(val: NonNullable<LH.Artifacts.Manifest['value']>, errors: LH.Artifacts.InstallabilityErrors['errors']) => boolean} Validator */
|
|
9
|
-
/**
|
|
10
|
-
* @return {Array<{id: LH.Artifacts.ManifestValueCheckID, failureText: string, validate: Validator}>}
|
|
11
|
-
*/
|
|
12
|
-
static get manifestChecks(): {
|
|
13
|
-
id: LH.Artifacts.ManifestValueCheckID;
|
|
14
|
-
failureText: string;
|
|
15
|
-
validate: (val: NonNullable<LH.Artifacts.Manifest['value']>, errors: LH.Artifacts.InstallabilityErrors['errors']) => boolean;
|
|
16
|
-
}[];
|
|
17
|
-
/**
|
|
18
|
-
* Returns results of all manifest checks
|
|
19
|
-
* @param {Pick<LH.Artifacts, 'WebAppManifest'|'InstallabilityErrors'>} Manifest
|
|
20
|
-
* @return {Promise<LH.Artifacts.ManifestValues>}
|
|
21
|
-
*/
|
|
22
|
-
static compute_({ WebAppManifest, InstallabilityErrors }: Pick<LH.Artifacts, 'WebAppManifest' | 'InstallabilityErrors'>): Promise<LH.Artifacts.ManifestValues>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=manifest-values.d.ts.map
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2016 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
|
-
import * as icons from '../lib/icons.js';
|
|
9
|
-
|
|
10
|
-
const PWA_DISPLAY_VALUES = ['minimal-ui', 'fullscreen', 'standalone'];
|
|
11
|
-
|
|
12
|
-
// Historically, Chrome recommended 12 chars as the maximum short_name length to prevent truncation.
|
|
13
|
-
// For more discussion, see https://github.com/GoogleChrome/lighthouse/issues/69 and https://developer.chrome.com/apps/manifest/name#short_name
|
|
14
|
-
const SUGGESTED_SHORTNAME_LENGTH = 12;
|
|
15
|
-
|
|
16
|
-
class ManifestValues {
|
|
17
|
-
/** @typedef {(val: NonNullable<LH.Artifacts.Manifest['value']>, errors: LH.Artifacts.InstallabilityErrors['errors']) => boolean} Validator */
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @return {Array<{id: LH.Artifacts.ManifestValueCheckID, failureText: string, validate: Validator}>}
|
|
21
|
-
*/
|
|
22
|
-
static get manifestChecks() {
|
|
23
|
-
return [
|
|
24
|
-
{
|
|
25
|
-
id: 'hasStartUrl',
|
|
26
|
-
failureText: 'Manifest does not contain a `start_url`',
|
|
27
|
-
validate: manifestValue => !!manifestValue.start_url.value,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 'hasIconsAtLeast144px',
|
|
31
|
-
failureText: 'Manifest does not have a PNG icon of at least 144px',
|
|
32
|
-
validate: manifestValue => icons.doExist(manifestValue) &&
|
|
33
|
-
icons.pngSizedAtLeast(144, manifestValue).length > 0,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: 'hasIconsAtLeast512px',
|
|
37
|
-
failureText: 'Manifest does not have a PNG icon of at least 512px',
|
|
38
|
-
validate: manifestValue => icons.doExist(manifestValue) &&
|
|
39
|
-
icons.pngSizedAtLeast(512, manifestValue).length > 0,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: 'fetchesIcon',
|
|
43
|
-
failureText: 'Manifest icon failed to be fetched',
|
|
44
|
-
validate: (manifestValue, errors) => {
|
|
45
|
-
const failedToFetchIconErrorIds = [
|
|
46
|
-
'cannot-download-icon',
|
|
47
|
-
'no-icon-available',
|
|
48
|
-
];
|
|
49
|
-
return icons.doExist(manifestValue) &&
|
|
50
|
-
!errors.some(error => failedToFetchIconErrorIds.includes(error.errorId));
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: 'hasPWADisplayValue',
|
|
55
|
-
failureText: 'Manifest\'s `display` value is not one of: ' + PWA_DISPLAY_VALUES.join(' | '),
|
|
56
|
-
validate: manifestValue => PWA_DISPLAY_VALUES.includes(manifestValue.display.value),
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: 'hasBackgroundColor',
|
|
60
|
-
failureText: 'Manifest does not have `background_color`',
|
|
61
|
-
validate: manifestValue => !!manifestValue.background_color.value,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: 'hasThemeColor',
|
|
65
|
-
failureText: 'Manifest does not have `theme_color`',
|
|
66
|
-
validate: manifestValue => !!manifestValue.theme_color.value,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: 'hasShortName',
|
|
70
|
-
failureText: 'Manifest does not have `short_name`',
|
|
71
|
-
validate: manifestValue => !!manifestValue.short_name.value,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: 'shortNameLength',
|
|
75
|
-
failureText: `Manifest's \`short_name\` is too long (>${SUGGESTED_SHORTNAME_LENGTH} ` +
|
|
76
|
-
`characters) to be displayed on a homescreen without truncation`,
|
|
77
|
-
// Pass if there's no short_name. Don't want to report a non-existent string is too long
|
|
78
|
-
validate: manifestValue => !!manifestValue.short_name.value &&
|
|
79
|
-
manifestValue.short_name.value.length <= SUGGESTED_SHORTNAME_LENGTH,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: 'hasName',
|
|
83
|
-
failureText: 'Manifest does not have `name`',
|
|
84
|
-
validate: manifestValue => !!manifestValue.name.value,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: 'hasMaskableIcon',
|
|
88
|
-
failureText: 'Manifest does not have at least one icon that is maskable',
|
|
89
|
-
validate: ManifestValue => icons.doExist(ManifestValue) &&
|
|
90
|
-
icons.containsMaskableIcon(ManifestValue),
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Returns results of all manifest checks
|
|
97
|
-
* @param {Pick<LH.Artifacts, 'WebAppManifest'|'InstallabilityErrors'>} Manifest
|
|
98
|
-
* @return {Promise<LH.Artifacts.ManifestValues>}
|
|
99
|
-
*/
|
|
100
|
-
static async compute_({WebAppManifest, InstallabilityErrors}) {
|
|
101
|
-
// if the manifest isn't there or is invalid json, we report that and bail
|
|
102
|
-
if (WebAppManifest === null) {
|
|
103
|
-
return {
|
|
104
|
-
isParseFailure: true,
|
|
105
|
-
parseFailureReason: 'No manifest was fetched',
|
|
106
|
-
allChecks: [],
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
const manifestValue = WebAppManifest.value;
|
|
110
|
-
if (manifestValue === undefined) {
|
|
111
|
-
return {
|
|
112
|
-
isParseFailure: true,
|
|
113
|
-
parseFailureReason: 'Manifest failed to parse as valid JSON',
|
|
114
|
-
allChecks: [],
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// manifest is valid, so do the rest of the checks
|
|
119
|
-
const remainingChecks = ManifestValues.manifestChecks.map(item => {
|
|
120
|
-
return {
|
|
121
|
-
id: item.id,
|
|
122
|
-
failureText: item.failureText,
|
|
123
|
-
passing: item.validate(manifestValue, InstallabilityErrors.errors),
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
isParseFailure: false,
|
|
129
|
-
allChecks: remainingChecks,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const ManifestValuesComputed =
|
|
135
|
-
makeComputedArtifact(ManifestValues, ['InstallabilityErrors', 'WebAppManifest']);
|
|
136
|
-
export {ManifestValuesComputed as ManifestValues};
|
package/core/config/budget.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export class Budget {
|
|
2
|
-
/**
|
|
3
|
-
* Asserts that obj has no own properties, throwing a nice error message if it does.
|
|
4
|
-
* `objectName` is included for nicer logging.
|
|
5
|
-
* @param {Record<string, unknown>} obj
|
|
6
|
-
* @param {string} objectName
|
|
7
|
-
*/
|
|
8
|
-
static assertNoExcessProperties(obj: Record<string, unknown>, objectName: string): void;
|
|
9
|
-
/**
|
|
10
|
-
* Asserts that `strings` has no duplicate strings in it, throwing an error if
|
|
11
|
-
* it does. `arrayName` is included for nicer logging.
|
|
12
|
-
* @param {Array<string>} strings
|
|
13
|
-
* @param {string} arrayName
|
|
14
|
-
*/
|
|
15
|
-
static assertNoDuplicateStrings(strings: Array<string>, arrayName: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* @param {Record<string, unknown>} resourceBudget
|
|
18
|
-
* @return {LH.Budget.ResourceBudget}
|
|
19
|
-
*/
|
|
20
|
-
static validateResourceBudget(resourceBudget: Record<string, unknown>): LH.Budget.ResourceBudget;
|
|
21
|
-
/**
|
|
22
|
-
* @param {unknown} path
|
|
23
|
-
* @param {string} error
|
|
24
|
-
*/
|
|
25
|
-
static throwInvalidPathError(path: unknown, error: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Validates that path is either: a) undefined or ) properly formed.
|
|
28
|
-
* Verifies the quantity and location of the two robot.txt regex characters: $, *
|
|
29
|
-
* @param {unknown} path
|
|
30
|
-
* @return {undefined|string}
|
|
31
|
-
*/
|
|
32
|
-
static validatePath(path: unknown): undefined | string;
|
|
33
|
-
/**
|
|
34
|
-
* Returns the budget that applies to a given URL.
|
|
35
|
-
* If multiple budgets match based on thier 'path' property,
|
|
36
|
-
* then the last-listed of those budgets is returned.
|
|
37
|
-
* @param {LH.Util.Immutable<Array<LH.Budget>>|null} budgets
|
|
38
|
-
* @param {string|undefined} url
|
|
39
|
-
* @return {LH.Util.Immutable<LH.Budget> | undefined} budget
|
|
40
|
-
*/
|
|
41
|
-
static getMatchingBudget(budgets: LH.Util.Immutable<Array<LH.Budget>> | null, url: string | undefined): LH.Util.Immutable<LH.Budget> | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Determines whether a URL matches against a robots.txt-style "path".
|
|
44
|
-
* Pattern should use the robots.txt format. E.g. "/*-article.html" or "/". Reference:
|
|
45
|
-
* https://developers.google.com/search/reference/robots_txt#url-matching-based-on-path-values
|
|
46
|
-
* @param {string} url
|
|
47
|
-
* @param {string=} pattern
|
|
48
|
-
* @return {boolean}
|
|
49
|
-
*/
|
|
50
|
-
static urlMatchesPattern(url: string, pattern?: string | undefined): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* @param {Record<string, unknown>} timingBudget
|
|
53
|
-
* @return {LH.Budget.TimingBudget}
|
|
54
|
-
*/
|
|
55
|
-
static validateTimingBudget(timingBudget: Record<string, unknown>): LH.Budget.TimingBudget;
|
|
56
|
-
/**
|
|
57
|
-
* @param {string} hostname
|
|
58
|
-
* @return {string}
|
|
59
|
-
*/
|
|
60
|
-
static validateHostname(hostname: string): string;
|
|
61
|
-
/**
|
|
62
|
-
* @param {unknown} hostnames
|
|
63
|
-
* @return {undefined|Array<string>}
|
|
64
|
-
*/
|
|
65
|
-
static validateHostnames(hostnames: unknown): undefined | Array<string>;
|
|
66
|
-
/**
|
|
67
|
-
* More info on the Budget format:
|
|
68
|
-
* https://github.com/GoogleChrome/lighthouse/issues/6053#issuecomment-428385930
|
|
69
|
-
* @param {unknown} budgetJson
|
|
70
|
-
* @return {Array<LH.Budget>}
|
|
71
|
-
*/
|
|
72
|
-
static initializeBudget(budgetJson: unknown): Array<LH.Budget>;
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=budget.d.ts.map
|