lighthouse 10.4.0 → 11.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 +1 -1
- package/cli/cli-flags.d.ts +1 -6
- package/cli/cli-flags.js +0 -5
- package/cli/run.js +3 -10
- package/cli/sentry-prompt.js +4 -2
- package/cli/test/smokehouse/core-tests.js +0 -2
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +24 -14
- package/cli/test/smokehouse/lighthouse-runners/bundle.d.ts +1 -2
- package/cli/test/smokehouse/lighthouse-runners/bundle.js +12 -21
- package/cli/test/smokehouse/lighthouse-runners/cli.d.ts +1 -3
- package/cli/test/smokehouse/lighthouse-runners/cli.js +3 -7
- package/cli/test/smokehouse/lighthouse-runners/devtools.d.ts +1 -5
- package/cli/test/smokehouse/lighthouse-runners/devtools.js +1 -12
- package/cli/test/smokehouse/readme.md +0 -2
- package/cli/test/smokehouse/report-assert.d.ts +1 -3
- package/cli/test/smokehouse/report-assert.js +2 -19
- package/cli/test/smokehouse/smokehouse.js +3 -32
- package/core/audits/accessibility/aria-allowed-role.d.ts +10 -0
- package/core/audits/accessibility/aria-allowed-role.js +46 -0
- package/core/audits/accessibility/image-redundant-alt.d.ts +10 -0
- package/core/audits/accessibility/image-redundant-alt.js +45 -0
- package/core/audits/accessibility/label-content-name-mismatch.d.ts +10 -0
- package/core/audits/accessibility/label-content-name-mismatch.js +44 -0
- package/core/audits/accessibility/skip-link.d.ts +10 -0
- package/core/audits/accessibility/skip-link.js +43 -0
- package/core/audits/accessibility/table-duplicate-name.d.ts +10 -0
- package/core/audits/accessibility/table-duplicate-name.js +44 -0
- package/core/audits/accessibility/target-size.js +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.js +2 -2
- package/core/audits/byte-efficiency/render-blocking-resources.js +1 -0
- package/core/audits/dobetterweb/uses-http2.d.ts +18 -1
- package/core/audits/dobetterweb/uses-http2.js +62 -16
- package/core/audits/installable-manifest.d.ts +1 -5
- package/core/audits/installable-manifest.js +2 -7
- package/core/audits/largest-contentful-paint-element.d.ts +0 -6
- package/core/audits/largest-contentful-paint-element.js +13 -15
- package/core/audits/metrics/{experimental-interaction-to-next-paint.d.ts → interaction-to-next-paint.d.ts} +3 -3
- package/core/audits/metrics/{experimental-interaction-to-next-paint.js → interaction-to-next-paint.js} +3 -3
- package/core/audits/uses-rel-preconnect.js +23 -8
- package/core/audits/work-during-interaction.js +2 -2
- package/core/computed/processed-navigation.d.ts +1 -1
- package/core/config/config-helpers.d.ts +3 -3
- package/core/config/config-helpers.js +5 -12
- package/core/config/config.js +1 -7
- package/core/config/constants.d.ts +0 -2
- package/core/config/constants.js +2 -18
- package/core/config/default-config.js +59 -53
- package/core/config/filters.js +1 -1
- package/core/config/validation.d.ts +7 -12
- package/core/config/validation.js +16 -26
- package/core/gather/base-artifacts.d.ts +4 -4
- package/core/gather/base-artifacts.js +2 -6
- package/core/gather/base-gatherer.d.ts +12 -37
- package/core/gather/base-gatherer.js +7 -54
- package/core/gather/driver/dom.d.ts +4 -4
- package/core/gather/driver/dom.js +2 -2
- package/core/gather/driver/environment.d.ts +4 -4
- package/core/gather/driver/environment.js +2 -2
- package/core/gather/driver/execution-context.d.ts +12 -3
- package/core/gather/driver/execution-context.js +34 -3
- package/core/gather/driver/navigation.d.ts +2 -2
- package/core/gather/driver/navigation.js +2 -5
- package/core/gather/driver/network-monitor.d.ts +7 -6
- package/core/gather/driver/network-monitor.js +4 -4
- package/core/gather/driver/network.d.ts +2 -2
- package/core/gather/driver/network.js +1 -1
- package/core/gather/driver/prepare.d.ts +10 -10
- package/core/gather/driver/prepare.js +10 -10
- package/core/gather/driver/service-workers.d.ts +4 -4
- package/core/gather/driver/service-workers.js +2 -2
- package/core/gather/driver/storage.d.ts +6 -6
- package/core/gather/driver/storage.js +3 -3
- package/core/gather/driver/target-manager.d.ts +6 -5
- package/core/gather/driver/target-manager.js +3 -3
- package/core/gather/driver/wait-for-condition.d.ts +14 -14
- package/core/gather/driver/wait-for-condition.js +8 -8
- package/core/gather/driver.d.ts +9 -6
- package/core/gather/driver.js +14 -4
- package/core/gather/fetcher.d.ts +3 -3
- package/core/gather/fetcher.js +1 -1
- package/core/gather/gatherers/accessibility.d.ts +4 -4
- package/core/gather/gatherers/accessibility.js +8 -3
- package/core/gather/gatherers/anchor-elements.d.ts +4 -4
- package/core/gather/gatherers/anchor-elements.js +4 -4
- package/core/gather/gatherers/bf-cache-failures.d.ts +8 -14
- package/core/gather/gatherers/bf-cache-failures.js +5 -14
- package/core/gather/gatherers/cache-contents.d.ts +4 -4
- package/core/gather/gatherers/cache-contents.js +3 -3
- package/core/gather/gatherers/console-messages.d.ts +6 -6
- package/core/gather/gatherers/console-messages.js +4 -4
- package/core/gather/gatherers/css-usage.d.ts +14 -14
- package/core/gather/gatherers/css-usage.js +9 -9
- package/core/gather/gatherers/devtools-log-compat.d.ts +5 -5
- package/core/gather/gatherers/devtools-log-compat.js +4 -4
- package/core/gather/gatherers/devtools-log.d.ts +6 -6
- package/core/gather/gatherers/devtools-log.js +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/doctype.js +3 -3
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +4 -4
- package/core/gather/gatherers/dobetterweb/domstats.js +3 -3
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +10 -22
- package/core/gather/gatherers/dobetterweb/optimized-images.js +10 -27
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +6 -12
- package/core/gather/gatherers/dobetterweb/response-compression.js +14 -21
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.d.ts +8 -14
- package/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +5 -14
- package/core/gather/gatherers/full-page-screenshot.d.ts +10 -10
- package/core/gather/gatherers/full-page-screenshot.js +7 -10
- package/core/gather/gatherers/global-listeners.d.ts +4 -4
- package/core/gather/gatherers/global-listeners.js +3 -3
- package/core/gather/gatherers/iframe-elements.d.ts +4 -4
- package/core/gather/gatherers/iframe-elements.js +3 -3
- package/core/gather/gatherers/image-elements.d.ts +10 -10
- package/core/gather/gatherers/image-elements.js +6 -6
- package/core/gather/gatherers/inputs.d.ts +4 -4
- package/core/gather/gatherers/inputs.js +3 -3
- package/core/gather/gatherers/inspector-issues.d.ts +8 -19
- package/core/gather/gatherers/inspector-issues.js +9 -26
- package/core/gather/gatherers/installability-errors.d.ts +6 -6
- package/core/gather/gatherers/installability-errors.js +4 -4
- package/core/gather/gatherers/js-usage.d.ts +6 -6
- package/core/gather/gatherers/js-usage.js +4 -4
- package/core/gather/gatherers/link-elements.d.ts +8 -20
- package/core/gather/gatherers/link-elements.js +7 -24
- package/core/gather/gatherers/main-document-content.d.ts +4 -16
- package/core/gather/gatherers/main-document-content.js +5 -23
- package/core/gather/gatherers/meta-elements.d.ts +4 -4
- package/core/gather/gatherers/meta-elements.js +3 -3
- package/core/gather/gatherers/network-user-agent.d.ts +5 -5
- package/core/gather/gatherers/network-user-agent.js +4 -4
- package/core/gather/gatherers/script-elements.d.ts +6 -11
- package/core/gather/gatherers/script-elements.js +4 -13
- package/core/gather/gatherers/scripts.d.ts +7 -6
- package/core/gather/gatherers/scripts.js +7 -9
- package/core/gather/gatherers/seo/embedded-content.d.ts +4 -4
- package/core/gather/gatherers/seo/embedded-content.js +3 -3
- package/core/gather/gatherers/seo/font-size.d.ts +6 -6
- package/core/gather/gatherers/seo/font-size.js +5 -5
- package/core/gather/gatherers/seo/robots-txt.d.ts +4 -4
- package/core/gather/gatherers/seo/robots-txt.js +3 -3
- package/core/gather/gatherers/seo/tap-targets.d.ts +8 -8
- package/core/gather/gatherers/seo/tap-targets.js +5 -5
- package/core/gather/gatherers/service-worker.d.ts +4 -10
- package/core/gather/gatherers/service-worker.js +3 -15
- package/core/gather/gatherers/source-maps.d.ts +11 -23
- package/core/gather/gatherers/source-maps.js +22 -53
- package/core/gather/gatherers/stacks.d.ts +7 -7
- package/core/gather/gatherers/stacks.js +6 -6
- package/core/gather/gatherers/trace-compat.d.ts +5 -5
- package/core/gather/gatherers/trace-compat.js +4 -4
- package/core/gather/gatherers/trace-elements.d.ts +13 -25
- package/core/gather/gatherers/trace-elements.js +19 -32
- package/core/gather/gatherers/trace.d.ts +8 -8
- package/core/gather/gatherers/trace.js +5 -5
- package/core/gather/gatherers/viewport-dimensions.d.ts +4 -4
- package/core/gather/gatherers/viewport-dimensions.js +3 -3
- package/core/gather/gatherers/web-app-manifest.d.ts +8 -8
- package/core/gather/gatherers/web-app-manifest.js +5 -5
- package/core/gather/navigation-runner.d.ts +9 -9
- package/core/gather/navigation-runner.js +14 -8
- package/core/gather/runner-helpers.d.ts +3 -3
- package/core/gather/runner-helpers.js +12 -4
- package/core/gather/session.d.ts +2 -2
- package/core/gather/session.js +1 -1
- package/core/gather/snapshot-runner.d.ts +2 -2
- package/core/gather/snapshot-runner.js +1 -1
- package/core/gather/timespan-runner.d.ts +2 -2
- package/core/gather/timespan-runner.js +1 -1
- package/core/index.cjs +0 -7
- package/core/index.d.ts +0 -15
- package/core/index.js +2 -40
- package/core/lib/asset-saver.js +14 -4
- package/core/lib/axe.js +1 -1
- package/core/lib/dependency-graph/simulator/network-analyzer.d.ts +28 -12
- package/core/lib/dependency-graph/simulator/network-analyzer.js +128 -100
- package/core/lib/emulation.d.ts +14 -14
- package/core/lib/emulation.js +7 -7
- package/core/lib/navigation-error.js +5 -0
- package/core/lib/network-recorder.d.ts +2 -1
- package/core/lib/network-recorder.js +1 -0
- package/core/lib/network-request.js +12 -3
- package/core/lib/page-functions.d.ts +10 -2
- package/core/lib/page-functions.js +85 -8
- package/core/lib/sentry.js +9 -2
- package/core/lib/stack-packs.js +4 -0
- package/core/runner.d.ts +8 -30
- package/core/runner.js +8 -39
- package/core/user-flow.d.ts +4 -4
- package/core/user-flow.js +2 -2
- package/dist/report/bundle.esm.js +2221 -5832
- package/dist/report/flow.js +2631 -235
- package/dist/report/standalone.js +2586 -234
- package/flow-report/src/i18n/i18n.d.ts +2 -2
- package/package.json +17 -24
- package/readme.md +3 -1
- package/report/assets/templates.html +3 -1
- package/report/renderer/category-renderer.d.ts +3 -2
- package/report/renderer/category-renderer.js +8 -4
- package/report/renderer/components.js +11 -5
- package/report/renderer/pwa-category-renderer.js +1 -1
- package/report/renderer/report-ui-features.js +9 -6
- package/report/renderer/report-utils.d.ts +1 -1
- package/report/renderer/report-utils.js +2 -2
- package/report/renderer/topbar-features.js +3 -0
- package/shared/localization/locales/ar-XB.json +185 -44
- package/shared/localization/locales/ar.json +185 -44
- package/shared/localization/locales/bg.json +185 -44
- package/shared/localization/locales/ca.json +190 -49
- package/shared/localization/locales/cs.json +185 -44
- package/shared/localization/locales/da.json +185 -44
- package/shared/localization/locales/de.json +185 -44
- package/shared/localization/locales/el.json +185 -44
- package/shared/localization/locales/en-GB.json +185 -44
- package/shared/localization/locales/en-US.json +99 -45
- package/shared/localization/locales/en-XA.json +185 -44
- package/shared/localization/locales/en-XL.json +99 -45
- package/shared/localization/locales/es-419.json +185 -44
- package/shared/localization/locales/es.json +185 -44
- package/shared/localization/locales/fi.json +185 -44
- package/shared/localization/locales/fil.json +185 -44
- package/shared/localization/locales/fr.json +185 -44
- package/shared/localization/locales/he.json +186 -45
- package/shared/localization/locales/hi.json +185 -44
- package/shared/localization/locales/hr.json +185 -44
- package/shared/localization/locales/hu.json +185 -44
- package/shared/localization/locales/id.json +185 -44
- package/shared/localization/locales/it.json +185 -44
- package/shared/localization/locales/ja.json +185 -44
- package/shared/localization/locales/ko.json +185 -44
- package/shared/localization/locales/lt.json +185 -44
- package/shared/localization/locales/lv.json +185 -44
- package/shared/localization/locales/nl.json +185 -44
- package/shared/localization/locales/no.json +185 -44
- package/shared/localization/locales/pl.json +185 -44
- package/shared/localization/locales/pt-PT.json +185 -44
- package/shared/localization/locales/pt.json +190 -49
- package/shared/localization/locales/ro.json +185 -44
- package/shared/localization/locales/ru.json +185 -44
- package/shared/localization/locales/sk.json +185 -44
- package/shared/localization/locales/sl.json +185 -44
- package/shared/localization/locales/sr-Latn.json +185 -44
- package/shared/localization/locales/sr.json +185 -44
- package/shared/localization/locales/sv.json +185 -44
- package/shared/localization/locales/ta.json +185 -44
- package/shared/localization/locales/te.json +185 -44
- package/shared/localization/locales/th.json +185 -44
- package/shared/localization/locales/tr.json +185 -44
- package/shared/localization/locales/uk.json +185 -44
- package/shared/localization/locales/vi.json +185 -44
- package/shared/localization/locales/zh-HK.json +185 -44
- package/shared/localization/locales/zh-TW.json +185 -44
- package/shared/localization/locales/zh.json +185 -44
- package/third-party/esbuild-plugins-polyfills/LICENSE +3 -0
- package/third-party/esbuild-plugins-polyfills/README.md +7 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.d.ts +9 -0
- package/third-party/esbuild-plugins-polyfills/esbuild-polyfills.js +129 -0
- package/tsconfig.json +2 -1
- package/types/artifacts.d.ts +16 -45
- package/types/config.d.ts +10 -52
- package/types/externs.d.ts +0 -2
- package/types/gatherer.d.ts +24 -47
- package/types/internal/rxjs.d.ts +26 -0
- package/types/internal/smokehouse.d.ts +1 -3
- package/types/lh.d.ts +0 -2
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/metrics/first-contentful-paint-3g.d.ts +0 -15
- package/core/audits/metrics/first-contentful-paint-3g.js +0 -69
- package/core/audits/resource-summary.d.ts +0 -16
- package/core/audits/resource-summary.js +0 -104
- package/core/audits/service-worker.d.ts +0 -46
- package/core/audits/service-worker.js +0 -182
- package/core/gather/gatherers/gatherer.d.ts +0 -46
- package/core/gather/gatherers/gatherer.js +0 -58
- package/core/legacy/config/config.d.ts +0 -107
- package/core/legacy/config/config.js +0 -566
- package/core/legacy/config/legacy-default-config.d.ts +0 -4
- package/core/legacy/config/legacy-default-config.js +0 -87
- package/core/legacy/gather/connections/connection.d.ts +0 -77
- package/core/legacy/gather/connections/connection.js +0 -196
- package/core/legacy/gather/connections/cri.d.ts +0 -27
- package/core/legacy/gather/connections/cri.js +0 -162
- package/core/legacy/gather/connections/raw.d.ts +0 -20
- package/core/legacy/gather/connections/raw.js +0 -57
- package/core/legacy/gather/driver.d.ts +0 -216
- package/core/legacy/gather/driver.js +0 -480
- package/core/legacy/gather/gather-runner.d.ts +0 -166
- package/core/legacy/gather/gather-runner.js +0 -590
- package/types/internal/lighthouse-logger.d.ts +0 -34
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2019 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {Audit} from './audit.js';
|
|
8
|
-
import {ResourceSummary as ComputedResourceSummary} from '../computed/resource-summary.js';
|
|
9
|
-
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
|
-
|
|
11
|
-
const UIStrings = {
|
|
12
|
-
/** Imperative title of a Lighthouse audit that tells the user to minimize the size and quantity of resources used to load the page. */
|
|
13
|
-
title: 'Keep request counts low and transfer sizes small',
|
|
14
|
-
/** Description of a Lighthouse audit that tells the user that they can setup a budgets for the quantity and size of page resources. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
15
|
-
description: 'To set budgets for the quantity and size of page resources,' +
|
|
16
|
-
' add a budget.json file. ' +
|
|
17
|
-
'[Learn more about performance budgets](https://web.dev/use-lighthouse-for-performance-budgets/).',
|
|
18
|
-
/** [ICU Syntax] Label for an audit identifying the number of requests and kibibytes used to load the page. */
|
|
19
|
-
displayValue: `{requestCount, plural, ` +
|
|
20
|
-
`=1 {1 request • {byteCount, number, bytes} KiB} ` +
|
|
21
|
-
`other {# requests • {byteCount, number, bytes} KiB}}`,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
25
|
-
|
|
26
|
-
class ResourceSummary extends Audit {
|
|
27
|
-
/**
|
|
28
|
-
* @return {LH.Audit.Meta}
|
|
29
|
-
*/
|
|
30
|
-
static get meta() {
|
|
31
|
-
return {
|
|
32
|
-
id: 'resource-summary',
|
|
33
|
-
title: str_(UIStrings.title),
|
|
34
|
-
description: str_(UIStrings.description),
|
|
35
|
-
scoreDisplayMode: Audit.SCORING_MODES.INFORMATIVE,
|
|
36
|
-
requiredArtifacts: ['devtoolsLogs', 'URL'],
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @param {LH.Artifacts} artifacts
|
|
42
|
-
* @param {LH.Audit.Context} context
|
|
43
|
-
* @return {Promise<LH.Audit.Product>}
|
|
44
|
-
*/
|
|
45
|
-
static async audit(artifacts, context) {
|
|
46
|
-
const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS];
|
|
47
|
-
const summary = await ComputedResourceSummary
|
|
48
|
-
.request({devtoolsLog, URL: artifacts.URL, budgets: context.settings.budgets}, context);
|
|
49
|
-
|
|
50
|
-
/** @type {LH.Audit.Details.Table['headings']} */
|
|
51
|
-
const headings = [
|
|
52
|
-
{key: 'label', valueType: 'text', label: str_(i18n.UIStrings.columnResourceType)},
|
|
53
|
-
{key: 'requestCount', valueType: 'numeric', label: str_(i18n.UIStrings.columnRequests)},
|
|
54
|
-
{key: 'transferSize', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize)},
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/** @type {Record<LH.Budget.ResourceType, LH.IcuMessage>} */
|
|
59
|
-
const strMappings = {
|
|
60
|
-
'total': str_(i18n.UIStrings.totalResourceType),
|
|
61
|
-
'document': str_(i18n.UIStrings.documentResourceType),
|
|
62
|
-
'script': str_(i18n.UIStrings.scriptResourceType),
|
|
63
|
-
'stylesheet': str_(i18n.UIStrings.stylesheetResourceType),
|
|
64
|
-
'image': str_(i18n.UIStrings.imageResourceType),
|
|
65
|
-
'media': str_(i18n.UIStrings.mediaResourceType),
|
|
66
|
-
'font': str_(i18n.UIStrings.fontResourceType),
|
|
67
|
-
'other': str_(i18n.UIStrings.otherResourceType),
|
|
68
|
-
'third-party': str_(i18n.UIStrings.thirdPartyResourceType),
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const types = /** @type {Array<LH.Budget.ResourceType>} */ (Object.keys(summary));
|
|
72
|
-
const rows = types.map(type => {
|
|
73
|
-
return {
|
|
74
|
-
// ResourceType is included as an "id" for ease of use.
|
|
75
|
-
// It does not appear directly in the table.
|
|
76
|
-
resourceType: type,
|
|
77
|
-
label: strMappings[type],
|
|
78
|
-
requestCount: summary[type].count,
|
|
79
|
-
transferSize: summary[type].transferSize,
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
// Force third-party to be last, descending by size otherwise
|
|
83
|
-
const thirdPartyRow = rows.find(r => r.resourceType === 'third-party') || [];
|
|
84
|
-
const otherRows = rows.filter(r => r.resourceType !== 'third-party')
|
|
85
|
-
.sort((a, b) => {
|
|
86
|
-
return b.transferSize - a.transferSize;
|
|
87
|
-
});
|
|
88
|
-
const tableItems = otherRows.concat(thirdPartyRow);
|
|
89
|
-
|
|
90
|
-
const tableDetails = Audit.makeTableDetails(headings, tableItems);
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
details: tableDetails,
|
|
94
|
-
score: 1,
|
|
95
|
-
displayValue: str_(UIStrings.displayValue, {
|
|
96
|
-
requestCount: summary.total.count,
|
|
97
|
-
byteCount: summary.total.transferSize,
|
|
98
|
-
}),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export default ResourceSummary;
|
|
104
|
-
export {UIStrings};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export default ServiceWorker;
|
|
2
|
-
declare class ServiceWorker extends Audit {
|
|
3
|
-
/**
|
|
4
|
-
* Find active service workers for this origin.
|
|
5
|
-
* @param {Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>} versions
|
|
6
|
-
* @param {URL} pageUrl
|
|
7
|
-
* @return {Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>}
|
|
8
|
-
*/
|
|
9
|
-
static getVersionsForOrigin(versions: Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>, pageUrl: URL): Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>;
|
|
10
|
-
/**
|
|
11
|
-
* From the set of active service workers for this origin, find the controlling SW (if any)
|
|
12
|
-
* and return its scope URL.
|
|
13
|
-
* @param {Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>} matchingSWVersions
|
|
14
|
-
* @param {Array<LH.Crdp.ServiceWorker.ServiceWorkerRegistration>} registrations
|
|
15
|
-
* @param {URL} pageUrl
|
|
16
|
-
* @return {{scopeUrl: string; scriptUrl: string} | undefined}
|
|
17
|
-
*/
|
|
18
|
-
static getControllingServiceWorker(matchingSWVersions: Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>, registrations: Array<LH.Crdp.ServiceWorker.ServiceWorkerRegistration>, pageUrl: URL): {
|
|
19
|
-
scopeUrl: string;
|
|
20
|
-
scriptUrl: string;
|
|
21
|
-
} | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Returns a failure message if there is no start_url or if the start_url isn't
|
|
24
|
-
* contolled by the scopeUrl.
|
|
25
|
-
* @param {LH.Artifacts['WebAppManifest']} WebAppManifest
|
|
26
|
-
* @param {string} scopeUrl
|
|
27
|
-
* @return {LH.IcuMessage|undefined}
|
|
28
|
-
*/
|
|
29
|
-
static checkStartUrl(WebAppManifest: LH.Artifacts['WebAppManifest'], scopeUrl: string): LH.IcuMessage | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* @param {LH.Artifacts} artifacts
|
|
32
|
-
* @return {LH.Audit.Product}
|
|
33
|
-
*/
|
|
34
|
-
static audit(artifacts: LH.Artifacts): LH.Audit.Product;
|
|
35
|
-
}
|
|
36
|
-
export namespace UIStrings {
|
|
37
|
-
const title: string;
|
|
38
|
-
const failureTitle: string;
|
|
39
|
-
const description: string;
|
|
40
|
-
const explanationOutOfScope: string;
|
|
41
|
-
const explanationNoManifest: string;
|
|
42
|
-
const explanationBadManifest: string;
|
|
43
|
-
const explanationBadStartUrl: string;
|
|
44
|
-
}
|
|
45
|
-
import { Audit } from './audit.js';
|
|
46
|
-
//# sourceMappingURL=service-worker.d.ts.map
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2016 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {Audit} from './audit.js';
|
|
8
|
-
import * as i18n from '../lib/i18n/i18n.js';
|
|
9
|
-
|
|
10
|
-
const UIStrings = {
|
|
11
|
-
/** Title of a Lighthouse audit that provides detail on a page's service worker. This descriptive title is shown to users when a service worker is registered and valid. */
|
|
12
|
-
title: 'Registers a service worker that controls page and `start_url`',
|
|
13
|
-
/** Title of a Lighthouse audit that provides detail on a page's service worker. This descriptive title is shown to users when a service worker is not present or invalid. */
|
|
14
|
-
failureTitle: 'Does not register a service worker that controls page and `start_url`',
|
|
15
|
-
/** Description of a Lighthouse audit that tells the user why they should use a service worker. 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. */
|
|
16
|
-
description: 'The service worker is the technology that enables your app to use many ' +
|
|
17
|
-
'Progressive Web App features, such as offline, add to homescreen, and push ' +
|
|
18
|
-
'notifications. [Learn more about Service Workers](https://developer.chrome.com/docs/lighthouse/pwa/service-worker/).',
|
|
19
|
-
/**
|
|
20
|
-
* @description Message explaining that the website may have service workers, but none are in scope to control the tested web page.
|
|
21
|
-
* @example {https://example.com/} pageUrl
|
|
22
|
-
* */
|
|
23
|
-
explanationOutOfScope: 'This origin has one or more service workers, however the page ' +
|
|
24
|
-
'({pageUrl}) is not in scope.',
|
|
25
|
-
/** Message explaining that the page has no manifest file so can't specify a starting url. */
|
|
26
|
-
explanationNoManifest: 'This page is controlled by a service worker, however ' +
|
|
27
|
-
'no `start_url` was found because no manifest was fetched.',
|
|
28
|
-
/** Message explaining that the page had an invalid manifest file so can't specify a starting url. */
|
|
29
|
-
explanationBadManifest: 'This page is controlled by a service worker, however ' +
|
|
30
|
-
'no `start_url` was found because manifest failed to parse as valid JSON',
|
|
31
|
-
/**
|
|
32
|
-
* @description Message explaining that the website has a service worker, but none are in scope to control the tested starting url.
|
|
33
|
-
* @example {https://example.com/} startUrl
|
|
34
|
-
* @example {https://othersite.com/} scopeUrl
|
|
35
|
-
* */
|
|
36
|
-
explanationBadStartUrl: 'This page is controlled by a service worker, however ' +
|
|
37
|
-
'the `start_url` ({startUrl}) is not in the service worker\'s scope ({scopeUrl})',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
41
|
-
|
|
42
|
-
class ServiceWorker extends Audit {
|
|
43
|
-
/**
|
|
44
|
-
* @return {LH.Audit.Meta}
|
|
45
|
-
*/
|
|
46
|
-
static get meta() {
|
|
47
|
-
return {
|
|
48
|
-
id: 'service-worker',
|
|
49
|
-
title: str_(UIStrings.title),
|
|
50
|
-
failureTitle: str_(UIStrings.failureTitle),
|
|
51
|
-
description: str_(UIStrings.description),
|
|
52
|
-
supportedModes: ['navigation'],
|
|
53
|
-
requiredArtifacts: ['URL', 'ServiceWorker', 'WebAppManifest'],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Find active service workers for this origin.
|
|
59
|
-
* @param {Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>} versions
|
|
60
|
-
* @param {URL} pageUrl
|
|
61
|
-
* @return {Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>}
|
|
62
|
-
*/
|
|
63
|
-
static getVersionsForOrigin(versions, pageUrl) {
|
|
64
|
-
return versions
|
|
65
|
-
.filter(v => v.status === 'activated')
|
|
66
|
-
.filter(v => new URL(v.scriptURL).origin === pageUrl.origin);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* From the set of active service workers for this origin, find the controlling SW (if any)
|
|
71
|
-
* and return its scope URL.
|
|
72
|
-
* @param {Array<LH.Crdp.ServiceWorker.ServiceWorkerVersion>} matchingSWVersions
|
|
73
|
-
* @param {Array<LH.Crdp.ServiceWorker.ServiceWorkerRegistration>} registrations
|
|
74
|
-
* @param {URL} pageUrl
|
|
75
|
-
* @return {{scopeUrl: string; scriptUrl: string} | undefined}
|
|
76
|
-
*/
|
|
77
|
-
static getControllingServiceWorker(matchingSWVersions, registrations, pageUrl) {
|
|
78
|
-
// Find the normalized scope URLs of possibly-controlling SWs.
|
|
79
|
-
/** @type {Array<{scopeUrl: string; scriptUrl: string}>} */
|
|
80
|
-
const scriptByScopeUrlList = [];
|
|
81
|
-
|
|
82
|
-
// Populate serviceWorkerUrls map with the scriptURLs and scopeUrls of matchingSWVersions and registrations
|
|
83
|
-
for (const version of matchingSWVersions) {
|
|
84
|
-
const matchedRegistration = registrations
|
|
85
|
-
.find(r => r.registrationId === version.registrationId);
|
|
86
|
-
|
|
87
|
-
if (matchedRegistration) {
|
|
88
|
-
const scopeUrl = new URL(matchedRegistration.scopeURL).href;
|
|
89
|
-
const scriptUrl = new URL(version.scriptURL).href;
|
|
90
|
-
scriptByScopeUrlList.push({scopeUrl, scriptUrl});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Find most-specific applicable scope, the one controlling the page.
|
|
95
|
-
// See https://w3c.github.io/ServiceWorker/v1/#scope-match-algorithm
|
|
96
|
-
const pageControllingUrls = scriptByScopeUrlList
|
|
97
|
-
.filter(ss => pageUrl.href.startsWith(ss.scopeUrl))
|
|
98
|
-
.sort((ssA, ssB) => ssA.scopeUrl.length - ssB.scopeUrl.length)
|
|
99
|
-
.pop();
|
|
100
|
-
|
|
101
|
-
return pageControllingUrls;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Returns a failure message if there is no start_url or if the start_url isn't
|
|
106
|
-
* contolled by the scopeUrl.
|
|
107
|
-
* @param {LH.Artifacts['WebAppManifest']} WebAppManifest
|
|
108
|
-
* @param {string} scopeUrl
|
|
109
|
-
* @return {LH.IcuMessage|undefined}
|
|
110
|
-
*/
|
|
111
|
-
static checkStartUrl(WebAppManifest, scopeUrl) {
|
|
112
|
-
if (!WebAppManifest) {
|
|
113
|
-
return str_(UIStrings.explanationNoManifest);
|
|
114
|
-
}
|
|
115
|
-
if (!WebAppManifest.value) {
|
|
116
|
-
return str_(UIStrings.explanationBadManifest);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const startUrl = WebAppManifest.value.start_url.value;
|
|
120
|
-
if (!startUrl.startsWith(scopeUrl)) {
|
|
121
|
-
return str_(UIStrings.explanationBadStartUrl, {startUrl, scopeUrl});
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @param {LH.Artifacts} artifacts
|
|
127
|
-
* @return {LH.Audit.Product}
|
|
128
|
-
*/
|
|
129
|
-
static audit(artifacts) {
|
|
130
|
-
// Match against `artifacts.URL.mainDocumentUrl` so audit accounts for any redirects.
|
|
131
|
-
// Service workers won't control network requests if the page uses `history.pushState` to "enter" the SW scope.
|
|
132
|
-
// For this reason it is better to evaluate the SW in relation to the main document url rather than the final frame url.
|
|
133
|
-
const {mainDocumentUrl} = artifacts.URL;
|
|
134
|
-
if (!mainDocumentUrl) throw new Error('mainDocumentUrl must exist in navigation mode');
|
|
135
|
-
const pageUrl = new URL(mainDocumentUrl);
|
|
136
|
-
const {versions, registrations} = artifacts.ServiceWorker;
|
|
137
|
-
|
|
138
|
-
const versionsForOrigin = ServiceWorker.getVersionsForOrigin(versions, pageUrl);
|
|
139
|
-
if (versionsForOrigin.length === 0) {
|
|
140
|
-
return {
|
|
141
|
-
score: 0,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const serviceWorkerUrls = ServiceWorker.getControllingServiceWorker(versionsForOrigin,
|
|
146
|
-
registrations, pageUrl);
|
|
147
|
-
if (!serviceWorkerUrls) {
|
|
148
|
-
return {
|
|
149
|
-
score: 0,
|
|
150
|
-
explanation: str_(UIStrings.explanationOutOfScope, {pageUrl: pageUrl.href}),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Include the SW details as diagnostic data.
|
|
155
|
-
const {scriptUrl, scopeUrl} = serviceWorkerUrls;
|
|
156
|
-
/** @type {LH.Audit.Details.DebugData} */
|
|
157
|
-
const details = {
|
|
158
|
-
type: 'debugdata',
|
|
159
|
-
scriptUrl,
|
|
160
|
-
scopeUrl,
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const startUrlFailure = ServiceWorker.checkStartUrl(artifacts.WebAppManifest,
|
|
164
|
-
serviceWorkerUrls.scopeUrl);
|
|
165
|
-
if (startUrlFailure) {
|
|
166
|
-
return {
|
|
167
|
-
score: 0,
|
|
168
|
-
details,
|
|
169
|
-
explanation: startUrlFailure,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// SW controls both finalDisplayedUrl and start_url.
|
|
174
|
-
return {
|
|
175
|
-
score: 1,
|
|
176
|
-
details,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export default ServiceWorker;
|
|
182
|
-
export {UIStrings};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2016 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
|
-
* Base class for all gatherers; defines pass lifecycle methods. The artifact
|
|
8
|
-
* from the gatherer is the last not-undefined value returned by a lifecycle
|
|
9
|
-
* method. All methods can return the artifact value directly or return a
|
|
10
|
-
* Promise that resolves to that value.
|
|
11
|
-
*
|
|
12
|
-
* If an Error is thrown (or a Promise that rejects on an Error),
|
|
13
|
-
* the runner will treat it as an error internal to the gatherer and
|
|
14
|
-
* continue execution of any remaining gatherers.
|
|
15
|
-
*
|
|
16
|
-
* @implements {LH.Gatherer.GathererInstance}
|
|
17
|
-
*/
|
|
18
|
-
export class Gatherer implements LH.Gatherer.GathererInstance {
|
|
19
|
-
/**
|
|
20
|
-
* @return {keyof LH.GathererArtifacts}
|
|
21
|
-
*/
|
|
22
|
-
get name(): keyof import("../..").GathererArtifacts;
|
|
23
|
-
/**
|
|
24
|
-
* Called before navigation to target url.
|
|
25
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
26
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
27
|
-
*/
|
|
28
|
-
beforePass(passContext: LH.Gatherer.PassContext): LH.Gatherer.PhaseResult;
|
|
29
|
-
/**
|
|
30
|
-
* Called after target page is loaded. If a trace is enabled for this pass,
|
|
31
|
-
* the trace is still being recorded.
|
|
32
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
33
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
34
|
-
*/
|
|
35
|
-
pass(passContext: LH.Gatherer.PassContext): LH.Gatherer.PhaseResult;
|
|
36
|
-
/**
|
|
37
|
-
* Called after target page is loaded, all gatherer `pass` methods have been
|
|
38
|
-
* executed, and — if generated in this pass — the trace is ended. The trace
|
|
39
|
-
* and record of network activity are provided in `loadData`.
|
|
40
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
41
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
42
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
43
|
-
*/
|
|
44
|
-
afterPass(passContext: LH.Gatherer.PassContext, loadData: LH.Gatherer.LoadData): LH.Gatherer.PhaseResult;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=gatherer.d.ts.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2016 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
|
-
/**
|
|
8
|
-
* Base class for all gatherers; defines pass lifecycle methods. The artifact
|
|
9
|
-
* from the gatherer is the last not-undefined value returned by a lifecycle
|
|
10
|
-
* method. All methods can return the artifact value directly or return a
|
|
11
|
-
* Promise that resolves to that value.
|
|
12
|
-
*
|
|
13
|
-
* If an Error is thrown (or a Promise that rejects on an Error),
|
|
14
|
-
* the runner will treat it as an error internal to the gatherer and
|
|
15
|
-
* continue execution of any remaining gatherers.
|
|
16
|
-
*
|
|
17
|
-
* @implements {LH.Gatherer.GathererInstance}
|
|
18
|
-
*/
|
|
19
|
-
class Gatherer {
|
|
20
|
-
/**
|
|
21
|
-
* @return {keyof LH.GathererArtifacts}
|
|
22
|
-
*/
|
|
23
|
-
get name() {
|
|
24
|
-
// @ts-expect-error - assume that class name has been added to LH.GathererArtifacts.
|
|
25
|
-
return this.constructor.name;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* eslint-disable no-unused-vars */
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Called before navigation to target url.
|
|
32
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
33
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
34
|
-
*/
|
|
35
|
-
beforePass(passContext) { }
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Called after target page is loaded. If a trace is enabled for this pass,
|
|
39
|
-
* the trace is still being recorded.
|
|
40
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
41
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
42
|
-
*/
|
|
43
|
-
pass(passContext) { }
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Called after target page is loaded, all gatherer `pass` methods have been
|
|
47
|
-
* executed, and — if generated in this pass — the trace is ended. The trace
|
|
48
|
-
* and record of network activity are provided in `loadData`.
|
|
49
|
-
* @param {LH.Gatherer.PassContext} passContext
|
|
50
|
-
* @param {LH.Gatherer.LoadData} loadData
|
|
51
|
-
* @return {LH.Gatherer.PhaseResult}
|
|
52
|
-
*/
|
|
53
|
-
afterPass(passContext, loadData) { }
|
|
54
|
-
|
|
55
|
-
/* eslint-enable no-unused-vars */
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export {Gatherer};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
export type GathererConstructor = typeof import('../../gather/gatherers/gatherer.js').Gatherer;
|
|
2
|
-
export type Gatherer = InstanceType<GathererConstructor>;
|
|
3
|
-
/**
|
|
4
|
-
* @implements {LH.Config.LegacyResolvedConfig}
|
|
5
|
-
*/
|
|
6
|
-
export class LegacyResolvedConfig implements LH.Config.LegacyResolvedConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Resolves the provided config (inherits from extended config, if set), resolves
|
|
9
|
-
* all referenced modules, and validates.
|
|
10
|
-
* @param {LH.Config=} config If not provided, uses the default config.
|
|
11
|
-
* @param {LH.Flags=} flags
|
|
12
|
-
* @return {Promise<LegacyResolvedConfig>}
|
|
13
|
-
*/
|
|
14
|
-
static fromJson(config?: LH.Config | undefined, flags?: LH.Flags | undefined): Promise<LegacyResolvedConfig>;
|
|
15
|
-
/**
|
|
16
|
-
* @param {LH.Config} baseJSON The JSON of the configuration to extend
|
|
17
|
-
* @param {LH.Config} extendJSON The JSON of the extensions
|
|
18
|
-
* @return {LH.Config}
|
|
19
|
-
*/
|
|
20
|
-
static extendConfigJSON(baseJSON: LH.Config, extendJSON: LH.Config): LH.Config;
|
|
21
|
-
/**
|
|
22
|
-
* @param {LH.Config['passes']} passes
|
|
23
|
-
* @return {?Array<Required<LH.Config.PassJson>>}
|
|
24
|
-
*/
|
|
25
|
-
static augmentPassesWithDefaults(passes: LH.Config['passes']): Array<Required<LH.Config.PassJson>> | null;
|
|
26
|
-
/**
|
|
27
|
-
* Observed throttling methods (devtools/provided) require at least 5s of quiet for the metrics to
|
|
28
|
-
* be computed. This method adjusts the quiet thresholds to the required minimums if necessary.
|
|
29
|
-
* @param {LH.Config.Settings} settings
|
|
30
|
-
* @param {?Array<Required<LH.Config.PassJson>>} passes
|
|
31
|
-
*/
|
|
32
|
-
static adjustDefaultPassForThrottling(settings: LH.Config.Settings, passes: Array<Required<LH.Config.PassJson>> | null): void;
|
|
33
|
-
/**
|
|
34
|
-
* Filter out any unrequested items from the config, based on requested categories or audits.
|
|
35
|
-
* @param {LegacyResolvedConfig} config
|
|
36
|
-
*/
|
|
37
|
-
static filterConfigIfNeeded(config: LegacyResolvedConfig): void;
|
|
38
|
-
/**
|
|
39
|
-
* Filter out any unrequested categories or audits from the categories object.
|
|
40
|
-
* @param {LegacyResolvedConfig['categories']} oldCategories
|
|
41
|
-
* @param {LH.Config.Settings} settings
|
|
42
|
-
* @return {{categories: LegacyResolvedConfig['categories'], requestedAuditNames: Set<string>}}
|
|
43
|
-
*/
|
|
44
|
-
static filterCategoriesAndAudits(oldCategories: LegacyResolvedConfig['categories'], settings: LH.Config.Settings): {
|
|
45
|
-
categories: LegacyResolvedConfig['categories'];
|
|
46
|
-
requestedAuditNames: Set<string>;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* From some requested audits, return names of all required and optional artifacts
|
|
50
|
-
* @param {LegacyResolvedConfig['audits']} audits
|
|
51
|
-
* @return {Set<string>}
|
|
52
|
-
*/
|
|
53
|
-
static getGatherersRequestedByAudits(audits: LegacyResolvedConfig['audits']): Set<string>;
|
|
54
|
-
/**
|
|
55
|
-
* Filters to only requested passes and gatherers, returning a new passes array.
|
|
56
|
-
* @param {LegacyResolvedConfig['passes']} passes
|
|
57
|
-
* @param {Set<string>} requestedGatherers
|
|
58
|
-
* @return {LegacyResolvedConfig['passes']}
|
|
59
|
-
*/
|
|
60
|
-
static generatePassesNeededByGatherers(passes: LegacyResolvedConfig['passes'], requestedGatherers: Set<string>): LegacyResolvedConfig['passes'];
|
|
61
|
-
/**
|
|
62
|
-
* Take an array of audits and audit paths and require any paths (possibly
|
|
63
|
-
* relative to the optional `configDir`) using `resolveModulePath`,
|
|
64
|
-
* leaving only an array of AuditDefns.
|
|
65
|
-
* @param {LH.Config['audits']} audits
|
|
66
|
-
* @param {string=} configDir
|
|
67
|
-
* @return {Promise<LegacyResolvedConfig['audits']>}
|
|
68
|
-
*/
|
|
69
|
-
static requireAudits(audits: LH.Config['audits'], configDir?: string | undefined): Promise<LegacyResolvedConfig['audits']>;
|
|
70
|
-
/**
|
|
71
|
-
* Takes an array of passes with every property now initialized except the
|
|
72
|
-
* gatherers and requires them, (relative to the optional `configDir` if
|
|
73
|
-
* provided) using `resolveModulePath`, returning an array of full Passes.
|
|
74
|
-
* @param {?Array<Required<LH.Config.PassJson>>} passes
|
|
75
|
-
* @param {string=} configDir
|
|
76
|
-
* @return {Promise<LegacyResolvedConfig['passes']>}
|
|
77
|
-
*/
|
|
78
|
-
static requireGatherers(passes: Array<Required<LH.Config.PassJson>> | null, configDir?: string | undefined): Promise<LegacyResolvedConfig['passes']>;
|
|
79
|
-
/**
|
|
80
|
-
* @deprecated `LegacyResolvedConfig.fromJson` should be used instead.
|
|
81
|
-
* @constructor
|
|
82
|
-
* @param {LH.Config} config
|
|
83
|
-
* @param {{settings: LH.Config.Settings, passes: ?LH.Config.Pass[], audits: ?LH.Config.AuditDefn[]}} opts
|
|
84
|
-
*/
|
|
85
|
-
constructor(config: LH.Config, opts: {
|
|
86
|
-
settings: LH.Config.Settings;
|
|
87
|
-
passes: LH.Config.Pass[] | null;
|
|
88
|
-
audits: LH.Config.AuditDefn[] | null;
|
|
89
|
-
});
|
|
90
|
-
/** @type {LH.Config.Settings} */
|
|
91
|
-
settings: LH.Config.Settings;
|
|
92
|
-
/** @type {?Array<LH.Config.Pass>} */
|
|
93
|
-
passes: Array<LH.Config.Pass> | null;
|
|
94
|
-
/** @type {?Array<LH.Config.AuditDefn>} */
|
|
95
|
-
audits: Array<LH.Config.AuditDefn> | null;
|
|
96
|
-
/** @type {?Record<string, LH.Config.Category>} */
|
|
97
|
-
categories: Record<string, LH.Config.Category> | null;
|
|
98
|
-
/** @type {?Record<string, LH.Config.Group>} */
|
|
99
|
-
groups: Record<string, LH.Config.Group> | null;
|
|
100
|
-
/**
|
|
101
|
-
* Provides a cleaned-up, stringified version of this config. Gatherer and
|
|
102
|
-
* Audit `implementation` and `instance` do not survive this process.
|
|
103
|
-
* @return {string}
|
|
104
|
-
*/
|
|
105
|
-
getPrintString(): string;
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=config.d.ts.map
|