import { runParallel } from "./chokidar/dist/esm/utils/runParallel/index.mjs";
import { buildAndWatchIntlayer } from "./chokidar/dist/esm/watcher.mjs";
import { getConfiguration } from "@intlayer/config";

//#region ../@intlayer/cli/dist/esm/build.mjs
/**
* Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.
* Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}
*/
const build = async (options) => {
	const config = getConfiguration(options?.configOptions);
	let parallelProcess = null;
	if (options?.with) {
		parallelProcess = runParallel(options.with);
		parallelProcess.result.catch(() => {});
	}
	await buildAndWatchIntlayer({
		persistent: options?.watch ?? false,
		skipPrepare: options?.skipPrepare ?? false,
		configuration: config
	});
	if (!options?.watch && parallelProcess) parallelProcess.kill();
};

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