react_on_rails 14.2.1 → 15.0.0.alpha.1
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 +5 -44
- data/CONTRIBUTING.md +14 -10
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/generators/react_on_rails/dev_tests_generator.rb +8 -4
- data/lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt +1 -1
- data/lib/react_on_rails/configuration.rb +1 -3
- data/lib/react_on_rails/engine.rb +3 -1
- data/lib/react_on_rails/locales/base.rb +1 -7
- data/lib/react_on_rails/packs_generator.rb +1 -1
- data/lib/react_on_rails/prerender_error.rb +2 -10
- data/lib/react_on_rails/utils.rb +1 -8
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/react_on_rails/version_checker.rb +23 -34
- data/react_on_rails.gemspec +2 -2
- data/tsconfig.json +5 -7
- metadata +5 -6
- data/knip.ts +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d60051000fbd817b3499b1de6f13c9abeaf5627bee250c50bf0d748ce3532a5
|
4
|
+
data.tar.gz: 4eccfe81e12b647503fa6e690c514d4d14d6704ab1e5c7f64282cafa7709d6e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99004f6792fe209d21474c7b5b311ac8a02cce27740b69164e44079983a5852895aa99ed12530043ba64ad6920d189cb6b19ce3957aca83b6bab06f75bf702ee
|
7
|
+
data.tar.gz: 2be5eb3178a913c90c7b4e640812bccc479245d0052d95751317f543c80e7bf9429f9fd61cbc1c5edb917aafbead33502c75fb63fd8ab183480aaa44124f3dc5
|
data/CHANGELOG.md
CHANGED
@@ -18,45 +18,7 @@ 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
|
-
|
22
|
-
|
23
|
-
#### Fixed
|
24
|
-
- Fixed a bug where the `load` event was not firing in Safari by postponing hydration to the next JavaScript task using `setTimeout(callback, 0)`. [PR 1729](https://github.com/shakacode/react_on_rails/pull/1729) by [Romex91](https://github.com/Romex91).
|
25
|
-
- Generated client packs now import from `react-on-rails/client` instead of `react-on-rails`. [PR 1706](https://github.com/shakacode/react_on_rails/pull/1706) by [alexeyr-ci](https://github.com/alexeyr-ci).
|
26
|
-
- The "optimization opportunity" message when importing the server-side `react-on-rails` instead of `react-on-rails/client` in browsers is now a warning for two reasons:
|
27
|
-
- Make it more prominent
|
28
|
-
- Include a stack trace when clicked
|
29
|
-
|
30
|
-
### [14.2.0] - 2025-03-03
|
31
|
-
|
32
|
-
#### Added
|
33
|
-
- 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).
|
34
|
-
|
35
|
-
#### Fixed
|
36
|
-
- 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).
|
37
|
-
- Disable `esModuleInterop` to increase interoperability [PR 1699](https://github.com/shakacode/react_on_rails/pull/1699) by [alexeyr-ci](https://github.com/alexeyr-ci).
|
38
|
-
- 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).
|
39
|
-
|
40
|
-
#### Changed
|
41
|
-
- 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).
|
42
|
-
|
43
|
-
### [14.1.1] - 2025-01-15
|
44
|
-
|
45
|
-
#### Fixed
|
46
|
-
|
47
|
-
- 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).
|
48
|
-
- 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).
|
49
|
-
|
50
|
-
### [14.1.0] - 2025-01-06
|
51
|
-
|
52
|
-
#### Fixed
|
53
|
-
|
54
|
-
- 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).
|
55
|
-
- Changed the ReactOnRails' version checker to use `ReactOnRails.configuration.node_modules_location` to determine the location of the package.json that the `react-on-rails` dependency is expected to be set by.
|
56
|
-
- Also, all errors that would be raised by the version checking have been converted to `Rails.Logger` warnings to avoid any breaking changes. [PR 1657](https://github.com/shakacode/react_on_rails/pull/1657) by [judahmeek](https://github.com/judahmeek).
|
57
|
-
- Enable use as a `git:` dependency. [PR 1664](https://github.com/shakacode/react_on_rails/pull/1664) by [alexeyr-ci](https://github.com/alexeyr-ci).
|
58
|
-
|
59
|
-
#### Added
|
21
|
+
#### Added(https://github.com/AbanoubGhadban).
|
60
22
|
- Added streaming server rendering support:
|
61
23
|
- [PR #1633](https://github.com/shakacode/react_on_rails/pull/1633) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
62
24
|
- New `stream_react_component` helper for adding streamed components to views
|
@@ -64,11 +26,13 @@ Changes since the last non-beta release.
|
|
64
26
|
- Enables progressive page loading and improved performance for server-rendered React components
|
65
27
|
- Added support for replaying console logs that occur during server rendering of streamed React components. This enables debugging of server-side rendering issues by capturing and displaying console output on the client and on the server output. [PR #1647](https://github.com/shakacode/react_on_rails/pull/1647) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
66
28
|
- Added support for handling errors happening during server rendering of streamed React components. It handles errors that happen during the initial render and errors that happen inside suspense boundaries. [PR #1648](https://github.com/shakacode/react_on_rails/pull/1648) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
67
|
-
- Added support for passing options to `YAML.safe_load` when loading locale files with `config.i18n_yml_safe_load_options`. [PR #1668](https://github.com/shakacode/react_on_rails/pull/1668) by [dzirtusss](https://github.com/dzirtusss).
|
68
29
|
|
69
30
|
#### Changed
|
70
31
|
- Console replay script generation now awaits the render request promise before generating, allowing it to capture console logs from asynchronous operations. This requires using a version of the Node renderer that supports replaying async console logs. [PR #1649](https://github.com/shakacode/react_on_rails/pull/1649) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
|
71
32
|
|
33
|
+
#### Fixed
|
34
|
+
- 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).
|
35
|
+
|
72
36
|
### [14.0.5] - 2024-08-20
|
73
37
|
#### Fixed
|
74
38
|
- Should force load react-components which send over turbo-stream [PR #1620](https://github.com/shakacode/react_on_rails/pull/1620) by [theforestvn88](https://github.com/theforestvn88).
|
@@ -1203,10 +1167,7 @@ Best done with Object destructing:
|
|
1203
1167
|
##### Fixed
|
1204
1168
|
- Fix several generator-related issues.
|
1205
1169
|
|
1206
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/14.
|
1207
|
-
[14.2.0]: https://github.com/shakacode/react_on_rails/compare/14.1.1...14.2.0
|
1208
|
-
[14.1.1]: https://github.com/shakacode/react_on_rails/compare/14.1.0...14.1.1
|
1209
|
-
[14.1.0]: https://github.com/shakacode/react_on_rails/compare/14.0.5...14.1.0
|
1170
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/14.0.5...master
|
1210
1171
|
[14.0.5]: https://github.com/shakacode/react_on_rails/compare/14.0.4...14.0.5
|
1211
1172
|
[14.0.4]: https://github.com/shakacode/react_on_rails/compare/14.0.3...14.0.4
|
1212
1173
|
[14.0.3]: https://github.com/shakacode/react_on_rails/compare/14.0.2...14.0.3
|
data/CONTRIBUTING.md
CHANGED
@@ -6,14 +6,20 @@
|
|
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
|
9
|
+
* After updating code via git, to prepare all examples and run all tests:
|
10
|
+
|
10
11
|
```sh
|
11
12
|
cd react_on_rails/
|
12
|
-
bundle && yarn && rake
|
13
|
+
bundle && yarn && rake examples:gen_all && rake node_package && rake
|
13
14
|
```
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
In order to run tests in browser
|
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.
|
17
23
|
|
18
24
|
# IDE/IDE SETUP
|
19
25
|
It's critical to configure your IDE/editor to ignore certain directories. Otherwise your IDE might slow to a crawl!
|
@@ -147,23 +153,21 @@ script/convert
|
|
147
153
|
yarn run dummy:spec
|
148
154
|
```
|
149
155
|
|
150
|
-
|
151
|
-
|
152
|
-
### JS tests
|
156
|
+
### Run NPM JS tests
|
153
157
|
|
154
158
|
```sh
|
155
159
|
cd react_on_rails/
|
156
|
-
yarn
|
160
|
+
yarn test
|
157
161
|
```
|
158
162
|
|
159
|
-
### spec/dummy tests
|
163
|
+
### Run spec/dummy tests
|
160
164
|
|
161
165
|
```sh
|
162
166
|
cd react_on_rails/spec/dummy
|
163
167
|
rspec
|
164
168
|
```
|
165
169
|
|
166
|
-
###
|
170
|
+
### Run most tests and linting
|
167
171
|
|
168
172
|
```sh
|
169
173
|
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 13. To see the older docs: [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).
|
@@ -47,10 +47,14 @@ module ReactOnRails
|
|
47
47
|
|
48
48
|
def add_yarn_relative_install_script_in_package_json
|
49
49
|
package_json = File.join(destination_root, "package.json")
|
50
|
-
contents =
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
contents = File.read(package_json)
|
51
|
+
replacement_value = <<-STRING
|
52
|
+
"scripts": {
|
53
|
+
"postinstall": "yalc link react-on-rails",
|
54
|
+
STRING
|
55
|
+
new_client_package_json_contents = contents.gsub(/ {2}"scripts": {/,
|
56
|
+
replacement_value)
|
57
|
+
File.open(package_json, "w+") { |f| f.puts new_client_package_json_contents }
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
@@ -52,7 +52,6 @@ module ReactOnRails
|
|
52
52
|
:generated_assets_dirs, :generated_assets_dir, :components_subdirectory,
|
53
53
|
:webpack_generated_files, :rendering_extension, :build_test_command,
|
54
54
|
:build_production_command, :i18n_dir, :i18n_yml_dir, :i18n_output_format,
|
55
|
-
:i18n_yml_safe_load_options,
|
56
55
|
:server_render_method, :random_dom_id, :auto_load_bundle,
|
57
56
|
:same_bundle_for_client_and_server, :rendering_props_extension,
|
58
57
|
:make_generated_server_bundle_the_entrypoint,
|
@@ -70,7 +69,7 @@ module ReactOnRails
|
|
70
69
|
rendering_extension: nil, build_test_command: nil,
|
71
70
|
build_production_command: nil, defer_generated_component_packs: nil,
|
72
71
|
same_bundle_for_client_and_server: nil,
|
73
|
-
i18n_dir: nil, i18n_yml_dir: nil, i18n_output_format: nil,
|
72
|
+
i18n_dir: nil, i18n_yml_dir: nil, i18n_output_format: nil,
|
74
73
|
random_dom_id: nil, server_render_method: nil, rendering_props_extension: nil,
|
75
74
|
components_subdirectory: nil, auto_load_bundle: nil, force_load: nil)
|
76
75
|
self.node_modules_location = node_modules_location.present? ? node_modules_location : Rails.root
|
@@ -81,7 +80,6 @@ module ReactOnRails
|
|
81
80
|
self.i18n_dir = i18n_dir
|
82
81
|
self.i18n_yml_dir = i18n_yml_dir
|
83
82
|
self.i18n_output_format = i18n_output_format
|
84
|
-
self.i18n_yml_safe_load_options = i18n_yml_safe_load_options
|
85
83
|
|
86
84
|
self.random_dom_id = random_dom_id
|
87
85
|
self.prerender = prerender
|
@@ -5,7 +5,9 @@ require "rails/railtie"
|
|
5
5
|
module ReactOnRails
|
6
6
|
class Engine < ::Rails::Engine
|
7
7
|
config.to_prepare do
|
8
|
-
VersionChecker.
|
8
|
+
if File.exist?(VersionChecker::NodePackageVersion.package_json_path)
|
9
|
+
VersionChecker.build.raise_if_gem_and_node_package_versions_differ
|
10
|
+
end
|
9
11
|
ReactOnRails::ServerRenderingPool.reset_pool
|
10
12
|
end
|
11
13
|
end
|
@@ -115,17 +115,11 @@ module ReactOnRails
|
|
115
115
|
translations = {}
|
116
116
|
defaults = {}
|
117
117
|
locale_files.each do |f|
|
118
|
-
|
119
|
-
translation = YAML.safe_load(File.open(f), **safe_load_options)
|
118
|
+
translation = YAML.safe_load(File.open(f))
|
120
119
|
key = translation.keys[0]
|
121
120
|
val = flatten(translation[key])
|
122
121
|
translations = translations.deep_merge(key => val)
|
123
122
|
defaults = defaults.deep_merge(flatten_defaults(val)) if key == default_locale
|
124
|
-
rescue Psych::Exception => e
|
125
|
-
raise ReactOnRails::Error, <<~MSG
|
126
|
-
Error parsing #{f}: #{e.message}
|
127
|
-
Consider fixing unsafe YAML or permitting with config.i18n_yml_safe_load_options
|
128
|
-
MSG
|
129
123
|
end
|
130
124
|
[translations.to_json, defaults.to_json]
|
131
125
|
end
|
@@ -47,7 +47,7 @@ module ReactOnRails
|
|
47
47
|
def pack_file_contents(file_path)
|
48
48
|
registered_component_name = component_name(file_path)
|
49
49
|
<<~FILE_CONTENT
|
50
|
-
import ReactOnRails from 'react-on-rails
|
50
|
+
import ReactOnRails from 'react-on-rails';
|
51
51
|
import #{registered_component_name} from '#{relative_component_path_from_generated_pack(file_path)}';
|
52
52
|
|
53
53
|
ReactOnRails.register({#{registered_component_name}});
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "rainbow"
|
4
|
-
|
5
3
|
# rubocop:disable: Layout/IndentHeredoc
|
6
4
|
module ReactOnRails
|
7
5
|
class PrerenderError < ::ReactOnRails::Error
|
@@ -53,17 +51,11 @@ module ReactOnRails
|
|
53
51
|
message << <<~MSG
|
54
52
|
Encountered error:
|
55
53
|
|
56
|
-
#{err
|
54
|
+
#{err}
|
57
55
|
|
58
56
|
MSG
|
59
57
|
|
60
|
-
backtrace =
|
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
|
58
|
+
backtrace = err.backtrace.first(15).join("\n")
|
67
59
|
else
|
68
60
|
backtrace = nil
|
69
61
|
end
|
data/lib/react_on_rails/utils.rb
CHANGED
@@ -8,9 +8,7 @@ require "active_support/core_ext/string"
|
|
8
8
|
|
9
9
|
module ReactOnRails
|
10
10
|
module Utils
|
11
|
-
TRUNCATION_FILLER = "\n... TRUNCATED
|
12
|
-
Rainbow('To see the full output, set FULL_TEXT_ERRORS=true.').red
|
13
|
-
} ...\n".freeze
|
11
|
+
TRUNCATION_FILLER = "\n... TRUNCATED ...\n"
|
14
12
|
|
15
13
|
# https://forum.shakacode.com/t/yak-of-the-week-ruby-2-4-pathname-empty-changed-to-look-at-file-size/901
|
16
14
|
# return object if truthy, else return nil
|
@@ -185,14 +183,9 @@ module ReactOnRails
|
|
185
183
|
end
|
186
184
|
end
|
187
185
|
|
188
|
-
def self.full_text_errors_enabled?
|
189
|
-
ENV["FULL_TEXT_ERRORS"] == "true"
|
190
|
-
end
|
191
|
-
|
192
186
|
def self.smart_trim(str, max_length = 1000)
|
193
187
|
# From https://stackoverflow.com/a/831583/1009332
|
194
188
|
str = str.to_s
|
195
|
-
return str if full_text_errors_enabled?
|
196
189
|
return str unless str.present? && max_length >= 1
|
197
190
|
return str if str.length <= max_length
|
198
191
|
|
@@ -19,9 +19,8 @@ module ReactOnRails
|
|
19
19
|
# For compatibility, the gem and the node package versions should always match,
|
20
20
|
# unless the user really knows what they're doing. So we will give a
|
21
21
|
# warning if they do not.
|
22
|
-
def
|
23
|
-
return if node_package_version.
|
24
|
-
return log_node_semver_version_warning if node_package_version.semver_wildcard?
|
22
|
+
def raise_if_gem_and_node_package_versions_differ
|
23
|
+
return if node_package_version.relative_path?
|
25
24
|
|
26
25
|
node_major_minor_patch = node_package_version.major_minor_patch
|
27
26
|
gem_major_minor_patch = gem_major_minor_patch_version
|
@@ -29,7 +28,9 @@ module ReactOnRails
|
|
29
28
|
node_major_minor_patch[1] == gem_major_minor_patch[1] &&
|
30
29
|
node_major_minor_patch[2] == gem_major_minor_patch[2]
|
31
30
|
|
32
|
-
|
31
|
+
raise_differing_versions_warning unless versions_match
|
32
|
+
|
33
|
+
raise_node_semver_version_warning if node_package_version.semver_wildcard?
|
33
34
|
end
|
34
35
|
|
35
36
|
private
|
@@ -45,15 +46,15 @@ module ReactOnRails
|
|
45
46
|
MSG
|
46
47
|
end
|
47
48
|
|
48
|
-
def
|
49
|
-
msg = "**
|
50
|
-
|
49
|
+
def raise_differing_versions_warning
|
50
|
+
msg = "**ERROR** ReactOnRails: ReactOnRails gem and node package versions do not match\n#{common_error_msg}"
|
51
|
+
raise ReactOnRails::Error, msg
|
51
52
|
end
|
52
53
|
|
53
|
-
def
|
54
|
-
msg = "**
|
54
|
+
def raise_node_semver_version_warning
|
55
|
+
msg = "**ERROR** ReactOnRails: Your node package version for react-on-rails contains a " \
|
55
56
|
"^ or ~\n#{common_error_msg}"
|
56
|
-
|
57
|
+
raise ReactOnRails::Error, msg
|
57
58
|
end
|
58
59
|
|
59
60
|
def gem_version
|
@@ -73,7 +74,7 @@ module ReactOnRails
|
|
73
74
|
end
|
74
75
|
|
75
76
|
def self.package_json_path
|
76
|
-
Rails.root.join(
|
77
|
+
Rails.root.join("client", "package.json")
|
77
78
|
end
|
78
79
|
|
79
80
|
def initialize(package_json)
|
@@ -81,41 +82,29 @@ module ReactOnRails
|
|
81
82
|
end
|
82
83
|
|
83
84
|
def raw
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
parsed_package_contents
|
88
|
-
|
89
|
-
|
90
|
-
return @raw = parsed_package_contents["dependencies"]["react-on-rails"]
|
91
|
-
end
|
85
|
+
parsed_package_contents = JSON.parse(package_json_contents)
|
86
|
+
if parsed_package_contents.key?("dependencies") &&
|
87
|
+
parsed_package_contents["dependencies"].key?("react-on-rails")
|
88
|
+
parsed_package_contents["dependencies"]["react-on-rails"]
|
89
|
+
else
|
90
|
+
raise ReactOnRails::Error, "No 'react-on-rails' entry in package.json dependencies"
|
92
91
|
end
|
93
|
-
msg = "No 'react-on-rails' entry in the dependencies of #{NodePackageVersion.package_json_path}, " \
|
94
|
-
"which is the expected location according to ReactOnRails.configuration.node_modules_location"
|
95
|
-
Rails.logger.warn(msg)
|
96
|
-
@raw = nil
|
97
92
|
end
|
98
93
|
|
99
94
|
def semver_wildcard?
|
100
|
-
|
101
|
-
# We want to disallow all expressions other than exact versions
|
102
|
-
# and the ones allowed by local_path_or_url?
|
103
|
-
raw.blank? || raw.match(/[~^><|*-]/).present?
|
95
|
+
raw.match(/[~^]/).present?
|
104
96
|
end
|
105
97
|
|
106
|
-
def
|
107
|
-
|
108
|
-
# All path and protocol "version ranges" include / somewhere,
|
109
|
-
# but we want to make an exception for npm:@scope/pkg@version.
|
110
|
-
!raw.nil? && raw.include?("/") && !raw.start_with?("npm:")
|
98
|
+
def relative_path?
|
99
|
+
raw.match(%r{(\.\.|\Afile:///)}).present?
|
111
100
|
end
|
112
101
|
|
113
102
|
def major_minor_patch
|
114
|
-
return if
|
103
|
+
return if relative_path?
|
115
104
|
|
116
105
|
match = raw.match(MAJOR_MINOR_PATCH_VERSION_REGEX)
|
117
106
|
unless match
|
118
|
-
raise ReactOnRails::Error, "Cannot parse version number '#{raw}' (
|
107
|
+
raise ReactOnRails::Error, "Cannot parse version number '#{raw}' (wildcard versions are not supported)"
|
119
108
|
end
|
120
109
|
|
121
110
|
[match[1], match[2], match[3]]
|
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 one hour a month of support and a gem for
|
40
|
+
better performance, via caching helpers, and our node rendering server.
|
41
41
|
--------------------------------------------------------------------------------
|
42
42
|
'
|
43
43
|
end
|
data/tsconfig.json
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
{
|
2
|
-
"extends": "@tsconfig/node14",
|
3
2
|
"compilerOptions": {
|
4
3
|
"allowJs": true,
|
5
|
-
"esModuleInterop":
|
6
|
-
|
7
|
-
"
|
8
|
-
"
|
9
|
-
"module": "node16",
|
4
|
+
"esModuleInterop": true,
|
5
|
+
"jsx": "react",
|
6
|
+
"lib": ["dom", "es2015"],
|
7
|
+
"module": "CommonJS",
|
10
8
|
"noImplicitAny": true,
|
11
9
|
"outDir": "node_package/lib",
|
12
10
|
"strict": true,
|
13
11
|
"incremental": true,
|
14
|
-
"target": "
|
12
|
+
"target": "es5"
|
15
13
|
},
|
16
14
|
"include": ["node_package/src/**/*"]
|
17
15
|
}
|
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:
|
4
|
+
version: 15.0.0.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -117,7 +117,6 @@ files:
|
|
117
117
|
- SUMMARY.md
|
118
118
|
- app/helpers/react_on_rails_helper.rb
|
119
119
|
- docker-compose.yml
|
120
|
-
- knip.ts
|
121
120
|
- lib/generators/USAGE
|
122
121
|
- lib/generators/react_on_rails/adapt_for_older_shakapacker_generator.rb
|
123
122
|
- lib/generators/react_on_rails/base_generator.rb
|
@@ -204,8 +203,8 @@ post_install_message: |2
|
|
204
203
|
|
205
204
|
--------------------------------------------------------------------------------
|
206
205
|
Checkout https://www.shakacode.com/react-on-rails-pro for information about
|
207
|
-
"React on Rails Pro" which includes
|
208
|
-
|
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.
|
209
208
|
--------------------------------------------------------------------------------
|
210
209
|
rdoc_options: []
|
211
210
|
require_paths:
|
@@ -221,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
220
|
- !ruby/object:Gem::Version
|
222
221
|
version: '0'
|
223
222
|
requirements: []
|
224
|
-
rubygems_version: 3.5.
|
223
|
+
rubygems_version: 3.5.3
|
225
224
|
signing_key:
|
226
225
|
specification_version: 4
|
227
226
|
summary: Rails with react server rendering with webpack.
|
data/knip.ts
DELETED
@@ -1,80 +0,0 @@
|
|
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;
|