class Sprockets::BundledAsset

def build_dependencies_paths_and_assets

def build_dependencies_paths_and_assets
  check_circular_dependency!
  paths, assets = {}, []
  # Define an `add_dependency` helper
  add_dependency = lambda do |asset|
    unless assets.any? { |a| a.pathname == asset.pathname }
      assets << asset
    end
  end
  # Iterate over all the declared require paths from the `Context`
  dependency_context._required_paths.each do |required_path|
    # Catch `require_self`
    if required_path == pathname.to_s
      add_dependency.call(self)
    else
      # Recursively lookup required asset
      environment[required_path, @options].to_a.each do |asset|
        add_dependency.call(asset)
      end
    end
  end
  # Ensure self is added to the dependency list
  add_dependency.call(self)
  dependency_context._dependency_paths.each do |path|
    paths[path] ||= {
      'path'      => path,
      'mtime'     => environment.stat(path).mtime,
      'hexdigest' => environment.file_digest(path).hexdigest
    }
  end
  dependency_context._dependency_assets.each do |path|
    # Skip if depending on self
    next if path == pathname.to_s
    # Recursively lookup required asset
    environment[path, @options].to_a.each do |asset|
      asset.dependency_paths.each do |dep|
        paths[dep['path']] ||= dep
      end
    end
  end
  @dependency_paths, @assets = paths.values, assets
  return @dependency_paths, @assets
end