lighthouse 12.8.2 → 13.0.0-dev.20251010
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 +1 -1
- package/cli/test/smokehouse/config/exclusions.js +0 -2
- package/cli/test/smokehouse/version-check.d.ts +1 -1
- package/core/audits/accessibility/accesskeys.js +3 -3
- package/core/audits/accessibility/aria-allowed-attr.js +3 -3
- package/core/audits/accessibility/aria-allowed-role.js +2 -1
- package/core/audits/accessibility/aria-command-name.js +1 -1
- package/core/audits/accessibility/aria-conditional-attr.js +1 -1
- package/core/audits/accessibility/aria-deprecated-role.js +1 -1
- package/core/audits/accessibility/aria-dialog-name.js +1 -1
- package/core/audits/accessibility/aria-hidden-body.js +3 -3
- package/core/audits/accessibility/aria-hidden-focus.js +3 -3
- package/core/audits/accessibility/aria-input-field-name.js +3 -3
- package/core/audits/accessibility/aria-meter-name.js +1 -1
- package/core/audits/accessibility/aria-progressbar-name.js +1 -1
- package/core/audits/accessibility/aria-prohibited-attr.js +1 -1
- package/core/audits/accessibility/aria-required-attr.js +3 -3
- package/core/audits/accessibility/aria-required-children.js +3 -3
- package/core/audits/accessibility/aria-required-parent.js +3 -3
- package/core/audits/accessibility/aria-roles.js +3 -3
- package/core/audits/accessibility/aria-text.js +3 -3
- package/core/audits/accessibility/aria-toggle-field-name.js +3 -3
- package/core/audits/accessibility/aria-tooltip-name.js +1 -1
- package/core/audits/accessibility/aria-treeitem-name.js +1 -1
- package/core/audits/accessibility/aria-valid-attr-value.js +3 -3
- package/core/audits/accessibility/aria-valid-attr.js +3 -3
- package/core/audits/accessibility/button-name.js +3 -3
- package/core/audits/accessibility/bypass.js +3 -3
- package/core/audits/accessibility/color-contrast.js +3 -3
- package/core/audits/accessibility/definition-list.js +3 -3
- package/core/audits/accessibility/dlitem.js +3 -3
- package/core/audits/accessibility/document-title.js +3 -3
- package/core/audits/accessibility/duplicate-id-aria.js +3 -3
- package/core/audits/accessibility/empty-heading.js +3 -3
- package/core/audits/accessibility/form-field-multiple-labels.js +3 -3
- package/core/audits/accessibility/frame-title.js +3 -3
- package/core/audits/accessibility/heading-order.js +3 -3
- package/core/audits/accessibility/html-has-lang.js +3 -3
- package/core/audits/accessibility/html-lang-valid.js +3 -3
- package/core/audits/accessibility/html-xml-lang-mismatch.js +3 -3
- package/core/audits/accessibility/identical-links-same-purpose.js +3 -3
- package/core/audits/accessibility/image-alt.js +3 -3
- package/core/audits/accessibility/image-redundant-alt.js +4 -3
- package/core/audits/accessibility/input-button-name.js +3 -3
- package/core/audits/accessibility/input-image-alt.js +3 -3
- package/core/audits/accessibility/label-content-name-mismatch.js +3 -3
- package/core/audits/accessibility/label.js +3 -3
- package/core/audits/accessibility/landmark-one-main.js +3 -4
- package/core/audits/accessibility/link-in-text-block.js +3 -3
- package/core/audits/accessibility/link-name.js +3 -3
- package/core/audits/accessibility/list.js +3 -3
- package/core/audits/accessibility/listitem.js +3 -3
- package/core/audits/accessibility/meta-refresh.js +3 -3
- package/core/audits/accessibility/meta-viewport.js +3 -3
- package/core/audits/accessibility/object-alt.js +3 -3
- package/core/audits/accessibility/select-name.js +3 -3
- package/core/audits/accessibility/skip-link.js +3 -3
- package/core/audits/accessibility/tabindex.js +3 -3
- package/core/audits/accessibility/table-duplicate-name.js +4 -3
- package/core/audits/accessibility/table-fake-caption.js +3 -3
- package/core/audits/accessibility/target-size.js +3 -3
- package/core/audits/accessibility/td-has-header.js +3 -3
- package/core/audits/accessibility/td-headers-attr.js +3 -3
- package/core/audits/accessibility/th-has-data-cells.js +3 -3
- package/core/audits/accessibility/valid-lang.js +3 -3
- package/core/audits/accessibility/video-caption.js +3 -3
- package/core/audits/audit.d.ts +0 -4
- package/core/audits/audit.js +2 -13
- package/core/audits/insights/cls-culprits-insight.js +1 -1
- package/core/audits/insights/dom-size-insight.js +11 -7
- package/core/audits/insights/font-display-insight.js +3 -1
- package/core/audits/insights/image-delivery-insight.js +4 -1
- package/core/audits/insights/insight-audit.d.ts +6 -4
- package/core/audits/insights/insight-audit.js +27 -8
- package/core/audits/insights/third-parties-insight.js +1 -1
- package/core/audits/layout-shifts.js +1 -1
- package/core/audits/predictive-perf.js +2 -2
- package/core/audits/seo/crawlable-anchors.js +2 -3
- package/core/audits/seo/manual/structured-data.js +1 -1
- package/core/audits/server-response-time.d.ts +0 -5
- package/core/audits/server-response-time.js +12 -26
- package/core/computed/metrics/cumulative-layout-shift.js +2 -2
- package/core/computed/metrics/lantern-metric.js +3 -3
- package/core/computed/metrics/lcp-breakdown.d.ts +10 -5
- package/core/computed/metrics/lcp-breakdown.js +50 -22
- package/core/computed/metrics/time-to-first-byte.js +33 -10
- package/core/computed/metrics/timing-summary.js +3 -2
- package/core/computed/page-dependency-graph.js +1 -1
- package/core/computed/trace-engine-result.js +2 -2
- package/core/config/default-config.js +110 -152
- package/core/config/experimental-config.js +1 -32
- package/core/config/filters.js +6 -9
- package/core/config/lr-desktop-config.js +0 -1
- package/core/config/lr-mobile-config.js +0 -1
- package/core/gather/driver/target-manager.d.ts +1 -1
- package/core/gather/driver.d.ts +1 -1
- package/core/gather/gatherers/anchor-elements.js +8 -24
- package/core/gather/gatherers/image-elements.js +32 -6
- package/core/gather/gatherers/inspector-issues.js +1 -28
- package/core/gather/gatherers/trace-elements.d.ts +2 -11
- package/core/gather/gatherers/trace-elements.js +9 -39
- package/core/gather/navigation-runner.js +0 -3
- package/core/gather/session.d.ts +1 -1
- package/core/lib/asset-saver.d.ts +2 -2
- package/core/lib/asset-saver.js +33 -43
- package/core/lib/bf-cache-strings.js +10 -9
- package/core/lib/deprecations-strings.js +5 -5
- package/core/lib/emulation.d.ts +10 -0
- package/core/lib/emulation.js +21 -6
- package/core/lib/legacy-javascript/legacy-javascript.js +4 -11
- package/core/lib/network-request.d.ts +0 -7
- package/core/lib/network-request.js +0 -16
- package/core/lib/proto-preprocessor.js +10 -25
- package/core/runner.js +1 -8
- package/core/scoring.js +1 -1
- package/dist/report/bundle.esm.js +10 -49
- package/dist/report/flow.js +12 -51
- package/dist/report/standalone.js +11 -50
- package/flow-report/src/i18n/i18n.d.ts +4 -6
- package/package.json +16 -19
- package/readme.md +2 -2
- package/report/assets/styles.css +0 -39
- package/report/renderer/api.js +0 -1
- package/report/renderer/category-renderer.js +6 -0
- package/report/renderer/components.js +1 -1
- package/report/renderer/details-renderer.d.ts +1 -2
- package/report/renderer/details-renderer.js +0 -1
- package/report/renderer/dom.d.ts +0 -13
- package/report/renderer/dom.js +0 -38
- package/report/renderer/performance-category-renderer.d.ts +0 -26
- package/report/renderer/performance-category-renderer.js +10 -142
- package/report/renderer/report-ui-features.d.ts +0 -1
- package/report/renderer/report-ui-features.js +2 -13
- package/report/renderer/report-utils.d.ts +2 -3
- package/report/renderer/report-utils.js +4 -6
- package/report/types/report-renderer.d.ts +0 -6
- package/shared/localization/locales/ar-XB.json +107 -455
- package/shared/localization/locales/ar.json +107 -455
- package/shared/localization/locales/bg.json +96 -444
- package/shared/localization/locales/ca.json +96 -444
- package/shared/localization/locales/cs.json +96 -444
- package/shared/localization/locales/da.json +96 -444
- package/shared/localization/locales/de.json +96 -444
- package/shared/localization/locales/el.json +96 -444
- package/shared/localization/locales/en-GB.json +96 -444
- package/shared/localization/locales/en-US.json +116 -467
- package/shared/localization/locales/en-XA.json +93 -441
- package/shared/localization/locales/en-XL.json +116 -467
- package/shared/localization/locales/es-419.json +96 -444
- package/shared/localization/locales/es.json +96 -444
- package/shared/localization/locales/fi.json +96 -444
- package/shared/localization/locales/fil.json +96 -444
- package/shared/localization/locales/fr.json +96 -444
- package/shared/localization/locales/he.json +118 -466
- package/shared/localization/locales/hi.json +96 -444
- package/shared/localization/locales/hr.json +100 -448
- package/shared/localization/locales/hu.json +96 -444
- package/shared/localization/locales/id.json +96 -444
- package/shared/localization/locales/it.json +96 -444
- package/shared/localization/locales/ja.json +96 -444
- package/shared/localization/locales/ko.json +97 -445
- package/shared/localization/locales/lt.json +96 -444
- package/shared/localization/locales/lv.json +97 -445
- package/shared/localization/locales/nl.json +96 -444
- package/shared/localization/locales/no.json +96 -444
- package/shared/localization/locales/pl.json +96 -444
- package/shared/localization/locales/pt-PT.json +96 -444
- package/shared/localization/locales/pt.json +97 -445
- package/shared/localization/locales/ro.json +97 -445
- package/shared/localization/locales/ru.json +96 -444
- package/shared/localization/locales/sk.json +96 -444
- package/shared/localization/locales/sl.json +96 -444
- package/shared/localization/locales/sr-Latn.json +96 -444
- package/shared/localization/locales/sr.json +96 -444
- package/shared/localization/locales/sv.json +96 -444
- package/shared/localization/locales/ta.json +96 -444
- package/shared/localization/locales/te.json +97 -445
- package/shared/localization/locales/th.json +96 -444
- package/shared/localization/locales/tr.json +96 -444
- package/shared/localization/locales/uk.json +96 -444
- package/shared/localization/locales/vi.json +96 -444
- package/shared/localization/locales/zh-HK.json +96 -444
- package/shared/localization/locales/zh-TW.json +97 -445
- package/shared/localization/locales/zh.json +96 -444
- package/shared/localization/locales.d.ts +2 -0
- package/shared/localization/locales.js +130 -139
- package/shared/tsconfig.json +2 -0
- package/tsconfig-base.json +2 -2
- package/tsconfig.json +1 -4
- package/types/artifacts.d.ts +6 -81
- package/types/audit.d.ts +1 -1
- package/types/lhr/settings.d.ts +1 -1
- package/core/audits/byte-efficiency/duplicated-javascript.d.ts +0 -45
- package/core/audits/byte-efficiency/duplicated-javascript.js +0 -223
- package/core/audits/byte-efficiency/efficient-animated-content.d.ts +0 -22
- package/core/audits/byte-efficiency/efficient-animated-content.js +0 -93
- package/core/audits/byte-efficiency/legacy-javascript.d.ts +0 -28
- package/core/audits/byte-efficiency/legacy-javascript.js +0 -144
- package/core/audits/byte-efficiency/modern-image-formats.d.ts +0 -38
- package/core/audits/byte-efficiency/modern-image-formats.js +0 -187
- package/core/audits/byte-efficiency/offscreen-images.d.ts +0 -63
- package/core/audits/byte-efficiency/offscreen-images.js +0 -240
- package/core/audits/byte-efficiency/render-blocking-resources.d.ts +0 -53
- package/core/audits/byte-efficiency/render-blocking-resources.js +0 -312
- package/core/audits/byte-efficiency/uses-long-cache-ttl.d.ts +0 -59
- package/core/audits/byte-efficiency/uses-long-cache-ttl.js +0 -293
- package/core/audits/byte-efficiency/uses-optimized-images.d.ts +0 -33
- package/core/audits/byte-efficiency/uses-optimized-images.js +0 -146
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.d.ts +0 -16
- package/core/audits/byte-efficiency/uses-responsive-images-snapshot.js +0 -106
- package/core/audits/byte-efficiency/uses-responsive-images.d.ts +0 -44
- package/core/audits/byte-efficiency/uses-responsive-images.js +0 -202
- package/core/audits/byte-efficiency/uses-text-compression.d.ts +0 -14
- package/core/audits/byte-efficiency/uses-text-compression.js +0 -108
- package/core/audits/critical-request-chains.d.ts +0 -44
- package/core/audits/critical-request-chains.js +0 -221
- package/core/audits/dobetterweb/dom-size.d.ts +0 -32
- package/core/audits/dobetterweb/dom-size.js +0 -182
- package/core/audits/dobetterweb/no-document-write.d.ts +0 -16
- package/core/audits/dobetterweb/no-document-write.js +0 -86
- package/core/audits/dobetterweb/uses-http2.d.ts +0 -72
- package/core/audits/dobetterweb/uses-http2.js +0 -276
- package/core/audits/dobetterweb/uses-passive-event-listeners.d.ts +0 -16
- package/core/audits/dobetterweb/uses-passive-event-listeners.js +0 -69
- package/core/audits/font-display.d.ts +0 -32
- package/core/audits/font-display.js +0 -195
- package/core/audits/largest-contentful-paint-element.d.ts +0 -34
- package/core/audits/largest-contentful-paint-element.js +0 -181
- package/core/audits/lcp-lazy-loaded.d.ts +0 -22
- package/core/audits/lcp-lazy-loaded.js +0 -115
- package/core/audits/metrics/first-meaningful-paint.d.ts +0 -12
- package/core/audits/metrics/first-meaningful-paint.js +0 -47
- package/core/audits/preload-fonts.d.ts +0 -25
- package/core/audits/preload-fonts.js +0 -97
- package/core/audits/prioritize-lcp-image.d.ts +0 -74
- package/core/audits/prioritize-lcp-image.js +0 -297
- package/core/audits/seo/font-size.d.ts +0 -24
- package/core/audits/seo/font-size.js +0 -344
- package/core/audits/third-party-facades.d.ts +0 -41
- package/core/audits/third-party-facades.js +0 -234
- package/core/audits/third-party-summary.d.ts +0 -78
- package/core/audits/third-party-summary.js +0 -236
- package/core/audits/uses-rel-preconnect.d.ts +0 -37
- package/core/audits/uses-rel-preconnect.js +0 -286
- package/core/audits/uses-rel-preload.d.ts +0 -57
- package/core/audits/uses-rel-preload.js +0 -263
- package/core/audits/viewport.d.ts +0 -17
- package/core/audits/viewport.js +0 -87
- package/core/audits/work-during-interaction.d.ts +0 -81
- package/core/audits/work-during-interaction.js +0 -287
- package/core/computed/critical-request-chains.d.ts +0 -42
- package/core/computed/critical-request-chains.js +0 -143
- package/core/computed/viewport-meta.d.ts +0 -37
- package/core/computed/viewport-meta.js +0 -71
- package/core/gather/gatherers/cache-contents.d.ts +0 -11
- package/core/gather/gatherers/cache-contents.js +0 -56
- package/core/gather/gatherers/devtools-log-compat.d.ts +0 -13
- package/core/gather/gatherers/devtools-log-compat.js +0 -35
- package/core/gather/gatherers/dobetterweb/domstats.d.ts +0 -10
- package/core/gather/gatherers/dobetterweb/domstats.js +0 -102
- package/core/gather/gatherers/dobetterweb/optimized-images.d.ts +0 -48
- package/core/gather/gatherers/dobetterweb/optimized-images.js +0 -169
- package/core/gather/gatherers/dobetterweb/response-compression.d.ts +0 -23
- package/core/gather/gatherers/dobetterweb/response-compression.js +0 -136
- package/core/gather/gatherers/seo/font-size.d.ts +0 -131
- package/core/gather/gatherers/seo/font-size.js +0 -347
- package/core/gather/gatherers/trace-compat.d.ts +0 -13
- package/core/gather/gatherers/trace-compat.js +0 -35
- package/types/internal/metaviewport-parser.d.ts +0 -13
- package/types/internal/parse-cache-control.d.ts +0 -20
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
export default FontSize;
|
|
2
|
-
export type NodeFontData = LH.Artifacts.FontSize["analyzedFailingNodesData"][0];
|
|
3
|
-
export type BackendIdsToFontData = Map<number, {
|
|
4
|
-
fontSize: number;
|
|
5
|
-
textLength: number;
|
|
6
|
-
}>;
|
|
7
|
-
declare class FontSize extends BaseGatherer {
|
|
8
|
-
/**
|
|
9
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
10
|
-
* @param {Array<NodeFontData>} failingNodes
|
|
11
|
-
*/
|
|
12
|
-
static fetchFailingNodeSourceRules(session: LH.Gatherer.ProtocolSession, failingNodes: Array<NodeFontData>): Promise<{
|
|
13
|
-
analyzedFailingNodesData: {
|
|
14
|
-
nodeId: number;
|
|
15
|
-
fontSize: number;
|
|
16
|
-
textLength: number;
|
|
17
|
-
parentNode: {
|
|
18
|
-
backendNodeId: number;
|
|
19
|
-
attributes: string[];
|
|
20
|
-
nodeName: string;
|
|
21
|
-
parentNode?: {
|
|
22
|
-
backendNodeId: number;
|
|
23
|
-
attributes: string[];
|
|
24
|
-
nodeName: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
cssRule?: {
|
|
28
|
-
type: "Regular" | "Inline" | "Attributes";
|
|
29
|
-
range?: {
|
|
30
|
-
startLine: number;
|
|
31
|
-
startColumn: number;
|
|
32
|
-
};
|
|
33
|
-
parentRule?: {
|
|
34
|
-
origin: import("devtools-protocol").Protocol.CSS.StyleSheetOrigin;
|
|
35
|
-
selectors: {
|
|
36
|
-
text: string;
|
|
37
|
-
}[];
|
|
38
|
-
};
|
|
39
|
-
styleSheetId?: string;
|
|
40
|
-
stylesheet?: import("devtools-protocol").Protocol.CSS.CSSStyleSheetHeader;
|
|
41
|
-
cssProperties?: Array<import("devtools-protocol").Protocol.CSS.CSSProperty>;
|
|
42
|
-
};
|
|
43
|
-
}[];
|
|
44
|
-
analyzedFailingTextLength: number;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* Returns the TextNodes in a DOM Snapshot.
|
|
48
|
-
* Every entry is associated with a TextNode in the layout tree (not display: none).
|
|
49
|
-
* @param {LH.Crdp.DOMSnapshot.CaptureSnapshotResponse} snapshot
|
|
50
|
-
*/
|
|
51
|
-
getTextNodesInLayoutFromSnapshot(snapshot: LH.Crdp.DOMSnapshot.CaptureSnapshotResponse): {
|
|
52
|
-
nodeIndex: number;
|
|
53
|
-
backendNodeId: number;
|
|
54
|
-
fontSize: number;
|
|
55
|
-
visibility: string;
|
|
56
|
-
textLength: number;
|
|
57
|
-
parentNode: {
|
|
58
|
-
parentNode: {
|
|
59
|
-
backendNodeId: number;
|
|
60
|
-
attributes: string[];
|
|
61
|
-
nodeName: string;
|
|
62
|
-
} | undefined;
|
|
63
|
-
backendNodeId: number;
|
|
64
|
-
attributes: string[];
|
|
65
|
-
nodeName: string;
|
|
66
|
-
};
|
|
67
|
-
}[];
|
|
68
|
-
/**
|
|
69
|
-
* Get all the failing text nodes that don't meet the legible text threshold.
|
|
70
|
-
* @param {LH.Crdp.DOMSnapshot.CaptureSnapshotResponse} snapshot
|
|
71
|
-
*/
|
|
72
|
-
findFailingNodes(snapshot: LH.Crdp.DOMSnapshot.CaptureSnapshotResponse): {
|
|
73
|
-
totalTextLength: number;
|
|
74
|
-
failingTextLength: number;
|
|
75
|
-
failingNodes: {
|
|
76
|
-
nodeId: number;
|
|
77
|
-
fontSize: number;
|
|
78
|
-
textLength: number;
|
|
79
|
-
parentNode: {
|
|
80
|
-
backendNodeId: number;
|
|
81
|
-
attributes: string[];
|
|
82
|
-
nodeName: string;
|
|
83
|
-
parentNode?: {
|
|
84
|
-
backendNodeId: number;
|
|
85
|
-
attributes: string[];
|
|
86
|
-
nodeName: string;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
cssRule?: {
|
|
90
|
-
type: "Regular" | "Inline" | "Attributes";
|
|
91
|
-
range?: {
|
|
92
|
-
startLine: number;
|
|
93
|
-
startColumn: number;
|
|
94
|
-
};
|
|
95
|
-
parentRule?: {
|
|
96
|
-
origin: import("devtools-protocol").Protocol.CSS.StyleSheetOrigin;
|
|
97
|
-
selectors: {
|
|
98
|
-
text: string;
|
|
99
|
-
}[];
|
|
100
|
-
};
|
|
101
|
-
styleSheetId?: string;
|
|
102
|
-
stylesheet?: import("devtools-protocol").Protocol.CSS.CSSStyleSheetHeader;
|
|
103
|
-
cssProperties?: Array<import("devtools-protocol").Protocol.CSS.CSSProperty>;
|
|
104
|
-
};
|
|
105
|
-
}[];
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* @param {LH.Gatherer.Context} passContext
|
|
109
|
-
* @return {Promise<LH.Artifacts.FontSize>} font-size analysis
|
|
110
|
-
*/
|
|
111
|
-
getArtifact(passContext: LH.Gatherer.Context): Promise<LH.Artifacts.FontSize>;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Returns the governing/winning CSS font-size rule for the set of styles given.
|
|
115
|
-
* This is roughly a stripped down version of the CSSMatchedStyle class in DevTools.
|
|
116
|
-
*
|
|
117
|
-
* @see https://cs.chromium.org/chromium/src/third_party/blink/renderer/devtools/front_end/sdk/CSSMatchedStyles.js?q=CSSMatchedStyles+f:devtools+-f:out&sq=package:chromium&dr=C&l=59-134
|
|
118
|
-
* @param {LH.Crdp.CSS.GetMatchedStylesForNodeResponse} matched CSS rules
|
|
119
|
-
* @return {NodeFontData['cssRule']|undefined}
|
|
120
|
-
*/
|
|
121
|
-
export function getEffectiveFontRule({ attributesStyle, inlineStyle, matchedCSSRules, inherited }: LH.Crdp.CSS.GetMatchedStylesForNodeResponse): NodeFontData["cssRule"] | undefined;
|
|
122
|
-
/**
|
|
123
|
-
* Finds the most specific directly matched CSS font-size rule from the list.
|
|
124
|
-
*
|
|
125
|
-
* @param {Array<LH.Crdp.CSS.RuleMatch>} matchedCSSRules
|
|
126
|
-
* @param {function(LH.Crdp.CSS.CSSStyle):boolean|string|undefined} isDeclarationOfInterest
|
|
127
|
-
* @return {NodeFontData['cssRule']|undefined}
|
|
128
|
-
*/
|
|
129
|
-
export function findMostSpecificMatchedCSSRule(matchedCSSRules: Array<LH.Crdp.CSS.RuleMatch> | undefined, isDeclarationOfInterest: (arg0: LH.Crdp.CSS.CSSStyle) => boolean | string | undefined): NodeFontData["cssRule"] | undefined;
|
|
130
|
-
import BaseGatherer from '../../base-gatherer.js';
|
|
131
|
-
//# sourceMappingURL=font-size.d.ts.map
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview Extracts information about illegible text from the page.
|
|
9
|
-
*
|
|
10
|
-
* In effort to keep this audit's execution time around 1s, maximum number of protocol calls was limited.
|
|
11
|
-
* Firstly, number of visited nodes (text nodes for which font size was checked) is capped.
|
|
12
|
-
* Secondly, number of failing nodes that are analyzed (for which detailed CSS information is extracted) is also limited.
|
|
13
|
-
*
|
|
14
|
-
* The applicable CSS rule is also determined by the code here with some simplifications (namely !important is ignored).
|
|
15
|
-
* This gatherer collects stylesheet metadata by itself, instead of relying on the styles gatherer which is slow (because it parses the stylesheet content).
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import BaseGatherer from '../../base-gatherer.js';
|
|
19
|
-
|
|
20
|
-
const FONT_SIZE_PROPERTY_NAME = 'font-size';
|
|
21
|
-
const MINIMAL_LEGIBLE_FONT_SIZE_PX = 12;
|
|
22
|
-
// limit number of protocol calls to make sure that gatherer doesn't take more than 1-2s
|
|
23
|
-
const MAX_NODES_SOURCE_RULE_FETCHED = 50; // number of nodes to fetch the source font-size rule
|
|
24
|
-
|
|
25
|
-
/** @typedef {LH.Artifacts.FontSize['analyzedFailingNodesData'][0]} NodeFontData */
|
|
26
|
-
/** @typedef {Map<number, {fontSize: number, textLength: number}>} BackendIdsToFontData */
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {LH.Crdp.CSS.CSSStyle} [style]
|
|
30
|
-
* @return {boolean}
|
|
31
|
-
*/
|
|
32
|
-
function hasFontSizeDeclaration(style) {
|
|
33
|
-
return !!style && !!style.cssProperties.find(({name}) => name === FONT_SIZE_PROPERTY_NAME);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Finds the most specific directly matched CSS font-size rule from the list.
|
|
38
|
-
*
|
|
39
|
-
* @param {Array<LH.Crdp.CSS.RuleMatch>} matchedCSSRules
|
|
40
|
-
* @param {function(LH.Crdp.CSS.CSSStyle):boolean|string|undefined} isDeclarationOfInterest
|
|
41
|
-
* @return {NodeFontData['cssRule']|undefined}
|
|
42
|
-
*/
|
|
43
|
-
function findMostSpecificMatchedCSSRule(matchedCSSRules = [], isDeclarationOfInterest) {
|
|
44
|
-
let mostSpecificRule;
|
|
45
|
-
for (let i = matchedCSSRules.length - 1; i >= 0; i--) {
|
|
46
|
-
if (isDeclarationOfInterest(matchedCSSRules[i].rule.style)) {
|
|
47
|
-
mostSpecificRule = matchedCSSRules[i].rule;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (mostSpecificRule) {
|
|
53
|
-
return {
|
|
54
|
-
type: 'Regular',
|
|
55
|
-
...mostSpecificRule.style,
|
|
56
|
-
parentRule: {
|
|
57
|
-
origin: mostSpecificRule.origin,
|
|
58
|
-
selectors: mostSpecificRule.selectorList.selectors,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Finds the most specific directly matched CSS font-size rule from the list.
|
|
66
|
-
*
|
|
67
|
-
* @param {Array<LH.Crdp.CSS.InheritedStyleEntry>} [inheritedEntries]
|
|
68
|
-
* @return {NodeFontData['cssRule']|undefined}
|
|
69
|
-
*/
|
|
70
|
-
function findInheritedCSSRule(inheritedEntries = []) {
|
|
71
|
-
// The inherited array contains the array of matched rules for all parents in ascending tree order.
|
|
72
|
-
// i.e. for an element whose path is `html > body > #main > #nav > p`
|
|
73
|
-
// `inherited` will be an array of styles like `[#nav, #main, body, html]`
|
|
74
|
-
// The closest parent with font-size will win
|
|
75
|
-
for (const {inlineStyle, matchedCSSRules} of inheritedEntries) {
|
|
76
|
-
if (hasFontSizeDeclaration(inlineStyle)) return {type: 'Inline', ...inlineStyle};
|
|
77
|
-
|
|
78
|
-
const directRule = findMostSpecificMatchedCSSRule(matchedCSSRules, hasFontSizeDeclaration);
|
|
79
|
-
if (directRule) return directRule;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Returns the governing/winning CSS font-size rule for the set of styles given.
|
|
85
|
-
* This is roughly a stripped down version of the CSSMatchedStyle class in DevTools.
|
|
86
|
-
*
|
|
87
|
-
* @see https://cs.chromium.org/chromium/src/third_party/blink/renderer/devtools/front_end/sdk/CSSMatchedStyles.js?q=CSSMatchedStyles+f:devtools+-f:out&sq=package:chromium&dr=C&l=59-134
|
|
88
|
-
* @param {LH.Crdp.CSS.GetMatchedStylesForNodeResponse} matched CSS rules
|
|
89
|
-
* @return {NodeFontData['cssRule']|undefined}
|
|
90
|
-
*/
|
|
91
|
-
function getEffectiveFontRule({attributesStyle, inlineStyle, matchedCSSRules, inherited}) {
|
|
92
|
-
// Inline styles have highest priority
|
|
93
|
-
if (hasFontSizeDeclaration(inlineStyle)) return {type: 'Inline', ...inlineStyle};
|
|
94
|
-
|
|
95
|
-
// Rules directly referencing the node come next
|
|
96
|
-
const matchedRule = findMostSpecificMatchedCSSRule(matchedCSSRules, hasFontSizeDeclaration);
|
|
97
|
-
if (matchedRule) return matchedRule;
|
|
98
|
-
|
|
99
|
-
// Then comes attributes styles (<font size="1">)
|
|
100
|
-
if (hasFontSizeDeclaration(attributesStyle)) return {type: 'Attributes', ...attributesStyle};
|
|
101
|
-
|
|
102
|
-
// Finally, find an inherited property if there is one
|
|
103
|
-
const inheritedRule = findInheritedCSSRule(inherited);
|
|
104
|
-
if (inheritedRule) return inheritedRule;
|
|
105
|
-
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @param {string} text
|
|
111
|
-
* @return {number}
|
|
112
|
-
*/
|
|
113
|
-
function getTextLength(text) {
|
|
114
|
-
// Array.from to count symbols not unicode code points. See: #6973
|
|
115
|
-
return !text ? 0 : Array.from(text.trim()).length;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
120
|
-
* @param {number} nodeId text node
|
|
121
|
-
* @return {Promise<NodeFontData['cssRule']|undefined>}
|
|
122
|
-
*/
|
|
123
|
-
async function fetchSourceRule(session, nodeId) {
|
|
124
|
-
const matchedRules = await session.sendCommand('CSS.getMatchedStylesForNode', {
|
|
125
|
-
nodeId,
|
|
126
|
-
});
|
|
127
|
-
const sourceRule = getEffectiveFontRule(matchedRules);
|
|
128
|
-
if (!sourceRule) return undefined;
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
type: sourceRule.type,
|
|
132
|
-
range: sourceRule.range,
|
|
133
|
-
styleSheetId: sourceRule.styleSheetId,
|
|
134
|
-
parentRule: sourceRule.parentRule && {
|
|
135
|
-
origin: sourceRule.parentRule.origin,
|
|
136
|
-
selectors: sourceRule.parentRule.selectors,
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
class FontSize extends BaseGatherer {
|
|
142
|
-
/** @type {LH.Gatherer.GathererMeta} */
|
|
143
|
-
meta = {
|
|
144
|
-
supportedModes: ['snapshot', 'navigation'],
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @param {LH.Gatherer.ProtocolSession} session
|
|
149
|
-
* @param {Array<NodeFontData>} failingNodes
|
|
150
|
-
*/
|
|
151
|
-
static async fetchFailingNodeSourceRules(session, failingNodes) {
|
|
152
|
-
const nodesToAnalyze = failingNodes
|
|
153
|
-
.sort((a, b) => b.textLength - a.textLength)
|
|
154
|
-
.slice(0, MAX_NODES_SOURCE_RULE_FETCHED);
|
|
155
|
-
|
|
156
|
-
// DOM.getDocument is necessary for pushNodesByBackendIdsToFrontend to properly retrieve nodeIds if the `DOM` domain was enabled before this gatherer, invoke it to be safe.
|
|
157
|
-
await session.sendCommand('DOM.getDocument', {depth: -1, pierce: true});
|
|
158
|
-
|
|
159
|
-
const {nodeIds} = await session.sendCommand('DOM.pushNodesByBackendIdsToFrontend', {
|
|
160
|
-
backendNodeIds: nodesToAnalyze.map(node => node.parentNode.backendNodeId),
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
const analysisPromises = nodesToAnalyze
|
|
164
|
-
.map(async (failingNode, i) => {
|
|
165
|
-
failingNode.nodeId = nodeIds[i];
|
|
166
|
-
try {
|
|
167
|
-
const cssRule = await fetchSourceRule(session, nodeIds[i]);
|
|
168
|
-
failingNode.cssRule = cssRule;
|
|
169
|
-
} catch (err) {
|
|
170
|
-
// The node was deleted. We don't need to distinguish between lack-of-rule
|
|
171
|
-
// due to a deleted node vs due to failed attribution, so just set to undefined.
|
|
172
|
-
failingNode.cssRule = undefined;
|
|
173
|
-
}
|
|
174
|
-
return failingNode;
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
const analyzedFailingNodesData = await Promise.all(analysisPromises);
|
|
178
|
-
|
|
179
|
-
const analyzedFailingTextLength = analyzedFailingNodesData.reduce(
|
|
180
|
-
(sum, {textLength}) => (sum += textLength),
|
|
181
|
-
0
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
return {analyzedFailingNodesData, analyzedFailingTextLength};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Returns the TextNodes in a DOM Snapshot.
|
|
189
|
-
* Every entry is associated with a TextNode in the layout tree (not display: none).
|
|
190
|
-
* @param {LH.Crdp.DOMSnapshot.CaptureSnapshotResponse} snapshot
|
|
191
|
-
*/
|
|
192
|
-
getTextNodesInLayoutFromSnapshot(snapshot) {
|
|
193
|
-
const strings = snapshot.strings;
|
|
194
|
-
/** @param {number} index */
|
|
195
|
-
const getString = (index) => strings[index];
|
|
196
|
-
/** @param {number} index */
|
|
197
|
-
const getFloat = (index) => parseFloat(strings[index]);
|
|
198
|
-
|
|
199
|
-
const textNodesData = [];
|
|
200
|
-
for (let j = 0; j < snapshot.documents.length; j++) {
|
|
201
|
-
// `doc` is a flattened property list describing all the Nodes in a document, with all string
|
|
202
|
-
// values deduped in the `strings` array.
|
|
203
|
-
const doc = snapshot.documents[j];
|
|
204
|
-
|
|
205
|
-
if (!doc.nodes.backendNodeId || !doc.nodes.parentIndex ||
|
|
206
|
-
!doc.nodes.attributes || !doc.nodes.nodeName) {
|
|
207
|
-
throw new Error('Unexpected response from DOMSnapshot.captureSnapshot.');
|
|
208
|
-
}
|
|
209
|
-
const nodes = /** @type {Required<typeof doc['nodes']>} */ (doc.nodes);
|
|
210
|
-
|
|
211
|
-
/** @param {number} parentIndex */
|
|
212
|
-
const getParentData = (parentIndex) => ({
|
|
213
|
-
backendNodeId: nodes.backendNodeId[parentIndex],
|
|
214
|
-
attributes: nodes.attributes[parentIndex].map(getString),
|
|
215
|
-
nodeName: getString(nodes.nodeName[parentIndex]),
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
for (const layoutIndex of doc.textBoxes.layoutIndex) {
|
|
219
|
-
const text = strings[doc.layout.text[layoutIndex]];
|
|
220
|
-
if (!text) continue;
|
|
221
|
-
|
|
222
|
-
const nodeIndex = doc.layout.nodeIndex[layoutIndex];
|
|
223
|
-
const styles = doc.layout.styles[layoutIndex];
|
|
224
|
-
const [fontSizeStringId, visibilityStringId] = styles;
|
|
225
|
-
const fontSize = getFloat(fontSizeStringId);
|
|
226
|
-
const visibility = getString(visibilityStringId);
|
|
227
|
-
|
|
228
|
-
const parentIndex = nodes.parentIndex[nodeIndex];
|
|
229
|
-
const grandParentIndex = nodes.parentIndex[parentIndex];
|
|
230
|
-
const parentNode = getParentData(parentIndex);
|
|
231
|
-
const grandParentNode =
|
|
232
|
-
grandParentIndex !== undefined ? getParentData(grandParentIndex) : undefined;
|
|
233
|
-
|
|
234
|
-
textNodesData.push({
|
|
235
|
-
nodeIndex,
|
|
236
|
-
backendNodeId: nodes.backendNodeId[nodeIndex],
|
|
237
|
-
fontSize,
|
|
238
|
-
visibility,
|
|
239
|
-
textLength: getTextLength(text),
|
|
240
|
-
parentNode: {
|
|
241
|
-
...parentNode,
|
|
242
|
-
parentNode: grandParentNode,
|
|
243
|
-
},
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return textNodesData;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Get all the failing text nodes that don't meet the legible text threshold.
|
|
253
|
-
* @param {LH.Crdp.DOMSnapshot.CaptureSnapshotResponse} snapshot
|
|
254
|
-
*/
|
|
255
|
-
findFailingNodes(snapshot) {
|
|
256
|
-
/** @type {NodeFontData[]} */
|
|
257
|
-
const failingNodes = [];
|
|
258
|
-
let totalTextLength = 0;
|
|
259
|
-
let failingTextLength = 0;
|
|
260
|
-
|
|
261
|
-
for (const textNodeData of this.getTextNodesInLayoutFromSnapshot(snapshot)) {
|
|
262
|
-
if (textNodeData.visibility === 'hidden') {
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
totalTextLength += textNodeData.textLength;
|
|
267
|
-
|
|
268
|
-
if (textNodeData.fontSize >= MINIMAL_LEGIBLE_FONT_SIZE_PX) {
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Once a bad TextNode is identified, its parent Node is needed.
|
|
273
|
-
failingTextLength += textNodeData.textLength;
|
|
274
|
-
failingNodes.push({
|
|
275
|
-
nodeId: 0, // Set later in fetchFailingNodeSourceRules.
|
|
276
|
-
parentNode: textNodeData.parentNode,
|
|
277
|
-
textLength: textNodeData.textLength,
|
|
278
|
-
fontSize: textNodeData.fontSize,
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return {totalTextLength, failingTextLength, failingNodes};
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* @param {LH.Gatherer.Context} passContext
|
|
287
|
-
* @return {Promise<LH.Artifacts.FontSize>} font-size analysis
|
|
288
|
-
*/
|
|
289
|
-
async getArtifact(passContext) {
|
|
290
|
-
const session = passContext.driver.defaultSession;
|
|
291
|
-
|
|
292
|
-
/** @type {Map<string, LH.Crdp.CSS.CSSStyleSheetHeader>} */
|
|
293
|
-
const stylesheets = new Map();
|
|
294
|
-
/** @param {LH.Crdp.CSS.StyleSheetAddedEvent} sheet */
|
|
295
|
-
const onStylesheetAdded = sheet => stylesheets.set(sheet.header.styleSheetId, sheet.header);
|
|
296
|
-
session.on('CSS.styleSheetAdded', onStylesheetAdded);
|
|
297
|
-
|
|
298
|
-
await Promise.all([
|
|
299
|
-
session.sendCommand('DOMSnapshot.enable'),
|
|
300
|
-
session.sendCommand('DOM.enable'),
|
|
301
|
-
session.sendCommand('CSS.enable'),
|
|
302
|
-
]);
|
|
303
|
-
|
|
304
|
-
// Get the computed font-size style of every node.
|
|
305
|
-
const snapshot = await session.sendCommand('DOMSnapshot.captureSnapshot', {
|
|
306
|
-
computedStyles: ['font-size', 'visibility'],
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
const {
|
|
310
|
-
totalTextLength,
|
|
311
|
-
failingTextLength,
|
|
312
|
-
failingNodes,
|
|
313
|
-
} = this.findFailingNodes(snapshot);
|
|
314
|
-
const {
|
|
315
|
-
analyzedFailingNodesData,
|
|
316
|
-
analyzedFailingTextLength,
|
|
317
|
-
} = await FontSize.fetchFailingNodeSourceRules(session, failingNodes);
|
|
318
|
-
|
|
319
|
-
session.off('CSS.styleSheetAdded', onStylesheetAdded);
|
|
320
|
-
|
|
321
|
-
// For the nodes whose computed style we could attribute to a stylesheet, assign
|
|
322
|
-
// the stylsheet to the data.
|
|
323
|
-
analyzedFailingNodesData
|
|
324
|
-
.filter(data => data.cssRule?.styleSheetId)
|
|
325
|
-
// @ts-expect-error - guaranteed to exist from the filter immediately above
|
|
326
|
-
.forEach(data => (data.cssRule.stylesheet = stylesheets.get(data.cssRule.styleSheetId)));
|
|
327
|
-
|
|
328
|
-
await Promise.all([
|
|
329
|
-
session.sendCommand('DOMSnapshot.disable'),
|
|
330
|
-
session.sendCommand('DOM.disable'),
|
|
331
|
-
session.sendCommand('CSS.disable'),
|
|
332
|
-
]);
|
|
333
|
-
|
|
334
|
-
return {
|
|
335
|
-
analyzedFailingNodesData,
|
|
336
|
-
analyzedFailingTextLength,
|
|
337
|
-
failingTextLength,
|
|
338
|
-
totalTextLength,
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
export default FontSize;
|
|
344
|
-
export {
|
|
345
|
-
getEffectiveFontRule,
|
|
346
|
-
findMostSpecificMatchedCSSRule,
|
|
347
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default TraceCompat;
|
|
2
|
-
/** @implements {LH.Gatherer.GathererInstance<'Trace'>} */
|
|
3
|
-
declare class TraceCompat extends BaseGatherer implements LH.Gatherer.GathererInstance<"Trace"> {
|
|
4
|
-
/** @type {LH.Gatherer.GathererMeta<'Trace'>} */
|
|
5
|
-
meta: LH.Gatherer.GathererMeta<"Trace">;
|
|
6
|
-
/**
|
|
7
|
-
* @param {LH.Gatherer.Context<'Trace'>} passContext
|
|
8
|
-
* @return {Promise<LH.Artifacts['traces']>}
|
|
9
|
-
*/
|
|
10
|
-
getArtifact(passContext: LH.Gatherer.Context<"Trace">): Promise<LH.Artifacts["traces"]>;
|
|
11
|
-
}
|
|
12
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
13
|
-
//# sourceMappingURL=trace-compat.d.ts.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview
|
|
9
|
-
* This gatherer remaps the result of the Trace gatherer for compatibility with legacy Lighthouse
|
|
10
|
-
* when devtools logs and traces were special-cased.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import TraceGatherer from './trace.js';
|
|
14
|
-
import BaseGatherer from '../base-gatherer.js';
|
|
15
|
-
|
|
16
|
-
/** @implements {LH.Gatherer.GathererInstance<'Trace'>} */
|
|
17
|
-
class TraceCompat extends BaseGatherer {
|
|
18
|
-
/** @type {LH.Gatherer.GathererMeta<'Trace'>} */
|
|
19
|
-
meta = {
|
|
20
|
-
supportedModes: ['timespan', 'navigation'],
|
|
21
|
-
dependencies: {Trace: TraceGatherer.symbol},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @param {LH.Gatherer.Context<'Trace'>} passContext
|
|
26
|
-
* @return {Promise<LH.Artifacts['traces']>}
|
|
27
|
-
*/
|
|
28
|
-
async getArtifact(passContext) {
|
|
29
|
-
return {
|
|
30
|
-
defaultPass: passContext.dependencies.Trace,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default TraceCompat;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2018 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
declare module 'metaviewport-parser' {
|
|
8
|
-
export function parseMetaViewPortContent(S: string): {
|
|
9
|
-
validProperties: {[p: string]: number | string},
|
|
10
|
-
unknownProperties: {[p: string]: number | string},
|
|
11
|
-
invalidValues: {[p: string]: number | string};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
declare module 'parse-cache-control' {
|
|
8
|
-
// Follows the potential settings of cache-control, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
|
9
|
-
interface CacheHeaders {
|
|
10
|
-
'max-age'?: number;
|
|
11
|
-
'must-revalidate'?: boolean;
|
|
12
|
-
'no-cache'?: boolean;
|
|
13
|
-
'no-store'?: boolean;
|
|
14
|
-
'private'?: boolean;
|
|
15
|
-
'stale-while-revalidate'?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function ParseCacheControl(headers?: string): CacheHeaders | null;
|
|
19
|
-
export = ParseCacheControl;
|
|
20
|
-
}
|