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
|
@@ -13,7 +13,7 @@ import {MainThreadTasks} from '../lib/tracehouse/main-thread-tasks.js';
|
|
|
13
13
|
import {taskGroups} from '../lib/tracehouse/task-groups.js';
|
|
14
14
|
import {TraceProcessor} from '../lib/tracehouse/trace-processor.js';
|
|
15
15
|
import {getExecutionTimingsByURL} from '../lib/tracehouse/task-summary.js';
|
|
16
|
-
import
|
|
16
|
+
import InteractionToNextPaint from './metrics/interaction-to-next-paint.js';
|
|
17
17
|
import {LighthouseError} from '../lib/lh-error.js';
|
|
18
18
|
|
|
19
19
|
/** @typedef {import('../computed/metrics/responsiveness.js').EventTimingEvent} EventTimingEvent */
|
|
@@ -273,7 +273,7 @@ class WorkDuringInteraction extends Audit {
|
|
|
273
273
|
const duration = interactionEvent.args.data.duration;
|
|
274
274
|
const displayValue = str_(UIStrings.displayValue, {timeInMs: duration, interactionType});
|
|
275
275
|
return {
|
|
276
|
-
score: duration <
|
|
276
|
+
score: duration < InteractionToNextPaint.defaultOptions.p10 ? 1 : 0,
|
|
277
277
|
displayValue,
|
|
278
278
|
details: {
|
|
279
279
|
type: 'list',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ProcessedNavigationComputed as ProcessedNavigation };
|
|
2
2
|
declare const ProcessedNavigationComputed: typeof ProcessedNavigation & {
|
|
3
|
-
request: (dependencies: import("../index.js").
|
|
3
|
+
request: (dependencies: import("../index.js").Artifacts.ProcessedTrace | import("../index.js").Trace, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
4
4
|
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
5
5
|
}>) => Promise<import("../index.js").Artifacts.ProcessedNavigation>;
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type GathererConstructor = typeof import('../gather/
|
|
1
|
+
export type GathererConstructor = typeof import('../gather/base-gatherer.js').default;
|
|
2
2
|
export type Audit = typeof import('../audits/audit.js')['Audit'];
|
|
3
3
|
export type Gatherer = InstanceType<GathererConstructor>;
|
|
4
4
|
/**
|
|
@@ -71,9 +71,9 @@ export function resolveAuditsToDefns(audits: LH.Config['audits'], configDir?: st
|
|
|
71
71
|
* @param {LH.Config.GathererJson} gathererJson
|
|
72
72
|
* @param {Array<string>} coreGathererList
|
|
73
73
|
* @param {string=} configDir
|
|
74
|
-
* @return {Promise<LH.Config.
|
|
74
|
+
* @return {Promise<LH.Config.AnyGathererDefn>}
|
|
75
75
|
*/
|
|
76
|
-
export function resolveGathererToDefn(gathererJson: LH.Config.GathererJson, coreGathererList: Array<string>, configDir?: string | undefined): Promise<LH.Config.
|
|
76
|
+
export function resolveGathererToDefn(gathererJson: LH.Config.GathererJson, coreGathererList: Array<string>, configDir?: string | undefined): Promise<LH.Config.AnyGathererDefn>;
|
|
77
77
|
/**
|
|
78
78
|
* Resolves the location of the specified module and returns an absolute
|
|
79
79
|
* string path to the file. Used for loading custom audits and gatherers.
|
|
@@ -20,7 +20,7 @@ import {getModuleDirectory} from '../../esm-utils.js';
|
|
|
20
20
|
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
|
|
23
|
-
/** @typedef {typeof import('../gather/
|
|
23
|
+
/** @typedef {typeof import('../gather/base-gatherer.js').default} GathererConstructor */
|
|
24
24
|
/** @typedef {typeof import('../audits/audit.js')['Audit']} Audit */
|
|
25
25
|
/** @typedef {InstanceType<GathererConstructor>} Gatherer */
|
|
26
26
|
|
|
@@ -160,7 +160,7 @@ function mergeConfigFragmentArrayByKey(baseArray, extensionArray, keyFn) {
|
|
|
160
160
|
* - {instance: myGathererInstance}
|
|
161
161
|
*
|
|
162
162
|
* @param {LH.Config.GathererJson} gatherer
|
|
163
|
-
* @return {{instance?: Gatherer, implementation?: GathererConstructor, path?: string}}
|
|
163
|
+
* @return {{instance?: Gatherer, implementation?: GathererConstructor, path?: string}}
|
|
164
164
|
*/
|
|
165
165
|
function expandGathererShorthand(gatherer) {
|
|
166
166
|
if (typeof gatherer === 'string') {
|
|
@@ -178,7 +178,7 @@ function expandGathererShorthand(gatherer) {
|
|
|
178
178
|
} else if (typeof gatherer === 'function') {
|
|
179
179
|
// just GathererConstructor
|
|
180
180
|
return {implementation: gatherer};
|
|
181
|
-
} else if (gatherer && typeof gatherer.
|
|
181
|
+
} else if (gatherer && typeof gatherer.getArtifact === 'function') {
|
|
182
182
|
// just GathererInstance
|
|
183
183
|
return {instance: gatherer};
|
|
184
184
|
} else {
|
|
@@ -254,7 +254,7 @@ async function requireWrapper(requirePath) {
|
|
|
254
254
|
* @param {string} gathererPath
|
|
255
255
|
* @param {Array<string>} coreGathererList
|
|
256
256
|
* @param {string=} configDir
|
|
257
|
-
* @return {Promise<LH.Config.
|
|
257
|
+
* @return {Promise<LH.Config.AnyGathererDefn>}
|
|
258
258
|
*/
|
|
259
259
|
async function requireGatherer(gathererPath, coreGathererList, configDir) {
|
|
260
260
|
const coreGatherer = coreGathererList.find(a => a === `${gathererPath}.js`);
|
|
@@ -399,7 +399,7 @@ async function mergePlugins(config, configDir, flags) {
|
|
|
399
399
|
* @param {LH.Config.GathererJson} gathererJson
|
|
400
400
|
* @param {Array<string>} coreGathererList
|
|
401
401
|
* @param {string=} configDir
|
|
402
|
-
* @return {Promise<LH.Config.
|
|
402
|
+
* @return {Promise<LH.Config.AnyGathererDefn>}
|
|
403
403
|
*/
|
|
404
404
|
async function resolveGathererToDefn(gathererJson, coreGathererList, configDir) {
|
|
405
405
|
const gathererDefn = expandGathererShorthand(gathererJson);
|
|
@@ -595,13 +595,6 @@ function deepCloneConfigJson(json) {
|
|
|
595
595
|
|
|
596
596
|
// Copy arrays that could contain non-serializable properties to allow for programmatic
|
|
597
597
|
// injection of audit and gatherer implementations.
|
|
598
|
-
if (Array.isArray(cloned.passes) && Array.isArray(json.passes)) {
|
|
599
|
-
for (let i = 0; i < cloned.passes.length; i++) {
|
|
600
|
-
const pass = cloned.passes[i];
|
|
601
|
-
pass.gatherers = (json.passes[i].gatherers || []).map(gatherer => shallowClone(gatherer));
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
598
|
if (Array.isArray(json.audits)) {
|
|
606
599
|
cloned.audits = json.audits.map(audit => shallowClone(audit));
|
|
607
600
|
}
|
package/core/config/config.js
CHANGED
|
@@ -12,7 +12,6 @@ import {Runner} from '../runner.js';
|
|
|
12
12
|
import defaultConfig from './default-config.js';
|
|
13
13
|
import {defaultNavigationConfig, nonSimulatedPassConfigOverrides} from './constants.js'; // eslint-disable-line max-len
|
|
14
14
|
import {
|
|
15
|
-
isFRGathererDefn,
|
|
16
15
|
throwInvalidDependencyOrder,
|
|
17
16
|
isValidArtifactDependency,
|
|
18
17
|
throwInvalidArtifactDependency,
|
|
@@ -104,7 +103,7 @@ function resolveExtensions(config) {
|
|
|
104
103
|
* Looks up the required artifact IDs for each dependency, throwing if no earlier artifact satisfies the dependency.
|
|
105
104
|
*
|
|
106
105
|
* @param {LH.Config.ArtifactJson} artifact
|
|
107
|
-
* @param {LH.Config.
|
|
106
|
+
* @param {LH.Config.AnyGathererDefn} gatherer
|
|
108
107
|
* @param {Map<Symbol, LH.Config.AnyArtifactDefn>} artifactDefnsBySymbol
|
|
109
108
|
* @return {LH.Config.AnyArtifactDefn['dependencies']}
|
|
110
109
|
*/
|
|
@@ -154,14 +153,9 @@ async function resolveArtifactsToDefns(artifacts, configDir) {
|
|
|
154
153
|
const coreGathererList = Runner.getGathererList();
|
|
155
154
|
const artifactDefns = [];
|
|
156
155
|
for (const artifactJson of sortedArtifacts) {
|
|
157
|
-
/** @type {LH.Config.GathererJson} */
|
|
158
|
-
// @ts-expect-error - remove when legacy runner path is removed.
|
|
159
156
|
const gathererJson = artifactJson.gatherer;
|
|
160
157
|
|
|
161
158
|
const gatherer = await resolveGathererToDefn(gathererJson, coreGathererList, configDir);
|
|
162
|
-
if (!isFRGathererDefn(gatherer)) {
|
|
163
|
-
throw new Error(`${gatherer.instance.name} gatherer does not have a Fraggle Rock meta obj`);
|
|
164
|
-
}
|
|
165
159
|
|
|
166
160
|
/** @type {LH.Config.AnyArtifactDefn} */
|
|
167
161
|
// @ts-expect-error - Typescript can't validate the gatherer and dependencies match
|
|
@@ -48,8 +48,6 @@ export namespace userAgents {
|
|
|
48
48
|
}
|
|
49
49
|
/** @type {LH.Config.Settings} */
|
|
50
50
|
export const defaultSettings: LH.Config.Settings;
|
|
51
|
-
/** @type {LH.Config.Pass} */
|
|
52
|
-
export const defaultPassConfig: LH.Config.Pass;
|
|
53
51
|
/** @type {Required<LH.Config.NavigationJson>} */
|
|
54
52
|
export const defaultNavigationConfig: Required<LH.Config.NavigationJson>;
|
|
55
53
|
export namespace nonSimulatedPassConfigOverrides {
|
package/core/config/constants.js
CHANGED
|
@@ -17,7 +17,7 @@ const throttling = {
|
|
|
17
17
|
DEVTOOLS_RTT_ADJUSTMENT_FACTOR,
|
|
18
18
|
DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR,
|
|
19
19
|
// These values align with WebPageTest's definition of "Fast 3G"
|
|
20
|
-
// But offer similar
|
|
20
|
+
// But offer similar characteristics to roughly the 75th percentile of 4G connections.
|
|
21
21
|
mobileSlow4G: {
|
|
22
22
|
rttMs: 150,
|
|
23
23
|
throughputKbps: 1.6 * 1024,
|
|
@@ -127,24 +127,9 @@ const defaultSettings = {
|
|
|
127
127
|
skipAudits: null,
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
-
/** @type {LH.Config.Pass} */
|
|
131
|
-
const defaultPassConfig = {
|
|
132
|
-
passName: 'defaultPass',
|
|
133
|
-
loadFailureMode: 'fatal',
|
|
134
|
-
recordTrace: false,
|
|
135
|
-
useThrottling: false,
|
|
136
|
-
pauseAfterFcpMs: 0,
|
|
137
|
-
pauseAfterLoadMs: 0,
|
|
138
|
-
networkQuietThresholdMs: 0,
|
|
139
|
-
cpuQuietThresholdMs: 0,
|
|
140
|
-
blockedUrlPatterns: [],
|
|
141
|
-
blankPage: 'about:blank',
|
|
142
|
-
gatherers: [],
|
|
143
|
-
};
|
|
144
|
-
|
|
145
130
|
/** @type {Required<LH.Config.NavigationJson>} */
|
|
146
131
|
const defaultNavigationConfig = {
|
|
147
|
-
id: '
|
|
132
|
+
id: 'defaultPass',
|
|
148
133
|
loadFailureMode: 'fatal',
|
|
149
134
|
disableThrottling: false,
|
|
150
135
|
disableStorageReset: false,
|
|
@@ -169,7 +154,6 @@ export {
|
|
|
169
154
|
screenEmulationMetrics,
|
|
170
155
|
userAgents,
|
|
171
156
|
defaultSettings,
|
|
172
|
-
defaultPassConfig,
|
|
173
157
|
defaultNavigationConfig,
|
|
174
158
|
nonSimulatedPassConfigOverrides,
|
|
175
159
|
};
|
|
@@ -38,8 +38,8 @@ const UIStrings = {
|
|
|
38
38
|
diagnosticsGroupDescription: 'More information about the performance of your application. These numbers don\'t [directly affect](https://developer.chrome.com/docs/lighthouse/performance/performance-scoring/) the Performance score.',
|
|
39
39
|
/** Title of the Accessibility category of audits. This section contains audits focused on making web content accessible to all users. Also used as a label of a score gauge; try to limit to 20 characters. */
|
|
40
40
|
a11yCategoryTitle: 'Accessibility',
|
|
41
|
-
/** Description of the Accessibility category. This is displayed at the top of a list of audits focused on making web content accessible to all users. No character length limits. 'improve the accessibility of your web app'
|
|
42
|
-
a11yCategoryDescription: 'These checks highlight opportunities to [improve the accessibility of your web app](https://developer.chrome.com/docs/lighthouse/accessibility/).
|
|
41
|
+
/** Description of the Accessibility category. This is displayed at the top of a list of audits focused on making web content accessible to all users. No character length limits. 'improve the accessibility of your web app' and 'manual testing' become link texts to additional documentation. */
|
|
42
|
+
a11yCategoryDescription: 'These checks highlight opportunities to [improve the accessibility of your web app](https://developer.chrome.com/docs/lighthouse/accessibility/). Automatic detection can only detect a subset of issues and does not guarantee the accessibility of your web app, so [manual testing](https://web.dev/how-to-review/) is also encouraged.',
|
|
43
43
|
/** Description of the Accessibility manual checks category. This description is displayed above a list of accessibility audits that currently have no automated test and so must be verified manually by the user. No character length limits. 'conducting an accessibility review' becomes link text to additional documentation. */
|
|
44
44
|
a11yCategoryManualDescription: 'These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://web.dev/how-to-review/).',
|
|
45
45
|
/** Title of the best practices section of the Accessibility category. Within this section are audits with descriptive titles that highlight common accessibility best practices. */
|
|
@@ -176,7 +176,6 @@ const defaultConfig = {
|
|
|
176
176
|
],
|
|
177
177
|
audits: [
|
|
178
178
|
'is-on-https',
|
|
179
|
-
'service-worker',
|
|
180
179
|
'viewport',
|
|
181
180
|
'metrics/first-contentful-paint',
|
|
182
181
|
'metrics/largest-contentful-paint',
|
|
@@ -187,7 +186,7 @@ const defaultConfig = {
|
|
|
187
186
|
'metrics/total-blocking-time',
|
|
188
187
|
'metrics/max-potential-fid',
|
|
189
188
|
'metrics/cumulative-layout-shift',
|
|
190
|
-
'metrics/
|
|
189
|
+
'metrics/interaction-to-next-paint',
|
|
191
190
|
'errors-in-console',
|
|
192
191
|
'server-response-time',
|
|
193
192
|
'metrics/interactive',
|
|
@@ -216,7 +215,6 @@ const defaultConfig = {
|
|
|
216
215
|
'metrics',
|
|
217
216
|
'performance-budget',
|
|
218
217
|
'timing-budget',
|
|
219
|
-
'resource-summary',
|
|
220
218
|
'third-party-summary',
|
|
221
219
|
'third-party-facades',
|
|
222
220
|
'largest-contentful-paint-element',
|
|
@@ -235,6 +233,7 @@ const defaultConfig = {
|
|
|
235
233
|
'manual/pwa-each-page-has-url',
|
|
236
234
|
'accessibility/accesskeys',
|
|
237
235
|
'accessibility/aria-allowed-attr',
|
|
236
|
+
'accessibility/aria-allowed-role',
|
|
238
237
|
'accessibility/aria-command-name',
|
|
239
238
|
'accessibility/aria-dialog-name',
|
|
240
239
|
'accessibility/aria-hidden-body',
|
|
@@ -269,8 +268,10 @@ const defaultConfig = {
|
|
|
269
268
|
'accessibility/html-xml-lang-mismatch',
|
|
270
269
|
'accessibility/identical-links-same-purpose',
|
|
271
270
|
'accessibility/image-alt',
|
|
271
|
+
'accessibility/image-redundant-alt',
|
|
272
272
|
'accessibility/input-button-name',
|
|
273
273
|
'accessibility/input-image-alt',
|
|
274
|
+
'accessibility/label-content-name-mismatch',
|
|
274
275
|
'accessibility/label',
|
|
275
276
|
'accessibility/landmark-one-main',
|
|
276
277
|
'accessibility/link-name',
|
|
@@ -281,7 +282,9 @@ const defaultConfig = {
|
|
|
281
282
|
'accessibility/meta-viewport',
|
|
282
283
|
'accessibility/object-alt',
|
|
283
284
|
'accessibility/select-name',
|
|
285
|
+
'accessibility/skip-link',
|
|
284
286
|
'accessibility/tabindex',
|
|
287
|
+
'accessibility/table-duplicate-name',
|
|
285
288
|
'accessibility/table-fake-caption',
|
|
286
289
|
'accessibility/target-size',
|
|
287
290
|
'accessibility/td-has-header',
|
|
@@ -432,7 +435,7 @@ const defaultConfig = {
|
|
|
432
435
|
{id: 'total-blocking-time', weight: 30, group: 'metrics', acronym: 'TBT', relevantAudits: metricsToAudits.tbtRelevantAudits},
|
|
433
436
|
{id: 'cumulative-layout-shift', weight: 25, group: 'metrics', acronym: 'CLS', relevantAudits: metricsToAudits.clsRelevantAudits},
|
|
434
437
|
{id: 'speed-index', weight: 10, group: 'metrics', acronym: 'SI'},
|
|
435
|
-
{id: '
|
|
438
|
+
{id: 'interaction-to-next-paint', weight: 0, group: 'metrics', acronym: 'INP', relevantAudits: metricsToAudits.inpRelevantAudits},
|
|
436
439
|
|
|
437
440
|
// These are our "invisible" metrics. Not displayed, but still in the LHR.
|
|
438
441
|
{id: 'interactive', weight: 0, group: 'hidden', acronym: 'TTI'},
|
|
@@ -467,7 +470,6 @@ const defaultConfig = {
|
|
|
467
470
|
{id: 'bootup-time', weight: 0},
|
|
468
471
|
{id: 'mainthread-work-breakdown', weight: 0},
|
|
469
472
|
{id: 'font-display', weight: 0},
|
|
470
|
-
{id: 'resource-summary', weight: 0},
|
|
471
473
|
{id: 'third-party-summary', weight: 0},
|
|
472
474
|
{id: 'third-party-facades', weight: 0},
|
|
473
475
|
{id: 'largest-contentful-paint-element', weight: 0},
|
|
@@ -506,72 +508,77 @@ const defaultConfig = {
|
|
|
506
508
|
supportedModes: ['navigation', 'snapshot'],
|
|
507
509
|
// Audit weights are meant to match the aXe scoring system of
|
|
508
510
|
// minor, moderate, serious, and critical.
|
|
509
|
-
// See the audits listed at dequeuniversity.com/rules/axe/4.
|
|
511
|
+
// See the audits listed at dequeuniversity.com/rules/axe/4.7.
|
|
510
512
|
// Click on an audit and check the right hand column to see its severity.
|
|
511
513
|
auditRefs: [
|
|
512
|
-
{id: 'accesskeys', weight:
|
|
514
|
+
{id: 'accesskeys', weight: 7, group: 'a11y-navigation'},
|
|
513
515
|
{id: 'aria-allowed-attr', weight: 10, group: 'a11y-aria'},
|
|
514
|
-
{id: 'aria-
|
|
515
|
-
{id: 'aria-
|
|
516
|
+
{id: 'aria-allowed-role', weight: 1, group: 'a11y-aria'},
|
|
517
|
+
{id: 'aria-command-name', weight: 7, group: 'a11y-aria'},
|
|
518
|
+
{id: 'aria-dialog-name', weight: 7, group: 'a11y-aria'},
|
|
516
519
|
{id: 'aria-hidden-body', weight: 10, group: 'a11y-aria'},
|
|
517
|
-
{id: 'aria-hidden-focus', weight:
|
|
518
|
-
{id: 'aria-input-field-name', weight:
|
|
519
|
-
{id: 'aria-meter-name', weight:
|
|
520
|
-
{id: 'aria-progressbar-name', weight:
|
|
520
|
+
{id: 'aria-hidden-focus', weight: 7, group: 'a11y-aria'},
|
|
521
|
+
{id: 'aria-input-field-name', weight: 7, group: 'a11y-aria'},
|
|
522
|
+
{id: 'aria-meter-name', weight: 7, group: 'a11y-aria'},
|
|
523
|
+
{id: 'aria-progressbar-name', weight: 7, group: 'a11y-aria'},
|
|
521
524
|
{id: 'aria-required-attr', weight: 10, group: 'a11y-aria'},
|
|
522
525
|
{id: 'aria-required-children', weight: 10, group: 'a11y-aria'},
|
|
523
526
|
{id: 'aria-required-parent', weight: 10, group: 'a11y-aria'},
|
|
524
|
-
{id: 'aria-roles', weight:
|
|
525
|
-
{id: 'aria-text', weight:
|
|
526
|
-
{id: 'aria-toggle-field-name', weight:
|
|
527
|
-
{id: 'aria-tooltip-name', weight:
|
|
528
|
-
{id: 'aria-treeitem-name', weight:
|
|
527
|
+
{id: 'aria-roles', weight: 7, group: 'a11y-aria'},
|
|
528
|
+
{id: 'aria-text', weight: 7, group: 'a11y-aria'},
|
|
529
|
+
{id: 'aria-toggle-field-name', weight: 7, group: 'a11y-aria'},
|
|
530
|
+
{id: 'aria-tooltip-name', weight: 7, group: 'a11y-aria'},
|
|
531
|
+
{id: 'aria-treeitem-name', weight: 7, group: 'a11y-aria'},
|
|
529
532
|
{id: 'aria-valid-attr-value', weight: 10, group: 'a11y-aria'},
|
|
530
533
|
{id: 'aria-valid-attr', weight: 10, group: 'a11y-aria'},
|
|
531
534
|
{id: 'button-name', weight: 10, group: 'a11y-names-labels'},
|
|
532
|
-
{id: 'bypass', weight:
|
|
533
|
-
{id: 'color-contrast', weight:
|
|
534
|
-
{id: 'definition-list', weight:
|
|
535
|
-
{id: 'dlitem', weight:
|
|
536
|
-
{id: 'document-title', weight:
|
|
537
|
-
{id: 'duplicate-id-active', weight:
|
|
535
|
+
{id: 'bypass', weight: 7, group: 'a11y-navigation'},
|
|
536
|
+
{id: 'color-contrast', weight: 7, group: 'a11y-color-contrast'},
|
|
537
|
+
{id: 'definition-list', weight: 7, group: 'a11y-tables-lists'},
|
|
538
|
+
{id: 'dlitem', weight: 7, group: 'a11y-tables-lists'},
|
|
539
|
+
{id: 'document-title', weight: 7, group: 'a11y-names-labels'},
|
|
540
|
+
{id: 'duplicate-id-active', weight: 7, group: 'a11y-navigation'},
|
|
538
541
|
{id: 'duplicate-id-aria', weight: 10, group: 'a11y-aria'},
|
|
539
|
-
{id: 'form-field-multiple-labels', weight:
|
|
540
|
-
{id: 'frame-title', weight:
|
|
541
|
-
{id: 'heading-order', weight:
|
|
542
|
-
{id: 'html-has-lang', weight:
|
|
543
|
-
{id: 'html-lang-valid', weight:
|
|
544
|
-
{id: 'html-xml-lang-mismatch', weight:
|
|
542
|
+
{id: 'form-field-multiple-labels', weight: 3, group: 'a11y-names-labels'},
|
|
543
|
+
{id: 'frame-title', weight: 7, group: 'a11y-names-labels'},
|
|
544
|
+
{id: 'heading-order', weight: 3, group: 'a11y-navigation'},
|
|
545
|
+
{id: 'html-has-lang', weight: 7, group: 'a11y-language'},
|
|
546
|
+
{id: 'html-lang-valid', weight: 7, group: 'a11y-language'},
|
|
547
|
+
{id: 'html-xml-lang-mismatch', weight: 3, group: 'a11y-language'},
|
|
545
548
|
{id: 'image-alt', weight: 10, group: 'a11y-names-labels'},
|
|
549
|
+
{id: 'image-redundant-alt', weight: 1, group: 'a11y-names-labels'},
|
|
546
550
|
{id: 'input-button-name', weight: 10, group: 'a11y-names-labels'},
|
|
547
551
|
{id: 'input-image-alt', weight: 10, group: 'a11y-names-labels'},
|
|
548
|
-
{id: 'label', weight:
|
|
549
|
-
{id: '
|
|
550
|
-
{id: 'link-
|
|
551
|
-
{id: '
|
|
552
|
-
{id: '
|
|
552
|
+
{id: 'label-content-name-mismatch', weight: 7, group: 'a11y-names-labels'},
|
|
553
|
+
{id: 'label', weight: 7, group: 'a11y-names-labels'},
|
|
554
|
+
{id: 'link-in-text-block', weight: 7, group: 'a11y-color-contrast'},
|
|
555
|
+
{id: 'link-name', weight: 7, group: 'a11y-names-labels'},
|
|
556
|
+
{id: 'list', weight: 7, group: 'a11y-tables-lists'},
|
|
557
|
+
{id: 'listitem', weight: 7, group: 'a11y-tables-lists'},
|
|
553
558
|
{id: 'meta-refresh', weight: 10, group: 'a11y-best-practices'},
|
|
554
559
|
{id: 'meta-viewport', weight: 10, group: 'a11y-best-practices'},
|
|
555
|
-
{id: 'object-alt', weight:
|
|
556
|
-
{id: 'select-name', weight:
|
|
557
|
-
{id: '
|
|
558
|
-
{id: '
|
|
560
|
+
{id: 'object-alt', weight: 7, group: 'a11y-names-labels'},
|
|
561
|
+
{id: 'select-name', weight: 7, group: 'a11y-names-labels'},
|
|
562
|
+
{id: 'skip-link', weight: 3, group: 'a11y-names-labels'},
|
|
563
|
+
{id: 'tabindex', weight: 7, group: 'a11y-navigation'},
|
|
564
|
+
{id: 'table-duplicate-name', weight: 1, group: 'a11y-tables-lists'},
|
|
565
|
+
{id: 'table-fake-caption', weight: 7, group: 'a11y-tables-lists'},
|
|
559
566
|
{id: 'td-has-header', weight: 10, group: 'a11y-tables-lists'},
|
|
560
|
-
{id: 'td-headers-attr', weight:
|
|
561
|
-
{id: 'th-has-data-cells', weight:
|
|
562
|
-
{id: 'valid-lang', weight:
|
|
567
|
+
{id: 'td-headers-attr', weight: 7, group: 'a11y-tables-lists'},
|
|
568
|
+
{id: 'th-has-data-cells', weight: 7, group: 'a11y-tables-lists'},
|
|
569
|
+
{id: 'valid-lang', weight: 7, group: 'a11y-language'},
|
|
563
570
|
{id: 'video-caption', weight: 10, group: 'a11y-audio-video'},
|
|
564
571
|
// Manual audits
|
|
565
|
-
{id: 'logical-tab-order', weight: 0},
|
|
566
572
|
{id: 'focusable-controls', weight: 0},
|
|
567
573
|
{id: 'interactive-element-affordance', weight: 0},
|
|
568
|
-
{id: '
|
|
574
|
+
{id: 'logical-tab-order', weight: 0},
|
|
575
|
+
{id: 'visual-order-follows-dom', weight: 0},
|
|
569
576
|
{id: 'focus-traps', weight: 0},
|
|
577
|
+
{id: 'managed-focus', weight: 0},
|
|
578
|
+
{id: 'use-landmarks', weight: 0},
|
|
579
|
+
{id: 'offscreen-content-hidden', weight: 0},
|
|
570
580
|
{id: 'custom-controls-labels', weight: 0},
|
|
571
581
|
{id: 'custom-controls-roles', weight: 0},
|
|
572
|
-
{id: 'visual-order-follows-dom', weight: 0},
|
|
573
|
-
{id: 'offscreen-content-hidden', weight: 0},
|
|
574
|
-
{id: 'use-landmarks', weight: 0},
|
|
575
582
|
// Hidden audits
|
|
576
583
|
{id: 'empty-heading', weight: 0, group: 'hidden'},
|
|
577
584
|
{id: 'identical-links-same-purpose', weight: 0, group: 'hidden'},
|
|
@@ -584,12 +591,12 @@ const defaultConfig = {
|
|
|
584
591
|
supportedModes: ['navigation', 'timespan', 'snapshot'],
|
|
585
592
|
auditRefs: [
|
|
586
593
|
// Trust & Safety
|
|
587
|
-
{id: 'is-on-https', weight:
|
|
594
|
+
{id: 'is-on-https', weight: 5, group: 'best-practices-trust-safety'},
|
|
588
595
|
{id: 'geolocation-on-start', weight: 1, group: 'best-practices-trust-safety'},
|
|
589
596
|
{id: 'notification-on-start', weight: 1, group: 'best-practices-trust-safety'},
|
|
590
597
|
{id: 'csp-xss', weight: 0, group: 'best-practices-trust-safety'},
|
|
591
598
|
// User Experience
|
|
592
|
-
{id: 'paste-preventing-inputs', weight:
|
|
599
|
+
{id: 'paste-preventing-inputs', weight: 3, group: 'best-practices-ux'},
|
|
593
600
|
{id: 'image-aspect-ratio', weight: 1, group: 'best-practices-ux'},
|
|
594
601
|
{id: 'image-size-responsive', weight: 1, group: 'best-practices-ux'},
|
|
595
602
|
{id: 'preload-fonts', weight: 1, group: 'best-practices-ux'},
|
|
@@ -599,7 +606,7 @@ const defaultConfig = {
|
|
|
599
606
|
// General Group
|
|
600
607
|
{id: 'no-unload-listeners', weight: 1, group: 'best-practices-general'},
|
|
601
608
|
{id: 'js-libraries', weight: 0, group: 'best-practices-general'},
|
|
602
|
-
{id: 'deprecations', weight:
|
|
609
|
+
{id: 'deprecations', weight: 5, group: 'best-practices-general'},
|
|
603
610
|
{id: 'errors-in-console', weight: 1, group: 'best-practices-general'},
|
|
604
611
|
{id: 'valid-source-maps', weight: 0, group: 'best-practices-general'},
|
|
605
612
|
{id: 'inspector-issues', weight: 1, group: 'best-practices-general'},
|
|
@@ -638,7 +645,6 @@ const defaultConfig = {
|
|
|
638
645
|
// Installable
|
|
639
646
|
{id: 'installable-manifest', weight: 2, group: 'pwa-installable'},
|
|
640
647
|
// PWA Optimized
|
|
641
|
-
{id: 'service-worker', weight: 1, group: 'pwa-optimized'},
|
|
642
648
|
{id: 'splash-screen', weight: 1, group: 'pwa-optimized'},
|
|
643
649
|
{id: 'themed-omnibox', weight: 1, group: 'pwa-optimized'},
|
|
644
650
|
{id: 'content-width', weight: 1, group: 'pwa-optimized'},
|
package/core/config/filters.js
CHANGED
|
@@ -8,7 +8,7 @@ import log from 'lighthouse-logger';
|
|
|
8
8
|
|
|
9
9
|
import {Audit} from '../audits/audit.js';
|
|
10
10
|
|
|
11
|
-
/** @type {Record<keyof LH.
|
|
11
|
+
/** @type {Record<keyof LH.BaseArtifacts, string>} */
|
|
12
12
|
const baseArtifactKeySource = {
|
|
13
13
|
fetchTime: '',
|
|
14
14
|
LighthouseRunWarnings: '',
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {LH.Config.GathererDefn | LH.Config.AnyFRGathererDefn} gathererDefn
|
|
3
|
-
* @return {gathererDefn is LH.Config.AnyFRGathererDefn}
|
|
4
|
-
*/
|
|
5
|
-
export function isFRGathererDefn(gathererDefn: LH.Config.GathererDefn | LH.Config.AnyFRGathererDefn): gathererDefn is import("../../types/config.js").default.AnyFRGathererDefn;
|
|
6
1
|
/**
|
|
7
2
|
* Determines if the artifact dependency direction is valid. The dependency's minimum supported mode
|
|
8
3
|
* must be less than or equal to the dependent's.
|
|
9
4
|
*
|
|
10
|
-
* @param {LH.Config.
|
|
11
|
-
* @param {LH.Config.
|
|
5
|
+
* @param {LH.Config.AnyGathererDefn} dependent The artifact that depends on the other.
|
|
6
|
+
* @param {LH.Config.AnyGathererDefn} dependency The artifact that is being depended on by the other.
|
|
12
7
|
* @return {boolean}
|
|
13
8
|
*/
|
|
14
|
-
export function isValidArtifactDependency(dependent: LH.Config.
|
|
9
|
+
export function isValidArtifactDependency(dependent: LH.Config.AnyGathererDefn, dependency: LH.Config.AnyGathererDefn): boolean;
|
|
15
10
|
/**
|
|
16
11
|
* Throws if pluginName is invalid or (somehow) collides with a category in the
|
|
17
12
|
* config being added to.
|
|
@@ -20,16 +15,16 @@ export function isValidArtifactDependency(dependent: LH.Config.AnyFRGathererDefn
|
|
|
20
15
|
*/
|
|
21
16
|
export function assertValidPluginName(config: LH.Config, pluginName: string): void;
|
|
22
17
|
/**
|
|
23
|
-
* Throws an error if the provided object does not implement the required
|
|
24
|
-
* @param {LH.Config.
|
|
18
|
+
* Throws an error if the provided object does not implement the required gatherer interface.
|
|
19
|
+
* @param {LH.Config.AnyArtifactDefn} artifactDefn
|
|
25
20
|
*/
|
|
26
|
-
export function
|
|
21
|
+
export function assertValidArtifact(artifactDefn: LH.Config.AnyArtifactDefn): void;
|
|
27
22
|
/**
|
|
28
23
|
* Throws an error if the provided object does not implement the required navigations interface.
|
|
29
24
|
* @param {LH.Config.ResolvedConfig['navigations']} navigationsDefn
|
|
30
25
|
* @return {{warnings: string[]}}
|
|
31
26
|
*/
|
|
32
|
-
export function
|
|
27
|
+
export function assertValidNavigations(navigationsDefn: LH.Config.ResolvedConfig['navigations']): {
|
|
33
28
|
warnings: string[];
|
|
34
29
|
};
|
|
35
30
|
/**
|
|
@@ -5,23 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Audit} from '../audits/audit.js';
|
|
8
|
-
import
|
|
8
|
+
import BaseGatherer from '../gather/base-gatherer.js';
|
|
9
9
|
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* @param {LH.Config.GathererDefn | LH.Config.AnyFRGathererDefn} gathererDefn
|
|
13
|
-
* @return {gathererDefn is LH.Config.AnyFRGathererDefn}
|
|
14
|
-
*/
|
|
15
|
-
function isFRGathererDefn(gathererDefn) {
|
|
16
|
-
return 'meta' in gathererDefn.instance;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
11
|
/**
|
|
20
12
|
* Determines if the artifact dependency direction is valid. The dependency's minimum supported mode
|
|
21
13
|
* must be less than or equal to the dependent's.
|
|
22
14
|
*
|
|
23
|
-
* @param {LH.Config.
|
|
24
|
-
* @param {LH.Config.
|
|
15
|
+
* @param {LH.Config.AnyGathererDefn} dependent The artifact that depends on the other.
|
|
16
|
+
* @param {LH.Config.AnyGathererDefn} dependency The artifact that is being depended on by the other.
|
|
25
17
|
* @return {boolean}
|
|
26
18
|
*/
|
|
27
19
|
function isValidArtifactDependency(dependent, dependency) {
|
|
@@ -54,26 +46,25 @@ function assertValidPluginName(config, pluginName) {
|
|
|
54
46
|
}
|
|
55
47
|
|
|
56
48
|
/**
|
|
57
|
-
* Throws an error if the provided object does not implement the required
|
|
58
|
-
* @param {LH.Config.
|
|
49
|
+
* Throws an error if the provided object does not implement the required gatherer interface.
|
|
50
|
+
* @param {LH.Config.AnyArtifactDefn} artifactDefn
|
|
59
51
|
*/
|
|
60
|
-
function
|
|
61
|
-
const gatherer =
|
|
62
|
-
const gathererName = gatherer.name;
|
|
52
|
+
function assertValidArtifact(artifactDefn) {
|
|
53
|
+
const gatherer = artifactDefn.gatherer.instance;
|
|
63
54
|
|
|
64
55
|
if (typeof gatherer.meta !== 'object') {
|
|
65
|
-
throw new Error(
|
|
56
|
+
throw new Error(`Gatherer for ${artifactDefn.id} did not provide a meta object.`);
|
|
66
57
|
}
|
|
67
58
|
|
|
68
59
|
if (gatherer.meta.supportedModes.length === 0) {
|
|
69
|
-
throw new Error(
|
|
60
|
+
throw new Error(`Gatherer for ${artifactDefn.id} did not support any gather modes.`);
|
|
70
61
|
}
|
|
71
62
|
|
|
72
63
|
if (
|
|
73
64
|
typeof gatherer.getArtifact !== 'function' ||
|
|
74
|
-
gatherer.getArtifact ===
|
|
65
|
+
gatherer.getArtifact === BaseGatherer.prototype.getArtifact
|
|
75
66
|
) {
|
|
76
|
-
throw new Error(
|
|
67
|
+
throw new Error(`Gatherer for ${artifactDefn.id} did not define a "getArtifact" method.`);
|
|
77
68
|
}
|
|
78
69
|
}
|
|
79
70
|
|
|
@@ -82,7 +73,7 @@ function assertValidFRGatherer(gathererDefn) {
|
|
|
82
73
|
* @param {LH.Config.ResolvedConfig['navigations']} navigationsDefn
|
|
83
74
|
* @return {{warnings: string[]}}
|
|
84
75
|
*/
|
|
85
|
-
function
|
|
76
|
+
function assertValidNavigations(navigationsDefn) {
|
|
86
77
|
if (!navigationsDefn || !navigationsDefn.length) return {warnings: []};
|
|
87
78
|
|
|
88
79
|
/** @type {string[]} */
|
|
@@ -257,7 +248,7 @@ function assertArtifactTopologicalOrder(navigations) {
|
|
|
257
248
|
* @return {{warnings: string[]}}
|
|
258
249
|
*/
|
|
259
250
|
function assertValidConfig(resolvedConfig) {
|
|
260
|
-
const {warnings} =
|
|
251
|
+
const {warnings} = assertValidNavigations(resolvedConfig.navigations);
|
|
261
252
|
|
|
262
253
|
/** @type {Set<string>} */
|
|
263
254
|
const artifactIds = new Set();
|
|
@@ -266,7 +257,7 @@ function assertValidConfig(resolvedConfig) {
|
|
|
266
257
|
throw new Error(`Config defined multiple artifacts with id '${artifactDefn.id}'`);
|
|
267
258
|
}
|
|
268
259
|
artifactIds.add(artifactDefn.id);
|
|
269
|
-
|
|
260
|
+
assertValidArtifact(artifactDefn);
|
|
270
261
|
}
|
|
271
262
|
|
|
272
263
|
for (const auditDefn of resolvedConfig.audits || []) {
|
|
@@ -309,11 +300,10 @@ function throwInvalidArtifactDependency(artifactId, dependencyKey) {
|
|
|
309
300
|
}
|
|
310
301
|
|
|
311
302
|
export {
|
|
312
|
-
isFRGathererDefn,
|
|
313
303
|
isValidArtifactDependency,
|
|
314
304
|
assertValidPluginName,
|
|
315
|
-
|
|
316
|
-
|
|
305
|
+
assertValidArtifact,
|
|
306
|
+
assertValidNavigations,
|
|
317
307
|
assertValidAudit,
|
|
318
308
|
assertValidCategories,
|
|
319
309
|
assertValidSettings,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {LH.Config.ResolvedConfig} resolvedConfig
|
|
3
|
-
* @param {LH.Gatherer.
|
|
3
|
+
* @param {LH.Gatherer.Driver} driver
|
|
4
4
|
* @param {{gatherMode: LH.Gatherer.GatherMode}} context
|
|
5
5
|
* @return {Promise<LH.BaseArtifacts>}
|
|
6
6
|
*/
|
|
7
|
-
export function getBaseArtifacts(resolvedConfig: LH.Config.ResolvedConfig, driver: LH.Gatherer.
|
|
7
|
+
export function getBaseArtifacts(resolvedConfig: LH.Config.ResolvedConfig, driver: LH.Gatherer.Driver, context: {
|
|
8
8
|
gatherMode: LH.Gatherer.GatherMode;
|
|
9
9
|
}): Promise<LH.BaseArtifacts>;
|
|
10
10
|
/**
|
|
11
|
-
* @param {LH.
|
|
11
|
+
* @param {LH.BaseArtifacts} baseArtifacts
|
|
12
12
|
* @param {Partial<LH.Artifacts>} gathererArtifacts
|
|
13
13
|
* @return {LH.Artifacts}
|
|
14
14
|
*/
|
|
15
|
-
export function finalizeArtifacts(baseArtifacts: LH.
|
|
15
|
+
export function finalizeArtifacts(baseArtifacts: LH.BaseArtifacts, gathererArtifacts: Partial<LH.Artifacts>): LH.Artifacts;
|
|
16
16
|
//# sourceMappingURL=base-artifacts.d.ts.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @param {LH.Config.ResolvedConfig} resolvedConfig
|
|
16
|
-
* @param {LH.Gatherer.
|
|
16
|
+
* @param {LH.Gatherer.Driver} driver
|
|
17
17
|
* @param {{gatherMode: LH.Gatherer.GatherMode}} context
|
|
18
18
|
* @return {Promise<LH.BaseArtifacts>}
|
|
19
19
|
*/
|
|
@@ -38,10 +38,6 @@ async function getBaseArtifacts(resolvedConfig, driver, context) {
|
|
|
38
38
|
},
|
|
39
39
|
PageLoadError: null,
|
|
40
40
|
GatherContext: context,
|
|
41
|
-
// Artifacts that have been replaced by regular gatherers in Fraggle Rock.
|
|
42
|
-
NetworkUserAgent: '',
|
|
43
|
-
traces: {},
|
|
44
|
-
devtoolsLogs: {},
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
43
|
|
|
@@ -63,7 +59,7 @@ function deduplicateWarnings(warnings) {
|
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
/**
|
|
66
|
-
* @param {LH.
|
|
62
|
+
* @param {LH.BaseArtifacts} baseArtifacts
|
|
67
63
|
* @param {Partial<LH.Artifacts>} gathererArtifacts
|
|
68
64
|
* @return {LH.Artifacts}
|
|
69
65
|
*/
|