@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
30 lines (28 loc) • 956 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#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
exports.getContentExtension = getContentExtension;
//# sourceMappingURL=getContentExtension.cjs.map