svelte-vitals 0.3.0 → 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.
- package/dist/bin.js +5 -3
- package/dist/{chunk-LYX2RVRM.js → chunk-XOPYXOAE.js} +20 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isReporterName,
|
|
4
4
|
readPackageVersion,
|
|
5
5
|
run
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XOPYXOAE.js";
|
|
7
7
|
|
|
8
8
|
// src/bin.ts
|
|
9
9
|
import mri from "mri";
|
|
@@ -37,7 +37,7 @@ Options:
|
|
|
37
37
|
--treat-dynamic-as <mode> pass | warn | fail (default: pass)
|
|
38
38
|
--route <glob> Only analyze routes matching this glob
|
|
39
39
|
--by-route Show per-route score breakdown in console output
|
|
40
|
-
--reporter <fmt> console | json | agent (auto: agent under AI-agent envs)
|
|
40
|
+
--reporter <fmt> console | json | agent | sarif | github (auto: agent under AI-agent envs, github under GitHub Actions)
|
|
41
41
|
--json Alias for --reporter=json
|
|
42
42
|
--fail-on <severity> Fail (exit 1) when any finding reaches this severity: critical | warning | info
|
|
43
43
|
--fail-on-warning Alias for --fail-on=warning
|
|
@@ -84,7 +84,9 @@ async function main() {
|
|
|
84
84
|
reporter = "json";
|
|
85
85
|
} else if (typeof argv.reporter === "string") {
|
|
86
86
|
if (!isReporterName(argv.reporter)) {
|
|
87
|
-
console.error(
|
|
87
|
+
console.error(
|
|
88
|
+
`svelte-vitals: unknown reporter '${argv.reporter}'. Valid values: console, json, agent, sarif, github.`
|
|
89
|
+
);
|
|
88
90
|
process.exit(2);
|
|
89
91
|
}
|
|
90
92
|
reporter = argv.reporter;
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
formatConsoleReport,
|
|
6
6
|
formatJsonReport,
|
|
7
7
|
formatAgentReport,
|
|
8
|
+
formatSarifReport,
|
|
9
|
+
formatGithubReport,
|
|
8
10
|
summarize,
|
|
9
11
|
hasFailureAtOrAbove,
|
|
10
12
|
defineConfig,
|
|
@@ -449,7 +451,7 @@ function readPackageVersion() {
|
|
|
449
451
|
// src/reporter-resolve.ts
|
|
450
452
|
var AGENT_ENV_VARS = ["CLAUDECODE", "SVELTE_VITALS_AGENT"];
|
|
451
453
|
function isReporterName(value) {
|
|
452
|
-
return value === "console" || value === "json" || value === "agent";
|
|
454
|
+
return value === "console" || value === "json" || value === "agent" || value === "sarif" || value === "github";
|
|
453
455
|
}
|
|
454
456
|
function isAgentEnv(env = process.env) {
|
|
455
457
|
return AGENT_ENV_VARS.some((key) => {
|
|
@@ -457,16 +459,23 @@ function isAgentEnv(env = process.env) {
|
|
|
457
459
|
return v !== void 0 && v !== "";
|
|
458
460
|
});
|
|
459
461
|
}
|
|
462
|
+
function isGithubActionsEnv(env = process.env) {
|
|
463
|
+
return env.GITHUB_ACTIONS === "true";
|
|
464
|
+
}
|
|
460
465
|
function resolveReporter(explicit, env = process.env) {
|
|
461
466
|
if (explicit) return explicit;
|
|
462
467
|
const fromEnv = env.SVELTE_VITALS_REPORTER;
|
|
463
468
|
if (isReporterName(fromEnv)) return fromEnv;
|
|
464
469
|
if (isAgentEnv(env)) return "agent";
|
|
470
|
+
if (isGithubActionsEnv(env)) return "github";
|
|
465
471
|
return "console";
|
|
466
472
|
}
|
|
467
473
|
function isAutoDetectedAgent(explicit, env = process.env) {
|
|
468
474
|
return !explicit && !isReporterName(env.SVELTE_VITALS_REPORTER) && isAgentEnv(env);
|
|
469
475
|
}
|
|
476
|
+
function isAutoDetectedGithub(explicit, env = process.env) {
|
|
477
|
+
return !explicit && !isReporterName(env.SVELTE_VITALS_REPORTER) && !isAgentEnv(env) && isGithubActionsEnv(env);
|
|
478
|
+
}
|
|
470
479
|
|
|
471
480
|
// src/index.ts
|
|
472
481
|
function routeMatcher(glob) {
|
|
@@ -508,10 +517,20 @@ async function run(opts = {}) {
|
|
|
508
517
|
"svelte-vitals: agent reporter auto-selected (AI-agent env detected); override with --reporter console|json."
|
|
509
518
|
);
|
|
510
519
|
}
|
|
520
|
+
if (reporter === "github" && isAutoDetectedGithub(opts.reporter, env)) {
|
|
521
|
+
errorLog(
|
|
522
|
+
"svelte-vitals: github reporter auto-selected (GitHub Actions detected); override with --reporter console|json|sarif."
|
|
523
|
+
);
|
|
524
|
+
}
|
|
511
525
|
if (reporter === "json") {
|
|
512
526
|
log(formatJsonReport(results, config, { version: readPackageVersion() }));
|
|
513
527
|
} else if (reporter === "agent") {
|
|
514
528
|
log(formatAgentReport(results, config));
|
|
529
|
+
} else if (reporter === "sarif") {
|
|
530
|
+
log(formatSarifReport(results, config, { version: readPackageVersion() }));
|
|
531
|
+
} else if (reporter === "github") {
|
|
532
|
+
const output = formatGithubReport(results, config);
|
|
533
|
+
if (output) log(output);
|
|
515
534
|
} else {
|
|
516
535
|
log(formatConsoleReport(results, config, { byRoute: opts.byRoute ?? false }));
|
|
517
536
|
}
|
package/dist/index.d.ts
CHANGED
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.4.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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"mri": "^1.2.0",
|
|
39
39
|
"svelte": "^5.56.3",
|
|
40
40
|
"tinyglobby": "^0.2.17",
|
|
41
|
-
"@svelte-vitals/core": "0.
|
|
41
|
+
"@svelte-vitals/core": "0.5.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^24.7.0"
|