Sha256: eca0bd3cdef51e66d94bc13e51e9e24ad5ef30ae3dda55d4883dd337799c71cb
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module Sprockets # Internal: Bundle processor takes a single file asset and prepends all the # `:required` URIs to the contents. # # Uses pipeline metadata: # # :required - Ordered Set of asset URIs to prepend # :stubbed - Set of asset URIs to substract from the required set. # # Also see DirectiveProcessor. class Bundle def self.call(input) env = input[:environment] type = input[:content_type] # TODO: Rebuilding this URI is a bit of a smell processed_uri = AssetURI.build(input[:filename], type: type, skip_bundle: true) cache = Hash.new do |h, uri| h[uri] = env.find_asset_by_uri(uri) end find_required = proc { |uri| cache[uri].metadata[:required] } required = Utils.dfs(processed_uri, &find_required) stubbed = Utils.dfs(cache[processed_uri].metadata[:stubbed], &find_required) required.subtract(stubbed) assets = required.map { |uri| cache[uri] } env.process_bundle_reducers(assets, env.unwrap_bundle_reducers(type)).merge(included: assets.map(&:uri)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sprockets-3.0.0.beta.3 | lib/sprockets/bundle.rb |
sprockets-3.0.0.beta.2 | lib/sprockets/bundle.rb |
sprockets-3.0.0.beta.1 | lib/sprockets/bundle.rb |