//#region src/init/utils/fileSystem.d.ts /** * Helper to check if a file exists */ export declare const exists: (rootDir: string, filePath: string) => Promise; /** * Helper to read a file */ export declare const readFileFromRoot: (rootDir: string, filePath: string) => Promise; /** * Helper to write a file */ export declare const writeFileToRoot: (rootDir: string, filePath: string, content: string) => Promise; /** * Helper to ensure a directory exists */ export declare const ensureDirectory: (rootDir: string, dirPath: string) => Promise; /** * Pattern type for locale JSON file organisation. * - 'nested': files are at `{base}/{locale}/{key}.json` * - 'flat': files are at `{base}/{locale}.json` */ export type JsonLocalePatternType = 'nested' | 'flat'; /** * Detected locale JSON file pattern and the corresponding source template. * `template` uses `${locale}` and `${key}` as literal placeholders (not JS * expressions) so it can be embedded directly in a template-literal string. */ export type JsonLocalePattern = { type: JsonLocalePatternType; /** * Source path template for syncJSON `source` option. * Example nested: `./locales/${locale}/${key}.json` * Example flat: `./locales/${locale}.json` */ template: string; /** * Detected locales in the directory. */ locales: string[]; }; /** * Scans the project for JSON files and determines whether locale files are * organised as `{base}/{locale}/{key}.json` (nested) or `{base}/{locale}.json` * (flat). Returns the most likely source template, or `null` when no locale * JSON files are found. * * The returned `template` contains `${locale}` and `${key}` as **literal** * placeholder strings so it can be embedded inside a JS template literal. */ export declare const detectJsonLocalePattern: (rootDir: string) => Promise; /** * Detected lingui catalog pattern. lingui stores one catalog file per locale * (default name `messages`), as `.po` (its default) or `.json`. */ export type LinguiCatalogPattern = { /** Which sync plugin should ingest the catalogs. */ format: 'po' | 'json'; /** * Source path template, with `${locale}` and `${key}` as literal * placeholders. The catalog filename (`messages`) is captured by `${key}` so * the produced intlayer dictionary key is `messages` — matching the fixed * `messages` namespace the lingui compat runtime reads from. * Example: `./src/locales/${locale}/${key}.po`. */ template: string; /** Detected locales. */ locales: string[]; }; /** * Scans the project for lingui catalog files (`{base}/{locale}/messages.po` or * `…/messages.json`, lingui's default layout) and derives the `syncPO` / * `syncJSON` `source` template. * * `.po` is preferred when present (lingui's default format). Returns `null` * when no lingui catalog is found, in which case the caller falls back to the * generic JSON detection. * * @param rootDir - Project root directory. */ export declare const detectLinguiCatalogPattern: (rootDir: string) => Promise; /** * The messages source template derived from a `next-intl` `i18n/request.ts` * file, ready to be used as a `syncJSON` `source` builder. */ export type NextIntlMessagesPattern = { /** `'flat'` (one file per locale) or `'nested'` (per-namespace files). */ type: JsonLocalePatternType; /** * Source path template relative to the project root, with `${locale}` (and * `${key}` when nested) as literal placeholders, e.g. `./messages/${locale}.json`. */ template: string; }; /** * Derives the messages source template from a `next-intl` `i18n/request.ts` * file, which is the authoritative location of the messages path in a next-intl * project (e.g. `messages: (await import(\`../messages/${locale}.json\`)).default`). * * Reading it removes the ambiguity of globbing the file system and yields the * exact `source` template for `syncJSON`. When the resulting template has no * `${key}` segment (the common single-file-per-locale layout, where top-level * keys are namespaces), `syncJSON` `splitKeys` auto-detection turns each * top-level key into its own dictionary. * * Returns `null` when no request file is found, the messages import cannot be * parsed, or the path is not project-root-relative (e.g. uses a TS path alias). * * @param rootDir - Project root directory. */ export declare const detectNextIntlMessagesPattern: (rootDir: string) => Promise; //#endregion //# sourceMappingURL=fileSystem.d.ts.map