react-rails 2.6.2 → 2.7.0.rc.0

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.
@@ -16,6 +16,19 @@ module React
16
16
  default: false,
17
17
  desc: "Don't generate server_rendering.js or config/initializers/react_server_rendering.rb"
18
18
 
19
+ # For Shakapacker below version 7, we need to set relative path for source_entry_path
20
+ def modify_webpacker_yml
21
+ webpacker_yml_path = 'config/webpacker.yml'
22
+ if webpacker? && Pathname.new(webpacker_yml_path).exist?
23
+ gsub_file(
24
+ webpacker_yml_path,
25
+ "source_entry_path: /\n",
26
+ "source_entry_path: packs\n"
27
+ )
28
+ reloaded_webpacker_config
29
+ end
30
+ end
31
+
19
32
  # Make an empty `components/` directory in the right place:
20
33
  def create_directory
21
34
  components_dir = if webpacker?
@@ -119,6 +132,11 @@ JS
119
132
  Webpacker::Configuration.source_path.join(Webpacker::Configuration.entry_path) # Webpacker <3
120
133
  end
121
134
  end
135
+
136
+ def reloaded_webpacker_config
137
+ Webpacker.instance.instance_variable_set(:@config, nil)
138
+ Webpacker.config
139
+ end
122
140
  end
123
141
  end
124
142
  end
@@ -2,6 +2,6 @@ module React
2
2
  module Rails
3
3
  # If you change this, make sure to update VERSIONS.md
4
4
  # and republish the UJS by updating package.json and `bundle exec rake ujs:publish`
5
- VERSION = '2.6.2'
5
+ VERSION = '2.7.0.rc.0'
6
6
  end
7
7
  end
data/lib/react.rb CHANGED
@@ -3,21 +3,19 @@ module React
3
3
  # @param props [Object] If it's a Hash or Array, it will be recursed. Otherwise it will be returned.
4
4
  # @return [Hash] a new hash whose keys are camelized strings
5
5
  def self.camelize_props(props)
6
- case props
6
+ props_as_json = props.as_json
7
+
8
+ case props_as_json
7
9
  when Hash
8
- props.each_with_object({}) do |(key, value), new_props|
10
+ props_as_json.each_with_object({}) do |(key, value), new_props|
9
11
  new_key = key.to_s.camelize(:lower)
10
12
  new_value = camelize_props(value)
11
13
  new_props[new_key] = new_value
12
14
  end
13
15
  when Array
14
- props.map { |item| camelize_props(item) }
16
+ props_as_json.map { |item| camelize_props(item) }
15
17
  else
16
- if defined?(ActionController::Parameters) && props.is_a?(ActionController::Parameters)
17
- camelize_props(props.to_h)
18
- else
19
- props
20
- end
18
+ props_as_json
21
19
  end
22
20
  end
23
21
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.7.0.rc.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul O’Shannessy
8
8
  - Robert Mosolgo
9
9
  - Gregory Myers
10
10
  - Tsukuru Tanimichi
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2022-04-06 00:00:00.000000000 Z
14
+ date: 2023-03-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: appraisal
@@ -223,6 +223,20 @@ dependencies:
223
223
  - - ">="
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
+ - !ruby/object:Gem::Dependency
227
+ name: turbolinks
228
+ requirement: !ruby/object:Gem::Requirement
229
+ requirements:
230
+ - - ">="
231
+ - !ruby/object:Gem::Version
232
+ version: '0'
233
+ type: :development
234
+ prerelease: false
235
+ version_requirements: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - ">="
238
+ - !ruby/object:Gem::Version
239
+ version: '0'
226
240
  - !ruby/object:Gem::Dependency
227
241
  name: connection_pool
228
242
  requirement: !ruby/object:Gem::Requirement
@@ -354,7 +368,7 @@ homepage: https://github.com/reactjs/react-rails
354
368
  licenses:
355
369
  - Apache-2.0
356
370
  metadata: {}
357
- post_install_message:
371
+ post_install_message:
358
372
  rdoc_options: []
359
373
  require_paths:
360
374
  - lib
@@ -365,12 +379,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
365
379
  version: '0'
366
380
  required_rubygems_version: !ruby/object:Gem::Requirement
367
381
  requirements:
368
- - - ">="
382
+ - - ">"
369
383
  - !ruby/object:Gem::Version
370
- version: '0'
384
+ version: 1.3.1
371
385
  requirements: []
372
- rubygems_version: 3.1.6
373
- signing_key:
386
+ rubygems_version: 3.4.6
387
+ signing_key:
374
388
  specification_version: 4
375
389
  summary: React integration for Ruby on Rails
376
390
  test_files: []