/** * Source scanning for translatable messages. * * Dependency-free, best-effort extraction: it recognises two anchors without * needing a full JavaScript parser — * * 1. `defineMessages({ ... })` catalog literals — keys **and** their default * message strings are extracted. * 2. `t('key')` / `tc('key')` / `i18n.t('key')` translation calls — the key is * extracted with an empty default (a string awaiting translation). * * The scanner is intentionally conservative: anything it cannot understand as a * string or nested object is skipped rather than guessed at. * * @module bquery/i18n */ /** A nested catalog of message strings. */ export type ExtractedCatalog = { [key: string]: string | ExtractedCatalog; }; /** A single extracted message, keyed by its dot-delimited path. */ export type ExtractedMessage = { key: string; value: string; }; /** Flattens a nested catalog into dot-delimited `key → value` entries. */ export declare const flatten: (catalog: ExtractedCatalog, prefix?: string) => ExtractedMessage[]; /** * Reconstructs a nested catalog from sorted dot-delimited entries. * * Keys are scanned from untrusted source files, so a `__proto__`, `constructor` * or `prototype` segment is rejected inline — right where each computed-property * assignment happens — to stop a malicious key from walking into or overwriting * the prototype chain. */ export declare const unflatten: (messages: ExtractedMessage[]) => ExtractedCatalog; /** * Extracts every translatable message from a single source string. * * `defineMessages` catalogs contribute their keys **and** default values; * `t()` / `tc()` calls contribute keys with an empty default. Duplicate keys * keep the first non-empty value seen. * * @param source - File contents to scan * @returns Flat, de-duplicated extracted messages */ export declare const extractFromSource: (rawSource: string) => ExtractedMessage[]; //# sourceMappingURL=extract.d.ts.map