@svelte-vitals/core 0.55.0 → 0.55.2

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,2 +1,2 @@
1
- import { $ as formatMarkdownReport, Ct as Value, Et as defineConfig, St as TreatDynamicAs, _t as RuleOverride, at as hasFailureAtOrAbove, ct as Category, dt as Fix, et as formatGithubReport, gt as RuleOptions, ht as Result, lt as Config, n as RuleEvidence, nt as Summary, o as ScoreModel, ot as summarize, pt as Presence, st as CATEGORIES, t as JsonReport, ut as Detection, vt as RuleSetting, xt as Severity, yt as RuleSettingObject } from "./json-DcTYXhKc.js";
1
+ import { $ as formatGithubReport, Q as formatMarkdownReport, St as Value, Tt as defineConfig, _t as RuleSetting, at as summarize, bt as Severity, ct as Config, ft as Presence, gt as RuleOverride, ht as RuleOptions, it as hasFailureAtOrAbove, lt as Detection, mt as Result, n as RuleEvidence, o as ScoreModel, ot as CATEGORIES, st as Category, t as JsonReport, tt as Summary, ut as Fix, vt as RuleSettingObject, xt as TreatDynamicAs } from "./json-BQf9Qb2D.js";
2
2
  export { CATEGORIES, type Category, type Config, type Detection, type Fix, type JsonReport, type Presence, type Result, type RuleEvidence, type RuleOptions, type RuleOverride, type RuleSetting, type RuleSettingObject, type ScoreModel, type Severity, type Summary, type TreatDynamicAs, type Value, defineConfig, formatGithubReport, formatMarkdownReport, hasFailureAtOrAbove, summarize };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { Cr as summarize, Er as CATEGORIES, Sr as hasFailureAtOrAbove, c as formatGithubReport, kr as defineConfig, t as formatMarkdownReport } from "./markdown-CgcwmqWX.js";
1
+ import { Or as CATEGORIES, Tr as summarize, c as formatGithubReport, jr as defineConfig, t as formatMarkdownReport, wr as hasFailureAtOrAbove } from "./markdown-DgHBAvYl.js";
2
2
  export { CATEGORIES, defineConfig, formatGithubReport, formatMarkdownReport, hasFailureAtOrAbove, summarize };
@@ -1,6 +1,12 @@
1
- import { $ as formatMarkdownReport, A as A11yOccurrenceInfo, At as OrphanEffectFact, B as decodeFragmentId, C as compileOverrides, Ct as Value, D as withFailedRulesOff, Dt as ComponentFacts, E as settingSeverity, F as IDREF_ATTRS, Ft as skippedFileWarnings, G as stripTextDirective, H as isTopFragment, I as LandmarkInput, It as Runtime, J as ImageInfo, K as HeadingInfo, L as NAMING_ATTRS, Lt as withReadLimit, M as ANCESTRY_DEPENDENT_TAGS, Mt as SuppressionDirective, N as ASIDE_DEMOTING_TAGS, Nt as collectComponentFacts, O as withIndexableOff, Ot as EachBlockFact, P as BranchStep, Pt as emptyComponentFacts, Q as isClassicScriptType, R as ResolvedA11y, S as SEARCH_RESULT_RULES, T as selectRules, Tt as defaultProject, U as resolveLandmark, V as foldOccurrences, W as splitTokens, X as HeadTag, Y as ResolvedImages, Z as ResolvedHead, _ as isPlainObject, a as HealthResult, at as hasFailureAtOrAbove, b as validateRuleSetting, bt as Scope, c as ScoreResult, ct as Category, d as Rule, dt as Fix, et as formatGithubReport, f as RuleContext, ft as KitAlias, g as RuleOptionsSpec, h as RuleOptionSpec, ht as Result, i as formatJsonReport, it as effectiveSeverity, j as A11ySkipCause, jt as SourceSpan, k as KitModuleFacts, kt as EffectFact, l as computeHealth, lt as Config, m as isPenalized, mt as Project, ot as summarize, p as docsUrlFor, q as ResolvedHeadings, r as buildJsonReport, rt as classify, s as ScoreOptions, t as JsonReport, tt as Classification, u as computeScore, v as resolveRuleOptions, w as formatFailedRuleWarning, wt as defaultConfig, x as CompiledOverride, xt as Severity, y as shouldSkipRangeCheck, z as SECTIONING_TAGS } from "./json-DcTYXhKc.js";
1
+ import { $ as formatGithubReport, A as routeNeverSsr, At as EachBlockFact, B as NAMING_ATTRS, C as compileOverrides, Ct as defaultConfig, D as withFailedRulesOff, Dt as ResolvedHead, E as settingSeverity, Et as HeadTag, F as ANCESTRY_DEPENDENT_TAGS, Ft as collectComponentFacts, G as isTopFragment, H as SECTIONING_TAGS, I as ASIDE_DEMOTING_TAGS, It as emptyComponentFacts, J as stripTextDirective, K as resolveLandmark, L as BranchStep, Lt as skippedFileWarnings, M as ResolvedHeadings, Mt as OrphanEffectFact, N as A11yOccurrenceInfo, Nt as SourceSpan, O as withIndexableOff, Ot as isClassicScriptType, P as A11ySkipCause, Pt as SuppressionDirective, Q as formatMarkdownReport, R as IDREF_ATTRS, Rt as Runtime, S as SEARCH_RESULT_RULES, St as Value, T as selectRules, U as decodeFragmentId, V as ResolvedA11y, W as foldOccurrences, X as ResolvedImages, Y as ImageInfo, Z as isSvgSrc, _ as isPlainObject, a as HealthResult, at as summarize, b as validateRuleSetting, bt as Severity, c as ScoreResult, ct as Config, d as Rule, dt as KitAlias, et as Classification, f as RuleContext, g as RuleOptionsSpec, h as RuleOptionSpec, i as formatJsonReport, it as hasFailureAtOrAbove, j as HeadingInfo, jt as EffectFact, k as KitModuleFacts, kt as ComponentFacts, l as computeHealth, m as isPenalized, mt as Result, nt as classify, p as docsUrlFor, pt as Project, q as splitTokens, r as buildJsonReport, rt as effectiveSeverity, s as ScoreOptions, st as Category, t as JsonReport, u as computeScore, ut as Fix, v as resolveRuleOptions, w as formatFailedRuleWarning, wt as defaultProject, x as CompiledOverride, y as shouldSkipRangeCheck, yt as Scope, z as LandmarkInput, zt as withReadLimit } from "./json-BQf9Qb2D.js";
2
2
  import { AST } from "svelte/compiler";
3
3
  //#region src/component-parse.d.ts
4
+ type Node$1 = any;
5
+ /**
6
+ * Export names of a module's constant lists — `export const X = [ … ]`, or a local one exported by
7
+ * name — that the module itself never writes (correctness/each-key, correctness/each-index-key).
8
+ */
9
+ export declare function collectConstantListExports(program: Node$1): Set<string>;
4
10
  /** What the per-file parsers produce — `ComponentFacts` minus `file`, with `suppressions` always present. */
5
11
  type ParsedFacts = Omit<ComponentFacts, 'file' | 'suppressions'> & {
6
12
  suppressions: SuppressionDirective[];
@@ -13,6 +19,7 @@ type ParsedFacts = Omit<ComponentFacts, 'file' | 'suppressions'> & {
13
19
  export declare function parseComponentFacts(source: string, filename: string): ParsedFacts;
14
20
  //#endregion
15
21
  //#region src/module-ast.d.ts
22
+ type Node = any;
16
23
  /**
17
24
  * Inline `svelte-vitals-disable-next-line` directives (issue #92). A plain text scan, not an
18
25
  * AST walk, so `<script>` (`//`) and template (`<!-- -->`) comments are covered uniformly. The
@@ -20,6 +27,20 @@ export declare function parseComponentFacts(source: string, filename: string): P
20
27
  * Shared with the Kit-module parser (the security kit-module rules).
21
28
  */
22
29
  export declare function collectSuppressions(source: string): SuppressionDirective[];
30
+ /**
31
+ * Parse a plain TS/JS module source by wrapping it in a `<script lang="ts">` tag —
32
+ * the Svelte script parser handles TS natively, so no extra parser dependency is
33
+ * needed. Literal "</script" occurrences are neutralised with a same-length
34
+ * placeholder first (string contents don't affect fact extraction; offsets are
35
+ * preserved). Returns the ESTree Program and the wrapped source — wrapped line
36
+ * numbers are +1 relative to the input, so callers subtract 1. Shared by the
37
+ * runes-module facts (correctness/orphan-effect) and the Kit-module facts (the security kit-module rules).
38
+ */
39
+ type ParsedModule = {
40
+ program: Node | undefined;
41
+ wrapped: string;
42
+ };
43
+ export declare function parseModuleProgram(source: string, filename: string): ParsedModule;
23
44
  //#endregion
24
45
  //#region src/inline-directives.d.ts
25
46
  /** File-relative-path → the inline directives collected from that file. */
@@ -68,8 +89,12 @@ export declare function collectSourceFiles(rt: Runtime, cwd: string): Promise<st
68
89
  * be a project-local module: the caller's `aliases` list decides which non-relative
69
90
  * specifiers resolve, defaulting to `$lib` → `src/lib`; `./`/`../` resolve against the
70
91
  * importing file's directory; bare packages and other aliases are skipped (they can't
71
- * be resolved to a project-local path at all). Also undefined when a relative
72
- * specifier's `..` segments escape the project root (see `normalizePosix`), or when a
92
+ * be resolved to a project-local path at all). A path above the project root (a leading `../`
93
+ * run) resolves only inside a directory a `kit.alias` value itself names above the root
94
+ * (`$plugins: '../../plugins'` in a monorepo app): the user's config says the app builds from
95
+ * there, so it is read like `src/` — likewise inside a workspace package's directory an entry
96
+ * names as its `root` — and anywhere else above the root is undefined, as nothing says the app
97
+ * reaches it. Also undefined when a
73
98
  * matched alias's value is itself absolute (e.g. `/opt/shared/src`, or a posixified Windows
74
99
  * drive-letter path like `C:/shared/src`): an absolute target is outside the analyzed project by
75
100
  * definition, and without this check `normalizePosix` would quietly drop the leading empty
@@ -78,7 +103,7 @@ export declare function collectSourceFiles(rt: Runtime, cwd: string): Promise<st
78
103
  * Exported from the package's public barrel because `architecture/private-scope-import`
79
104
  * and `architecture/route-component-import` (inside `packages/core`) both need resolution
80
105
  * that is not restricted to runes modules, unlike `resolveRunesModuleSpecifier` — and
81
- * because `resolveComponentPath` (`packages/cli/src/providers/source/resolve.ts`), which
106
+ * because component resolution (`packages/cli/src/providers/source/resolve.ts`), which
82
107
  * drives transitive `<head>`/heading resolution, delegates its alias/`$lib`/relative
83
108
  * mapping here too, rather than duplicating it. This is the single site for every
84
109
  * repo-local specifier resolution in the repo.
@@ -122,6 +147,14 @@ export declare function resolveKitAliases(viteConfig: {
122
147
  } | undefined, svelteConfig: {
123
148
  source: string;
124
149
  } | undefined): KitAlias[] | undefined;
150
+ /**
151
+ * `aliases` followed by the project's package.json `imports` entries (`"#lib/*": "./src/lib/*"`),
152
+ * after Kit's own: Vite's alias plugin resolves before Node-style subpath imports. The entries are
153
+ * ordered by Node's precedence — exact keys, then patterns by longest prefix — because the alias
154
+ * resolver takes the first match. Only a project-relative target counts; anything else is skipped,
155
+ * which leaves the specifier unresolved as before.
156
+ */
157
+ export declare function withPackageImports(aliases: KitAlias[] | undefined, packageJsonSource: string | undefined): KitAlias[] | undefined;
125
158
  /**
126
159
  * The project's effective `kit.paths.base`, following SvelteKit's precedence: the `sveltekit()`
127
160
  * plugin config when it carries one, otherwise `svelte.config`. `file` is the config the base
@@ -138,6 +171,44 @@ export declare function resolveKitPathsBase(viteConfig: {
138
171
  file: string;
139
172
  } | undefined;
140
173
  //#endregion
174
+ //#region src/workspace-packages.d.ts
175
+ /** A package the app declares, from its repository or its `node_modules`: `dir` is relative to the app. */
176
+ interface WorkspacePackage {
177
+ name: string;
178
+ dir: string;
179
+ /** The package's `package.json` source. */
180
+ manifest: string;
181
+ }
182
+ /**
183
+ * The app's dependencies that link a package of the same repository, name → range: a `workspace:`
184
+ * version range, or a `link:`/`file:` path. A `workspace:` range that renames (`workspace:other@*`)
185
+ * or names a path is left out, since the specifier would not be the package's own name.
186
+ */
187
+ export declare function declaredLocalPackages(packageJsonSource: string | undefined): Map<string, string>;
188
+ /** The `packages:` globs of a `pnpm-workspace.yaml`, in block (`- 'apps/*'`) or flow (`[a, b]`) form. */
189
+ export declare function pnpmWorkspaceGlobs(yaml: string): string[];
190
+ /** A root `package.json`'s `workspaces` globs (an array, or `{ packages }`); undefined when it declares none. */
191
+ export declare function packageJsonWorkspaceGlobs(source: string | undefined): string[] | undefined;
192
+ /**
193
+ * `aliases` widened with the app's workspace packages, the way the bundler sees them: an alias
194
+ * whose value points into `node_modules/<package>` names the package's own directory (the link a
195
+ * workspace install creates, readable whether or not it was installed), and every package's
196
+ * `exports` follows the aliases, as Vite resolves a bare specifier only after its alias plugin.
197
+ */
198
+ export declare function withWorkspacePackages(aliases: KitAlias[] | undefined, packages: readonly WorkspacePackage[]): KitAlias[] | undefined;
199
+ /**
200
+ * The app's dependencies that an install puts in `node_modules`: every declared name whose range is
201
+ * not a local protocol (`workspace:`, `link:`, `file:`, `portal:`). Those are the workspace
202
+ * resolver's, whose bounds must not be sidestepped through their `node_modules` link.
203
+ */
204
+ export declare function declaredInstalledPackages(packageJsonSource: string | undefined): string[];
205
+ /**
206
+ * `aliases` widened with the Svelte packages installed in `node_modules` (`dir` is the textual
207
+ * `node_modules/<name>` path, relative to the app), compiled like workspace packages. Packages that
208
+ * publish no Svelte marker get no entries: nothing they export is a component.
209
+ */
210
+ export declare function withInstalledPackages(aliases: KitAlias[] | undefined, packages: readonly WorkspacePackage[]): KitAlias[] | undefined;
211
+ //#endregion
141
212
  //#region src/svelte-ast.d.ts
142
213
  /**
143
214
  * Parse a `.svelte` source, tolerating style blocks written in a CSS dialect.
@@ -193,6 +264,10 @@ export declare function attrTextOf(attr: AST.Attribute): string | undefined;
193
264
  export declare const ROBOTS_SOURCE_PATHS: readonly ["static/robots.txt", "src/routes/robots.txt/+server.ts", "src/routes/robots.txt/+server.js"];
194
265
  /** Locations that satisfy the sitemap.xml project rule (seo/sitemap-xml). */
195
266
  export declare const SITEMAP_SOURCE_PATHS: readonly ["static/sitemap.xml", "src/routes/sitemap.xml/+server.ts", "src/routes/sitemap.xml/+server.js"];
267
+ /** The `+server` endpoints above, wherever (group) directories nest them — filter with `servesRootFile`. */
268
+ export declare const ROOT_FILE_ENDPOINT_GLOB = "src/routes/**/{robots.txt,sitemap.xml}/+server.{ts,js}";
269
+ /** Whether a `+server` endpoint serves `/<file>`: (group) directories add no URL segment. */
270
+ export declare function servesRootFile(rel: string, file: 'robots.txt' | 'sitemap.xml'): boolean;
196
271
  /** Vite's own config resolution order — only the first existing file is the one Vite loads. */
197
272
  export declare const VITE_CONFIG_FILES: readonly ["vite.config.js", "vite.config.mjs", "vite.config.ts", "vite.config.cjs", "vite.config.mts", "vite.config.cts"];
198
273
  /** SvelteKit's config resolution order (`@sveltejs/kit` checks js before ts). */
@@ -375,19 +450,6 @@ export declare const seoImageAlt: Rule;
375
450
  export declare const seoHreflang: Rule;
376
451
  //#endregion
377
452
  //#region src/rules/seo/single-h1.d.ts
378
- /**
379
- * seo/single-h1 — Heading hierarchy (single H1). Reads the per-route page-body headings
380
- * channel (collected by both providers), counting `headings` plus `componentHeadings`
381
- * (static mode only — headings found transitively in rendered child components) as one
382
- * combined list. Zero <h1> (no primary heading) is a `warning`: defensible, a page needs
383
- * a primary heading. Two or more is only `info`: a single <h1> is the conventional
384
- * signal, but no official source documents a ranking penalty for several (2026-08-09 v1
385
- * rule-validity review, P2 #11) — so it's flagged as a style nit, not a defect. Exactly
386
- * one passes. A route whose headings were not collected (channel unset) emits nothing, as does
387
- * one whose `dynamicHeading` flag says an undeterminable `<svelte:element>` may be its <h1>. A
388
- * global `rules: { 'seo/single-h1': <severity> }` override flattens both arms to one
389
- * severity (design, `applyRuleSeverities`).
390
- */
391
453
  export declare const seoSingleH1: Rule;
392
454
  //#endregion
393
455
  //#region src/rules/seo/duplicate-title.d.ts
@@ -975,4 +1037,4 @@ export declare function formatHtmlReport(results: Result[], config: Config, meta
975
1037
  coreVersion?: string;
976
1038
  }): string;
977
1039
  //#endregion
978
- export { type A11yOccurrenceInfo, type A11ySkipCause, ANCESTRY_DEPENDENT_TAGS, ASIDE_DEMOTING_TAGS, type AppSnapshot, type BranchStep, type Classification, type CompiledOverride, type ComponentFacts, type ConsoleReportOptions, type DirectiveIndex, type EachBlockFact, type EffectFact, type FailedRule, type HeadTag, type HeadingInfo, type HealthResult, IDREF_ATTRS, type ImageInfo, type KitAlias, type KitModuleFacts, type LandmarkInput, NAMING_ATTRS, type OrphanEffectFact, type Palette, type Project, type ResolvedA11y, type ResolvedHead, type ResolvedHeadings, type ResolvedImages, type RouteBadge, type Rule, type RuleContext, type RuleOptionSpec, type RuleOptionsSpec, type Runtime, SEARCH_RESULT_RULES, SECTIONING_TAGS, type Scope, type ScoreOptions, type ScoreResult, type SourceSpan, type SuppressionDirective, buildJsonReport, classify, collectComponentFacts, compileOverrides, computeHealth, computeScore, decodeFragmentId, defaultConfig, defaultProject, docsUrlFor, effectiveSeverity, emptyComponentFacts, foldOccurrences, formatFailedRuleWarning, formatGithubReport, formatJsonReport, formatMarkdownReport, hasFailureAtOrAbove, isClassicScriptType, isPenalized, isPlainObject, isTopFragment, resolveLandmark, resolveRuleOptions, selectRules, settingSeverity, shouldSkipRangeCheck, skippedFileWarnings, splitTokens, stripTextDirective, summarize, validateRuleSetting, withFailedRulesOff, withIndexableOff, withReadLimit };
1040
+ export { type A11yOccurrenceInfo, type A11ySkipCause, ANCESTRY_DEPENDENT_TAGS, ASIDE_DEMOTING_TAGS, type AppSnapshot, type BranchStep, type Classification, type CompiledOverride, type ComponentFacts, type ConsoleReportOptions, type DirectiveIndex, type EachBlockFact, type EffectFact, type FailedRule, type HeadTag, type HeadingInfo, type HealthResult, IDREF_ATTRS, type ImageInfo, type KitAlias, type KitModuleFacts, type LandmarkInput, NAMING_ATTRS, type OrphanEffectFact, type Palette, type Project, type ResolvedA11y, type ResolvedHead, type ResolvedHeadings, type ResolvedImages, type RouteBadge, type Rule, type RuleContext, type RuleOptionSpec, type RuleOptionsSpec, type Runtime, SEARCH_RESULT_RULES, SECTIONING_TAGS, type Scope, type ScoreOptions, type ScoreResult, type SourceSpan, type SuppressionDirective, type WorkspacePackage, buildJsonReport, classify, collectComponentFacts, compileOverrides, computeHealth, computeScore, decodeFragmentId, defaultConfig, defaultProject, docsUrlFor, effectiveSeverity, emptyComponentFacts, foldOccurrences, formatFailedRuleWarning, formatGithubReport, formatJsonReport, formatMarkdownReport, hasFailureAtOrAbove, isClassicScriptType, isPenalized, isPlainObject, isSvgSrc, isTopFragment, resolveLandmark, resolveRuleOptions, routeNeverSsr, selectRules, settingSeverity, shouldSkipRangeCheck, skippedFileWarnings, splitTokens, stripTextDirective, summarize, validateRuleSetting, withFailedRulesOff, withIndexableOff, withReadLimit };