const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
const require_src = require('./shared/src-CPo8xoSH.cjs');
require('./shared/dist-BMVjvV-v.cjs');
require('./shared/parse-ast-index-5aLNEQ2C.cjs');
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("./rolldown-binding.wasi.cjs"));
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));

//#region src/parallel-plugin-worker.ts
const { registryId, pluginInfos, threadNumber } = node_worker_threads.workerData;
(async () => {
	try {
		const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
			const pluginModule = await import(pluginInfo.fileUrl);
			const definePluginImpl = pluginModule.default;
			const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
			return {
				index: pluginInfo.index,
				plugin: require_src.bindingifyPlugin(plugin, {}, {}, new require_src.PluginContextData(), [], () => {}, "info", false)
			};
		}));
		(0, src_rolldown_binding_wasi_cjs.registerPlugins)(registryId, plugins);
		node_worker_threads.parentPort.postMessage({ type: "success" });
	} catch (error) {
		node_worker_threads.parentPort.postMessage({
			type: "error",
			error
		});
	} finally {
		node_worker_threads.parentPort.unref();
	}
})();

//#endregion