@mesh-tech/mesh-cli
Version:
CLI for Mesh platform development utilities
101 lines (100 loc) • 3.19 kB
TypeScript
import type { DiscoveredPage, Discovery } from "./discover.js";
export type LinkIssueKind = "broken" | "external";
export interface LinkIssue {
kind: LinkIssueKind;
page: string;
href: string;
}
export interface AssembledPage {
source: string;
route: string;
filePath: string;
title: string;
sectionTitle: string;
sectionOrder: number;
sectionSlug: string;
order?: number;
}
export interface PublishManifest {
version: 1;
count: number;
sources: string[];
}
export interface AssembleResult {
outDir: string;
pages: AssembledPage[];
navigation: unknown[];
brokenLinks: LinkIssue[];
externalLinks: LinkIssue[];
publishManifest: PublishManifest;
reservedViolations: string[];
}
interface FrontMatter {
data: Record<string, unknown>;
body: string;
hasFrontMatter: boolean;
}
export declare function splitFrontMatter(markdown: string): FrontMatter;
export declare function deriveTitle(frontMatter: Record<string, unknown>, body: string, source: string): string;
export interface LinkResolution {
href: string;
issue?: LinkIssue;
}
export declare function stripHtmlComments(body: string): string;
export declare function resolveLink(args: {
href: string;
pageRoute: string;
sourceDir: string;
sourceIndex: Map<string, AssembledPage>;
routes: Set<string>;
ignoreLinkPrefixes: string[];
pathKind: (repoRelPath: string) => "file" | "dir" | null;
repoUrl: string;
}): LinkResolution;
export declare function rewriteLinks(args: {
body: string;
page: AssembledPage;
sourceIndex: Map<string, AssembledPage>;
routes: Set<string>;
ignoreLinkPrefixes: string[];
pathKind: (repoRelPath: string) => "file" | "dir" | null;
repoUrl: string;
}): {
body: string;
issues: LinkIssue[];
};
export interface AssembleOptions {
repoRoot: string;
discovery: Discovery;
outDir: string;
repoUrl?: string;
ignoreLinkPrefixes?: string[];
meshBaseline?: string;
commit?: string;
}
export declare function pageRoute(page: DiscoveredPage): string;
export declare function pageFilePath(route: string): string;
export declare function assemblePortal(options: AssembleOptions): AssembleResult;
export declare function buildNavigation(pages: AssembledPage[]): unknown[];
export declare function renderZudokuConfig(args: {
navigation: unknown[];
title: string;
description: string;
baseline?: string | undefined;
commit?: string | undefined;
}): string;
export declare function renderVersionJson(args: {
baseline?: string | undefined;
commit: string;
builtAt: string;
}): string;
export declare function currentCommit(repoRoot: string): string;
export declare function currentBaseline(repoRoot: string): string | undefined;
export interface PublishSetDiff {
added: string[];
removed: string[];
}
export declare function publishSetAtRef(repoRoot: string, ref: string): string[];
export declare function diffPublishSets(base: string[], head: string[]): PublishSetDiff;
export declare function renderPublishSetSummary(manifest: PublishManifest, diff: PublishSetDiff | null): string;
export {};