create require aliases for plugins

This commit is contained in:
nightwing 2015-04-04 01:24:01 +04:00 committed by nightwing
parent b5b6255302
commit bb5cfce7e9
3 changed files with 8 additions and 4 deletions

View File

@ -154,21 +154,25 @@ define(function(require, exports, module) {
});
}
var pathConfig = {};
pathConfig["plugins/" + name] = host + join(base, name);
// Add the plugin to the config
Object.keys(options.plugins).forEach(function(path){
var pluginPath = name + "/" + path + ".js";
// Watch project path
watch("~/.c9/plugins/" + pluginPath);
var cfg = options.plugins[path];
cfg.packagePath = host + join(base, pluginPath.replace(/^plugins\//, ""));
cfg.packagePath = "plugins/" + name + "/" + path;
cfg.staticPrefix = host + join(base, name);
cfg.apikey = "0000000000000000000000000000=";
config.push(cfg);
});
requirejs.config({paths: pathConfig});
next();
});
},

View File

@ -68,7 +68,7 @@ define(function(require, exports, module) {
var path = options.packagePath + ".js";
var host = vfs.baseUrl + "/";
var base = join(String(c9.projectId), "plugins", auth.accessToken);
options.packagePath = host + join(base, path.replace(/^plugins\//, ""));
options.staticPrefix = host + join(base, name);

View File

@ -115,7 +115,7 @@ function plugin(options, imports, register) {
token: req.params.token
});
opts.options.debug = req.params.debug;
opts.options.debug = req.params.debug == 1;
res.setHeader("Cache-Control", "no-cache, no-store");
res.render(__dirname + "/views/standalone.html.ejs", {
architectConfig: getConfig(configType, opts),