|
|
@ -87,36 +87,27 @@ module.exports = function (Meta) {
|
|
|
|
|
|
|
|
|
|
|
|
Meta.js.bridgeModules = function (app, callback) {
|
|
|
|
Meta.js.bridgeModules = function (app, callback) {
|
|
|
|
// Add routes for AMD-type modules to serve those files
|
|
|
|
// Add routes for AMD-type modules to serve those files
|
|
|
|
var numBridged = 0,
|
|
|
|
function addRoute(relPath) {
|
|
|
|
addRoute = function (relPath) {
|
|
|
|
var relativePath = nconf.get('relative_path');
|
|
|
|
var relativePath = nconf.get('relative_path');
|
|
|
|
|
|
|
|
|
|
|
|
app.get(relativePath + '/src/modules/' + relPath, function (req, res) {
|
|
|
|
app.get(relativePath + '/src/modules/' + relPath, function (req, res) {
|
|
|
|
return res.sendFile(path.join(__dirname, '../../', Meta.js.scripts.modules[relPath]), {
|
|
|
|
return res.sendFile(path.join(__dirname, '../../', Meta.js.scripts.modules[relPath]), {
|
|
|
|
maxAge: app.enabled('cache') ? 5184000000 : 0
|
|
|
|
maxAge: app.enabled('cache') ? 5184000000 : 0
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async.series([
|
|
|
|
var numBridged = 0;
|
|
|
|
function (next) {
|
|
|
|
|
|
|
|
for(var relPath in Meta.js.scripts.modules) {
|
|
|
|
|
|
|
|
if (Meta.js.scripts.modules.hasOwnProperty(relPath)) {
|
|
|
|
|
|
|
|
addRoute(relPath);
|
|
|
|
|
|
|
|
++numBridged;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
for(var relPath in Meta.js.scripts.modules) {
|
|
|
|
}
|
|
|
|
if (Meta.js.scripts.modules.hasOwnProperty(relPath)) {
|
|
|
|
], function (err) {
|
|
|
|
addRoute(relPath);
|
|
|
|
if (err) {
|
|
|
|
++numBridged;
|
|
|
|
winston.error('[meta/js] Encountered error while bridging modules:' + err.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
winston.verbose('[meta/js] ' + numBridged + ' of ' + Object.keys(Meta.js.scripts.modules).length + ' modules bridged');
|
|
|
|
winston.verbose('[meta/js] ' + numBridged + ' of ' + Object.keys(Meta.js.scripts.modules).length + ' modules bridged');
|
|
|
|
callback(err);
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Meta.js.minify = function (target, callback) {
|
|
|
|
Meta.js.minify = function (target, callback) {
|
|
|
|