<commit_before>var rework = require('rework')
  , npm = require('rework-npm')
  , vars = require('rework-vars')
  , assets = require('rework-assets')
  , path = require('path')
  , fs = require('fs')
  , events = require('events')
  , resolve = require('resolve')
  , pkg = require('package-lookup')
  , read = function (f) {
    return fs.readFileSync(f, 'utf8')
  };

var ctor = module.exports = function (opts, cb) {
  opts = opts || {};

  var src
  try {
    src = bundle(opts)
  } catch (err) {
    return process.nextTick(function () { cb(err) })
  }

  process.nextTick(function () { cb(null, src) })
}

ctor.emitter = new events.EventEmitter()

function bundle (opts) {
    var entries = [];
    
    opts.entries.forEach(function (entry) {
        var resolvedEntry = resolveFilePath(entry);

        entries.push(applyRework(opts, resolvedEntry));
    });

    return entries.join(opts.compress ? '' : '\n');
}

function applyRework (opts, resolvedEntry) {
    var css = rework(read(resolvedEntry), {source: resolvedEntry}),
        dirName = path.dirname(resolvedEntry);

    css.use(npm({
        root: dirName,
        prefilter: prefilter
    }));

    parseCSSVariables(css, opts);
    handleAssets (css, opts, dirName);
    applyReworkPlugins(css, dirName);

    return css.toString({<commit_msg>fixing some tests<commit_after>var rework = require('rework')
  , npm = require('rework-npm')
  , vars = require('rework-vars')
  , assets = require('rework-assets')
  , path = require('path')
  , fs = require('fs')
  , events = require('events')
  , resolve = require('resolve')
  , pkg = require('package-lookup')
  , read = function (f) {
    return fs.readFileSync(f, 'utf8')
  };

var ctor = module.exports = function (opts, cb) {
  opts = opts || {};

  var src
  try {
    src = bundle(opts)
  } catch (err) {
    return process.nextTick(function () { cb(err) })
  }

  process.nextTick(function () { cb(null, src) })
}

ctor.emitter = new events.EventEmitter()

function bundle (opts) {
    var entries = [];
    
    opts.entries.forEach(function (entry) {
        var resolvedEntry = resolveFilePath(entry);

        entries.push(applyRework(opts, resolvedEntry));
    });

    return entries.join(opts.compress ? '' : '\n');
}

function applyRework (opts, resolvedEntry) {
    var css = rework(read(resolvedEntry), {source: resolvedEntry}),
        dirName = path.dirname(resolvedEntry);

    css.use(npm({
        root: dirName,
        prefilter: prefilter
    }));

    parseCSSVariables(css, opts);
    handleAssets (css, opts, dirName);
    applyReworkPlugins(css, opts, dirName);

    return css.toString({
{'fraction_non_alphanumeric': 0.15667678300455234, 'fraction_numerical': 0.0007587253414264037, 'mean_word_length': 3.280844155844156, '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': '3147863', 'n_tokens_mistral': 864, 'n_tokens_neox': 839, 'n_words': 182}