@svelte-vitals/vite 0.29.5 → 0.29.6
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/hooks/index.js +10 -1
- package/dist/index.js +17 -7
- package/package.json +3 -3
package/dist/hooks/index.js
CHANGED
|
@@ -44,8 +44,17 @@ async function analyzeAndIngest(html, route, origin, rules, config, lastSignatur
|
|
|
44
44
|
];
|
|
45
45
|
const images = [{ route, images: imgs.map((img) => ({ ...img, file: route })) }];
|
|
46
46
|
const project = { hasRobotsTxt: true, hasSitemap: true, htmlLang };
|
|
47
|
-
const { results: ruleResults } = await runRules(rules, {
|
|
47
|
+
const { results: ruleResults, failedRules } = await runRules(rules, {
|
|
48
|
+
heads: [head],
|
|
49
|
+
headings,
|
|
50
|
+
images,
|
|
51
|
+
project,
|
|
52
|
+
config
|
|
53
|
+
});
|
|
48
54
|
const results = applyRuleSeverities(ruleResults, config);
|
|
55
|
+
if (failedRules.length > 0 && globalThis.process?.env?.SVELTE_VITALS_DEBUG) {
|
|
56
|
+
for (const f of failedRules) console.warn(`[svelte-vitals] rule ${f.id} failed and was skipped: ${f.message}`);
|
|
57
|
+
}
|
|
49
58
|
const signature = findingSignature(results, config);
|
|
50
59
|
if (lastSignature.get(route) === signature) return;
|
|
51
60
|
lastSignature.set(route, signature);
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
applyRuleSeverities,
|
|
25
25
|
applyOverrides,
|
|
26
26
|
runRules,
|
|
27
|
+
withFailedRulesOff,
|
|
27
28
|
computeScore,
|
|
28
29
|
summarize,
|
|
29
30
|
hasFailureAtOrAbove,
|
|
@@ -216,7 +217,11 @@ async function analyze(prerenderPagesDir, cwd, options, extraProjectFacts, resol
|
|
|
216
217
|
};
|
|
217
218
|
const kitModules = await collectKitModuleFacts(cwd, project.kitAliases);
|
|
218
219
|
const selected = selectRules(allRules, config);
|
|
219
|
-
const {
|
|
220
|
+
const {
|
|
221
|
+
results: rawResults,
|
|
222
|
+
examined,
|
|
223
|
+
failedRules
|
|
224
|
+
} = await runRules(selected, {
|
|
220
225
|
heads,
|
|
221
226
|
headings,
|
|
222
227
|
images,
|
|
@@ -227,15 +232,20 @@ async function analyze(prerenderPagesDir, cwd, options, extraProjectFacts, resol
|
|
|
227
232
|
sourceFiles
|
|
228
233
|
});
|
|
229
234
|
const results = applyOverrides(applyRuleSeverities(rawResults, config), config);
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
|
|
235
|
+
for (const f of failedRules) warnings.push(`rule ${f.id} failed and was skipped: ${f.message.split("\n")[0]}`);
|
|
236
|
+
const scoringConfig = withFailedRulesOff(
|
|
237
|
+
config,
|
|
238
|
+
failedRules.map((f) => f.id)
|
|
239
|
+
);
|
|
240
|
+
const { score } = computeScore(results, scoringConfig);
|
|
241
|
+
const summary = summarize(results, scoringConfig);
|
|
242
|
+
const failed = hasFailureAtOrAbove(summary, scoringConfig.failOn);
|
|
233
243
|
const coverageNote = `Analyzed ${heads.length} prerendered route(s). SSR/dynamic routes are not covered \u2014 run \`npx svelte-vitals\` for those.
|
|
234
244
|
Scanned ${components.length} component(s) under src/ for Correctness/Security/Architecture/Bundle findings.`;
|
|
235
|
-
const consoleReport = formatConsoleReport(results,
|
|
245
|
+
const consoleReport = formatConsoleReport(results, scoringConfig, { mode: "rendered / plugin" }) + "\n" + coverageNote + "\n";
|
|
236
246
|
const jsonReport = formatJsonReport(
|
|
237
247
|
results,
|
|
238
|
-
|
|
248
|
+
scoringConfig,
|
|
239
249
|
{ version: readPackageVersion() },
|
|
240
250
|
selected.map((r) => r.id),
|
|
241
251
|
examined
|
|
@@ -248,7 +258,7 @@ Scanned ${components.length} component(s) under src/ for Correctness/Security/Ar
|
|
|
248
258
|
jsonReport,
|
|
249
259
|
routeCount: heads.length,
|
|
250
260
|
failed,
|
|
251
|
-
failOn:
|
|
261
|
+
failOn: scoringConfig.failOn,
|
|
252
262
|
warnings
|
|
253
263
|
};
|
|
254
264
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svelte-vitals/vite",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.6",
|
|
4
4
|
"description": "Vite/SvelteKit plugin for svelte-vitals — analyzes prerendered HTML during vite build, plus a live dev dashboard.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"esm-env": "^1.2.2",
|
|
43
43
|
"node-html-parser": "^9.0.1",
|
|
44
44
|
"tinyglobby": "^0.2.17",
|
|
45
|
-
"@svelte-vitals/core": "0.41.
|
|
46
|
-
"svelte-vitals": "0.45.
|
|
45
|
+
"@svelte-vitals/core": "0.41.1",
|
|
46
|
+
"svelte-vitals": "0.45.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@sveltejs/kit": "^2.70.2",
|