Permalink
Browse files

Fix http-client reference

  • Loading branch information...
1 parent 2d2b99e commit baad36ca36e878ae14a4b6279bbf2596f10860b7 @kriszyp committed Jul 7, 2010
Showing with 26 additions and 2 deletions.
  1. +2 −2 jackconfig.js
  2. +24 −0 lib/util/narwhal-compat.js
View
@@ -17,8 +17,8 @@ require("app");
exports.app =
// this will provide module wrapping for the server side CommonJS libraries for the client
transporter.Transporter({loader: function(id){
- if(id.match(/-engine/)){
- id = "../engines/default/lib/" + id;
+ if(id.match(/promised-io/)){
+ id = id.replace(/promised-io\/http-client/,'http-client');
}
return require.loader.loader.fetch(require.loader.resolvePkg(id.substring(0, id.length - 3),"","","")[0]);
}},
View
@@ -0,0 +1,24 @@
+var defaultLoader = require.loader;
+var packages = ["perstore", "pintura", "commonjs-utils", "wiky", "transporter", "narwhal-lib", "narwhal", "tunguska", "promised-io", "rql", "patr"];
+var remapped = {
+ "http-client": "rhino-http-client"
+};
+try{
+ require("perstore/model");
+}catch(e){
+ var defaultResolvePkg = require.loader.resolvePkg;
+ require.loader.resolvePkg = function(id, baseId, pkg, basePkg){
+ var packageName;
+ for(var i = 0; i < packages.length; i++){
+ packageName = packages[i];
+ if(id.substring(0, packageName.length) == packageName){
+ var id = id.substring(packageName.length + 1);
+ if(id in remapped){
+ id = remapped[id];
+ }
+ return defaultResolvePkg(id, baseId, pkg, basePkg);
+ }
+ }
+ return defaultResolvePkg(id, baseId, pkg, basePkg);
+ };
+}

0 comments on commit baad36c

Please sign in to comment.