@svelte-vitals/core 0.41.1 → 0.42.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 +37 -23
- package/dist/index.js +188 -1329
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -762,13 +762,6 @@ type TextOrExpr = AST.Text | AST.ExpressionTag;
|
|
|
762
762
|
* the standard fragment, nodes, consequent, alternate, and body keys.
|
|
763
763
|
*/
|
|
764
764
|
declare const CHILD_NODE_KEYS: string[];
|
|
765
|
-
/**
|
|
766
|
-
* Determine a value's kind from a list of child/text nodes (design §4, §11):
|
|
767
|
-
* - any ExpressionTag present → 'dynamic' (e.g. {data.title}); we do NOT
|
|
768
|
-
* follow the expression — that would turn this into runtime analysis.
|
|
769
|
-
* - non-whitespace Text only → 'static'
|
|
770
|
-
* - empty / whitespace only → 'absent'
|
|
771
|
-
*/
|
|
772
765
|
declare function valueFromNodes(nodes: TextOrExpr[]): Value;
|
|
773
766
|
/** The literal text of a node list when fully static (no ExpressionTag), else undefined. */
|
|
774
767
|
declare function textFromNodes(nodes: TextOrExpr[]): string | undefined;
|
|
@@ -811,6 +804,11 @@ declare function selectRules(rules: Rule[], config: Config): Rule[];
|
|
|
811
804
|
* second, parallel notion of "not counted" for callers to keep in sync.
|
|
812
805
|
*/
|
|
813
806
|
declare function withFailedRulesOff(config: Config, failedRuleIds: readonly string[]): Config;
|
|
807
|
+
/** One-line "rule failed and was skipped" warning; capped to the message's first line so a stack trace can't flood a terminal. */
|
|
808
|
+
declare function formatFailedRuleWarning(f: {
|
|
809
|
+
id: string;
|
|
810
|
+
message: string;
|
|
811
|
+
}): string;
|
|
814
812
|
/** Apply per-rule severity overrides to results (design §6). */
|
|
815
813
|
declare function applyRuleSeverities(results: Result[], config: Config): Result[];
|
|
816
814
|
/** An override entry with its globs compiled once. Build with `compileOverrides`. */
|
|
@@ -1539,6 +1537,23 @@ interface ConsoleReportOptions {
|
|
|
1539
1537
|
*/
|
|
1540
1538
|
declare function formatConsoleReport(results: Result[], config: Config, options?: ConsoleReportOptions): string;
|
|
1541
1539
|
|
|
1540
|
+
/**
|
|
1541
|
+
* Strip ANSI/OSC escape sequences and C0 control characters (except `\n`/`\t`) from a
|
|
1542
|
+
* string before it reaches a terminal. POSIX file/route names can contain almost any
|
|
1543
|
+
* byte, so a hostile repo can smuggle a terminal-title rewrite, cursor move, or other
|
|
1544
|
+
* escape-sequence trick into what looks like plain report text.
|
|
1545
|
+
*
|
|
1546
|
+
* Only OSC and CSI sequences are pattern-matched and removed whole (payload included) —
|
|
1547
|
+
* those cover title-bar writes and cursor/screen control, the two classes with a real
|
|
1548
|
+
* blast radius. Any other `ESC` byte (rarer single/two-byte forms like reset or
|
|
1549
|
+
* save-cursor) falls through to the final C0 sweep below, which drops the lone `ESC`
|
|
1550
|
+
* but — deliberately, not swallowing an adjacent legitimate character — leaves whatever
|
|
1551
|
+
* printable byte follows it as stray text.
|
|
1552
|
+
* ponytail: doesn't special-case every Fe escape form; broaden the CSI/OSC patterns if a
|
|
1553
|
+
* concrete non-CSI/OSC sequence turns out to matter.
|
|
1554
|
+
*/
|
|
1555
|
+
declare function terminalSafe(text: string): string;
|
|
1556
|
+
|
|
1542
1557
|
interface ScoreModel {
|
|
1543
1558
|
routeAverage: number;
|
|
1544
1559
|
sitePenalty: number;
|
|
@@ -1670,6 +1685,20 @@ declare function formatMarkdownReport(results: Result[], config: Config, meta: {
|
|
|
1670
1685
|
version: string;
|
|
1671
1686
|
}): string;
|
|
1672
1687
|
|
|
1688
|
+
type Band = 'good' | 'warn' | 'poor';
|
|
1689
|
+
declare const BAND_COLOR: Record<Band, string>;
|
|
1690
|
+
declare function scoreBand(score: number): Band;
|
|
1691
|
+
declare function escapeHtml(s: string): string;
|
|
1692
|
+
/**
|
|
1693
|
+
* Return the URL only when it uses a safe http/https scheme, else null.
|
|
1694
|
+
* Guards a finding's `docsUrl` against `javascript:`/`data:` hrefs — escapeHtml
|
|
1695
|
+
* neutralizes attribute breakout but not a malicious scheme. Browsers strip
|
|
1696
|
+
* ASCII whitespace (tab/newline/CR) from a URL before resolving its scheme (so
|
|
1697
|
+
* `java\tscript:` runs as `javascript:`), so strip whitespace first; anything not
|
|
1698
|
+
* plainly http(s):// afterward is rejected. Pure string work — no `URL` global,
|
|
1699
|
+
* keeping core runtime-agnostic and lib-minimal.
|
|
1700
|
+
*/
|
|
1701
|
+
declare function safeHref(url: string): string | null;
|
|
1673
1702
|
/** Provenance of a route's findings: real rendered page vs. source-only analysis. */
|
|
1674
1703
|
type RouteBadge = 'measured' | 'static';
|
|
1675
1704
|
interface AppSnapshot {
|
|
@@ -1719,19 +1748,4 @@ declare function formatHtmlReport(results: Result[], config: Config, meta: {
|
|
|
1719
1748
|
coreVersion?: string;
|
|
1720
1749
|
}): string;
|
|
1721
1750
|
|
|
1722
|
-
type
|
|
1723
|
-
declare const BAND_COLOR: Record<Band, string>;
|
|
1724
|
-
declare function scoreBand(score: number): Band;
|
|
1725
|
-
declare function escapeHtml(s: string): string;
|
|
1726
|
-
/**
|
|
1727
|
-
* Return the URL only when it uses a safe http/https scheme, else null.
|
|
1728
|
-
* Guards a finding's `docsUrl` against `javascript:`/`data:` hrefs — escapeHtml
|
|
1729
|
-
* neutralizes attribute breakout but not a malicious scheme. Browsers strip
|
|
1730
|
-
* ASCII whitespace (tab/newline/CR) from a URL before resolving its scheme (so
|
|
1731
|
-
* `java\tscript:` runs as `javascript:`), so strip whitespace first; anything not
|
|
1732
|
-
* plainly http(s):// afterward is rejected. Pure string work — no `URL` global,
|
|
1733
|
-
* keeping core runtime-agnostic and lib-minimal.
|
|
1734
|
-
*/
|
|
1735
|
-
declare function safeHref(url: string): string | null;
|
|
1736
|
-
|
|
1737
|
-
export { APP_SCRIPT, APP_STYLE, type AppSnapshot, BAND_COLOR, CATEGORIES, CHILD_NODE_KEYS, type Category, type Classification, type CompiledOverride, type ComponentFacts, type Config, type ConsoleReportOptions, type Detection, type EachBlockFact, type EffectFact, type FailedRule, type Fix, type HeadProvider, type HeadTag, type HeadingInfo, type HealthResult, type ImageInfo, type JsonReport, type KitAlias, type KitModuleFacts, type OrphanEffectFact, type Palette, type Presence, type Project, ROBOTS_SOURCE_PATHS, type RawKitAliases, type ResolvedHead, type ResolvedHeadings, type ResolvedImages, type Result, type RouteBadge, type Rule, type RuleContext, type RuleEvidence, type RuleInfo, type RuleOptionInfo, type RuleOptionSpec, type RuleOptions, type RuleOptionsSpec, type RuleOverride, type RuleSetting, type RuleSettingObject, type Runtime, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, type Scope, type ScoreModel, type ScoreOptions, type ScoreResult, type Severity, type SourceSpan, type Summary, type SuppressionDirective, type TreatDynamicAs, VITE_CONFIG_FILES, type Value, type ViteKitConfigResult, allRules, applyOverrides, applyRuleSeverities, architectureComponentSize, architectureDirectoryNaming, architectureDocLinkTarget, architecturePrivateScopeImport, architecturePropCount, architectureReservedDirectoryNames, architectureReservedNamePlacement, architectureRouteComponentImport, architectureUnitEntryFile, attrText, attrTextOf, attrValue, attrValueOf, buildHtmlDocument, buildJsonReport, classify, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, compileOverrides, computeHealth, computeScore, correctnessBasePathNavigation, correctnessCheckableBindValue, correctnessEachIndexKey, correctnessEachKey, correctnessEffectAsDerived, correctnessEffectAsOnMount, correctnessInstanceBrowserGlobal, correctnessNonreactiveBuiltinState, correctnessOrphanEffect, correctnessOrphanLifecycle, correctnessPropMutation, correctnessServerBrowserGlobal, correctnessStalePropDerivation, correctnessUnmutatedState, defaultConfig, defaultProject, defineConfig, docsUrlFor, effectiveSeverity, emptyComponentFacts, emptyKitModuleFacts, escapeHtml, explainRule, findAttr, findKitAliasesInSvelteConfig, findKitPathsBaseInSvelteConfig, findKitPathsBaseInViteConfig, findMinifyDisabled, formatAgentReport, formatConsoleReport, formatGithubReport, formatHtmlReport, formatJsonReport, formatMarkdownReport, formatSarifReport, hasFailureAtOrAbove, headTagRule, imageRule, intOption, isMentionedAnywhere, isPenalized, lineOf, linkRule, listOption, mapOption, noColorPalette, overrideMatches, parseComponentFacts, parseKitModuleFacts, performanceFontPreloadCrossorigin, performanceHeavyImport, performanceImageDimensions, performanceImageLoadingHint, performanceLcpImage, performanceLoadWaterfall, performanceMinifyDisabled, performanceNamespaceImport, performancePreconnect, performancePreloadMissingAs, performanceRenderBlockingScript, performanceResponsiveImage, performanceSequentialAwaits, performanceStateRaw, renderAppShell, resolveKitAliases, resolveKitPathsBase, resolveRepoLocalPath, resolveRuleOptions, resolveRunesModuleSpecifier, runRules, safeHref, scoreBand, scoreColor, scoresByCategory, securityHandlerStateWrite, securityJavascriptUrl, securityRawHtml, securityServerModuleState, securitySharedStateImport, selectRules, 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, settingOptions, settingSeverity, shouldSkipRangeCheck, summarize, textFromNodes, validateRuleOptions, validateRuleSetting, valueFromNodes, withFailedRulesOff };
|
|
1751
|
+
export { APP_SCRIPT, APP_STYLE, type AppSnapshot, BAND_COLOR, CATEGORIES, CHILD_NODE_KEYS, type Category, type Classification, type CompiledOverride, type ComponentFacts, type Config, type ConsoleReportOptions, type Detection, type EachBlockFact, type EffectFact, type FailedRule, type Fix, type HeadProvider, type HeadTag, type HeadingInfo, type HealthResult, type ImageInfo, type JsonReport, type KitAlias, type KitModuleFacts, type OrphanEffectFact, type Palette, type Presence, type Project, ROBOTS_SOURCE_PATHS, type RawKitAliases, type ResolvedHead, type ResolvedHeadings, type ResolvedImages, type Result, type RouteBadge, type Rule, type RuleContext, type RuleEvidence, type RuleInfo, type RuleOptionInfo, type RuleOptionSpec, type RuleOptions, type RuleOptionsSpec, type RuleOverride, type RuleSetting, type RuleSettingObject, type Runtime, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, type Scope, type ScoreModel, type ScoreOptions, type ScoreResult, type Severity, type SourceSpan, type Summary, type SuppressionDirective, type TreatDynamicAs, VITE_CONFIG_FILES, type Value, type ViteKitConfigResult, allRules, applyOverrides, applyRuleSeverities, architectureComponentSize, architectureDirectoryNaming, architectureDocLinkTarget, architecturePrivateScopeImport, architecturePropCount, architectureReservedDirectoryNames, architectureReservedNamePlacement, architectureRouteComponentImport, architectureUnitEntryFile, attrText, attrTextOf, attrValue, attrValueOf, buildHtmlDocument, buildJsonReport, classify, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, compileOverrides, computeHealth, computeScore, correctnessBasePathNavigation, correctnessCheckableBindValue, correctnessEachIndexKey, correctnessEachKey, correctnessEffectAsDerived, correctnessEffectAsOnMount, correctnessInstanceBrowserGlobal, correctnessNonreactiveBuiltinState, correctnessOrphanEffect, correctnessOrphanLifecycle, correctnessPropMutation, correctnessServerBrowserGlobal, correctnessStalePropDerivation, correctnessUnmutatedState, defaultConfig, defaultProject, defineConfig, docsUrlFor, effectiveSeverity, emptyComponentFacts, emptyKitModuleFacts, escapeHtml, explainRule, findAttr, findKitAliasesInSvelteConfig, findKitPathsBaseInSvelteConfig, findKitPathsBaseInViteConfig, findMinifyDisabled, formatAgentReport, formatConsoleReport, formatFailedRuleWarning, formatGithubReport, formatHtmlReport, formatJsonReport, formatMarkdownReport, formatSarifReport, hasFailureAtOrAbove, headTagRule, imageRule, intOption, isMentionedAnywhere, isPenalized, lineOf, linkRule, listOption, mapOption, noColorPalette, overrideMatches, parseComponentFacts, parseKitModuleFacts, performanceFontPreloadCrossorigin, performanceHeavyImport, performanceImageDimensions, performanceImageLoadingHint, performanceLcpImage, performanceLoadWaterfall, performanceMinifyDisabled, performanceNamespaceImport, performancePreconnect, performancePreloadMissingAs, performanceRenderBlockingScript, performanceResponsiveImage, performanceSequentialAwaits, performanceStateRaw, renderAppShell, resolveKitAliases, resolveKitPathsBase, resolveRepoLocalPath, resolveRuleOptions, resolveRunesModuleSpecifier, runRules, safeHref, scoreBand, scoreColor, scoresByCategory, securityHandlerStateWrite, securityJavascriptUrl, securityRawHtml, securityServerModuleState, securitySharedStateImport, selectRules, 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, settingOptions, settingSeverity, shouldSkipRangeCheck, summarize, terminalSafe, textFromNodes, validateRuleOptions, validateRuleSetting, valueFromNodes, withFailedRulesOff };
|