// import { fileURLToPath } from "node:url";
// import path from "node:path";
// const __dirname = path.dirname(fileURLToPath(import.meta.url));
import rec from "./sox.js";

function load(recorderName) {
	try {
		// const recoderPath = path.resolve(__dirname, recorderName);
		// const module = await import(recoderPath);
		// return module.default;
		return rec;
	} catch (err) {
		if (err.code === "MODULE_NOT_FOUND") {
			throw new Error(`No such recorder found: ${recorderName}`);
		}

		throw err;
	}
}

export default {
	load,
};
