svelte-vitals 0.13.0 → 0.14.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/dist/bin.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  knownRuleIds,
7
7
  readPackageVersion,
8
8
  run
9
- } from "./chunk-Y4JY3ODE.js";
9
+ } from "./chunk-YMRN4VPN.js";
10
10
 
11
11
  // src/bin.ts
12
12
  import mri from "mri";
@@ -247,6 +247,7 @@ function tagsFromHead(head) {
247
247
  const asLiteral = attrText(node.attributes, "as");
248
248
  const hasCrossorigin = findAttr(node.attributes, "crossorigin") !== void 0;
249
249
  const hreflang = attrText(node.attributes, "hreflang");
250
+ const href = attrText(node.attributes, "href");
250
251
  tags.push({
251
252
  kind: "link",
252
253
  ...rel ? { rel } : {},
@@ -255,12 +256,22 @@ function tagsFromHead(head) {
255
256
  ...asLiteral ? { as: asLiteral } : {},
256
257
  ...hasCrossorigin ? { hasCrossorigin: true } : {},
257
258
  // Keep a literal empty hreflang="" (present-but-invalid) so SEO026 can flag it.
258
- ...hreflang !== void 0 ? { hreflang } : {}
259
+ ...hreflang !== void 0 ? { hreflang } : {},
260
+ ...href ? { href } : {}
259
261
  });
260
- } else if (node.name === "script" && attrText(node.attributes, "type") === "application/ld+json") {
261
- const nodes = node.fragment?.nodes ?? [];
262
- const raw = textFromNodes(nodes);
263
- tags.push({ kind: "jsonld", value: valueFromNodes(nodes), ...raw !== void 0 ? { jsonld: raw } : {} });
262
+ } else if (node.name === "script") {
263
+ const type = attrText(node.attributes, "type");
264
+ if (type === "application/ld+json") {
265
+ const nodes = node.fragment?.nodes ?? [];
266
+ const raw = textFromNodes(nodes);
267
+ tags.push({ kind: "jsonld", value: valueFromNodes(nodes), ...raw !== void 0 ? { jsonld: raw } : {} });
268
+ } else {
269
+ const src = attrText(node.attributes, "src");
270
+ if (src) {
271
+ const blocking = findAttr(node.attributes, "defer") === void 0 && findAttr(node.attributes, "async") === void 0 && type !== "module";
272
+ tags.push({ kind: "script", value: "static", href: src, ...blocking ? { blocking: true } : {} });
273
+ }
274
+ }
264
275
  }
265
276
  }
266
277
  return tags;
@@ -310,6 +321,9 @@ function collectImages(node, source, acc) {
310
321
  hasHeight: hasSpread || Boolean(findAttr(attrs, "height")),
311
322
  hasLoading: hasSpread || Boolean(findAttr(attrs, "loading")),
312
323
  hasAlt: hasSpread || Boolean(findAttr(attrs, "alt")),
324
+ // A literal loading="lazy" only — a spread or dynamic loading={…} must not be flagged.
325
+ lazy: attrText(attrs, "loading") === "lazy",
326
+ hasSrcset: hasSpread || Boolean(findAttr(attrs, "srcset")),
313
327
  line: lineOf(source, node.start)
314
328
  });
315
329
  }
@@ -443,6 +457,8 @@ function tagKey(tag) {
443
457
  return `link:${tag.rel ?? "?"}`;
444
458
  case "jsonld":
445
459
  return "jsonld";
460
+ case "script":
461
+ return `script:${tag.href ?? "?"}`;
446
462
  }
447
463
  }
448
464
  function resolveComponentPath(source, fromFileRel) {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  knownRuleIds,
7
7
  routeMatcher,
8
8
  run
9
- } from "./chunk-Y4JY3ODE.js";
9
+ } from "./chunk-YMRN4VPN.js";
10
10
  export {
11
11
  ProjectError,
12
12
  analyzeProject,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-vitals",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "A SvelteKit SEO checker — not a runtime Web Vitals reporter. Static analysis of your routes' head metadata.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "mri": "^1.2.0",
43
43
  "svelte": "^5.56.3",
44
44
  "tinyglobby": "^0.2.17",
45
- "@svelte-vitals/core": "0.14.0"
45
+ "@svelte-vitals/core": "0.15.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^24.7.0"