ember-es6_template 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/ember-es6_template.gemspec +1 -1
- data/lib/ember/es6_template.rb +1 -1
- data/lib/ember/es6_template/sprockets2/coffee_script.rb +5 -8
- data/lib/ember/es6_template/sprockets3.rb +23 -4
- data/lib/ember/es6_template/sprockets3/coffee_script_helper.rb +4 -14
- data/lib/ember/es6_template/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42edda08f0f4c6a3f5fdf6484094568146f9717e
|
4
|
+
data.tar.gz: 2d764e7c029fd1ffb91ad2030496f5894ce09459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d76ccf711685a6245d14f53c4fdf4771309aee6191e2ceb7b645de1889bc2323c73b60bdf4eb7d8dcd1ce412caef5eb55545d68ff2ef9da17d30be93104250f
|
7
|
+
data.tar.gz: 9f8853546eaddc91656d11eb4e1c5dbf7699c132a9fe8b64c5548593beab67062e4dae029ed9067364d7b85ffe4a5d098864685a3c9503780fbbed992b18f606
|
data/.travis.yml
CHANGED
@@ -5,13 +5,17 @@ sudo: false
|
|
5
5
|
rvm:
|
6
6
|
- 2.0.0
|
7
7
|
- 2.1
|
8
|
-
- 2.2
|
8
|
+
- 2.2.4
|
9
|
+
- 2.3.0
|
9
10
|
|
10
11
|
env:
|
11
12
|
matrix:
|
12
|
-
- SPROCKETS_VERSION="~> 2.
|
13
|
+
- SPROCKETS_VERSION="~> 2.2.0"
|
13
14
|
- SPROCKETS_VERSION="~> 2.12.0"
|
14
15
|
- SPROCKETS_VERSION="~> 3.0.0"
|
15
16
|
- SPROCKETS_VERSION="~> 3.1.0"
|
16
17
|
- SPROCKETS_VERSION="~> 3.2.0"
|
17
18
|
- SPROCKETS_VERSION="~> 3.3.0"
|
19
|
+
- SPROCKETS_VERSION="~> 3.4.0"
|
20
|
+
- SPROCKETS_VERSION="~> 3.5.0"
|
21
|
+
- SPROCKETS_VERSION="~> 4.0.0.beta1"
|
data/ember-es6_template.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency 'babel-transpiler', '>= 0.6.0', '< 0.8'
|
22
|
-
spec.add_dependency 'sprockets', '>= 2.
|
22
|
+
spec.add_dependency 'sprockets', '>= 2.2', '< 4'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/lib/ember/es6_template.rb
CHANGED
@@ -1,17 +1,14 @@
|
|
1
1
|
module Ember
|
2
2
|
module ES6Template
|
3
3
|
class CoffeeScript < Tilt::CoffeeScriptTemplate
|
4
|
-
self.default_mime_type = 'application/javascript'
|
5
|
-
|
6
4
|
def evaluate(scope, locals, &block)
|
7
5
|
filename = scope.pathname.to_s
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
7
|
+
if es6?(filename)
|
8
|
+
::CoffeeScript.compile(data, bare: true)
|
9
|
+
else
|
10
|
+
super
|
11
|
+
end
|
15
12
|
end
|
16
13
|
|
17
14
|
private
|
@@ -7,10 +7,29 @@ module Ember
|
|
7
7
|
autoload :CoffeeScriptHelper, 'ember/es6_template/sprockets3/coffee_script_helper'
|
8
8
|
|
9
9
|
def self.setup(env)
|
10
|
-
env.
|
11
|
-
env.
|
12
|
-
env.
|
13
|
-
env.
|
10
|
+
env.register_mime_type 'application/ecmascript-6', extensions: %w(.es6)
|
11
|
+
env.register_mime_type 'application/ecmascript-6+module', extensions: %w(.module.es6)
|
12
|
+
env.register_mime_type 'text/coffeescript', extensions: %w(.es6.coffee .coffee)
|
13
|
+
env.register_mime_type 'text/coffeescript+module', extensions: %w(.es6.module.coffee .module.coffee)
|
14
|
+
|
15
|
+
env.register_transformer 'application/ecmascript-6', 'application/javascript', ES6
|
16
|
+
env.register_transformer 'application/ecmascript-6+module', 'application/javascript', ES6Module
|
17
|
+
env.register_transformer 'text/coffeescript', 'application/javascript', CoffeeScript
|
18
|
+
env.register_transformer 'text/coffeescript+module', 'application/javascript', CoffeeScriptModule
|
19
|
+
|
20
|
+
env.register_preprocessor 'application/ecmascript-6', Sprockets::DirectiveProcessor.new(comments: ["//", ["/*", "*/"]])
|
21
|
+
env.register_preprocessor 'application/ecmascript-6+module', Sprockets::DirectiveProcessor.new(comments: ["//", ["/*", "*/"]])
|
22
|
+
env.register_preprocessor 'text/coffeescript', Sprockets::DirectiveProcessor.new(comments: ["#", ["###", "###"]])
|
23
|
+
env.register_preprocessor 'text/coffeescript+module', Sprockets::DirectiveProcessor.new(comments: ["#", ["###", "###"]])
|
24
|
+
|
25
|
+
if Sprockets::VERSION =~ /^4\./
|
26
|
+
env.register_transformer_suffix %w(
|
27
|
+
application/ecmascript-6
|
28
|
+
application/ecmascript-6+module
|
29
|
+
text/coffeescript
|
30
|
+
text/coffeescript+module
|
31
|
+
), 'application/\2+ruby', '.erb', Sprockets::ERBProcessor
|
32
|
+
end
|
14
33
|
end
|
15
34
|
end
|
16
35
|
end
|
@@ -5,16 +5,10 @@ module Ember
|
|
5
5
|
data = input[:data]
|
6
6
|
|
7
7
|
result = input[:cache].fetch(_cache_key + [data]) do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
)
|
13
|
-
else
|
14
|
-
code = Sprockets::Autoload::CoffeeScript.compile(data, bare: false)
|
15
|
-
|
16
|
-
{'code' => code}
|
17
|
-
end
|
8
|
+
transform(
|
9
|
+
Sprockets::Autoload::CoffeeScript.compile(data, bare: true),
|
10
|
+
input
|
11
|
+
)
|
18
12
|
end
|
19
13
|
|
20
14
|
result['code']
|
@@ -31,10 +25,6 @@ module Ember
|
|
31
25
|
Sprockets::Autoload::CoffeeScript.version
|
32
26
|
]
|
33
27
|
end
|
34
|
-
|
35
|
-
def es6?(filename)
|
36
|
-
File.basename(filename) =~ /\.(?:es6|module)\./
|
37
|
-
end
|
38
28
|
end
|
39
29
|
end
|
40
30
|
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
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryunosuke SATO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: babel-transpiler
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '2.
|
39
|
+
version: '2.2'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '4'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '2.
|
49
|
+
version: '2.2'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '4'
|