@svelte-vitals/core 0.44.0 → 0.46.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/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { an as CATEGORIES, e as Category, i as Config, ao as Detection, F as Fix, J as JsonReport, ap as Presence, d as Result, aq as RuleEvidence, ar as RuleOptions, as as RuleOverride, at as RuleSetting, au as RuleSettingObject, av as ScoreModel, f as Severity, aw as Summary, ax as TreatDynamicAs, V as Value, ay as defineConfig } from './index-CWWQEu8q.js';
1
+ export { ap as CATEGORIES, f as Category, b as Config, aq as Detection, F as Fix, J as JsonReport, ar as Presence, R as Result, as as RuleEvidence, at as RuleOptions, au as RuleOverride, av as RuleSetting, aw as RuleSettingObject, ax as ScoreModel, g as Severity, ay as Summary, az as TreatDynamicAs, V as Value, aA as defineConfig, a0 as formatGithubReport, a2 as formatMarkdownReport, a3 as hasFailureAtOrAbove, ak as summarize } from './index-Cx3Mi_d4.js';
package/dist/index.js CHANGED
@@ -1,8 +1,16 @@
1
1
  import {
2
2
  CATEGORIES,
3
- defineConfig
4
- } from "./chunk-2N7E4JFX.js";
3
+ defineConfig,
4
+ formatGithubReport,
5
+ formatMarkdownReport,
6
+ hasFailureAtOrAbove,
7
+ summarize
8
+ } from "./chunk-M7RA6QQW.js";
5
9
  export {
6
10
  CATEGORIES,
7
- defineConfig
11
+ defineConfig,
12
+ formatGithubReport,
13
+ formatMarkdownReport,
14
+ hasFailureAtOrAbove,
15
+ summarize
8
16
  };
@@ -1,7 +1,14 @@
1
- import { C as ComponentFacts, S as SuppressionDirective, R as Runtime, K as KitAlias, a as KitModuleFacts, V as Value, b as Rule, c as RuleContext, d as Result, e as Category, f as Severity, F as Fix, g as RuleOptionSpec, H as HeadTag, h as ResolvedHead, I as ImageInfo, i as Config, J as JsonReport } from './index-CWWQEu8q.js';
2
- export { A as A11yOccurrenceInfo, B as BranchStep, j as Classification, k as CompiledOverride, E as EachBlockFact, l as EffectFact, m as HeadProvider, n as HeadingInfo, o as HealthResult, p as IDREF_ATTRS, L as LANDMARK_ROLES, O as OrphanEffectFact, P as Project, q as READ_CONCURRENCY, r as ResolvedA11y, s as ResolvedHeadings, t as ResolvedImages, u as RuleOptionsSpec, v as Scope, w as ScoreOptions, x as ScoreResult, y as SourceSpan, z as applyOverrides, D as applyRuleSeverities, G as buildJsonReport, M as classify, N as compileOverrides, Q as computeHealth, T as computeScore, U as decodeFragmentId, W as defaultConfig, X as defaultProject, Y as docsUrlFor, Z as effectiveSeverity, _ as foldOccurrences, $ as formatFailedRuleWarning, a0 as formatJsonReport, a1 as hasFailureAtOrAbove, a2 as intOption, a3 as isMentionedAnywhere, a4 as isPenalized, a5 as isTopFragment, a6 as listOption, a7 as mapOption, a8 as overrideMatches, a9 as resolveRuleOptions, aa as scoresByCategory, ab as selectRules, ac as settingOptions, ad as settingSeverity, ae as shouldSkipRangeCheck, af as skippedFileWarnings, ag as splitTokens, ah as stripTextDirective, ai as summarize, aj as validateRuleOptions, ak as validateRuleSetting, al as withFailedRulesOff, am as withReadLimit } from './index-CWWQEu8q.js';
1
+ import { S as SuppressionDirective, C as ComponentFacts, R as Result, a as Rule, b as Config, c as Runtime, K as KitAlias, d as KitModuleFacts, V as Value, e as RuleContext, f as Category, g as Severity, F as Fix, h as RuleOptionSpec, H as HeadTag, i as ResolvedHead, I as ImageInfo, J as JsonReport } from './index-Cx3Mi_d4.js';
2
+ export { A as A11yOccurrenceInfo, B as BranchStep, j as Classification, k as CompiledOverride, E as EachBlockFact, l as EffectFact, m as HeadProvider, n as HeadingInfo, o as HealthResult, p as IDREF_ATTRS, L as LANDMARK_ROLES, O as OrphanEffectFact, P as Project, q as READ_CONCURRENCY, r as ResolvedA11y, s as ResolvedHeadings, t as ResolvedImages, u as RuleOptionsSpec, v as Scope, w as ScoreOptions, x as ScoreResult, y as SourceSpan, z as applyOverrides, D as applyRuleSeverities, G as buildJsonReport, M as classify, N as compileOverrides, Q as computeHealth, T as computeScore, U as decodeFragmentId, W as defaultConfig, X as defaultProject, Y as docsUrlFor, Z as effectiveSeverity, _ as foldOccurrences, $ as formatFailedRuleWarning, a0 as formatGithubReport, a1 as formatJsonReport, a2 as formatMarkdownReport, a3 as hasFailureAtOrAbove, a4 as intOption, a5 as isMentionedAnywhere, a6 as isPenalized, a7 as isTopFragment, a8 as listOption, a9 as mapOption, aa as overrideMatches, ab as resolveRuleOptions, ac as scoresByCategory, ad as selectRules, ae as settingOptions, af as settingSeverity, ag as shouldSkipRangeCheck, ah as skippedFileWarnings, ai as splitTokens, aj as stripTextDirective, ak as summarize, al as validateRuleOptions, am as validateRuleSetting, an as withFailedRulesOff, ao as withReadLimit } from './index-Cx3Mi_d4.js';
3
3
  import { AST } from 'svelte/compiler';
4
4
 
5
+ /**
6
+ * Inline `svelte-vitals-disable-next-line` directives (issue #92). A plain text scan, not an
7
+ * AST walk, so `<script>` (`//`) and template (`<!-- -->`) comments are covered uniformly. The
8
+ * directive must be the entire content of its line; the suppressed line is directive-line + 1.
9
+ * Shared with the Kit-module parser (the security kit-module rules).
10
+ */
11
+ declare function collectSuppressions(source: string): SuppressionDirective[];
5
12
  /** What the per-file parsers produce — `ComponentFacts` minus `file`, with `suppressions` always present. */
6
13
  type ParsedFacts = Omit<ComponentFacts, 'file' | 'suppressions'> & {
7
14
  suppressions: SuppressionDirective[];
@@ -13,6 +20,33 @@ type ParsedFacts = Omit<ComponentFacts, 'file' | 'suppressions'> & {
13
20
  */
14
21
  declare function parseComponentFacts(source: string, filename: string): ParsedFacts;
15
22
 
23
+ /** File-relative-path → the inline directives collected from that file. */
24
+ type DirectiveIndex = ReadonlyMap<string, readonly SuppressionDirective[]>;
25
+ /**
26
+ * Apply inline `svelte-vitals-disable-next-line` directives to a finished result set — one
27
+ * mechanism, over `Result`s, so any rule that emits a line-anchored finding is covered by
28
+ * construction rather than by per-family wiring (design 2026-08-17).
29
+ *
30
+ * Runs on the output of `applyOverrides(applyRuleSeverities(...))`, so a directive silences
31
+ * whatever survived config, and every consumer downstream — scoring, `--fail-on`, the suppressions
32
+ * file, the reporters — sees the same suppressed set. `fileRule` keeps its own earlier filter and
33
+ * is unaffected: a result it already suppressed never arrives here, and its PASS is not penalized.
34
+ *
35
+ * A rule+route whose every penalized result was suppressed gains one PASS, located at the first
36
+ * suppressed result in emission order — the anchor the rules themselves use. Its message is the
37
+ * rule's `passLabel` when it declares one, else its `title`.
38
+ */
39
+ declare function applyInlineDirectives(results: readonly Result[], index: DirectiveIndex, rules: readonly Rule[], config: Config): Result[];
40
+ /**
41
+ * Directives naming a rule id that no rule declares. Unlike a directive that matches no finding —
42
+ * legitimate whenever the code was fixed, the rule turned off, or the run scoped — a misspelled id
43
+ * can never be right, so it is reported rather than silently suppressing nothing.
44
+ *
45
+ * Compared against every registered rule, not the selected ones: disabling a rule in config must
46
+ * not turn its directives into errors.
47
+ */
48
+ declare function unknownDirectiveIds(index: DirectiveIndex, rules: readonly Rule[]): string[];
49
+
16
50
  /**
17
51
  * Fallback facts for a file that fails to read or parse (dev tooling must never
18
52
  * throw). This is the single source of truth for the empty-facts shape — add new
@@ -626,6 +660,37 @@ declare const a11yPlaceholderLabelOption: Rule;
626
660
 
627
661
  declare const a11yRequireDatetime: Rule;
628
662
 
663
+ declare const a11yDeprecatedElement: Rule;
664
+
665
+ declare const a11yDeprecatedAttr: Rule;
666
+
667
+ declare const a11yDisallowedAriaProps: Rule;
668
+
669
+ declare const a11yDeprecatedAria: Rule;
670
+
671
+ declare const a11yDisallowedElement: Rule;
672
+
673
+ /**
674
+ * Content-model membership over the literal element tree
675
+ * (design 2026-08-20-permitted-contents-rule-design.md; measured
676
+ * 2026-08-20-permitted-contents-measured.md). Broken structure (closed containers, headings,
677
+ * structure-bound children) is `warning`; category mismatches are `info`.
678
+ */
679
+ declare const a11yPermittedContents: Rule;
680
+
681
+ /**
682
+ * a11y/required-element — every route must contain the elements the project declares (design
683
+ * 2026-08-19-config-driven-element-rules). Judged on the composed route: the layout chain, the page,
684
+ * every resolved component and the shell's `<body>`, because "`<main>` on every route" is a claim
685
+ * about the page the user sees, and a `+page.svelte` alone rarely holds it.
686
+ *
687
+ * Presence is open-world: an unresolved component can only add elements, so a route with every
688
+ * declared tag present passes however closed the world is. Absence needs the closed world for
689
+ * elements (`elementsClosed`), which spreads and expression ids do not disturb; a route missing a
690
+ * declared tag with the world open emits nothing.
691
+ */
692
+ declare const a11yRequiredElement: Rule;
693
+
629
694
  declare const a11yDoctype: Rule;
630
695
 
631
696
  /**
@@ -650,9 +715,9 @@ declare const a11yTopLevelLandmark: Rule;
650
715
  declare const a11yIdDuplication: Rule;
651
716
 
652
717
  /**
653
- * a11y/no-missing-id-ref — a `for`/`aria-labelledby`/`aria-describedby`/`aria-controls`/
654
- * `aria-activedescendant`/same-page `href="#…"` referencing an `id` absent from the composed
655
- * route. Universal ("no element anywhere defines this id") needs a closed world, so this rule
718
+ * a11y/no-missing-id-ref — an id-reference attribute (`IDREF_ATTRS`: HTML's `for`/`list`/`headers`/
719
+ * `form`/the popover and command targets, and every ARIA id-reference property) or a same-page
720
+ * `href="#…"` referencing an `id` absent from the composed route. Universal ("no element anywhere defines this id") needs a closed world, so this rule
656
721
  * runs only on routes `ctx.a11y[].fullyResolved` marks fully resolved — see the rule docs.
657
722
  */
658
723
  declare const a11yNoMissingIdRef: Rule;
@@ -667,6 +732,8 @@ interface RuleOptionInfo {
667
732
  default: number | readonly string[] | Readonly<Record<string, string>>;
668
733
  min?: number;
669
734
  max?: number;
735
+ /** For a `string-list` with a reserved grammar: what each entry must be, in words (the regex stays out of `explain --json`). */
736
+ pattern?: string;
670
737
  }
671
738
  interface RuleInfo {
672
739
  id: string;
@@ -801,22 +868,6 @@ declare function formatSarifReport(results: Result[], config: Config, meta: {
801
868
  version: string;
802
869
  }): string;
803
870
 
804
- /**
805
- * Render penalized findings as GitHub Actions workflow commands (issue #18, design slice 5).
806
- * GitHub turns these into inline PR annotations and run-annotation entries. Returns '' when clean.
807
- */
808
- declare function formatGithubReport(results: Result[], config: Config): string;
809
-
810
- /**
811
- * Render a compact Markdown summary — Health score, per-category table, severity counts, and
812
- * a findings table — suitable for a GitHub Actions job summary or a sticky PR comment
813
- * (`svelte-vitals ci install`). Delegates all aggregation to `buildJsonReport` so the numbers
814
- * never drift from the JSON/console reporters.
815
- */
816
- declare function formatMarkdownReport(results: Result[], config: Config, meta: {
817
- version: string;
818
- }): string;
819
-
820
871
  type Band = 'good' | 'warn' | 'poor';
821
872
  declare const BAND_COLOR: Record<Band, string>;
822
873
  declare function scoreBand(score: number): Band;
@@ -880,4 +931,4 @@ declare function formatHtmlReport(results: Result[], config: Config, meta: {
880
931
  coreVersion?: string;
881
932
  }): string;
882
933
 
883
- export { APP_SCRIPT, APP_STYLE, type AppSnapshot, BAND_COLOR, CHILD_NODE_KEYS, ComponentFacts, type ConsoleReportOptions, type FailedRule, HeadTag, ImageInfo, KitAlias, KitModuleFacts, type Palette, ROBOTS_SOURCE_PATHS, type RawKitAliases, ResolvedHead, type RouteBadge, Rule, RuleContext, type RuleInfo, type RuleOptionInfo, RuleOptionSpec, Runtime, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, SuppressionDirective, VITE_CONFIG_FILES, type ViteKitConfigResult, a11yAccessibleName, a11yDoctype, a11yDuplicateLandmark, a11yIdDuplication, a11yInteractiveNesting, a11yInvalidAriaValue, a11yInvalidRole, a11yLabelHasControl, a11yNoMissingIdRef, a11yPlaceholderLabelOption, a11yRequireDatetime, a11yRequiredAriaProps, a11yTopLevelLandmark, a11yUnknownAriaAttribute, a11yUseList, allRules, architectureComponentSize, architectureDirectoryNaming, architectureDocLinkTarget, architecturePrivateScopeImport, architecturePropCount, architectureReservedDirectoryNames, architectureReservedNamePlacement, architectureRouteComponentImport, architectureUnitEntryFile, attrText, attrTextOf, attrValue, attrValueOf, buildHtmlDocument, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, correctnessBasePathNavigation, correctnessCheckableBindValue, correctnessEachIndexKey, correctnessEachKey, correctnessEffectAsDerived, correctnessEffectAsOnMount, correctnessInstanceBrowserGlobal, correctnessNonreactiveBuiltinState, correctnessOrphanEffect, correctnessOrphanLifecycle, correctnessPropMutation, correctnessServerBrowserGlobal, correctnessStalePropDerivation, correctnessUnmutatedState, emptyComponentFacts, emptyKitModuleFacts, escapeHtml, explainRule, findAttr, findKitAliasesInSvelteConfig, findKitPathsBaseInSvelteConfig, findKitPathsBaseInViteConfig, findMinifyDisabled, formatAgentReport, formatConsoleReport, formatGithubReport, formatHtmlReport, formatMarkdownReport, formatSarifReport, headTagRule, imageRule, lineOf, linkRule, noColorPalette, parseComponentFacts, parseKitModuleFacts, parseSvelte, performanceFontPreloadCrossorigin, performanceHeavyImport, performanceImageDimensions, performanceImageLoadingHint, performanceLcpImage, performanceLoadWaterfall, performanceMinifyDisabled, performanceNamespaceImport, performancePreconnect, performancePreloadMissingAs, performanceRenderBlockingScript, performanceResponsiveImage, performanceSequentialAwaits, performanceStateRaw, renderAppShell, resolveKitAliases, resolveKitPathsBase, resolveRepoLocalPath, resolveRunesModuleSpecifier, runRules, safeHref, scoreBand, scoreColor, securityHandlerStateWrite, securityJavascriptUrl, securityRawHtml, securityServerModuleState, securitySharedStateImport, seoCanonicalUrl, seoCharset, seoDescriptionLength, seoDescriptionPresence, seoDuplicateDescription, seoDuplicateTitle, seoHeadingLevelSkip, seoHreflang, seoHtmlLang, seoImageAlt, seoIndexability, seoJsonLd, seoJsonLdDateFormat, seoJsonLdDeprecatedType, seoJsonLdPlaceholder, seoJsonLdRelativeUrl, seoJsonLdRequiredProps, seoJsonLdValidity, seoOgDescription, seoOgImage, seoOgTitle, seoOgUrl, seoRobotsTxt, seoSingleH1, seoSitemapInRobots, seoSitemapXml, seoSsrDisabled, seoTitleLength, seoTitlePresence, seoTwitterCard, seoViewport, terminalSafe, textFromNodes, valueFromNodes };
934
+ export { APP_SCRIPT, APP_STYLE, type AppSnapshot, BAND_COLOR, CHILD_NODE_KEYS, ComponentFacts, type ConsoleReportOptions, type DirectiveIndex, type FailedRule, HeadTag, ImageInfo, KitAlias, KitModuleFacts, type Palette, ROBOTS_SOURCE_PATHS, type RawKitAliases, ResolvedHead, type RouteBadge, Rule, RuleContext, type RuleInfo, type RuleOptionInfo, RuleOptionSpec, Runtime, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, SuppressionDirective, VITE_CONFIG_FILES, type ViteKitConfigResult, a11yAccessibleName, a11yDeprecatedAria, a11yDeprecatedAttr, a11yDeprecatedElement, a11yDisallowedAriaProps, a11yDisallowedElement, a11yDoctype, a11yDuplicateLandmark, a11yIdDuplication, a11yInteractiveNesting, a11yInvalidAriaValue, a11yInvalidRole, a11yLabelHasControl, a11yNoMissingIdRef, a11yPermittedContents, a11yPlaceholderLabelOption, a11yRequireDatetime, a11yRequiredAriaProps, a11yRequiredElement, a11yTopLevelLandmark, a11yUnknownAriaAttribute, a11yUseList, allRules, applyInlineDirectives, architectureComponentSize, architectureDirectoryNaming, architectureDocLinkTarget, architecturePrivateScopeImport, architecturePropCount, architectureReservedDirectoryNames, architectureReservedNamePlacement, architectureRouteComponentImport, architectureUnitEntryFile, attrText, attrTextOf, attrValue, attrValueOf, buildHtmlDocument, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, collectSuppressions, correctnessBasePathNavigation, correctnessCheckableBindValue, correctnessEachIndexKey, correctnessEachKey, correctnessEffectAsDerived, correctnessEffectAsOnMount, correctnessInstanceBrowserGlobal, correctnessNonreactiveBuiltinState, correctnessOrphanEffect, correctnessOrphanLifecycle, correctnessPropMutation, correctnessServerBrowserGlobal, correctnessStalePropDerivation, correctnessUnmutatedState, emptyComponentFacts, emptyKitModuleFacts, escapeHtml, explainRule, findAttr, findKitAliasesInSvelteConfig, findKitPathsBaseInSvelteConfig, findKitPathsBaseInViteConfig, findMinifyDisabled, formatAgentReport, formatConsoleReport, formatHtmlReport, formatSarifReport, headTagRule, imageRule, lineOf, linkRule, noColorPalette, parseComponentFacts, parseKitModuleFacts, parseSvelte, performanceFontPreloadCrossorigin, performanceHeavyImport, performanceImageDimensions, performanceImageLoadingHint, performanceLcpImage, performanceLoadWaterfall, performanceMinifyDisabled, performanceNamespaceImport, performancePreconnect, performancePreloadMissingAs, performanceRenderBlockingScript, performanceResponsiveImage, performanceSequentialAwaits, performanceStateRaw, renderAppShell, resolveKitAliases, resolveKitPathsBase, resolveRepoLocalPath, resolveRunesModuleSpecifier, runRules, safeHref, scoreBand, scoreColor, securityHandlerStateWrite, securityJavascriptUrl, securityRawHtml, securityServerModuleState, securitySharedStateImport, seoCanonicalUrl, seoCharset, seoDescriptionLength, seoDescriptionPresence, seoDuplicateDescription, seoDuplicateTitle, seoHeadingLevelSkip, seoHreflang, seoHtmlLang, seoImageAlt, seoIndexability, seoJsonLd, seoJsonLdDateFormat, seoJsonLdDeprecatedType, seoJsonLdPlaceholder, seoJsonLdRelativeUrl, seoJsonLdRequiredProps, seoJsonLdValidity, seoOgDescription, seoOgImage, seoOgTitle, seoOgUrl, seoRobotsTxt, seoSingleH1, seoSitemapInRobots, seoSitemapXml, seoSsrDisabled, seoTitleLength, seoTitlePresence, seoTwitterCard, seoViewport, terminalSafe, textFromNodes, unknownDirectiveIds, valueFromNodes };