Permalink
Browse files

Make define a local free variable until I can move off mixed loading …

…with Narwhal
  • Loading branch information...
1 parent 7373562 commit e73f399e209268e25834dc5b4d31d5617fe140da @kriszyp committed Oct 28, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/nodules.js
View
@@ -129,7 +129,7 @@ function EnginePackage(engine){
};
}
-define = function (id, injects, factory) {
+var define = function (id, injects, factory) {
if (currentModule == null) {
throw new Error("define() may only be called during module factory instantiation");
}
@@ -306,12 +306,12 @@ function makeRequire(currentId){
originalExports = module.exports = exports,
nextRequire = currentRequire = makeRequire(uri);
module.dependents[currentId] = true;
- exports = factory.call(exports, nextRequire, exports, module,
+ exports = factory.call(exports, nextRequire, exports, module, define,
currentFile, currentFile.replace(/\/[^\/]*$/,''))
|| exports;
if(factory != factories[uri]){
// if a module was wrapped with the transport/D than the factory will get replaced
- exports = factories[uri].call(exports, nextRequire, exports, module,
+ exports = factories[uri].call(exports, nextRequire, exports, module, define,
currentFile, currentFile.replace(/\/[^\/]*$/,''))
|| exports;
}
@@ -618,7 +618,7 @@ exports.load = function(uri, require){
};
function createFactory(uri, source){
try{
- factories[uri] = compile("function(require, exports, module, __filename, __dirname, Worker, SharedWorker){" + source + "\n;return exports;}", uri);
+ factories[uri] = compile("function(require, exports, module, define, __filename, __dirname, Worker, SharedWorker){" + source + "\n;return exports;}", uri);
/* var indexOfExport, indexOfRequireDef = source.indexOf("define");
if(indexOfRequireDef > -1 && ((indexOfExport = source.indexOf("exports.")) == -1 || indexOfExport > indexOfRequireDef)){
// looks like it is an Aynchronous module definition module

0 comments on commit e73f399

Please sign in to comment.