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

@wefterjs/core

v0.0.1

Published

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="../../Logo/Dark/Icon.svg"> <source media="(prefers-color-scheme: light)" srcset="../../Logo/Light/Icon.svg"> <img alt="Wefter" src="../../Logo/Light/Icon.svg

Readme


It gives your JS code a single, typed bridge to native plugin capability on both Android (Kotlin) and iOS (Swift), through the same functions either way.

Install

pnpm add @wefterjs/core

This is a real runtime dependency, not a dev dependency, since your app imports it at run time on the device. Its counterpart, @wefterjs/cli, is a dev dependency instead, since it never ships in the built app.

Usage

Most of the time you won't call this package's functions directly. A plugin you install with wefter add exposes its own wrapper functions (Scanner.open(), Storage.get()) that call into @wefterjs/core underneath. You'll reach for it directly for built-in system calls, or to check on the bridge itself:

import {
  invokeNative,
  isNativeBridgeAvailable,
  getDeviceInfo,
  hideSplash,
} from "@wefterjs/core";

if (isNativeBridgeAvailable()) {
  const { platform, osVersion } = await getDeviceInfo();
  console.log(`Running on ${platform} ${osVersion}`);
}

await hideSplash();

const { debug } = await invokeNative<{ debug: boolean }>("__system", "isDebug");

API

| Export | What it does | | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | invokeNative(plugin, method, payload?, options?) | Calls a native method, returns a Promise. Every plugin wrapper calls this underneath. Rejects with a WefterBridgeError on timeout, abort, or no bridge present. | | registerHook(hookName, callback) | Subscribes to native-pushed events (sensor readings, scan results). Returns { remove() }. | | onBridgeReady() | Resolves once the native bridge is wired up. Await it once before your first plugin call to avoid a startup race. | | isNativeBridgeAvailable() | Synchronous check: true inside the native shell, false in a plain browser tab. | | getPlatformInfo() | Synchronous, no native round-trip: { platform, coreVersion, environment }. | | getDeviceInfo() | Async native call: { platform, osVersion } straight from the OS. | | hideSplash() | Signals the app is ready so a dismissOn: "ready" splash screen can dismiss. | | definePlugin(name, methods) | Used by plugin authors to generate a typed wrapper object around invokeNative. | | WefterBridgeError, WefterErrorCode | The error class and code union every rejected call uses (TIMEOUT, ABORTED, NO_BRIDGE, UNKNOWN_PLUGIN, INVALID_PAYLOAD, PLUGIN_THREW, PERMISSION_DENIED, UNKNOWN). |

Testing

@wefterjs/core/testing mocks the bridge so you can test components that call plugins without a real device or emulator:

import { installMockBridge, uninstallMockBridge } from "@wefterjs/core/testing";
import { getDeviceInfo } from "@wefterjs/core";

installMockBridge({
  __system: async (method) => {
    if (method === "getDeviceInfo")
      return { platform: "android", osVersion: "14" };
    throw new Error(`unhandled method ${method}`);
  },
});

const result = await getDeviceInfo();
expect(result.platform).toBe("android");

uninstallMockBridge();

Each handler receives (method, payload) for calls made to that plugin name. Call uninstallMockBridge() afterward so later tests don't inherit a mock they didn't set up.

Development

pnpm build   # tsc -p tsconfig.json
pnpm test    # vitest run

Part of the Wefter monorepo. See the root README for the full picture, and wefter.dev for complete documentation.

License

MIT