From ef8dda05532eb475dcdd1c90e9df0ee5d726bed7 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 12 May 2015 20:55:10 +0100 Subject: [PATCH] require is not defined... why not --- src/node/hooks/i18n.js | 23 +++++++++++++++++++---- src/static/js/pluginfw/read-installed.js | 19 +++++++++++++++++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/node/hooks/i18n.js b/src/node/hooks/i18n.js index 1d28b5447..f14de6340 100644 --- a/src/node/hooks/i18n.js +++ b/src/node/hooks/i18n.js @@ -1,13 +1,27 @@ +define( + [ + 'languages4translatewiki', + 'fs', + 'path', + 'underscore', + 'npm', + 'ep_etherpad-lite/static/js/pluginfw/plugins', + 'semver' + ], + function(languages, fs, path, _, npm, plugins, semver){ + +var exports = {}; + var languages = require('languages4translatewiki') , fs = require('fs') , path = require('path') , _ = require('underscore') , npm = require('npm') - , plugins = require('ep_etherpad-lite/static/js/pluginfw/plugins.js').plugins - , semver = require('semver') - , existsSync = semver.gt(process.version, '0.7.0') ? fs.existsSync : path.existsSync -; + , plugins = require('ep_etherpad-lite/static/js/pluginfw/plugins.js') + , semver = require('semver'); +var existsSync = semver.gt(process.version, '0.7.0') ? fs.existsSync : path.existsSync +plugins = plugins.plugins; // returns all existing messages merged together and grouped by langcode // {es: {"foo": "string"}, en:...} @@ -102,3 +116,4 @@ exports.expressCreateServer = function(n, args) { } +}); diff --git a/src/static/js/pluginfw/read-installed.js b/src/static/js/pluginfw/read-installed.js index 800ee32cd..2284cfc13 100644 --- a/src/static/js/pluginfw/read-installed.js +++ b/src/static/js/pluginfw/read-installed.js @@ -88,13 +88,26 @@ as far as the left-most node_modules folder. */ +define( + [ + 'npm', + 'graceful-fs', + 'path', + 'asyncMap', + 'semver', + 'log' + ], + function (npm, fs, path, asyncMap, semver, log) { var npm = require("npm/lib/npm.js") , fs = require("graceful-fs") , path = require("path") - , asyncMap = require("slide").asyncMap + , asyncMap = require("slide") , semver = require("semver") - , log = require("log4js").getLogger('pluginfw') + , log = require("log4js"); + +asyncMap = asyncMap.asyncMap; +log = log.getLogger('pluginfw'); function readJson(file, callback) { fs.readFile(file, function(er, buf) { @@ -335,3 +348,5 @@ if (module === require.main) { return map } } + +});