New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

jsic

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsic

JS Import Compiler optimizes JavaScript by inlining recursively JavaScript files referenced by $import function

latest
Source
npmnpm
Version
0.1.6
Version published
Maintainers
1
Created
Source

JS Import Compiler

JS Import Compiler is a node.js application that looks for $import calls recursively in the source JavaScript file and resolves them in the destination file the same way as LESS/SCSS preprocessors resolve @import rule in the output CSS.

Why not AMD?

  • JSCS gives a way to reduce the number of HTTP requests by combining all scripts into a single one, what increases the application performance
  • Being a build tool JSCS doesn't require any additional JavaScript on client-side

Usage

Define dependencies in your code:

src/main.js

var foo = $import( "./Form/Input/Tel" );

Create the dependency source:

src/Form/Input/Tel.js

function() {
    return {
          prop: "",
          method: function(){}
    }
}

Run the compiler:

node jsic.js src/main.js build/mail.js

Examine the combined file:

build/main.js

var foo = function() {
    return {
          prop: "",
          method: function(){}
    }
};

Linter compatibility

In order to have keep dependency source in in valid syntax from a linter prospective you can assign its body to module.exports, which is ignored by the compiler

/**
* The banner will be ignored by compiler
*/
module.exports = function() {
    return {
          prop: "",
          method: function(){}
    }
};

JSIC as a grunt task

Please find instructions at https://github.com/dsheiko/grunt-jsic

FAQs

Package last updated on 18 Nov 2013

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