svelte-vitals 0.54.5 → 0.54.7
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/{action-pin.generated-C2XJJ3NW.js → action-pin.generated-BkwgIAMh.js} +2 -2
- package/dist/{analyze-BH6tM7-d.js → analyze-D5CKrnVf.js} +9 -5
- package/dist/bin.js +6 -6
- package/dist/{ci-DdxIti4m.js → ci-CVMFzrRD.js} +2 -2
- package/dist/{complete-DopIU_Sb.js → complete-DJIjQlEC.js} +6 -6
- package/dist/{docs-hor--7iY.js → docs-CfxdUEEe.js} +3 -3
- package/dist/{explain-BQWRixs6.js → explain-D9Cc6k2G.js} +2 -2
- package/dist/gunshi-registry.js +2 -2
- package/dist/index.d.ts +58 -18
- package/dist/index.js +2 -2
- package/dist/{install-BEsNEdKk.js → install-BIpFmwLJ.js} +15 -13
- package/dist/{src-BhVse1Wr.js → src-Oo1FLd1x.js} +17 -9
- package/package.json +10 -10
|
@@ -56,7 +56,7 @@ function buildWorkflowYaml(opts) {
|
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/ci/action-pin.generated.ts
|
|
59
|
-
const ACTION_SHA = "
|
|
60
|
-
const ACTION_VERSION = "0.
|
|
59
|
+
const ACTION_SHA = "91ef310a72272f7473aeadcdec63c9ba1ba6ea11";
|
|
60
|
+
const ACTION_VERSION = "0.12.1";
|
|
61
61
|
//#endregion
|
|
62
62
|
export { planWorkflowWrite as a, buildWorkflowYaml as i, ACTION_VERSION as n, WORKFLOW_PATH as r, ACTION_SHA as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as findUnknownRuleIds,
|
|
1
|
+
import { _ as readCoreVersion, c as findUnknownRuleIds, g as isReporterName, i as run, l as knownRuleIds, v as readPackageVersion } from "./src-Oo1FLd1x.js";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { terminalSafe } from "@svelte-vitals/core/internal";
|
|
@@ -288,8 +288,10 @@ function resolveArgs(argv) {
|
|
|
288
288
|
const diffBase = typeof argv.diff === "string" ? argv.diff || "HEAD" : void 0;
|
|
289
289
|
const staged = Boolean(argv.staged);
|
|
290
290
|
let baselineRef;
|
|
291
|
-
if (argv.baseline !== void 0)
|
|
292
|
-
|
|
291
|
+
if (argv.baseline !== void 0) {
|
|
292
|
+
if (typeof argv.baseline !== "string" || argv.baseline.trim() === "" || argv.baseline.startsWith("-")) errors.push("svelte-vitals: --baseline requires a git ref (e.g. --baseline origin/main).");
|
|
293
|
+
else baselineRef = argv.baseline;
|
|
294
|
+
}
|
|
293
295
|
const allow = toList(argv.rules);
|
|
294
296
|
const ignore = toList(argv.ignore);
|
|
295
297
|
const unknown = findUnknownRuleIds([...allow, ...ignore]);
|
|
@@ -298,8 +300,10 @@ function resolveArgs(argv) {
|
|
|
298
300
|
errors.push(`Known rule ids: ${knownRuleIds().join(", ")}`);
|
|
299
301
|
}
|
|
300
302
|
let reporter;
|
|
301
|
-
if (typeof argv.reporter === "string")
|
|
302
|
-
|
|
303
|
+
if (typeof argv.reporter === "string") {
|
|
304
|
+
if (!isReporterName(argv.reporter)) errors.push(`svelte-vitals: unknown reporter '${argv.reporter}'. Valid values: console, json, agent, sarif, github, html, md.`);
|
|
305
|
+
else reporter = argv.reporter;
|
|
306
|
+
}
|
|
303
307
|
const failOnRaw = argv["fail-on"];
|
|
304
308
|
const failOnValid = isFailOnValue(failOnRaw);
|
|
305
309
|
if (typeof failOnRaw === "string" && !failOnValid) warnings.push(`svelte-vitals: unknown --fail-on '${failOnRaw}'; expected critical|warning|info. No threshold applied.`);
|
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { g as realIO, i as resolveLocale, m as consoleIO, n as runAnalyzeCliGunshi } from "./analyze-
|
|
2
|
+
import { g as realIO, i as resolveLocale, m as consoleIO, n as runAnalyzeCliGunshi } from "./analyze-D5CKrnVf.js";
|
|
3
3
|
import { terminalSafe } from "@svelte-vitals/core/internal";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
/**
|
|
@@ -17,35 +17,35 @@ async function runCli(argv, io = consoleIO, env = process.env) {
|
|
|
17
17
|
try {
|
|
18
18
|
const locale = resolveLocale(env);
|
|
19
19
|
if (argv[0] === "complete") {
|
|
20
|
-
const { runCompleteCliGunshi } = await import("./complete-
|
|
20
|
+
const { runCompleteCliGunshi } = await import("./complete-DJIjQlEC.js");
|
|
21
21
|
return {
|
|
22
22
|
code: await runCompleteCliGunshi(argv, io),
|
|
23
23
|
exit: "natural"
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
if (argv[0] === "docs") {
|
|
27
|
-
const { runDocsCliGunshi } = await import("./docs-
|
|
27
|
+
const { runDocsCliGunshi } = await import("./docs-CfxdUEEe.js");
|
|
28
28
|
return {
|
|
29
29
|
code: await runDocsCliGunshi(argv.slice(1), io, locale),
|
|
30
30
|
exit: "natural"
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
if (argv[0] === "explain") {
|
|
34
|
-
const { runExplainCliGunshi } = await import("./explain-
|
|
34
|
+
const { runExplainCliGunshi } = await import("./explain-D9Cc6k2G.js");
|
|
35
35
|
return {
|
|
36
36
|
code: await runExplainCliGunshi(argv.slice(1), io, locale),
|
|
37
37
|
exit: "natural"
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
if (argv[0] === "install") {
|
|
41
|
-
const { runInstallCliGunshi } = await import("./install-
|
|
41
|
+
const { runInstallCliGunshi } = await import("./install-BIpFmwLJ.js").then((n) => n.n);
|
|
42
42
|
return {
|
|
43
43
|
code: await runInstallCliGunshi(argv.slice(1), io, locale),
|
|
44
44
|
exit: "immediate"
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
if (argv[0] === "ci") {
|
|
48
|
-
const { runCiCliGunshi } = await import("./ci-
|
|
48
|
+
const { runCiCliGunshi } = await import("./ci-CVMFzrRD.js");
|
|
49
49
|
return {
|
|
50
50
|
code: await runCiCliGunshi(argv.slice(1), {
|
|
51
51
|
...realIO(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as guardArgs, c as stripUnknownFlags, g as realIO, l as suggestClosest, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-
|
|
2
|
-
import { a as planWorkflowWrite, i as buildWorkflowYaml, n as ACTION_VERSION, r as WORKFLOW_PATH, t as ACTION_SHA } from "./action-pin.generated-
|
|
1
|
+
import { a as guardArgs, c as stripUnknownFlags, g as realIO, l as suggestClosest, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-D5CKrnVf.js";
|
|
2
|
+
import { a as planWorkflowWrite, i as buildWorkflowYaml, n as ACTION_VERSION, r as WORKFLOW_PATH, t as ACTION_SHA } from "./action-pin.generated-BkwgIAMh.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { cli } from "gunshi/bone";
|
|
5
5
|
import { define } from "gunshi/definition";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as FAIL_ON_VALUES, f as TREAT_DYNAMIC_AS_VALUES, m as consoleIO, t as ROOT_ARGS, u as CATEGORIES } from "./analyze-
|
|
3
|
-
import { t as INSTALL_ARGS } from "./install-
|
|
4
|
-
import { CI_ARGS, CI_UPGRADE_ARGS } from "./ci-
|
|
5
|
-
import { DOCS_LIST_ARGS, DOCS_ROOT_ARGS, DOCS_SHOW_ARGS } from "./docs-
|
|
6
|
-
import { EXPLAIN_ARGS } from "./explain-
|
|
1
|
+
import { h as REPORTER_NAMES } from "./src-Oo1FLd1x.js";
|
|
2
|
+
import { d as FAIL_ON_VALUES, f as TREAT_DYNAMIC_AS_VALUES, m as consoleIO, t as ROOT_ARGS, u as CATEGORIES } from "./analyze-D5CKrnVf.js";
|
|
3
|
+
import { t as INSTALL_ARGS } from "./install-BIpFmwLJ.js";
|
|
4
|
+
import { CI_ARGS, CI_UPGRADE_ARGS } from "./ci-CVMFzrRD.js";
|
|
5
|
+
import { DOCS_LIST_ARGS, DOCS_ROOT_ARGS, DOCS_SHOW_ARGS } from "./docs-CfxdUEEe.js";
|
|
6
|
+
import { EXPLAIN_ARGS } from "./explain-D9Cc6k2G.js";
|
|
7
7
|
import { cli } from "gunshi/bone";
|
|
8
8
|
import { define } from "gunshi/definition";
|
|
9
9
|
import { kebabnize } from "gunshi/utils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as knownRuleIds } from "./src-
|
|
2
|
-
import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-
|
|
1
|
+
import { l as knownRuleIds } from "./src-Oo1FLd1x.js";
|
|
2
|
+
import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-D5CKrnVf.js";
|
|
3
3
|
import { docsUrlFor } from "@svelte-vitals/core/internal";
|
|
4
4
|
import { cli } from "gunshi/bone";
|
|
5
5
|
import { define } from "gunshi/definition";
|
|
@@ -34,7 +34,7 @@ const EMBEDDED_DOCS = [
|
|
|
34
34
|
name: "scoping",
|
|
35
35
|
title: "Scoping findings to a change",
|
|
36
36
|
description: "Use --diff, --staged, --baseline and the suppressions file so only what a change introduced is reported, instead of a legacy backlog.",
|
|
37
|
-
body: "# Scoping findings to a change\n\nAn existing project usually has a backlog nobody is about to fix. Scope the report rather than\ndisabling rules.\n\n## Scope by file\n\n- `--diff [ref]`: only findings in files changed versus `ref` (default `HEAD`).\n- `--staged`: only findings in staged files. The pre-commit gate.\n\n```bash\nsvelte-vitals . --diff --reporter agent # after editing: what did I just break?\nsvelte-vitals . --staged # before committing\n```\n\nBoth work when the project is not at the git repo root.\n\n## Scope by finding (`--baseline <ref>`)\n\nReports only findings **not already present** at `ref`. Scopes by finding identity rather than by\nfile, so a pre-existing problem in a file you touched does not fail the gate. No default ref.\n\n```bash\nsvelte-vitals --diff origin/main --baseline origin/main --fail-on warning # PR gate\n```\n\nIt checks `ref` out into a temporary worktree and subtracts those findings. On failure (no git,\nbad ref) it warns and reports everything rather than failing the run.\n\n## Accept a backlog once (`svelte-vitals-suppressions.json`)\n\n`--baseline` handles the transient case. For a persistent ramp, record today's findings once:\n\n```bash\nsvelte-vitals --update-suppressions\ngit add svelte-vitals-suppressions.json\n```\n\nThis analyzes the whole project (`--diff`/`--staged`/`--baseline` are ignored), writes every\npenalized finding, and exits `0` without a report.\n\nThe file then applies automatically on every run, after `--diff`/`--staged` and `--baseline
|
|
37
|
+
body: "# Scoping findings to a change\n\nAn existing project usually has a backlog nobody is about to fix. Scope the report rather than\ndisabling rules.\n\n## Scope by file\n\n- `--diff [ref]`: only findings in files changed versus `ref` (default `HEAD`).\n- `--staged`: only findings in staged files. The pre-commit gate.\n\n```bash\nsvelte-vitals . --diff --reporter agent # after editing: what did I just break?\nsvelte-vitals . --staged # before committing\n```\n\nBoth work when the project is not at the git repo root.\n\n## Scope by finding (`--baseline <ref>`)\n\nReports only findings **not already present** at `ref`. Scopes by finding identity rather than by\nfile, so a pre-existing problem in a file you touched does not fail the gate. No default ref.\n\n```bash\nsvelte-vitals --diff origin/main --baseline origin/main --fail-on warning # PR gate\n```\n\nIt checks `ref` out into a temporary worktree and subtracts those findings. On failure (no git,\nbad ref) it warns and reports everything rather than failing the run.\n\n## Accept a backlog once (`svelte-vitals-suppressions.json`)\n\n`--baseline` handles the transient case. For a persistent ramp, record today's findings once:\n\n```bash\nsvelte-vitals --update-suppressions\ngit add svelte-vitals-suppressions.json\n```\n\nThis analyzes the whole project (`--diff`/`--staged`/`--baseline` are ignored), writes every\npenalized finding, and exits `0` without a report.\n\nThe file then applies automatically on every run, after `--diff`/`--staged` and `--baseline` —\nin `vite build` and the live dashboard too (source-scan entries only; route-level entries are\nskipped there, since rendered route findings anchor to the built HTML).\nFixing an accepted finding leaves a **stale** entry, reported on stderr but never failing the run.\n`--no-suppressions` ignores the file for one run.\n\nAn entry covers whatever its rule reports at that route and location, not just the message\nrecorded when written, so a different finding from the same rule at the same spot still matches\nand stays suppressed (and not stale).\n\nA malformed suppressions file is a hard error (exit `2`), not a silent skip.\n\n## Suppress one occurrence inline\n\nFor a single finding that is correct by design, put a `svelte-vitals-disable-next-line` comment on\nthe line directly above it:\n\n```html\n<!-- svelte-vitals-disable-next-line security/raw-html -->\n<div>{@html sanitized}</div>\n```\n\nInside `<script>`, use `// svelte-vitals-disable-next-line <rule-id>`. Omit the id to suppress every\nrule on the next line, or list several comma-separated.\n\nOnly findings the report anchors to a **line** can be reached this way, not the `<head>` metadata\nrules, which report what a route never set. A directive in a component silences that finding on\nevery route composing it; for one route, use the suppressions file or `overrides`.\n\n## Which one\n\n| Situation | Use |\n| -------------------------------------- | ---------------------------------------- |\n| Checking an edit you just made | `--diff` |\n| One occurrence that is right as-is | `svelte-vitals-disable-next-line` |\n| Pre-commit hook | `--staged` |\n| PR gate against a base branch | `--diff <base> --baseline <base>` |\n| Adopting on a legacy project, for good | `--update-suppressions`, commit the file |\n\nMatching ignores line numbers in both `--baseline` and the suppressions file, so a second\nviolation of the same rule lower in the same file does not surface as new.\n\n## Related\n\n- `svelte-vitals docs show ci`: the generated PR gate already does the `--diff`/`--baseline` pairing\n- `svelte-vitals docs show config`: turning a rule off for good, when that is genuinely right"
|
|
38
38
|
}
|
|
39
39
|
];
|
|
40
40
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as knownRuleIds } from "./src-
|
|
2
|
-
import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-
|
|
1
|
+
import { l as knownRuleIds } from "./src-Oo1FLd1x.js";
|
|
2
|
+
import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-D5CKrnVf.js";
|
|
3
3
|
import { CATEGORIES } from "@svelte-vitals/core";
|
|
4
4
|
import { allRules, explainRule } from "@svelte-vitals/core/internal";
|
|
5
5
|
import { cli } from "gunshi/bone";
|
package/dist/gunshi-registry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ROOT_ARGS } from "./analyze-
|
|
2
|
-
import { t as INSTALL_ARGS } from "./install-
|
|
1
|
+
import { t as ROOT_ARGS } from "./analyze-D5CKrnVf.js";
|
|
2
|
+
import { t as INSTALL_ARGS } from "./install-BIpFmwLJ.js";
|
|
3
3
|
import { t as JA_ARG_DESCRIPTIONS } from "./ja-BDLP3KLG.js";
|
|
4
4
|
export { INSTALL_ARGS, JA_ARG_DESCRIPTIONS, ROOT_ARGS };
|
package/dist/index.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ type ReporterName = 'console' | 'json' | 'agent' | 'sarif' | 'github' | 'html' |
|
|
|
103
103
|
* drift and make the scaffolder create a duplicate config the loader then
|
|
104
104
|
* shadows or ignores.
|
|
105
105
|
*/
|
|
106
|
-
declare const CONFIG_FILENAMES: string[];
|
|
106
|
+
export declare const CONFIG_FILENAMES: string[];
|
|
107
107
|
/** Result of loading and validating a config file. */
|
|
108
108
|
interface LoadedConfigFile {
|
|
109
109
|
/** The file's contents after validation; invalid optional fields are dropped (see `warnings`). */
|
|
@@ -124,16 +124,16 @@ interface LoadedConfigFile {
|
|
|
124
124
|
* config fails validation (unknown rule ids in `rules`, invalid `weights`
|
|
125
125
|
* entries).
|
|
126
126
|
*/
|
|
127
|
-
declare function loadConfigFile(cwd: string): Promise<LoadedConfigFile | undefined>;
|
|
127
|
+
export declare function loadConfigFile(cwd: string): Promise<LoadedConfigFile | undefined>;
|
|
128
128
|
//#endregion
|
|
129
129
|
//#region src/providers/source/project.d.ts
|
|
130
130
|
/** Thrown when the target directory is not a SvelteKit project (CLI maps to exit 2). */
|
|
131
|
-
declare class ProjectError extends Error {
|
|
131
|
+
export declare class ProjectError extends Error {
|
|
132
132
|
constructor(message: string);
|
|
133
133
|
}
|
|
134
134
|
//#endregion
|
|
135
135
|
//#region src/route-matcher.d.ts
|
|
136
|
-
declare function routeMatcher(glob: string | undefined): (route: string) => boolean;
|
|
136
|
+
export declare function routeMatcher(glob: string | undefined): (route: string) => boolean;
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region src/runtime/node.d.ts
|
|
139
139
|
/**
|
|
@@ -141,15 +141,15 @@ declare function routeMatcher(glob: string | undefined): (route: string) => bool
|
|
|
141
141
|
* only place in the static-mode pipeline allowed to touch `node:` APIs; the
|
|
142
142
|
* provider and rules stay runtime-agnostic by going through this interface.
|
|
143
143
|
*/
|
|
144
|
-
declare function createNodeRuntime(): Runtime;
|
|
144
|
+
export declare function createNodeRuntime(): Runtime;
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region src/rules-config.d.ts
|
|
147
147
|
/** Rule ids passed to --rules/--ignore that aren't part of the built-in registry. */
|
|
148
|
-
declare function findUnknownRuleIds(ids: string[]): string[];
|
|
148
|
+
export declare function findUnknownRuleIds(ids: string[]): string[];
|
|
149
149
|
/** All built-in rule ids, sorted — for help and error messages. */
|
|
150
|
-
declare function knownRuleIds(): string[];
|
|
150
|
+
export declare function knownRuleIds(): string[];
|
|
151
151
|
/** The options a rule declares, or undefined when it takes none. */
|
|
152
|
-
declare function ruleOptionsSpec(id: string): RuleOptionsSpec | undefined;
|
|
152
|
+
export declare function ruleOptionsSpec(id: string): RuleOptionsSpec | undefined;
|
|
153
153
|
/**
|
|
154
154
|
* Stamps the rule registry's provenance onto error messages that list known ids.
|
|
155
155
|
* Two copies of svelte-vitals can coexist in one tree (e.g. the Vite plugin's
|
|
@@ -157,10 +157,50 @@ declare function ruleOptionsSpec(id: string): RuleOptionsSpec | undefined;
|
|
|
157
157
|
* a rule that exists in one copy but not the other reads as a mystery rather
|
|
158
158
|
* than a version skew.
|
|
159
159
|
*/
|
|
160
|
-
declare function registryTag(): string;
|
|
160
|
+
export declare function registryTag(): string;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/suppressions.d.ts
|
|
163
|
+
/**
|
|
164
|
+
* Persistent adoption ramp (design doc 2026-07-13-suppressions-file-design.md):
|
|
165
|
+
* accept every currently-penalized finding once (`--update-suppressions`), then
|
|
166
|
+
* gate only on findings that appear afterward. Unlike `--baseline <ref>` (a
|
|
167
|
+
* transient git-ref comparison), this file is committed and applied on every run.
|
|
168
|
+
*/
|
|
169
|
+
export declare const SUPPRESSIONS_FILE = "svelte-vitals-suppressions.json";
|
|
170
|
+
interface SuppressionEntry {
|
|
171
|
+
id: string;
|
|
172
|
+
route?: string;
|
|
173
|
+
location?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Reads `svelte-vitals-suppressions.json` from `cwd`. Returns `undefined` when
|
|
177
|
+
* the file doesn't exist. Throws when the file exists but is not valid JSON, its
|
|
178
|
+
* top-level shape isn't `{ version: 1, suppressions: [...] }`, or an entry is
|
|
179
|
+
* missing a string `id` — a silently-ignored typo would un-gate CI, so malformed
|
|
180
|
+
* files are a hard error (mapped to exit 2 by the caller). Unknown keys (both
|
|
181
|
+
* top-level and per-entry) are ignored for forward compatibility.
|
|
182
|
+
*/
|
|
183
|
+
export declare function loadSuppressions(cwd: string): SuppressionEntry[] | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Removes penalized findings whose key matches a suppression entry. Passing
|
|
186
|
+
* seeds are never removed even if their key happens to match. Reports how many
|
|
187
|
+
* findings were suppressed and how many entries in `entries` matched nothing
|
|
188
|
+
* (stale — most likely fixed since the file was last written).
|
|
189
|
+
*
|
|
190
|
+
* `allResults` (defaults to `results`) is used only for the staleness tally, not
|
|
191
|
+
* for filtering: a caller that narrows `results` to a subset of files/findings
|
|
192
|
+
* (`--diff`/`--staged`/`--baseline`) can still pass the pre-scope, project-wide
|
|
193
|
+
* result set here so an entry whose finding survives elsewhere in the project
|
|
194
|
+
* isn't misreported as stale just because this run's scope excluded it.
|
|
195
|
+
*/
|
|
196
|
+
export declare function applySuppressions(results: Result[], entries: SuppressionEntry[], config: Config, allResults?: Result[]): {
|
|
197
|
+
results: Result[];
|
|
198
|
+
suppressed: number;
|
|
199
|
+
stale: number;
|
|
200
|
+
};
|
|
161
201
|
//#endregion
|
|
162
202
|
//#region src/index.d.ts
|
|
163
|
-
interface RunOptions {
|
|
203
|
+
export interface RunOptions {
|
|
164
204
|
cwd?: string;
|
|
165
205
|
log?: (line: string) => void;
|
|
166
206
|
errorLog?: (line: string) => void;
|
|
@@ -246,14 +286,14 @@ interface RunOptions {
|
|
|
246
286
|
* clutter the log. So gate on `stderrIsTTY` unconditionally, then reuse the color
|
|
247
287
|
* gating (NO_COLOR / --no-color / agent env) with that same TTY value.
|
|
248
288
|
*/
|
|
249
|
-
declare function spinnerEnabled(opts: {
|
|
289
|
+
export declare function spinnerEnabled(opts: {
|
|
250
290
|
reporter: ReporterName;
|
|
251
291
|
rawReporter: ReporterName | undefined;
|
|
252
292
|
stderrIsTTY: boolean;
|
|
253
293
|
env: NodeJS.ProcessEnv;
|
|
254
294
|
noColorFlag?: boolean;
|
|
255
295
|
}): boolean;
|
|
256
|
-
interface AnalyzeOptions {
|
|
296
|
+
export interface AnalyzeOptions {
|
|
257
297
|
cwd?: string;
|
|
258
298
|
metaComponents?: string[];
|
|
259
299
|
treatDynamicAs?: 'pass' | 'warn' | 'fail';
|
|
@@ -306,7 +346,7 @@ interface AnalyzeOptions {
|
|
|
306
346
|
*/
|
|
307
347
|
loadedConfig?: LoadedConfigFile | null;
|
|
308
348
|
}
|
|
309
|
-
interface AnalyzeResult {
|
|
349
|
+
export interface AnalyzeResult {
|
|
310
350
|
results: Result[];
|
|
311
351
|
config: Config;
|
|
312
352
|
version: string;
|
|
@@ -339,8 +379,8 @@ interface AnalyzeResult {
|
|
|
339
379
|
* config file's value is used, otherwise the built-in default (design doc
|
|
340
380
|
* 2026-07-05-config-file-design.md §3).
|
|
341
381
|
*/
|
|
342
|
-
declare function analyzeProject(opts?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
343
|
-
interface ApplyScopeOptions {
|
|
382
|
+
export declare function analyzeProject(opts?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
383
|
+
export interface ApplyScopeOptions {
|
|
344
384
|
cwd: string;
|
|
345
385
|
staged?: boolean;
|
|
346
386
|
diffBase?: string;
|
|
@@ -371,11 +411,11 @@ interface ApplyScopeOptions {
|
|
|
371
411
|
* `@svelte-vitals/action` (issue #154) so the git-diff/baseline orchestration
|
|
372
412
|
* lives in exactly one place.
|
|
373
413
|
*/
|
|
374
|
-
declare function applyScope(results: Result[], opts: ApplyScopeOptions): Promise<Result[]>;
|
|
414
|
+
export declare function applyScope(results: Result[], opts: ApplyScopeOptions): Promise<Result[]>;
|
|
375
415
|
/**
|
|
376
416
|
* Run static-mode analysis once and return the process exit code (design §6):
|
|
377
417
|
* 0 = no failing findings, 1 = critical finding present, 2 = execution error.
|
|
378
418
|
*/
|
|
379
|
-
declare function run(opts?: RunOptions): Promise<number>;
|
|
419
|
+
export declare function run(opts?: RunOptions): Promise<number>;
|
|
380
420
|
//#endregion
|
|
381
|
-
export {
|
|
421
|
+
export { type LoadedConfigFile, type ParseCache, type SuppressionEntry, defineConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { CONFIG_FILENAMES, ProjectError, analyzeProject, applyScope, createNodeRuntime, defineConfig, findUnknownRuleIds, knownRuleIds, loadConfigFile, registryTag, routeMatcher, ruleOptionsSpec, run, spinnerEnabled };
|
|
1
|
+
import { C as ProjectError, S as routeMatcher, a as spinnerEnabled, c as findUnknownRuleIds, d as ruleOptionsSpec, f as SUPPRESSIONS_FILE, i as run, l as knownRuleIds, m as loadSuppressions, n as applyScope, o as CONFIG_FILENAMES, p as applySuppressions, r as defineConfig, s as loadConfigFile, t as analyzeProject, u as registryTag, w as createNodeRuntime } from "./src-Oo1FLd1x.js";
|
|
2
|
+
export { CONFIG_FILENAMES, ProjectError, SUPPRESSIONS_FILE, analyzeProject, applyScope, applySuppressions, createNodeRuntime, defineConfig, findUnknownRuleIds, knownRuleIds, loadConfigFile, loadSuppressions, registryTag, routeMatcher, ruleOptionsSpec, run, spinnerEnabled };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as guardArgs, c as stripUnknownFlags, g as realIO, h as clackPrompts, m as consoleIO, o as splitAtTerminator, p as toList, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-
|
|
4
|
-
import { a as planWorkflowWrite, i as buildWorkflowYaml, n as ACTION_VERSION, r as WORKFLOW_PATH, t as ACTION_SHA } from "./action-pin.generated-
|
|
2
|
+
import { b as hasDep, o as CONFIG_FILENAMES, v as readPackageVersion, x as readPkg, y as discoverApps } from "./src-Oo1FLd1x.js";
|
|
3
|
+
import { a as guardArgs, c as stripUnknownFlags, g as realIO, h as clackPrompts, m as consoleIO, o as splitAtTerminator, p as toList, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-D5CKrnVf.js";
|
|
4
|
+
import { a as planWorkflowWrite, i as buildWorkflowYaml, n as ACTION_VERSION, r as WORKFLOW_PATH, t as ACTION_SHA } from "./action-pin.generated-BkwgIAMh.js";
|
|
5
5
|
import { buildCursorRules, installHeader } from "./install/skill-content.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
@@ -572,17 +572,19 @@ async function runInstall(flags, io, prompts, version = "0.0.0") {
|
|
|
572
572
|
if (apps.length === 1) {
|
|
573
573
|
io.errorLog(`svelte-vitals: detected SvelteKit app at ${apps[0]}; targeting it for the Vite/config targets.`);
|
|
574
574
|
appDir = join(io.cwd, apps[0]);
|
|
575
|
-
} else if (apps.length > 1)
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
575
|
+
} else if (apps.length > 1) {
|
|
576
|
+
if (io.isTTY) {
|
|
577
|
+
const picked = await prompts.selectApp(apps);
|
|
578
|
+
if (picked === null) {
|
|
579
|
+
io.log("Cancelled.");
|
|
580
|
+
return 0;
|
|
581
|
+
}
|
|
582
|
+
appDir = join(io.cwd, picked);
|
|
583
|
+
} else {
|
|
584
|
+
io.errorLog(`svelte-vitals: multiple SvelteKit apps found: ${apps.join(", ")}.`);
|
|
585
|
+
io.errorLog(`svelte-vitals: pass one with --app, e.g. \`svelte-vitals install --app ${apps[0]}\`.`);
|
|
586
|
+
return 2;
|
|
580
587
|
}
|
|
581
|
-
appDir = join(io.cwd, picked);
|
|
582
|
-
} else {
|
|
583
|
-
io.errorLog(`svelte-vitals: multiple SvelteKit apps found: ${apps.join(", ")}.`);
|
|
584
|
-
io.errorLog(`svelte-vitals: pass one with --app, e.g. \`svelte-vitals install --app ${apps[0]}\`.`);
|
|
585
|
-
return 2;
|
|
586
588
|
}
|
|
587
589
|
}
|
|
588
590
|
}
|
|
@@ -1383,8 +1383,10 @@ async function resolveRoute(rt, cwd, pageRel, config, layouts, cache, aliases, a
|
|
|
1383
1383
|
if (tag.kind === "jsonld" || tag.kind === "script" || tag.kind === "link" && tag.rel !== "canonical") additiveTags.push(stamped);
|
|
1384
1384
|
else composed.set(tagKey(tag), stamped);
|
|
1385
1385
|
}
|
|
1386
|
-
if (resolved.broad)
|
|
1387
|
-
|
|
1386
|
+
if (resolved.broad) {
|
|
1387
|
+
if (isPage) broadOwn = true;
|
|
1388
|
+
else broadInherited = true;
|
|
1389
|
+
}
|
|
1388
1390
|
componentHeadings.push(...resolved.headings);
|
|
1389
1391
|
}
|
|
1390
1392
|
if (broadOwn || broadInherited) {
|
|
@@ -2553,12 +2555,18 @@ function validateConfigFile(raw, path) {
|
|
|
2553
2555
|
const warnings = [];
|
|
2554
2556
|
const config = {};
|
|
2555
2557
|
for (const key of Object.keys(raw)) if (!KNOWN_TOP_LEVEL_KEYS.has(key)) warnings.push(`${path}: unknown config key '${key}' ignored.`);
|
|
2556
|
-
if (raw.treatDynamicAs !== void 0)
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
if (raw.
|
|
2561
|
-
|
|
2558
|
+
if (raw.treatDynamicAs !== void 0) {
|
|
2559
|
+
if (TREAT_DYNAMIC_AS_VALUES.includes(raw.treatDynamicAs)) config.treatDynamicAs = raw.treatDynamicAs;
|
|
2560
|
+
else warnings.push(`${path}: unknown treatDynamicAs '${String(raw.treatDynamicAs)}'; expected pass|warn|fail. Ignoring.`);
|
|
2561
|
+
}
|
|
2562
|
+
if (raw.failOn !== void 0) {
|
|
2563
|
+
if (FAIL_ON_VALUES.includes(raw.failOn)) config.failOn = raw.failOn;
|
|
2564
|
+
else warnings.push(`${path}: unknown failOn '${String(raw.failOn)}'; expected critical|warning|info. Ignoring.`);
|
|
2565
|
+
}
|
|
2566
|
+
if (raw.metaComponents !== void 0) {
|
|
2567
|
+
if (Array.isArray(raw.metaComponents) && raw.metaComponents.every((c) => typeof c === "string")) config.metaComponents = raw.metaComponents;
|
|
2568
|
+
else warnings.push(`${path}: metaComponents must be an array of strings. Ignoring.`);
|
|
2569
|
+
}
|
|
2562
2570
|
if (raw.rules !== void 0) {
|
|
2563
2571
|
if (!isPlainObject(raw.rules)) throw new Error(`${path}: rules must be an object of rule-id → setting.`);
|
|
2564
2572
|
const rules = raw.rules;
|
|
@@ -3146,4 +3154,4 @@ async function run(opts = {}) {
|
|
|
3146
3154
|
}
|
|
3147
3155
|
}
|
|
3148
3156
|
//#endregion
|
|
3149
|
-
export {
|
|
3157
|
+
export { ProjectError as C, routeMatcher as S, readCoreVersion as _, spinnerEnabled as a, hasDep as b, findUnknownRuleIds as c, ruleOptionsSpec as d, SUPPRESSIONS_FILE as f, isReporterName as g, REPORTER_NAMES as h, run as i, knownRuleIds as l, loadSuppressions as m, applyScope as n, CONFIG_FILENAMES as o, applySuppressions as p, defineConfig$1 as r, loadConfigFile as s, analyzeProject as t, registryTag as u, readPackageVersion as v, createNodeRuntime as w, readPkg as x, discoverApps as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-vitals",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.7",
|
|
4
4
|
"description": "A deterministic SvelteKit code-health scanner (SEO, performance, correctness, security, architecture, accessibility).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@svelte-vitals/core": "0.54.
|
|
47
|
-
"@clack/prompts": "^1.
|
|
48
|
-
"@gunshi/plugin-completion": "0.37.
|
|
49
|
-
"@gunshi/plugin-i18n": "0.37.
|
|
50
|
-
"@gunshi/plugin-suggestion": "0.37.
|
|
51
|
-
"gunshi": "0.37.
|
|
52
|
-
"magicast": "^0.5.
|
|
46
|
+
"@svelte-vitals/core": "0.54.7",
|
|
47
|
+
"@clack/prompts": "^1.8.0",
|
|
48
|
+
"@gunshi/plugin-completion": "0.37.2",
|
|
49
|
+
"@gunshi/plugin-i18n": "0.37.2",
|
|
50
|
+
"@gunshi/plugin-suggestion": "0.37.2",
|
|
51
|
+
"gunshi": "0.37.2",
|
|
52
|
+
"magicast": "^0.5.5",
|
|
53
53
|
"svelte": "^5.57.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@gunshi/docs": "0.37.
|
|
56
|
+
"@gunshi/docs": "0.37.2",
|
|
57
57
|
"@types/estree": "^1.0.9",
|
|
58
|
-
"@types/node": "^24.13.
|
|
58
|
+
"@types/node": "^24.13.4"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|