@route-intelligence/shared
v2.2.0
Published
Shared types and utilities for Route Intelligence
Readme
@route-intelligence/shared
Shared TypeScript types and helpers used by every Route Intelligence package.
There is no runtime analyzer here. Install this only if you write a plugin, consume SerializedGraph, or share types across packages.
Install
npm install @route-intelligence/sharedCLI / core already depend on this. App users do not need a direct install.
What it exports
Graph model
RouteNodeType—route,layout,template,loading,error,middleware,api-route, …RouteEdgeType—navigation,redirect,layout-parent,prefetch,middleware-match, …- Node/edge attributes, conditions (
auth,locale,feature-flag, …) SerializedGraph— JSON shape written tori-output/graph.jsonDiagnostic+ rule ids (dead-route,broken-link,circular-navigation, …)createDefaultNodeAttributes/createDefaultEdgeAttributes
Plugin contract
FrameworkPlugin is the interface framework packages implement:
detect(ctx)— is this framework present?configure(ctx)— plugin-specific configdiscoverRoutes(ctx)— yieldRawRouteanalyzeFile(file, ctx)— navigation edges from a fileenrichGraph(graph, ctx)— extra edges (middleware, layouts)runDiagnostics(graph)— plugin-specific diagnostics
Also: AnalyzerConfig, AnalysisResult, GraphPatch, defineConfig.
Typical import
import type { SerializedGraph, FrameworkPlugin, Diagnostic } from '@route-intelligence/shared';
import { createDefaultNodeAttributes } from '@route-intelligence/shared';ESLint, Playwright, and the visualizer all read SerializedGraph. Keep that type stable when changing this package.
License
MIT