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-maker

v0.0.2

Published

Make a customized node REPL with ease.

Readme

repl-server

Make a customized node REPL with ease.

The problem

Building a custom REPL is not hard with the repl module, but you need a non-trivial amount of boilerplate to have things you might expect out of the box.

This solution

This module exposes a function that creates and starts a REPLServer with some packed features:

  • Multiline expressions: You don't have to write every statement in a single line.
  • Command history: You can pass a path to a history file that will save the command history between sessions (using repl.history).
  • Promises evaluation: Avoid doing things like (async () => { const foo = await getFoo(); console.log(foo) })(): every expression that evaluates to a promise will be waited. Just getFoo() will work.

Usage

Install it:

npm install repl-maker

create your repl:

const path = require('path')
const os = require('os')
const makeRepl = require('repl-maker')

const historyFile = path.join(os.homedir(), '.my_repl_history')
const context = {
  answer: 42,
  square: (x) => x*x
}

makeRepl({ historyFile, context })

and use it:

$ node index.js
> answer
42
> Promise.resolve(3)
3
> square(5)
25

Configuration

The makeRepl function accepts an object with these options:

  • prompt (string) - The prompt of your REPL (default: > )
  • context (object): Every key in this object will be available as a local variable (default: {})
  • historyFile (string) - Path to a file that will save the command history (default: null, meaning that no history file will be generated)
  • evalAsync (boolean) - Configures if the REPL waits until promises are resolved or not (default: true)
  • recoverErrors (boolean) - Configures if multiline expressions are allowed or not (default: true)
  • onExit (function) - A callback that will be executed when the user exits the REPL (default: null)

Use cases

If you find yourself opening a node REPL and requiring some stuff of your project to try it out, then this module can help you.

A very straightforward example is an express server with some models. You can create a minimal repl.js file:

const makeRepl = require('repl-maker')
const db = require('./models')

makeRepl({
  context: { db }
})

and add a npm script "repl": "node repl.js". Then you can start it and interact with your models:

npm run repl
> db.findUser({ id: 1 }).then(user => user.name)
'John Doe'