{"version":3,"file":"loadYamlContentDeclaration.mjs","names":[],"sources":["../../../src/loadDictionaries/loadYamlContentDeclaration.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { parseYaml } from '@intlayer/core/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const loadYamlContentDeclaration = async (\n  path: string\n): Promise<Dictionary | undefined> => {\n  try {\n    const fileContent = await readFile(path, 'utf-8');\n    const parsed = parseYaml<Dictionary>(fileContent);\n\n    if (!parsed || typeof parsed !== 'object') {\n      console.error(`[intlayer] Invalid YAML content declaration: ${path}`);\n      return undefined;\n    }\n\n    if (!parsed.key) {\n      console.error(\n        `[intlayer] Missing key in YAML content declaration: ${path}`\n      );\n      return undefined;\n    }\n\n    return parsed;\n  } catch (error) {\n    console.error(`Error loading YAML content declaration at ${path}:`, error);\n    return undefined;\n  }\n};\n"],"mappings":";;;;AAIA,MAAa,6BAA6B,OACxC,SACoC;CACpC,IAAI;EAEF,MAAM,SAAS,UAAsB,MADX,SAAS,MAAM,OAAO,CACA;EAEhD,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU;GACzC,QAAQ,MAAM,gDAAgD,MAAM;GACpE;EACF;EAEA,IAAI,CAAC,OAAO,KAAK;GACf,QAAQ,MACN,uDAAuD,MACzD;GACA;EACF;EAEA,OAAO;CACT,SAAS,OAAO;EACd,QAAQ,MAAM,6CAA6C,KAAK,IAAI,KAAK;EACzE;CACF;AACF"}