react_on_rails 16.2.0.rc.0 → 16.2.0.test.3

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: 28e1bda4590cc95516e1a295feacdc8134b077a049e5759a98017770c578c334
4
- data.tar.gz: bcb1a38c0bfc08887686562d8e0d8d0f7e2819de6bab533a947ef2cba4e711b0
3
+ metadata.gz: d23e199f7597e88d219d9541c30d304328c182c98dc30bbdc35b9ec0fb1b5f73
4
+ data.tar.gz: fb3601578def2b46a71d6cfd52e96e2eec8a6c686ae27fca49baaee87801c9a4
5
5
  SHA512:
6
- metadata.gz: 7af0f6467580dcfb86ac14e0ea810bbfbd8c938a731fe11a41ffcd898cbebb61716c0626ae4b521928290242be4d9a78127cec11e0bd84d25b65a04bac75a537
7
- data.tar.gz: 4114a11458885477566823102e70796de40a835c265806d2f4acff4b98ba3887f8e70791d781aaa41605c3ae9cfe14ae64e5d6098ba7d51560042e4d2be5ea35
6
+ metadata.gz: 8d7d7e86dd5c0eca61463ed386d644defadf16cce0c249d47d2928b1fa53d606c77a2192122ba88797c39dfa636a1d8016ebe0e4e5de13d4e7be32daafb48d6c
7
+ data.tar.gz: 1a9e4e568f253f58bbea1f5e379bce832b6c3dec2b6e9719ec8e76e852eaf9669744b1c3cb146d5ba99f4b6738a0c5dd503a3a747b64aa9c3278f5a9fe2d2ab7
data/.rubocop.yml CHANGED
@@ -1,16 +1,36 @@
1
- # Inherits from root config
2
- inherit_from: ../.rubocop.yml
3
-
4
- # Merge Exclude arrays with parent instead of replacing them
5
- inherit_mode:
6
- merge:
7
- - Exclude
1
+ # This is the configuration used to check the rubocop source code.
2
+ # Check out: https://github.com/bbatsov/rubocop
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rspec
8
6
 
9
7
  AllCops:
8
+ NewCops: enable
9
+ DisplayCopNames: true
10
+ TargetRubyVersion: 3.0.0
10
11
  SuggestExtensions: false
11
12
 
13
+ Include:
14
+ - '**/Rakefile'
15
+ - '**/config.ru'
16
+ - 'Gemfile'
17
+ - '**/*.rb'
18
+ - '**/*.rake'
19
+
12
20
  Exclude:
21
+ - '**/*.js'
22
+ - '**/node_modules/**/*'
23
+ - '**/public/**/*'
24
+ - '**/tmp/**/*'
25
+ - 'coverage/**/*'
26
+ - 'gen-examples/examples/**/*'
27
+ - 'node_modules/**/*'
28
+ - '../react_on_rails_pro/**/*' # Exclude pro package (has its own linting)
13
29
  - 'spec/dummy/bin/*'
30
+ - 'spec/fixtures/**/*'
31
+ - 'spec/react_on_rails/dummy-for-generators/**/*'
32
+ - 'tmp/**/*'
33
+ - 'vendor/**/*'
14
34
 
15
35
  Naming/FileName:
16
36
  Exclude:
@@ -18,6 +38,24 @@ Naming/FileName:
18
38
  - '**/Rakefile'
19
39
  - '**/Steepfile'
20
40
 
41
+ Layout/LineLength:
42
+ Max: 120
43
+
44
+ Style/StringLiterals:
45
+ EnforcedStyle: double_quotes
46
+
47
+ Style/Documentation:
48
+ Enabled: false
49
+
50
+ Style/HashEachMethods:
51
+ Enabled: true
52
+
53
+ Style/HashTransformKeys:
54
+ Enabled: true
55
+
56
+ Style/HashTransformValues:
57
+ Enabled: true
58
+
21
59
  Lint/AssignmentInCondition:
22
60
  Exclude:
23
61
  - 'spec/dummy/bin/spring'
@@ -28,19 +66,33 @@ Lint/SuppressedException:
28
66
  - 'spec/dummy/bin/rake'
29
67
 
30
68
  Metrics/AbcSize:
69
+ Max: 28
31
70
  Exclude:
32
71
  - 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling
33
72
 
73
+ Metrics/CyclomaticComplexity:
74
+ Max: 7
75
+
76
+ Metrics/PerceivedComplexity:
77
+ Max: 10
78
+
34
79
  Metrics/ClassLength:
80
+ Max: 150
35
81
  Exclude:
36
82
  - 'lib/generators/react_on_rails/base_generator.rb' # Generator complexity justified
37
83
  - 'lib/react_on_rails/dev/server_manager.rb' # Dev tool with comprehensive help system
38
84
 
85
+ Metrics/ParameterLists:
86
+ Max: 5
87
+ CountKeywordArgs: false
88
+
39
89
  Metrics/MethodLength:
90
+ Max: 41
40
91
  Exclude:
41
92
  - 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling
42
93
 
43
94
  Metrics/ModuleLength:
95
+ Max: 180
44
96
  Exclude:
45
97
  - 'spec/react_on_rails/engine_spec.rb' # Comprehensive engine tests require many examples
46
98
 
@@ -55,6 +107,18 @@ RSpec/AnyInstance:
55
107
  - 'spec/react_on_rails/binstubs/dev_static_spec.rb'
56
108
  - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests require system mocking
57
109
 
110
+ RSpec/DescribeClass:
111
+ Enabled: false
112
+
113
+ RSpec/ExampleLength:
114
+ Enabled: false
115
+
116
+ RSpec/MessageSpies:
117
+ Enabled: false
118
+
119
+ RSpec/NestedGroups:
120
+ Max: 4
121
+
58
122
  RSpec/BeforeAfterAll:
59
123
  Exclude:
60
124
  - 'spec/react_on_rails/generators/dev_tests_generator_spec.rb'
@@ -63,10 +127,19 @@ RSpec/BeforeAfterAll:
63
127
  - 'spec/react_on_rails/binstubs/dev_static_spec.rb'
64
128
  - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests require global setup
65
129
 
130
+ RSpec/MessageChain:
131
+ Enabled: false
132
+
133
+ RSpec/MultipleExpectations:
134
+ Enabled: false
135
+
66
136
  RSpec/MultipleDescribes:
67
137
  Exclude:
68
138
  - 'spec/dummy/spec/system/integration_spec.rb'
69
139
 
140
+ RSpec/MultipleMemoizedHelpers:
141
+ Max: 12
142
+
70
143
  Style/GlobalVars:
71
144
  Exclude:
72
145
  - 'spec/dummy/config/environments/development.rb'
@@ -83,3 +156,4 @@ RSpec/InstanceVariable:
83
156
  RSpec/StubbedMock:
84
157
  Exclude:
85
158
  - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests use mixed stub/mock patterns
159
+
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- eval_gemfile File.expand_path("../Gemfile.shared_dev_dependencies", __dir__)
4
-
5
3
  gem "shakapacker", "9.4.0"
6
4
  gem "bootsnap", require: false
7
- gem "rails", "~> 7.1.0"
5
+ gem "rails", "~> 7.1"
8
6
 
9
7
  gem "sqlite3", "~> 1.6"
10
8
  gem "sass-rails", "~> 6.0"
@@ -37,6 +35,9 @@ group :development, :test do
37
35
  gem "pry-rescue"
38
36
  gem "rbs", require: false
39
37
  gem "steep", require: false
38
+ gem "rubocop", "1.61.0", require: false
39
+ gem "rubocop-performance", "~>1.20.0", require: false
40
+ gem "rubocop-rspec", "~>2.26", require: false
40
41
  gem "spring", "~> 4.0"
41
42
  gem "lefthook", require: false
42
43
  # Added for Ruby 3.5+ compatibility to silence warnings
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- react_on_rails (16.2.0.rc.0)
4
+ react_on_rails (16.2.0.test.3)
5
5
  addressable
6
6
  connection_pool
7
7
  execjs (~> 2.5)
@@ -12,36 +12,35 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- actioncable (7.1.6)
16
- actionpack (= 7.1.6)
17
- activesupport (= 7.1.6)
15
+ actioncable (7.1.3.2)
16
+ actionpack (= 7.1.3.2)
17
+ activesupport (= 7.1.3.2)
18
18
  nio4r (~> 2.0)
19
19
  websocket-driver (>= 0.6.1)
20
20
  zeitwerk (~> 2.6)
21
- actionmailbox (7.1.6)
22
- actionpack (= 7.1.6)
23
- activejob (= 7.1.6)
24
- activerecord (= 7.1.6)
25
- activestorage (= 7.1.6)
26
- activesupport (= 7.1.6)
21
+ actionmailbox (7.1.3.2)
22
+ actionpack (= 7.1.3.2)
23
+ activejob (= 7.1.3.2)
24
+ activerecord (= 7.1.3.2)
25
+ activestorage (= 7.1.3.2)
26
+ activesupport (= 7.1.3.2)
27
27
  mail (>= 2.7.1)
28
28
  net-imap
29
29
  net-pop
30
30
  net-smtp
31
- actionmailer (7.1.6)
32
- actionpack (= 7.1.6)
33
- actionview (= 7.1.6)
34
- activejob (= 7.1.6)
35
- activesupport (= 7.1.6)
31
+ actionmailer (7.1.3.2)
32
+ actionpack (= 7.1.3.2)
33
+ actionview (= 7.1.3.2)
34
+ activejob (= 7.1.3.2)
35
+ activesupport (= 7.1.3.2)
36
36
  mail (~> 2.5, >= 2.5.4)
37
37
  net-imap
38
38
  net-pop
39
39
  net-smtp
40
40
  rails-dom-testing (~> 2.2)
41
- actionpack (7.1.6)
42
- actionview (= 7.1.6)
43
- activesupport (= 7.1.6)
44
- cgi
41
+ actionpack (7.1.3.2)
42
+ actionview (= 7.1.3.2)
43
+ activesupport (= 7.1.3.2)
45
44
  nokogiri (>= 1.8.5)
46
45
  racc
47
46
  rack (>= 2.2.4)
@@ -49,47 +48,43 @@ GEM
49
48
  rack-test (>= 0.6.3)
50
49
  rails-dom-testing (~> 2.2)
51
50
  rails-html-sanitizer (~> 1.6)
52
- actiontext (7.1.6)
53
- actionpack (= 7.1.6)
54
- activerecord (= 7.1.6)
55
- activestorage (= 7.1.6)
56
- activesupport (= 7.1.6)
51
+ actiontext (7.1.3.2)
52
+ actionpack (= 7.1.3.2)
53
+ activerecord (= 7.1.3.2)
54
+ activestorage (= 7.1.3.2)
55
+ activesupport (= 7.1.3.2)
57
56
  globalid (>= 0.6.0)
58
57
  nokogiri (>= 1.8.5)
59
- actionview (7.1.6)
60
- activesupport (= 7.1.6)
58
+ actionview (7.1.3.2)
59
+ activesupport (= 7.1.3.2)
61
60
  builder (~> 3.1)
62
- cgi
63
61
  erubi (~> 1.11)
64
62
  rails-dom-testing (~> 2.2)
65
63
  rails-html-sanitizer (~> 1.6)
66
- activejob (7.1.6)
67
- activesupport (= 7.1.6)
64
+ activejob (7.1.3.2)
65
+ activesupport (= 7.1.3.2)
68
66
  globalid (>= 0.3.6)
69
- activemodel (7.1.6)
70
- activesupport (= 7.1.6)
71
- activerecord (7.1.6)
72
- activemodel (= 7.1.6)
73
- activesupport (= 7.1.6)
67
+ activemodel (7.1.3.2)
68
+ activesupport (= 7.1.3.2)
69
+ activerecord (7.1.3.2)
70
+ activemodel (= 7.1.3.2)
71
+ activesupport (= 7.1.3.2)
74
72
  timeout (>= 0.4.0)
75
- activestorage (7.1.6)
76
- actionpack (= 7.1.6)
77
- activejob (= 7.1.6)
78
- activerecord (= 7.1.6)
79
- activesupport (= 7.1.6)
73
+ activestorage (7.1.3.2)
74
+ actionpack (= 7.1.3.2)
75
+ activejob (= 7.1.3.2)
76
+ activerecord (= 7.1.3.2)
77
+ activesupport (= 7.1.3.2)
80
78
  marcel (~> 1.0)
81
- activesupport (7.1.6)
79
+ activesupport (7.1.3.2)
82
80
  base64
83
- benchmark (>= 0.3)
84
81
  bigdecimal
85
82
  concurrent-ruby (~> 1.0, >= 1.0.2)
86
83
  connection_pool (>= 2.2.5)
87
84
  drb
88
85
  i18n (>= 1.6, < 2)
89
- logger (>= 1.4.2)
90
86
  minitest (>= 5.1)
91
87
  mutex_m
92
- securerandom (>= 0.3)
93
88
  tzinfo (~> 2.0)
94
89
  addressable (2.8.7)
95
90
  public_suffix (>= 2.0.2, < 7.0)
@@ -97,7 +92,7 @@ GEM
97
92
  ast (2.4.2)
98
93
  base64 (0.3.0)
99
94
  benchmark (0.4.1)
100
- bigdecimal (4.0.1)
95
+ bigdecimal (3.3.1)
101
96
  bootsnap (1.18.3)
102
97
  msgpack (~> 1.2)
103
98
  builder (3.3.0)
@@ -114,11 +109,10 @@ GEM
114
109
  capybara-screenshot (1.0.26)
115
110
  capybara (>= 1.0, < 4)
116
111
  launchy
117
- cgi (0.5.1)
118
112
  childprocess (5.0.0)
119
113
  coderay (1.1.3)
120
- concurrent-ruby (1.3.6)
121
- connection_pool (3.0.2)
114
+ concurrent-ruby (1.3.5)
115
+ connection_pool (2.5.5)
122
116
  coveralls (0.8.23)
123
117
  json (>= 1.8, < 3)
124
118
  simplecov (~> 0.16.1)
@@ -129,7 +123,7 @@ GEM
129
123
  csv (3.3.5)
130
124
  cypress-on-rails (1.20.0)
131
125
  rack
132
- date (3.5.1)
126
+ date (3.5.0)
133
127
  debug (1.9.2)
134
128
  irb (~> 1.10)
135
129
  reline (>= 0.3.8)
@@ -138,7 +132,7 @@ GEM
138
132
  drb (2.2.3)
139
133
  equivalent-xml (0.6.0)
140
134
  nokogiri (>= 1.4.3)
141
- erb (6.0.1)
135
+ erb (6.0.0)
142
136
  erubi (1.13.1)
143
137
  execjs (2.9.1)
144
138
  ffi (1.16.3)
@@ -147,13 +141,13 @@ GEM
147
141
  generator_spec (0.10.0)
148
142
  activesupport (>= 3.0.0)
149
143
  railties (>= 3.0.0)
150
- globalid (1.3.0)
144
+ globalid (1.2.1)
151
145
  activesupport (>= 6.1)
152
- i18n (1.14.8)
146
+ i18n (1.14.7)
153
147
  concurrent-ruby (~> 1.0)
154
148
  interception (0.5)
155
- io-console (0.8.2)
156
- irb (1.16.0)
149
+ io-console (0.8.1)
150
+ irb (1.15.3)
157
151
  pp (>= 0.6.0)
158
152
  rdoc (>= 4.0.0)
159
153
  reline (>= 0.4.2)
@@ -174,34 +168,32 @@ GEM
174
168
  rb-fsevent (~> 0.10, >= 0.10.3)
175
169
  rb-inotify (~> 0.9, >= 0.9.10)
176
170
  logger (1.7.0)
177
- loofah (2.25.0)
171
+ loofah (2.24.1)
178
172
  crass (~> 1.0.2)
179
173
  nokogiri (>= 1.12.0)
180
- mail (2.9.0)
181
- logger
174
+ mail (2.8.1)
182
175
  mini_mime (>= 0.1.1)
183
176
  net-imap
184
177
  net-pop
185
178
  net-smtp
186
- marcel (1.1.0)
179
+ marcel (1.0.4)
187
180
  matrix (0.4.3)
188
181
  method_source (1.1.0)
189
182
  mini_mime (1.1.5)
190
183
  mini_portile2 (2.8.9)
191
- minitest (6.0.1)
192
- prism (~> 1.5)
184
+ minitest (5.26.2)
193
185
  msgpack (1.7.2)
194
186
  mutex_m (0.3.0)
195
- net-imap (0.6.2)
187
+ net-imap (0.4.11)
196
188
  date
197
189
  net-protocol
198
190
  net-pop (0.1.2)
199
191
  net-protocol
200
192
  net-protocol (0.2.2)
201
193
  timeout
202
- net-smtp (0.5.1)
194
+ net-smtp (0.5.0)
203
195
  net-protocol
204
- nio4r (2.7.5)
196
+ nio4r (2.7.3)
205
197
  nokogiri (1.18.10)
206
198
  mini_portile2 (~> 2.8.2)
207
199
  racc (~> 1.4)
@@ -214,7 +206,6 @@ GEM
214
206
  pp (0.6.3)
215
207
  prettyprint
216
208
  prettyprint (0.2.0)
217
- prism (1.7.0)
218
209
  pry (0.14.2)
219
210
  coderay (~> 1.1)
220
211
  method_source (~> 1.0)
@@ -229,11 +220,11 @@ GEM
229
220
  pry-rescue (1.6.0)
230
221
  interception (>= 0.5)
231
222
  pry (>= 0.12.0)
232
- psych (5.3.1)
223
+ psych (5.2.6)
233
224
  date
234
225
  stringio
235
226
  public_suffix (6.0.2)
236
- puma (6.6.1)
227
+ puma (6.4.2)
237
228
  nio4r (~> 2.0)
238
229
  racc (1.8.1)
239
230
  rack (3.2.4)
@@ -244,22 +235,22 @@ GEM
244
235
  rack (>= 3.0.0)
245
236
  rack-test (2.2.0)
246
237
  rack (>= 1.3)
247
- rackup (2.3.1)
238
+ rackup (2.2.1)
248
239
  rack (>= 3)
249
- rails (7.1.6)
250
- actioncable (= 7.1.6)
251
- actionmailbox (= 7.1.6)
252
- actionmailer (= 7.1.6)
253
- actionpack (= 7.1.6)
254
- actiontext (= 7.1.6)
255
- actionview (= 7.1.6)
256
- activejob (= 7.1.6)
257
- activemodel (= 7.1.6)
258
- activerecord (= 7.1.6)
259
- activestorage (= 7.1.6)
260
- activesupport (= 7.1.6)
240
+ rails (7.1.3.2)
241
+ actioncable (= 7.1.3.2)
242
+ actionmailbox (= 7.1.3.2)
243
+ actionmailer (= 7.1.3.2)
244
+ actionpack (= 7.1.3.2)
245
+ actiontext (= 7.1.3.2)
246
+ actionview (= 7.1.3.2)
247
+ activejob (= 7.1.3.2)
248
+ activemodel (= 7.1.3.2)
249
+ activerecord (= 7.1.3.2)
250
+ activestorage (= 7.1.3.2)
251
+ activesupport (= 7.1.3.2)
261
252
  bundler (>= 1.15.0)
262
- railties (= 7.1.6)
253
+ railties (= 7.1.3.2)
263
254
  rails-dom-testing (2.3.0)
264
255
  activesupport (>= 5.0.0)
265
256
  minitest
@@ -267,15 +258,13 @@ GEM
267
258
  rails-html-sanitizer (1.6.2)
268
259
  loofah (~> 2.21)
269
260
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
270
- railties (7.1.6)
271
- actionpack (= 7.1.6)
272
- activesupport (= 7.1.6)
273
- cgi
261
+ railties (7.1.3.2)
262
+ actionpack (= 7.1.3.2)
263
+ activesupport (= 7.1.3.2)
274
264
  irb
275
265
  rackup (>= 1.0.0)
276
266
  rake (>= 12.2)
277
267
  thor (~> 1.0, >= 1.2.2)
278
- tsort (>= 0.2)
279
268
  zeitwerk (~> 2.6)
280
269
  rainbow (3.1.1)
281
270
  rake (13.3.1)
@@ -284,14 +273,15 @@ GEM
284
273
  ffi (~> 1.0)
285
274
  rbs (3.9.5)
286
275
  logger
287
- rdoc (7.0.3)
276
+ rdoc (6.15.1)
288
277
  erb
289
278
  psych (>= 4.0.0)
290
279
  tsort
291
280
  regexp_parser (2.11.3)
292
281
  reline (0.6.3)
293
282
  io-console (~> 0.5)
294
- rexml (3.4.4)
283
+ rexml (3.2.7)
284
+ strscan (>= 3.0.9)
295
285
  rspec-core (3.13.0)
296
286
  rspec-support (~> 3.13.0)
297
287
  rspec-expectations (3.13.1)
@@ -397,7 +387,7 @@ GEM
397
387
  strscan (>= 1.0.0)
398
388
  terminal-table (>= 2, < 4)
399
389
  uri (>= 0.12.0)
400
- stringio (3.2.0)
390
+ stringio (3.1.8)
401
391
  strscan (3.1.0)
402
392
  sync (0.5.0)
403
393
  term-ansicolor (1.8.0)
@@ -406,14 +396,15 @@ GEM
406
396
  unicode-display_width (>= 1.1.1, < 3)
407
397
  thor (1.4.0)
408
398
  tilt (2.3.0)
409
- timeout (0.6.0)
399
+ timeout (0.4.1)
410
400
  tins (1.33.0)
411
401
  bigdecimal
412
402
  sync
413
403
  tsort (0.2.0)
414
- turbo-rails (2.0.20)
415
- actionpack (>= 7.1.0)
416
- railties (>= 7.1.0)
404
+ turbo-rails (2.0.6)
405
+ actionpack (>= 6.0.0)
406
+ activejob (>= 6.0.0)
407
+ railties (>= 6.0.0)
417
408
  turbolinks (5.2.1)
418
409
  turbolinks-source (~> 5.2)
419
410
  turbolinks-source (5.2.0)
@@ -428,14 +419,13 @@ GEM
428
419
  rubyzip (>= 1.3.0)
429
420
  selenium-webdriver (~> 4.0, < 4.11)
430
421
  websocket (1.2.10)
431
- websocket-driver (0.8.0)
432
- base64
422
+ websocket-driver (0.7.6)
433
423
  websocket-extensions (>= 0.1.0)
434
424
  websocket-extensions (0.1.5)
435
425
  xpath (3.2.0)
436
426
  nokogiri (~> 1.8)
437
427
  yard (0.9.36)
438
- zeitwerk (2.7.4)
428
+ zeitwerk (2.7.3)
439
429
 
440
430
  PLATFORMS
441
431
  ruby
@@ -466,7 +456,7 @@ DEPENDENCIES
466
456
  pry-rails
467
457
  pry-rescue
468
458
  puma (~> 6.0)
469
- rails (~> 7.1.0)
459
+ rails (~> 7.1)
470
460
  rbs
471
461
  react_on_rails!
472
462
  rspec-rails
@@ -31,8 +31,7 @@ module ReactOnRails
31
31
 
32
32
  def add_test_related_gems_to_gemfile
33
33
  gem("rspec-rails", group: :test)
34
- # NOTE: chromedriver-helper was deprecated in 2019. Modern selenium-webdriver (4.x)
35
- # and GitHub Actions have built-in driver management, so no driver helper is needed.
34
+ gem("chromedriver-helper", group: :test)
36
35
  gem("coveralls", require: false)
37
36
  end
38
37
 
@@ -124,75 +124,4 @@ module GeneratorHelper
124
124
  true
125
125
  end
126
126
  end
127
-
128
- # Check if SWC is configured as the JavaScript transpiler in shakapacker.yml
129
- #
130
- # @return [Boolean] true if SWC is configured or should be used by default
131
- #
132
- # Detection logic:
133
- # 1. If shakapacker.yml exists and specifies javascript_transpiler: parse it
134
- # 2. For Shakapacker 9.3.0+, SWC is the default if not specified
135
- # 3. Returns true for fresh installations (SWC is recommended default)
136
- #
137
- # @note This method is used to determine whether to install SWC dependencies
138
- # (@swc/core, swc-loader) instead of Babel dependencies during generation.
139
- #
140
- # @note Caching: The result is memoized for the lifetime of the generator instance.
141
- # If shakapacker.yml changes during generator execution (unlikely), the cached
142
- # value will not update. This is acceptable since generators run quickly.
143
- def using_swc?
144
- return @using_swc if defined?(@using_swc)
145
-
146
- @using_swc = detect_swc_configuration
147
- end
148
-
149
- private
150
-
151
- def detect_swc_configuration
152
- shakapacker_yml_path = File.join(destination_root, "config/shakapacker.yml")
153
-
154
- if File.exist?(shakapacker_yml_path)
155
- config = parse_shakapacker_yml(shakapacker_yml_path)
156
- transpiler = config.dig("default", "javascript_transpiler")
157
-
158
- # Explicit configuration takes precedence
159
- return transpiler == "swc" if transpiler
160
-
161
- # For Shakapacker 9.3.0+, SWC is the default
162
- return shakapacker_version_9_3_or_higher?
163
- end
164
-
165
- # Fresh install: SWC is recommended default for Shakapacker 9.3.0+
166
- shakapacker_version_9_3_or_higher?
167
- end
168
-
169
- def parse_shakapacker_yml(path)
170
- require "yaml"
171
- # Use safe_load_file for security (defense-in-depth, even though this is user's own config)
172
- # permitted_classes: [Symbol] allows symbol keys which shakapacker.yml may use
173
- # aliases: true allows YAML anchors (&default, *default) commonly used in Rails configs
174
- YAML.safe_load_file(path, permitted_classes: [Symbol], aliases: true)
175
- rescue ArgumentError
176
- # Older Psych versions don't support all parameters - try without aliases
177
- begin
178
- YAML.safe_load_file(path, permitted_classes: [Symbol])
179
- rescue ArgumentError
180
- # Very old Psych - fall back to safe_load with File.read
181
- YAML.safe_load(File.read(path), permitted_classes: [Symbol]) # rubocop:disable Style/YAMLFileRead
182
- end
183
- rescue StandardError
184
- # If we can't parse the file, return empty config
185
- {}
186
- end
187
-
188
- # Check if Shakapacker 9.3.0 or higher is available
189
- # This version made SWC the default JavaScript transpiler
190
- def shakapacker_version_9_3_or_higher?
191
- return true unless defined?(ReactOnRails::PackerUtils)
192
-
193
- ReactOnRails::PackerUtils.shakapacker_version_requirement_met?("9.3.0")
194
- rescue StandardError
195
- # If we can't determine version, assume latest (which uses SWC)
196
- true
197
- end
198
127
  end
@@ -99,13 +99,6 @@ module ReactOnRails
99
99
  @types/react-dom
100
100
  ].freeze
101
101
 
102
- # SWC transpiler dependencies (for Shakapacker 9.3.0+ default transpiler)
103
- # SWC is ~20x faster than Babel and is the default for new Shakapacker installations
104
- SWC_DEPENDENCIES = %w[
105
- @swc/core
106
- swc-loader
107
- ].freeze
108
-
109
102
  private
110
103
 
111
104
  def setup_js_dependencies
@@ -125,8 +118,6 @@ module ReactOnRails
125
118
  add_css_dependencies
126
119
  # Rspack dependencies are only added when --rspack flag is used
127
120
  add_rspack_dependencies if respond_to?(:options) && options&.rspack?
128
- # SWC dependencies are only added when SWC is the configured transpiler
129
- add_swc_dependencies if using_swc?
130
121
  # Dev dependencies vary based on bundler choice
131
122
  add_dev_dependencies
132
123
  end
@@ -241,26 +232,6 @@ module ReactOnRails
241
232
  MSG
242
233
  end
243
234
 
244
- def add_swc_dependencies
245
- puts "Installing SWC transpiler dependencies (20x faster than Babel)..."
246
- return if add_packages(SWC_DEPENDENCIES, dev: true)
247
-
248
- GeneratorMessages.add_warning(<<~MSG.strip)
249
- ⚠️ Failed to add SWC dependencies.
250
-
251
- SWC is the default JavaScript transpiler for Shakapacker 9.3.0+.
252
- You can install them manually by running:
253
- npm install --save-dev #{SWC_DEPENDENCIES.join(' ')}
254
- MSG
255
- rescue StandardError => e
256
- GeneratorMessages.add_warning(<<~MSG.strip)
257
- ⚠️ Error adding SWC dependencies: #{e.message}
258
-
259
- You can install them manually by running:
260
- npm install --save-dev #{SWC_DEPENDENCIES.join(' ')}
261
- MSG
262
- end
263
-
264
235
  def add_typescript_dependencies
265
236
  puts "Installing TypeScript dependencies..."
266
237
  return if add_packages(TYPESCRIPT_DEPENDENCIES, dev: true)