class Jass::BundleProcessor

Public Class Methods

call(input) click to toggle source
# File lib/jass/bundle_processor.rb, line 9
def call(input)
  instance.call(input)
end
instance() click to toggle source
# File lib/jass/bundle_processor.rb, line 5
def instance
  @instance ||= new
end

Public Instance Methods

call(input) click to toggle source
# File lib/jass/bundle_processor.rb, line 14
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