react_on_rails_pro 16.2.0.test.6 → 16.2.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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.prettierignore +3 -0
  3. data/.rubocop.yml +7 -90
  4. data/CHANGELOG.md +16 -7
  5. data/CONTRIBUTING.md +64 -43
  6. data/Gemfile.development_dependencies +4 -4
  7. data/Gemfile.loader +11 -8
  8. data/Gemfile.lock +147 -124
  9. data/README.md +1 -1
  10. data/docs/bundle-caching.md +22 -8
  11. data/docs/caching.md +39 -27
  12. data/docs/code-splitting-loadable-components.md +71 -55
  13. data/docs/code-splitting.md +74 -70
  14. data/docs/configuration.md +6 -6
  15. data/docs/contributors-info/onboarding-customers.md +2 -1
  16. data/docs/contributors-info/releasing.md +1 -0
  17. data/docs/contributors-info/style.md +23 -15
  18. data/docs/home-pro.md +33 -15
  19. data/docs/installation.md +57 -9
  20. data/docs/js-memory-leaks.md +2 -3
  21. data/docs/node-renderer/debugging.md +5 -1
  22. data/docs/node-renderer/error-reporting-and-tracing.md +27 -15
  23. data/docs/node-renderer/heroku.md +4 -5
  24. data/docs/profiling-server-side-rendering-code.md +43 -42
  25. data/docs/react-server-components/add-streaming-and-interactivity.md +1 -1
  26. data/docs/react-server-components/create-without-ssr.md +18 -18
  27. data/docs/react-server-components/glossary.md +22 -3
  28. data/docs/react-server-components/how-react-server-components-work.md +25 -18
  29. data/docs/react-server-components/inside-client-components.md +19 -18
  30. data/docs/react-server-components/purpose-and-benefits.md +24 -14
  31. data/docs/react-server-components/rendering-flow.md +7 -3
  32. data/docs/react-server-components/server-side-rendering.md +23 -22
  33. data/docs/release-notes/4.0.md +103 -94
  34. data/docs/release-notes/v4-react-server-components.md +16 -16
  35. data/docs/streaming-server-rendering.md +2 -4
  36. data/docs/troubleshooting.md +5 -2
  37. data/docs/updating.md +55 -20
  38. data/lib/react_on_rails_pro/request.rb +18 -3
  39. data/lib/react_on_rails_pro/version.rb +1 -1
  40. data/rakelib/dummy_apps.rake +4 -4
  41. data/rakelib/lint.rake +1 -1
  42. data/rakelib/run_rspec.rake +3 -3
  43. metadata +4 -4
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: ..
11
11
  specs:
12
- react_on_rails (16.2.0.test.6)
12
+ react_on_rails (16.2.0)
13
13
  addressable
14
14
  connection_pool
15
15
  execjs (~> 2.5)
@@ -20,7 +20,7 @@ PATH
20
20
  PATH
21
21
  remote: .
22
22
  specs:
23
- react_on_rails_pro (16.2.0.test.6)
23
+ react_on_rails_pro (16.2.0)
24
24
  addressable
25
25
  async (>= 2.6)
26
26
  connection_pool
@@ -29,71 +29,73 @@ PATH
29
29
  httpx (~> 1.5)
30
30
  jwt (~> 2.7)
31
31
  rainbow
32
- react_on_rails (= 16.2.0.test.6)
32
+ react_on_rails (= 16.2.0)
33
33
 
34
34
  GEM
35
35
  remote: https://rubygems.org/
36
36
  specs:
37
- actioncable (7.2.2.1)
38
- actionpack (= 7.2.2.1)
39
- activesupport (= 7.2.2.1)
37
+ actioncable (7.2.3)
38
+ actionpack (= 7.2.3)
39
+ activesupport (= 7.2.3)
40
40
  nio4r (~> 2.0)
41
41
  websocket-driver (>= 0.6.1)
42
42
  zeitwerk (~> 2.6)
43
- actionmailbox (7.2.2.1)
44
- actionpack (= 7.2.2.1)
45
- activejob (= 7.2.2.1)
46
- activerecord (= 7.2.2.1)
47
- activestorage (= 7.2.2.1)
48
- activesupport (= 7.2.2.1)
43
+ actionmailbox (7.2.3)
44
+ actionpack (= 7.2.3)
45
+ activejob (= 7.2.3)
46
+ activerecord (= 7.2.3)
47
+ activestorage (= 7.2.3)
48
+ activesupport (= 7.2.3)
49
49
  mail (>= 2.8.0)
50
- actionmailer (7.2.2.1)
51
- actionpack (= 7.2.2.1)
52
- actionview (= 7.2.2.1)
53
- activejob (= 7.2.2.1)
54
- activesupport (= 7.2.2.1)
50
+ actionmailer (7.2.3)
51
+ actionpack (= 7.2.3)
52
+ actionview (= 7.2.3)
53
+ activejob (= 7.2.3)
54
+ activesupport (= 7.2.3)
55
55
  mail (>= 2.8.0)
56
56
  rails-dom-testing (~> 2.2)
57
- actionpack (7.2.2.1)
58
- actionview (= 7.2.2.1)
59
- activesupport (= 7.2.2.1)
57
+ actionpack (7.2.3)
58
+ actionview (= 7.2.3)
59
+ activesupport (= 7.2.3)
60
+ cgi
60
61
  nokogiri (>= 1.8.5)
61
62
  racc
62
- rack (>= 2.2.4, < 3.2)
63
+ rack (>= 2.2.4, < 3.3)
63
64
  rack-session (>= 1.0.1)
64
65
  rack-test (>= 0.6.3)
65
66
  rails-dom-testing (~> 2.2)
66
67
  rails-html-sanitizer (~> 1.6)
67
68
  useragent (~> 0.16)
68
- actiontext (7.2.2.1)
69
- actionpack (= 7.2.2.1)
70
- activerecord (= 7.2.2.1)
71
- activestorage (= 7.2.2.1)
72
- activesupport (= 7.2.2.1)
69
+ actiontext (7.2.3)
70
+ actionpack (= 7.2.3)
71
+ activerecord (= 7.2.3)
72
+ activestorage (= 7.2.3)
73
+ activesupport (= 7.2.3)
73
74
  globalid (>= 0.6.0)
74
75
  nokogiri (>= 1.8.5)
75
- actionview (7.2.2.1)
76
- activesupport (= 7.2.2.1)
76
+ actionview (7.2.3)
77
+ activesupport (= 7.2.3)
77
78
  builder (~> 3.1)
79
+ cgi
78
80
  erubi (~> 1.11)
79
81
  rails-dom-testing (~> 2.2)
80
82
  rails-html-sanitizer (~> 1.6)
81
- activejob (7.2.2.1)
82
- activesupport (= 7.2.2.1)
83
+ activejob (7.2.3)
84
+ activesupport (= 7.2.3)
83
85
  globalid (>= 0.3.6)
84
- activemodel (7.2.2.1)
85
- activesupport (= 7.2.2.1)
86
- activerecord (7.2.2.1)
87
- activemodel (= 7.2.2.1)
88
- activesupport (= 7.2.2.1)
86
+ activemodel (7.2.3)
87
+ activesupport (= 7.2.3)
88
+ activerecord (7.2.3)
89
+ activemodel (= 7.2.3)
90
+ activesupport (= 7.2.3)
89
91
  timeout (>= 0.4.0)
90
- activestorage (7.2.2.1)
91
- actionpack (= 7.2.2.1)
92
- activejob (= 7.2.2.1)
93
- activerecord (= 7.2.2.1)
94
- activesupport (= 7.2.2.1)
92
+ activestorage (7.2.3)
93
+ actionpack (= 7.2.3)
94
+ activejob (= 7.2.3)
95
+ activerecord (= 7.2.3)
96
+ activesupport (= 7.2.3)
95
97
  marcel (~> 1.0)
96
- activesupport (7.2.2.1)
98
+ activesupport (7.2.3)
97
99
  base64
98
100
  benchmark (>= 0.3)
99
101
  bigdecimal
@@ -105,19 +107,19 @@ GEM
105
107
  minitest (>= 5.1)
106
108
  securerandom (>= 0.3)
107
109
  tzinfo (~> 2.0, >= 2.0.5)
108
- addressable (2.8.7)
109
- public_suffix (>= 2.0.2, < 7.0)
110
+ addressable (2.8.8)
111
+ public_suffix (>= 2.0.2, < 8.0)
110
112
  amazing_print (1.6.0)
111
- ast (2.4.2)
112
- async (2.27.4)
113
+ ast (2.4.3)
114
+ async (2.35.0)
113
115
  console (~> 1.29)
114
116
  fiber-annotation
115
117
  io-event (~> 1.11)
116
118
  metrics (~> 0.12)
117
- traces (~> 0.15)
118
- base64 (0.2.0)
119
- benchmark (0.4.0)
120
- bigdecimal (3.1.9)
119
+ traces (~> 0.18)
120
+ base64 (0.3.0)
121
+ benchmark (0.5.0)
122
+ bigdecimal (3.3.1)
121
123
  bindex (0.8.1)
122
124
  bootsnap (1.18.3)
123
125
  msgpack (~> 1.2)
@@ -135,14 +137,15 @@ GEM
135
137
  capybara-screenshot (1.0.26)
136
138
  capybara (>= 1.0, < 4)
137
139
  launchy
140
+ cgi (0.5.0)
138
141
  childprocess (5.0.0)
139
142
  coderay (1.1.3)
140
143
  commonmarker (1.1.4-arm64-darwin)
141
144
  commonmarker (1.1.4-x86_64-darwin)
142
145
  commonmarker (1.1.4-x86_64-linux)
143
146
  concurrent-ruby (1.3.5)
144
- connection_pool (2.5.0)
145
- console (1.33.0)
147
+ connection_pool (3.0.2)
148
+ console (1.34.2)
146
149
  fiber-annotation
147
150
  fiber-local (~> 1.1)
148
151
  json
@@ -156,14 +159,15 @@ GEM
156
159
  bigdecimal
157
160
  rexml
158
161
  crass (1.0.6)
159
- date (3.4.1)
162
+ date (3.5.0)
160
163
  diff-lcs (1.5.1)
161
164
  docile (1.4.0)
162
- drb (2.2.1)
165
+ drb (2.2.3)
163
166
  equivalent-xml (0.6.0)
164
167
  nokogiri (>= 1.4.3)
168
+ erb (6.0.0)
165
169
  erubi (1.13.1)
166
- execjs (2.9.1)
170
+ execjs (2.10.0)
167
171
  fakefs (2.8.0)
168
172
  faker (3.4.1)
169
173
  i18n (>= 1.8.11, < 2)
@@ -178,19 +182,19 @@ GEM
178
182
  generator_spec (0.10.0)
179
183
  activesupport (>= 3.0.0)
180
184
  railties (>= 3.0.0)
181
- globalid (1.2.1)
185
+ globalid (1.3.0)
182
186
  activesupport (>= 6.1)
183
187
  graphiql-rails (1.10.0)
184
188
  railties
185
189
  hashdiff (1.1.0)
186
190
  http-2 (1.1.1)
187
- httpx (1.5.1)
191
+ httpx (1.6.3)
188
192
  http-2 (>= 1.0.0)
189
193
  i18n (1.14.7)
190
194
  concurrent-ruby (~> 1.0)
191
- io-console (0.8.0)
192
- io-event (1.12.1)
193
- irb (1.15.1)
195
+ io-console (0.8.1)
196
+ io-event (1.14.2)
197
+ irb (1.15.3)
194
198
  pp (>= 0.6.0)
195
199
  rdoc (>= 4.0.0)
196
200
  reline (>= 0.4.2)
@@ -201,36 +205,38 @@ GEM
201
205
  rails-dom-testing (>= 1, < 3)
202
206
  railties (>= 4.2.0)
203
207
  thor (>= 0.14, < 2.0)
204
- json (2.7.2)
205
- jwt (2.9.3)
208
+ json (2.17.1)
209
+ jwt (2.10.2)
206
210
  base64
211
+ language_server-protocol (3.17.0.5)
207
212
  launchy (3.0.1)
208
213
  addressable (~> 2.8)
209
214
  childprocess (~> 5.0)
210
215
  listen (3.9.0)
211
216
  rb-fsevent (~> 0.10, >= 0.10.3)
212
217
  rb-inotify (~> 0.9, >= 0.9.10)
213
- logger (1.6.6)
214
- loofah (2.24.0)
218
+ logger (1.7.0)
219
+ loofah (2.24.1)
215
220
  crass (~> 1.0.2)
216
221
  nokogiri (>= 1.12.0)
217
- mail (2.8.1)
222
+ mail (2.9.0)
223
+ logger
218
224
  mini_mime (>= 0.1.1)
219
225
  net-imap
220
226
  net-pop
221
227
  net-smtp
222
- marcel (1.0.4)
228
+ marcel (1.1.0)
223
229
  matrix (0.4.2)
224
230
  method_source (1.1.0)
225
- metrics (0.14.0)
231
+ metrics (0.15.0)
226
232
  mini_mime (1.1.5)
227
- minitest (5.25.4)
233
+ minitest (5.26.2)
228
234
  mize (0.4.1)
229
235
  protocol (~> 2.0)
230
236
  msgpack (1.7.2)
231
237
  net-http (0.4.1)
232
238
  uri
233
- net-imap (0.5.8)
239
+ net-imap (0.5.12)
234
240
  date
235
241
  net-protocol
236
242
  net-pop (0.1.2)
@@ -239,22 +245,23 @@ GEM
239
245
  timeout
240
246
  net-smtp (0.5.1)
241
247
  net-protocol
242
- nio4r (2.7.4)
243
- nokogiri (1.18.8-arm64-darwin)
248
+ nio4r (2.7.5)
249
+ nokogiri (1.18.10-arm64-darwin)
244
250
  racc (~> 1.4)
245
- nokogiri (1.18.8-x86_64-darwin)
251
+ nokogiri (1.18.10-x86_64-darwin)
246
252
  racc (~> 1.4)
247
- nokogiri (1.18.8-x86_64-linux-gnu)
253
+ nokogiri (1.18.10-x86_64-linux-gnu)
248
254
  racc (~> 1.4)
249
255
  package_json (0.2.0)
250
- parallel (1.25.1)
251
- parser (3.3.3.0)
256
+ parallel (1.27.0)
257
+ parser (3.3.10.0)
252
258
  ast (~> 2.4.1)
253
259
  racc
254
260
  pg (1.5.6)
255
- pp (0.6.2)
261
+ pp (0.6.3)
256
262
  prettyprint
257
263
  prettyprint (0.2.0)
264
+ prism (1.6.0)
258
265
  protocol (2.0.0)
259
266
  ruby_parser (~> 3.0)
260
267
  pry (0.14.2)
@@ -267,65 +274,69 @@ GEM
267
274
  pry (>= 0.13.0)
268
275
  pry-theme (1.3.1)
269
276
  coderay (~> 1.1)
270
- psych (5.2.3)
277
+ psych (5.2.6)
271
278
  date
272
279
  stringio
273
- public_suffix (6.0.0)
280
+ public_suffix (7.0.0)
274
281
  puma (6.5.0)
275
282
  nio4r (~> 2.0)
276
283
  racc (1.8.1)
277
- rack (3.1.12)
284
+ rack (3.2.4)
278
285
  rack-proxy (0.7.7)
279
286
  rack
280
- rack-session (2.1.0)
287
+ rack-session (2.1.1)
281
288
  base64 (>= 0.1.0)
282
289
  rack (>= 3.0.0)
283
290
  rack-test (2.2.0)
284
291
  rack (>= 1.3)
285
- rackup (2.2.1)
292
+ rackup (2.3.1)
286
293
  rack (>= 3)
287
- rails (7.2.2.1)
288
- actioncable (= 7.2.2.1)
289
- actionmailbox (= 7.2.2.1)
290
- actionmailer (= 7.2.2.1)
291
- actionpack (= 7.2.2.1)
292
- actiontext (= 7.2.2.1)
293
- actionview (= 7.2.2.1)
294
- activejob (= 7.2.2.1)
295
- activemodel (= 7.2.2.1)
296
- activerecord (= 7.2.2.1)
297
- activestorage (= 7.2.2.1)
298
- activesupport (= 7.2.2.1)
294
+ rails (7.2.3)
295
+ actioncable (= 7.2.3)
296
+ actionmailbox (= 7.2.3)
297
+ actionmailer (= 7.2.3)
298
+ actionpack (= 7.2.3)
299
+ actiontext (= 7.2.3)
300
+ actionview (= 7.2.3)
301
+ activejob (= 7.2.3)
302
+ activemodel (= 7.2.3)
303
+ activerecord (= 7.2.3)
304
+ activestorage (= 7.2.3)
305
+ activesupport (= 7.2.3)
299
306
  bundler (>= 1.15.0)
300
- railties (= 7.2.2.1)
301
- rails-dom-testing (2.2.0)
307
+ railties (= 7.2.3)
308
+ rails-dom-testing (2.3.0)
302
309
  activesupport (>= 5.0.0)
303
310
  minitest
304
311
  nokogiri (>= 1.6)
305
312
  rails-html-sanitizer (1.6.2)
306
313
  loofah (~> 2.21)
307
314
  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)
308
- railties (7.2.2.1)
309
- actionpack (= 7.2.2.1)
310
- activesupport (= 7.2.2.1)
315
+ railties (7.2.3)
316
+ actionpack (= 7.2.3)
317
+ activesupport (= 7.2.3)
318
+ cgi
311
319
  irb (~> 1.13)
312
320
  rackup (>= 1.0.0)
313
321
  rake (>= 12.2)
314
322
  thor (~> 1.0, >= 1.2.2)
323
+ tsort (>= 0.2)
315
324
  zeitwerk (~> 2.6)
316
325
  rainbow (3.1.1)
317
- rake (13.2.1)
326
+ rake (13.3.1)
318
327
  rb-fsevent (0.11.2)
319
328
  rb-inotify (0.11.1)
320
329
  ffi (~> 1.0)
321
330
  rbs (3.9.5)
322
331
  logger
323
- rdoc (6.12.0)
332
+ rdoc (6.16.1)
333
+ erb
324
334
  psych (>= 4.0.0)
335
+ tsort
325
336
  regexp_parser (2.9.2)
326
- reline (0.6.0)
337
+ reline (0.6.3)
327
338
  io-console (~> 0.5)
328
- rexml (3.3.9)
339
+ rexml (3.4.4)
329
340
  rspec-core (3.13.0)
330
341
  rspec-support (~> 3.13.0)
331
342
  rspec-expectations (3.13.1)
@@ -347,23 +358,34 @@ GEM
347
358
  rspec-support (3.13.1)
348
359
  rspec_junit_formatter (0.6.0)
349
360
  rspec-core (>= 2, < 4, != 2.12.0)
350
- rubocop (1.36.0)
361
+ rubocop (1.61.0)
351
362
  json (~> 2.3)
363
+ language_server-protocol (>= 3.17.0)
352
364
  parallel (~> 1.10)
353
- parser (>= 3.1.2.1)
365
+ parser (>= 3.3.0.2)
354
366
  rainbow (>= 2.2.2, < 4.0)
355
367
  regexp_parser (>= 1.8, < 3.0)
356
368
  rexml (>= 3.2.5, < 4.0)
357
- rubocop-ast (>= 1.20.1, < 2.0)
369
+ rubocop-ast (>= 1.30.0, < 2.0)
358
370
  ruby-progressbar (~> 1.7)
359
- unicode-display_width (>= 1.4.0, < 3.0)
360
- rubocop-ast (1.31.3)
361
- parser (>= 3.3.1.0)
362
- rubocop-performance (1.15.0)
363
- rubocop (>= 1.7.0, < 2.0)
364
- rubocop-ast (>= 0.4.0)
365
- rubocop-rspec (2.13.2)
366
- rubocop (~> 1.33)
371
+ unicode-display_width (>= 2.4.0, < 3.0)
372
+ rubocop-ast (1.48.0)
373
+ parser (>= 3.3.7.2)
374
+ prism (~> 1.4)
375
+ rubocop-capybara (2.21.0)
376
+ rubocop (~> 1.41)
377
+ rubocop-factory_bot (2.26.1)
378
+ rubocop (~> 1.61)
379
+ rubocop-performance (1.20.2)
380
+ rubocop (>= 1.48.1, < 2.0)
381
+ rubocop-ast (>= 1.30.0, < 2.0)
382
+ rubocop-rspec (2.31.0)
383
+ rubocop (~> 1.40)
384
+ rubocop-capybara (~> 2.17)
385
+ rubocop-factory_bot (~> 2.22)
386
+ rubocop-rspec_rails (~> 2.28)
387
+ rubocop-rspec_rails (2.29.1)
388
+ rubocop (~> 1.61)
367
389
  ruby-progressbar (1.13.0)
368
390
  ruby_parser (3.21.0)
369
391
  racc (~> 1.5)
@@ -393,7 +415,7 @@ GEM
393
415
  websocket (~> 1.0)
394
416
  semantic_range (3.1.0)
395
417
  sexp_processor (4.17.1)
396
- shakapacker (9.3.0)
418
+ shakapacker (9.4.0)
397
419
  activesupport (>= 5.2)
398
420
  package_json
399
421
  rack-proxy (>= 0.6.1)
@@ -418,18 +440,19 @@ GEM
418
440
  sqlite3 (1.7.3-arm64-darwin)
419
441
  sqlite3 (1.7.3-x86_64-darwin)
420
442
  sqlite3 (1.7.3-x86_64-linux)
421
- stringio (3.1.2)
443
+ stringio (3.1.9)
422
444
  sync (0.5.0)
423
445
  term-ansicolor (1.10.2)
424
446
  mize
425
447
  tins (~> 1.0)
426
- thor (1.3.2)
448
+ thor (1.4.0)
427
449
  tilt (2.4.0)
428
- timeout (0.4.3)
450
+ timeout (0.4.4)
429
451
  tins (1.33.0)
430
452
  bigdecimal
431
453
  sync
432
- traces (0.18.1)
454
+ traces (0.18.2)
455
+ tsort (0.2.0)
433
456
  turbolinks (5.2.1)
434
457
  turbolinks-source (~> 5.2)
435
458
  turbolinks-source (5.2.0)
@@ -437,7 +460,7 @@ GEM
437
460
  concurrent-ruby (~> 1.0)
438
461
  uglifier (4.2.0)
439
462
  execjs (>= 0.3.0, < 3)
440
- unicode-display_width (2.5.0)
463
+ unicode-display_width (2.6.0)
441
464
  uri (1.0.3)
442
465
  useragent (0.16.11)
443
466
  web-console (4.2.1)
@@ -454,14 +477,14 @@ GEM
454
477
  crack (>= 0.3.2)
455
478
  hashdiff (>= 0.4.0, < 2.0.0)
456
479
  websocket (1.2.10)
457
- websocket-driver (0.7.7)
480
+ websocket-driver (0.8.0)
458
481
  base64
459
482
  websocket-extensions (>= 0.1.0)
460
483
  websocket-extensions (0.1.5)
461
484
  xpath (3.2.0)
462
485
  nokogiri (~> 1.8)
463
486
  yard (0.9.36)
464
- zeitwerk (2.7.1)
487
+ zeitwerk (2.7.3)
465
488
 
466
489
  PLATFORMS
467
490
  arm64-darwin-24
@@ -503,13 +526,13 @@ DEPENDENCIES
503
526
  rspec-rails
504
527
  rspec-retry
505
528
  rspec_junit_formatter
506
- rubocop (= 1.36.0)
507
- rubocop-performance (= 1.15.0)
508
- rubocop-rspec (= 2.13.2)
529
+ rubocop (= 1.61.0)
530
+ rubocop-performance (~> 1.20.0)
531
+ rubocop-rspec (~> 2.26)
509
532
  sass-rails
510
533
  scss_lint
511
534
  selenium-webdriver (= 4.9.0)
512
- shakapacker (= 9.3.0)
535
+ shakapacker (= 9.4.0)
513
536
  spring
514
537
  spring-watcher-listen
515
538
  sprockets
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![License](https://img.shields.io/badge/license-Commercial-blue.svg)](./LICENSE)
4
4
  [![Build Integration Tests](https://github.com/shakacode/react_on_rails/actions/workflows/pro-integration-tests.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/pro-integration-tests.yml)
5
5
  [![Build Lint](https://github.com/shakacode/react_on_rails/actions/workflows/pro-lint.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/pro-lint.yml)
6
- [![Build Package Tests](https://github.com/shakacode/react_on_rails/actions/workflows/pro-package-tests.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/pro-package-tests.yml)
6
+ [![Build Package Tests](https://github.com/shakacode/react_on_rails/actions/workflows/pro-test-package-and-gem.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/pro-test-package-and-gem.yml)
7
7
 
8
8
  **Performance enhancements and advanced features for [React on Rails](https://github.com/shakacode/react_on_rails).**
9
9
 
@@ -1,16 +1,19 @@
1
1
  # Bundle Caching
2
2
 
3
3
  ## Why?
4
+
4
5
  Building webpack bundles is often time-consuming, and the same bundles are built many times.
5
6
  For example, you might build the production bundles during CI, then for a Review app, then
6
- for Staging, and maybe even for Production. Or you might want to deploy a small Ruby only
7
+ for Staging, and maybe even for Production. Or you might want to deploy a small Ruby-only
7
8
  change to production, but you will have to wait minutes for your bundles to be built again.
8
9
 
9
10
  ## Solution
11
+
10
12
  React on Rails 2.1.0 introduces bundle caching based on a digest of all the source files, defined
11
13
  in the `config/shakapacker.yml` file, plus other files defined with `config.dependency_globs` and
12
14
  excluding any files from `config.excluded_dependency_globs`. Creating this hash key takes at most a
13
- few seconds for even large projects. Additionally, the cache key includes
15
+ few seconds for even large projects. Additionally, the cache key includes
16
+
14
17
  1. NODE_ENV
15
18
  2. Version of React on Rails Pro
16
19
  3. Configurable additional env values by supplying an array in method cache_keys on the `remote_bundle_cache_adapter`. See examples below.
@@ -18,6 +21,7 @@ few seconds for even large projects. Additionally, the cache key includes
18
21
  This cache key is used for saving files to some remote storage, typically S3.
19
22
 
20
23
  ## Bonus for local development with multiple directories building production builds
24
+
21
25
  Bundle caching can help save time if you have multiple directories for the same repository.
22
26
 
23
27
  The bundles are cached in `Rails.root.join('tmp', 'bundle_cache')`
@@ -32,6 +36,7 @@ ln -s ../../my_project/tmp/bundle_cache
32
36
  ## Configuration
33
37
 
34
38
  ### 1. React on Rails Configuration
39
+
35
40
  First, we need to tell React on Rails to use a custom build module. In
36
41
  `config/initializers/react_on_rails`, set this value:
37
42
 
@@ -49,7 +54,7 @@ ReactOnRails.configure do |config|
49
54
  end
50
55
  ```
51
56
 
52
- And define it like this:
57
+ And define it like this:
53
58
 
54
59
  ```ruby
55
60
  module CustomBuildCommand
@@ -61,6 +66,7 @@ end
61
66
  ```
62
67
 
63
68
  ### 2. React on Rails Pro Configuration
69
+
64
70
  Next, we need to configure the `config/initializers/react_on_rails_pro.rb` with some module,
65
71
  say called S3BundleCacheAdapter.
66
72
 
@@ -79,21 +85,26 @@ cached_react_component and cached_react_component_hash, add those as well to `co
79
85
  To simplify your configuration, entire directories can be added to `config.dependency_globs` & then any irrelevant files or subdirectories can be added to `config.excluded_dependency_globs`
80
86
 
81
87
  For example:
88
+
82
89
  ```ruby
83
90
  config.dependency_globs = [ File.join(Rails.root, "app", "views", "**", "*.jbuilder") ]
84
91
  config.excluded_dependency_globs = [ File.join(Rails.root, "app", "views", "**", "dont_hash_this.jbuilder") ]
85
92
  ```
93
+
86
94
  will hash all files in `app/views` that have the `jbuilder` extension except for any file named `dont_hash_this.jbuilder`.
87
95
 
88
96
  The goal is that Ruby only changes that don't affect your webpack bundles don't change the cache keys, and anything that could affect the bundles MUST change the cache keys!
89
97
 
90
98
  ### 3. Remove any call to rake task `react_on_rails_pro:pre_stage_bundle_for_node_renderer`
91
- This task is called automaticaly if you're using bundle caching.
99
+
100
+ This task is called automatically if you're using bundle caching.
101
+
92
102
  ```ruby
93
103
  Rake::Task['react_on_rails_pro:pre_stage_bundle_for_node_renderer'].invoke
94
104
  ```
95
105
 
96
106
  #### Custom ENV cache keys
107
+
97
108
  Check your webpack config for the webpack.DefinePlugin. That allows JS code to use
98
109
  `process.env.MY_ENV_VAR` resulting in bundles that differ depending on the ENV value set.
99
110
 
@@ -115,12 +126,14 @@ Another use of the ENV values would be a cache version, so incrementing this ENV
115
126
  would force a new cache value.
116
127
 
117
128
  ## Disabling via an ENV value
129
+
118
130
  Once configured for bundle caching, ReactOnRailsPro::AssetsPrecompile's caching functionality
119
131
  can be disabled by setting ENV["DISABLE_PRECOMPILE_CACHE"] equal to "true"
120
132
 
121
133
  ### Examples of `remote_bundle_cache_adapter`:
122
134
 
123
135
  #### S3BundleCacheAdapter
136
+
124
137
  Example of a module for custom methods for the `remote_bundle_cache_adapter`.
125
138
 
126
139
  Note, S3UploadService is your own code that fetches and uploads.
@@ -140,7 +153,7 @@ class S3BundleCacheAdapter
140
153
  def self.cache_keys
141
154
  [Rails.env, ENV['SOME_ENV_VALUE']]
142
155
  end
143
-
156
+
144
157
  # return value is unused
145
158
  # This command should build the bundles
146
159
  def self.build
@@ -153,8 +166,8 @@ class S3BundleCacheAdapter
153
166
  result = S3UploadService.new.fetch_object(zipped_bundles_filename)
154
167
  result.get.body.read if result
155
168
  end
156
-
157
- # Optional: method to return an array of extra files paths, that require caching.
169
+
170
+ # Optional: method to return an array of extra files paths, that require caching.
158
171
  # These files get placed at the `extra_files` directory at the top of the zipfile
159
172
  # and are moved to the original places after unzipping the bundles.
160
173
  def self.extra_files_to_cache
@@ -180,6 +193,7 @@ end
180
193
  ```
181
194
 
182
195
  #### LocalBundleCacheAdapter
196
+
183
197
  Example of a module for custom methods for the `remote_bundle_cache_adapter` that does not save files
184
198
  remotely. Only local files are used.
185
199
 
@@ -189,7 +203,7 @@ class LocalBundleCacheAdapter
189
203
  # if no additional cache keys, return an empty array
190
204
  []
191
205
  end
192
-
206
+
193
207
  def self.build
194
208
  Rake.sh(ReactOnRails::Utils.prepend_cd_node_modules_directory('yarn start build.prod').to_s)
195
209
  end