<commit_before>/*global module:false*/
module.exports = function(grunt) {
  var path = require('path');
  var net = require('net');
  var HOST = '127.0.0.1';
  var PORT = 65384;
  var excludes = ['.js', '.ico', '.css'];
  var client = new net.Socket();
  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    connect: {
      options: {
        port: 8000,
        hostname: '*',
        livereload: 35728,
        middleware: function(connect, options, middlewares) {
          // inject a custom middleware into the array of default middlewares 
          middlewares.unshift(function(req, res, next) {
            var ext = path.extname(req.url);
            if (excludes.indexOf(ext) >= 0) {
              return next();
            }

            client.connect(PORT, HOST, function() {
              client.write(req.url);
            });
            client.on('data', function(data) {
              res.end(data);
              client.destroy();
            });
            client.on('close', function() {
              client.destroy();
            });
          });
 
          return middlewares;
        },
      },
      server: {
        options: {
          open: true,
          base: ['static']
        }
      }
    },
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['lib/<%= pkg.name %>.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',<commit_msg>update client to support long connection<commit_after>var path = require('path');
var net = require('net');

/*global module:false*/
module.exports = function(grunt) {
  var Freenoker = {
    port: 65384,
    excludes: ['.ico', '.js', '.css']
  };

  var client = new net.Socket();

  client.connect(Freenoker.port, function() {
    grunt.log.writeln('Connected to freenoker server at port ' + Freenoker.port);
  });
  client.on('data', function(data) {
    Freenoker.res.end(data);
    grunt.log.writeln(new Date().getTime())
  });

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    connect: {
      options: {
        port: 8000,
        hostname: '*',
        livereload: 35728,
        middleware: function(connect, options, middlewares) {
          // inject a custom middleware into the array of default middlewares 
          middlewares.unshift(function(req, res, next) {
            grunt.log.writeln(new Date().getTime())
            var ext = path.extname(req.url);
            if (Freenoker.excludes.indexOf(ext) >= 0) {
              return next();
            } else {
              Freenoker.req = req;
              Freenoker.res = res;

              client.write(req.url);
            }
          });
 
          return middlewares;
        },
      },
      server: {
        options: {
          open: true,
          base: ['static']
        }
      }
    },
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['lib/<%= pkg.name %>.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',
{'fraction_non_alphanumeric': 0.184688995215311, 'fraction_numerical': 0.00861244019138756, 'mean_word_length': 1.761558784676354, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '7616514', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1312, 'n_words': 261}