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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mafia-shared-relay

v0.0.9

Published

This is a script aimed at simplifying the creation of a relay interface for scriptors, and even for normal users.

Downloads

27

Readme

This is a script aimed at simplifying the creation of a relay interface for scriptors, and even for normal users.

This can be used in two ways. The first is by a script as a library, the second can be used by a non-scripter by providing the name of a json file.

The json file is expected to be located in relay/shared_relay/pages/, an example of how you'd load it is provided in relay/shared_relay/relay_Scripts.js. Just replace the test with your own page name. You can also name files outside of the folder, by default it will look in that folder if the path provided does not contain a /.

https://github.com/libraryaddict/MafiaSharedRelay/blob/master/relay/shared_relay/pages/test.json

You can do multiple pages, "test", "test2", "test3"

If your relay page fails to load, then you did some bad json or missed a parameter or something. Try validate your json, and check against the test.json file to see if you missed something. This is not a dummy proof system.

Place a file with the same name but .css and it'll load that css file alongside your page of the same name. So test.css and test.json

For scripters, you can install the npm library located here: You will be bundling this into your script.

To make use of it, you will be making a relay/relay_MyScript.js file that calls if (handleApiRequest()); return; generateHTML(pages: HtmlPage[]). You can also provide extra css by providing ExtraHtml

Components to be used are found in https://github.com/libraryaddict/MafiaSharedRelay/blob/master/src/mafia/RelayUtils.ts#L3 and work the same way as the .json structure does for the most part.

On the offchance you want to do something more complicated, you're probably better off making your own relay page. This used garbo's relay as a base, but reworked stuff until the only big similarity is the css.

If you want to execute custom javascript that invokes mafia's API, the only real solution is to make an XMLHttpRequest or fetch that points to a relay script which executes the javascript itself, as mafia will be executing that relay script not the browser and thus the api calls are available.

This is how this script sets the properties, it invokes a script that executes the javascript provided in the 'api' form field. Then returns the result of that javascript as the executed page's text.

If the page would return no text, then ' ' is returned to prevent a 404 error.

It loads the properties in a more simple manner, it's created in a data object when the relay page is first invoked. Which of course means that if the properties change while the relay script is open, the relay script will be unaware until it is refreshed.

To install as an API, use

npm i mafia-shared-relay

To install otherwise

git checkout libraryaddict/MafiaSharedRelay release

Projects using this!

https://github.com/frazazel/goorbo

https://github.com/libraryaddict/Greyday