react-rails 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +7 -13
- data/lib/assets/javascripts/react_ujs.js +6 -0
- data/lib/assets/javascripts/react_ujs_event_setup.js +27 -0
- data/lib/assets/javascripts/{react_ujs.js.erb → react_ujs_mount.js} +12 -53
- data/lib/assets/javascripts/react_ujs_native.js +18 -0
- data/lib/assets/javascripts/react_ujs_turbolinks.js +9 -0
- data/lib/assets/javascripts/react_ujs_turbolinks_classic.js +10 -0
- data/lib/assets/javascripts/react_ujs_turbolinks_classic_deprecated.js +13 -0
- data/lib/generators/react/install_generator.rb +1 -1
- data/lib/react/jsx/jsx_transformer.rb +2 -2
- data/lib/react/rails.rb +0 -1
- data/lib/react/rails/component_mount.rb +10 -2
- data/lib/react/rails/railtie.rb +10 -0
- data/lib/react/rails/version.rb +1 -1
- data/lib/react/server_rendering/manifest_container.rb +1 -1
- data/lib/react/server_rendering/sprockets_renderer.rb +7 -1
- data/lib/react/server_rendering/yaml_manifest_container.rb +19 -0
- metadata +59 -53
- data/lib/react/rails/engine.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bfcf293fb25b2c8b94f7046cc4ccc4423ae2431
|
4
|
+
data.tar.gz: e6d7b81dd200c57831a4214f675034fdbbffdc11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cafb0bf7621292d60e1437dba42d32e24dd9eea23c8d49406f42ac211fdb852eafee7f7649e6275cd75035bfe0c071d787275a6b000b42ad939ae305ec1640d1
|
7
|
+
data.tar.gz: 4a46fa6972483ecb1c4835a62608f25a19574b003bac3fba9446f88aeffc5bca147912f7227fa16e624fe27c69c855c849c2b9558157a0c348a642a45bb53278
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,23 @@
|
|
8
8
|
|
9
9
|
#### Bug Fixes
|
10
10
|
|
11
|
+
## 1.6.1 (February 28, 2016)
|
12
|
+
|
13
|
+
#### Breaking Changes
|
14
|
+
|
15
|
+
#### New Features
|
16
|
+
|
17
|
+
- UJS can mount and unmount a component by ID (not only the component's children) #466
|
18
|
+
- Support Turbolinks 5 #475
|
19
|
+
|
20
|
+
#### Deprecation
|
21
|
+
|
22
|
+
#### Bug Fixes
|
23
|
+
|
24
|
+
- Support nested arrays with `camelize_props` #480
|
25
|
+
- Improve Sprockets 3 compatibility #453
|
26
|
+
- Fix install-generator `require` spacing #476
|
27
|
+
|
11
28
|
## 1.6.0 (February 4, 2016)
|
12
29
|
|
13
30
|
#### Breaking Changes
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ in your Ruby on Rails (3.2+) application. `react-rails` can:
|
|
19
19
|
- [Generate components](#component-generator) with a Rails generator
|
20
20
|
- [Be extended](#extending-react-rails) with custom renderers, transformers and view helpers
|
21
21
|
|
22
|
-
Just getting started with React? Make sure to check out the [Getting Started] (https://facebook.github.io/react/docs/getting-started.html) guide.
|
22
|
+
Just getting started with React? Make sure to check out the [Getting Started] (https://facebook.github.io/react/docs/getting-started.html) guide. Also, see [Related Projects](#related-projects) below.
|
23
23
|
|
24
24
|
## Installation
|
25
25
|
|
@@ -82,14 +82,6 @@ end
|
|
82
82
|
After restarting your Rails server, `//= require react` will provide the build of React.js which
|
83
83
|
was specified by the configurations.
|
84
84
|
|
85
|
-
If you want to hand-pick which add-ons are added to your build they are available via sprockets
|
86
|
-
directives.
|
87
|
-
|
88
|
-
```js
|
89
|
-
//= require react
|
90
|
-
//= require react-addons-css-transition-group
|
91
|
-
```
|
92
|
-
|
93
85
|
`react-rails` offers a few other options for versions & builds of React.js.
|
94
86
|
See [VERSIONS.md](https://github.com/reactjs/react-rails/blob/master/VERSIONS.md) for more info about
|
95
87
|
using the `react-source` gem or dropping in your own copies of React.js.
|
@@ -185,7 +177,7 @@ _(It will also be mounted by the UJS on page load.)_
|
|
185
177
|
|
186
178
|
There are some requirements for this to work:
|
187
179
|
|
188
|
-
- `react-rails` must load your code. By convention it uses `components.js`, which was created
|
180
|
+
- `react-rails` must load your code. By convention, it uses `components.js`, which was created
|
189
181
|
by the install task. This file must include your components _and_ their dependencies (eg, Underscore.js).
|
190
182
|
- Your components must be accessible in the global scope.
|
191
183
|
If you are using `.js.jsx.coffee` files then the wrapper function needs to be taken into account:
|
@@ -203,7 +195,7 @@ You can configure your pool of JS virtual machines and specify where it should l
|
|
203
195
|
|
204
196
|
```ruby
|
205
197
|
# config/environments/application.rb
|
206
|
-
# These are the defaults if you
|
198
|
+
# These are the defaults if you don't specify any yourself
|
207
199
|
MyApp::Application.configure do
|
208
200
|
# Settings for the pool of renderers:
|
209
201
|
config.react.server_renderer_pool_size ||= 1 # ExecJS doesn't allow more than one on MRI
|
@@ -405,5 +397,7 @@ Any subclass of `ExecJSRenderer` may use those hooks (for example, `SprocketsRen
|
|
405
397
|
|
406
398
|
### Related Projects
|
407
399
|
|
408
|
-
|
409
|
-
|
400
|
+
- [react\_on\_rails Gem](https://github.com/shakacode/react_on_rails): Webpack Integration of React with Rails utilizing the modern JavaScript tooling and libraries, including Webpack, Babel, React, Redux, React-Router. You can an example of this live at [www.reactrails.com](http://www.reactrails.com).
|
401
|
+
- [React.rb](http://reactrb.org/): Use Ruby to build reactive user interfaces with React under the covers.[github source code here](https://github.com/zetachang/react.rb).
|
402
|
+
- [react-rails-hot-loader](https://github.com/rmosolgo/react-rails-hot-loader) is a simple live-reloader for `react-rails`.
|
403
|
+
- [react-rails-benchmark_renderer](https://github.com/pboling/react-rails-benchmark_renderer) adds performance instrumentation to server rendering.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
;(function(document, window) {
|
2
|
+
// jQuery is optional. Use it to support legacy browsers.
|
3
|
+
var $ = (typeof window.jQuery !== 'undefined') && window.jQuery;
|
4
|
+
if ($) {
|
5
|
+
ReactRailsUJS.handleEvent = function(eventName, callback) {
|
6
|
+
$(document).on(eventName, callback);
|
7
|
+
};
|
8
|
+
} else {
|
9
|
+
ReactRailsUJS.handleEvent = function(eventName, callback) {
|
10
|
+
document.addEventListener(eventName, callback);
|
11
|
+
};
|
12
|
+
}
|
13
|
+
// Detect which kind of events to set up:
|
14
|
+
if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
15
|
+
if (typeof Turbolinks.EVENTS !== 'undefined') {
|
16
|
+
// Turbolinks.EVENTS is in classic version 2.4.0+
|
17
|
+
ReactRailsUJS.TurbolinksClassic.setup();
|
18
|
+
} else if (typeof Turbolinks.controller !== "undefined") {
|
19
|
+
// Turbolinks.controller is in version 5+
|
20
|
+
ReactRailsUJS.Turbolinks.setup();
|
21
|
+
} else {
|
22
|
+
ReactRailsUJS.TurbolinksClassicDeprecated.setup();
|
23
|
+
}
|
24
|
+
} else {
|
25
|
+
ReactRailsUJS.Native.setup();
|
26
|
+
}
|
27
|
+
})(document, window);
|
@@ -1,15 +1,16 @@
|
|
1
|
-
/*globals React, Turbolinks*/
|
2
|
-
|
3
|
-
// Unobtrusive scripting adapter for React
|
4
1
|
;(function(document, window) {
|
5
2
|
// jQuery is optional. Use it to support legacy browsers.
|
6
3
|
var $ = (typeof window.jQuery !== 'undefined') && window.jQuery;
|
7
4
|
|
8
|
-
// create the namespace
|
9
5
|
window.ReactRailsUJS = {
|
6
|
+
// This attribute holds the name of component which should be mounted
|
7
|
+
// example: `data-react-class="MyApp.Items.EditForm"`
|
10
8
|
CLASS_NAME_ATTR: 'data-react-class',
|
9
|
+
|
10
|
+
// This attribute holds JSON stringified props for initializing the component
|
11
|
+
// example: `data-react-props="{\"item\": { \"id\": 1, \"name\": \"My Item\"} }"`
|
11
12
|
PROPS_ATTR: 'data-react-props',
|
12
|
-
|
13
|
+
|
13
14
|
// helper method for the mount and unmount methods to find the
|
14
15
|
// `data-react-class` DOM elements
|
15
16
|
findDOMNodes: function(searchSelector) {
|
@@ -26,7 +27,8 @@
|
|
26
27
|
parent = searchSelector;
|
27
28
|
break;
|
28
29
|
case 'string':
|
29
|
-
selector = searchSelector + '
|
30
|
+
selector = searchSelector + '[' + window.ReactRailsUJS.CLASS_NAME_ATTR + '], ' +
|
31
|
+
searchSelector + ' [' + window.ReactRailsUJS.CLASS_NAME_ATTR + ']';
|
30
32
|
parent = document;
|
31
33
|
break
|
32
34
|
default:
|
@@ -40,6 +42,8 @@
|
|
40
42
|
}
|
41
43
|
},
|
42
44
|
|
45
|
+
// Within `searchSelector`, find nodes which should have React components
|
46
|
+
// inside them, and mount them with their props.
|
43
47
|
mountComponents: function(searchSelector) {
|
44
48
|
var nodes = window.ReactRailsUJS.findDOMNodes(searchSelector);
|
45
49
|
|
@@ -60,6 +64,8 @@
|
|
60
64
|
}
|
61
65
|
},
|
62
66
|
|
67
|
+
// Within `searchSelector`, find nodes which have React components
|
68
|
+
// inside them, and unmount those components.
|
63
69
|
unmountComponents: function(searchSelector) {
|
64
70
|
var nodes = window.ReactRailsUJS.findDOMNodes(searchSelector);
|
65
71
|
|
@@ -72,51 +78,4 @@
|
|
72
78
|
}
|
73
79
|
}
|
74
80
|
};
|
75
|
-
|
76
|
-
// functions not exposed publicly
|
77
|
-
function handleTurbolinksEvents () {
|
78
|
-
var handleEvent;
|
79
|
-
var unmountEvent;
|
80
|
-
|
81
|
-
if ($) {
|
82
|
-
handleEvent = function(eventName, callback) {
|
83
|
-
$(document).on(eventName, callback);
|
84
|
-
};
|
85
|
-
|
86
|
-
} else {
|
87
|
-
handleEvent = function(eventName, callback) {
|
88
|
-
document.addEventListener(eventName, callback);
|
89
|
-
};
|
90
|
-
}
|
91
|
-
|
92
|
-
if (Turbolinks.EVENTS) {
|
93
|
-
unmountEvent = Turbolinks.EVENTS.BEFORE_UNLOAD;
|
94
|
-
} else {
|
95
|
-
unmountEvent = 'page:receive';
|
96
|
-
Turbolinks.pagesCached(0);
|
97
|
-
|
98
|
-
if (window.ReactRailsUJS.RAILS_ENV_DEVELOPMENT) {
|
99
|
-
console.warn('The Turbolinks cache has been disabled (Turbolinks >= 2.4.0 is recommended). See https://github.com/reactjs/react-rails/issues/87 for more information.');
|
100
|
-
}
|
101
|
-
}
|
102
|
-
handleEvent('page:change', function() {window.ReactRailsUJS.mountComponents()});
|
103
|
-
handleEvent(unmountEvent, function() {window.ReactRailsUJS.unmountComponents()});
|
104
|
-
}
|
105
|
-
|
106
|
-
function handleNativeEvents() {
|
107
|
-
if ($) {
|
108
|
-
$(function() {window.ReactRailsUJS.mountComponents()});
|
109
|
-
} else if ('addEventListener' in window) {
|
110
|
-
document.addEventListener('DOMContentLoaded', function() {window.ReactRailsUJS.mountComponents()});
|
111
|
-
} else {
|
112
|
-
// add support to IE8 without jQuery
|
113
|
-
window.attachEvent('onload', function() {window.ReactRailsUJS.mountComponents()});
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
118
|
-
handleTurbolinksEvents();
|
119
|
-
} else {
|
120
|
-
handleNativeEvents();
|
121
|
-
}
|
122
81
|
})(document, window);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
;(function(document, window) {
|
2
|
+
// jQuery is optional. Use it to support legacy browsers.
|
3
|
+
var $ = (typeof window.jQuery !== 'undefined') && window.jQuery;
|
4
|
+
|
5
|
+
window.ReactRailsUJS.Native = {
|
6
|
+
// Attach handlers to browser events to mount & unmount components
|
7
|
+
setup: function() {
|
8
|
+
if ($) {
|
9
|
+
$(function() {window.ReactRailsUJS.mountComponents()});
|
10
|
+
} else if ('addEventListener' in window) {
|
11
|
+
document.addEventListener('DOMContentLoaded', function() {window.ReactRailsUJS.mountComponents()});
|
12
|
+
} else {
|
13
|
+
// add support to IE8 without jQuery
|
14
|
+
window.attachEvent('onload', function() {window.ReactRailsUJS.mountComponents()});
|
15
|
+
}
|
16
|
+
}
|
17
|
+
};
|
18
|
+
})(document, window);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
;(function(document, window) {
|
2
|
+
window.ReactRailsUJS.Turbolinks = {
|
3
|
+
// Turbolinks 5+ got rid of named events (?!)
|
4
|
+
setup: function() {
|
5
|
+
ReactRailsUJS.handleEvent('turbolinks:load', function() {window.ReactRailsUJS.mountComponents()});
|
6
|
+
ReactRailsUJS.handleEvent('turbolinks:before-cache', function() {window.ReactRailsUJS.unmountComponents()});
|
7
|
+
}
|
8
|
+
};
|
9
|
+
})(document, window);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
;(function(document, window) {
|
2
|
+
window.ReactRailsUJS.TurbolinksClassic = {
|
3
|
+
// Attach handlers to Turbolinks-Classic events
|
4
|
+
// for mounting and unmounting components
|
5
|
+
setup: function() {
|
6
|
+
ReactRailsUJS.handleEvent(Turbolinks.EVENTS.CHANGE, function() {window.ReactRailsUJS.mountComponents()});
|
7
|
+
ReactRailsUJS.handleEvent(Turbolinks.EVENTS.BEFORE_UNLOAD, function() {window.ReactRailsUJS.unmountComponents()});
|
8
|
+
}
|
9
|
+
};
|
10
|
+
})(document, window);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
;(function(document, window) {
|
2
|
+
window.ReactRailsUJS.TurbolinksClassicDeprecated = {
|
3
|
+
// Before Turbolinks 2.4.0, Turbolinks didn't
|
4
|
+
// have named events and didn't have a before-unload event.
|
5
|
+
// Also, it didn't work with the Turbolinks cache, see
|
6
|
+
// https://github.com/reactjs/react-rails/issues/87
|
7
|
+
setup: function() {
|
8
|
+
Turbolinks.pagesCached(0)
|
9
|
+
ReactRailsUJS.handleEvent('page:change', function() {window.ReactRailsUJS.mountComponents()});
|
10
|
+
ReactRailsUJS.handleEvent('page:receive', function() {window.ReactRailsUJS.unmountComponents()});
|
11
|
+
}
|
12
|
+
};
|
13
|
+
})(document, window);
|
@@ -22,7 +22,7 @@ module React
|
|
22
22
|
if manifest.exist?
|
23
23
|
manifest_contents = File.read(manifest)
|
24
24
|
|
25
|
-
if match = manifest_contents.match(/\/\/=\s+require\s+turbolinks/)
|
25
|
+
if match = manifest_contents.match(/\/\/=\s+require\s+turbolinks\s+\n/)
|
26
26
|
inject_into_file manifest, require_react, { after: match[0] }
|
27
27
|
elsif match = manifest_contents.match(/\/\/=\s+require_tree[^\n]*/)
|
28
28
|
inject_into_file manifest, require_react, { before: match[0] }
|
@@ -23,9 +23,9 @@ module React
|
|
23
23
|
result["code"]
|
24
24
|
end
|
25
25
|
|
26
|
+
# search for transformer file using sprockets - allows user to override
|
27
|
+
# this file in his own application
|
26
28
|
def jsx_transform_code
|
27
|
-
# search for transformer file using sprockets - allows user to override
|
28
|
-
# this file in his own application
|
29
29
|
::Rails.application.assets[@asset_path].to_s
|
30
30
|
end
|
31
31
|
end
|
data/lib/react/rails.rb
CHANGED
@@ -49,9 +49,17 @@ module React
|
|
49
49
|
def camelize_props_key(props)
|
50
50
|
return props unless props.is_a?(Hash)
|
51
51
|
props.inject({}) do |h, (k,v)|
|
52
|
-
h[k.to_s.camelize(:lower)] =
|
52
|
+
h[k.to_s.camelize(:lower)] = case v
|
53
|
+
when Hash
|
54
|
+
camelize_props_key(v)
|
55
|
+
when Array
|
56
|
+
v.map {|i| camelize_props_key(i) }
|
57
|
+
else
|
58
|
+
v
|
59
|
+
end
|
60
|
+
h
|
53
61
|
end
|
54
62
|
end
|
55
63
|
end
|
56
64
|
end
|
57
|
-
end
|
65
|
+
end
|
data/lib/react/rails/railtie.rb
CHANGED
@@ -87,6 +87,16 @@ module React
|
|
87
87
|
# Reload renderers in dev when files change
|
88
88
|
ActionDispatch::Reloader.to_prepare { React::ServerRendering.reset_pool }
|
89
89
|
end
|
90
|
+
|
91
|
+
initializer "react_rails.setup_engine", :group => :all do |app|
|
92
|
+
sprockets_env = app.assets || Sprockets # Sprockets 3.x expects this in a different place
|
93
|
+
if Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new("3.0.0")
|
94
|
+
sprockets_env.register_mime_type("application/jsx", extensions: [".jsx", ".js.jsx", ".es.jsx", ".es6.jsx"])
|
95
|
+
sprockets_env.register_transformer("application/jsx", "application/javascript", React::JSX::Processor)
|
96
|
+
else
|
97
|
+
sprockets_env.register_engine(".jsx", React::JSX::Template)
|
98
|
+
end
|
99
|
+
end
|
90
100
|
end
|
91
101
|
end
|
92
102
|
end
|
data/lib/react/rails/version.rb
CHANGED
@@ -11,7 +11,7 @@ module React
|
|
11
11
|
|
12
12
|
def find_asset(logical_path)
|
13
13
|
asset_path = @manifest.assets[logical_path] || raise("No compiled asset for #{logical_path}, was it precompiled?")
|
14
|
-
asset_full_path = ::Rails.root.join("public", @manifest.
|
14
|
+
asset_full_path = ::Rails.root.join("public", @manifest.dir, asset_path)
|
15
15
|
File.read(asset_full_path)
|
16
16
|
end
|
17
17
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require "react/server_rendering/environment_container"
|
2
2
|
require "react/server_rendering/manifest_container"
|
3
|
+
require "react/server_rendering/yaml_manifest_container"
|
4
|
+
|
3
5
|
module React
|
4
6
|
module ServerRendering
|
5
7
|
# Extends ExecJSRenderer for the Rails environment
|
@@ -62,7 +64,11 @@ module React
|
|
62
64
|
elsif ::Rails.application.config.assets.compile
|
63
65
|
EnvironmentContainer.new
|
64
66
|
else
|
65
|
-
|
67
|
+
if Rails::VERSION::MAJOR == 3
|
68
|
+
YamlManifestContainer.new
|
69
|
+
else
|
70
|
+
ManifestContainer.new
|
71
|
+
end
|
66
72
|
end
|
67
73
|
end
|
68
74
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module React
|
2
|
+
module ServerRendering
|
3
|
+
# Get asset content by reading the compiled file from disk using the generated maniftest.yml file
|
4
|
+
#
|
5
|
+
# This is good for Rails production when assets are compiled to public/assets
|
6
|
+
# but sometimes, they're compiled to other directories (or other servers)
|
7
|
+
class YamlManifestContainer
|
8
|
+
def initialize
|
9
|
+
@assets = YAML.load_file(::Rails.root.join("public/assets/manifest.yml"))
|
10
|
+
end
|
11
|
+
|
12
|
+
def find_asset(logical_path)
|
13
|
+
asset_path = @assets[logical_path] || raise("No compiled asset for #{logical_path}, was it precompiled?")
|
14
|
+
asset_full_path = ::Rails.root.join("public", "assets", asset_path)
|
15
|
+
File.read(asset_full_path)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,251 +1,251 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul O’Shannessy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.2.2
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: codeclimate-test-reporter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
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
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coffee-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: es5-shim-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.0.5
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.0.5
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: guard-minitest
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: jbuilder
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: poltergeist
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.3.3
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.3.3
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: test-unit
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '2.5'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '2.5'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: turbolinks
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: 2.0.0
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 2.0.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: coffee-script-source
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - ~>
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '1.8'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - ~>
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '1.8'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: connection_pool
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: execjs
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: rails
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- -
|
213
|
+
- - ">="
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '3.2'
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '3.2'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: tilt
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: babel-transpiler
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
|
-
- -
|
241
|
+
- - ">="
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: 0.7.0
|
244
244
|
type: :runtime
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
|
-
- -
|
248
|
+
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: 0.7.0
|
251
251
|
description: Compile your JSX on demand or precompile for production.
|
@@ -255,8 +255,19 @@ executables: []
|
|
255
255
|
extensions: []
|
256
256
|
extra_rdoc_files: []
|
257
257
|
files:
|
258
|
+
- CHANGELOG.md
|
259
|
+
- LICENSE
|
260
|
+
- README.md
|
258
261
|
- lib/assets/javascripts/JSXTransformer.js
|
259
|
-
- lib/assets/javascripts/react_ujs.js
|
262
|
+
- lib/assets/javascripts/react_ujs.js
|
263
|
+
- lib/assets/javascripts/react_ujs_event_setup.js
|
264
|
+
- lib/assets/javascripts/react_ujs_mount.js
|
265
|
+
- lib/assets/javascripts/react_ujs_native.js
|
266
|
+
- lib/assets/javascripts/react_ujs_turbolinks.js
|
267
|
+
- lib/assets/javascripts/react_ujs_turbolinks_classic.js
|
268
|
+
- lib/assets/javascripts/react_ujs_turbolinks_classic_deprecated.js
|
269
|
+
- lib/assets/react-source/development-with-addons/react-server.js
|
270
|
+
- lib/assets/react-source/development-with-addons/react.js
|
260
271
|
- lib/assets/react-source/development/react-addons-clone-with-props.js
|
261
272
|
- lib/assets/react-source/development/react-addons-create-fragment.js
|
262
273
|
- lib/assets/react-source/development/react-addons-css-transition-group.js
|
@@ -268,8 +279,8 @@ files:
|
|
268
279
|
- lib/assets/react-source/development/react-addons-update.js
|
269
280
|
- lib/assets/react-source/development/react-server.js
|
270
281
|
- lib/assets/react-source/development/react.js
|
271
|
-
- lib/assets/react-source/
|
272
|
-
- lib/assets/react-source/
|
282
|
+
- lib/assets/react-source/production-with-addons/react-server.js
|
283
|
+
- lib/assets/react-source/production-with-addons/react.js
|
273
284
|
- lib/assets/react-source/production/react-addons-clone-with-props.js
|
274
285
|
- lib/assets/react-source/production/react-addons-create-fragment.js
|
275
286
|
- lib/assets/react-source/production/react-addons-css-transition-group.js
|
@@ -281,38 +292,33 @@ files:
|
|
281
292
|
- lib/assets/react-source/production/react-addons-update.js
|
282
293
|
- lib/assets/react-source/production/react-server.js
|
283
294
|
- lib/assets/react-source/production/react.js
|
284
|
-
- lib/assets/react-source/production-with-addons/react-server.js
|
285
|
-
- lib/assets/react-source/production-with-addons/react.js
|
286
295
|
- lib/generators/react/component_generator.rb
|
287
296
|
- lib/generators/react/install_generator.rb
|
288
297
|
- lib/generators/templates/component.es6.jsx
|
289
298
|
- lib/generators/templates/component.js.jsx
|
290
299
|
- lib/generators/templates/component.js.jsx.coffee
|
300
|
+
- lib/react-rails.rb
|
301
|
+
- lib/react/jsx.rb
|
291
302
|
- lib/react/jsx/babel_transformer.rb
|
292
303
|
- lib/react/jsx/jsx_transformer.rb
|
293
304
|
- lib/react/jsx/processor.rb
|
294
305
|
- lib/react/jsx/template.rb
|
295
|
-
- lib/react/
|
306
|
+
- lib/react/rails.rb
|
296
307
|
- lib/react/rails/asset_variant.rb
|
297
308
|
- lib/react/rails/component_mount.rb
|
298
309
|
- lib/react/rails/controller_lifecycle.rb
|
299
310
|
- lib/react/rails/controller_renderer.rb
|
300
|
-
- lib/react/rails/engine.rb
|
301
311
|
- lib/react/rails/railtie.rb
|
302
312
|
- lib/react/rails/version.rb
|
303
313
|
- lib/react/rails/view_helper.rb
|
304
|
-
- lib/react/
|
314
|
+
- lib/react/server_rendering.rb
|
305
315
|
- lib/react/server_rendering/environment_container.rb
|
306
316
|
- lib/react/server_rendering/exec_js_renderer.rb
|
307
317
|
- lib/react/server_rendering/manifest_container.rb
|
318
|
+
- lib/react/server_rendering/sprockets_renderer.rb
|
308
319
|
- lib/react/server_rendering/sprockets_renderer/console_polyfill.js
|
309
320
|
- lib/react/server_rendering/sprockets_renderer/console_replay.js
|
310
|
-
- lib/react/server_rendering/
|
311
|
-
- lib/react/server_rendering.rb
|
312
|
-
- lib/react-rails.rb
|
313
|
-
- README.md
|
314
|
-
- CHANGELOG.md
|
315
|
-
- LICENSE
|
321
|
+
- lib/react/server_rendering/yaml_manifest_container.rb
|
316
322
|
homepage: https://github.com/reactjs/react-rails
|
317
323
|
licenses:
|
318
324
|
- Apache-2.0
|
@@ -323,17 +329,17 @@ require_paths:
|
|
323
329
|
- lib
|
324
330
|
required_ruby_version: !ruby/object:Gem::Requirement
|
325
331
|
requirements:
|
326
|
-
- -
|
332
|
+
- - ">="
|
327
333
|
- !ruby/object:Gem::Version
|
328
334
|
version: '0'
|
329
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
330
336
|
requirements:
|
331
|
-
- -
|
337
|
+
- - ">="
|
332
338
|
- !ruby/object:Gem::Version
|
333
339
|
version: '0'
|
334
340
|
requirements: []
|
335
341
|
rubyforge_project:
|
336
|
-
rubygems_version: 2.
|
342
|
+
rubygems_version: 2.5.1
|
337
343
|
signing_key:
|
338
344
|
specification_version: 4
|
339
345
|
summary: React/JSX adapter for the Ruby on Rails asset pipeline.
|
data/lib/react/rails/engine.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Rails
|
3
|
-
class Engine < ::Rails::Engine
|
4
|
-
initializer "react_rails.setup_engine", :group => :all do |app|
|
5
|
-
sprockets_env = app.assets || Sprockets # Sprockets 3.x expects this in a different place
|
6
|
-
if Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new("3.0.0")
|
7
|
-
sprockets_env.register_mime_type("application/jsx", extensions: [".jsx", ".js.jsx", ".es.jsx", ".es6.jsx"])
|
8
|
-
sprockets_env.register_transformer("application/jsx", "application/javascript", React::JSX::Processor)
|
9
|
-
else
|
10
|
-
sprockets_env.register_engine(".jsx", React::JSX::Template)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|