import { pathToFileURL } from "node:url";

//#region src/deploy/sniffer-worker.ts
const entryPath = process.argv[2];
if (!entryPath) {
	console.log(JSON.stringify({
		envVars: [],
		error: "No entry file path provided"
	}));
	process.exit(1);
}
const validEntryPath = entryPath;
/**
* Main sniffing function
*/
async function sniff() {
	let error = null;
	try {
		const entryUrl = pathToFileURL(validEntryPath).href;
		await import(entryUrl);
	} catch (e) {
		error = e instanceof Error ? e.message : String(e);
	}
	const sniffer = globalThis.__envSniffer;
	const envVars = sniffer ? sniffer.getEnvironmentVariables() : [];
	console.log(JSON.stringify({
		envVars,
		error
	}));
}
process.on("unhandledRejection", () => {});
sniff().catch((e) => {
	console.log(JSON.stringify({
		envVars: [],
		error: e.message || String(e)
	}));
	process.exit(1);
});

//#endregion
//# sourceMappingURL=sniffer-worker.mjs.map