anodynos / uRequire

The Ultimate JavaScript Module Builder & Automagical Task Runner. Convert AMD & CommonJS/NodeJS modules to UMD, AMD, CommonJS or bundle them as `combined.js` (rjs & almond, AMDclean soon) & automagically run/test/watch them on nodejs, Web/AMD or Web/Script. Declarative & DRY config with inheritance. Manipulate & inject dependencies, module code, banners, version etc while building with a single line. Support two kinds of plugins, ResourceConverter (i.e file level) and AfterBuilder (i.e the whole bundle). Transparent support for Coffeescript, IcedCoffeescript, Coco, LiveScript – they’re just JavaScript :-)
http://anodynos.github.io/uRequire
MIT License
265 stars 20 forks source link

Missing "var" statement in dependencies. (AMD to nodejs) #50

Closed plepers closed 10 years ago

plepers commented 10 years ago

uRequire v0.6.10

When convert AMD module to nodejs/commonjs format, the "var" statement is missing at the beginning of dependencies loading.

eg.

AMD source

define(
  [
    'eagl/core/Pipeline',
    'eagl/lang',
    './Foo'
  ],
  function(
    Pipeline,
    lang,
    Foo
  ){

  //...
  return {};

});

"nodejs" result :

(function (window, global) {

// !! expect "var Pipeline ...."  
  Pipeline = require('../core/Pipeline'),
    lang = require('../lang'),
    Foo = require('./Foo');

module.exports = (function () {
  return {};
}).call(this);

}).call(this, (typeof exports === 'object' ? global : window), (typeof exports === 'object' ? global : window))

In template, l.237, is the _.any callback should be bound to this?

(dep, depIdx)=> (not dep.isSystem) and (@module?.parameters or [])[depIdx]) 
             ^

I can submit a PR if you wish.

Pierre

anodynos commented 10 years ago

Oops, it got away - thanks! I ll release it as 0.6.12 tomorrow