svelte-vitals 0.10.0 → 0.12.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 +1 -1
- package/dist/{chunk-U7HHKAJX.js → chunk-NBNJRN52.js} +31 -3
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -95,13 +95,28 @@ async function detectAppHtmlLang(rt, cwd) {
|
|
|
95
95
|
if (!await rt.exists(appHtmlPath)) return { presence: "none", value: "absent" };
|
|
96
96
|
return detectHtmlLang(await rt.readFile(appHtmlPath));
|
|
97
97
|
}
|
|
98
|
+
async function robotsRefsSitemap(rt, cwd) {
|
|
99
|
+
const p = rt.join(cwd, "static/robots.txt");
|
|
100
|
+
if (!await rt.exists(p)) return void 0;
|
|
101
|
+
try {
|
|
102
|
+
return /^\s*sitemap:/im.test(await rt.readFile(p));
|
|
103
|
+
} catch {
|
|
104
|
+
return void 0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
98
107
|
async function collectProjectFacts(rt, cwd) {
|
|
99
108
|
const [hasRobotsTxt, hasSitemap, htmlLang] = await Promise.all([
|
|
100
109
|
existsAny(rt, cwd, ROBOTS_SOURCE_PATHS),
|
|
101
110
|
existsAny(rt, cwd, SITEMAP_SOURCE_PATHS),
|
|
102
111
|
detectAppHtmlLang(rt, cwd)
|
|
103
112
|
]);
|
|
104
|
-
|
|
113
|
+
const robotsReferencesSitemap = await robotsRefsSitemap(rt, cwd);
|
|
114
|
+
return {
|
|
115
|
+
hasRobotsTxt,
|
|
116
|
+
hasSitemap,
|
|
117
|
+
htmlLang,
|
|
118
|
+
...robotsReferencesSitemap !== void 0 ? { robotsReferencesSitemap } : {}
|
|
119
|
+
};
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
// src/providers/source/parse.ts
|
|
@@ -202,15 +217,28 @@ function tagsFromHead(head) {
|
|
|
202
217
|
if (node.name === "meta") {
|
|
203
218
|
const name = attrText(node.attributes, "name");
|
|
204
219
|
const property = attrText(node.attributes, "property");
|
|
220
|
+
const content = name === "robots" ? attrText(node.attributes, "content") : void 0;
|
|
221
|
+
const noindex = content !== void 0 && /(^|[\s,])(noindex|none)([\s,]|$)/i.test(content);
|
|
205
222
|
tags.push({
|
|
206
223
|
kind: "meta",
|
|
207
224
|
...name ? { name } : {},
|
|
208
225
|
...property ? { property } : {},
|
|
209
|
-
value: attrValue(node.attributes, "content")
|
|
226
|
+
value: attrValue(node.attributes, "content"),
|
|
227
|
+
...noindex ? { noindex: true } : {}
|
|
210
228
|
});
|
|
211
229
|
} else if (node.name === "link") {
|
|
212
230
|
const rel = attrText(node.attributes, "rel");
|
|
213
|
-
|
|
231
|
+
const hasAs = findAttr(node.attributes, "as") !== void 0;
|
|
232
|
+
const asLiteral = attrText(node.attributes, "as");
|
|
233
|
+
const hasCrossorigin = findAttr(node.attributes, "crossorigin") !== void 0;
|
|
234
|
+
tags.push({
|
|
235
|
+
kind: "link",
|
|
236
|
+
...rel ? { rel } : {},
|
|
237
|
+
value: attrValue(node.attributes, "href"),
|
|
238
|
+
...hasAs ? { hasAs: true } : {},
|
|
239
|
+
...asLiteral ? { as: asLiteral } : {},
|
|
240
|
+
...hasCrossorigin ? { hasCrossorigin: true } : {}
|
|
241
|
+
});
|
|
214
242
|
} else if (node.name === "script" && attrText(node.attributes, "type") === "application/ld+json") {
|
|
215
243
|
tags.push({ kind: "jsonld", value: valueFromNodes(node.fragment?.nodes ?? []) });
|
|
216
244
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-vitals",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.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.
|
|
45
|
+
"@svelte-vitals/core": "0.13.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^24.7.0"
|