Sha256: edb88977558764bb2006999d5eeeb3be49eba6fb916399b531fcb5d1c404b8c6

Contents?: true

Size: 835 Bytes

Versions: 2

Compression:

Stored size: 835 Bytes

Contents

module Jass
  class BundleProcessor
    
    class << self
      def instance
        @instance ||= new
      end
      
      def call(input)
        instance.call(input)
      end
    end
    
    def call(input)
      env, filename = input.fetch(:environment), input.fetch(:filename)
      dependencies = Set.new(input.fetch(:metadata).fetch(:dependencies))
      globals = input.fetch(:metadata).fetch(:globals, {})
      bundle_root = Pathname.new(filename).dirname
      bundle = Jass.compiler.bundle(filename, Jass.input_options, globals: globals)
      dependencies += bundle.fetch('map').fetch('sources').map { |dep| Sprockets::URIUtils.build_file_digest_uri(bundle_root.join(dep).to_s) }
      
      { data: bundle.fetch('code'),
        dependencies: dependencies,
        map: bundle.fetch('map') }
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jass-0.9.5 lib/jass/bundle_processor.rb
jass-0.9.4 lib/jass/bundle_processor.rb