ember-es6_template 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/ember-es6_template.gemspec +2 -3
- data/lib/ember/es6_template/es6.rb +26 -11
- data/lib/ember/es6_template/es6_sprockets2.rb +23 -0
- data/lib/ember/es6_template/es6module.rb +28 -13
- data/lib/ember/es6_template/es6module_sprockets2.rb +25 -0
- data/lib/ember/es6_template/version.rb +1 -1
- data/lib/ember/es6_template.rb +11 -3
- metadata +11 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86db4eb2a5854bd44a33b7278a96f93840fc856d
|
4
|
+
data.tar.gz: 60c0f71270a55e39c4385e339db91aa4651e4b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d35450b30b74463f271687cd17f7e6f7d17002b4ef8345fa3b4e56f528d31838fc244ee896e62b3df10e38a8d18db6993a0c07243231977e32c836004e02575
|
7
|
+
data.tar.gz: b591ea35778aa767208a0022cec84b716c2ce05c30129251f6e2892182625c3c4058c62cba824041540138f2cd7c99b3e30c28b95da55879cbb70e5ac5265657
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/ember-es6_template.gemspec
CHANGED
@@ -19,11 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency 'babel-transpiler', '~> 0.6.0'
|
22
|
-
spec.add_dependency '
|
22
|
+
spec.add_dependency 'sprockets'
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
27
27
|
spec.add_development_dependency 'minitest-power_assert'
|
28
|
-
spec.add_development_dependency 'sprockets', '~> 2.12'
|
29
28
|
end
|
@@ -1,23 +1,38 @@
|
|
1
1
|
module Ember
|
2
2
|
module ES6Template
|
3
|
-
class ES6
|
4
|
-
def self.
|
5
|
-
|
3
|
+
class ES6
|
4
|
+
def self.instance
|
5
|
+
@instance ||= new
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
8
|
+
def self.call(input)
|
9
|
+
instance.call(input)
|
10
|
+
end
|
9
11
|
|
10
|
-
def
|
11
|
-
|
12
|
+
def call(input)
|
13
|
+
data = input[:data]
|
12
14
|
|
13
|
-
result =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
result = input[:cache].fetch(cache_key + [data]) do
|
16
|
+
Babel::Transpiler.transform(data,
|
17
|
+
'sourceRoot' => input[:load_path],
|
18
|
+
'moduleRoot' => '',
|
19
|
+
'filename' => input[:filename]
|
20
|
+
)
|
21
|
+
end
|
18
22
|
|
19
23
|
result['code']
|
20
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def cache_key
|
29
|
+
[
|
30
|
+
self.class.name,
|
31
|
+
VERSION,
|
32
|
+
Babel::Transpiler.version,
|
33
|
+
Babel::Transpiler.source_version
|
34
|
+
]
|
35
|
+
end
|
21
36
|
end
|
22
37
|
end
|
23
38
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Ember
|
2
|
+
module ES6Template
|
3
|
+
class ES6 < ::Tilt::Template
|
4
|
+
def self.default_mime_type
|
5
|
+
'application/javascript'
|
6
|
+
end
|
7
|
+
|
8
|
+
def prepare; end
|
9
|
+
|
10
|
+
def evaluate(scope, locals, &block)
|
11
|
+
env = scope.environment
|
12
|
+
|
13
|
+
result = Babel::Transpiler.transform(data,
|
14
|
+
'sourceRoot' => env.root,
|
15
|
+
'moduleRoot' => '',
|
16
|
+
'filename' => scope.logical_path
|
17
|
+
)
|
18
|
+
|
19
|
+
result['code']
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,25 +1,40 @@
|
|
1
1
|
module Ember
|
2
2
|
module ES6Template
|
3
|
-
class ES6Module
|
4
|
-
def self.
|
5
|
-
|
3
|
+
class ES6Module
|
4
|
+
def self.instance
|
5
|
+
@instance ||= new
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
8
|
+
def self.call(input)
|
9
|
+
instance.call(input)
|
10
|
+
end
|
9
11
|
|
10
|
-
def
|
11
|
-
|
12
|
+
def call(input)
|
13
|
+
data = input[:data]
|
12
14
|
|
13
|
-
result =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
result = input[:cache].fetch(cache_key + [data]) do
|
16
|
+
Babel::Transpiler.transform(data,
|
17
|
+
'modules' => 'amd',
|
18
|
+
'moduleIds' => true,
|
19
|
+
'sourceRoot' => input[:load_path],
|
20
|
+
'moduleRoot' => '',
|
21
|
+
'filename' => input[:filename]
|
22
|
+
)
|
23
|
+
end
|
20
24
|
|
21
25
|
result['code']
|
22
26
|
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def cache_key
|
31
|
+
[
|
32
|
+
self.class.name,
|
33
|
+
VERSION,
|
34
|
+
Babel::Transpiler.version,
|
35
|
+
Babel::Transpiler.source_version
|
36
|
+
]
|
37
|
+
end
|
23
38
|
end
|
24
39
|
end
|
25
40
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Ember
|
2
|
+
module ES6Template
|
3
|
+
class ES6Module < ::Tilt::Template
|
4
|
+
def self.default_mime_type
|
5
|
+
'application/javascript'
|
6
|
+
end
|
7
|
+
|
8
|
+
def prepare; end
|
9
|
+
|
10
|
+
def evaluate(scope, locals, &block)
|
11
|
+
env = scope.environment
|
12
|
+
|
13
|
+
result = Babel::Transpiler.transform(data,
|
14
|
+
'modules' => 'amd',
|
15
|
+
'moduleIds' => true,
|
16
|
+
'sourceRoot' => env.root,
|
17
|
+
'moduleRoot' => '',
|
18
|
+
'filename' => scope.logical_path
|
19
|
+
)
|
20
|
+
|
21
|
+
result['code']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/ember/es6_template.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
require 'ember/es6_template/version'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'sprockets'
|
4
4
|
require 'babel/transpiler'
|
5
5
|
|
6
6
|
module Ember
|
7
7
|
module ES6Template
|
8
|
-
|
9
|
-
|
8
|
+
case Sprockets::VERSION
|
9
|
+
when /^2\./
|
10
|
+
autoload :ES6, 'ember/es6_template/es6_sprockets2'
|
11
|
+
autoload :ES6Module, 'ember/es6_template/es6module_sprockets2'
|
12
|
+
when /^3\./
|
13
|
+
autoload :ES6, 'ember/es6_template/es6'
|
14
|
+
autoload :ES6Module, 'ember/es6_template/es6module'
|
15
|
+
else
|
16
|
+
raise "Unsupported sprockets version: #{Sprockets::VERSION}"
|
17
|
+
end
|
10
18
|
end
|
11
19
|
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.0.
|
4
|
+
version: 0.0.2
|
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-03-
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: babel-transpiler
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: sprockets
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: sprockets
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '2.12'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '2.12'
|
111
97
|
description: The tilt template for Ember specified ES6.
|
112
98
|
email:
|
113
99
|
- tricknotes.rs@gmail.com
|
@@ -126,7 +112,9 @@ files:
|
|
126
112
|
- ember-es6_template.gemspec
|
127
113
|
- lib/ember/es6_template.rb
|
128
114
|
- lib/ember/es6_template/es6.rb
|
115
|
+
- lib/ember/es6_template/es6_sprockets2.rb
|
129
116
|
- lib/ember/es6_template/es6module.rb
|
117
|
+
- lib/ember/es6_template/es6module_sprockets2.rb
|
130
118
|
- lib/ember/es6_template/version.rb
|
131
119
|
homepage: https://github.com/tricknotes/ember-es6_template
|
132
120
|
licenses:
|