UNPKG

@intlayer/chokidar

Version:

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

28 lines (27 loc) 863 B
//#region src/utils/getContentExtension.ts /** * Generates the .content file extension based on the desired format * and the project's fileExtensions configuration. * * Example: * format 'ts' -> '.content.ts' * format 'esm' -> '.content.js' (if matching .content.js is found in config) */ const getContentExtension = (format, configuration) => { let contentFileExtension = ".ts"; switch (format) { case "json": contentFileExtension = ".json"; break; case "cjs": contentFileExtension = ".cjs"; break; case "esm": contentFileExtension = ".js"; break; } return configuration.content.fileExtensions.find((extension) => extension.endsWith(contentFileExtension)) ?? configuration.content.fileExtensions[0] ?? `.content${contentFileExtension}`; }; //#endregion export { getContentExtension }; //# sourceMappingURL=getContentExtension.mjs.map