Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Avoid mutating 6to5 options hash
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Dec 9, 2014
1 parent 8032ac3 commit 6e08a26
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/sprockets/es6to5_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ def self.call(input)
end

def initialize(options = {})
@options = {blacklist: []}.merge(options)
@options[:blacklist] << 'useStrict'
@options[:sourceMap] = true
@options = options.merge({
'blacklist' => (options['blacklist'] || []) + ['useStrict'],

This comment has been minimized.

Copy link
@sebmck

sebmck Dec 9, 2014

Why are you blacklisting useStrict? ES6 scripts are explicitly strict.

This comment has been minimized.

Copy link
@josh

josh Dec 9, 2014

Author Contributor

Adding "use strict" to the top level of a script without an additional closure isn't concatenation friendly.

This comment has been minimized.

Copy link
@sebmck

sebmck Dec 9, 2014

Ah, understood.

This comment has been minimized.

Copy link
@josh

josh Dec 9, 2014

Author Contributor

I guess sprockets should be responsible for wrapping functions in that case, but its not supported right now so I just omitted it.

I'll probably revisit it once all the source map stuff is in place.

'sourceMap' => true
}).freeze

@cache_key = [
self.class.name,
SOURCE_VERSION,
VERSION,
@options
]
].freeze
end

def call(input)
Expand Down

0 comments on commit 6e08a26

Please sign in to comment.