Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

helios-merge

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

helios-merge

Tool for merging Helios Kernel modules

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

helios-merge — merges Helios modules

helios-merge is a command-line tool which bundles JavaScript modules based upon the Helios Kernel module format. This tool can be used to prepare a library internally managed as several Helios Kernel modules to release as a plain JavaScript file (suitable for using without Helios Kernel), or to simply get a bundled module suitable for further minimizaiton. helios-merge is based upon the Esprima and Escodegen projects.

Installation

Install helios-merge using npm:

$ sudo npm install helios-merge -g

Optionally you may download the distribution using this link. In latter case you will have to launch it as node path/to/helios-merge.js instead of simply helios-merge in the examples below.

Usage

$ helios-merge --input=path --output=path [additional options]
Options:

--input path of the main module to start merging from (defaults to ./main.js)

--output path to write the bundled script into. After the bundle is prepared, it could be reused instead of the original file (provided to the --input option) with the same effect

--quiet suppress informational messages display

--plain create a plain .js file suitable to be used without Helios Kernel (implies --scope=global)

--scope=subdir (default) — bundle only the scripts in the directory and subdirectories. All modules outside of the bundling scope will be treated as external dependencies and will be included into the bundled module head using the include() function of Helios Kernel

--scope=local bundle all sources available by a local path, but treat remote dependencies as external

--scope=global bundle all local and remote files (paths starting form http://...)

--help or whatever unrecognized — show help message

Example

In this example we have a library splitted between several modules relying on each other, and we are going to merge it into a single module. The source of the artificial example library could be like this:

./myLibrary.js — main library module, provides a method to say 'Hello World!':
include('./base.js');
include('./print.js');

init = function() {
    myLibrary.helloWorld = function() {
        myLibrary.print('Hello World!');
    }
}
./print.js — prints a given message:
include('./base.js');

init = function() {
    myLibrary.print = function(text) {
        console.log(text);
    }
}
./base.js — declares library object:
init = function() {
    myLibrary = {};
}

Bundling the library using helios-merge like this:

$ helios-merge --input=./myLibrary.js --output=./myLibraryBundled.js

The generated myLibraryBundled.js will contain the code of all modules sorted in order of dependence and will behave like this:

init = function() {
    myLibrary = {};

    myLibrary.print = function(text) {
        console.log(text);
    }

    myLibrary.helloWorld = function() {
        myLibrary.print('Hello World!');
    }
}

This code demonstrates the behaviour of the generated bundle, but in fact the code of each original module will additionally be wrapped into an anonymous function to make use of local variables declared in each original module's initializer.

Bitdeli Badge

FAQs

Package last updated on 21 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc