Permalink
Browse files

silence error due to importing standard node modules

  • Loading branch information...
1 parent 9915fd8 commit 18008444368b40b30e8c0e55586b7c444948982a @dvv dvv committed Jul 14, 2010
Showing with 10 additions and 9 deletions.
  1. +10 −9 lib/jsgi/transporter.js
View
@@ -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 {
@@ -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
@@ -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
@@ -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.