import { configESMxCJSRequire } from "../../../../../../config/dist/esm/utils/ESMxCJSHelpers.mjs";
import { clearModuleCache } from "../../../../../../config/dist/esm/utils/clearModuleCache.mjs";
import { built_default } from "./config/dist/esm/built.mjs";
import { join } from "node:path";
import { existsSync } from "node:fs";

//#region ../react-intlayer/dist/esm/@intlayer/core/dist/esm/dictionaries-entry/dist/esm/index.mjs
/**
* @intlayer/dictionaries-entry is a package that only returns the dictionary entry file.
* Using an external package allow to alias it in the bundle configuration (such as webpack).
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
*/
const getDictionaries = (configuration = built_default) => {
	const { content, build } = configuration;
	const dictionariesPath = join(content.mainDir, `dictionaries.cjs`);
	let dictionaries = {};
	if (existsSync(dictionariesPath)) {
		clearModuleCache(dictionariesPath);
		dictionaries = (build.require ?? configESMxCJSRequire)(dictionariesPath);
	}
	return dictionaries ?? {};
};

//#endregion
export { getDictionaries };
//# sourceMappingURL=index.mjs.map