parallel-plugin-worker.mjs 1.1 KB

1234567891011121314151617181920212223242526272829
  1. import { n as __toESM, t as require_binding } from "./shared/binding-B4m_2rFW.mjs";
  2. import { c as PluginContextData, n as bindingifyPlugin } from "./shared/bindingify-input-options-DCTviPFW.mjs";
  3. import { parentPort, workerData } from "node:worker_threads";
  4. //#region src/parallel-plugin-worker.ts
  5. var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
  6. const { registryId, pluginInfos, threadNumber } = workerData;
  7. (async () => {
  8. try {
  9. const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
  10. const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
  11. const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
  12. return {
  13. index: pluginInfo.index,
  14. plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, [], []), [], () => {}, "info", false, void 0)
  15. };
  16. }));
  17. (0, import_binding.registerPlugins)(registryId, plugins);
  18. parentPort.postMessage({ type: "success" });
  19. } catch (error) {
  20. parentPort.postMessage({
  21. type: "error",
  22. error
  23. });
  24. } finally {
  25. parentPort.unref();
  26. }
  27. })();
  28. //#endregion
  29. export {};