lighthouse 8.6.0-dev.20211101 → 8.6.0-dev.20211105
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/dist/report/flow.js +14 -14
- package/dist/report/standalone.js +41 -35
- package/flow-report/.eslintrc.cjs +2 -0
- package/flow-report/assets/standalone-flow-template.html +3 -2
- package/flow-report/assets/styles.css +1 -1
- package/flow-report/src/common.tsx +11 -4
- package/flow-report/src/i18n/i18n.tsx +10 -6
- package/flow-report/src/icons.tsx +30 -9
- package/flow-report/src/sidebar/sidebar.tsx +27 -8
- package/flow-report/src/summary/category.tsx +7 -2
- package/flow-report/src/summary/summary.tsx +9 -3
- package/flow-report/src/util.ts +21 -9
- package/flow-report/src/wrappers/report-renderer.tsx +10 -3
- package/flow-report/src/wrappers/report.tsx +9 -5
- package/flow-report/standalone-flow.tsx +4 -3
- package/flow-report/test/setup/env-setup.ts +1 -1
- package/flow-report/test/sidebar/sidebar-test.tsx +43 -1
- package/lighthouse-cli/.eslintrc.cjs +2 -0
- package/lighthouse-cli/cli-flags.js +1 -1
- package/lighthouse-core/audits/audit.js +1 -1
- package/lighthouse-core/computed/resource-summary.js +1 -1
- package/lighthouse-core/config/default-config.js +0 -2
- package/lighthouse-core/gather/connections/cri.js +1 -1
- package/lighthouse-core/lib/proto-preprocessor.js +14 -2
- package/lighthouse-core/lib/url-shim.js +1 -1
- package/lighthouse-core/util-commonjs.js +24 -9
- package/package.json +3 -3
- package/report/.eslintrc.cjs +2 -0
- package/report/assets/standalone-template.html +2 -3
- package/report/assets/styles.css +227 -251
- package/report/assets/templates.html +19 -29
- package/report/clients/bundle.js +1 -0
- package/report/clients/standalone.js +6 -13
- package/report/renderer/api.js +32 -0
- package/report/renderer/category-renderer.js +22 -18
- package/report/renderer/components.js +46 -79
- package/report/renderer/crc-details-renderer.js +15 -12
- package/report/renderer/dom.js +16 -1
- package/report/renderer/drop-down-menu.js +2 -2
- package/report/renderer/element-screenshot-renderer.js +6 -6
- package/report/renderer/features-util.js +1 -1
- package/report/renderer/open-tab.js +9 -3
- package/report/renderer/performance-category-renderer.js +31 -19
- package/report/renderer/report-renderer.js +34 -10
- package/report/renderer/report-ui-features.js +36 -33
- package/report/renderer/swap-locale-feature.js +3 -3
- package/report/renderer/topbar-features.js +52 -48
- package/report/renderer/util.js +25 -9
- package/report/test/clients/bundle-test.js +8 -0
- package/report/test/renderer/category-renderer-test.js +2 -2
- package/report/test/renderer/performance-category-renderer-test.js +1 -1
- package/report/test/renderer/report-renderer-axe-test.js +5 -2
- package/report/test/renderer/report-renderer-test.js +13 -10
- package/report/test/renderer/report-ui-features-test.js +17 -10
- package/report/test-assets/faux-psi-template.html +2 -7
- package/report/test-assets/faux-psi.js +20 -39
- package/report/types/html-renderer.d.ts +2 -0
- package/report/types/report-renderer.d.ts +23 -0
- package/shared/localization/locales/ar-XB.json +0 -15
- package/shared/localization/locales/ar.json +0 -15
- package/shared/localization/locales/bg.json +0 -15
- package/shared/localization/locales/ca.json +0 -15
- package/shared/localization/locales/cs.json +0 -15
- package/shared/localization/locales/da.json +0 -15
- package/shared/localization/locales/de.json +0 -15
- package/shared/localization/locales/el.json +0 -15
- package/shared/localization/locales/en-GB.json +0 -15
- package/shared/localization/locales/en-US.json +18 -15
- package/shared/localization/locales/en-XA.json +0 -15
- package/shared/localization/locales/en-XL.json +18 -15
- package/shared/localization/locales/es-419.json +0 -15
- package/shared/localization/locales/es.json +0 -15
- package/shared/localization/locales/fi.json +0 -15
- package/shared/localization/locales/fil.json +0 -15
- package/shared/localization/locales/fr.json +0 -15
- package/shared/localization/locales/he.json +0 -15
- package/shared/localization/locales/hi.json +0 -15
- package/shared/localization/locales/hr.json +0 -15
- package/shared/localization/locales/hu.json +0 -15
- package/shared/localization/locales/id.json +0 -15
- package/shared/localization/locales/it.json +0 -15
- package/shared/localization/locales/ja.json +0 -15
- package/shared/localization/locales/ko.json +0 -15
- package/shared/localization/locales/lt.json +0 -15
- package/shared/localization/locales/lv.json +0 -15
- package/shared/localization/locales/nl.json +0 -15
- package/shared/localization/locales/no.json +0 -15
- package/shared/localization/locales/pl.json +0 -15
- package/shared/localization/locales/pt-PT.json +0 -15
- package/shared/localization/locales/pt.json +0 -15
- package/shared/localization/locales/ro.json +0 -15
- package/shared/localization/locales/ru.json +0 -15
- package/shared/localization/locales/sk.json +0 -15
- package/shared/localization/locales/sl.json +0 -15
- package/shared/localization/locales/sr-Latn.json +0 -15
- package/shared/localization/locales/sr.json +0 -15
- package/shared/localization/locales/sv.json +0 -15
- package/shared/localization/locales/ta.json +0 -15
- package/shared/localization/locales/te.json +0 -15
- package/shared/localization/locales/th.json +0 -15
- package/shared/localization/locales/tr.json +0 -15
- package/shared/localization/locales/uk.json +0 -15
- package/shared/localization/locales/vi.json +0 -15
- package/shared/localization/locales/zh-HK.json +0 -15
- package/shared/localization/locales/zh-TW.json +0 -15
- package/shared/localization/locales/zh.json +0 -15
- package/lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js +0 -96
|
@@ -800,21 +800,6 @@
|
|
|
800
800
|
"lighthouse-core/audits/dobetterweb/dom-size.js | title": {
|
|
801
801
|
"message": "避免 DOM 過大"
|
|
802
802
|
},
|
|
803
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | columnFailingAnchors": {
|
|
804
|
-
"message": "審核失敗的錨點"
|
|
805
|
-
},
|
|
806
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | description": {
|
|
807
|
-
"message": "將 `rel=\"noopener\"` 或 `rel=\"noreferrer\"` 新增至所有外部連結,可提升效能並防範安全漏洞。[瞭解詳情](https://web.dev/external-anchors-use-rel-noopener/)。"
|
|
808
|
-
},
|
|
809
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | failureTitle": {
|
|
810
|
-
"message": "跨原始來源目的地的連結不安全"
|
|
811
|
-
},
|
|
812
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | title": {
|
|
813
|
-
"message": "跨來源目的地的連結安全"
|
|
814
|
-
},
|
|
815
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | warning": {
|
|
816
|
-
"message": "無法判斷錨點的目的地 ({anchorHTML})。如果 target=_blank 不是用作連結,請考慮移除。"
|
|
817
|
-
},
|
|
818
803
|
"lighthouse-core/audits/dobetterweb/geolocation-on-start.js | description": {
|
|
819
804
|
"message": "如果未提供其他資訊就要求存取使用者的位置資訊,會讓使用者感到困惑而不信任網站。建議您在使用者執行特定動作時,再提出這項要求。[瞭解詳情](https://web.dev/geolocation-on-start/)。"
|
|
820
805
|
},
|
|
@@ -800,21 +800,6 @@
|
|
|
800
800
|
"lighthouse-core/audits/dobetterweb/dom-size.js | title": {
|
|
801
801
|
"message": "避免 DOM 過大"
|
|
802
802
|
},
|
|
803
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | columnFailingAnchors": {
|
|
804
|
-
"message": "未通過稽核的錨點"
|
|
805
|
-
},
|
|
806
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | description": {
|
|
807
|
-
"message": "將 `rel=\"noopener\"` 或 `rel=\"noreferrer\"` 新增至所有外部連結,可提升效能並防範安全漏洞。[瞭解詳情](https://web.dev/external-anchors-use-rel-noopener/)。"
|
|
808
|
-
},
|
|
809
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | failureTitle": {
|
|
810
|
-
"message": "跨原始來源目的地的連結不安全"
|
|
811
|
-
},
|
|
812
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | title": {
|
|
813
|
-
"message": "跨來源目的地的連結很安全"
|
|
814
|
-
},
|
|
815
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | warning": {
|
|
816
|
-
"message": "無法判定錨點的目的地 ({anchorHTML})。如果 target=_blank 不是做為超連結使用,請考慮移除它。"
|
|
817
|
-
},
|
|
818
803
|
"lighthouse-core/audits/dobetterweb/geolocation-on-start.js | description": {
|
|
819
804
|
"message": "如果未提供其他資訊就要求存取使用者的位置資訊,會讓使用者感到困惑而不信任網站。建議你在使用者執行特定動作時,再提出這項要求。[瞭解詳情](https://web.dev/geolocation-on-start/)。"
|
|
820
805
|
},
|
|
@@ -800,21 +800,6 @@
|
|
|
800
800
|
"lighthouse-core/audits/dobetterweb/dom-size.js | title": {
|
|
801
801
|
"message": "避免 DOM 规模过大"
|
|
802
802
|
},
|
|
803
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | columnFailingAnchors": {
|
|
804
|
-
"message": "未通过审核的锚点"
|
|
805
|
-
},
|
|
806
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | description": {
|
|
807
|
-
"message": "向任何外部链接添加 `rel=\"noopener\"` 或 `rel=\"noreferrer\"`,可提高性能并减少安全漏洞。[了解详情](https://web.dev/external-anchors-use-rel-noopener/)。"
|
|
808
|
-
},
|
|
809
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | failureTitle": {
|
|
810
|
-
"message": "指向跨域目的地的链接不安全"
|
|
811
|
-
},
|
|
812
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | title": {
|
|
813
|
-
"message": "指向跨域目的地的链接安全"
|
|
814
|
-
},
|
|
815
|
-
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | warning": {
|
|
816
|
-
"message": "无法确定锚点 ({anchorHTML}) 的目的地。如果不用作超链接,建议移除 target=_blank。"
|
|
817
|
-
},
|
|
818
803
|
"lighthouse-core/audits/dobetterweb/geolocation-on-start.js | description": {
|
|
819
804
|
"message": "如果网站在缺少上下文的情况下请求位置,会导致用户不信任网站或感到困惑。建议将请求与用户操作进行绑定。[了解详情](https://web.dev/geolocation-on-start/)。"
|
|
820
805
|
},
|
|
@@ -1,96 +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
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
const URL = require('../../lib/url-shim.js');
|
|
9
|
-
const Audit = require('../audit.js');
|
|
10
|
-
const i18n = require('../../lib/i18n/i18n.js');
|
|
11
|
-
|
|
12
|
-
const UIStrings = {
|
|
13
|
-
/** Title of a Lighthouse audit that provides detail on the cross-origin links that the web page contains, and whether the links can be considered safe. This descriptive title is shown to users when all links are safe. */
|
|
14
|
-
title: 'Links to cross-origin destinations are safe',
|
|
15
|
-
/** Title of a Lighthouse audit that provides detail on the cross-origin links that the web page contains, and whether the links can be considered safe. This descriptive title is shown to users when not all links can be considered safe. */
|
|
16
|
-
failureTitle: 'Links to cross-origin destinations are unsafe',
|
|
17
|
-
/** Description of a Lighthouse audit that tells the user why and how they should secure cross-origin links. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
|
|
18
|
-
description: 'Add `rel="noopener"` or `rel="noreferrer"` to any external links to improve ' +
|
|
19
|
-
'performance and prevent security vulnerabilities. ' +
|
|
20
|
-
'[Learn more](https://web.dev/external-anchors-use-rel-noopener/).',
|
|
21
|
-
/**
|
|
22
|
-
* @description Warning that some links' destinations cannot be determined and therefore the audit cannot evaluate the link's safety.
|
|
23
|
-
* @example {<a target="_blank">} anchorHTML
|
|
24
|
-
*/
|
|
25
|
-
warning: 'Unable to determine the destination for anchor ({anchorHTML}). ' +
|
|
26
|
-
'If not used as a hyperlink, consider removing target=_blank.',
|
|
27
|
-
/** Label for a column in a data table; entries will be the HTML elements that failed the audit. Anchors are DOM elements that are links. */
|
|
28
|
-
columnFailingAnchors: 'Failing Anchors',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
32
|
-
|
|
33
|
-
class ExternalAnchorsUseRelNoopenerAudit extends Audit {
|
|
34
|
-
/**
|
|
35
|
-
* @return {LH.Audit.Meta}
|
|
36
|
-
*/
|
|
37
|
-
static get meta() {
|
|
38
|
-
return {
|
|
39
|
-
id: 'external-anchors-use-rel-noopener',
|
|
40
|
-
title: str_(UIStrings.title),
|
|
41
|
-
failureTitle: str_(UIStrings.failureTitle),
|
|
42
|
-
description: str_(UIStrings.description),
|
|
43
|
-
requiredArtifacts: ['URL', 'AnchorElements'],
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param {LH.Artifacts} artifacts
|
|
49
|
-
* @return {LH.Audit.Product}
|
|
50
|
-
*/
|
|
51
|
-
static audit(artifacts) {
|
|
52
|
-
/** @type {LH.IcuMessage[]} */
|
|
53
|
-
const warnings = [];
|
|
54
|
-
const pageHost = new URL(artifacts.URL.finalUrl).host;
|
|
55
|
-
const failingAnchors = artifacts.AnchorElements
|
|
56
|
-
.filter(anchor => anchor.target === '_blank' && !anchor.rel.includes('noopener') &&
|
|
57
|
-
!anchor.rel.includes('noreferrer'))
|
|
58
|
-
// Filter usages to exclude anchors that are same origin
|
|
59
|
-
.filter(anchor => {
|
|
60
|
-
try {
|
|
61
|
-
return new URL(anchor.href).host !== pageHost;
|
|
62
|
-
} catch (err) {
|
|
63
|
-
warnings.push(str_(UIStrings.warning, {anchorHTML: anchor.node.snippet}));
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
.filter(anchor => {
|
|
68
|
-
return !anchor.href || anchor.href.toLowerCase().startsWith('http');
|
|
69
|
-
})
|
|
70
|
-
.map(anchor => {
|
|
71
|
-
return {
|
|
72
|
-
node: Audit.makeNodeItem(anchor.node),
|
|
73
|
-
href: anchor.href || 'Unknown',
|
|
74
|
-
target: anchor.target || '',
|
|
75
|
-
rel: anchor.rel || '',
|
|
76
|
-
outerHTML: anchor.node.snippet || '',
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
/** @type {LH.Audit.Details.Table['headings']} */
|
|
81
|
-
const headings = [
|
|
82
|
-
{key: 'node', itemType: 'node', text: str_(UIStrings.columnFailingAnchors)},
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
const details = Audit.makeTableDetails(headings, failingAnchors);
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
score: Number(failingAnchors.length === 0),
|
|
89
|
-
details,
|
|
90
|
-
warnings,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
module.exports = ExternalAnchorsUseRelNoopenerAudit;
|
|
96
|
-
module.exports.UIStrings = UIStrings;
|