react_on_rails 14.1.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0e439ad231345f667bd0397a191854a1fc1265fd6b53aa4ff07297c52cbea88
4
- data.tar.gz: 80499fba8a3696ba0bca1a07742a36c0bc1c286294ebdab57d0f742c94d8a32b
3
+ metadata.gz: 5bcd1f3d6e521231a8435057a0979cf4d354b6ee075ca172dfa554e7837b516f
4
+ data.tar.gz: f3569c8499bfc239486670d24248523b311cf4a97ee616df7bd97c6c15d4ee33
5
5
  SHA512:
6
- metadata.gz: fe4dd909d8ee7f1ee6e7210acdee7fbede95caa508b41d2f43e88aa11113bbb8d3eb88e4c0b24a826b472b2ac5ed234e5c6ba8ea357488d59d21fd995c010e36
7
- data.tar.gz: 83c5ccc2589399f773872291069f591179a2eb3cd13b8420102bd95f65421a6f00cc9d591a578adb5ae20339a7cd5dba7cf0f87bce25a0041a7ef9e7f3497a3a
6
+ metadata.gz: 929bc16300843b336cab3022fc3a681feea4cf1fba3dbdf35c88df9508058ba32f1f7eeb29ac0a044a1fa1254aca16ec216159e4c08a5c660e18df428348d01f
7
+ data.tar.gz: 8b3ba8b7608c2ced7cb314d2efcd944cd362ee7f1807472de601574b5237c66d9093dcd98741f235fddce0d9f84bb9bf9b60a846a4a4ce85c1fa2498d191552b
data/CHANGELOG.md CHANGED
@@ -18,6 +18,17 @@ 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
+
21
32
  ### [14.1.1] - 2025-01-15
22
33
 
23
34
  #### Fixed
data/CONTRIBUTING.md CHANGED
@@ -9,7 +9,7 @@
9
9
  * After updating code via Git, to prepare all examples:
10
10
  ```sh
11
11
  cd react_on_rails/
12
- bundle && yarn && rake examples:gen_all && rake node_package && rake
12
+ bundle && yarn && rake shakapacker_examples:gen_all && rake node_package && rake
13
13
  ```
14
14
 
15
15
  See [Dev Initial Setup](#dev-initial-setup) below for, well... initial setup,
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- react_on_rails (14.1.0)
4
+ react_on_rails (14.1.1)
5
5
  addressable
6
6
  connection_pool
7
7
  execjs (~> 2.5)
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 = err.backtrace.first(15).join("\n")
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
@@ -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 ...\n"
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactOnRails
4
- VERSION = "14.1.1"
4
+ VERSION = "14.2.0"
5
5
  end
@@ -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 one hour a month of support and a gem for
40
- better performance, via caching helpers, and our node rendering server.
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": true,
5
+ "esModuleInterop": false,
6
+ // needed for Jest tests even though we don't use .tsx
5
7
  "jsx": "react-jsx",
6
- "lib": ["dom", "es2015"],
7
- "module": "CommonJS",
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": "es5"
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.1.1
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-01-17 00:00:00.000000000 Z
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 one hour a month of support and a gem for
207
- better performance, via caching helpers, and our node rendering server.
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.3
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.