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

bugpack

v0.2.2

Published

Package manager and loader to help make browser and node js package loading consistent and easier

Downloads

24

Readme

bugpack

bugpack is a JavaScript package loader that helps make browser and node js package loading consistent. It is designed to work both within node js as well as directly in the browser.

bugpack provides a simple name base package loading mechanism that depends upon a pre-generated registry called bugpack-registry.json. These files can be produced using the bugpack-registry project. Name based loading makes it very simple to export and require packages without having to update all of your requires every time you move a file.

The library makes up part of the foundation of our architecture for airbug so check out the docs for an overview of the full power of what the code has to offer. If the library is missing something you need, please let us know!

Latest Version 0.2.0

NOTE: This documentation is still being written. If you click on a link and it doesn't go anywhere, it's likely because that portion of the docs hasn't been written yet. If there are parts of the docs you'd like us to focus on, feel free to ask!

Quick Examples

Export and require without loading of registry

var bugpack     = require('bugpack');

var MyExport = function() {};

bugpack.export('MyExportName', MyExport);


// Else where in code...
var MyExport = bugpack.require('MyExportName');    // MyExport

Download Source

The source is available for download from GitHub

For the web, you can download the packaged scripts here

https://s3.amazonaws.com/public-airbug/bugpack-0.2.0.js
https://s3.amazonaws.com/public-airbug/bugpack-0.2.0.min.js

Install

For node js, you can install using Node Package Manager npm

npm install bugpack

For the web, simply include this script in your application

<script type="text/javascript" src="https://s3.amazonaws.com/public-airbug/bugpack-0.2.0.min.js"></script>

Usage

In node js:

var bugpack = require('bugpack');

var SomePackage = bugpack.require('SomePackage');

In the browser:

<script type="text/javascript" src="https://s3.amazonaws.com/public-airbug/bugpack-0.2.0.js"></script>
<script type="text/javascript">

var bugpack = require('bugpack');

var SomePackage = bugpack.require('SomePackage');

</script>

Documentation

Overview

BugPack Registry

BugPack System

Getting Started

Generate bugpack-registry.json file

bugpack-registry.json files are what tell the bugpack system the names of all the available exports and where they can be found. Registry files should generated and placed at the root of either a node module (for node js) or a base url (for the web). Registry files use relative paths to point the bugpack system at files. So once the registry file is generated it should stay at the same relative point as the files that the registry points to...

Example

I have JS files that have bugpack annotations located at...

/my/path/myfile.js
/my/path/somedir/myotherfile.js

I decide to generate my registry at

/my/path

So that the registry now lives at..

/my/path/bugpack-registry.json

As long as the registry file and the JS files remain relative to one another the system will work.

e.g. I can move all the contents of /my/path/ to /my/elsewhere/

So the files are now

/my/elsewhere/myfile.js
/my/elsewhere/somedir/myotherfile.js
/my/elsewhere/bugpack-registry.json

The registry file is still in the same relative path to the JS files, so it will work..

However, you could not just move the contents of /my/path/somedir/ to /my/path/someotherdir/

So the files are now

/my/path/myfile.js
/my/path/someotherdir/myotherfile.js
/my/path/bugpack-registry.json

This would prevent the bugpack system from correctly knowing where the myotherfile.js is located.

When these breaking changes are made, you will need to regenerate the bugpack-registry.json file