'use strict';


// wrap a commonjs module according to neuron

// @param {Object} options
//  - code  {string} 
//  - deps  {Array.<string>} deps
//  - id    {Object} package.json object
module.exports = function(options) {

    return  options.define + '(\'' + options.id + '\', [\'' + options.deps.join('\', \'') + '\'], function(require, exports, module) {\n\n' +

                options.code.replace(/\r|\n/g, '\n') + 

            '\n\n});';

};






'use strict';

var lang = require('./lang');

// wrap a commonjs module according to neuron

// @param {Object} options
//  - code  {string} 
//  - deps  {Array.<string>} deps
//  - id    {Object} package.json object
module.exports = function(options) {

	options.deps = options.deps.length ? "'" + options.deps.join("', '") + "'" : '';
	options.code = options.code.replace(/\r|\n/g, '\n');

    return lang.template("{define}('{id}', [{deps}], function(require, exports, module) {\n\n"
    	+ "{code}\n\n" + 

    "});", options);
};






fix a bug that if there is no dependencies, the code generated will throw syntax error