diff options
author | Egil Moeller <egil.moller@freecode.no> | 2012-03-19 17:16:49 +0100 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2012-03-19 17:16:49 +0100 |
commit | c591efb352030d2e348b2fa63fba78e722c75a62 (patch) | |
tree | 6f1dff2b72df9e941bc56ab4b50dce6ea160b876 /src/static/js/pluginfw/plugins.js | |
parent | 6fe7f2c2b201428f645f5af36a0f75801025ce8d (diff) | |
download | etherpad-lite-c591efb352030d2e348b2fa63fba78e722c75a62.zip |
Plugin list can now be reloaded 'live'
Diffstat (limited to 'src/static/js/pluginfw/plugins.js')
-rw-r--r-- | src/static/js/pluginfw/plugins.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/static/js/pluginfw/plugins.js b/src/static/js/pluginfw/plugins.js index c5c21903..5017962b 100644 --- a/src/static/js/pluginfw/plugins.js +++ b/src/static/js/pluginfw/plugins.js @@ -2,7 +2,7 @@ exports.isClient = typeof global != "object"; if (!exports.isClient) { var npm = require("npm/lib/npm.js"); - var readInstalled = require("npm/lib/utils/read-installed.js"); + var readInstalled = require("./read-installed.js"); var relativize = require("npm/lib/utils/relativize.js"); var readJson = require("npm/lib/utils/read-json.js"); var path = require("path"); @@ -10,6 +10,7 @@ if (!exports.isClient) { var fs = require("fs"); var tsort = require("./tsort"); var util = require("util"); + var extend = require("node.extend"); } exports.prefix = 'ep_'; @@ -112,14 +113,19 @@ exports.getPackages = function (cb) { function flatten(deps) { Object.keys(deps).forEach(function (name) { if (name.indexOf(exports.prefix) == 0) { - packages[name] = deps[name]; + packages[name] = extend({}, deps[name]); + // Delete anything that creates loops so that the plugin + // list can be sent as JSON to the web client + delete packages[name].dependencies; + delete packages[name].parent; } if (deps[name].dependencies !== undefined) flatten(deps[name].dependencies); - delete deps[name].dependencies; }); } - flatten([data]); + var tmp = {}; + tmp[data.name] = data; + flatten(tmp); cb(null, packages); }); } |