lighthouse 11.7.0-dev.20240408 → 11.7.0-dev.20240410
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/cli/cli-flags.js +3 -3
- package/cli/test/smokehouse/config/exclusions.js +1 -0
- package/cli/test/smokehouse/core-tests.js +4 -16
- package/cli/test/smokehouse/frontends/smokehouse-bin.js +2 -2
- package/core/audits/redirects-http.d.ts +19 -0
- package/core/audits/redirects-http.js +75 -0
- package/core/config/default-config.js +10 -52
- package/core/gather/driver/target-manager.js +1 -1
- package/core/gather/driver/wait-for-condition.js +2 -3
- package/core/gather/driver.js +1 -0
- package/core/gather/session.d.ts +8 -0
- package/core/gather/session.js +12 -0
- package/core/lib/lantern/network-node.js +28 -4
- package/core/runner.js +18 -23
- package/dist/report/bundle.esm.js +11 -95
- package/dist/report/flow.js +16 -100
- package/dist/report/standalone.js +12 -96
- package/flow-report/src/help-dialog.tsx +0 -1
- package/flow-report/src/i18n/i18n.d.ts +0 -4
- package/flow-report/src/i18n/ui-strings.d.ts +0 -1
- package/flow-report/src/i18n/ui-strings.js +0 -2
- package/package.json +1 -1
- package/readme.md +2 -2
- package/report/assets/styles.css +1 -43
- package/report/assets/templates.html +0 -95
- package/report/renderer/components.d.ts +2 -2
- package/report/renderer/components.js +2 -103
- package/report/renderer/report-renderer.js +2 -12
- package/report/renderer/report-ui-features.js +1 -1
- package/report/renderer/report-utils.d.ts +0 -1
- package/report/renderer/report-utils.js +0 -3
- package/shared/localization/locales/ar-XB.json +0 -174
- package/shared/localization/locales/ar.json +0 -174
- package/shared/localization/locales/bg.json +0 -174
- package/shared/localization/locales/ca.json +0 -174
- package/shared/localization/locales/cs.json +0 -174
- package/shared/localization/locales/da.json +0 -174
- package/shared/localization/locales/de.json +0 -174
- package/shared/localization/locales/el.json +0 -174
- package/shared/localization/locales/en-GB.json +0 -174
- package/shared/localization/locales/en-US.json +9 -177
- package/shared/localization/locales/en-XA.json +0 -174
- package/shared/localization/locales/en-XL.json +9 -177
- package/shared/localization/locales/es-419.json +0 -174
- package/shared/localization/locales/es.json +0 -174
- package/shared/localization/locales/fi.json +0 -174
- package/shared/localization/locales/fil.json +0 -174
- package/shared/localization/locales/fr.json +0 -174
- package/shared/localization/locales/he.json +0 -174
- package/shared/localization/locales/hi.json +0 -174
- package/shared/localization/locales/hr.json +0 -174
- package/shared/localization/locales/hu.json +0 -174
- package/shared/localization/locales/id.json +0 -174
- package/shared/localization/locales/it.json +0 -174
- package/shared/localization/locales/ja.json +0 -174
- package/shared/localization/locales/ko.json +0 -174
- package/shared/localization/locales/lt.json +0 -174
- package/shared/localization/locales/lv.json +0 -174
- package/shared/localization/locales/nl.json +0 -174
- package/shared/localization/locales/no.json +0 -174
- package/shared/localization/locales/pl.json +0 -174
- package/shared/localization/locales/pt-PT.json +0 -174
- package/shared/localization/locales/pt.json +0 -174
- package/shared/localization/locales/ro.json +0 -174
- package/shared/localization/locales/ru.json +0 -174
- package/shared/localization/locales/sk.json +0 -174
- package/shared/localization/locales/sl.json +0 -174
- package/shared/localization/locales/sr-Latn.json +0 -174
- package/shared/localization/locales/sr.json +0 -174
- package/shared/localization/locales/sv.json +0 -174
- package/shared/localization/locales/ta.json +0 -174
- package/shared/localization/locales/te.json +0 -174
- package/shared/localization/locales/th.json +0 -174
- package/shared/localization/locales/tr.json +0 -174
- package/shared/localization/locales/uk.json +0 -174
- package/shared/localization/locales/vi.json +0 -174
- package/shared/localization/locales/zh-HK.json +0 -174
- package/shared/localization/locales/zh-TW.json +0 -174
- package/shared/localization/locales/zh.json +0 -174
- package/types/artifacts.d.ts +0 -27
- package/types/audit.d.ts +0 -10
- package/types/gatherer.d.ts +1 -0
- package/types/internal/smokehouse.d.ts +1 -1
- package/core/audits/content-width.d.ts +0 -17
- package/core/audits/content-width.js +0 -76
- package/core/audits/installable-manifest.d.ts +0 -111
- package/core/audits/installable-manifest.js +0 -248
- package/core/audits/manual/pwa-cross-browser.d.ts +0 -12
- package/core/audits/manual/pwa-cross-browser.js +0 -40
- package/core/audits/manual/pwa-each-page-has-url.d.ts +0 -12
- package/core/audits/manual/pwa-each-page-has-url.js +0 -38
- package/core/audits/manual/pwa-page-transitions.d.ts +0 -12
- package/core/audits/manual/pwa-page-transitions.js +0 -38
- package/core/audits/maskable-icon.d.ts +0 -25
- package/core/audits/maskable-icon.js +0 -70
- package/core/audits/multi-check-audit.d.ts +0 -28
- package/core/audits/multi-check-audit.js +0 -82
- package/core/audits/splash-screen.d.ts +0 -37
- package/core/audits/splash-screen.js +0 -98
- package/core/audits/themed-omnibox.d.ts +0 -42
- package/core/audits/themed-omnibox.js +0 -102
- package/core/computed/manifest-values.d.ts +0 -24
- package/core/computed/manifest-values.js +0 -136
- package/core/gather/gatherers/installability-errors.d.ts +0 -17
- package/core/gather/gatherers/installability-errors.js +0 -56
- package/core/gather/gatherers/web-app-manifest.d.ts +0 -32
- package/core/gather/gatherers/web-app-manifest.js +0 -106
- package/report/renderer/pwa-category-renderer.d.ts +0 -55
- package/report/renderer/pwa-category-renderer.js +0 -184
- package/third-party/chromium-synchronization/installability-errors-test.js +0 -79
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview Base class for boolean audits that can have multiple reasons for failure
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {Audit} from './audit.js';
|
|
12
|
-
|
|
13
|
-
class MultiCheckAudit extends Audit {
|
|
14
|
-
/**
|
|
15
|
-
* @param {LH.Artifacts} artifacts
|
|
16
|
-
* @param {LH.Audit.Context} context
|
|
17
|
-
* @return {Promise<LH.Audit.Product>}
|
|
18
|
-
*/
|
|
19
|
-
static async audit(artifacts, context) {
|
|
20
|
-
const multiProduct = await this.audit_(artifacts, context);
|
|
21
|
-
return this.createAuditProduct(multiProduct);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @param {{failures: Array<string>, manifestValues?: LH.Artifacts.ManifestValues}} result
|
|
26
|
-
* @return {LH.Audit.Product}
|
|
27
|
-
*/
|
|
28
|
-
static createAuditProduct(result) {
|
|
29
|
-
/** @type {LH.Audit.MultiCheckAuditDetails} */
|
|
30
|
-
const detailsItem = {
|
|
31
|
-
...result,
|
|
32
|
-
...result.manifestValues,
|
|
33
|
-
manifestValues: undefined,
|
|
34
|
-
allChecks: undefined,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
if (result.manifestValues?.allChecks) {
|
|
38
|
-
result.manifestValues.allChecks.forEach(check => {
|
|
39
|
-
detailsItem[check.id] = check.passing;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Include the detailed pass/fail checklist as a diagnostic.
|
|
44
|
-
/** @type {LH.Audit.Details.DebugData} */
|
|
45
|
-
const details = {
|
|
46
|
-
type: 'debugdata',
|
|
47
|
-
// TODO: Consider not nesting detailsItem under `items`.
|
|
48
|
-
items: [detailsItem],
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// If we fail, share the failures
|
|
52
|
-
if (result.failures.length > 0) {
|
|
53
|
-
return {
|
|
54
|
-
score: 0,
|
|
55
|
-
// TODO(#11495): make this i18n-able.
|
|
56
|
-
explanation: `Failures: ${result.failures.join(',\n')}.`,
|
|
57
|
-
details,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Otherwise, we pass
|
|
62
|
-
return {
|
|
63
|
-
score: 1,
|
|
64
|
-
details,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/* eslint-disable no-unused-vars */
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @param {LH.Artifacts} artifacts
|
|
72
|
-
* @param {LH.Audit.Context} context
|
|
73
|
-
* @return {Promise<{failures: Array<string>, manifestValues?: LH.Artifacts.ManifestValues}>}
|
|
74
|
-
*/
|
|
75
|
-
static audit_(artifacts, context) {
|
|
76
|
-
throw new Error('audit_ unimplemented');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/* eslint-enable no-unused-vars */
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default MultiCheckAudit;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export default SplashScreen;
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* Audits if a page is configured for a custom splash screen when launched
|
|
5
|
-
* https://github.com/GoogleChrome/lighthouse/issues/24
|
|
6
|
-
*
|
|
7
|
-
* Requirements:
|
|
8
|
-
* * manifest is not empty
|
|
9
|
-
* * manifest has a valid name
|
|
10
|
-
* * manifest has a valid background_color
|
|
11
|
-
* * manifest has a valid theme_color
|
|
12
|
-
* * manifest contains icon that's a png and size >= 512px
|
|
13
|
-
*/
|
|
14
|
-
declare class SplashScreen extends MultiCheckAudit {
|
|
15
|
-
/**
|
|
16
|
-
* @param {LH.Artifacts.ManifestValues} manifestValues
|
|
17
|
-
* @param {Array<string>} failures
|
|
18
|
-
*/
|
|
19
|
-
static assessManifest(manifestValues: LH.Artifacts.ManifestValues, failures: Array<string>): void;
|
|
20
|
-
/**
|
|
21
|
-
* @param {LH.Artifacts} artifacts
|
|
22
|
-
* @param {LH.Audit.Context} context
|
|
23
|
-
* @return {Promise<{failures: Array<string>, manifestValues: LH.Artifacts.ManifestValues}>}
|
|
24
|
-
*/
|
|
25
|
-
static audit_(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<{
|
|
26
|
-
failures: Array<string>;
|
|
27
|
-
manifestValues: LH.Artifacts.ManifestValues;
|
|
28
|
-
}>;
|
|
29
|
-
}
|
|
30
|
-
export namespace UIStrings {
|
|
31
|
-
const title: string;
|
|
32
|
-
const failureTitle: string;
|
|
33
|
-
const description: string;
|
|
34
|
-
}
|
|
35
|
-
import MultiCheckAudit from './multi-check-audit.js';
|
|
36
|
-
import { ManifestValues } from '../computed/manifest-values.js';
|
|
37
|
-
//# sourceMappingURL=splash-screen.d.ts.map
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import MultiCheckAudit from './multi-check-audit.js';
|
|
8
|
-
import {ManifestValues} from '../computed/manifest-values.js';
|
|
9
|
-
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
|
-
|
|
11
|
-
const UIStrings = {
|
|
12
|
-
/** Title of a Lighthouse audit that provides detail on splash screens. This descriptive title is shown to users when the site has a custom splash screen. */
|
|
13
|
-
title: 'Configured for a custom splash screen',
|
|
14
|
-
/** Title of a Lighthouse audit that provides detail on splash screens. This descriptive title is shown to users when the site does not have a custom splash screen. */
|
|
15
|
-
failureTitle: 'Is not configured for a custom splash screen',
|
|
16
|
-
/** Description of a Lighthouse audit that tells the user why they should configure a custom splash screen. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
17
|
-
description: 'A themed splash screen ensures a high-quality experience when ' +
|
|
18
|
-
'users launch your app from their homescreens. ' +
|
|
19
|
-
'[Learn more about splash screens](https://developer.chrome.com/docs/lighthouse/pwa/splash-screen/).',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @fileoverview
|
|
26
|
-
* Audits if a page is configured for a custom splash screen when launched
|
|
27
|
-
* https://github.com/GoogleChrome/lighthouse/issues/24
|
|
28
|
-
*
|
|
29
|
-
* Requirements:
|
|
30
|
-
* * manifest is not empty
|
|
31
|
-
* * manifest has a valid name
|
|
32
|
-
* * manifest has a valid background_color
|
|
33
|
-
* * manifest has a valid theme_color
|
|
34
|
-
* * manifest contains icon that's a png and size >= 512px
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
class SplashScreen extends MultiCheckAudit {
|
|
38
|
-
/**
|
|
39
|
-
* @return {LH.Audit.Meta}
|
|
40
|
-
*/
|
|
41
|
-
static get meta() {
|
|
42
|
-
return {
|
|
43
|
-
id: 'splash-screen',
|
|
44
|
-
title: str_(UIStrings.title),
|
|
45
|
-
failureTitle: str_(UIStrings.failureTitle),
|
|
46
|
-
description: str_(UIStrings.description),
|
|
47
|
-
supportedModes: ['navigation'],
|
|
48
|
-
requiredArtifacts: ['WebAppManifest', 'InstallabilityErrors'],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @param {LH.Artifacts.ManifestValues} manifestValues
|
|
54
|
-
* @param {Array<string>} failures
|
|
55
|
-
*/
|
|
56
|
-
static assessManifest(manifestValues, failures) {
|
|
57
|
-
if (manifestValues.isParseFailure && manifestValues.parseFailureReason) {
|
|
58
|
-
failures.push(manifestValues.parseFailureReason);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const splashScreenCheckIds = [
|
|
63
|
-
'hasName',
|
|
64
|
-
'hasBackgroundColor',
|
|
65
|
-
'hasThemeColor',
|
|
66
|
-
'hasIconsAtLeast512px',
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
manifestValues.allChecks
|
|
70
|
-
.filter(item => splashScreenCheckIds.includes(item.id))
|
|
71
|
-
.forEach(item => {
|
|
72
|
-
if (!item.passing) {
|
|
73
|
-
failures.push(item.failureText);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @param {LH.Artifacts} artifacts
|
|
80
|
-
* @param {LH.Audit.Context} context
|
|
81
|
-
* @return {Promise<{failures: Array<string>, manifestValues: LH.Artifacts.ManifestValues}>}
|
|
82
|
-
*/
|
|
83
|
-
static async audit_(artifacts, context) {
|
|
84
|
-
/** @type {Array<string>} */
|
|
85
|
-
const failures = [];
|
|
86
|
-
|
|
87
|
-
const manifestValues = await ManifestValues.request(artifacts, context);
|
|
88
|
-
SplashScreen.assessManifest(manifestValues, failures);
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
failures,
|
|
92
|
-
manifestValues,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default SplashScreen;
|
|
98
|
-
export {UIStrings};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export default ThemedOmnibox;
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* Audits if a page is configured for a themed address bar
|
|
5
|
-
*
|
|
6
|
-
* Requirements:
|
|
7
|
-
* * manifest is not empty
|
|
8
|
-
* * manifest has a theme_color
|
|
9
|
-
* * HTML has a theme-color meta
|
|
10
|
-
*
|
|
11
|
-
* Color validity is explicitly not checked.
|
|
12
|
-
*/
|
|
13
|
-
declare class ThemedOmnibox extends MultiCheckAudit {
|
|
14
|
-
/**
|
|
15
|
-
* @param {LH.Artifacts.MetaElement|undefined} themeColorMeta
|
|
16
|
-
* @param {Array<string>} failures
|
|
17
|
-
*/
|
|
18
|
-
static assessMetaThemecolor(themeColorMeta: LH.Artifacts.MetaElement | undefined, failures: Array<string>): void;
|
|
19
|
-
/**
|
|
20
|
-
* @param {LH.Artifacts.ManifestValues} manifestValues
|
|
21
|
-
* @param {Array<string>} failures
|
|
22
|
-
*/
|
|
23
|
-
static assessManifest(manifestValues: LH.Artifacts.ManifestValues, failures: Array<string>): void;
|
|
24
|
-
/**
|
|
25
|
-
* @param {LH.Artifacts} artifacts
|
|
26
|
-
* @param {LH.Audit.Context} context
|
|
27
|
-
* @return {Promise<{failures: Array<string>, manifestValues: LH.Artifacts.ManifestValues, themeColor: ?string}>}
|
|
28
|
-
*/
|
|
29
|
-
static audit_(artifacts: LH.Artifacts, context: LH.Audit.Context): Promise<{
|
|
30
|
-
failures: Array<string>;
|
|
31
|
-
manifestValues: LH.Artifacts.ManifestValues;
|
|
32
|
-
themeColor: string | null;
|
|
33
|
-
}>;
|
|
34
|
-
}
|
|
35
|
-
export namespace UIStrings {
|
|
36
|
-
const title: string;
|
|
37
|
-
const failureTitle: string;
|
|
38
|
-
const description: string;
|
|
39
|
-
}
|
|
40
|
-
import MultiCheckAudit from './multi-check-audit.js';
|
|
41
|
-
import { ManifestValues } from '../computed/manifest-values.js';
|
|
42
|
-
//# sourceMappingURL=themed-omnibox.d.ts.map
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import MultiCheckAudit from './multi-check-audit.js';
|
|
8
|
-
import {ManifestValues} from '../computed/manifest-values.js';
|
|
9
|
-
import * as i18n from '../lib/i18n/i18n.js';
|
|
10
|
-
|
|
11
|
-
const UIStrings = {
|
|
12
|
-
/** Title of a Lighthouse audit that provides detail on the theme color the web page has set for the browser's address bar. This descriptive title is shown to users when an address-bar theme color has been set. */
|
|
13
|
-
title: 'Sets a theme color for the address bar.',
|
|
14
|
-
/** Title of a Lighthouse audit that provides detail on the theme color the web page has set for the browser's address bar. This descriptive title is shown to users when an address-bar theme color has not been set. */
|
|
15
|
-
failureTitle: 'Does not set a theme color for the address bar.',
|
|
16
|
-
/** Description of a Lighthouse audit that tells the user why they should set a theme color for the browser's address bar. This is displayed after a user expands the section to see more. No character length limits. The last sentence starting with 'Learn' becomes link text to additional documentation. */
|
|
17
|
-
description: 'The browser address bar can be themed to match your site. ' +
|
|
18
|
-
'[Learn more about theming the address bar](https://developer.chrome.com/docs/lighthouse/pwa/themed-omnibox/).',
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @fileoverview
|
|
25
|
-
* Audits if a page is configured for a themed address bar
|
|
26
|
-
*
|
|
27
|
-
* Requirements:
|
|
28
|
-
* * manifest is not empty
|
|
29
|
-
* * manifest has a theme_color
|
|
30
|
-
* * HTML has a theme-color meta
|
|
31
|
-
*
|
|
32
|
-
* Color validity is explicitly not checked.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
class ThemedOmnibox extends MultiCheckAudit {
|
|
36
|
-
/**
|
|
37
|
-
* @return {LH.Audit.Meta}
|
|
38
|
-
*/
|
|
39
|
-
static get meta() {
|
|
40
|
-
return {
|
|
41
|
-
id: 'themed-omnibox',
|
|
42
|
-
title: str_(UIStrings.title),
|
|
43
|
-
failureTitle: str_(UIStrings.failureTitle),
|
|
44
|
-
description: str_(UIStrings.description),
|
|
45
|
-
supportedModes: ['navigation'],
|
|
46
|
-
requiredArtifacts: ['WebAppManifest', 'InstallabilityErrors', 'MetaElements'],
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @param {LH.Artifacts.MetaElement|undefined} themeColorMeta
|
|
52
|
-
* @param {Array<string>} failures
|
|
53
|
-
*/
|
|
54
|
-
static assessMetaThemecolor(themeColorMeta, failures) {
|
|
55
|
-
if (!themeColorMeta) {
|
|
56
|
-
// TODO(#7238): i18n
|
|
57
|
-
failures.push('No `<meta name="theme-color">` tag found');
|
|
58
|
-
} else if (!themeColorMeta.content) {
|
|
59
|
-
failures.push('The theme-color meta tag did not contain a content value');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @param {LH.Artifacts.ManifestValues} manifestValues
|
|
65
|
-
* @param {Array<string>} failures
|
|
66
|
-
*/
|
|
67
|
-
static assessManifest(manifestValues, failures) {
|
|
68
|
-
if (manifestValues.isParseFailure && manifestValues.parseFailureReason) {
|
|
69
|
-
failures.push(manifestValues.parseFailureReason);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const themeColorCheck = manifestValues.allChecks.find(i => i.id === 'hasThemeColor');
|
|
74
|
-
if (themeColorCheck && !themeColorCheck.passing) {
|
|
75
|
-
failures.push(themeColorCheck.failureText);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @param {LH.Artifacts} artifacts
|
|
81
|
-
* @param {LH.Audit.Context} context
|
|
82
|
-
* @return {Promise<{failures: Array<string>, manifestValues: LH.Artifacts.ManifestValues, themeColor: ?string}>}
|
|
83
|
-
*/
|
|
84
|
-
static async audit_(artifacts, context) {
|
|
85
|
-
/** @type {Array<string>} */
|
|
86
|
-
const failures = [];
|
|
87
|
-
|
|
88
|
-
const themeColorMeta = artifacts.MetaElements.find(meta => meta.name === 'theme-color');
|
|
89
|
-
const manifestValues = await ManifestValues.request(artifacts, context);
|
|
90
|
-
ThemedOmnibox.assessManifest(manifestValues, failures);
|
|
91
|
-
ThemedOmnibox.assessMetaThemecolor(themeColorMeta, failures);
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
failures,
|
|
95
|
-
manifestValues,
|
|
96
|
-
themeColor: themeColorMeta?.content || null,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default ThemedOmnibox;
|
|
102
|
-
export {UIStrings};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { ManifestValuesComputed as ManifestValues };
|
|
2
|
-
declare const ManifestValuesComputed: typeof ManifestValues & {
|
|
3
|
-
request: (dependencies: Pick<import("../index.js").Artifacts, "InstallabilityErrors" | "WebAppManifest">, context: import("../../types/utility-types.js").default.ImmutableObject<{
|
|
4
|
-
computedCache: Map<string, import("../lib/arbitrary-equality-map.js").ArbitraryEqualityMap>;
|
|
5
|
-
}>) => Promise<import("../index.js").Artifacts.ManifestValues>;
|
|
6
|
-
};
|
|
7
|
-
declare class ManifestValues {
|
|
8
|
-
/** @typedef {(val: NonNullable<LH.Artifacts.Manifest['value']>, errors: LH.Artifacts.InstallabilityErrors['errors']) => boolean} Validator */
|
|
9
|
-
/**
|
|
10
|
-
* @return {Array<{id: LH.Artifacts.ManifestValueCheckID, failureText: string, validate: Validator}>}
|
|
11
|
-
*/
|
|
12
|
-
static get manifestChecks(): {
|
|
13
|
-
id: LH.Artifacts.ManifestValueCheckID;
|
|
14
|
-
failureText: string;
|
|
15
|
-
validate: (val: NonNullable<LH.Artifacts.Manifest['value']>, errors: LH.Artifacts.InstallabilityErrors['errors']) => boolean;
|
|
16
|
-
}[];
|
|
17
|
-
/**
|
|
18
|
-
* Returns results of all manifest checks
|
|
19
|
-
* @param {Pick<LH.Artifacts, 'WebAppManifest'|'InstallabilityErrors'>} Manifest
|
|
20
|
-
* @return {Promise<LH.Artifacts.ManifestValues>}
|
|
21
|
-
*/
|
|
22
|
-
static compute_({ WebAppManifest, InstallabilityErrors }: Pick<LH.Artifacts, 'WebAppManifest' | 'InstallabilityErrors'>): Promise<LH.Artifacts.ManifestValues>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=manifest-values.d.ts.map
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2016 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {makeComputedArtifact} from './computed-artifact.js';
|
|
8
|
-
import * as icons from '../lib/icons.js';
|
|
9
|
-
|
|
10
|
-
const PWA_DISPLAY_VALUES = ['minimal-ui', 'fullscreen', 'standalone'];
|
|
11
|
-
|
|
12
|
-
// Historically, Chrome recommended 12 chars as the maximum short_name length to prevent truncation.
|
|
13
|
-
// For more discussion, see https://github.com/GoogleChrome/lighthouse/issues/69 and https://developer.chrome.com/apps/manifest/name#short_name
|
|
14
|
-
const SUGGESTED_SHORTNAME_LENGTH = 12;
|
|
15
|
-
|
|
16
|
-
class ManifestValues {
|
|
17
|
-
/** @typedef {(val: NonNullable<LH.Artifacts.Manifest['value']>, errors: LH.Artifacts.InstallabilityErrors['errors']) => boolean} Validator */
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @return {Array<{id: LH.Artifacts.ManifestValueCheckID, failureText: string, validate: Validator}>}
|
|
21
|
-
*/
|
|
22
|
-
static get manifestChecks() {
|
|
23
|
-
return [
|
|
24
|
-
{
|
|
25
|
-
id: 'hasStartUrl',
|
|
26
|
-
failureText: 'Manifest does not contain a `start_url`',
|
|
27
|
-
validate: manifestValue => !!manifestValue.start_url.value,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 'hasIconsAtLeast144px',
|
|
31
|
-
failureText: 'Manifest does not have a PNG icon of at least 144px',
|
|
32
|
-
validate: manifestValue => icons.doExist(manifestValue) &&
|
|
33
|
-
icons.pngSizedAtLeast(144, manifestValue).length > 0,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: 'hasIconsAtLeast512px',
|
|
37
|
-
failureText: 'Manifest does not have a PNG icon of at least 512px',
|
|
38
|
-
validate: manifestValue => icons.doExist(manifestValue) &&
|
|
39
|
-
icons.pngSizedAtLeast(512, manifestValue).length > 0,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: 'fetchesIcon',
|
|
43
|
-
failureText: 'Manifest icon failed to be fetched',
|
|
44
|
-
validate: (manifestValue, errors) => {
|
|
45
|
-
const failedToFetchIconErrorIds = [
|
|
46
|
-
'cannot-download-icon',
|
|
47
|
-
'no-icon-available',
|
|
48
|
-
];
|
|
49
|
-
return icons.doExist(manifestValue) &&
|
|
50
|
-
!errors.some(error => failedToFetchIconErrorIds.includes(error.errorId));
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: 'hasPWADisplayValue',
|
|
55
|
-
failureText: 'Manifest\'s `display` value is not one of: ' + PWA_DISPLAY_VALUES.join(' | '),
|
|
56
|
-
validate: manifestValue => PWA_DISPLAY_VALUES.includes(manifestValue.display.value),
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: 'hasBackgroundColor',
|
|
60
|
-
failureText: 'Manifest does not have `background_color`',
|
|
61
|
-
validate: manifestValue => !!manifestValue.background_color.value,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: 'hasThemeColor',
|
|
65
|
-
failureText: 'Manifest does not have `theme_color`',
|
|
66
|
-
validate: manifestValue => !!manifestValue.theme_color.value,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: 'hasShortName',
|
|
70
|
-
failureText: 'Manifest does not have `short_name`',
|
|
71
|
-
validate: manifestValue => !!manifestValue.short_name.value,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: 'shortNameLength',
|
|
75
|
-
failureText: `Manifest's \`short_name\` is too long (>${SUGGESTED_SHORTNAME_LENGTH} ` +
|
|
76
|
-
`characters) to be displayed on a homescreen without truncation`,
|
|
77
|
-
// Pass if there's no short_name. Don't want to report a non-existent string is too long
|
|
78
|
-
validate: manifestValue => !!manifestValue.short_name.value &&
|
|
79
|
-
manifestValue.short_name.value.length <= SUGGESTED_SHORTNAME_LENGTH,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: 'hasName',
|
|
83
|
-
failureText: 'Manifest does not have `name`',
|
|
84
|
-
validate: manifestValue => !!manifestValue.name.value,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: 'hasMaskableIcon',
|
|
88
|
-
failureText: 'Manifest does not have at least one icon that is maskable',
|
|
89
|
-
validate: ManifestValue => icons.doExist(ManifestValue) &&
|
|
90
|
-
icons.containsMaskableIcon(ManifestValue),
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Returns results of all manifest checks
|
|
97
|
-
* @param {Pick<LH.Artifacts, 'WebAppManifest'|'InstallabilityErrors'>} Manifest
|
|
98
|
-
* @return {Promise<LH.Artifacts.ManifestValues>}
|
|
99
|
-
*/
|
|
100
|
-
static async compute_({WebAppManifest, InstallabilityErrors}) {
|
|
101
|
-
// if the manifest isn't there or is invalid json, we report that and bail
|
|
102
|
-
if (WebAppManifest === null) {
|
|
103
|
-
return {
|
|
104
|
-
isParseFailure: true,
|
|
105
|
-
parseFailureReason: 'No manifest was fetched',
|
|
106
|
-
allChecks: [],
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
const manifestValue = WebAppManifest.value;
|
|
110
|
-
if (manifestValue === undefined) {
|
|
111
|
-
return {
|
|
112
|
-
isParseFailure: true,
|
|
113
|
-
parseFailureReason: 'Manifest failed to parse as valid JSON',
|
|
114
|
-
allChecks: [],
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// manifest is valid, so do the rest of the checks
|
|
119
|
-
const remainingChecks = ManifestValues.manifestChecks.map(item => {
|
|
120
|
-
return {
|
|
121
|
-
id: item.id,
|
|
122
|
-
failureText: item.failureText,
|
|
123
|
-
passing: item.validate(manifestValue, InstallabilityErrors.errors),
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
isParseFailure: false,
|
|
129
|
-
allChecks: remainingChecks,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const ManifestValuesComputed =
|
|
135
|
-
makeComputedArtifact(ManifestValues, ['InstallabilityErrors', 'WebAppManifest']);
|
|
136
|
-
export {ManifestValuesComputed as ManifestValues};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default InstallabilityErrors;
|
|
2
|
-
declare class InstallabilityErrors extends BaseGatherer {
|
|
3
|
-
/**
|
|
4
|
-
* Creates an Artifacts.InstallabilityErrors, tranforming data from the protocol
|
|
5
|
-
* for old versions of Chrome.
|
|
6
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
7
|
-
* @return {Promise<LH.Artifacts['InstallabilityErrors']>}
|
|
8
|
-
*/
|
|
9
|
-
static getInstallabilityErrors(session: LH.Gatherer.ProtocolSession): Promise<LH.Artifacts['InstallabilityErrors']>;
|
|
10
|
-
/**
|
|
11
|
-
* @param {LH.Gatherer.Context} context
|
|
12
|
-
* @return {Promise<LH.Artifacts['InstallabilityErrors']>}
|
|
13
|
-
*/
|
|
14
|
-
getArtifact(context: LH.Gatherer.Context): Promise<LH.Artifacts['InstallabilityErrors']>;
|
|
15
|
-
}
|
|
16
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
17
|
-
//# sourceMappingURL=installability-errors.d.ts.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import log from 'lighthouse-logger';
|
|
8
|
-
|
|
9
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
10
|
-
|
|
11
|
-
class InstallabilityErrors extends BaseGatherer {
|
|
12
|
-
/** @type {LH.Gatherer.GathererMeta} */
|
|
13
|
-
meta = {
|
|
14
|
-
supportedModes: ['snapshot', 'navigation'],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Creates an Artifacts.InstallabilityErrors, tranforming data from the protocol
|
|
19
|
-
* for old versions of Chrome.
|
|
20
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
21
|
-
* @return {Promise<LH.Artifacts['InstallabilityErrors']>}
|
|
22
|
-
*/
|
|
23
|
-
static async getInstallabilityErrors(session) {
|
|
24
|
-
const status = {
|
|
25
|
-
msg: 'Get webapp installability errors',
|
|
26
|
-
id: 'lh:gather:getInstallabilityErrors',
|
|
27
|
-
};
|
|
28
|
-
log.time(status);
|
|
29
|
-
const response = await session.sendCommand('Page.getInstallabilityErrors');
|
|
30
|
-
|
|
31
|
-
const errors = response.installabilityErrors;
|
|
32
|
-
|
|
33
|
-
log.timeEnd(status);
|
|
34
|
-
return {errors};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param {LH.Gatherer.Context} context
|
|
39
|
-
* @return {Promise<LH.Artifacts['InstallabilityErrors']>}
|
|
40
|
-
*/
|
|
41
|
-
async getArtifact(context) {
|
|
42
|
-
const driver = context.driver;
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
return await InstallabilityErrors.getInstallabilityErrors(driver.defaultSession);
|
|
46
|
-
} catch {
|
|
47
|
-
return {
|
|
48
|
-
errors: [
|
|
49
|
-
{errorId: 'protocol-timeout', errorArguments: []},
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default InstallabilityErrors;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export default WebAppManifest;
|
|
2
|
-
declare class WebAppManifest extends BaseGatherer {
|
|
3
|
-
/**
|
|
4
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
5
|
-
* @return {Promise<{url: string, data: string}|null>}
|
|
6
|
-
*/
|
|
7
|
-
static fetchAppManifest(session: LH.Gatherer.ProtocolSession): Promise<{
|
|
8
|
-
url: string;
|
|
9
|
-
data: string;
|
|
10
|
-
} | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Uses the debugger protocol to fetch the manifest from within the context of
|
|
13
|
-
* the target page, reusing any credentials, emulation, etc, already established
|
|
14
|
-
* there.
|
|
15
|
-
*
|
|
16
|
-
* Returns the parsed manifest or null if the page had no manifest. If the manifest
|
|
17
|
-
* was unparseable as JSON, manifest.value will be undefined and manifest.warning
|
|
18
|
-
* will have the reason. See manifest-parser.js for more information.
|
|
19
|
-
*
|
|
20
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
21
|
-
* @param {string} pageUrl
|
|
22
|
-
* @return {Promise<LH.Artifacts.Manifest|null>}
|
|
23
|
-
*/
|
|
24
|
-
static getWebAppManifest(session: LH.Gatherer.ProtocolSession, pageUrl: string): Promise<LH.Artifacts.Manifest | null>;
|
|
25
|
-
/**
|
|
26
|
-
* @param {LH.Gatherer.Context} context
|
|
27
|
-
* @return {Promise<LH.Artifacts['WebAppManifest']>}
|
|
28
|
-
*/
|
|
29
|
-
getArtifact(context: LH.Gatherer.Context): Promise<LH.Artifacts['WebAppManifest']>;
|
|
30
|
-
}
|
|
31
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
32
|
-
//# sourceMappingURL=web-app-manifest.d.ts.map
|