module Sprockets::Resolve

def resolve_index_under_path(load_path, logical_name, mime_exts)

Returns Array. First element is an Array of hashes or empty, second is a String

that are named `index` and have a matching mime type in `mime_exts`.
Looking in the given `load_path` this method will find all files under the `logical_name` directory

e.g. {".xml.builder"=>"application/xml+builder"}
mime_exts - Hash of file extensions and their mime types
e.g. "application" or "coffee/foo"
logical_name - String. A filename without extension
load_path - String. An absolute path to a directory

Internal: Finds candidate index files in a given path
def resolve_index_under_path(load_path, logical_name, mime_exts)
  dirname = File.join(load_path, logical_name)
  if self.directory?(dirname)
    candidates = self.find_matching_path_for_extensions(dirname, "index".freeze, mime_exts)
  else
    candidates = []
  end
  candidates.map! do |c|
    { filename: c[0],
      type: c[1],
      index_alias: compress_from_root(c[0].sub(/\/index(\.[^\/]+)$/, '\1')) }
  end
  return candidates, [ URIUtils.build_file_digest_uri(dirname) ]
end