/** * A route's path template: the one compiled pattern each route resolves to, the * handler signature that template dictates, and the capture hints the emitter * and the OpenAPI generator read back. * * D115 P4 R4a. The pattern is resolved once per route and cached, because three * separate questions ask for it — the contextual type of a `route` binding, the * collision key, and the handler's own parameters — and evaluating it three * times is how three answers start to differ. */ import { type Span, type TypeReference, type ValueType } from "@velarscript/compiler/extension"; import { type CompiledRoutePattern, type RoutePatternCapture, type RoutePatternStaticValue } from "../route-pattern.ts"; import { type NodeRouteDeclaration } from "../server-ast.ts"; /** * What the route-pattern rules ask of the analyzer that hosts them, and nothing * more. The two pattern tables arrive through the host rather than as captured * values because `analyze` replaces one of them per program and fills the other * as the walk goes, so a snapshot taken at construction would be the wrong one. */ export interface RouteAnalysisHost { readonly extensionCalls: Map; readonly routePatterns: Map; readonly routePatternValues: ReadonlyMap; enumWireValuesOf(identity: string, name: string): ReadonlyMap | null; expandAliases(type: ValueType): ValueType; fieldsOf(identity: string): ReadonlyMap | null; resolveValidatedAnnotation(reference: TypeReference | null): ValueType; typeError(message: string, errorSpan: Span): void; } export declare function staticPattern(host: RouteAnalysisHost, route: NodeRouteDeclaration): CompiledRoutePattern | null; export declare function routePath(host: RouteAnalysisHost, route: NodeRouteDeclaration): string; /** * 路由模板就是处理函数的签名来源。字段类型在这里解析一次,正文随后看到 * `path.params` 与 `path.query` 的精确只读结构;可选查询字段自然得到 `T?`。 */ export declare function boundRoutePathType(host: RouteAnalysisHost, pattern: CompiledRoutePattern | null): ValueType; export declare function routeCaptureType(host: RouteAnalysisHost, capture: RoutePatternCapture): ValueType; export declare function recordRouteCaptureHint(host: RouteAnalysisHost, capture: RoutePatternCapture, resolved: ValueType): void; //# sourceMappingURL=routes.d.ts.map