diff --git a/.nakignore b/.nakignore index f614359b..af2498a1 100644 --- a/.nakignore +++ b/.nakignore @@ -6,4 +6,5 @@ build/webkitbuilds/ build/win32* build/Cloud9 build/sdk -node_modules/logicblox/build/logicblox/static \ No newline at end of file +node_modules/logicblox/build/logicblox/static +plugins/c9/profile/dist/bundle.js diff --git a/node_modules/c9/setup_paths.js b/node_modules/c9/setup_paths.js new file mode 100644 index 00000000..20705464 --- /dev/null +++ b/node_modules/c9/setup_paths.js @@ -0,0 +1,20 @@ +/** + * Allow code that lives on the server to resolve paths like + * require("plugins/c9.language/language"), + * just like on the client. + */ +var modules = require("module"); +var oldResolve = modules._resolveFilename; +var extraPaths = [ + __dirname + "/../../" +]; +modules._resolveFilename = function(request, paths) { + // Ensure client extensions can be loaded + request = request.replace(/^lib\//, "node_modules/"); + // Add the extra paths + extraPaths.forEach(function(p) { + if(paths.paths.indexOf(p) === -1) + paths.paths.push(p); + }); + return oldResolve(request, paths); +}; diff --git a/scripts/makestatic.js b/scripts/makestatic.js index d7198542..2ccaabe9 100755 --- a/scripts/makestatic.js +++ b/scripts/makestatic.js @@ -2,6 +2,7 @@ "use strict"; require("amd-loader"); +require("c9/setup_paths.js"); var path = require("path"); var architect = require("architect"); var optimist = require("optimist"); diff --git a/server.js b/server.js index 107c80a5..1e165a26 100755 --- a/server.js +++ b/server.js @@ -11,6 +11,7 @@ var architect = require("architect"); var optimist = require("optimist"); var async = require("async"); var os = require("os"); +require("c9/setup_paths.js"); if (process.version.match(/^v0/) && parseFloat(process.version.substr(3)) < 10) { console.warn("You're using Node.js version " + process.version