<commit_before>
/**
 * Module dependencies.
 */

var Visitor = require('./')
  , Parser = require('../parser')
  , nodes = require('../nodes')
  , utils = require('../utils')
  , dirname = require('path').dirname
  , fs = require('fs');

var DepsResolver = module.exports = function DepsResolver(root, options) {
  this.root = root;
  this.filename = options.filename;
  this.paths = options.paths || [];
  this.paths.push(dirname(options.filename || '.'));
  this.functions = {};
  this.deps = [];
};

DepsResolver.prototype.__proto__ = Visitor.prototype;

DepsResolver.prototype.visitRoot = function(block) {
  for (var i = 0, len = block.nodes.length; i < len; ++i) {
    this.visit(block.nodes[i]);
  }
};

DepsResolver.prototype.visitGroup = function(node) {
  this.visit(node.block);
};

DepsResolver.prototype.visitIdent = function(ident) {
  this.visit(ident.val);
};

DepsResolver.prototype.visitIf = function(node) {
  this.visit(node.block);
  this.visit(node.cond);
  for (var i = 0, len = node.elses.length; i < len; ++i) {
    this.visit(node.elses[i]);
  }
};

DepsResolver.prototype.visitFunction = function(fn) {
  this.functions[fn.name] = fn.block;
};

DepsResolver.prototype.visitCall = function(call) {
  if (call.name in this.functions) this.visit(this.functions[call.name]);
  if (call.block) this.visit(call.block);
};

DepsResolver.prototype.visitBlock = DepsResolver.prototype.visitRoot;

DepsResolver.prototype.visitExpression = DepsResolver.prototype.visitRoot;

DepsResolver.prototype.visitMedia = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitEach = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitAtblock = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitImport = function(node) {
  var path = node.path.first.val
    , literal, found, oldPath;

  if (!path) return;

  literal = /\.css(?:"|$)/.test(path);

  // support optional .styl
  if (!literal && !/\.styl$/i.test(path)) {
    oldPath = path;
    path += '.styl';
  }

  // Lookup
  found = utils.find(path, this.paths, this.filename);

  // support optional index<commit_msg>Visit keyframes and at-rules in the deps resolver<commit_after>
/**
 * Module dependencies.
 */

var Visitor = require('./')
  , Parser = require('../parser')
  , nodes = require('../nodes')
  , utils = require('../utils')
  , dirname = require('path').dirname
  , fs = require('fs');

var DepsResolver = module.exports = function DepsResolver(root, options) {
  this.root = root;
  this.filename = options.filename;
  this.paths = options.paths || [];
  this.paths.push(dirname(options.filename || '.'));
  this.functions = {};
  this.deps = [];
};

DepsResolver.prototype.__proto__ = Visitor.prototype;

DepsResolver.prototype.visitRoot = function(block) {
  for (var i = 0, len = block.nodes.length; i < len; ++i) {
    this.visit(block.nodes[i]);
  }
};

DepsResolver.prototype.visitGroup = function(node) {
  this.visit(node.block);
};

DepsResolver.prototype.visitIdent = function(ident) {
  this.visit(ident.val);
};

DepsResolver.prototype.visitIf = function(node) {
  this.visit(node.block);
  this.visit(node.cond);
  for (var i = 0, len = node.elses.length; i < len; ++i) {
    this.visit(node.elses[i]);
  }
};

DepsResolver.prototype.visitFunction = function(fn) {
  this.functions[fn.name] = fn.block;
};

DepsResolver.prototype.visitCall = function(call) {
  if (call.name in this.functions) this.visit(this.functions[call.name]);
  if (call.block) this.visit(call.block);
};

DepsResolver.prototype.visitBlock = DepsResolver.prototype.visitRoot;

DepsResolver.prototype.visitExpression = DepsResolver.prototype.visitRoot;

DepsResolver.prototype.visitMedia = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitAtrule = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitKeyframes = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitEach = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitAtblock = DepsResolver.prototype.visitGroup;

DepsResolver.prototype.visitImport = function(node) {
  var path = node.path.first.val
    , literal, found, oldPath;

  if (!path) return;

  literal = /\.css(?:"|$)/.test(path);

  // support optional .styl
  if (!literal && !/\.styl$/i.test(path)) {
    oldPath = path;
    path += '.styl';
  }

  // Lookup
  found = utils.find(path, this.paths, this.filename);

  // support optional index
{'fraction_non_alphanumeric': 0.16202130070246998, 'fraction_numerical': 0.0009064128710627691, 'mean_word_length': 4.150525087514586, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1435982', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1456, 'n_words': 250}