{"version":3,"file":"processContentDeclaration.mjs","names":[],"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { autoDecorateContent } from '../utils/autoDecorateContent';\nimport { resolveObjectPromises } from '../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n  contentDeclaration: Dictionary,\n  configuration: IntlayerConfig\n): Promise<Dictionary | undefined> => {\n  try {\n    const resolvedContent = (await resolveObjectPromises(\n      contentDeclaration.content\n    )) as Dictionary['content'];\n\n    const isAutoDecorateContentEnabled =\n      contentDeclaration.contentAutoTransformation ??\n      configuration.dictionary?.contentAutoTransformation ??\n      false;\n\n    const decoratedContent = isAutoDecorateContentEnabled\n      ? autoDecorateContent(resolvedContent, isAutoDecorateContentEnabled)\n      : resolvedContent;\n\n    return {\n      ...contentDeclaration,\n      content: decoratedContent,\n    } as Dictionary;\n  } catch (error) {\n    logger(error, {\n      level: 'error',\n    });\n  }\n};\n"],"mappings":";;;;;;;;AASA,MAAa,4BAA4B,OACvC,oBACA,kBACoC;CACpC,IAAI;EACF,MAAM,kBAAmB,MAAM,sBAC7B,mBAAmB,OACrB;EAEA,MAAM,+BACJ,mBAAmB,6BACnB,cAAc,YAAY,6BAC1B;EAEF,MAAM,mBAAmB,+BACrB,oBAAoB,iBAAiB,4BAA4B,IACjE;EAEJ,OAAO;GACL,GAAG;GACH,SAAS;EACX;CACF,SAAS,OAAO;EACd,OAAO,OAAO,EACZ,OAAO,QACT,CAAC;CACH;AACF"}