UNPKG

@intlayer/chokidar

Version:

Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.

25 lines (23 loc) 767 B
import { readFile } from "node:fs/promises"; import { parseYaml } from "@intlayer/core/utils"; //#region src/loadDictionaries/loadYamlContentDeclaration.ts const loadYamlContentDeclaration = async (path) => { try { const parsed = parseYaml(await readFile(path, "utf-8")); if (!parsed || typeof parsed !== "object") { console.error(`[intlayer] Invalid YAML content declaration: ${path}`); return; } if (!parsed.key) { console.error(`[intlayer] Missing key in YAML content declaration: ${path}`); return; } return parsed; } catch (error) { console.error(`Error loading YAML content declaration at ${path}:`, error); return; } }; //#endregion export { loadYamlContentDeclaration }; //# sourceMappingURL=loadYamlContentDeclaration.mjs.map