import { ContentAdapter, FormatCodec, SyncContent, SyncPluginContext } from "./types.js"; import { FilePathPattern } from "@intlayer/types/filePathPattern"; //#region src/syncPluginKit/createFileAdapter.d.ts /** * Discovery strategy of the file adapter: * - `strict`: keep only files whose path rebuilds identically from the source * pattern, and fabricate entries for missing locales/keys so every declared * locale has a write-back target (sync plugins). * - `inclusive`: keep every glob match without fabricating missing entries * (read-only load plugins, whose patterns may contain free `**` globs). */ export type FileAdapterDiscovery = 'strict' | 'inclusive'; export type CreateFileAdapterOptions = { /** * Location of the files, as a static string, a templated string * (e.g. `./messages/{{locale}}/{{key}}.json`) or a function building the * path from the key and locale. */ source: FilePathPattern; /** * Format of the files: string payload ↔ structured content. */ codec: FormatCodec; /** * Optional override of how one file is read and parsed. Defaults to a plain * utf-8 read followed by `codec.parse`, returning `undefined` for missing or * unreadable files. Adapters needing richer loading (e.g. JSON5 or * transpiled TS sources) provide their own implementation here. */ readEntry?: (absoluteFilePath: string, context: SyncPluginContext) => Promise; /** * Discovery strategy. Defaults to `'strict'`. */ discovery?: FileAdapterDiscovery; }; /** * Create a filesystem {@link ContentAdapter} for `createSyncPlugin`. * * Handles glob discovery of the source pattern, key/locale extraction from * paths, base-directory resolution, and change-detected atomic writes. */ export declare const createFileAdapter: (options: CreateFileAdapterOptions) => ContentAdapter; /** * Default `readEntry` implementation: plain utf-8 read followed by the given * parser. Returns `undefined` for missing or unreadable files. */ export declare const createFileReader: (parse: (raw: string) => SyncContent) => (absoluteFilePath: string) => Promise; //#endregion //# sourceMappingURL=createFileAdapter.d.ts.map