@svelte-vitals/vite 0.7.0 → 0.8.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.
@@ -45,19 +45,22 @@ function parseHtmlHead(html) {
45
45
  const asAttr = link.getAttribute("as");
46
46
  const hasCrossorigin = link.hasAttribute("crossorigin");
47
47
  const hreflang = link.getAttribute("hreflang");
48
+ const href = link.getAttribute("href");
48
49
  tags.push({
49
50
  kind: "link",
50
51
  rel,
51
52
  presence: "own",
52
- value: attrValue(link.getAttribute("href")),
53
+ value: attrValue(href),
53
54
  ...asAttr != null ? { hasAs: true, as: asAttr } : {},
54
55
  ...hasCrossorigin ? { hasCrossorigin: true } : {},
55
56
  // Keep a literal empty hreflang="" (present-but-invalid) so SEO026 can flag it.
56
- ...hreflang != null ? { hreflang } : {}
57
+ ...hreflang != null ? { hreflang } : {},
58
+ ...href ? { href } : {}
57
59
  });
58
60
  }
59
61
  for (const script of head.querySelectorAll("script")) {
60
- if (script.getAttribute("type") === "application/ld+json") {
62
+ const type = script.getAttribute("type");
63
+ if (type === "application/ld+json") {
61
64
  const raw = script.rawText;
62
65
  tags.push({
63
66
  kind: "jsonld",
@@ -65,6 +68,18 @@ function parseHtmlHead(html) {
65
68
  value: attrValue(raw),
66
69
  ...raw && raw.trim().length > 0 ? { jsonld: raw } : {}
67
70
  });
71
+ continue;
72
+ }
73
+ const src = script.getAttribute("src");
74
+ if (src) {
75
+ const blocking = !script.hasAttribute("defer") && !script.hasAttribute("async") && type !== "module";
76
+ tags.push({
77
+ kind: "script",
78
+ presence: "own",
79
+ value: "static",
80
+ href: src,
81
+ ...blocking ? { blocking: true } : {}
82
+ });
68
83
  }
69
84
  }
70
85
  const htmlEl = root.querySelector("html");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseHtmlHead
3
- } from "../chunk-MICKONGB.js";
3
+ } from "../chunk-VMCOBS2U.js";
4
4
 
5
5
  // src/hooks/handle.ts
6
6
  import { DEV } from "esm-env";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseHtmlHead
3
- } from "./chunk-MICKONGB.js";
3
+ } from "./chunk-VMCOBS2U.js";
4
4
 
5
5
  // src/plugin.ts
6
6
  import { existsSync } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svelte-vitals/vite",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Vite/SvelteKit plugin for svelte-vitals — analyzes prerendered HTML during vite build.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "esm-env": "^1.2.2",
43
43
  "node-html-parser": "^6.1.13",
44
44
  "tinyglobby": "^0.2.17",
45
- "@svelte-vitals/core": "0.14.0"
45
+ "@svelte-vitals/core": "0.15.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@sveltejs/kit": "^2.0.0",