GithubHelp home page GithubHelp logo

ekoeryanto / module-igniter Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 127 KB

License: MIT License

JavaScript 100.00%
automation node module loader igniter nodejs rollup-plugin webpack-plugin caller instantiate

module-igniter's Introduction

JavaScript Style Guide Codecov Build Status Build status CircleCI

NodeJS Module Igniter

Automatic call nodejs module, originally created for load rollup-plugins.

Install

Using NPM

npm i module-igniter

Using Yarn

yarn add module-igniter

Usage

Without Argument

const igniter = require("module-igniter");
const plug = igniter({ prefix: "rollup-plugin-" });
plug("commonjs", "node-resolve");
// or plug(['commonjs', 'node-resolve'])
// result [require('rollup-plugin-commonjs')(), require('rollup-plugin-node-resolve')()]

With Single Argument

const igniter = require("module-igniter");
const plug = igniter({prefix: 'rollup-plugin-'})

// single array argument
plug({ foo: [["hello"]] });
// result [require('foo')(['hello])]
plug({replace: {'process.env.NODE_ENV': JSON.stringify(environment)})
// result [require('rollup-plugin-replace')({'process.env.NODE_ENV': JSON.stringify(environment)})]

With multiple Arguments

const igniter = require("module-igniter");
const plug = igniter();

// single array argument
plug({ foo: [["hello"], { bar: "baz" }] });
// result [require('foo')(['hello], {bar: 'baz'})]

Optional Environment (Last Boolean Parameter)

const igniter = require('module-igniter')
const plug = igniter({prefix: 'rollup-plugin-'})
plug({replace: {'process.env.NODE_ENV': JSON.stringify(environment)}, false)
// result []

Class Based Plugin (Webpack)

const igniter = require("module-igniter");
const plug = igniter({ classic: true });
plug({
  "html-webpack-plugin": {
    filename: "assets/admin.html"
  }
});
// result [new require('html-webpack-plugin')({filename: 'assets/admin.html'})]

Example

See here for real usage example

License

MIT

module-igniter's People

Contributors

ekoeryanto avatar

Watchers

 avatar  avatar

module-igniter's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.