node package manager


JavaScript Integration System.

JSI Introduction

a simple module loader , you can use npm installed modules in web browser such as it work in nodejs!


npm install jsi -g


  • install and run example:

    $ cd <webroot>
    $ jsi example
    $ open http://localhost:8080
  • command line

    • on [webroot]

      $ jsi example 									--deplay hello world example
      $ jsi start										--start debug server
    • on [webroot]/[scriptroot]

      $ jsi export -o temp.js main.js					--export main.js as a single javascript file
      													(main.js variables on global namespace;
      														buf dependence modules is hidden, you can use require('modulename') to get it )
      $ jsi export -o exported.js -ns xmldom xmldom	--export package: export xmldom to a single script and exports variables on the namespace xmldom.
		//advance useage:  install a optimized external package on package system.
		$ jsi install jquery							--install a external optimized package from npm
		$ jsi install ./workspace/xmldom				--install a external optimized package from local filesystem
  • lite template example

    //inline style
    var tpl = <div>
    	<p> this is a xml style templete ; 
    		default syntax support for mostly javascript editor (E4X standard) </p>
    //single template file
    var tpl = liteXML("/path.tpl")
    //partly template file(css3 selector)
    var tpl = liteXML("/path.tpl#header")
  • javascript debug and compress

    • enable debug


    • disable debug


  • test route /route.js

    exports = [
    	//mock with json data
    	//mock from remote url 
    	//mock from local json file
		//mock with nodejs request handle
			path:	/\/service\/user\/(\d+)/,
			action:	function(request,response,path,uid){
				var headers = {"Content-Type":"text/json;charset=utf-8"};
				response.writeHead(200, headers); 
				return true;