{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry file.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\n\nimport { ESMxCJSRequire, getConfiguration } from '@intlayer/config';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector } from 'intlayer';\n\nexport const getDictionaries = () => {\n  const { content } = getConfiguration();\n\n  const dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\n\n  let dictionaries = {};\n  if (existsSync(dictionariesPath)) {\n    delete ESMxCJSRequire.cache[dictionariesPath];\n\n    dictionaries = ESMxCJSRequire(dictionariesPath);\n  }\n\n  return (dictionaries ?? {}) as Record<\n    IntlayerDictionaryTypesConnector['key'],\n    IntlayerDictionaryTypesConnector\n  >;\n};\n\nexport default getDictionaries();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAAiD;AACjD,gBAA2B;AAC3B,kBAAqB;AAId,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,QAAQ,QAAI,gCAAiB;AAErC,QAAM,uBAAmB,kBAAK,QAAQ,SAAS,kBAAkB;AAEjE,MAAI,eAAe,CAAC;AACpB,UAAI,sBAAW,gBAAgB,GAAG;AAChC,WAAO,6BAAe,MAAM,gBAAgB;AAE5C,uBAAe,8BAAe,gBAAgB;AAAA,EAChD;AAEA,SAAQ,gBAAgB,CAAC;AAI3B;AAEA,IAAO,gBAAQ,gBAAgB;","names":[]}