46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import { ResolvedNavItemWithLink } from "../../shared/index.js";
|
|
|
|
//#region src/client/utils/resolveRepoType.d.ts
|
|
type RepoType = "GitHub" | "GitLab" | "Gitee" | "Bitbucket" | null;
|
|
declare function resolveRepoType(repo: string): RepoType;
|
|
//#endregion
|
|
//#region src/client/utils/resolveEditLink.d.ts
|
|
declare const editLinkPatterns: Record<Exclude<RepoType, null>, string>;
|
|
declare function resolveEditLink({
|
|
docsRepo,
|
|
docsBranch,
|
|
docsDir,
|
|
filePathRelative,
|
|
editLinkPattern
|
|
}: {
|
|
docsRepo: string;
|
|
docsBranch: string;
|
|
docsDir: string;
|
|
filePathRelative: string | null;
|
|
editLinkPattern?: string;
|
|
}): string | null;
|
|
//#endregion
|
|
//#region src/client/utils/resolveNavLink.d.ts
|
|
/**
|
|
* Resolve NavLink props from string
|
|
*
|
|
* @example
|
|
* - Input: '/README.md'
|
|
* - Output: { text: 'Home', link: '/' }
|
|
*/
|
|
declare function resolveNavLink(link: string): ResolvedNavItemWithLink;
|
|
declare function normalizeLink(base?: string, link?: string): string;
|
|
declare function normalizePrefix(base: string, link?: string): string;
|
|
//#endregion
|
|
//#region src/client/utils/shared.d.ts
|
|
declare const EXTERNAL_URL_RE: RegExp;
|
|
declare const PATHNAME_PROTOCOL_RE: RegExp;
|
|
declare const HASH_RE: RegExp;
|
|
declare const EXT_RE: RegExp;
|
|
declare const inBrowser: boolean;
|
|
declare function toArray<T>(value: T | T[]): T[];
|
|
declare function isActive(currentPath: string, matchPath?: string, asRegex?: boolean): boolean;
|
|
declare function normalize(path: string): string;
|
|
declare function numToUnit(value?: string | number): string;
|
|
//#endregion
|
|
export { EXTERNAL_URL_RE, EXT_RE, HASH_RE, PATHNAME_PROTOCOL_RE, RepoType, editLinkPatterns, inBrowser, isActive, normalize, normalizeLink, normalizePrefix, numToUnit, resolveEditLink, resolveNavLink, resolveRepoType, toArray }; |