require is not defined... why not

express-require
John McLear 2015-05-12 20:55:10 +01:00
parent e5abd185b5
commit ef8dda0553
2 changed files with 36 additions and 6 deletions

View File

@ -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) {
}
});

View File

@ -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
}
}
});