Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
72 lines
2.9 KiB
TypeScript
72 lines
2.9 KiB
TypeScript
import { type SegmentParam } from '../utils/get-segment-param';
|
|
import { type InterceptionMarker } from '../utils/interception-routes';
|
|
export type RouteGroupAppRouteSegment = {
|
|
type: 'route-group';
|
|
name: string;
|
|
/**
|
|
* If present, this segment has an interception marker prefixing it.
|
|
*/
|
|
interceptionMarker?: InterceptionMarker;
|
|
};
|
|
export type ParallelRouteAppRouteSegment = {
|
|
type: 'parallel-route';
|
|
name: string;
|
|
/**
|
|
* If present, this segment has an interception marker prefixing it.
|
|
*/
|
|
interceptionMarker?: InterceptionMarker;
|
|
};
|
|
export type StaticAppRouteSegment = {
|
|
type: 'static';
|
|
name: string;
|
|
/**
|
|
* If present, this segment has an interception marker prefixing it.
|
|
*/
|
|
interceptionMarker?: InterceptionMarker;
|
|
};
|
|
export type DynamicAppRouteSegment = {
|
|
type: 'dynamic';
|
|
name: string;
|
|
param: SegmentParam;
|
|
/**
|
|
* If present, this segment has an interception marker prefixing it.
|
|
*/
|
|
interceptionMarker?: InterceptionMarker;
|
|
};
|
|
/**
|
|
* Represents a single segment in a route path.
|
|
* Can be either static (e.g., "blog") or dynamic (e.g., "[slug]").
|
|
*/
|
|
export type AppRouteSegment = StaticAppRouteSegment | DynamicAppRouteSegment | RouteGroupAppRouteSegment | ParallelRouteAppRouteSegment;
|
|
export type NormalizedAppRouteSegment = StaticAppRouteSegment | DynamicAppRouteSegment;
|
|
export declare function parseAppRouteSegment(segment: string): AppRouteSegment | null;
|
|
export type AppRoute = {
|
|
normalized: boolean;
|
|
pathname: string;
|
|
segments: AppRouteSegment[];
|
|
dynamicSegments: DynamicAppRouteSegment[];
|
|
interceptionMarker: InterceptionMarker | undefined;
|
|
interceptingRoute: AppRoute | undefined;
|
|
interceptedRoute: AppRoute | undefined;
|
|
};
|
|
export type NormalizedAppRoute = Omit<AppRoute, 'normalized' | 'segments'> & {
|
|
normalized: true;
|
|
segments: NormalizedAppRouteSegment[];
|
|
};
|
|
export declare function isNormalizedAppRoute(route: InterceptionAppRoute): route is NormalizedInterceptionAppRoute;
|
|
export type InterceptionAppRoute = Omit<AppRoute, 'interceptionMarker' | 'interceptingRoute' | 'interceptedRoute'> & {
|
|
interceptionMarker: InterceptionMarker;
|
|
interceptingRoute: AppRoute;
|
|
interceptedRoute: AppRoute;
|
|
};
|
|
export type NormalizedInterceptionAppRoute = Omit<InterceptionAppRoute, 'normalized' | 'segments' | 'interceptionMarker' | 'interceptingRoute' | 'interceptedRoute'> & {
|
|
normalized: true;
|
|
segments: NormalizedAppRouteSegment[];
|
|
interceptionMarker: InterceptionMarker;
|
|
interceptingRoute: NormalizedAppRoute;
|
|
interceptedRoute: NormalizedAppRoute;
|
|
};
|
|
export declare function isInterceptionAppRoute(route: NormalizedAppRoute): route is NormalizedInterceptionAppRoute;
|
|
export declare function parseAppRoute(pathname: string, normalized: true): NormalizedAppRoute;
|
|
export declare function parseAppRoute(pathname: string, normalized: false): AppRoute;
|