Skip to content

Commit

Permalink
silence error due to importing standard node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
dvv committed Jul 14, 2010
1 parent 9915fd8 commit 1800844
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/jsgi/transporter.js
Expand Up @@ -20,15 +20,15 @@ exports.Transporter = function(options, app) {
},
autoRun = "autoRun" in options ? options.autoRun : true,
excluded = {};
converter = options.converter || exports.CommonJS;
converter = options.converter || exports.CommonJS;

excludeModules.forEach(function(moduleId){
excluded[moduleId] = true;
});
return function(request) {
var modules, isPaused, path = request.pathInfo;
if(path.indexOf(prefix) != 0){
if(app){
if(app){
return app(request);
}
return {
Expand Down Expand Up @@ -115,13 +115,14 @@ exports.Transporter = function(options, app) {
return;
}
if(!fileContents && write){
errors.push('console.warn(' + JSON.stringify(moduleName) + ' + " not found");\n');
if (console.warn === undefined)
errors.push('console.warn(' + JSON.stringify(moduleName) + ' + " not found");\n');
return;
}
if(moduleName === "require"){
// require.js loads the require handler, which can't be embedded in
// require.js loads the require handler, which can't be embedded in
// require.def because require doesn't exist yet
// also hand-coded modules that define their require.def's don't need wrapping/resolution,
// also hand-coded modules that define their require.def's don't need wrapping/resolution,
// they can be directly written
var baseUrl = request.pathInfo.substring(0, request.pathInfo.lastIndexOf("/") + 1);
// we set the base url in the require config so that it knows where to load from
Expand All @@ -130,10 +131,10 @@ exports.Transporter = function(options, app) {
return true;
}
if(excluded[moduleName] || fileContents.indexOf("require.def(") > -1){
// also hand-coded modules that define their require.def's don't need wrapping/resolution,
// also hand-coded modules that define their require.def's don't need wrapping/resolution,
// they can be directly written
write(fileContents);
return true;
return true;
}
converter(moduleName, fileContents, resolveDeps ? loadModule : function(){ return true;}, modules, write);
modules[moduleName] = 2; // finished
Expand Down Expand Up @@ -300,4 +301,4 @@ exports.DojoRequireJS = function(moduleName, fileContents, loadModule, modules,
write(fileContents);
write('\n});\n');
}
};
};

0 comments on commit 1800844

Please sign in to comment.