1.0.7 • Published 7 years ago

namespace-bundler v1.0.7

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
7 years ago

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.

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago