svelte-vitals 0.54.6 → 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.
@@ -1,4 +1,4 @@
1
- import { c as findUnknownRuleIds, h as readPackageVersion, i as run, l as knownRuleIds, m as readCoreVersion, p as isReporterName } from "./src-CNeKZkf0.js";
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";
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-B1DhJ_wC.js";
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-B5MjMWIx.js");
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-CS6y-jmw.js");
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-2q_Uvl0L.js");
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-NaV82t9A.js").then((n) => n.n);
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-Cs-AbY0g.js");
48
+ const { runCiCliGunshi } = await import("./ci-CVMFzrRD.js");
49
49
  return {
50
50
  code: await runCiCliGunshi(argv.slice(1), {
51
51
  ...realIO(),
@@ -1,4 +1,4 @@
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-B1DhJ_wC.js";
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
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";
@@ -1,9 +1,9 @@
1
- import { f as REPORTER_NAMES } from "./src-CNeKZkf0.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-B1DhJ_wC.js";
3
- import { t as INSTALL_ARGS } from "./install-NaV82t9A.js";
4
- import { CI_ARGS, CI_UPGRADE_ARGS } from "./ci-Cs-AbY0g.js";
5
- import { DOCS_LIST_ARGS, DOCS_ROOT_ARGS, DOCS_SHOW_ARGS } from "./docs-CS6y-jmw.js";
6
- import { EXPLAIN_ARGS } from "./explain-2q_Uvl0L.js";
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-CNeKZkf0.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-B1DhJ_wC.js";
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`.\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"
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-CNeKZkf0.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-B1DhJ_wC.js";
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";
@@ -1,4 +1,4 @@
1
- import { t as ROOT_ARGS } from "./analyze-B1DhJ_wC.js";
2
- import { t as INSTALL_ARGS } from "./install-NaV82t9A.js";
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
@@ -159,6 +159,46 @@ export declare function ruleOptionsSpec(id: string): RuleOptionsSpec | undefined
159
159
  */
160
160
  export declare function registryTag(): string;
161
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
+ };
201
+ //#endregion
162
202
  //#region src/index.d.ts
163
203
  export interface RunOptions {
164
204
  cwd?: string;
@@ -378,4 +418,4 @@ export declare function applyScope(results: Result[], opts: ApplyScopeOptions):
378
418
  */
379
419
  export declare function run(opts?: RunOptions): Promise<number>;
380
420
  //#endregion
381
- export { type LoadedConfigFile, type ParseCache, defineConfig };
421
+ export { type LoadedConfigFile, type ParseCache, type SuppressionEntry, defineConfig };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as spinnerEnabled, b as ProjectError, c as findUnknownRuleIds, d as ruleOptionsSpec, i as run, l as knownRuleIds, n as applyScope, o as CONFIG_FILENAMES, r as defineConfig, s as loadConfigFile, t as analyzeProject, u as registryTag, x as createNodeRuntime, y as routeMatcher } from "./src-CNeKZkf0.js";
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,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { _ as hasDep, g as discoverApps, h as readPackageVersion, o as CONFIG_FILENAMES, v as readPkg } from "./src-CNeKZkf0.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-B1DhJ_wC.js";
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
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";
@@ -3154,4 +3154,4 @@ async function run(opts = {}) {
3154
3154
  }
3155
3155
  }
3156
3156
  //#endregion
3157
- export { hasDep as _, spinnerEnabled as a, ProjectError as b, findUnknownRuleIds as c, ruleOptionsSpec as d, REPORTER_NAMES as f, discoverApps as g, readPackageVersion as h, run as i, knownRuleIds as l, readCoreVersion as m, applyScope as n, CONFIG_FILENAMES as o, isReporterName as p, defineConfig$1 as r, loadConfigFile as s, analyzeProject as t, registryTag as u, readPkg as v, createNodeRuntime as x, routeMatcher as y };
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.6",
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,13 +43,13 @@
43
43
  "dist"
44
44
  ],
45
45
  "dependencies": {
46
- "@svelte-vitals/core": "0.54.6",
46
+ "@svelte-vitals/core": "0.54.7",
47
47
  "@clack/prompts": "^1.8.0",
48
48
  "@gunshi/plugin-completion": "0.37.2",
49
49
  "@gunshi/plugin-i18n": "0.37.2",
50
50
  "@gunshi/plugin-suggestion": "0.37.2",
51
51
  "gunshi": "0.37.2",
52
- "magicast": "^0.5.4",
52
+ "magicast": "^0.5.5",
53
53
  "svelte": "^5.57.0"
54
54
  },
55
55
  "devDependencies": {