hi all, jaggery2 module loading system has been implemented. you can find in github here https://github.com/sidias/jaggery2
jaggery2 can load modules as follow(similar to node module loading system) 1.) require('foo') 2.) require('/home/buddhi/Documents/jaggery2/foo') 3.) require('./foo'); 4.) require(../../foo) hint :- parameter 'foo' can be a file module(single js file)(.jag is not implemented yet) or folder module. *File Module* if module is a file module and if exact file name is not given(without file extension) jaggery will try to load module with added extension .js(.jag is not implemented yet) *Folder Module* if module is a folder as module then jaggery find that folder in given path and try to read package.json if exists.if not try to read and load inedex.js file.if package.json file exists attribute main is point to the main module eg: in package.json { "name" : "module name", "main" : "./index.js"} *Parameter to require function* can be *,core modules or folder as module* core module(in src/lib folder) can be loaded by passing module name to require function.for instance 'require('foo')'.this will always returns core module if exists if foo is not a core module then, module loading system starting from current working directory and append '/jaggery_module ' to that directory name attempt to load module from that directory to root directroy eg:- if we are working from directory /home/buddhi/jaggery2/moduleTest/ jaggery will look all the following directories till module found * /home/buddhi/jaggery2/moduleTest/jaggery_module * /home/buddhi/jaggery2/jaggery_module * /home/buddhi/jaggery_module * /home/jaggery_module *absolute path* no complex process to find the module from that system.module can be folder module or file module. *relative path(./ or ../../)* resolve path and load the module.module can be folder module or file module hint : - in a given path if file module and folder module with the same name exists.jaggery will load the file module ignoring folder module -- to load a module, replace module name you wish to load in module.js file(line 418) then change dir to ./nas/src/ bin and execute command ./jjs your dir/nas/Src/Dilan/Jaggery.js Thanks & Best Regards, *Buddhi Nipun Mihara* Software Engineer(intern) WSO2, Inc.:http://wso2.com lean.enterprise.middleware
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev