react_on_rails 14.1.0 → 14.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -1
- data/CONTRIBUTING.md +10 -14
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/knip.ts +80 -0
- data/lib/react_on_rails/prerender_error.rb +10 -2
- data/lib/react_on_rails/utils.rb +8 -1
- data/lib/react_on_rails/version.rb +1 -1
- data/react_on_rails.gemspec +2 -2
- data/tsconfig.json +7 -5
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bcd1f3d6e521231a8435057a0979cf4d354b6ee075ca172dfa554e7837b516f
|
4
|
+
data.tar.gz: f3569c8499bfc239486670d24248523b311cf4a97ee616df7bd97c6c15d4ee33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 929bc16300843b336cab3022fc3a681feea4cf1fba3dbdf35c88df9508058ba32f1f7eeb29ac0a044a1fa1254aca16ec216159e4c08a5c660e18df428348d01f
|
7
|
+
data.tar.gz: 8b3ba8b7608c2ced7cb314d2efcd944cd362ee7f1807472de601574b5237c66d9093dcd98741f235fddce0d9f84bb9bf9b60a846a4a4ce85c1fa2498d191552b
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,26 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
|
|
18
18
|
### [Unreleased]
|
19
19
|
Changes since the last non-beta release.
|
20
20
|
|
21
|
+
#### Added
|
22
|
+
- Add export option 'react-on-rails/client' to avoid shipping server-rendering code to browsers (~5KB improvement) [PR 1697](https://github.com/shakacode/react_on_rails/pull/1697) by [Romex91](https://github.com/Romex91).
|
23
|
+
|
24
|
+
#### Fixed
|
25
|
+
- Fix obscure errors by introducing FULL_TEXT_ERRORS [PR 1695](https://github.com/shakacode/react_on_rails/pull/1695) by [Romex91](https://github.com/Romex91).
|
26
|
+
- Disable `esModuleInterop` to increase interoperability [PR 1699](https://github.com/shakacode/react_on_rails/pull/1699) by [alexeyr-ci](https://github.com/alexeyr-ci).
|
27
|
+
- Resolved 14.1.1 incompatibility with eslint & made sure that spec/dummy is linted by eslint. [PR 1693](https://github.com/shakacode/react_on_rails/pull/1693) by [judahmeek](https://github.com/judahmeek).
|
28
|
+
|
29
|
+
#### Changed
|
30
|
+
- More up-to-date TS config [PR 1700](https://github.com/shakacode/react_on_rails/pull/1700) by [alexeyr-ci](https://github.com/alexeyr-ci).
|
31
|
+
|
32
|
+
### [14.1.1] - 2025-01-15
|
33
|
+
|
34
|
+
#### Fixed
|
35
|
+
|
36
|
+
- Separated streamServerRenderedReactComponent from the ReactOnRails object in order to stop users from getting errors during webpack compilation about needing the `stream-browserify` package. [PR 1680](https://github.com/shakacode/react_on_rails/pull/1680) by [judahmeek](https://github.com/judahmeek).
|
37
|
+
- Removed obsolete `js-yaml` peer dependency. [PR 1678](https://github.com/shakacode/react_on_rails/pull/1678) by [alexeyr-ci](https://github.com/alexeyr-ci).
|
38
|
+
|
39
|
+
### [14.1.0] - 2025-01-06
|
40
|
+
|
21
41
|
#### Fixed
|
22
42
|
|
23
43
|
- Incorrect type and confusing name for `ReactOnRails.registerStore`, use `registerStoreGenerators` instead. [PR 1651](https://github.com/shakacode/react_on_rails/pull/1651) by [alexeyr-ci](https://github.com/alexeyr-ci).
|
@@ -1172,7 +1192,9 @@ Best done with Object destructing:
|
|
1172
1192
|
##### Fixed
|
1173
1193
|
- Fix several generator-related issues.
|
1174
1194
|
|
1175
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/14.
|
1195
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/14.1.1...master
|
1196
|
+
[14.1.1]: https://github.com/shakacode/react_on_rails/compare/14.1.0...14.1.1
|
1197
|
+
[14.1.0]: https://github.com/shakacode/react_on_rails/compare/14.0.5...14.1.0
|
1176
1198
|
[14.0.5]: https://github.com/shakacode/react_on_rails/compare/14.0.4...14.0.5
|
1177
1199
|
[14.0.4]: https://github.com/shakacode/react_on_rails/compare/14.0.3...14.0.4
|
1178
1200
|
[14.0.3]: https://github.com/shakacode/react_on_rails/compare/14.0.2...14.0.3
|
data/CONTRIBUTING.md
CHANGED
@@ -6,20 +6,14 @@
|
|
6
6
|
|
7
7
|
## To run tests:
|
8
8
|
* [Yalc](https://github.com/whitecolor/yalc) must be installed globally for most local development.
|
9
|
-
* After updating code via
|
10
|
-
|
9
|
+
* After updating code via Git, to prepare all examples:
|
11
10
|
```sh
|
12
11
|
cd react_on_rails/
|
13
|
-
bundle && yarn && rake
|
12
|
+
bundle && yarn && rake shakapacker_examples:gen_all && rake node_package && rake
|
14
13
|
```
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
yarn global add browserify babelify tape-run faucet
|
19
|
-
browserify -t babelify node_package/tests/*.js | tape-run | faucet
|
20
|
-
```
|
21
|
-
|
22
|
-
See Dev Initial Setup, below for, well... initial setup.
|
15
|
+
See [Dev Initial Setup](#dev-initial-setup) below for, well... initial setup,
|
16
|
+
and [Running tests](#running-tests) for more details on running tests.
|
23
17
|
|
24
18
|
# IDE/IDE SETUP
|
25
19
|
It's critical to configure your IDE/editor to ignore certain directories. Otherwise your IDE might slow to a crawl!
|
@@ -153,21 +147,23 @@ script/convert
|
|
153
147
|
yarn run dummy:spec
|
154
148
|
```
|
155
149
|
|
156
|
-
|
150
|
+
## Running tests
|
151
|
+
|
152
|
+
### JS tests
|
157
153
|
|
158
154
|
```sh
|
159
155
|
cd react_on_rails/
|
160
|
-
yarn test
|
156
|
+
yarn run test
|
161
157
|
```
|
162
158
|
|
163
|
-
###
|
159
|
+
### spec/dummy tests
|
164
160
|
|
165
161
|
```sh
|
166
162
|
cd react_on_rails/spec/dummy
|
167
163
|
rspec
|
168
164
|
```
|
169
165
|
|
170
|
-
###
|
166
|
+
### Linting, type checking and JS tests together
|
171
167
|
|
172
168
|
```sh
|
173
169
|
cd react_on_rails/
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
|
24
24
|
-----
|
25
25
|
|
26
|
-
*These are the docs for React on Rails
|
26
|
+
*These are the docs for React on Rails 14. To see the older docs and code: [v13](https://github.com/shakacode/react_on_rails/tree/13.4.0), [v12](https://github.com/shakacode/react_on_rails/tree/12.6.0), and [v11](https://github.com/shakacode/react_on_rails/tree/11.3.0).*
|
27
27
|
|
28
28
|
# About
|
29
29
|
React on Rails integrates Rails with (server rendering of) [React](https://github.com/facebook/react).
|
data/knip.ts
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
import type { KnipConfig } from 'knip';
|
2
|
+
|
3
|
+
const config: KnipConfig = {
|
4
|
+
// ! at the end means files are used in production
|
5
|
+
workspaces: {
|
6
|
+
'.': {
|
7
|
+
entry: ['node_package/src/ReactOnRails.ts!', 'node_package/src/ReactOnRails.node.ts!'],
|
8
|
+
project: ['node_package/src/**/*.[jt]s!', 'node_package/tests/**/*.[jt]s'],
|
9
|
+
babel: {
|
10
|
+
config: ['node_package/babel.config.js'],
|
11
|
+
},
|
12
|
+
ignoreBinaries: [
|
13
|
+
// Knip fails to detect it's declared in devDependencies
|
14
|
+
'nps',
|
15
|
+
// local scripts
|
16
|
+
'node_package/scripts/.*',
|
17
|
+
],
|
18
|
+
ignoreDependencies: [
|
19
|
+
// Required for TypeScript compilation, but we don't depend on Turbolinks itself.
|
20
|
+
'@types/turbolinks',
|
21
|
+
// used in package-scripts.yml
|
22
|
+
'concurrently',
|
23
|
+
// The Knip ESLint plugin fails to detect these are transitively required by a config,
|
24
|
+
// though we don't actually use its rules anywhere.
|
25
|
+
'eslint-plugin-jsx-a11y',
|
26
|
+
'eslint-plugin-react',
|
27
|
+
// Used in CI
|
28
|
+
'@arethetypeswrong/cli',
|
29
|
+
],
|
30
|
+
},
|
31
|
+
'spec/dummy': {
|
32
|
+
entry: [
|
33
|
+
'app/assets/config/manifest.js!',
|
34
|
+
'client/app/packs/**/*.js!',
|
35
|
+
// Not sure why this isn't detected as a dependency of client/app/packs/server-bundle.js
|
36
|
+
'client/app/generated/server-bundle-generated.js!',
|
37
|
+
'spec/fixtures/automated_packs_generation/**/*.js{x,}',
|
38
|
+
'config/webpack/{production,development,test}.js',
|
39
|
+
// Declaring this as webpack.config instead doesn't work correctly
|
40
|
+
'config/webpack/webpack.config.js',
|
41
|
+
],
|
42
|
+
project: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}!', 'config/webpack/*.js'],
|
43
|
+
paths: {
|
44
|
+
'Assets/*': ['client/app/assets/*'],
|
45
|
+
},
|
46
|
+
ignoreBinaries: [
|
47
|
+
// Has to be installed globally
|
48
|
+
'yalc',
|
49
|
+
// Local binaries
|
50
|
+
'bin/.*',
|
51
|
+
],
|
52
|
+
ignoreDependencies: [
|
53
|
+
// Knip thinks it can be a devDependency, but it's supposed to be in dependencies.
|
54
|
+
'@babel/runtime',
|
55
|
+
// There's no ReScript plugin for Knip
|
56
|
+
'@rescript/react',
|
57
|
+
// The Babel plugin fails to detect it
|
58
|
+
'babel-plugin-transform-react-remove-prop-types',
|
59
|
+
// This one is weird. It's long-deprecated and shouldn't be necessary.
|
60
|
+
// Probably need to update the Webpack config.
|
61
|
+
'node-libs-browser',
|
62
|
+
// The below dependencies are not detected by the Webpack plugin
|
63
|
+
// due to the config issue.
|
64
|
+
'css-loader',
|
65
|
+
'expose-loader',
|
66
|
+
'file-loader',
|
67
|
+
'imports-loader',
|
68
|
+
'mini-css-extract-plugin',
|
69
|
+
'null-loader',
|
70
|
+
'sass',
|
71
|
+
'sass-loader',
|
72
|
+
'sass-resources-loader',
|
73
|
+
'style-loader',
|
74
|
+
'url-loader',
|
75
|
+
],
|
76
|
+
},
|
77
|
+
},
|
78
|
+
};
|
79
|
+
|
80
|
+
export default config;
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "rainbow"
|
4
|
+
|
3
5
|
# rubocop:disable: Layout/IndentHeredoc
|
4
6
|
module ReactOnRails
|
5
7
|
class PrerenderError < ::ReactOnRails::Error
|
@@ -51,11 +53,17 @@ module ReactOnRails
|
|
51
53
|
message << <<~MSG
|
52
54
|
Encountered error:
|
53
55
|
|
54
|
-
#{err}
|
56
|
+
#{err.inspect}
|
55
57
|
|
56
58
|
MSG
|
57
59
|
|
58
|
-
backtrace =
|
60
|
+
backtrace = if Utils.full_text_errors_enabled?
|
61
|
+
err.backtrace.join("\n")
|
62
|
+
else
|
63
|
+
"#{Rails.backtrace_cleaner.clean(err.backtrace).join("\n")}\n" +
|
64
|
+
Rainbow("The rest of the backtrace is hidden. " \
|
65
|
+
"To see the full backtrace, set FULL_TEXT_ERRORS=true.").red
|
66
|
+
end
|
59
67
|
else
|
60
68
|
backtrace = nil
|
61
69
|
end
|
data/lib/react_on_rails/utils.rb
CHANGED
@@ -8,7 +8,9 @@ require "active_support/core_ext/string"
|
|
8
8
|
|
9
9
|
module ReactOnRails
|
10
10
|
module Utils
|
11
|
-
TRUNCATION_FILLER = "\n... TRUNCATED
|
11
|
+
TRUNCATION_FILLER = "\n... TRUNCATED #{
|
12
|
+
Rainbow('To see the full output, set FULL_TEXT_ERRORS=true.').red
|
13
|
+
} ...\n".freeze
|
12
14
|
|
13
15
|
# https://forum.shakacode.com/t/yak-of-the-week-ruby-2-4-pathname-empty-changed-to-look-at-file-size/901
|
14
16
|
# return object if truthy, else return nil
|
@@ -183,9 +185,14 @@ module ReactOnRails
|
|
183
185
|
end
|
184
186
|
end
|
185
187
|
|
188
|
+
def self.full_text_errors_enabled?
|
189
|
+
ENV["FULL_TEXT_ERRORS"] == "true"
|
190
|
+
end
|
191
|
+
|
186
192
|
def self.smart_trim(str, max_length = 1000)
|
187
193
|
# From https://stackoverflow.com/a/831583/1009332
|
188
194
|
str = str.to_s
|
195
|
+
return str if full_text_errors_enabled?
|
189
196
|
return str unless str.present? && max_length >= 1
|
190
197
|
return str if str.length <= max_length
|
191
198
|
|
data/react_on_rails.gemspec
CHANGED
@@ -36,8 +36,8 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.post_install_message = '
|
37
37
|
--------------------------------------------------------------------------------
|
38
38
|
Checkout https://www.shakacode.com/react-on-rails-pro for information about
|
39
|
-
"React on Rails Pro" which includes
|
40
|
-
|
39
|
+
"React on Rails Pro" which includes a gem for better performance, via caching helpers, and our
|
40
|
+
node rendering server, support for React 19, and much more.
|
41
41
|
--------------------------------------------------------------------------------
|
42
42
|
'
|
43
43
|
end
|
data/tsconfig.json
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
{
|
2
|
+
"extends": "@tsconfig/node14",
|
2
3
|
"compilerOptions": {
|
3
4
|
"allowJs": true,
|
4
|
-
"esModuleInterop":
|
5
|
-
|
6
|
-
"
|
7
|
-
"
|
5
|
+
"esModuleInterop": false,
|
6
|
+
// needed for Jest tests even though we don't use .tsx
|
7
|
+
"jsx": "react-jsx",
|
8
|
+
"lib": ["dom", "es2020"],
|
9
|
+
"module": "node16",
|
8
10
|
"noImplicitAny": true,
|
9
11
|
"outDir": "node_package/lib",
|
10
12
|
"strict": true,
|
11
13
|
"incremental": true,
|
12
|
-
"target": "
|
14
|
+
"target": "es2020"
|
13
15
|
},
|
14
16
|
"include": ["node_package/src/**/*"]
|
15
17
|
}
|
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: 14.
|
4
|
+
version: 14.2.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: 2025-
|
11
|
+
date: 2025-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- SUMMARY.md
|
118
118
|
- app/helpers/react_on_rails_helper.rb
|
119
119
|
- docker-compose.yml
|
120
|
+
- knip.ts
|
120
121
|
- lib/generators/USAGE
|
121
122
|
- lib/generators/react_on_rails/adapt_for_older_shakapacker_generator.rb
|
122
123
|
- lib/generators/react_on_rails/base_generator.rb
|
@@ -203,8 +204,8 @@ post_install_message: |2
|
|
203
204
|
|
204
205
|
--------------------------------------------------------------------------------
|
205
206
|
Checkout https://www.shakacode.com/react-on-rails-pro for information about
|
206
|
-
"React on Rails Pro" which includes
|
207
|
-
|
207
|
+
"React on Rails Pro" which includes a gem for better performance, via caching helpers, and our
|
208
|
+
node rendering server, support for React 19, and much more.
|
208
209
|
--------------------------------------------------------------------------------
|
209
210
|
rdoc_options: []
|
210
211
|
require_paths:
|
@@ -220,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
221
|
- !ruby/object:Gem::Version
|
221
222
|
version: '0'
|
222
223
|
requirements: []
|
223
|
-
rubygems_version: 3.5.
|
224
|
+
rubygems_version: 3.5.11
|
224
225
|
signing_key:
|
225
226
|
specification_version: 4
|
226
227
|
summary: Rails with react server rendering with webpack.
|