Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add --amd option to generate ender.js as an AMD whole thing

  • Loading branch information...
commit 8ff8ea327bf07e7183fc155d1323f5bfbc8e1387 1 parent abbc542
@jfromaniello authored
Showing with 7 additions and 1 deletion.
  1. +4 −0 lib/ender.cmd.js
  2. +3 −1 lib/ender.file.js
View
4 lib/ender.cmd.js
@@ -41,6 +41,10 @@ module.exports = {
}
value = opts.splice(0, j)
size = 1 + value.length
+ } else if (option == '--amd') {
+ option = 'amd'
+ value = true
+ size = 1;
} else if (option == '--noop' || option == '-x'){
option = 'noop'
value = true
View
4 lib/ender.file.js
@@ -146,6 +146,8 @@ ENDER.file = module.exports = {
result = result.join('\n\n')
if (options.sandbox) {
result = ['(function () {', result, '}).call({});'].join('\n\n')
+ }else if (options.amd){
+ result = ['define(function(){\n\n var _ender = {}; \n\n (function () {', result, '}).call(_ender); \n\n return _ender.ender;\n});'].join('\n\n')
}
callback(null, result)
})
@@ -463,7 +465,7 @@ ENDER.file = module.exports = {
source = source.join('\n\n ') + '\n\n}());'
}
- if (options.sandbox && packageName == 'ender-js') {
+ if ((options.sandbox || options.amd) && packageName == 'ender-js') {
source = ['/* Declare local API */\nvar require, provide, $, ender;\n'
, source
, '\n/* Set Local API */\nrequire = this.require\nprovide = this.provide\nender = $ = this.ender;'
Please sign in to comment.
Something went wrong with that request. Please try again.