class Sprockets::Bundle

def self.call(input)

def self.call(input)
  env  = input[:environment]
  type = input[:content_type]
  dependencies = Set.new(input[:metadata][:dependencies])
  processed_uri, deps = env.resolve(input[:filename], accept: type, pipeline: :self, compat: false)
  dependencies.merge(deps)
  find_required = proc { |uri| env.load(uri).metadata[:required] }
  required = Utils.dfs(processed_uri, &find_required)
  stubbed  = Utils.dfs(env.load(processed_uri).metadata[:stubbed], &find_required)
  required.subtract(stubbed)
  assets = required.map { |uri| env.load(uri) }
  (required + stubbed).each do |uri|
    dependencies.merge(env.load(uri).metadata[:dependencies])
  end
  reducers = Hash[env.match_mime_type_keys(env.config[:bundle_reducers], type).flat_map(&:to_a)]
  process_bundle_reducers(assets, reducers).merge(dependencies: dependencies, included: assets.map(&:uri))
end