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 🙏

© 2024 – Pkg Stats / Ryan Hefner

reverse-require

v2.0.0

Published

Search for node modules from host project first

Downloads

37

Readme

reverse-require

Search for node modules from host project first

Overview

This project provides a set of methods to reverse the search order of module imports.

So instead of searching the module first and moving up the chain, we start at the top-level project and work our way down the child projects until we find the module.

When is this useful?

Imagine you have a Core library that defines a set of npm dependencies.

You reference Core in Project A and Project B to get a common set of dependencies and behaviour :sunglasses:

But now you want to test out how a new dependency will work in Project A. You npm link the module into Project A, fire it up and... Core still loads the old version :neutral_face:

Of course! Core defines the dependency so it's installed locally to that project and linking the new version to Project A won't help.

You could link the dependency into Core but it can get a bit hairy if you have a few libraries deep. And what if you need a different set of libraries in Project B?

reverse-require lets you link a module near the base of the tree and version with your dependency modules (a little like npm dedupe but without having to define the same dependency in your package.json file).

Installation

$ npm install --save reverse-require

Usage

// Configuration:

// In the index of your project:
var ReverseRequire = require('reverse-require');
ReverseRequire.moduleRoot = __filename;

// Usage:
var rr = require('reverse-require')();
var _ = rr('lodash');