<commit_before>'use strict';

var stylus          = require('stylus'),
    gutil           = require('gulp-util'),
    PluginError     = gutil.PluginError,
    log             = gutil.log,
    Transform       = require('stream').Transform,
    defaults        = require('lodash.defaults'),

    PLUGIN_NAME     = 'gulp-stylus';

function formatException(e) {
  return e.name+' in plugin \''+gutil.colors.cyan(PLUGIN_NAME)+'\''+': '+e.message
}

function gulpstylus(options) {
  var stream = new Transform({ objectMode: true }),
      opts = defaults({}, options ,{
        compress: false,
        silent: false
      });

  stream._transform = function(file, unused, done) {

    if (file.isNull()) {
      stream.push(file);
      return done();
    }

    if (file.isStream()) {
      return done(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
    }

    var s = stylus(file.contents.toString('utf8'))
              .set('filename', file.path)
              .set('compress', opts.compress);

    try {
      var css = s.render();
      file.path = gutil.replaceExtension(file.path, '.css');
      file.contents = new Buffer(css);
      stream.push(file);
      done();

    } catch (e) {
      if (opts.silent) {
        log(formatException(e));
        file.path = gutil.replaceExtension(file.path, '.css');
        file.contents = new Buffer('');
        stream.push(file);
        return done();
      }

      done(new PluginError(PLUGIN_NAME, e));
    }

  };
<commit_msg>Stylus sets are set through plugin options now<commit_after>'use strict';

var stylus          = require('stylus'),
    gutil           = require('gulp-util'),
    PluginError     = gutil.PluginError,
    log             = gutil.log,
    Transform       = require('stream').Transform,
    defaults        = require('lodash.defaults'),

    PLUGIN_NAME     = 'gulp-stylus';

function formatException(e) {
  return e.name+' in plugin \''+gutil.colors.cyan(PLUGIN_NAME)+'\''+': '+e.message
}

function gulpstylus(options) {
  var stream = new Transform({ objectMode: true }),
      opts = defaults({}, options ,{
        compress: false,
        silent: false
      });

  stream._transform = function(file, unused, done) {

    if (file.isNull()) {
      stream.push(file);
      return done();
    }

    if (file.isStream()) {
      return done(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
    }

    var s = stylus(file.contents.toString('utf8')).set('filename', file.path);

    if (opts.set) {
      var key, _ref = opts.set;
      for (key in _ref) {
        s.set(key, _ref[key]);
      }
    }

    try {
      var css = s.render();
      file.path = gutil.replaceExtension(file.path, '.css');
      file.contents = new Buffer(css);
      stream.push(file);
      done();

    } catch (e) {
      if (opts.silent) {
        log(formatException(e));
        file.path = gutil.replaceExtension(file.path, '.css');
        file.contents = new Buffer('');
        stream.push(file);
        return done();
      }

      done(new PluginError(PLUGIN_NAME, e));
    }

  };

{'fraction_non_alphanumeric': 0.15367121507472384, 'fraction_numerical': 0.000649772579597141, 'mean_word_length': 2.2895299145299144, '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': '4748191', 'n_tokens_mistral': 997, 'n_tokens_neox': 966, 'n_words': 202}