{"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["getAppLogger","formatPath","loadLocalDictionaries","buildDictionary","createTypes","createDictionaryEntryPoint","createModuleAugmentation"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n  filePath: string,\n  config: IntlayerConfig\n) => {\n  const appLogger = getAppLogger(config);\n\n  // Process the file with the functionToRun\n  appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n    isVerbose: true,\n  });\n\n  const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n  const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n  const dictionariesToBuild = Object.values(\n    dictionariesOutput?.mergedDictionaries ?? {}\n  ).map((dictionary) => dictionary.dictionary);\n\n  await createTypes(dictionariesToBuild, config);\n\n  await createDictionaryEntryPoint(config);\n\n  appLogger('Dictionaries built', {\n    isVerbose: true,\n  });\n\n  await createModuleAugmentation(config);\n\n  appLogger('Module augmentation built', {\n    isVerbose: true,\n  });\n\n  // Plugin transformation\n  // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n  for await (const plugin of config.plugins ?? []) {\n    const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n    await plugin.afterBuild?.({\n      dictionaries: {\n        unmergedDictionaries,\n        mergedDictionaries,\n      },\n      configuration: config,\n    });\n  }\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,yCAAyC,OACpD,UACA,WACG;CACH,MAAM,gBAAYA,sCAAa,MAAM;CAGrC,UAAU,6BAA6BC,mCAAW,QAAQ,KAAK,EAC7D,WAAW,KACb,CAAC;CAED,MAAM,qBAAqB,MAAMC,qEAAsB,UAAU,MAAM;CAEvE,MAAM,qBAAqB,MAAMC,wEAAgB,oBAAoB,MAAM;CAE3E,MAAM,sBAAsB,OAAO,OACjC,oBAAoB,sBAAsB,CAAC,CAC7C,CAAC,CAAC,KAAK,eAAe,WAAW,UAAU;CAE3C,MAAMC,0CAAY,qBAAqB,MAAM;CAE7C,MAAMC,yFAA2B,MAAM;CAEvC,UAAU,sBAAsB,EAC9B,WAAW,KACb,CAAC;CAED,MAAMC,qEAAyB,MAAM;CAErC,UAAU,6BAA6B,EACrC,WAAW,KACb,CAAC;CAID,WAAW,MAAM,UAAU,OAAO,WAAW,CAAC,GAAG;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;EAErD,MAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;GACF;GACA,eAAe;EACjB,CAAC;CACH;AACF"}