coffee-react 3.0.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/coffee-react-transform.js +95 -82
- data/js-syntax-transform.js +27312 -0
- data/lib/coffee_react.rb +15 -10
- metadata +3 -2
data/lib/coffee_react.rb
CHANGED
@@ -7,21 +7,20 @@ module CoffeeReact
|
|
7
7
|
CompilationError = ExecJS::ProgramError
|
8
8
|
|
9
9
|
module Source
|
10
|
-
def self.path
|
11
|
-
|
10
|
+
def self.path(filename)
|
11
|
+
File.expand_path("../#{filename}", File.dirname(__FILE__))
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.
|
15
|
-
|
16
|
-
@path = path
|
14
|
+
def self.context(filename)
|
15
|
+
ExecJS.compile(File.read(self.path(filename)))
|
17
16
|
end
|
18
17
|
|
19
|
-
def self.
|
20
|
-
@
|
18
|
+
def self.transform_context
|
19
|
+
@transform_context ||= self.context('coffee-react-transform.js')
|
21
20
|
end
|
22
21
|
|
23
|
-
def self.
|
24
|
-
@
|
22
|
+
def self.jstransform_context
|
23
|
+
@jstransform_context ||= self.context('js-syntax-transform.js')
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
@@ -35,7 +34,13 @@ module CoffeeReact
|
|
35
34
|
def transform(script, options = {})
|
36
35
|
script = script.read if script.respond_to?(:read)
|
37
36
|
|
38
|
-
Source.
|
37
|
+
Source.transform_context.call("coffeeReactTransform", script, options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def jstransform(script)
|
41
|
+
script = script.read if script.respond_to?(:read)
|
42
|
+
|
43
|
+
Source.jstransform_context.call("coffeeReactJSSyntaxTransform", script)
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Friend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- LICENSE
|
65
65
|
- README.md
|
66
66
|
- coffee-react-transform.js
|
67
|
+
- js-syntax-transform.js
|
67
68
|
- lib/coffee-react.rb
|
68
69
|
- lib/coffee_react.rb
|
69
70
|
homepage: http://github.com/jsdf/ruby-coffee-react
|