react_on_rails 17.2.0.rc.0 → 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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/generators/react_on_rails/js_dependency_manager.rb +13 -11
- data/lib/generators/react_on_rails/rsc_setup/client_references.rb +100 -30
- data/lib/generators/react_on_rails/rsc_setup.rb +7 -4
- data/lib/react_on_rails/doctor.rb +21 -20
- data/lib/react_on_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e693369dbaeba45ae43c510dfffae96a539f54ef55187d0fe3e3a29aee2a864
|
|
4
|
+
data.tar.gz: 6f73358fad45c5826b671ff7efcb3e1dbdd5a916b1659bd964df9db8a680a719
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8efb2839f33b03bea64098bdee605ccb70e6432511f07dda175ee8d9586121411af470c0c0f197238b2be850975521739edc58c35dd211c981f32e929a8a224d
|
|
7
|
+
data.tar.gz: e38c214f95d69aebecdab18058c6c3e3ae2fd04cba40daa262e098a59e3caee84558c204e684a99b36abedca27e140f702b9d7bdfa830d485b2c926ca300b351
|
data/Gemfile.lock
CHANGED
|
@@ -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
|
|
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
|
|
155
|
-
#
|
|
156
|
-
# current on npm; React's RSC runtime and
|
|
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
|
|
161
|
-
RSC_REACT_VERSION_RANGE = "~19.
|
|
162
|
-
# Pinned to the stable 19.
|
|
163
|
-
#
|
|
164
|
-
|
|
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
|
|
258
|
-
# Pin React to
|
|
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"]
|
|
@@ -43,8 +43,10 @@ module ReactOnRails
|
|
|
43
43
|
// (which re-runs the hook). Running bin/shakapacker directly after changing server
|
|
44
44
|
// components is covered by the best-effort staleness warning below.
|
|
45
45
|
//
|
|
46
|
-
// The resolution cascade below
|
|
47
|
-
//
|
|
46
|
+
// The resolution cascade below — including the react-on-rails-pro client-component
|
|
47
|
+
// registrations appended to every branch's result (issue #5079) — is mirrored, branch
|
|
48
|
+
// for branch, by the Pro dummy's hand-written rscManifestClientReferences.js and pinned
|
|
49
|
+
// on both sides by contract tests.
|
|
48
50
|
const rscClientReferences = (() => {
|
|
49
51
|
// Required inside the IIFE rather than at the top of the file because the module-scope
|
|
50
52
|
// bindings 'resolve' (from 'path') and 'config' (from 'shakapacker') are already
|
|
@@ -168,40 +170,73 @@ module ReactOnRails
|
|
|
168
170
|
);
|
|
169
171
|
};
|
|
170
172
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
const resolveDiscoveredClientReferences = () => {
|
|
174
|
+
if (configuredRefsJson) {
|
|
175
|
+
const resolvedRefsJson = resolve(configuredRefsJson);
|
|
176
|
+
if (!existsSync(resolvedRefsJson)) {
|
|
177
|
+
throw new Error(
|
|
178
|
+
`RSC_MANIFEST_CLIENT_REFERENCES_JSON is set but the file does not exist: ${resolvedRefsJson}`,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
warnIfManifestStale(resolvedRefsJson);
|
|
182
|
+
return readManifestReferences(resolvedRefsJson);
|
|
177
183
|
}
|
|
178
|
-
warnIfManifestStale(resolvedRefsJson);
|
|
179
|
-
return readManifestReferences(resolvedRefsJson);
|
|
180
|
-
}
|
|
181
184
|
|
|
182
|
-
|
|
183
|
-
return [fallbackRscClientReferences];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (existsSync(defaultRefsJson)) {
|
|
187
|
-
warnIfManifestStale(defaultRefsJson);
|
|
188
|
-
return readManifestReferences(defaultRefsJson);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (existsSync(serverComponentRegistrationEntry)) {
|
|
192
|
-
if (!rscConfigSupportsDiscovery()) {
|
|
193
|
-
console.warn(
|
|
194
|
-
`[react_on_rails] Missing ${defaultRefsJson}, but this app's RSC webpack config ` +
|
|
195
|
-
'or precompile hook does not support manifest discovery yet; falling back to broad client ' +
|
|
196
|
-
'reference scan. Re-run rails g react_on_rails:rsc to update generated configs.',
|
|
197
|
-
);
|
|
185
|
+
if (process.env.RSC_REFERENCE_DISCOVERY_BUILD === 'true' || process.env.RSC_BUNDLE_ONLY === 'true') {
|
|
198
186
|
return [fallbackRscClientReferences];
|
|
199
187
|
}
|
|
200
188
|
|
|
201
|
-
|
|
202
|
-
|
|
189
|
+
if (existsSync(defaultRefsJson)) {
|
|
190
|
+
warnIfManifestStale(defaultRefsJson);
|
|
191
|
+
return readManifestReferences(defaultRefsJson);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (existsSync(serverComponentRegistrationEntry)) {
|
|
195
|
+
if (!rscConfigSupportsDiscovery()) {
|
|
196
|
+
console.warn(
|
|
197
|
+
`[react_on_rails] Missing ${defaultRefsJson}, but this app's RSC webpack config ` +
|
|
198
|
+
'or precompile hook does not support manifest discovery yet; falling back to broad client ' +
|
|
199
|
+
'reference scan. Re-run rails g react_on_rails:rsc to update generated configs.',
|
|
200
|
+
);
|
|
201
|
+
return [fallbackRscClientReferences];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
throw new Error(`Missing ${defaultRefsJson}. Run bin/shakapacker-precompile-hook before bin/shakapacker.`);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return [fallbackRscClientReferences];
|
|
208
|
+
};
|
|
203
209
|
|
|
204
|
-
|
|
210
|
+
// react-on-rails-pro ships its own 'use client' components (RSCRoute, RSCProvider, and
|
|
211
|
+
// the default RSC provider registration). Both the discovery build and the fallback
|
|
212
|
+
// directory scan only cover app source — node_modules is never scanned — so these can
|
|
213
|
+
// never be discovered and, without explicit registration, never reach
|
|
214
|
+
// react-client-manifest.json. Server components rendering them (e.g. a nested
|
|
215
|
+
// <RSCRoute> for section-level refetching) then fail the render-time manifest lookup
|
|
216
|
+
// even when the RSC bundle compiles (issue #5079). require.resolve returns the
|
|
217
|
+
// absolute realpath, which matches the module resource webpack records
|
|
218
|
+
// (resolve.symlinks defaults to true), so the manifest keys line up with the file URLs
|
|
219
|
+
// the RSC bundle's client references carry even when react-on-rails-pro is installed
|
|
220
|
+
// through a symlink (pnpm, workspaces). A function (invoked in the return below, after
|
|
221
|
+
// the discovered references resolve) so both this resolver and its Pro dummy mirror
|
|
222
|
+
// surface the same first error when both steps fail.
|
|
223
|
+
const reactOnRailsProClientReferences = () =>
|
|
224
|
+
[
|
|
225
|
+
'react-on-rails-pro/RSCRoute',
|
|
226
|
+
'react-on-rails-pro/RSCProvider',
|
|
227
|
+
'react-on-rails-pro/registerDefaultRSCProvider/client',
|
|
228
|
+
].map((subpath) => {
|
|
229
|
+
try {
|
|
230
|
+
return require.resolve(subpath);
|
|
231
|
+
} catch (err) {
|
|
232
|
+
throw new Error(
|
|
233
|
+
`Failed to resolve the react-on-rails-pro client component "${subpath}" for RSC ` +
|
|
234
|
+
`client-reference registration: ${err.message}`,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
return [...new Set([...resolveDiscoveredClientReferences(), ...reactOnRailsProClientReferences()])];
|
|
205
240
|
})();
|
|
206
241
|
JS
|
|
207
242
|
end
|
|
@@ -277,6 +312,10 @@ module ReactOnRails
|
|
|
277
312
|
|
|
278
313
|
content = read_current_rsc_config(config_path, fallback: content)
|
|
279
314
|
end
|
|
315
|
+
# A previously generated IIFE (no react-on-rails-pro registrations — issue #5079) also
|
|
316
|
+
# counts as generated below; warn so the user registers the components manually.
|
|
317
|
+
warn_outdated_rsc_client_references_helper(config_path) if
|
|
318
|
+
outdated_generated_rsc_client_references_defined?(content)
|
|
280
319
|
return :scoped if generated_rsc_client_references_defined?(content)
|
|
281
320
|
|
|
282
321
|
warn_unscoped_rsc_client_references_helper(config_path)
|
|
@@ -312,6 +351,12 @@ module ReactOnRails
|
|
|
312
351
|
content = normalized_content
|
|
313
352
|
end
|
|
314
353
|
|
|
354
|
+
# A resolver emitted by a previous generator version (no react-on-rails-pro
|
|
355
|
+
# client-component registrations — issue #5079) is deliberately not rewritten; warn
|
|
356
|
+
# before the scoped-references short-circuit below treats it as already current.
|
|
357
|
+
warn_outdated_rsc_client_references_helper(config_path) if
|
|
358
|
+
outdated_generated_rsc_client_references_defined?(content)
|
|
359
|
+
|
|
315
360
|
return unless rsc_plugin_sections_safe_to_rewrite?(config_path, content, is_server:)
|
|
316
361
|
|
|
317
362
|
return if rsc_plugin_uses_scoped_client_references?(content, is_server:)
|
|
@@ -1405,6 +1450,31 @@ module ReactOnRails
|
|
|
1405
1450
|
write_existing_rsc_config(config_path, updated_content, action: :rewrite)
|
|
1406
1451
|
end
|
|
1407
1452
|
|
|
1453
|
+
# True when the file carries a manifest-backed generated resolver IIFE that does not
|
|
1454
|
+
# register the react-on-rails-pro client components (issue #5079) — either the resolver a
|
|
1455
|
+
# previous generator version emitted, or a user customization of one. The generator never
|
|
1456
|
+
# rewrites such a resolver; it warns with manual registration instructions instead.
|
|
1457
|
+
def outdated_generated_rsc_client_references_defined?(content)
|
|
1458
|
+
return false unless generated_rsc_client_references_defined?(content)
|
|
1459
|
+
|
|
1460
|
+
iife_body = generated_rsc_client_references_iife_body(content)
|
|
1461
|
+
return false unless iife_body
|
|
1462
|
+
|
|
1463
|
+
!js_code_matches?(iife_body, /\breactOnRailsProClientReferences\b/)
|
|
1464
|
+
end
|
|
1465
|
+
|
|
1466
|
+
def warn_outdated_rsc_client_references_helper(config_path)
|
|
1467
|
+
GeneratorMessages.add_warning(
|
|
1468
|
+
"#{config_path} contains a rscClientReferences resolver from a previous generator " \
|
|
1469
|
+
"version: it does not register the react-on-rails-pro package's own client components " \
|
|
1470
|
+
"(RSCRoute, RSCProvider, registerDefaultRSCProvider/client — issue #5079). The file was " \
|
|
1471
|
+
"left unchanged. Add require.resolve entries for those components to your " \
|
|
1472
|
+
"clientReferences (see the RSC setup docs at " \
|
|
1473
|
+
"https://reactonrails.com/docs/pro/react-server-components/create-without-ssr), or " \
|
|
1474
|
+
"remove the generated resolver block and re-run this generator to emit the current one."
|
|
1475
|
+
)
|
|
1476
|
+
end
|
|
1477
|
+
|
|
1408
1478
|
def read_current_rsc_config(config_path, fallback:)
|
|
1409
1479
|
return fallback if options[:pretend] || options[:skip]
|
|
1410
1480
|
|
|
@@ -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
|
-
|
|
92
|
-
React #{RSC_SUPPORTED_REACT_LINE} with patch >= #{RSC_MINIMUM_REACT_VERSION}.
|
|
93
|
-
|
|
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
|
|
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+
|
|
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
|
-
#
|
|
5088
|
-
#
|
|
5089
|
-
|
|
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}#{
|
|
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
|
|
5431
|
-
# publication for other rejected prereleases; use the
|
|
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? &&
|
|
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,
|
|
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
|
-
|
|
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)
|
|
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)
|