import { writeFileIfChanged } from "./writeFileIfChanged.mjs";

//#region ../chokidar/dist/esm/writeJsonIfChanged.mjs
const writeJsonIfChanged = async (path, data, { pretty = true } = {}) => {
	const space = pretty ? 2 : void 0;
	let json = "{}";
	try {
		json = JSON.stringify(data, null, space);
	} catch (error) {
		console.error(`Error while parsing data to JSON for ${path}:`, error);
	}
	return await writeFileIfChanged(path, json);
};

//#endregion
export { writeJsonIfChanged };
//# sourceMappingURL=writeJsonIfChanged.mjs.map