This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/node_modules/dust/lib/server.js

21 lines
539 B
JavaScript

var path = require('path'),
parser = require('./parser'),
compiler = require('./compiler'),
Script = process.binding('evals').Script;
require.paths.unshift(path.join(__dirname, '..'));
module.exports = function(dust) {
compiler.parse = parser.parse;
dust.compile = compiler.compile;
dust.loadSource = function(source, path) {
return Script.runInNewContext(source, {dust: dust}, path);
};
dust.nextTick = process.nextTick;
// expose optimizers in commonjs env too
dust.optimizers = compiler.optimizers;
}