Module: Jass::React::JSX::Processor

Defined in:
lib/jass/react/jsx/processor.rb

Constant Summary collapse

VERSION =
'1'

Class Method Summary collapse

Class Method Details

.cache_keyObject



6
7
8
# File 'lib/jass/react/jsx/processor.rb', line 6

def cache_key
  @cache_key ||= [name, VERSION].freeze
end

.call(input) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/jass/react/jsx/processor.rb', line 10

def call(input)
  data = input[:data]

  js, map = input[:cache].fetch(cache_key + [input[:filename]] + [data]) do
    result = Jass::React::JSX::Compiler.compile(data, input[:filename])
    result.values_at('code', 'map')
  end

  #map = Sprockets::SourceMapUtils.format_source_map(map, input)
  #map = Sprockets::SourceMapUtils.combine_source_maps(input[:metadata][:map], map)

  { data: js } #, map: map }
end