react_on_rails 17.2.0.rc.1 → 17.2.0.rc.2

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: 69798d53f8e79c799ad30c0910568deb5ff1f7e8308840960e72ae4dc59a112e
4
- data.tar.gz: 8fe2437d15ab95544e9d6165429789b72bc42721333c1fcd90283ad274e4afec
3
+ metadata.gz: 9e693369dbaeba45ae43c510dfffae96a539f54ef55187d0fe3e3a29aee2a864
4
+ data.tar.gz: 6f73358fad45c5826b671ff7efcb3e1dbdd5a916b1659bd964df9db8a680a719
5
5
  SHA512:
6
- metadata.gz: e67061bd03e02f6457e40d8d6a686e5ae02c315e594f4843c8b79892aab0c3fe402bb5690f3430dcff07a3d6b4ab1f8deb4085f3824b7c97ee59601cd3d46f4a
7
- data.tar.gz: 97fa89ad907a46fe4ba3b6ae1eaab139015bd7708a5413b39867960ec89932b5a109e47e86d4d4aa27d7e4d0299cd19d63a0c3d95992c4b29eaa50c827a675a2
6
+ metadata.gz: 8efb2839f33b03bea64098bdee605ccb70e6432511f07dda175ee8d9586121411af470c0c0f197238b2be850975521739edc58c35dd211c981f32e929a8a224d
7
+ data.tar.gz: e38c214f95d69aebecdab18058c6c3e3ae2fd04cba40daa262e098a59e3caee84558c204e684a99b36abedca27e140f702b9d7bdfa830d485b2c926ca300b351
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- react_on_rails (17.2.0.rc.1)
4
+ react_on_rails (17.2.0.rc.2)
5
5
  addressable
6
6
  connection_pool
7
7
  execjs (~> 2.5)
@@ -145,23 +145,25 @@ module ReactOnRails
145
145
  ].freeze
146
146
 
147
147
  # React Server Components dependencies (only installed when --rsc flag is used)
148
- # Requires React 19.2.x with patch >= 19.2.7 - see https://react.dev/reference/rsc/server-components
148
+ # Requires the React line that matches the pinned package - see https://react.dev/reference/rsc/server-components
149
149
  RSC_DEPENDENCIES = %w[
150
150
  react-on-rails-rsc
151
151
  ].freeze
152
152
 
153
153
  # React peer-dependency range for generated RSC apps. This governs the `react` / `react-dom`
154
- # installs (see add_react_dependencies) and intentionally stays on the React 19.2.x line
155
- # with a 19.2.7 minimum. Do not widen this to later minors just because those releases are
156
- # current on npm; React's RSC runtime and bundler integration can change between minors.
154
+ # installs (see add_react_dependencies) and stays on the single React minor that the pinned
155
+ # `react-on-rails-rsc` package bundles Flight for: 19.3.1 peers on React ^19.3.0. Do not widen
156
+ # this to later minors just because those releases are current on npm; React's RSC runtime and
157
+ # bundler integration can change between minors. Move it together with RSC_PACKAGE_VERSION_PIN.
157
158
  #
158
159
  # This is intentionally distinct from RSC_PACKAGE_VERSION_PIN below, which pins
159
160
  # `react-on-rails-rsc`. Coordination note for #3609: Pro package metadata and generated apps
160
- # use the tested React 19.2.x range with the exact stable RSC package pin.
161
- RSC_REACT_VERSION_RANGE = "~19.2.7"
162
- # Pinned to the stable 19.2.1 package, which carries the coordinated React 19.2.7 RSC peer floor
163
- # required by the React on Rails Pro 17 runtime check.
164
- RSC_PACKAGE_VERSION_PIN = "19.2.1"
161
+ # use the tested React range with the exact stable RSC package pin.
162
+ RSC_REACT_VERSION_RANGE = "~19.3.0"
163
+ # Pinned to the stable 19.3.1 package, the current React 19.3 line. Apps generated by earlier
164
+ # versions keep their own pins (19.2.x with React 19.2.7+, or 19.3.0 with React 19.2.8+), which
165
+ # the React on Rails Pro 17 runtime check still supports.
166
+ RSC_PACKAGE_VERSION_PIN = "19.3.1"
165
167
 
166
168
  private
167
169
 
@@ -254,8 +256,8 @@ module ReactOnRails
254
256
  def add_react_dependencies
255
257
  say "Installing React dependencies..."
256
258
 
257
- # RSC requires the coordinated React 19.2.x patch line.
258
- # Pin React to ~19.2.7 while using the matching stable RSC package.
259
+ # RSC requires the React line that matches the pinned RSC package.
260
+ # Pin React to RSC_REACT_VERSION_RANGE while using the matching stable RSC package.
259
261
  react_deps = if respond_to?(:use_rsc?) && use_rsc?
260
262
  ["react@#{RSC_REACT_VERSION_RANGE}", "react-dom@#{RSC_REACT_VERSION_RANGE}",
261
263
  "prop-types@^15.0.0"]
@@ -35,6 +35,7 @@ module ReactOnRails
35
35
  RSC_FALLBACK_LAYOUT_NAME = "react_on_rails_rsc"
36
36
  RSC_GENERATED_LAYOUT_NAME_PATTERN = /\Areact_on_rails_rsc(?:_(?:[2-9]|[1-9]\d+))?\z/
37
37
  RSC_REACT_VERSION_RANGE = ReactOnRails::Generators::JsDependencyManager::RSC_REACT_VERSION_RANGE
38
+ RSC_PACKAGE_VERSION_PIN = ReactOnRails::Generators::JsDependencyManager::RSC_PACKAGE_VERSION_PIN
38
39
  RSC_MINIMUM_REACT_VERSION = RSC_REACT_VERSION_RANGE.sub(/\A[~^]/, "")
39
40
  RSC_MINIMUM_REACT_VERSION_TUPLE = RSC_MINIMUM_REACT_VERSION.split(".").map(&:to_i).freeze
40
41
  RSC_SUPPORTED_REACT_MAJOR = RSC_MINIMUM_REACT_VERSION_TUPLE.fetch(0)
@@ -88,12 +89,14 @@ module ReactOnRails
88
89
  GeneratorMessages.add_warning(<<~MSG.strip)
89
90
  ⚠️ RSC requires React #{RSC_SUPPORTED_REACT_LINE} (detected: #{react_version})
90
91
 
91
- React Server Components in React on Rails Pro currently only supports
92
- React #{RSC_SUPPORTED_REACT_LINE} with patch >= #{RSC_MINIMUM_REACT_VERSION}. Other React minor versions are
93
- not yet supported.
92
+ This generator installs react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN}, which requires
93
+ React #{RSC_SUPPORTED_REACT_LINE} with patch >= #{RSC_MINIMUM_REACT_VERSION}. The React on Rails Pro node renderer refuses
94
+ to start when React and react-on-rails-rsc are on different lines.
94
95
 
95
96
  To install a compatible React version:
96
97
  #{manual_add_packages_command(["react@#{RSC_REACT_VERSION_RANGE}", "react-dom@#{RSC_REACT_VERSION_RANGE}"])}
98
+
99
+ Run `bundle exec rake react_on_rails:doctor` afterwards to confirm the pairing.
97
100
  MSG
98
101
  elsif patch < RSC_MINIMUM_REACT_PATCH
99
102
  GeneratorMessages.add_warning(<<~MSG.strip)
@@ -102,7 +105,7 @@ module ReactOnRails
102
105
  Please upgrade to at least React #{RSC_MINIMUM_REACT_VERSION}:
103
106
  #{manual_add_packages_command(["react@#{RSC_MINIMUM_REACT_VERSION}", "react-dom@#{RSC_MINIMUM_REACT_VERSION}"])}
104
107
 
105
- react-on-rails-rsc 19.2.x with patch >= 19.2.1 is coordinated with
108
+ react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN} is coordinated with
106
109
  React/React DOM #{RSC_MINIMUM_REACT_VERSION}+ for the React on Rails Pro 17 RSC runtime.
107
110
  MSG
108
111
  end
@@ -5070,7 +5070,7 @@ module ReactOnRails
5070
5070
  # Each row covers react-on-rails-rsc patches rsc_min_patch..rsc_max_patch (nil = open-ended)
5071
5071
  # on rsc_minor. React must match the Flight line the RSC package bundles:
5072
5072
  # 19.2.x ships Flight 19.2, published 19.3.0 ships Flight 19.2.8 (React on Rails 17.1.0),
5073
- # and 19.3.1+ (starting with 19.3.1-rc.0) ships Flight 19.3.0.
5073
+ # and 19.3.1+ ships Flight 19.3.0. Only stable react-on-rails-rsc releases are supported.
5074
5074
  RSC_REACT_SUPPORT_RANGES = [
5075
5075
  { rsc_minor: 2, rsc_min_patch: 1, rsc_max_patch: nil, minor: 2, min_patch: 7 },
5076
5076
  { rsc_minor: 3, rsc_min_patch: 0, rsc_max_patch: 0, minor: 2, min_patch: 8 },
@@ -5084,9 +5084,10 @@ module ReactOnRails
5084
5084
  min_patch.positive? ? "#{line} starting at #{RSC_SUPPORTED_PACKAGE_MAJOR}.#{minor}.#{min_patch}" : line
5085
5085
  end.join(" or ")
5086
5086
  RSC_PACKAGE_INSTALL_VERSION = ReactOnRails::Generators::JsDependencyManager::RSC_PACKAGE_VERSION_PIN
5087
- # Admits the 19.3.1-rc.x soak. The generator pin stays on stable 19.2.1.
5088
- # Remove once react-on-rails-rsc 19.3.1 ships stable.
5089
- RSC_MINIMUM_PACKAGE_PRERELEASE_VERSION = "19.3.1-rc.0"
5087
+ # Rejected prerelease lines with a known published stable successor: the 19.3.0-rc.4 pin that
5088
+ # React on Rails 17.1.0 generated, and the 19.3.1-rc.x soak that 17.2.0.rc.0 and rc.1 admitted.
5089
+ # Mirrors prereleaseLinesWithStableSuccessor in rscPeerSupport.ts.
5090
+ RSC_PRERELEASE_LINES_WITH_STABLE_SUCCESSOR = [[19, 3, 0], [19, 3, 1]].freeze
5090
5091
  RSC_MINIMUM_REACT_VERSION = "19.2.7"
5091
5092
  RSC_MINIMUM_REACT_VERSION_TUPLE = RSC_MINIMUM_REACT_VERSION.split(".").map(&:to_i).freeze
5092
5093
  RSC_SUPPORTED_REACT_MAJOR = RSC_MINIMUM_REACT_VERSION_TUPLE.fetch(0)
@@ -5407,18 +5408,14 @@ module ReactOnRails
5407
5408
  rsc_version = rsc_package["version"].to_s
5408
5409
  return true if rsc_package_version_at_or_above_minimum?(rsc_version)
5409
5410
 
5410
- prerelease_requirement = if RSC_MINIMUM_PACKAGE_PRERELEASE_VERSION.present?
5411
- "\n(or #{RSC_MINIMUM_PACKAGE_PRERELEASE_VERSION} during the RC soak)"
5412
- else
5413
- ""
5414
- end
5415
-
5416
5411
  rsc_install, react_install = rsc_package_floor_install_versions(rsc_version)
5412
+ # A prerelease can satisfy the numeric floor and still be rejected, so say why.
5413
+ stable_only_note = npm_prerelease(rsc_version).present? ? " (stable releases only)" : ""
5417
5414
 
5418
5415
  checker.add_error(<<~MSG.strip)
5419
5416
  🚫 #{RSC_PACKAGE_NAME} #{rsc_version.presence || 'unknown'} is not supported by React on Rails Pro 17 RSC.
5420
5417
 
5421
- React on Rails Pro 17 requires #{RSC_PACKAGE_NAME} >= #{RSC_MINIMUM_PACKAGE_VERSION}#{prerelease_requirement}
5418
+ React on Rails Pro 17 requires #{RSC_PACKAGE_NAME} >= #{RSC_MINIMUM_PACKAGE_VERSION}#{stable_only_note}
5422
5419
  on the supported #{RSC_SUPPORTED_PACKAGE_LINE} package line
5423
5420
  with React/React DOM #{react_install}+.
5424
5421
 
@@ -5427,27 +5424,26 @@ module ReactOnRails
5427
5424
  false
5428
5425
  end
5429
5426
 
5430
- # Only the 19.3.0 transition has a known published stable successor. Compatibility does not establish
5431
- # publication for other rejected prereleases; use the generator pin for those versions.
5427
+ # Only the lines in RSC_PRERELEASE_LINES_WITH_STABLE_SUCCESSOR have a known published stable
5428
+ # successor. Compatibility does not establish publication for other rejected prereleases; use the
5429
+ # generator pin for those versions.
5432
5430
  # Returns [rsc_version_to_install, react_version_to_install].
5433
5431
  def rsc_package_floor_install_versions(rsc_version)
5434
- if npm_prerelease(rsc_version).present? && npm_version_tuple(rsc_version) == [19, 3, 0]
5432
+ if npm_prerelease(rsc_version).present? &&
5433
+ RSC_PRERELEASE_LINES_WITH_STABLE_SUCCESSOR.include?(npm_version_tuple(rsc_version))
5435
5434
  stable_version = npm_version_tuple(rsc_version).join(".")
5436
5435
  if rsc_stable_package_version_supported?(stable_version)
5437
5436
  return [stable_version, recommended_react_install_version_for_rsc_package(stable_version)]
5438
5437
  end
5439
5438
  end
5440
5439
 
5441
- [RSC_PACKAGE_INSTALL_VERSION, RSC_MINIMUM_REACT_VERSION]
5440
+ [RSC_PACKAGE_INSTALL_VERSION, recommended_react_install_version_for_rsc_package(RSC_PACKAGE_INSTALL_VERSION)]
5442
5441
  end
5443
5442
 
5444
5443
  def rsc_package_version_at_or_above_minimum?(rsc_version)
5445
5444
  return false if rsc_version.blank?
5446
- return true if rsc_stable_package_version_supported?(rsc_version)
5447
- return false if RSC_MINIMUM_PACKAGE_PRERELEASE_VERSION.blank?
5448
- return false unless npm_version_tuple(rsc_version) == npm_version_tuple(RSC_MINIMUM_PACKAGE_PRERELEASE_VERSION)
5449
5445
 
5450
- npm_version_compare(rsc_version, RSC_MINIMUM_PACKAGE_PRERELEASE_VERSION) >= 0
5446
+ rsc_stable_package_version_supported?(rsc_version)
5451
5447
  end
5452
5448
 
5453
5449
  def rsc_stable_package_version_supported?(rsc_version)
@@ -5650,8 +5646,13 @@ module ReactOnRails
5650
5646
  installed_version = rsc_package["version"].to_s
5651
5647
  return if installed_version.blank?
5652
5648
 
5653
- rsc_dist_tags(package_root).each do |tag, tag_version|
5649
+ dist_tags = rsc_dist_tags(package_root)
5650
+ latest_version = dist_tags["latest"].to_s
5651
+ dist_tags.each do |tag, tag_version|
5654
5652
  next unless RSC_DIST_TAGS_TO_CHECK.include?(tag)
5653
+ # A prerelease tag that the stable `latest` release has caught up with or passed (for example
5654
+ # next 19.3.1-rc.1 once latest is 19.3.1) is not an upgrade target, and this version rejects it.
5655
+ next if latest_version.present? && !npm_version_greater?(tag_version, latest_version)
5655
5656
  next unless npm_version_greater?(tag_version, installed_version)
5656
5657
 
5657
5658
  checker.add_warning(<<~MSG.strip)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "17.2.0.rc.1"
4
+ VERSION = "17.2.0.rc.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.2.0.rc.1
4
+ version: 17.2.0.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon