npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@maciejwojs/input-bridge

v0.2.1

Published

Native input bridge addon for Node.js

Downloads

902

Readme

@maciejwojs/input-bridge

Native Node.js addon for simulating hardware input events on Windows and Linux. The package exposes a single JavaScript API for mouse movement, clicks, keyboard events, scrolling, and typed text, with batched execution and optimization support.

Features

  • Windows backend using the native SendInput API
  • Linux backend using the Freedesktop RemoteDesktop portal on Wayland
  • Optional Linux X11 backend for environments where Wayland is unavailable
  • Batched event queue with explicit flush() execution
  • Relative and absolute mouse movement
  • Mouse button clicks and wheel scrolling
  • Raw keyboard events and typed Unicode text
  • DOM KeyboardEvent.code mapping via keyPressDOM()
  • Movement optimization via optimizeMouseMovesRelative() and optimizeMouseMovesAbsolute()
  • Optional native logger callback from the addon

Install

bun install

Quick start

import { InputBridge } from '@maciejwojs/input-bridge';

const bridge = new InputBridge({ autoFlush: false });
await bridge.init();

bridge.moveMouseRelative(10, 0);
bridge.mouseClick(0, true);
bridge.mouseClick(0, false);
bridge.flush();

API overview

  • init() - initializes the native bridge and requests permissions on Linux
  • moveMouseRelative(x, y) - queue a relative mouse movement
  • moveMouseAbsolute(x, y) - queue an absolute mouse movement
  • mouseClick(button, down) - queue a mouse button press/release
  • keyPress(keyCode, down) - queue a raw keyboard press/release
  • keyPressDOM(domCode, down) - queue a scan-code based key event from DOM KeyboardEvent.code
  • scrollMouse(delta) - queue a mouse wheel scroll event
  • typeString(text) - queue typed Unicode text
  • optimizeMouseMovesRelative(distanceThreshold) - reduce buffered relative move events
  • optimizeMouseMovesAbsolute(distanceThreshold) - reduce buffered absolute move events
  • toggleOptimization() - enable/disable internal mouse move optimization
  • flush() - execute all queued input events
  • setLogger(callback) - receive native backend log messages

Build and development

bun run build
bun run rebuild

To verify the native addon loads successfully:

bun run test:load

Prebuilt binaries

Create a prebuilt binary for the current platform:

bun run prebuildify

Create prebuilt binaries for Windows, Linux, and macOS targets:

bun run prebuildify:all

Built artifacts are placed in prebuilds/ and loaded automatically by lib/index.ts.

Supported platforms

  • win32 - fully implemented with Windows SendInput
  • linux - supported on Wayland via the RemoteDesktop portal and optionally on X11 when built with the X11 backend
  • other OSes use the stub fallback if compiled, but native injection is only available on supported backends

Project layout

  • lib/ - JavaScript API surface and wrapper exports
  • src/addon.cpp - N-API bridge implementation
  • src/win/platform_input_win.cpp - Windows backend
  • src/linux/platform_input_linux.cpp - Linux backend
  • src/platform_input_stub.cpp - fallback implementation
  • src/platform_input.hpp - shared backend interface and event queue
  • binding.gyp - native addon build configuration

Notes

The repository is designed to keep the public JS API stable while allowing per-platform native backend extensions. The InputBridge wrapper always exposes the same methods regardless of the active backend.