middleman-react 0.12.1 → 0.12.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1918b93e67c412ddc111878452d2bcdd41ee2cd
4
- data.tar.gz: bb32769e69a0077702b098db7e290456b178cac8
3
+ metadata.gz: fa7fba70a39d5400507265dea99855e7ff55d7b8
4
+ data.tar.gz: 4b8c05c8e511275349741723b93ea603cf9693b2
5
5
  SHA512:
6
- metadata.gz: 537d9c1b2a4f601be8e0b50efe7d76b6b91a50f42fe0b6e710712479a0e59f20e87986686b7380ade54274986e1e6aaca3548d7791ad3e14d64dbbad0c07cabc
7
- data.tar.gz: 1ce4620240a4f437327ac9fdff295298794c2cc2655c5a8094cbd9f2113323590b7a84ece07847f1b97370be011175c4038734444c4d7e434fda40bdbc6696e4
6
+ metadata.gz: 4578d9f957b041a42559259e588d3be162517b7390753c02233c768b62a7a7c400329fca44bb9febc4671beef25fb477ce5b5a5fb11795e1855203557711b480
7
+ data.tar.gz: 5060eecb38cd96a3edcbf783664bc79e525a54a6d4cbbe3a393ef061633437c62cfaad0ab9e404e31f8134a86c61236521e18d89463eb827890bddfad5fdca83
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- middleman-react (0.12.1)
4
+ middleman-react (0.12.1.1)
5
5
  execjs
6
6
  middleman-core (>= 3.0)
7
7
  react-source (~> 0.12.1)
data/README.md CHANGED
@@ -9,6 +9,16 @@ Inspired (and pretty much a clone of really) the [react-rails] gem for Middleman
9
9
  1. `gem install middleman-react`
10
10
  2. `activate :react` in `config.rb`
11
11
 
12
+ ##### Options
13
+
14
+ It is also possible to pass options through to the JSX compiler if that’s your thing:
15
+
16
+ ``` ruby
17
+ activate :react do |config|
18
+ config.harmony = true
19
+ config.strip_types = true
20
+ end
21
+ ```
12
22
 
13
23
  #### Sprockets loading react-source
14
24
 
@@ -32,6 +42,11 @@ Or with addons:
32
42
  //= require react-with-addons
33
43
  ```
34
44
 
45
+ #### A note on versioning
46
+
47
+ The version for this gem will reflect that of the underlying version of `react-source`, meaning that using `0.12.1` of this gem will give you version `0.12.1` of React. This is the same approach that `react-rails` takes.
48
+ If updates to the gem code are required that do not alter the `react-source` version in use need to be made they will be released with a `.1` version appended, eg: `0.12.1.1`.
49
+
35
50
  #### Developing / Contributing
36
51
  1. Fork it!
37
52
  2. Get set up: `./script/bootstrap`
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rake/clean'
@@ -8,7 +8,15 @@ module Middleman
8
8
  module React
9
9
  # Middleman extension entry point
10
10
  class Extension < Middleman::Extension
11
+ option :harmony, false, 'The option of harmony'
12
+ option :strip_types, false, 'The option of stripTypes'
13
+
11
14
  def initialize(app, options_hash = {}, &block)
15
+ super
16
+
17
+ Middleman::React::Template.harmony = options[:harmony]
18
+ Middleman::React::Template.strip_types = options[:strip_types]
19
+
12
20
  ::Tilt.register 'jsx', Middleman::React::Template
13
21
  ::Sprockets.register_engine 'jsx', Middleman::React::Template
14
22
  end
@@ -16,8 +16,8 @@ module Middleman
16
16
  @context ||= ExecJS.compile(contents)
17
17
  end
18
18
 
19
- def transform(code)
20
- context.call('JSXTransformer.transform', code)['code']
19
+ def transform(code, opts = {})
20
+ context.call('JSXTransformer.transform', code, opts)['code']
21
21
  end
22
22
  module_function :transform
23
23
  end
@@ -8,10 +8,22 @@ module Middleman
8
8
  class Template < Tilt::Template
9
9
  self.default_mime_type = 'application/javascript'
10
10
 
11
- def prepare; end
11
+ cattr_accessor :harmony
12
+ cattr_accessor :strip_types
13
+ @harmony = false
14
+ @strip_types = false
15
+
16
+ def prepare
17
+ if self.class.harmony || options.key?(:harmony)
18
+ options[:harmony] = self.class.harmony
19
+ end
20
+ if self.class.strip_types || options.key?(:stripTypes)
21
+ options[:stripTypes] = self.class.strip_types
22
+ end
23
+ end
12
24
 
13
25
  def evaluate(scope, locals, &block)
14
- @output ||= JSX.transform(data)
26
+ @output ||= JSX.transform(data, options)
15
27
  end
16
28
  end
17
29
  end
@@ -4,6 +4,6 @@ module Middleman
4
4
  # Gem packaging constants
5
5
  module React
6
6
  PACKAGE = 'middleman-react'
7
- VERSION = '0.12.1'
7
+ VERSION = '0.12.1.1'
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Morris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-09 00:00:00.000000000 Z
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -177,6 +177,7 @@ files:
177
177
  - Gemfile.lock
178
178
  - LICENSE
179
179
  - README.md
180
+ - Rakefile
180
181
  - fixtures/app/config.rb
181
182
  - fixtures/app/source/assets/javascripts/coffeescript.js.jsx.coffee
182
183
  - fixtures/app/source/assets/javascripts/plain_jsx.js.jsx