react_on_rails 11.0.5 → 11.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +6 -7
- data/lib/react_on_rails.rb +2 -0
- data/lib/react_on_rails/json_parse_error.rb +26 -0
- data/lib/react_on_rails/prerender_error.rb +13 -10
- data/lib/react_on_rails/react_component/render_options.rb +3 -1
- data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +8 -3
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e83dc63e255b12add1db7f16fa2ae9c8ee21f8d
|
4
|
+
data.tar.gz: e771480790081124a2673330cda45802e11ea15d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c3da1497f3990327569b93d578d8cc992f222dcb1a2be1c859abf2b4df37afbe960f5242fb567b861cf55339e2affe3d45c776124b9586de05a93020e5bf8f2
|
7
|
+
data.tar.gz: 37ab5c553e1adca77bc00a5c99832ebffbaa6c64b40aaed12023abe8e89351cf03a6c479502f43ce504526bb940a3aecde21bbd687c9f2b0acb791b0824e13b7
|
data/CHANGELOG.md
CHANGED
@@ -12,6 +12,9 @@ Changes since last non-beta release.
|
|
12
12
|
|
13
13
|
#### Changed
|
14
14
|
|
15
|
+
### [11.0.6] - 2018-05-11
|
16
|
+
- Even more detailed errors for Honeybadger and Sentry when there's a JSON parse error on server rendering. [PR 1086](https://github.com/shakacode/react_on_rails/pull/1086) by [justin808](https://github.com/justin808).
|
17
|
+
|
15
18
|
### [11.0.5] - 2018-05-11
|
16
19
|
- More detailed errors for Honeybadger and Sentry. [PR 1081](https://github.com/shakacode/react_on_rails/pull/1081) by [justin808](https://github.com/justin808).
|
17
20
|
|
@@ -758,7 +761,8 @@ Best done with Object destructing:
|
|
758
761
|
##### Fixed
|
759
762
|
- Fix several generator related issues.
|
760
763
|
|
761
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/11.0.
|
764
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/11.0.6...master
|
765
|
+
[11.0.6]: https://github.com/shakacode/react_on_rails/compare/11.0.5...11.0.6
|
762
766
|
[11.0.5]: https://github.com/shakacode/react_on_rails/compare/11.0.4...11.0.5
|
763
767
|
[11.0.4]: https://github.com/shakacode/react_on_rails/compare/11.0.3...11.0.4
|
764
768
|
[11.0.3]: https://github.com/shakacode/react_on_rails/compare/11.0.2...11.0.3
|
data/README.md
CHANGED
@@ -2,17 +2,16 @@
|
|
2
2
|
|
3
3
|
*If this projects helps you, please give us a star!*
|
4
4
|
|
5
|
-
## Need Help with Rails + Webpack + React? Want better performance?
|
5
|
+
## Need Help with Rails + Webpack v4 + React? Want better performance?
|
6
6
|
Aloha, I'm Justin Gordon the creator and maintainer of React on Rails. I offer a [React on Rails Pro Support Plan](http://www.shakacode.com/work/shakacode-pro-support.pdf), and I can help you with:
|
7
|
-
* Optimizing your webpack setup for React on Rails.
|
8
|
-
* Upgrading from older React on Rails to newer versions
|
7
|
+
* Optimizing your webpack setup to Webpack v4 for React on Rails.
|
8
|
+
* Upgrading from older React on Rails to newer versions (are using using the new Webpacker setup that avoids the asset pipeline?)
|
9
9
|
* Better performance client and server side.
|
10
|
-
*
|
10
|
+
* Efficiently migrating from Angular to React.
|
11
11
|
* Best practices based on 4 years of React on Rails experience.
|
12
12
|
* Early access to the React on Rails Pro Gem and Node code, including:
|
13
|
-
* ShakaCode's Node.js rendering server for better performance for server rendering (
|
14
|
-
* Performance helpers, especially for server rendering
|
15
|
-
* Webpack configuration examples
|
13
|
+
* ShakaCode's Node.js rendering server for better performance for server rendering (live at [egghead.io](https://egghead.io/)).
|
14
|
+
* Performance caching helpers, especially for server rendering
|
16
15
|
|
17
16
|
Please [email me](mailto:justin@shakacode.com) for a free half-hour project consultation, on anything from React on Rails to any aspect of web development.
|
18
17
|
|
data/lib/react_on_rails.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module ReactOnRails
|
2
|
+
class JsonParseError < ::ReactOnRails::Error
|
3
|
+
attr_reader :json
|
4
|
+
|
5
|
+
def initialize(parse_error, json)
|
6
|
+
@json = json
|
7
|
+
@original_error = parse_error
|
8
|
+
super(parse_error.message)
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_honeybadger_context
|
12
|
+
to_error_context
|
13
|
+
end
|
14
|
+
|
15
|
+
def raven_context
|
16
|
+
to_error_context
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_error_context
|
20
|
+
{
|
21
|
+
original_error: @original_error,
|
22
|
+
json: @json
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -27,6 +27,19 @@ module ReactOnRails
|
|
27
27
|
to_error_context
|
28
28
|
end
|
29
29
|
|
30
|
+
def to_error_context
|
31
|
+
result = {
|
32
|
+
component_name: component_name,
|
33
|
+
err: err,
|
34
|
+
props: props,
|
35
|
+
js_code: js_code,
|
36
|
+
console_messages: console_messages
|
37
|
+
}
|
38
|
+
|
39
|
+
result.merge!(err.to_error_context) if err.respond_to?(:to_error_context)
|
40
|
+
result
|
41
|
+
end
|
42
|
+
|
30
43
|
private
|
31
44
|
|
32
45
|
def calc_message(component_name, console_messages, err, js_code, props)
|
@@ -59,15 +72,5 @@ console messages:
|
|
59
72
|
end
|
60
73
|
[backtrace, message]
|
61
74
|
end
|
62
|
-
|
63
|
-
def to_error_context
|
64
|
-
{
|
65
|
-
component_name: component_name,
|
66
|
-
err: err,
|
67
|
-
props: props,
|
68
|
-
js_code: js_code,
|
69
|
-
console_messages: console_messages
|
70
|
-
}
|
71
|
-
end
|
72
75
|
end
|
73
76
|
end
|
@@ -7,6 +7,8 @@ module ReactOnRails
|
|
7
7
|
class RenderOptions
|
8
8
|
include Utils::Required
|
9
9
|
|
10
|
+
attr_accessor :request_digest
|
11
|
+
|
10
12
|
NO_PROPS = {}.freeze
|
11
13
|
|
12
14
|
def initialize(react_component_name: required("react_component_name"), options: required("options"))
|
@@ -49,7 +51,7 @@ module ReactOnRails
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def to_s
|
52
|
-
"{ react_component_name = #{react_component_name}, options = #{options}"
|
54
|
+
"{ react_component_name = #{react_component_name}, options = #{options}, request_digest = #{request_digest}"
|
53
55
|
end
|
54
56
|
|
55
57
|
private
|
@@ -47,8 +47,13 @@ module ReactOnRails
|
|
47
47
|
"tmp/server-generated-#{@file_index % 10}.js")
|
48
48
|
@file_index += 1
|
49
49
|
end
|
50
|
-
json_string = js_evaluator.eval_js(js_code)
|
51
|
-
result =
|
50
|
+
json_string = js_evaluator.eval_js(js_code, render_options)
|
51
|
+
result = nil
|
52
|
+
begin
|
53
|
+
result = JSON.parse(json_string)
|
54
|
+
rescue JSON::ParserError => e
|
55
|
+
raise ReactOnRails::JsonParseError.new(e, json_string)
|
56
|
+
end
|
52
57
|
|
53
58
|
if render_options.logging_on_server
|
54
59
|
console_script = result["consoleReplayScript"]
|
@@ -82,7 +87,7 @@ module ReactOnRails
|
|
82
87
|
end
|
83
88
|
end
|
84
89
|
|
85
|
-
def eval_js(js_code)
|
90
|
+
def eval_js(js_code, _render_options)
|
86
91
|
@js_context_pool.with do |js_context|
|
87
92
|
result = js_context.eval(js_code)
|
88
93
|
js_context.eval("console.history = []")
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.0.
|
4
|
+
version: 11.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -436,6 +436,7 @@ files:
|
|
436
436
|
- lib/react_on_rails/error.rb
|
437
437
|
- lib/react_on_rails/git_utils.rb
|
438
438
|
- lib/react_on_rails/json_output.rb
|
439
|
+
- lib/react_on_rails/json_parse_error.rb
|
439
440
|
- lib/react_on_rails/locales_to_js.rb
|
440
441
|
- lib/react_on_rails/prerender_error.rb
|
441
442
|
- lib/react_on_rails/react_component/render_options.rb
|
@@ -497,7 +498,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
497
498
|
version: '0'
|
498
499
|
requirements: []
|
499
500
|
rubyforge_project:
|
500
|
-
rubygems_version: 2.6.
|
501
|
+
rubygems_version: 2.6.13
|
501
502
|
signing_key:
|
502
503
|
specification_version: 4
|
503
504
|
summary: Rails with react server rendering with webpack.
|