@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
25 lines (23 loc) • 1.07 kB
JavaScript
import { autoDecorateContent } from "../utils/autoDecorateContent.mjs";
import { resolveObjectPromises } from "../utils/resolveObjectPromises.mjs";
import { logger } from "@intlayer/config/logger";
//#region src/buildIntlayerDictionary/processContentDeclaration.ts
/**
* Function to load, process the module and return the Intlayer Dictionary from the module file
*/
const processContentDeclaration = async (contentDeclaration, configuration) => {
try {
const resolvedContent = await resolveObjectPromises(contentDeclaration.content);
const isAutoDecorateContentEnabled = contentDeclaration.contentAutoTransformation ?? configuration.dictionary?.contentAutoTransformation ?? false;
const decoratedContent = isAutoDecorateContentEnabled ? autoDecorateContent(resolvedContent, isAutoDecorateContentEnabled) : resolvedContent;
return {
...contentDeclaration,
content: decoratedContent
};
} catch (error) {
logger(error, { level: "error" });
}
};
//#endregion
export { processContentDeclaration };
//# sourceMappingURL=processContentDeclaration.mjs.map