{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/unmerged-dictionaries-entry is a package that only returns the unmerged 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 { Dictionary, IntlayerDictionaryTypesConnector } from 'intlayer';\n\nexport const getUnmergedDictionaries = () => {\n  const { content } = getConfiguration();\n\n  const dictionariesPath = join(content.mainDir, 'unmerged_dictionaries.cjs');\n  let dictionaries: Record<\n    IntlayerDictionaryTypesConnector['key'],\n    Dictionary[]\n  > = {};\n\n  if (existsSync(dictionariesPath)) {\n    delete ESMxCJSRequire.cache[dictionariesPath];\n    dictionaries = ESMxCJSRequire(dictionariesPath);\n  }\n\n  return dictionaries;\n};\n\nexport default (() => getUnmergedDictionaries())();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAAiD;AACjD,gBAA2B;AAC3B,kBAAqB;AAId,MAAM,0BAA0B,MAAM;AAC3C,QAAM,EAAE,QAAQ,QAAI,gCAAiB;AAErC,QAAM,uBAAmB,kBAAK,QAAQ,SAAS,2BAA2B;AAC1E,MAAI,eAGA,CAAC;AAEL,UAAI,sBAAW,gBAAgB,GAAG;AAChC,WAAO,6BAAe,MAAM,gBAAgB;AAC5C,uBAAe,8BAAe,gBAAgB;AAAA,EAChD;AAEA,SAAO;AACT;AAEA,IAAO,iBAAS,MAAM,wBAAwB,GAAG;","names":[]}