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

@silyze/background-runner-execute-instantly

v1.0.0

Published

Local and instant execution transport for @silyze/background-runner

Downloads

5

Readme

Background Runner – Execute Instantly

A zero‑overhead, in‑process transport for @silyze/background-runner.

Run your jobs synchronously – perfect for unit tests, CLI tools, or any scenario where you don’t need queues, IPC, or brokers.


Why?

  • Instant execution – tasks run immediately in the same call‑stack.
  • 100 % type‑safe – preserves the compile‑time guarantees of Background Runner.
  • Drop‑in – swap transports later (RabbitMQ, Redis, WebSocket…) with no changes to call‑sites.
  • Zero dependencies – tiny footprint, uses the built‑in structuredClone() and a small assertNonNull() helper.

Installation

npm install @silyze/background-runner-execute-instantly

Peer dependency: @silyze/background-runner ≥ 1.0.0.


Quick start

import { BackgroundRunner, handler, registry } from "@silyze/background-runner";
import ExecuteInstantly from "@silyze/background-runner-execute-instantly";

/**
 * 1) Define some jobs
 */
const consoleRegistry = registry(
  handler("log", async (msg: string) => console.log(msg)),
  handler("warn", async (msg: string) => console.warn(msg)),
  handler("error", async (msg: string) => console.error(msg))
);

/**
 * 2) Create a runner bound to the *instant* transport
 */
const consoleRunner = new BackgroundRunner(consoleRegistry, ExecuteInstantly);

/**
 * 3) Fire‑and‑forget (well… almost – they run right now!)
 */
consoleRunner.run("log", "Hello immediate world");
consoleRunner.run("warn", "Heads‑up");
consoleRunner.run("error", "Something broke");

Tip: Because the transport deep‑clones parameters via structuredClone, your handler gets its own copy – no unintended mutation leaks.


API

ExecuteInstantly(getJobHandler) (default export)

default function ExecuteInstantly<
  R extends JobHandler<string, any>[],
  N extends RegistryName<R>
>(
  getJobHandler: <F extends N>(name: F) => MaybeRegistryJobHandler<F, R>
): JobTransport<R, N>;

| Param | Type | Description | | --------------- | ----------------------------------- | ---------------------------------------------------------------------- | | getJobHandler | (name) => MaybeRegistryJobHandler | Provided by BackgroundRunner; resolves a handler by name at runtime. |

Returns a JobTransport whose handleJob(name, params) simply:

  1. Looks up the handler via getJobHandler.
  2. assertNonNull (throws if job not found – should never happen with a typed registry).
  3. Invokes handler(...structuredClone(params)) synchronously.

🏗 When not to use this transport

  • Heavy CPU work – it will block the event loop; use a worker thread or queue instead.
  • Horizontal scaling – for multi‑process / multi‑machine setups, pick a message broker transport.

Treat Execute Instantly as a baseline: develop locally, unit‑test easily, then graduate to distributed transports without rewriting your business code.