ember-es6_template 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ember/es6_template.rb +10 -0
- data/lib/ember/es6_template/config.rb +13 -0
- data/lib/ember/es6_template/sprockets2/es6.rb +1 -1
- data/lib/ember/es6_template/sprockets2/es6module.rb +7 -1
- data/lib/ember/es6_template/sprockets3/es6module.rb +14 -18
- data/lib/ember/es6_template/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41ce7edad979b252d083ced5a0248a14d1fba7f8
|
4
|
+
data.tar.gz: 3f45a8f0664aa940f48392352c294c329b7f3691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98cc626eb44ebbf60c93f08435d33decdd14b4a22814315366cb45848a3b512631821f696e00890acd3473c0b02df1c8cf0a1e9ddf73e46e8a358392df90edd7
|
7
|
+
data.tar.gz: df93807593a14cb40de67f36dd89a013b4c1adfc870edb1a864aa4eedb429cde12b9351acf7389d749243f012045bdf8726c62695bbe3c8583dd2c0001dcfe45
|
data/lib/ember/es6_template.rb
CHANGED
@@ -13,5 +13,15 @@ module Ember
|
|
13
13
|
else
|
14
14
|
raise "Unsupported sprockets version: #{Sprockets::VERSION}"
|
15
15
|
end
|
16
|
+
|
17
|
+
autoload :Config, 'ember/es6_template/config'
|
18
|
+
|
19
|
+
def self.configure
|
20
|
+
yield config if block_given?
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.config
|
24
|
+
@config ||= Config.new
|
25
|
+
end
|
16
26
|
end
|
17
27
|
end
|
@@ -15,11 +15,17 @@ module Ember
|
|
15
15
|
'moduleIds' => true,
|
16
16
|
'sourceRoot' => env.root,
|
17
17
|
'moduleRoot' => '',
|
18
|
-
'filename' => scope.logical_path
|
18
|
+
'filename' => module_name(scope.logical_path)
|
19
19
|
)
|
20
20
|
|
21
21
|
result['code']
|
22
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def module_name(path)
|
27
|
+
[Ember::ES6Template.config.module_prefix, path].compact.join('/')
|
28
|
+
end
|
23
29
|
end
|
24
30
|
end
|
25
31
|
end
|
@@ -2,13 +2,17 @@ module Ember
|
|
2
2
|
module ES6Template
|
3
3
|
class ES6Module
|
4
4
|
def self.instance
|
5
|
-
@instance ||= new
|
5
|
+
@instance ||= new(Ember::ES6Template.config)
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.call(input)
|
9
9
|
instance.call(input)
|
10
10
|
end
|
11
11
|
|
12
|
+
def initialize(config = Config.new)
|
13
|
+
@config = config
|
14
|
+
end
|
15
|
+
|
12
16
|
def call(input)
|
13
17
|
data = input[:data]
|
14
18
|
|
@@ -28,21 +32,12 @@ module Ember
|
|
28
32
|
private
|
29
33
|
|
30
34
|
def transform(data, input)
|
31
|
-
actual_name = input[:name]
|
32
|
-
if input[:filename][File.expand_path(input[:name] + '/index', input[:load_path])]
|
33
|
-
if actual_name == '.'
|
34
|
-
actual_name = 'index'
|
35
|
-
else
|
36
|
-
actual_name += '/index'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
35
|
Babel::Transpiler.transform(data,
|
41
36
|
'modules' => 'amd',
|
42
37
|
'moduleIds' => true,
|
43
38
|
'sourceRoot' => input[:load_path],
|
44
39
|
'moduleRoot' => '',
|
45
|
-
'filename' =>
|
40
|
+
'filename' => module_name(input)
|
46
41
|
)
|
47
42
|
end
|
48
43
|
|
@@ -51,22 +46,23 @@ module Ember
|
|
51
46
|
self.class.name,
|
52
47
|
VERSION,
|
53
48
|
Babel::Transpiler.version,
|
54
|
-
Babel::Transpiler.source_version
|
49
|
+
Babel::Transpiler.source_version,
|
50
|
+
@config.to_hash
|
55
51
|
]
|
56
52
|
end
|
57
53
|
|
58
|
-
def
|
59
|
-
|
54
|
+
def module_name(input)
|
55
|
+
module_name = input[:name]
|
60
56
|
|
61
57
|
if input[:filename][File.expand_path(input[:name] + '/index', input[:load_path])]
|
62
|
-
if
|
63
|
-
|
58
|
+
if module_name == '.'
|
59
|
+
module_name = 'index'
|
64
60
|
else
|
65
|
-
|
61
|
+
module_name += '/index'
|
66
62
|
end
|
67
63
|
end
|
68
64
|
|
69
|
-
|
65
|
+
[@config.module_prefix, module_name].compact.join('/')
|
70
66
|
end
|
71
67
|
end
|
72
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ember-es6_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryunosuke SATO
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- bin/setup
|
138
138
|
- ember-es6_template.gemspec
|
139
139
|
- lib/ember/es6_template.rb
|
140
|
+
- lib/ember/es6_template/config.rb
|
140
141
|
- lib/ember/es6_template/sprockets2.rb
|
141
142
|
- lib/ember/es6_template/sprockets2/coffee_script.rb
|
142
143
|
- lib/ember/es6_template/sprockets2/es6.rb
|