@intlayer/dictionaries-entry
Version:
Provides the entry path for Intlayer dictionaries, solving filesystem retrieval issues for bundlers like Webpack and Rollup.
43 lines • 1.7 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var index_exports = {};
__export(index_exports, {
default: () => index_default,
getDictionaries: () => getDictionaries
});
module.exports = __toCommonJS(index_exports);
var import_config = require("@intlayer/config");
var import_fs = require("fs");
var import_path = require("path");
const getDictionaries = () => {
const { content } = (0, import_config.getConfiguration)();
const dictionariesPath = (0, import_path.join)(content.mainDir, "dictionaries.cjs");
let dictionaries = {};
if ((0, import_fs.existsSync)(dictionariesPath)) {
delete import_config.ESMxCJSRequire.cache[dictionariesPath];
dictionaries = (0, import_config.ESMxCJSRequire)(dictionariesPath);
}
return dictionaries ?? {};
};
var index_default = getDictionaries();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getDictionaries
});
//# sourceMappingURL=index.cjs.map