ember-es6_template 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de49d925a91c483aa199ce425c26ab1f438359f8
4
- data.tar.gz: 24f12f416d09608729b1c86fad6d4223774d4f29
3
+ metadata.gz: 3150df9a76eddaf0615b50a14e65f16a028496f4
4
+ data.tar.gz: 2d59611860fd0f8cce7355eaaddf565634399ea4
5
5
  SHA512:
6
- metadata.gz: b2b26e48a0938e9f1b25eb094e84f724365d2296823bf82ebb337d17409f8f26cdf79ce495ba5e3c478a26af788cb27cebf52b9952cd1d914f82248a1b799faf
7
- data.tar.gz: ee024f04caa7751ededddaf672e94412834ed28de0d7277e5c5a8cf859c9b99ebdf6cc181617d0234bcb361a07a7ca67944dc118292c588d7a8fed2a5f008db3
6
+ metadata.gz: 8074ff15eea7302a8c38e8291d204b7f6379ad4bedd3b946ab664a562ce86e7680a7fa3febea3c5c2f9ccd9f4922ccfe0b3ffc0d8627f4b96ddfa5d86a120b18
7
+ data.tar.gz: 9b4a6143562709424fff07bd617cafcf8b6173ea0f0e8d2101716081f1049e5c0a0b8f61e2f726a9972b4a9d18764be8775286d40e909ea33cd39ee112efc089
@@ -1,14 +1,17 @@
1
1
  module Ember
2
2
  module ES6Template
3
3
  class CoffeeScript < Tilt::CoffeeScriptTemplate
4
+ self.default_mime_type = 'application/javascript'
5
+
4
6
  def evaluate(scope, locals, &block)
5
7
  filename = scope.pathname.to_s
6
8
 
7
- if es6?(filename)
8
- ::CoffeeScript.compile(data, bare: true)
9
- else
10
- super
11
- end
9
+ @output ||=
10
+ if es6?(filename)
11
+ ::CoffeeScript.compile(data, options.merge(bare: true))
12
+ else
13
+ ::CoffeeScript.compile(data, options)
14
+ end
12
15
  end
13
16
 
14
17
  private
@@ -5,10 +5,16 @@ module Ember
5
5
  data = input[:data]
6
6
 
7
7
  result = input[:cache].fetch(_cache_key + [data]) do
8
- transform(
9
- Sprockets::Autoload::CoffeeScript.compile(data, bare: true),
10
- input
11
- )
8
+ if es6?(input[:filename])
9
+ transform(
10
+ Sprockets::Autoload::CoffeeScript.compile(data, bare: true),
11
+ input
12
+ )
13
+ else
14
+ code = Sprockets::Autoload::CoffeeScript.compile(data, bare: false)
15
+
16
+ {'code' => code}
17
+ end
12
18
  end
13
19
 
14
20
  result['code']
@@ -25,6 +31,10 @@ module Ember
25
31
  Sprockets::Autoload::CoffeeScript.version
26
32
  ]
27
33
  end
34
+
35
+ def es6?(filename)
36
+ File.basename(filename) =~ /\.(?:es6|module)\./
37
+ end
28
38
  end
29
39
  end
30
40
  end
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module ES6Template
3
- VERSION = '0.4.3'
3
+ VERSION = '0.4.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-es6_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryunosuke SATO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-29 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babel-transpiler
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  version: '0'
170
170
  requirements: []
171
171
  rubyforge_project:
172
- rubygems_version: 2.4.5.1
172
+ rubygems_version: 2.5.1
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: The tilt template for Ember specified ES6.