# namespace-bundler

> A namespace-based bundler for JavaScript

Latest version **1.0.7** (published 2017-01-22) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install namespace-bundler
pnpm add namespace-bundler
yarn add namespace-bundler
bun add namespace-bundler
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2017-01-22 |
| First published | 2017-01-22 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Daniel Stuessy |
| Maintainers | dstuessy |

## Links

- npm: https://www.npmjs.com/package/namespace-bundler
- Repository: https://github.com/dstuessy/namespace-bundler
- Homepage: https://github.com/dstuessy/namespace-bundler#readme
- Issues: https://github.com/dstuessy/namespace-bundler/issues
- npm.io page: https://npm.io/package/namespace-bundler

## Dependencies (4)

- [escope](https://npm.io/package/escope.md) ^3.6.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [esprima](https://npm.io/package/esprima.md) ^3.1.2
- [escodegen](https://npm.io/package/escodegen.md) ^1.8.1

## Recent versions

- 1.0.7 (latest) — 2017-01-22
- 1.0.6 — 2017-01-22
- 1.0.5 — 2017-01-22
- 1.0.4 — 2017-01-22
- 1.0.3 — 2017-01-22
- 1.0.2 — 2017-01-22

## README

# namespace-bundler

[![Master Build Status](https://travis-ci.org/dstuessy/namespace-bundler.svg?branch=master)](https://travis-ci.org/dstuessy/namespace-bundler)

A JavaScript bundler based on [namespaces](http://adamsilver.io/articles/javascript-namespacing/).
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](http://caniuse.com/usage_table.php).



## How to use

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

``` javascript
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.

``` javascript
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:

``` shell
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](https://nodejs.org/api/debugger.html) using a terminal.

---
_Source: https://npm.io/package/namespace-bundler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
