@svelte-vitals/vite 0.55.3 → 0.55.4

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/README.md CHANGED
@@ -30,6 +30,8 @@ export default {
30
30
  - `outFile`: write the JSON report to a path.
31
31
  - `rules` / `metaComponents` / `treatDynamicAs`: same as the CLI/core config.
32
32
  - `weights`: per-category weight overrides for the combined Health score.
33
+ - `overrides`: route- and file-scoped rule overrides, same as the config file's `overrides`.
34
+ - `seo`: `{ indexable?: boolean }`; `indexable: false` turns off the search-result rules.
33
35
  - `prerenderDir`: override the prerendered-pages directory (default: `output/prerendered/pages` under `kit.outDir`).
34
36
  - `cwd`: project root (defaults to the Vite config root).
35
37
  - `ui`: serve the live dev dashboard (default `true`); pass `false` to keep only the build-time gate.
@@ -1,6 +1,5 @@
1
1
  import { Config, RuleSetting } from "@svelte-vitals/core";
2
2
  import { Handle } from "@sveltejs/kit";
3
- //#region src/hooks/handle.d.ts
4
3
  /** Options for the dev-time SvelteKit handle. A focused subset of the plugin options. */
5
4
  interface SvelteVitalsHookOptions {
6
5
  /** Component names treated as meta sources (design §11 layer 4). Mirrors the plugin option. */
@@ -15,5 +14,4 @@ interface SvelteVitalsHookOptions {
15
14
  * HTML). Add it to `src/hooks.server.ts`, e.g. `sequence(svelteVitalsHandle())`.
16
15
  */
17
16
  export declare function svelteVitalsHandle(options?: SvelteVitalsHookOptions): Handle;
18
- //#endregion
19
17
  export type { SvelteVitalsHookOptions };
@@ -1,8 +1,8 @@
1
- import { i as toOccurrenceMap, r as parseHtmlHead, t as isLoopbackOrigin } from "../loopback-DxxU70UA.js";
1
+ import { i as toOccurrenceMap, r as parseHtmlHead, t as isLoopbackOrigin } from "../loopback-D_07LGfE.js";
2
2
  import { defineConfig } from "@svelte-vitals/core";
3
3
  import { allRules, defaultProject, effectiveSeverity, formatFailedRuleWarning, isPenalized, runAnalysis, selectRules, terminalSafe } from "@svelte-vitals/core/internal";
4
4
  import { DEV } from "esm-env";
5
- //#region src/hooks/handle.ts
5
+ // src/hooks/handle.ts
6
6
  /** Stable signature of a route's penalized findings, so ingest is skipped when a repeat visit finds nothing new. */
7
7
  function findingSignature(results, config) {
8
8
  return results.filter((r) => isPenalized(r.detection, config.treatDynamicAs)).map((r) => `${r.id}:${effectiveSeverity(r, config)}:${r.detection.presence}:${r.detection.value}`).sort().join("|");
@@ -130,5 +130,4 @@ function svelteVitalsHandle(options = {}) {
130
130
  } });
131
131
  };
132
132
  }
133
- //#endregion
134
133
  export { svelteVitalsHandle };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Category, Config, RuleOverride, RuleSetting, Severity, TreatDynamicAs } from "@svelte-vitals/core";
2
2
  import { Plugin } from "vite";
3
- //#region src/plugin.d.ts
4
3
  interface SvelteVitalsOptions {
5
4
  /** Project root (defaults to the Vite config root / cwd). */
6
5
  cwd?: string;
@@ -31,5 +30,4 @@ interface SvelteVitalsOptions {
31
30
  }
32
31
  /** svelte-vitals Vite/SvelteKit plugin. */
33
32
  export declare function svelteVitals(options?: SvelteVitalsOptions): Plugin | Plugin[];
34
- //#endregion
35
33
  export type { SvelteVitalsOptions };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as toOccurrenceMap, n as isSameOrigin, r as parseHtmlHead, t as isLoopbackOrigin } from "./loopback-DxxU70UA.js";
1
+ import { i as toOccurrenceMap, n as isSameOrigin, r as parseHtmlHead, t as isLoopbackOrigin } from "./loopback-D_07LGfE.js";
2
2
  import { once } from "node:events";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { access, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
@@ -6,7 +6,7 @@ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "nod
6
6
  import { CATEGORIES, defineConfig } from "@svelte-vitals/core";
7
7
  import { ROBOTS_SOURCE_PATHS, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, VITE_CONFIG_FILES, addFactsDirectives, allRules, buildJsonReport, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, collectSuppressions, computeScore, defaultConfig, findKitHashRouterInSvelteConfig, findMinifyDisabled, formatConsoleReport, formatFailedRuleWarning, formatJsonReportChunks, hasFailureAtOrAbove, isPlainObject, renderAppShell, resolveKitAliases, resolveKitPathsBase, resolveRuleOptions, routeNeverSsr, runAnalysis, safeHref, selectRules, servesRootFile, shouldSkipRangeCheck, skippedFileWarnings, summarize, terminalSafe, unknownDirectiveIds, validateRuleSetting, withFailedRulesOff, withIndexableOff, withPackageImports, withWorkspacePackages } from "@svelte-vitals/core/internal";
8
8
  import { CONFIG_FILENAMES, SUPPRESSIONS_FILE, analyzeProject, applySuppressions, createNodeRuntime, dropConstantListEachBlocks, findUnknownRuleIds, findWorkspacePackages, knownRuleIds, loadConfigFile, loadSuppressions, registryTag, ruleOptionsSpec } from "svelte-vitals";
9
- //#region src/providers/rendered/collect.ts
9
+ // src/providers/rendered/collect.ts
10
10
  /** Map a prerendered HTML path (relative to pages/, POSIX) to its route. */
11
11
  function deriveRouteFromHtmlPath(relPath) {
12
12
  let p = relPath.replace(/\\/g, "/").replace(/\.html$/, "");
@@ -89,8 +89,7 @@ async function collectRenderedHeads(prerenderPagesDir) {
89
89
  htmlLang
90
90
  };
91
91
  }
92
- //#endregion
93
- //#region src/providers/rendered/project.ts
92
+ // src/providers/rendered/project.ts
94
93
  async function exists(path) {
95
94
  try {
96
95
  await access(path);
@@ -156,8 +155,7 @@ async function collectRenderedProject(cwd, htmlLang) {
156
155
  ...componentAliases !== kitAliases ? { componentAliases } : {}
157
156
  };
158
157
  }
159
- //#endregion
160
- //#region src/providers/source/components.ts
158
+ // src/providers/source/components.ts
161
159
  const nodeRuntime = createNodeRuntime();
162
160
  /**
163
161
  * Scan every `.svelte` component under `src/` for Correctness/Security/Architecture/
@@ -184,8 +182,7 @@ function collectKitModuleFacts$1(root, aliases) {
184
182
  function collectSourceFiles$1(root) {
185
183
  return collectSourceFiles(nodeRuntime, root);
186
184
  }
187
- //#endregion
188
- //#region src/suppressions.ts
185
+ // src/suppressions.ts
189
186
  /**
190
187
  * Apply `svelte-vitals-suppressions.json` the way every plugin surface must: source-scan entries
191
188
  * only. A route-level entry (route starting with `/`) is written by the CLI against
@@ -207,8 +204,7 @@ function applySourceSuppressions(results, entries, config) {
207
204
  notices
208
205
  };
209
206
  }
210
- //#endregion
211
- //#region src/version.ts
207
+ // src/version.ts
212
208
  /** Read this package's version from its own package.json so the report never drifts. */
213
209
  function readPackageVersion() {
214
210
  try {
@@ -237,8 +233,7 @@ function readCoreVersion() {
237
233
  return "0.0.0";
238
234
  }
239
235
  }
240
- //#endregion
241
- //#region src/analyze.ts
236
+ // src/analyze.ts
242
237
  /**
243
238
  * Merge plugin options over an optional loaded config file, per-field precedence (an
244
239
  * explicit `options` value wins, otherwise the file, otherwise the built-in default).
@@ -417,8 +412,7 @@ Scanned ${components.length} component(s) under src/ for Correctness/Security/Ar
417
412
  warnings
418
413
  };
419
414
  }
420
- //#endregion
421
- //#region src/minify-flag.ts
415
+ // src/minify-flag.ts
422
416
  /**
423
417
  * performance/minify-disabled fact from the evaluated Vite user config (the value the plugin's
424
418
  * `config` hook sees) — exact, so it also catches function-form/conditional configs the CLI's
@@ -449,8 +443,7 @@ async function resolveMinifyDisabled(minify, configFile, root) {
449
443
  ...suppressions !== void 0 ? { suppressions } : {}
450
444
  };
451
445
  }
452
- //#endregion
453
- //#region src/ui/snapshot.ts
446
+ // src/ui/snapshot.ts
454
447
  /**
455
448
  * `docsUrl` on an ingested (live) result flows into `/data.json` responses, which the
456
449
  * client script renders into an <a href> without going through `renderAppShell`'s own
@@ -495,8 +488,7 @@ function buildSnapshot(store, config, meta, staticFailedRuleIds) {
495
488
  meta
496
489
  };
497
490
  }
498
- //#endregion
499
- //#region src/ui/middleware.ts
491
+ // src/ui/middleware.ts
500
492
  const SEVERITIES = /* @__PURE__ */ new Set([
501
493
  "critical",
502
494
  "warning",
@@ -621,8 +613,7 @@ function installUiMiddleware(server, config, version, store, coreVersion, getSta
621
613
  }
622
614
  });
623
615
  }
624
- //#endregion
625
- //#region src/ui/store.ts
616
+ // src/ui/store.ts
626
617
  /**
627
618
  * Merge rule (design doc §2): for a route with a live result set, static results whose
628
619
  * rule id appears in the live payload are replaced by the live ones — the handle reports
@@ -722,8 +713,7 @@ function createStore() {
722
713
  }
723
714
  };
724
715
  }
725
- //#endregion
726
- //#region src/ui/analysis.ts
716
+ // src/ui/analysis.ts
727
717
  /**
728
718
  * Apply `svelte-vitals-suppressions.json` to the whole-project layer, same entries as the build
729
719
  * gate (see `applySourceSuppressions`). A malformed file is a warning here, not an error: dev
@@ -822,8 +812,7 @@ function createAnalysisRunner(opts) {
822
812
  }
823
813
  };
824
814
  }
825
- //#endregion
826
- //#region src/plugin.ts
815
+ // src/plugin.ts
827
816
  const CONFIG_BASENAMES = /* @__PURE__ */ new Set([
828
817
  "svelte.config.js",
829
818
  "svelte.config.ts",
@@ -1078,5 +1067,4 @@ function svelteVitals(options = {}) {
1078
1067
  }
1079
1068
  }];
1080
1069
  }
1081
- //#endregion
1082
1070
  export { svelteVitals };
@@ -1,6 +1,6 @@
1
1
  import { ASIDE_DEMOTING_TAGS, IDREF_ATTRS, NAMING_ATTRS, SECTIONING_TAGS, decodeFragmentId, isClassicScriptType, isSvgSrc, isTopFragment, resolveLandmark, splitTokens, stripTextDirective } from "@svelte-vitals/core/internal";
2
2
  import { parse } from "node-html-parser";
3
- //#region src/providers/rendered/parse-html.ts
3
+ // src/providers/rendered/parse-html.ts
4
4
  /** The <img> is its `<picture>`'s fallback and a sibling `<source>` carries the srcset. */
5
5
  function pictureOffersSrcset(img) {
6
6
  const parent = img.parentNode;
@@ -202,8 +202,7 @@ function toOccurrenceMap(keys, file) {
202
202
  });
203
203
  return out;
204
204
  }
205
- //#endregion
206
- //#region src/loopback.ts
205
+ // src/loopback.ts
207
206
  /** Only the local dev server hosts the ingest endpoint, so never POST off-box. */
208
207
  function isLoopbackOrigin(origin) {
209
208
  try {
@@ -234,5 +233,4 @@ function isSameOrigin(origin, host, secure = false) {
234
233
  function effectivePort(url) {
235
234
  return url.port || (url.protocol === "https:" ? "443" : "80");
236
235
  }
237
- //#endregion
238
236
  export { toOccurrenceMap as i, isSameOrigin as n, parseHtmlHead as r, isLoopbackOrigin as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svelte-vitals/vite",
3
- "version": "0.55.3",
3
+ "version": "0.55.4",
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",
@@ -40,12 +40,12 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "esm-env": "^1.2.2",
43
- "node-html-parser": "^9.0.4"
43
+ "node-html-parser": "^9.0.7"
44
44
  },
45
45
  "peerDependencies": {
46
- "@svelte-vitals/core": "^0.55.3",
46
+ "@svelte-vitals/core": "^0.55.4",
47
47
  "@sveltejs/kit": "^2.0.0",
48
- "svelte-vitals": "^0.55.3",
48
+ "svelte-vitals": "^0.55.4",
49
49
  "vite": "^5.0.3 || ^6.0.0 || ^7.0.0 || ^8.0.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
@@ -54,13 +54,13 @@
54
54
  }
55
55
  },
56
56
  "devDependencies": {
57
- "@svelte-vitals/core": "0.55.3",
58
- "@sveltejs/kit": "^2.70.3",
59
- "@types/node": "^24.19.1",
60
- "happy-dom": "^20.14.5",
61
- "svelte": "^5.57.2",
62
- "svelte-vitals": "0.55.3",
63
- "vite": "^8.3.4"
57
+ "@svelte-vitals/core": "0.55.4",
58
+ "@sveltejs/kit": "^2.70.4",
59
+ "@types/node": "^24.19.2",
60
+ "happy-dom": "^21.0.4",
61
+ "svelte": "^5.57.3",
62
+ "svelte-vitals": "0.55.4",
63
+ "vite": "^8.3.6"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "tsdown",