diff --git a/lib/sprockets/babel_processor.rb b/lib/sprockets/babel_processor.rb index c0c140831..e3bebc959 100644 --- a/lib/sprockets/babel_processor.rb +++ b/lib/sprockets/babel_processor.rb @@ -16,6 +16,12 @@ def self.call(input) instance.call(input) end + def self.cache_key + instance.cache_key + end + + attr_reader :cache_key + def initialize(options = {}) @options = options.merge({ 'blacklist' => (options['blacklist'] || []) + ['useStrict'], diff --git a/test/test_babel_processor.rb b/test/test_babel_processor.rb index 7277e35ec..4d8f72442 100644 --- a/test/test_babel_processor.rb +++ b/test/test_babel_processor.rb @@ -168,4 +168,15 @@ def test_caching_takes_filename_into_account }); JS end + + def test_cache_key + assert Sprockets::BabelProcessor.cache_key + + amd_processor_1 = Sprockets::BabelProcessor.new('modules' => 'amd') + amd_processor_2 = Sprockets::BabelProcessor.new('modules' => 'amd') + assert_equal amd_processor_1.cache_key, amd_processor_2.cache_key + + system_processor = Sprockets::BabelProcessor.new('modules' => 'system') + refute_equal amd_processor_1.cache_key, system_processor.cache_key + end end