sprockets-es6 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sprockets/es6.rb +21 -4
- data/lib/sprockets/es6/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c67e316bee6ff8e934f7270ca8078a421e18125
|
4
|
+
data.tar.gz: fb653c65017338df1a980ae06fe2dc0cf4238820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b57f6d735574f9058d3f757010226c169f79c2e61d31e4765059eba850ca605ca1eae4fc86a1701f1d0edcda507d9e97e603678c1306449ff180dcfa46c5878
|
7
|
+
data.tar.gz: f26504ed7b76bc9ebb27a268b606655aee2bd8fe826f403dfc904b6fba690931382160cea32ab43c971a0d040995b4fb4da0b448a339024b5705c3c80f89f5d6
|
data/lib/sprockets/es6.rb
CHANGED
@@ -4,13 +4,30 @@ require 'sprockets/es6/version'
|
|
4
4
|
|
5
5
|
module Sprockets
|
6
6
|
class ES6
|
7
|
+
def self.instance
|
8
|
+
@instance ||= new
|
9
|
+
end
|
10
|
+
|
7
11
|
def self.call(input)
|
12
|
+
instance.call(input)
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
@options = options.dup.freeze
|
17
|
+
|
18
|
+
@cache_key = [
|
19
|
+
self.class.name,
|
20
|
+
ES6to5.version,
|
21
|
+
VERSION,
|
22
|
+
@options
|
23
|
+
].freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
def call(input)
|
8
27
|
data = input[:data]
|
9
|
-
result = input[:cache].fetch(
|
10
|
-
ES6to5.transform(data,
|
28
|
+
result = input[:cache].fetch(@cache_key + [data]) do
|
29
|
+
ES6to5.transform(data, @options)
|
11
30
|
end
|
12
|
-
|
13
|
-
# TODO: result['map']
|
14
31
|
result['code']
|
15
32
|
end
|
16
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-es6
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Peek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: 6to5
|