UNPKG

@mintlify/link-rot

Version:

Static checking for broken internal links

80 lines (79 loc) 2.32 kB
import { ParsedPath } from 'path'; declare enum PathType { INTERNAL = "internal", EXTERNAL = "external", DATA = "data" } export declare enum Wrapper { MD = "md",// ![]() SRC = "src",// <img src="" /> HREF = "href",// <a href="" /> CARD = "card" } export declare enum EdgeType { CONTENT = "content", NAVIGATION = "navigation" } /** * An MdxPath is a path in an Mdx page. Contains all path-related information. */ export declare class MdxPath { originalPath: string; relativeDir: string; filename: string; wrapper?: Wrapper | undefined; path: ParsedPath | URL; pathType: PathType; anchorLink?: string; queryParams?: URLSearchParams; static getPathType(url: string): PathType; /** * Generate all the computed fields in an MdxPath */ private constructParsedPath; constructor(originalPath: string, relativeDir?: string, filename?: string, wrapper?: Wrapper | undefined); toString(): string; getResolvedFiles(allFiles: string[], baseDir: string): string[]; resolvesTo(node: Node, allFiles: string[], baseDir: string): boolean; static filterMapInternalPaths(paths: string[]): string[]; } export declare class Node { label: string; paths: MdxPath[]; relativeDir: string; filename: string; edges: Edge[]; constructor(label: string, paths?: MdxPath[]); toString(): string; equals(other: Node): boolean; addPath(originalPath: string, wrapper?: Wrapper): void; addOutgoingEdge(edge: Edge): void; getChildNodes(depth?: number): Node[]; } export declare class Edge { source: Node; target: Node; edgeType: EdgeType; private count; constructor(source: Node, target: Node, edgeType: EdgeType); incrementCount(): void; getCount(): number; equals(other: Edge): boolean; } export declare class Graph { baseDir: string; private nodes; private edges; private fileResolutionMap; constructor(baseDir: string); addNode(label: string): Node; addNodes(labels: string[]): void; addAliasNodes(): void; getNode(label: string): Node | undefined; private addEdge; addEdgesBetweenNodes(): void; precomputeFileResolutions(): void; getBrokenInternalLinks(): MdxPath[]; getAllInternalPaths(): string[]; } export {};