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

repl-live

v1.0.0

Published

Node REPL with automatic context re-require on file change

Readme

repl-live

Node REPL with automatic context re-require on file change.

You're tinkering with a module at the REPL. You change the source. The REPL doesn't see it. repl-live watches the working directory and re-require()s your modules into the REPL context on every change, so the next thing you type sees the new code.

Install

npm install --save-dev repl-live

Usage

import { startLive } from 'repl-live';

startLive({
  requires: {
    foo: './foo.cjs',
    bar: './lib/bar.cjs',
  },
});

Now at the REPL, foo and bar are the current exports of those files. Edit the file, hit return, they're the new exports. Both relative paths (resolved against watchDir) and absolute paths / node-module names are accepted.

API

startLive(options): REPLServer

Same shape as repl.start() from node:repl, plus:

| Option | Type | Default | Notes | | --- | --- | --- | --- | | requires | Record<string, string> | {} | Map from REPL context variable name to module path. | | watchDir | string | process.cwd() | Directory to watch (recursive). | | onReload | (event, changedPath?) => void | undefined | Called after a successful reload. event is 'initial' or 'change'. | | onReloadError | (err) => void | logs to stderr | Called when a require() throws during reload; the previous context value is retained. |

Returns the underlying REPLServer. On the exit event the file watcher is closed automatically.

attachLiveReload(target, requires, watchDir, onReload?, onReloadError?)

Lower-level building block. Loads requires into target.context and watches watchDir for changes. Returns an async dispose() that closes the watcher. Useful for embedding the reload logic into a host other than repl.start.

Notes

  • Re-require() works for CommonJS modules. ESM is one-shot in Node (no cache eviction available), so ESM modules will only load once — keep the modules you want to hot-reload as CJS.
  • A reload that throws is caught: the previous context value stays in place and the error goes to onReloadError (or stderr).
  • The file watcher is chokidar 4.x, which handles editor-atomic-save quirks across OSes.

Migration from 0.x

The 0.x API monkey-patched the built-in repl module so that require('repl-live').start(options) would work as a drop-in for repl.start. ESM doesn't allow that. v1 exports startLive directly:

// 0.x
const repl = require('repl-live');
repl.start({ requires: { foo: './foo.js' } });

// 1.x
import { startLive } from 'repl-live';
startLive({ requires: { foo: './foo.cjs' } });

Requirements

  • Node.js >= 22.

License

MIT.