import { PlainMergedDictionaryOutput } from "./writeMergedDictionary.js"; import { IntlayerConfig } from "@intlayer/types/config"; import { Dictionary, DictionaryQualifierType, QualifiedDictionaryGroup } from "@intlayer/types/dictionary"; import { Locale } from "@intlayer/types/allLocales"; //#region src/buildIntlayerDictionary/writeDynamicDictionary.d.ts export type DictionaryResult = { dictionaryPath: string; dictionary: Dictionary; }; export type LocalizedDictionaryResult = Partial>; export type LocalizedDictionaryOutput = Record; /** * Generates the content of a dictionary entry point file. * * When the dictionary references other dictionaries through `nest()`, the * loader for a locale resolves the referenced dictionaries alongside it and * attaches them as `nestedDictionaries`. The nest targets then travel in the * same lazy chunk as their consumer, and `getNesting` resolves them from that * local reference instead of the global registry — which the build * optimization strips. * * @param key - The dictionary key. * @param locales - Locales to emit a loader for. * @param format - Output module format. * @param nestedKeys - Keys referenced through `nest()`, transitively. */ export declare const generateDictionaryEntryPoint: (key: string, locales: string[], format?: 'cjs' | 'esm', nestedKeys?: string[]) => string; /** * One entry of a qualified loader map. * * `treeSegments` is where the entry lives in the loader tree (its composite id * segments); `chunkSegments` is the chunk path it loads. They differ when the * entry aliases another entry with identical content (e.g. array-variant * fan-out): the alias keeps its own tree position but points at the canonical * entry's chunk, so equal content is emitted — and downloaded — only once. */ export type QualifiedEntrySegments = { treeSegments: string[]; chunkSegments: string[]; }; /** * Generates the entry point of a qualified dictionary (collection / variant, * possibly combined). Under each locale the loader map nests one * level per declared dimension (canonical order) and carries a marker listing * those dimensions so the runtime can walk the tree. * * One static `import()` is emitted per leaf `(locale, …segments)` chunk, which * keeps the output compatible with bundlers that reject template-literal * dynamic imports (Turbopack). Entries whose content is identical share one * chunk: their leaves point at the canonical entry's import path. */ export declare const generateQualifiedDictionaryEntryPoint: (key: string, qualifierTypes: DictionaryQualifierType[], entries: QualifiedEntrySegments[], locales: string[], format?: 'cjs' | 'esm') => string; /** * Write the localized dictionaries to the dictionariesDir * @param mergedDictionaries - The merged dictionaries * @param configuration - The configuration * @returns The final dictionaries * * @example * ```ts * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries); * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries); * console.log(finalDictionaries); * * // .intlayer/dynamic_dictionary/dictionaries/en_home.json * // .intlayer/dynamic_dictionary/dictionaries/fr_home.json * ``` */ export declare const writeDynamicDictionary: (mergedDictionaries: PlainMergedDictionaryOutput, configuration: IntlayerConfig, formats?: ('cjs' | 'esm')[], nestedDictionaryGraph?: Map>) => Promise; export type QualifiedMergedDictionaryResult = { dictionaryPath: string; dictionary: QualifiedDictionaryGroup; }; export type QualifiedMergedDictionaryOutput = Record; /** * Writes the dynamic chunks and entry points of qualified dictionaries * (collections, variants — possibly combined) in * `importMode: 'dynamic'`. * * Each entry is reduced to one per-locale chunk written to a path nested by * dimension — `json/{key}/{seg1}/{seg2}/{locale}.json` — and a single * `{key}.{ext}` entry point exposes the matching nested loader tree, so the * entry point is discovered and aggregated exactly like a plain dynamic one. */ export declare const writeDynamicQualifiedDictionaries: (qualifiedDictionaries: QualifiedMergedDictionaryOutput, configuration: IntlayerConfig, formats?: ('cjs' | 'esm')[]) => Promise; //#endregion //# sourceMappingURL=writeDynamicDictionary.d.ts.map