<commit_before>var http = require('http'),
    fs = require('fs'),
    path = require('path'),
    argv = require('minimist')(process.argv.slice(2)),
    ASYNC_REQUIRE_PATH = './assets/async_require.js',
    config = require('./config.js'),
    compile = require('./compile.js');

config.configPath = argv.config;
config.assetPath = argv.path;

if (!config.assetPath) throw new Error('path must be present');

http.createServer(function (req, res) {
    console.log('requested --- ' + req.url);
    var filePath = '.' + req.url,
        promise = compile.compile(filePath);
    promise.then(function (src) {
        res.writeHead(200, {'Content-Type': 'application/javascript'});
        res.end(src);
    }).fail(function (err) {
        res.writeHead(404, {'Content-Type': 'application/javascript'});
        res.end();
    });
}).listen(6969);

console.log('Server is listening on 6969');<commit_msg>add lib.js route<commit_after>var http = require('http'),
    fs = require('fs'),
    path = require('path'),
    argv = require('minimist')(process.argv.slice(2)),
    ASYNC_REQUIRE_PATH = './assets/async_require.js',
    config = require('./config.js'),
    compile = require('./compile.js');

config.configPath = argv.config;
config.assetPath = argv.path;

if (!config.assetPath) throw new Error('path must be present');

http.createServer(function (req, res) {
    console.log('requested --- ' + req.url);
    // TODO: move lib.js to directives
    // e.g.
    //      //= require_lib
    if (req.url === '/lib.js') {
        fs.readFile('./src/assets/async_require.js', function (err, data) {
            res.writeHead(200, {'Content-Type': 'application/javascript'});
            console.log(data);
            res.end(data);
        });
    } else {
        var filePath = '.' + req.url,
            promise = compile.compile(filePath);
        promise.then(function (src) {
            res.writeHead(200, {'Content-Type': 'application/javascript'});
            res.end(src);
        }).fail(function (err) {
            res.writeHead(404, {'Content-Type': 'application/javascript'});
            res.end();
        });
    }
}).listen(6969);

console.log('Server is listening on 6969');
{'fraction_non_alphanumeric': 0.18334849863512284, 'fraction_numerical': 0.015013648771610554, 'mean_word_length': 2.8110918544194106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2074416', 'n_tokens_mistral': 696, 'n_tokens_neox': 682, 'n_words': 131}