react_on_rails 16.2.1 → 16.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd0ac542bd8bc80fc8602e2b7ce897edc7b9dd864cd102bf531e1f9c432bb1dc
4
- data.tar.gz: 81673108213bd8e36d8531a7d5545b8c376c8cd42533477c0eed1e38bed561a1
3
+ metadata.gz: 8d25a07c961a82f41437cf2de3d8af33de4140a5fdae17bf450517186e0bfc6c
4
+ data.tar.gz: a977b2cd5e558f38722e3ee44b07a81e02575adcfa294931fcea6bbe40423a1c
5
5
  SHA512:
6
- metadata.gz: d1bbe18ba87244c4f2d500732b933ffac75be9abdc5867b2153d306efa227aa4e3c2a139998fa2b64ce17a2b26a7ea29004d4e36f2d94e6488aae39e354da3be
7
- data.tar.gz: d2119ca0445b5a99f02c9f935f5842b3c54b9e10c29fdf3533a8dc42b1ca7369d6703fe39e58e1327adabb3350a1d85321576112ba02abe44e96fcf45a716be7
6
+ metadata.gz: f39b1dc343e724210bedb948f41e4607707cb2e3269d1594f71d757031fd6b49f9867b252f6b247b1cdfc15e14f8963f83563ec8be03712decb419f16b7caa3d
7
+ data.tar.gz: a3e26f3e4be5fcebf786ac4873d81d4969acd5ecbad98375885bf2e754117f3dc065d6bdddb1fef9964106835187f75c9710410c37e21647c5681a8d37759118
@@ -2,7 +2,7 @@
2
2
 
3
3
  eval_gemfile File.expand_path("../Gemfile.shared_dev_dependencies", __dir__)
4
4
 
5
- gem "shakapacker", "9.4.0"
5
+ gem "shakapacker", "9.5.0"
6
6
  gem "bootsnap", require: false
7
7
  gem "rails", "~> 7.1.0"
8
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- react_on_rails (16.2.1)
4
+ react_on_rails (16.3.0.rc.0)
5
5
  addressable
6
6
  connection_pool
7
7
  execjs (~> 2.5)
@@ -96,7 +96,7 @@ GEM
96
96
  amazing_print (1.6.0)
97
97
  ast (2.4.2)
98
98
  base64 (0.3.0)
99
- benchmark (0.4.1)
99
+ benchmark (0.5.0)
100
100
  bigdecimal (4.0.1)
101
101
  bootsnap (1.18.3)
102
102
  msgpack (~> 1.2)
@@ -202,7 +202,7 @@ GEM
202
202
  net-smtp (0.5.1)
203
203
  net-protocol
204
204
  nio4r (2.7.5)
205
- nokogiri (1.18.10)
205
+ nokogiri (1.19.0)
206
206
  mini_portile2 (~> 2.8.2)
207
207
  racc (~> 1.4)
208
208
  ostruct (0.6.1)
@@ -214,7 +214,7 @@ GEM
214
214
  pp (0.6.3)
215
215
  prettyprint
216
216
  prettyprint (0.2.0)
217
- prism (1.7.0)
217
+ prism (1.8.0)
218
218
  pry (0.14.2)
219
219
  coderay (~> 1.1)
220
220
  method_source (~> 1.0)
@@ -284,7 +284,7 @@ GEM
284
284
  ffi (~> 1.0)
285
285
  rbs (3.9.5)
286
286
  logger
287
- rdoc (7.0.3)
287
+ rdoc (7.1.0)
288
288
  erb
289
289
  psych (>= 4.0.0)
290
290
  tsort
@@ -360,7 +360,7 @@ GEM
360
360
  rubyzip (>= 1.2.2, < 3.0)
361
361
  websocket (~> 1.0)
362
362
  semantic_range (3.1.0)
363
- shakapacker (9.4.0)
363
+ shakapacker (9.5.0)
364
364
  activesupport (>= 5.2)
365
365
  package_json
366
366
  rack-proxy (>= 0.6.1)
@@ -404,7 +404,7 @@ GEM
404
404
  tins (~> 1.0)
405
405
  terminal-table (3.0.2)
406
406
  unicode-display_width (>= 1.1.1, < 3)
407
- thor (1.4.0)
407
+ thor (1.5.0)
408
408
  tilt (2.3.0)
409
409
  timeout (0.6.0)
410
410
  tins (1.33.0)
@@ -478,7 +478,7 @@ DEPENDENCIES
478
478
  sass-rails (~> 6.0)
479
479
  sdoc
480
480
  selenium-webdriver (= 4.9.0)
481
- shakapacker (= 9.4.0)
481
+ shakapacker (= 9.5.0)
482
482
  spring (~> 4.0)
483
483
  sprockets (~> 4.0)
484
484
  sqlite3 (~> 1.6)
@@ -328,11 +328,6 @@ module ReactOnRails
328
328
  "shakapacker.yml private_output_path: '#{relative_path}'")
329
329
  end
330
330
 
331
- def check_minimum_shakapacker_version
332
- ReactOnRails::PackerUtils.raise_shakapacker_version_incompatible_for_basic_pack_generation unless
333
- ReactOnRails::PackerUtils.supports_basic_pack_generation?
334
- end
335
-
336
331
  def check_autobundling_requirements
337
332
  raise_missing_components_subdirectory unless components_subdirectory.present?
338
333
 
@@ -148,13 +148,17 @@ module ReactOnRails
148
148
  puts help_troubleshooting
149
149
  end
150
150
 
151
+ # Flags that take a value as the next argument (not using = syntax)
152
+ FLAGS_WITH_VALUES = %w[--route --rails-env].freeze
153
+
151
154
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
152
155
  def run_from_command_line(args = ARGV)
153
156
  require "optparse"
154
157
 
155
158
  # Get the command early to check for help/kill before running hooks
156
159
  # We need to do this before OptionParser processes flags like -h/--help
157
- command = args.find { |arg| !arg.start_with?("--") && !arg.start_with?("-") }
160
+ # Skip arguments that are values for flags (e.g., "hello_world" after "--route")
161
+ command = extract_command_from_args(args)
158
162
 
159
163
  # Check if help flags are present in args (before OptionParser processes them)
160
164
  help_requested = args.any? { |arg| HELP_FLAGS.include?(arg) }
@@ -215,6 +219,32 @@ module ReactOnRails
215
219
 
216
220
  private
217
221
 
222
+ # Extract the command from args, skipping flag values
223
+ # For example, in ["--route", "hello_world"], "hello_world" is a flag value, not a command
224
+ # But in ["static", "--route", "hello_world"], "static" is the command
225
+ def extract_command_from_args(args)
226
+ skip_next = false
227
+ args.each do |arg|
228
+ if skip_next
229
+ skip_next = false
230
+ next
231
+ end
232
+
233
+ # Check if this flag takes a value as the next argument
234
+ if FLAGS_WITH_VALUES.include?(arg)
235
+ skip_next = true
236
+ next
237
+ end
238
+
239
+ # Skip any flag (starts with - or --)
240
+ next if arg.start_with?("-")
241
+
242
+ # Found a non-flag, non-value argument - this is the command
243
+ return arg
244
+ end
245
+ nil
246
+ end
247
+
218
248
  def run_precompile_hook_if_present
219
249
  require "open3"
220
250
  require "shellwords"
@@ -36,10 +36,6 @@ module ReactOnRails
36
36
  shakapacker_version_requirement_met?("8.2.0")
37
37
  end
38
38
 
39
- def self.supports_basic_pack_generation?
40
- shakapacker_version_requirement_met?(ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION)
41
- end
42
-
43
39
  def self.supports_autobundling?
44
40
  min_version = ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_BUNDLING
45
41
  ::Shakapacker.config.respond_to?(:nested_entries?) && shakapacker_version_requirement_met?(min_version)
@@ -149,19 +145,10 @@ module ReactOnRails
149
145
 
150
146
  def self.raise_shakapacker_version_incompatible_for_autobundling
151
147
  msg = <<~MSG
152
- **ERROR** ReactOnRails: Please upgrade ::Shakapacker to version #{ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_BUNDLING} or \
153
- above to use the automated bundle generation feature (which requires nested_entries support). \
154
- The currently installed version is #{ReactOnRails::PackerUtils.shakapacker_version}. \
155
- Basic pack generation requires ::Shakapacker #{ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION} or above.
156
- MSG
148
+ **ERROR** ReactOnRails: Automated bundle generation requires Shakapacker >= #{ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_BUNDLING} (for nested_entries support).
149
+ Installed version: #{ReactOnRails::PackerUtils.shakapacker_version}
157
150
 
158
- raise ReactOnRails::Error, msg
159
- end
160
-
161
- def self.raise_shakapacker_version_incompatible_for_basic_pack_generation
162
- msg = <<~MSG
163
- **ERROR** ReactOnRails: Please upgrade ::Shakapacker to version #{ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION} or \
164
- above to use basic pack generation features. The currently installed version is #{ReactOnRails::PackerUtils.shakapacker_version}.
151
+ To fix: Upgrade Shakapacker, or set `auto_load_bundle: false` in your ReactOnRails configuration.
165
152
  MSG
166
153
 
167
154
  raise ReactOnRails::Error, msg
@@ -8,8 +8,8 @@ module ReactOnRails
8
8
  class PacksGenerator
9
9
  CONTAINS_CLIENT_OR_SERVER_REGEX = /\.(server|client)($|\.)/
10
10
  COMPONENT_EXTENSIONS = /\.(jsx?|tsx?)$/
11
- MINIMUM_SHAKAPACKER_VERSION = "6.5.1"
12
11
  # Auto-registration requires nested_entries support which was added in 7.0.0
12
+ # Note: The gemspec requires Shakapacker >= 6.0 for basic functionality
13
13
  MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_BUNDLING = "7.0.0"
14
14
 
15
15
  def self.instance
@@ -252,18 +252,14 @@ module ReactOnRails
252
252
  end
253
253
 
254
254
  # Checks if React on Rails Pro is installed and licensed.
255
- # This method validates the license and will raise an exception if invalid.
255
+ # Checks if React on Rails Pro gem is installed
256
+ # Note: This only checks gem presence, not license validity
256
257
  #
257
- # @return [Boolean] true if Pro is available with valid license
258
- # @raise [ReactOnRailsPro::Error] if license is invalid
258
+ # @return [Boolean] true if Pro gem is available
259
259
  def self.react_on_rails_pro?
260
260
  return @react_on_rails_pro if defined?(@react_on_rails_pro)
261
261
 
262
- @react_on_rails_pro = begin
263
- return false unless gem_available?("react_on_rails_pro")
264
-
265
- ReactOnRailsPro::Utils.validated_license_data!.present?
266
- end
262
+ @react_on_rails_pro = gem_available?("react_on_rails_pro")
267
263
  end
268
264
 
269
265
  # Return an empty string if React on Rails Pro is not installed
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "16.2.1"
4
+ VERSION = "16.3.0.rc.0"
5
5
  end
@@ -27,9 +27,6 @@ module ReactOnRails
27
27
  MINIMUM_SUPPORTED_REACT_MAJOR_VERSION = "16"
28
28
  LATEST_REACT_MAJOR_VERSION = "19"
29
29
 
30
- # Minimum Shakapacker version for compatibility testing
31
- MINIMUM_SHAKAPACKER_VERSION = "8.2.0"
32
-
33
30
  attr_reader :packer_type, :name, :generator_options, :react_version
34
31
 
35
32
  # Returns true if this example uses a pinned (non-latest) React version
@@ -79,7 +79,6 @@ namespace :run_rspec do
79
79
 
80
80
  # Dynamically define Rake tasks for each example app found in the examples directory
81
81
  ExampleType.all[:shakapacker_examples].each do |example_type|
82
- puts "Creating #{example_type.rspec_task_name} task"
83
82
  desc "Runs RSpec for #{example_type.name_pretty} only"
84
83
  task example_type.rspec_task_name_short => example_type.gen_task_name do
85
84
  # Use unbundled mode for pinned React version examples to ensure the example app's
@@ -115,12 +114,12 @@ namespace :run_rspec do
115
114
  ExampleType.all[:shakapacker_examples].select(&:pinned_react_version?)
116
115
  end
117
116
 
118
- desc "Runs Rspec for latest version example apps only (React 19, Shakapacker 9.x)"
117
+ desc "Runs Rspec for latest version example apps only (React 19)"
119
118
  task shakapacker_examples_latest: latest_examples.map(&:gen_task_name) do
120
119
  latest_examples.each { |example_type| Rake::Task[example_type.rspec_task_name].invoke }
121
120
  end
122
121
 
123
- desc "Runs Rspec for React 18 example apps only (Shakapacker 8.2.0)"
122
+ desc "Runs Rspec for React 18 example apps only"
124
123
  task shakapacker_examples_react18: react18_examples.map(&:gen_task_name) do
125
124
  react18_examples.each { |example_type| Rake::Task[example_type.rspec_task_name].invoke }
126
125
  end
@@ -24,15 +24,6 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
24
24
  deps["react-dom"] = react_version
25
25
  end
26
26
 
27
- # Updates Shakapacker to minimum supported version in either dependencies or devDependencies
28
- def update_shakapacker_dependency(deps, dev_deps)
29
- if dev_deps&.key?("shakapacker")
30
- dev_deps["shakapacker"] = ExampleType::MINIMUM_SHAKAPACKER_VERSION
31
- elsif deps&.key?("shakapacker")
32
- deps["shakapacker"] = ExampleType::MINIMUM_SHAKAPACKER_VERSION
33
- end
34
- end
35
-
36
27
  # Updates dependencies in package.json to use specific React version
37
28
  def update_package_json_for_react_version(package_json_path, react_version)
38
29
  return unless File.exist?(package_json_path)
@@ -57,7 +48,6 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
57
48
  # @babel/plugin-transform-runtime is required by the default babel config but not
58
49
  # automatically included as a dependency in older Shakapacker versions
59
50
  dev_deps["@babel/plugin-transform-runtime"] = "^7.24.0" if dev_deps
60
- update_shakapacker_dependency(deps, dev_deps)
61
51
 
62
52
  # Add npm overrides to force specific React version, preventing yalc-linked
63
53
  # react-on-rails from pulling in React 19 as a transitive dependency
@@ -69,32 +59,12 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
69
59
  File.write(package_json_path, "#{JSON.pretty_generate(package_json)}\n")
70
60
  end
71
61
 
72
- # Updates Gemfile to pin shakapacker to minimum version
73
- # (must match the npm package version exactly)
74
- def update_gemfile_versions(gemfile_path)
75
- return unless File.exist?(gemfile_path)
76
-
77
- gemfile_content = File.read(gemfile_path)
78
- # Replace any shakapacker gem line with exact version pin
79
- # Handle both single-line: gem 'shakapacker', '>= 8.2.0'
80
- # And multi-line declarations:
81
- # gem 'shakapacker',
82
- # '>= 8.2.0'
83
- gemfile_content = gemfile_content.gsub(
84
- /gem ['"]shakapacker['"][^\n]*(?:\n\s+[^g\n][^\n]*)*$/m,
85
- "gem 'shakapacker', '#{ExampleType::MINIMUM_SHAKAPACKER_VERSION}'"
86
- )
87
- File.write(gemfile_path, gemfile_content)
88
- end
89
-
90
62
  # Updates package.json and Gemfile to use specific React version for compatibility testing
91
63
  def apply_react_version(dir, react_version)
92
64
  update_package_json_for_react_version(File.join(dir, "package.json"), react_version)
93
- update_gemfile_versions(File.join(dir, "Gemfile"))
94
65
 
95
66
  puts " Updated package.json for compatibility testing:"
96
67
  puts " React: #{react_version}"
97
- puts " Shakapacker: #{ExampleType::MINIMUM_SHAKAPACKER_VERSION}"
98
68
  end
99
69
 
100
70
  # Define tasks for each example type
@@ -115,9 +85,7 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
115
85
  sh_in_dir(example_type.dir, "touch .gitignore")
116
86
  sh_in_dir(example_type.dir,
117
87
  "echo \"gem 'react_on_rails', path: '#{relative_gem_root}'\" >> #{example_type.gemfile}")
118
- # Pin to 9.4.0 to ensure gem and npm package versions match
119
- # (shakapacker 9.5.0 gem was released but npm package version detection has issues)
120
- sh_in_dir(example_type.dir, "echo \"gem 'shakapacker', '9.4.0'\" >> #{example_type.gemfile}")
88
+ # Shakapacker is automatically included as a dependency via react_on_rails.gemspec (>= 6.0)
121
89
  bundle_install_in(example_type.dir)
122
90
  sh_in_dir(example_type.dir, "rake shakapacker:install")
123
91
  # Skip validation when running generators on example apps during development.
@@ -136,7 +104,7 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
136
104
  # Apply specific React version for compatibility testing examples
137
105
  if example_type.pinned_react_version?
138
106
  apply_react_version(example_type.dir, example_type.react_version_string)
139
- # Re-run bundle install since Gemfile was updated with pinned shakapacker version
107
+ # Re-run bundle install to ensure dependencies are resolved correctly
140
108
  bundle_install_in(example_type.dir)
141
109
  # Run npm install BEFORE shakapacker:binstubs to ensure the npm shakapacker version
142
110
  # matches the gem version. The binstubs task loads the Rails environment which
@@ -32,6 +32,8 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency "execjs", "~> 2.5"
33
33
  s.add_dependency "rails", ">= 5.2"
34
34
  s.add_dependency "rainbow", "~> 3.0"
35
+ # Minimum 6.0 for base compatibility; auto_load_bundle feature requires >= 7.0
36
+ # (see PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_BUNDLING)
35
37
  s.add_dependency "shakapacker", ">= 6.0"
36
38
 
37
39
  s.add_development_dependency "gem-release"
@@ -79,7 +79,6 @@ module ReactOnRails
79
79
  def check_component_registry_timeout: () -> void
80
80
  def validate_generated_component_packs_loading_strategy: () -> void
81
81
  def validate_enforce_private_server_bundles: () -> void
82
- def check_minimum_shakapacker_version: () -> void
83
82
  def check_autobundling_requirements: () -> void
84
83
  def adjust_precompile_task: () -> void
85
84
  def error_if_using_packer_and_generated_assets_dir_not_match_public_output_path: () -> void
@@ -1,7 +1,6 @@
1
1
  module ReactOnRails
2
2
  module PackerUtils
3
3
  def self.supports_autobundling?: () -> bool
4
- def self.supports_basic_pack_generation?: () -> bool
5
4
  def self.supports_async_loading?: () -> bool
6
5
  def self.nested_entries?: () -> bool
7
6
  def self.packer_public_output_path: () -> String
@@ -9,7 +8,6 @@ module ReactOnRails
9
8
  def self.shakapacker_precompile_hook_configured?: () -> bool
10
9
  def self.shakapacker_precompile_hook_value: () -> String
11
10
  def self.raise_shakapacker_version_incompatible_for_autobundling: () -> void
12
- def self.raise_shakapacker_version_incompatible_for_basic_pack_generation: () -> void
13
11
  def self.raise_nested_entries_disabled: () -> void
14
12
  end
15
13
  end
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: 16.2.1
4
+ version: 16.3.0.rc.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-18 00:00:00.000000000 Z
11
+ date: 2026-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable