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

namespace-bundler

v1.0.7

Published

A namespace-based bundler for JavaScript

Downloads

7

Readme

namespace-bundler

Master Build Status

A JavaScript bundler based on namespaces. The goal is to have a simple, easy to use bundler that honors namespace patterns without the need of import or require at the top of JavaScript files. Another way of putting it is to have a bundler that doesn't touch your source code unless it has to -- as with 'use strict'; statements -- and just puts them together into one file. One major benefit with this is having legible JavaScript in browser dev tools, including legacy ones like IE8; yes, I know, but people still use it.

How to use

Simply include namespace-bundler as a node module or require the file directly, then call its bundle method:

const Bundler = require('namespace-bundler');

let bundledFileContent = Bundler.bundle('/absolute/path/to/source/directory').value;

The bundle method returns a plain object with two properties, value and writeToFile:

  • value is a string consisting of all the file contents in the target directly, bundled in order of dependency.
  • writeToFile simply writes the value synchronously to a target file path; see "Write to file" for more details.

Write to file

If writing the bundled file contents to a file is desired, just use the synchronous writeToFile method of the returned object by the bundle method; see "How to use" if you haven't read about the bundle method.

const Bundler = require('namespace-bundler');

Bundler.bundle('/absolute/path/to/source/directory').writeToFile('/absolute/path/to/destination/file');

Momentarily this method is synchronous. However, this will change in the future to be asynchronous, with an optional synchronous method.

Install

Simply install using NPM:

npm install --save-dev namespace-bundler

Development

Feel free to contribute source code and ideas to this project. For testing and development purposes, a directory called dev is available with its contents ignored -- except dev-readme.md. This is for convenience whilst not bloating the project with dead source code.

Visual Studio Code

A debug configuration for development purposes has been set up under .vscode/launch.json. This way the run-me file can be executed in debug mode.

Other Dev Tools

If other development tools are being used, run-me can be executed on any terminal. See nodejs's page on debugging using a terminal.