import { version as version$1 } from "../package.mjs";
import { dirname, join } from "path";
import { readFile, stat } from "fs/promises";
import { fileURLToPath } from "url";
//#region lib/utils.ts
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const directoryExists = (path) => stat(path).then((info) => info.isDirectory()).catch(() => false);
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), join("..", ".."));
function readFromPackage(...components) {
	return readFile(join(packageRoot, ...components), "utf8");
}
function version() {
	return version$1;
}
let __debug = "DEBUG" in process.env;
function debug(...args) {
	if (__debug) console.log(...args);
}
function enableDebug(value) {
	if (value !== void 0) __debug = value;
	return __debug;
}
//#endregion
export { debug, directoryExists, enableDebug, readFromPackage, sleep, version };
