webperf-snippets 0.1.0 → 0.3.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/README.md +185 -20
- package/package.json +1 -1
- package/snippets/CoreWebVitals/CLS.js +29 -15
- package/snippets/CoreWebVitals/INP.js +14 -7
- package/snippets/CoreWebVitals/LCP-Image-Entropy.js +29 -11
- package/snippets/CoreWebVitals/LCP-Subparts.js +4 -0
- package/snippets/CoreWebVitals/LCP-Trail.js +14 -3
- package/snippets/CoreWebVitals/LCP-Video-Candidate.js +20 -2
- package/snippets/CoreWebVitals/LCP.js +4 -2
- package/snippets/DevTools-Overrides/Fetch-XHR-Timeline-read.js +9 -2
- package/snippets/Interaction/DOM-Size-and-Depth.js +134 -0
- package/snippets/Interaction/Forced-Synchronous-Layout.js +33 -7
- package/snippets/Interaction/Input-Latency-Breakdown.js +45 -1
- package/snippets/Interaction/Interactions.js +16 -5
- package/snippets/Interaction/Layout-Shift-Loading-and-Interaction.js +44 -13
- package/snippets/Interaction/Long-Animation-Frames-Helpers.js +28 -1
- package/snippets/Interaction/Long-Animation-Frames-Script-Attribution.js +8 -0
- package/snippets/Interaction/Long-Animation-Frames.js +31 -2
- package/snippets/Interaction/LongTask.js +37 -5
- package/snippets/Interaction/Scroll-Performance.js +40 -0
- package/snippets/Interaction/WORKFLOWS.md +9 -0
- package/snippets/Loading/Back-Forward-Cache.js +174 -381
- package/snippets/Loading/CSS-Media-Queries-Analysis.js +76 -44
- package/snippets/Loading/Cache-Strategy-Analysis.js +52 -30
- package/snippets/Loading/Compression-Audit.js +172 -0
- package/snippets/Loading/Content-Visibility.js +8 -3
- package/snippets/Loading/Critical-CSS-Detection.js +8 -6
- package/snippets/Loading/Event-Processing-Time.js +15 -2
- package/snippets/Loading/FCP.js +39 -5
- package/snippets/Loading/Find-Above-The-Fold-Lazy-Loaded-Images.js +1 -1
- package/snippets/Loading/Find-non-Lazy-Loaded-Images-outside-of-the-viewport.js +7 -5
- package/snippets/Loading/Find-render-blocking-resources.js +11 -13
- package/snippets/Loading/First-And-Third-Party-Script-Info.js +40 -20
- package/snippets/Loading/First-And-Third-Party-Script-Timings.js +21 -13
- package/snippets/Loading/Fonts-Preloaded-Loaded-and-used-above-the-fold.js +35 -4
- package/snippets/Loading/Inline-CSS-Info-and-Size.js +8 -6
- package/snippets/Loading/Inline-Script-Info-and-Size.js +14 -7
- package/snippets/Loading/JS-Execution-Time-Breakdown.js +23 -10
- package/snippets/Loading/Priority-Hints-Audit.js +4 -1
- package/snippets/Loading/Resource-Hints-Validation.js +15 -0
- package/snippets/Loading/Resource-Hints.js +29 -8
- package/snippets/Loading/SSR-Hydration-Data-Analysis.js +77 -8
- package/snippets/Loading/Script-Loading.js +55 -25
- package/snippets/Loading/Server-Timing-Early-Hints.js +126 -0
- package/snippets/Loading/Service-Worker-Analysis.js +229 -53
- package/snippets/Loading/Speculation-Rules-Inspector.js +134 -0
- package/snippets/Loading/TTFB-Resources.js +59 -18
- package/snippets/Loading/TTFB-Sub-Parts.js +9 -2
- package/snippets/Loading/TTFB.js +3 -2
- package/snippets/Loading/Third-Party-Impact-by-Domain.js +216 -0
- package/snippets/Loading/Validate-Preload-Async-Defer-Scripts.js +21 -3
- package/snippets/Loading/WORKFLOWS.md +47 -1
- package/snippets/Loading/Webfont-Usage-Analyzer.js +332 -0
- package/snippets/Media/Image-Element-Audit.js +22 -3
- package/snippets/Media/Oversized-Images.js +217 -0
- package/snippets/Media/SVG-Embedded-Bitmap-Analysis.js +18 -3
- package/snippets/Media/WORKFLOWS.md +22 -0
- package/snippets/Resources/Network-Bandwidth-Connection-Quality.js +7 -0
- package/snippets/SCHEMA.md +1176 -0
- package/snippets/_shared/helpers.js +44 -0
- package/src/bin.js +86 -57
- package/src/crux.js +84 -0
- package/src/decision-tree.js +11 -1
- package/src/interactions.js +30 -0
- package/src/report-to.js +46 -0
- package/src/reporters/human.js +20 -1
- package/src/reporters/markdown.js +103 -0
- package/src/runner.js +81 -17
- package/src/workflows/loading.js +14 -0
|
@@ -19,6 +19,15 @@ When the user asks "optimize images" or "check image performance":
|
|
|
19
19
|
- Find-Images-With-Lazy-and-Fetchpriority.js (contradictory attributes)
|
|
20
20
|
- Priority-Hints-Audit.js (LCP image should have fetchpriority="high")
|
|
21
21
|
|
|
22
|
+
### Oversized Images Audit
|
|
23
|
+
|
|
24
|
+
When the user asks about images larger than needed, wasted bytes, blurry images, or `srcset`/`sizes` problems:
|
|
25
|
+
|
|
26
|
+
1. **Oversized-Images.js** - Compare each image file with the pixels drawn (oversized and undersized)
|
|
27
|
+
2. **Image-Element-Audit.js** - Check format, lazy loading and `srcset` usage of the flagged images
|
|
28
|
+
3. Cross-reference with **webperf-core-web-vitals** skill:
|
|
29
|
+
- LCP.js (check whether an oversized image is the LCP element)
|
|
30
|
+
|
|
22
31
|
### Video Performance Audit
|
|
23
32
|
|
|
24
33
|
When the user asks "optimize videos" or "check video performance":
|
|
@@ -106,6 +115,19 @@ Use this decision tree to automatically run follow-up snippets based on results:
|
|
|
106
115
|
|
|
107
116
|
- **If images missing alt text** → Accessibility issue, recommend adding descriptive alt text
|
|
108
117
|
|
|
118
|
+
### After Oversized-Images.js
|
|
119
|
+
|
|
120
|
+
- **If oversized images found** → Recommend:
|
|
121
|
+
- `srcset` with several widths and an accurate `sizes` attribute
|
|
122
|
+
- Resizing at build time or with an image CDN
|
|
123
|
+
- Run **Image-Element-Audit.js** to check format and lazy loading of the same images
|
|
124
|
+
|
|
125
|
+
- **If an oversized image is the LCP element** → Run **webperf-core-web-vitals:LCP.js** and **LCP-Subparts.js** (large files inflate resource load duration)
|
|
126
|
+
|
|
127
|
+
- **If undersized (blurry) images found** → Recommend a source with at least the needed pixels and a `2x` candidate for high-density screens
|
|
128
|
+
|
|
129
|
+
- **If skipped images are lazy-loaded** → Scroll to the end of the page and run the snippet again
|
|
130
|
+
|
|
109
131
|
### After Video-Element-Audit.js
|
|
110
132
|
|
|
111
133
|
- **If video is LCP candidate** → Run:
|
|
@@ -89,9 +89,16 @@
|
|
|
89
89
|
|
|
90
90
|
console.groupEnd();
|
|
91
91
|
|
|
92
|
+
const connectionRating =
|
|
93
|
+
effectiveType === "4g" ? "good"
|
|
94
|
+
: effectiveType === "3g" ? "needs-improvement"
|
|
95
|
+
: effectiveType === "2g" || effectiveType === "slow-2g" ? "poor"
|
|
96
|
+
: undefined;
|
|
97
|
+
|
|
92
98
|
return {
|
|
93
99
|
script: "Network-Bandwidth-Connection-Quality",
|
|
94
100
|
status: "ok",
|
|
101
|
+
...(connectionRating !== undefined ? { rating: connectionRating } : {}),
|
|
95
102
|
details: {
|
|
96
103
|
effectiveType,
|
|
97
104
|
downlink: connection.downlink,
|