import { FSRouter } from './FSRouter'; export type PageMeta = { page: string; depth: number; group?: string; dir: string; name: string; }; export declare class FSNode { readonly tree: FSTree; id: number; /** * 分组 */ group?: string; /** * 深度,起始为 0 */ depth: number; /** * 【唯一】所在目录,相对于 cwd */ dir: string; /** * 路径名 */ name: string; /** * 页面,未声明页面时为空字符串 * @ref https://reactrouter.com/en/main/route/route#elementcomponent */ page: string; /** * https://reactrouter.com/en/main/start/concepts#layout-routes */ layout?: string; /** * @ref https://reactrouter.com/en/main/route/loader */ loader?: string; /** * @ref https://reactrouter.com/en/main/route/action */ action?: string; /** * @ref https://reactrouter.com/en/main/route/error-element */ error?: string; /** * @ref https://react.dev/reference/react/Suspense */ loading?: string; children: FSNode[]; parent?: FSNode; private _resolveFile; constructor(tree: FSTree, pageMeta: PageMeta); update(meta: PageMeta): void; get path(): string; private _linking; static parse(page: string): PageMeta; } export type FSTreeOptions = { cwd: string; resolveExist: (page: FSNode, fileNames: string[]) => number; }; export declare class FSTree { readonly options: FSTreeOptions; root?: FSNode; dirMap: Map; defaultMap: Map; groupMap: Map; idSet: Set; fsRouter: FSRouter; constructor(options: FSTreeOptions); get cwd(): string; mount(pages: string[]): void; update(pages: string[], parent: string): void; render(tabSize?: number): string; private _id; nextId(): number; static makeLayoutComponentName(id: number): string; static makePageComponentName(id: number): string; }