module Sprockets::Transformers
def compute_transformers!(registered_transformers)
def compute_transformers!(registered_transformers) preprocessors = self.config[:preprocessors] postprocessors = self.config[:postprocessors] transformers = Hash.new { {} } inverted_transformers = Hash.new { Set.new } incoming_edges = registered_transformers.group_by(&:from) registered_transformers.each do |t| traversals = dfs_paths([t]) { |k| incoming_edges.fetch(k.to, []) } traversals.each do |nodes| src, dst = nodes.first.from, nodes.last.to processor = compose_transformer_list nodes, preprocessors, postprocessors transformers[src] = {} unless transformers.key?(src) transformers[src][dst] = processor inverted_transformers[dst] = Set.new unless inverted_transformers.key?(dst) inverted_transformers[dst] << src end end self.config = hash_reassoc(config, :transformers) { transformers } self.config = hash_reassoc(config, :inverted_transformers) { inverted_transformers } end