Skip to content

Commit 24e4171

Browse files
committed
fix(webperf-core-web-vitals): consistent Subparts naming
Rename LCP-SubParts.js → LCP-Subparts.js, update internal script identifier ("LCP-Sub-Parts" → "LCP-Subparts"), rename calcSubParts → calcSubparts, and fix all remaining LCP-Sub-Parts references in SKILL.md
1 parent 8d84a7d commit 24e4171

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

skills/webperf-core-web-vitals/SKILL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ JavaScript snippets for measuring web performance in Chrome DevTools. Execute wi
1212

1313
- `scripts/CLS.js` — Cumulative Layout Shift (CLS)
1414
- `scripts/INP.js` — Interaction to Next Paint (INP)
15-
- `scripts/LCP-Sub-Parts.js` — LCP Sub-Parts
15+
- `scripts/LCP-Subparts.js` — LCP Subparts
1616
- `scripts/LCP-Trail.js` — LCP Trail
1717
- `scripts/LCP-Video-Candidate.js` — LCP Video Candidate
1818
- `scripts/LCP.js` — Largest Contentful Paint (LCP)
@@ -23,7 +23,7 @@ Descriptions, thresholds, and return schemas: `references/snippets.md`, `referen
2323

2424
Scripts fall into two execution patterns:
2525

26-
### Synchronous (LCP, CLS, LCP-Sub-Parts, LCP-Trail, LCP-Video-Candidate)
26+
### Synchronous (LCP, CLS, LCP-Subparts, LCP-Trail, LCP-Video-Candidate)
2727

2828
Run via `evaluate_script` and return structured JSON immediately from buffered performance data. The page must have already loaded.
2929

@@ -97,7 +97,7 @@ Use this decision tree to automatically run follow-up snippets based on results:
9797

9898
### After LCP.js
9999

100-
- **If LCP > 2.5s** → Run **LCP-Sub-Parts.js** to diagnose which phase is slow
100+
- **If LCP > 2.5s** → Run **LCP-Subparts.js** to diagnose which phase is slow
101101
- **If LCP > 4.0s (poor)** → Run full LCP deep dive workflow
102102
- **If LCP candidate is a video** → Run **LCP-Video-Candidate.js**
103103
- **Always run****LCP-Trail.js** to understand candidate evolution
@@ -136,7 +136,7 @@ Use this decision tree to automatically run follow-up snippets based on results:
136136

137137
When a script returns `status: "error"`:
138138

139-
- **LCP/CLS/LCP-Sub-Parts/LCP-Trail** → The page may not have finished loading. Ask the user to wait for full load or reload, then re-run the script.
139+
- **LCP/CLS/LCP-Subparts/LCP-Trail** → The page may not have finished loading. Ask the user to wait for full load or reload, then re-run the script.
140140
- **INP** (`getINP()` returns error) → No interactions have been recorded yet. Remind the user to interact with the page, then call `getINP()` again.
141141
- **LCP-Video-Candidate** → No LCP entries found; see LCP error recovery above.
142142

@@ -149,4 +149,4 @@ window.__cwvHighlight = false;
149149
// then run any LCP script
150150
```
151151

152-
Scripts that support this flag: `LCP.js`, `LCP-Sub-Parts.js`, `LCP-Trail.js`.
152+
Scripts that support this flag: `LCP.js`, `LCP-Subparts.js`, `LCP-Trail.js`.

skills/webperf-core-web-vitals/scripts/LCP-SubParts.js renamed to skills/webperf-core-web-vitals/scripts/LCP-Subparts.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
return null;
2020
};
2121

22-
const calcSubParts = (lcpEntry, navEntry) => {
22+
const calcSubparts = (lcpEntry, navEntry) => {
2323
const lcpResEntry = performance
2424
.getEntriesByType("resource")
2525
.find((e) => e.name === lcpEntry.url);
@@ -44,7 +44,7 @@
4444
const navEntry = getNavigationEntry();
4545
if (!navEntry) return;
4646

47-
const { ttfb, lcpRequestStart, lcpResponseEnd, total } = calcSubParts(lcpEntry, navEntry);
47+
const { ttfb, lcpRequestStart, lcpResponseEnd, total } = calcSubparts(lcpEntry, navEntry);
4848

4949
if (HIGHLIGHT && lcpEntry.element) {
5050
lcpEntry.element.style.outline = "3px dashed lime";
@@ -72,14 +72,14 @@
7272
// Synchronous return for agent (buffered entries)
7373
const lcpEntry = performance.getEntriesByType("largest-contentful-paint").at(-1);
7474
if (!lcpEntry) {
75-
return { script: "LCP-Sub-Parts", status: "error", error: "No LCP entries yet" };
75+
return { script: "LCP-Subparts", status: "error", error: "No LCP entries yet" };
7676
}
7777
const navEntry = getNavigationEntry();
7878
if (!navEntry) {
79-
return { script: "LCP-Sub-Parts", status: "error", error: "No navigation entry" };
79+
return { script: "LCP-Subparts", status: "error", error: "No navigation entry" };
8080
}
8181

82-
const { ttfb, lcpRequestStart, lcpResponseEnd, total } = calcSubParts(lcpEntry, navEntry);
82+
const { ttfb, lcpRequestStart, lcpResponseEnd, total } = calcSubparts(lcpEntry, navEntry);
8383
const totalMs = Math.round(total);
8484
const ttfbVal = Math.round(ttfb);
8585
const loadDelayVal = Math.round(lcpRequestStart - ttfb);
@@ -105,7 +105,7 @@
105105
}
106106

107107
return {
108-
script: "LCP-Sub-Parts",
108+
script: "LCP-Subparts",
109109
status: "ok",
110110
metric: "LCP",
111111
value: totalMs,

0 commit comments

Comments
 (0)