kopia lustrzana https://github.com/c9/core
Merge pull request +8012 from c9/profile-require
Allow portable paths in profile require()pull/117/merge
commit
2025a19647
|
@ -6,4 +6,5 @@ build/webkitbuilds/
|
|||
build/win32*
|
||||
build/Cloud9
|
||||
build/sdk
|
||||
node_modules/logicblox/build/logicblox/static
|
||||
node_modules/logicblox/build/logicblox/static
|
||||
plugins/c9/profile/dist/bundle.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);
|
||||
};
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue