<commit_before>var Lien = require("lien")
  , Tinyreq = require("tinyreq")
  , Ul = require("ul")
  ;

function Wrabbit() {
}

Wrabbit.prototype.req = function (url, callback) {
    if (!url) { return callback("Missing the file to wrap", 400); }
    return Tinyreq(url, function (err, content, res) {
        if (err) { return callback(err, 500); }
        if (res.statusCode === 404) { return callback("The provided url ends with 404.", 404); }
        if (res.statusCode !== 200) { return callback("Cannot access the provided file.", 400); }
        callback(null, content);
    });
};

Wrabbit.prototype.wrap = function (content, wrapline) {
    return wrapline + "\n" + content + "\n});";
};

Wrabbit.prototype.wrapUrl = function (url, wrapline, callback) {
    var self = this;
    self.req(url, function (err, content) {
        if (err) { return callback(err, content); }
        callback(null, self.wrap(content, wrapline));
    });
};

Wrabbit.prototype.server = function (options, callback) {

    var self = this;

    if (typeof options === "number") {
        options = {
            port: options
          , host: null
        };
    }

    options = Ul.merge(options, {
        host: "localhost"
      , root: __dirname + "/public"
    });

    var server = new Lien(options);

    server.page.add("/api", function (lien) {
        self.wrapUrl(lien.search.url, "http://" + lien.req.headers["host"] + lien.req.url, function (err, res) {
            if (err) { return lien.end(err, res); }
            lien.end(res, 200, "js");
        });
    });

    server.page.add("/", "html/index.html");
    server.on("load", callback);
};

module.exports = new Wrabbit();<commit_msg>Wrap the full url and return the module<commit_after>var Lien = require("lien")
  , Tinyreq = require("tinyreq")
  , Ul = require("ul")
  ;

function Wrabbit() {
}

Wrabbit.prototype.req = function (url, callback) {
    if (!url) { return callback("Missing the file to wrap", 400); }
    return Tinyreq(url, function (err, content, res) {
        if (err) { return callback(err, 500); }
        if (res.statusCode === 404) { return callback("The provided url ends with 404.", 404); }
        if (res.statusCode !== 200) { return callback("Cannot access the provided file.", 400); }
        callback(null, content);
    });
};

Wrabbit.prototype.wrap = function (content, wrapline) {
    return wrapline + "\n" + content + "\nreturn module;});";
};

Wrabbit.prototype.wrapUrl = function (url, wrapline, callback) {
    var self = this;
    self.req(url, function (err, content) {
        if (err) { return callback(err, content); }
        callback(null, self.wrap(content, wrapline));
    });
};

Wrabbit.prototype.server = function (options, callback) {

    var self = this;

    if (typeof options === "number") {
        options = {
            port: options
          , host: null
        };
    }

    options = Ul.merge(options, {
        host: "localhost"
      , root: __dirname + "/public"
    });

    var server = new Lien(options);

    server.page.add("/api", function (lien) {
        self.wrapUrl(lien.search.url, "E('http://" + lien.req.headers["host"] + lien.req.url + "', function (require, module, exports, global, engine) {", function (err, res) {
            if (err) { return lien.end(err, res); }
            lien.end(res, 200, "js");
        });
    });

    server.page.add("/", "html/index.html");
    server.on("load", callback);
};

module.exports = new Wrabbit();
{'fraction_non_alphanumeric': 0.1697300402067777, 'fraction_numerical': 0.013785180930499713, 'mean_word_length': 2.6818181818181817, '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': '2583376', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1078, 'n_words': 287}