@a.incantalupo/web-tools 0.3.1 → 0.4.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.
@@ -16,11 +16,14 @@ const METRICS = {
16
16
  speedIndexMs: "speed-index",
17
17
  ttfbMs: "server-response-time",
18
18
  };
19
- /** The node of the "Largest Contentful Paint element" audit: a list whose first table holds it. */
19
+ /**
20
+ * The LCP element, from Lighthouse 13's "LCP breakdown" insight: a list whose items are
21
+ * the subparts table and the element's node (`type: "node"`).
22
+ */
20
23
  function lcpElementOf(details) {
21
- const lists = details?.items ??
22
- [];
23
- const node = lists.flatMap((l) => l.items ?? []).find((i) => i.node)?.node;
24
+ const items = details
25
+ ?.items ?? [];
26
+ const node = items.find((i) => i?.type === "node");
24
27
  if (!node?.selector && !node?.snippet)
25
28
  return null;
26
29
  const snippet = (node.snippet ?? "").replace(/\s+/g, " ");
@@ -148,7 +151,7 @@ export async function runLighthouse(urls, outDir, times = 1) {
148
151
  error: lhr.runtimeError?.message ?? metricError ?? null,
149
152
  reportFile,
150
153
  screenshot,
151
- lcpElement: lcpElementOf(lhr.audits["largest-contentful-paint-element"]?.details),
154
+ lcpElement: lcpElementOf(lhr.audits["lcp-breakdown-insight"]?.details),
152
155
  },
153
156
  });
154
157
  }
package/package.json CHANGED
@@ -1,17 +1,27 @@
1
1
  {
2
2
  "name": "@a.incantalupo/web-tools",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Checks and captures for any website: readability and contrast, screenshots, style snapshots and diffs, glyph and image checks, a site audit with niche profiles, your own signed-in browser.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "stack-tools": "dist/cli.js"
8
8
  },
9
9
  "exports": {
10
- ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
11
- "./audit": { "types": "./dist/audit/index.d.ts", "default": "./dist/audit/index.js" }
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./audit": {
15
+ "types": "./dist/audit/index.d.ts",
16
+ "default": "./dist/audit/index.js"
17
+ }
12
18
  },
13
- "files": ["dist", "README.md"],
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
14
23
  "license": "MIT",
24
+ "engines": { "node": ">=22.19" },
15
25
  "repository": {
16
26
  "type": "git",
17
27
  "url": "git+https://github.com/Alessandro-Incantalupo/web-stack-kb.git",
@@ -25,7 +35,7 @@
25
35
  "dependencies": {
26
36
  "cheerio": "^1.1.0",
27
37
  "chrome-launcher": "^1.2.0",
28
- "lighthouse": "^12.8.0",
38
+ "lighthouse": "^13.6.0",
29
39
  "playwright-core": "1.56.1"
30
40
  },
31
41
  "devDependencies": {