| 123456789101112131415161718192021 |
- import { createRequire } from "node:module";
- const require = createRequire(import.meta.url);
- /**
- * dbus-next needs the native `usocket` module to receive Unix FDs (OpenPipeWireRemote).
- * Without it, Node falls back to net.Socket and FD unmarshalling fails.
- * Throws at startup so the user gets a clear error instead of a silent hang.
- */
- export function assertUsocketAvailable() {
- try {
- require("usocket");
- } catch (err) {
- throw new Error(
- "The native `usocket` module failed to load. " +
- "Wayland screen capture requires it for D-Bus Unix FD passing. " +
- "Run `npm rebuild usocket` or reinstall dependencies.\n" +
- ` Original error: ${err.message}`,
- );
- }
- }
|