Sha256: 76e10367300862e8ef23fa19580e5e009facafba5bdc7158d9af6653f41cc1e5
Contents?: true
Size: 957 Bytes
Versions: 2
Compression:
Stored size: 957 Bytes
Contents
# frozen_string_literal: true require 'sprockets/autoload' require 'sprockets/source_map_utils' module Sprockets # Processor engine class for the CoffeeScript compiler. # Depends on the `coffee-script` and `coffee-script-source` gems. # # For more infomation see: # # https://github.com/rails/ruby-coffee-script # module CoffeeScriptProcessor VERSION = '2' def self.cache_key @cache_key ||= "#{name}:#{Autoload::CoffeeScript::Source.version}:#{VERSION}".freeze end def self.call(input) data = input[:data] js, map = input[:cache].fetch([self.cache_key, data]) do result = Autoload::CoffeeScript.compile(data, sourceMap: true, sourceFiles: [input[:source_path]]) [result['js'], SourceMapUtils.decode_json_source_map(result['v3SourceMap'])['mappings']] end map = SourceMapUtils.combine_source_maps(input[:metadata][:map], map) { data: js, map: map } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sprockets-4.0.0.beta4 | lib/sprockets/coffee_script_processor.rb |
sprockets-4.0.0.beta3 | lib/sprockets/coffee_script_processor.rb |