@svelte-vitals/core 0.55.2 → 0.55.3

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.
@@ -430,6 +430,10 @@ interface HeadTag {
430
430
  /** Source file the tag came from (static mode); unset on a rendered head. */
431
431
  file?: string;
432
432
  }
433
+ /** Whether a `<link>`'s `rel` holds `token`: `rel` is a set of space-separated keywords (`dns-prefetch preconnect`). */
434
+ declare function hasRel(tag: {
435
+ rel?: string;
436
+ }, token: string): boolean;
433
437
  /** Resolved effective head for a single route (design §8). */
434
438
  interface ResolvedHead {
435
439
  /** Route path, e.g. '/blog/[slug]'. */
@@ -529,6 +533,8 @@ interface Project {
529
533
  value?: string;
530
534
  file: string;
531
535
  };
536
+ /** `kit.router.type: 'hash'` in `svelte.config.{js,ts}`: SvelteKit then never server-renders or prerenders a page. */
537
+ kitHashRouter?: true;
532
538
  /**
533
539
  * The project's compiled SvelteKit alias entries, in Kit's own order (`$lib` first), read from
534
540
  * `svelte.config.{js,ts}`. Absent means no config was read — resolution then falls back to
@@ -566,6 +572,8 @@ interface Project {
566
572
  * `<link rel="canonical">`, rendered on every route beside `%sveltekit.head%` (static mode).
567
573
  */
568
574
  appHtmlHeadTags?: Omit<HeadTag, 'presence' | 'file'>[];
575
+ /** HTML comments inside the shell's `<head>` (`<!--seo-head-->`), which a `transformPageChunk` hook may replace with tags. */
576
+ appHtmlHeadComments?: string[];
569
577
  }
570
578
  declare const defaultProject: Project;
571
579
  /** A concrete, agent-actionable remediation for a finding (design §10, issue #18). */
@@ -738,6 +746,10 @@ interface BranchStep {
738
746
  group: number;
739
747
  /** branch index within the group (if: 0..n consequent→else; await: 0=pending,1=then,2=catch) */
740
748
  branch: number;
749
+ /** A heading renders here whichever arm is taken: every arm of the block has one, a prop the use passes decides the arm, or the place's own conditions select it. */
750
+ always?: true;
751
+ /** The body of an `{#each}` (headings only): it may render any number of times, or none. */
752
+ repeat?: true;
741
753
  }
742
754
  /** Where a folded occurrence sits, for the finding location. */
743
755
  interface A11yOccurrenceInfo {
@@ -889,7 +901,7 @@ declare function stripTextDirective(fragment: string): string;
889
901
  * so seo/single-h1 never needs to know which mode produced them.
890
902
  */
891
903
  interface HeadingInfo {
892
- /** Heading level 1–6 (the `n` in <hn>). */
904
+ /** Heading level: 1–6 (the `n` in <hn>), an ARIA heading's `aria-level`, or 0 when the source does not determine it (source mode). */
893
905
  level: number;
894
906
  /** 1-based source line, or 0 if unknown (rendered mode does not track lines). */
895
907
  line: number;
@@ -901,6 +913,15 @@ interface HeadingInfo {
901
913
  * above it. Group numbers are route-wide: each file instance has its own range.
902
914
  */
903
915
  path?: BranchStep[];
916
+ /**
917
+ * Its place in document order (source mode): the source offset of each placement from the route's
918
+ * outermost file down — a layout's `{@render children()}`, a component's tag, a snippet's
919
+ * `{@render}` — and last its own. Compared element by element (`documentOrder`); rendered-mode
920
+ * headings carry none and arrive in order.
921
+ */
922
+ order?: number[];
923
+ /** A `role="heading"` element: it holds its outline level for seo/heading-level-skip, but is not an `<h1>` for seo/single-h1. */
924
+ aria?: true;
904
925
  }
905
926
  /** Resolved page-body headings for a single route (page + layout chain). */
906
927
  interface ResolvedHeadings {
@@ -908,9 +929,8 @@ interface ResolvedHeadings {
908
929
  headings: HeadingInfo[];
909
930
  /**
910
931
  * Headings found in child components rendered (transitively) by this route's
911
- * chain files — source mode only; absent in rendered mode. Kept separate from
912
- * `headings` because their position in document order is unknown: safe for
913
- * counting (seo/single-h1), unusable for outline order (seo/heading-level-skip).
932
+ * chain files — source mode only; absent in rendered mode. Their `order` places
933
+ * them among `headings`.
914
934
  */
915
935
  componentHeadings?: HeadingInfo[];
916
936
  /**
@@ -965,6 +985,13 @@ interface KitModuleFacts {
965
985
  resolved: string;
966
986
  line: number;
967
987
  }[];
988
+ /** The targets of the `.set()`/`.update()` writes recorded in `importedStateWrites` from a handler, for the collector to drop those that reach a persistence client. */
989
+ storeWriteTargets?: {
990
+ name: string;
991
+ imported: string;
992
+ resolved: string;
993
+ line: number;
994
+ }[];
968
995
  /** Value imports whose specifier resolves to a repo-local `.svelte.ts`/`.svelte.js` runes module (security/shared-state-import). */
969
996
  runesModuleImports: {
970
997
  source: string;
@@ -978,7 +1005,7 @@ interface KitModuleFacts {
978
1005
  line: number;
979
1006
  inHandler: boolean;
980
1007
  }[];
981
- /** Browser-global reads in server-executed positions — top level, handler bodies, the `init` hook (correctness/server-browser-global). Empty when the file itself exports `ssr = false`. */
1008
+ /** Browser-global reads in server-executed positions — top level, handler bodies, the `init` hook (correctness/server-browser-global). Empty when the file itself exports a literal `ssr = false`. */
982
1009
  browserGlobalRefs: {
983
1010
  name: string;
984
1011
  line: number;
@@ -986,18 +1013,46 @@ interface KitModuleFacts {
986
1013
  }[];
987
1014
  /** Root-relative `redirect()` literals in this Kit module (correctness/base-path-navigation). */
988
1015
  basePathLinks: BasePathLinkFact[];
989
- /** Set when this file disables SSR via `export const ssr = false` (inline or same-file alias export) — the declaration's line (seo/ssr-disabled). */
1016
+ /** Set when this file disables SSR via `export const ssr = false` or `= dev` (inline or same-file alias export) — the declaration's line (seo/ssr-disabled). */
990
1017
  ssrDisabled?: {
991
1018
  line: number;
992
1019
  };
993
1020
  /** Set when this file exports `ssr` as anything but a literal `false` (`true`, a computed value, a re-export) — it may turn SSR back on under a layout's `ssr = false` (see `appSsrDisabled`, `routeNeverSsr`). */
994
1021
  ssrEnabled?: true;
1022
+ /** Set when this file exports `ssr` as the literal `true` (inline or same-file alias export); implies `ssrEnabled`. */
1023
+ ssrTrue?: true;
995
1024
  /** Set when this file disables client-side rendering via `export const csr = false` (inline or same-file alias export). With no client runtime, a universal load only runs during SSR — performance/load-waterfall's browser-waterfall premise doesn't hold. */
996
1025
  csrDisabled?: {
997
1026
  line: number;
998
1027
  };
1028
+ /** Set when this file exports `csr` as anything but `false` — it may turn CSR back on under a layout's `csr = false` (see `universalNeverCsr`). */
1029
+ csrEnabled?: true;
999
1030
  /** Set when the exported `load` redirects or throws `error()` on every call — every path through its body reaches a `redirect()`/`error()` before any `return`, directly or through a same-file top-level function that always does (see `loadNeverRenders` in kit-module-parse.ts). A `+page` module carrying it means the route never renders its own page. */
1000
1031
  loadNeverRenders?: true;
1032
+ /** Set when the exported `load` redirects or errors on every call once `if (building)` (from `$app/environment`) is read false, as on every request; the page renders only if its route is prerendered (see `prerenderExported`). */
1033
+ loadNeverRendersOutsideBuild?: true;
1034
+ /** The module exports `prerender`, in any form. */
1035
+ prerenderExported?: true;
1036
+ /** The request paths the exported `handle` of a hooks file answers before calling `resolve` (see `handleAnsweredPaths` in kit-module-parse.ts): a route they cover never renders. */
1037
+ answeredPaths?: {
1038
+ op: 'eq' | 'starts';
1039
+ v: string;
1040
+ }[];
1041
+ /** The string literals a `transformPageChunk` the exported `handle` passes to `resolve` replaces in the page HTML (`html.replace('<!--seo-head-->', …)`). */
1042
+ pageChunkTokens?: string[];
1043
+ /** The imported flag a load's leading guard reads (`if (!FLAG) redirect(…)`): `collectKitModuleFacts` sets `loadNeverRenders` when that export is the literal `false`. */
1044
+ pendingFlagGuard?: {
1045
+ resolved: string;
1046
+ name: string;
1047
+ member?: string;
1048
+ };
1049
+ /** The imported factory `export const load = factory(…)` calls: `collectKitModuleFacts` sets `loadNeverRenders` when the function it returns redirects or errors on every call. */
1050
+ pendingLoadFactory?: {
1051
+ resolved: string;
1052
+ name: string;
1053
+ };
1054
+ /** Set when the exported `load` sends a request without a session away before rendering (see `loadGatesOnLocals` in kit-module-parse.ts); every route under a `+layout` carrying it is behind a login. */
1055
+ loadGated?: true;
1001
1056
  /** Sequential-await analysis of the exported `load` function (performance/load-waterfall, performance/sequential-awaits): 1-based lines of await sites that depend on an earlier await's result, and of sites independent of all earlier awaits. Set only when at least one list is non-empty. */
1002
1057
  loadWaterfalls?: {
1003
1058
  dependentLines: number[];
@@ -1011,7 +1066,22 @@ interface KitModuleFacts {
1011
1066
  readFailed?: true;
1012
1067
  }
1013
1068
  /** The rule-context fields the per-route SSR resolution reads. */
1014
- type SsrScope = Pick<RuleContext, 'kitModules' | 'components' | 'sourceFiles'>;
1069
+ type SsrScope = Pick<RuleContext, 'kitModules' | 'components' | 'sourceFiles'> & {
1070
+ project?: Pick<Project, 'kitHashRouter'>;
1071
+ };
1072
+ /**
1073
+ * Whether a `+page` file's route never renders because a layout above it redirects or errors in its
1074
+ * `load` on every call (`loadNeverRenders`). Not the root layout: one that sent every request away
1075
+ * would leave the app nothing to serve, so that reading is more likely wrong than the app, and acting
1076
+ * on it would silence every route.
1077
+ */
1078
+ declare function layoutNeverRenders(file: string, scope: SsrScope): boolean;
1079
+ /**
1080
+ * Whether a `+page` file's route never renders because its own `load` redirects or errors on every
1081
+ * request, a build-time `if (building)` aside (`loadNeverRendersOutsideBuild`), and nothing on its chain
1082
+ * exports `prerender`, so the build never renders it either.
1083
+ */
1084
+ declare function pageRendersOnlyWhenBuilding(file: string, scope: SsrScope): boolean;
1015
1085
  /** Whether a `+page`/`+layout` file (module or component) belongs to a route that is never server-rendered. */
1016
1086
  declare function routeNeverSsr(file: string, scope: SsrScope): boolean;
1017
1087
  //#endregion
@@ -1343,8 +1413,13 @@ declare function buildJsonReport(results: Result[], config: Config, meta: {
1343
1413
  version: string;
1344
1414
  }, ruleIds?: readonly string[], examined?: Record<string, Record<string, number>>, skipped?: JsonReport['skipped']): JsonReport;
1345
1415
  /** Render results as the documented JSON report string (design §7). */
1346
- declare function formatJsonReport(results: Result[], config: Config, meta: {
1416
+ declare function formatJsonReport(...args: Parameters<typeof formatJsonReportChunks>): string;
1417
+ /**
1418
+ * `formatJsonReport`'s text in pieces, one route at a time: a large prerendered site's report is
1419
+ * longer than the longest string V8 can hold.
1420
+ */
1421
+ declare function formatJsonReportChunks(results: Result[], config: Config, meta: {
1347
1422
  version: string;
1348
- }, ruleIds?: readonly string[], examined?: Record<string, Record<string, number>>, skipped?: JsonReport['skipped']): string;
1423
+ }, ruleIds?: readonly string[], examined?: Record<string, Record<string, number>>, skipped?: JsonReport['skipped']): Generator<string>;
1349
1424
  //#endregion
1350
- export { formatGithubReport as $, routeNeverSsr as A, EachBlockFact as At, NAMING_ATTRS as B, compileOverrides as C, defaultConfig as Ct, withFailedRulesOff as D, ResolvedHead as Dt, settingSeverity as E, HeadTag as Et, ANCESTRY_DEPENDENT_TAGS as F, collectComponentFacts as Ft, isTopFragment as G, SECTIONING_TAGS as H, ASIDE_DEMOTING_TAGS as I, emptyComponentFacts as It, stripTextDirective as J, resolveLandmark as K, BranchStep as L, skippedFileWarnings as Lt, ResolvedHeadings as M, OrphanEffectFact as Mt, A11yOccurrenceInfo as N, SourceSpan as Nt, withIndexableOff as O, isClassicScriptType as Ot, A11ySkipCause as P, SuppressionDirective as Pt, formatMarkdownReport as Q, IDREF_ATTRS as R, Runtime as Rt, SEARCH_RESULT_RULES as S, Value as St, selectRules as T, defineConfig as Tt, decodeFragmentId as U, ResolvedA11y as V, foldOccurrences as W, ResolvedImages as X, ImageInfo as Y, isSvgSrc as Z, isPlainObject as _, RuleSetting as _t, HealthResult as a, summarize as at, validateRuleSetting as b, Severity as bt, ScoreResult as c, Config as ct, Rule as d, KitAlias as dt, Classification as et, RuleContext as f, Presence as ft, RuleOptionsSpec as g, RuleOverride as gt, RuleOptionSpec as h, RuleOptions as ht, formatJsonReport as i, hasFailureAtOrAbove as it, HeadingInfo as j, EffectFact as jt, KitModuleFacts as k, ComponentFacts as kt, computeHealth as l, Detection as lt, isPenalized as m, Result as mt, RuleEvidence as n, classify as nt, ScoreModel as o, CATEGORIES as ot, docsUrlFor as p, Project as pt, splitTokens as q, buildJsonReport as r, effectiveSeverity as rt, ScoreOptions as s, Category as st, JsonReport as t, Summary as tt, computeScore as u, Fix as ut, resolveRuleOptions as v, RuleSettingObject as vt, formatFailedRuleWarning as w, defaultProject as wt, CompiledOverride as x, TreatDynamicAs as xt, shouldSkipRangeCheck as y, Scope as yt, LandmarkInput as z, withReadLimit as zt };
1425
+ export { ResolvedImages as $, KitModuleFacts as A, ResolvedHead as At, BranchStep as B, emptyComponentFacts as Bt, SEARCH_RESULT_RULES as C, Severity as Ct, settingSeverity as D, defaultProject as Dt, selectRules as E, defaultConfig as Et, ResolvedHeadings as F, EffectFact as Ft, SECTIONING_TAGS as G, LandmarkInput as H, Runtime as Ht, A11yOccurrenceInfo as I, OrphanEffectFact as It, isTopFragment as J, decodeFragmentId as K, A11ySkipCause as L, SourceSpan as Lt, pageRendersOnlyWhenBuilding as M, isClassicScriptType as Mt, routeNeverSsr as N, ComponentFacts as Nt, withFailedRulesOff as O, defineConfig as Ot, HeadingInfo as P, EachBlockFact as Pt, ImageInfo as Q, ANCESTRY_DEPENDENT_TAGS as R, SuppressionDirective as Rt, CompiledOverride as S, Scope as St, formatFailedRuleWarning as T, Value as Tt, NAMING_ATTRS as U, withReadLimit as Ut, IDREF_ATTRS as V, skippedFileWarnings as Vt, ResolvedA11y as W, splitTokens as X, resolveLandmark as Y, stripTextDirective as Z, RuleOptionsSpec as _, Result as _t, formatJsonReportChunks as a, classify as at, shouldSkipRangeCheck as b, RuleSetting as bt, ScoreOptions as c, summarize as ct, computeScore as d, Config as dt, isSvgSrc as et, Rule as f, Detection as ft, RuleOptionSpec as g, Project as gt, isPenalized as h, Presence as ht, formatJsonReport as i, Summary as it, layoutNeverRenders as j, hasRel as jt, withIndexableOff as k, HeadTag as kt, ScoreResult as l, CATEGORIES as lt, docsUrlFor as m, KitAlias as mt, RuleEvidence as n, formatGithubReport as nt, HealthResult as o, effectiveSeverity as ot, RuleContext as p, Fix as pt, foldOccurrences as q, buildJsonReport as r, Classification as rt, ScoreModel as s, hasFailureAtOrAbove as st, JsonReport as t, formatMarkdownReport as tt, computeHealth as u, Category as ut, isPlainObject as v, RuleOptions as vt, compileOverrides as w, TreatDynamicAs as wt, validateRuleSetting as x, RuleSettingObject as xt, resolveRuleOptions as y, RuleOverride as yt, ASIDE_DEMOTING_TAGS as z, collectComponentFacts as zt };