///
import * as chokidar from 'chokidar';
import * as fs from 'fs';
import type { SimpleGit } from 'simple-git';
import type { PathVersionInfo } from '../plugins/types.js';
import type { RedoclyConfig } from '../config/schema.js';
import { VersionsConfig } from './versions-config.js';
import { I18nConfig } from './i18n-config.js';
type WatchCb = (event: 'add' | 'change' | 'unlink', path: string, stats?: fs.Stats) => void;
export interface ContentRecord {
content: string;
contentHash: string;
relativePath: string;
absolutePath: string;
isIgnored: boolean;
parsed?: any;
}
export interface ParsedContentRecord extends ContentRecord {
parsed: T;
}
export interface OpenAPISource {
content: string;
absolutePath: string;
relativePath: string;
}
export interface ContentProvider {
cwd: string;
filesList: Set;
fsFilesList: Set;
versions: VersionsConfig;
oasRecords: Map;
i18ns: I18nConfig;
loadContent(relativePath: string, parse?: undefined): ContentRecord;
loadContent(relativePath: string, parse: 'yaml'): ParsedContentRecord;
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
content: string;
data: Record;
}>;
loadContent(relativePath: string, parse: 'yaml' | 'frontmatter' | undefined): ParsedContentRecord;
isPathIgnored(relativePath: string): boolean;
loadYamlAndResolveRefs(relativePath: string): ParsedContentRecord;
resolveRefs(content: any, contentDir?: string, referencesChain?: string[]): any;
getLastModified: (relativePath: string) => Promise;
getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo | undefined;
has(relativePath: string): boolean;
getRedoclyConfig(fileName?: string): {
content?: string;
parsed: unknown;
relativePath: string;
contentHash?: string;
};
/**
* Returns the redocly.yaml config closest to the specified file. This function will look in the same directory as the file first.
* Then it will look in parent directory recursively until it finds a redocly.yaml or reaches root of the portal.
* This does NOT merge local config with the root redocly.yaml
* @param fileRelativePath
*/
getLocalRedoclyConfig(fileRelativePath: string): {
content?: string;
parsed: Partial;
relativePath: string;
isIgnored?: boolean;
};
getFsRelativePath(relativePath: string): string;
getFsAbsolutePath(relativePath: string): string;
slugFromRelativePath(relativePath: string): string;
addVirtualFile(relativePath: string, contentRecord: ContentRecord): void;
clearVirtualFiles(): void;
}
export declare class FsContentProvider implements ContentProvider {
#private;
cwd: string;
private ignored;
private initialContentLoaded;
private ignoredPaths;
fsFilesList: Set;
private localizedFilesList;
private virtualFilesList;
private slugger;
oasRecords: Map;
versions: VersionsConfig;
i18ns: I18nConfig;
lastModifiedData: Map;
_git: SimpleGit | undefined;
_gitInstallationChecked: boolean;
_locallyModifiedCache: Set | null;
_lastModifiedCache: Promise