react_on_rails_pro 16.2.0.beta.11 → 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 +4 -4
- data/.gitignore +1 -1
- data/.prettierignore +0 -1
- data/CHANGELOG.md +14 -4
- data/Gemfile.lock +5 -4
- data/app/helpers/react_on_rails_pro_helper.rb +190 -33
- data/eslint.config.mjs +26 -7
- data/lib/react_on_rails_pro/async_value.rb +35 -0
- data/lib/react_on_rails_pro/concerns/async_rendering.rb +68 -0
- data/lib/react_on_rails_pro/concerns/stream.rb +62 -49
- data/lib/react_on_rails_pro/configuration.rb +20 -10
- data/lib/react_on_rails_pro/immediate_async_value.rb +27 -0
- data/lib/react_on_rails_pro/version.rb +1 -1
- data/lib/react_on_rails_pro.rb +3 -0
- data/package-scripts.yml +20 -37
- data/package.json +9 -154
- data/rakelib/run_rspec.rake +1 -1
- data/react_on_rails_pro.gemspec +9 -7
- data/sig/react_on_rails_pro/async_value.rbs +15 -0
- data/sig/react_on_rails_pro/concerns/async_rendering.rbs +15 -0
- data/sig/react_on_rails_pro/immediate_async_value.rbs +15 -0
- metadata +24 -6
- data/script/preinstall.js +0 -31
- data/yarn.lock +0 -7599
|
@@ -31,72 +31,85 @@ module ReactOnRailsPro
|
|
|
31
31
|
#
|
|
32
32
|
# @see ReactOnRails::Helper#stream_react_component
|
|
33
33
|
def stream_view_containing_react_components(template:, close_stream_at_end: true, **render_options)
|
|
34
|
-
@rorp_rendering_fibers = []
|
|
35
|
-
template_string = render_to_string(template: template, **render_options)
|
|
36
|
-
# View may contain extra newlines, chunk already contains a newline
|
|
37
|
-
# Having multiple newlines between chunks causes hydration errors
|
|
38
|
-
# So we strip extra newlines from the template string and add a single newline
|
|
39
|
-
response.stream.write(template_string)
|
|
40
|
-
|
|
41
|
-
begin
|
|
42
|
-
drain_streams_concurrently
|
|
43
|
-
ensure
|
|
44
|
-
response.stream.close if close_stream_at_end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
def drain_streams_concurrently
|
|
51
34
|
require "async"
|
|
35
|
+
require "async/barrier"
|
|
52
36
|
require "async/limited_queue"
|
|
53
37
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# To avoid memory bloat, we use a limited queue to buffer chunks in memory.
|
|
38
|
+
Sync do |parent_task|
|
|
39
|
+
# Initialize async primitives for concurrent component streaming
|
|
40
|
+
@async_barrier = Async::Barrier.new
|
|
58
41
|
buffer_size = ReactOnRailsPro.configuration.concurrent_component_streaming_buffer_size
|
|
59
|
-
|
|
42
|
+
@main_output_queue = Async::LimitedQueue.new(buffer_size)
|
|
60
43
|
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
# Render template - components will start streaming immediately
|
|
45
|
+
template_string = render_to_string(template: template, **render_options)
|
|
46
|
+
# View may contain extra newlines, chunk already contains a newline
|
|
47
|
+
# Having multiple newlines between chunks causes hydration errors
|
|
48
|
+
# So we strip extra newlines from the template string and add a single newline
|
|
49
|
+
response.stream.write(template_string)
|
|
63
50
|
|
|
64
|
-
# This structure ensures that even if a producer task fails, we always
|
|
65
|
-
# signal the writer to stop and then wait for it to finish draining
|
|
66
|
-
# any remaining items from the queue before propagating the error.
|
|
67
51
|
begin
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
|
|
52
|
+
drain_streams_concurrently(parent_task)
|
|
53
|
+
# Do not close the response stream in an ensure block.
|
|
54
|
+
# If an error occurs we may need the stream open to send diagnostic/error details
|
|
55
|
+
# (for example, ApplicationController#rescue_from in the dummy app).
|
|
56
|
+
response.stream.close if close_stream_at_end
|
|
73
57
|
end
|
|
74
58
|
end
|
|
75
59
|
end
|
|
76
60
|
|
|
77
|
-
|
|
78
|
-
@rorp_rendering_fibers.each_with_index.map do |fiber, idx|
|
|
79
|
-
parent.async do
|
|
80
|
-
loop do
|
|
81
|
-
chunk = fiber.resume
|
|
82
|
-
break unless chunk
|
|
61
|
+
private
|
|
83
62
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
# Drains all streaming tasks concurrently using a producer-consumer pattern.
|
|
64
|
+
#
|
|
65
|
+
# Producer tasks: Created by consumer_stream_async in the helper, each streams
|
|
66
|
+
# chunks from the renderer and enqueues them to @main_output_queue.
|
|
67
|
+
#
|
|
68
|
+
# Consumer task: Single writer dequeues chunks and writes to response stream.
|
|
69
|
+
#
|
|
70
|
+
# Client disconnect handling:
|
|
71
|
+
# - If client disconnects (IOError/Errno::EPIPE), writer stops gracefully
|
|
72
|
+
# - Barrier is stopped to cancel all producer tasks, preventing wasted work
|
|
73
|
+
# - No exception propagates to the controller for client disconnects
|
|
74
|
+
def drain_streams_concurrently(parent_task)
|
|
75
|
+
client_disconnected = false
|
|
76
|
+
|
|
77
|
+
writing_task = parent_task.async do
|
|
78
|
+
# Drain all remaining chunks from the queue to the response stream
|
|
79
|
+
while (chunk = @main_output_queue.dequeue)
|
|
80
|
+
response.stream.write(chunk)
|
|
87
81
|
end
|
|
82
|
+
rescue IOError, Errno::EPIPE => e
|
|
83
|
+
# Client disconnected - stop writing gracefully
|
|
84
|
+
client_disconnected = true
|
|
85
|
+
log_client_disconnect("writer", e)
|
|
88
86
|
end
|
|
87
|
+
|
|
88
|
+
# Wait for all component streaming tasks to complete
|
|
89
|
+
begin
|
|
90
|
+
@async_barrier.wait
|
|
91
|
+
rescue StandardError => e
|
|
92
|
+
@async_barrier.stop
|
|
93
|
+
raise e
|
|
94
|
+
end
|
|
95
|
+
ensure
|
|
96
|
+
# Close the queue first to unblock writing_task (it may be waiting on dequeue)
|
|
97
|
+
@main_output_queue.close
|
|
98
|
+
|
|
99
|
+
# Wait for writing_task to ensure client_disconnected flag is set
|
|
100
|
+
# before we check it (fixes race condition where ensure runs before
|
|
101
|
+
# writing_task's rescue block sets the flag)
|
|
102
|
+
writing_task.wait
|
|
103
|
+
|
|
104
|
+
# If client disconnected, stop all producer tasks to avoid wasted work
|
|
105
|
+
@async_barrier.stop if client_disconnected
|
|
89
106
|
end
|
|
90
107
|
|
|
91
|
-
def
|
|
92
|
-
|
|
93
|
-
loop do
|
|
94
|
-
pair = queue.dequeue
|
|
95
|
-
break if pair.nil?
|
|
108
|
+
def log_client_disconnect(context, exception)
|
|
109
|
+
return unless ReactOnRails.configuration.logging_on_server
|
|
96
110
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
end
|
|
111
|
+
Rails.logger.debug do
|
|
112
|
+
"[React on Rails Pro] Client disconnected during streaming (#{context}): #{exception.class}"
|
|
100
113
|
end
|
|
101
114
|
end
|
|
102
115
|
end
|
|
@@ -70,7 +70,26 @@ module ReactOnRailsPro
|
|
|
70
70
|
:renderer_request_retry_limit, :throw_js_errors, :ssr_timeout,
|
|
71
71
|
:profile_server_rendering_js_code, :raise_non_shell_server_rendering_errors, :enable_rsc_support,
|
|
72
72
|
:rsc_payload_generation_url_path, :rsc_bundle_js_file, :react_client_manifest_file,
|
|
73
|
-
:react_server_client_manifest_file
|
|
73
|
+
:react_server_client_manifest_file
|
|
74
|
+
|
|
75
|
+
attr_reader :concurrent_component_streaming_buffer_size
|
|
76
|
+
|
|
77
|
+
# Sets the buffer size for concurrent component streaming.
|
|
78
|
+
#
|
|
79
|
+
# This value controls how many chunks can be buffered in memory during
|
|
80
|
+
# concurrent streaming operations. When producers generate chunks faster
|
|
81
|
+
# than they can be written to the client, this buffer prevents unbounded
|
|
82
|
+
# memory growth by blocking producers when the buffer is full.
|
|
83
|
+
#
|
|
84
|
+
# @param value [Integer] A positive integer specifying the buffer size
|
|
85
|
+
# @raise [ReactOnRailsPro::Error] if value is not a positive integer
|
|
86
|
+
def concurrent_component_streaming_buffer_size=(value)
|
|
87
|
+
unless value.is_a?(Integer) && value.positive?
|
|
88
|
+
raise ReactOnRailsPro::Error,
|
|
89
|
+
"config.concurrent_component_streaming_buffer_size must be a positive integer"
|
|
90
|
+
end
|
|
91
|
+
@concurrent_component_streaming_buffer_size = value
|
|
92
|
+
end
|
|
74
93
|
|
|
75
94
|
def initialize(renderer_url: nil, renderer_password: nil, server_renderer: nil, # rubocop:disable Metrics/AbcSize
|
|
76
95
|
renderer_use_fallback_exec_js: nil, prerender_caching: nil,
|
|
@@ -118,7 +137,6 @@ module ReactOnRailsPro
|
|
|
118
137
|
validate_remote_bundle_cache_adapter
|
|
119
138
|
setup_renderer_password
|
|
120
139
|
setup_assets_to_copy
|
|
121
|
-
validate_concurrent_component_streaming_buffer_size
|
|
122
140
|
setup_execjs_profiler_if_needed
|
|
123
141
|
check_react_on_rails_support_for_rsc
|
|
124
142
|
end
|
|
@@ -210,14 +228,6 @@ module ReactOnRailsPro
|
|
|
210
228
|
end
|
|
211
229
|
end
|
|
212
230
|
|
|
213
|
-
def validate_concurrent_component_streaming_buffer_size
|
|
214
|
-
return if concurrent_component_streaming_buffer_size.is_a?(Integer) &&
|
|
215
|
-
concurrent_component_streaming_buffer_size.positive?
|
|
216
|
-
|
|
217
|
-
raise ReactOnRailsPro::Error,
|
|
218
|
-
"config.concurrent_component_streaming_buffer_size must be a positive integer"
|
|
219
|
-
end
|
|
220
|
-
|
|
221
231
|
def setup_renderer_password
|
|
222
232
|
return if renderer_password.present?
|
|
223
233
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactOnRailsPro
|
|
4
|
+
# ImmediateAsyncValue is returned when a cached_async_react_component call
|
|
5
|
+
# has a cache hit. It provides the same interface as AsyncValue but returns
|
|
6
|
+
# the cached value immediately without any async operations.
|
|
7
|
+
#
|
|
8
|
+
class ImmediateAsyncValue
|
|
9
|
+
def initialize(value)
|
|
10
|
+
@value = value
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
attr_reader :value
|
|
14
|
+
|
|
15
|
+
def resolved?
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def to_s
|
|
20
|
+
@value.to_s
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def html_safe
|
|
24
|
+
@value.html_safe
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/react_on_rails_pro.rb
CHANGED
|
@@ -20,4 +20,7 @@ require "react_on_rails_pro/assets_precompile"
|
|
|
20
20
|
require "react_on_rails_pro/prepare_node_renderer_bundles"
|
|
21
21
|
require "react_on_rails_pro/concerns/stream"
|
|
22
22
|
require "react_on_rails_pro/concerns/rsc_payload_renderer"
|
|
23
|
+
require "react_on_rails_pro/concerns/async_rendering"
|
|
24
|
+
require "react_on_rails_pro/async_value"
|
|
25
|
+
require "react_on_rails_pro/immediate_async_value"
|
|
23
26
|
require "react_on_rails_pro/routes"
|
data/package-scripts.yml
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
1
|
scripts:
|
|
2
|
-
test:
|
|
3
|
-
default:
|
|
4
|
-
description: Run all JS tests
|
|
5
|
-
script: jest packages/node-renderer
|
|
6
|
-
ci:
|
|
7
|
-
description: Run all JS tests in CI mode
|
|
8
|
-
# https://circleci.com/docs/collect-test-data/#jest
|
|
9
|
-
script: jest --ci --runInBand --reporters=default --reporters=jest-junit -- packages/node-renderer
|
|
10
|
-
debug:
|
|
11
|
-
description: Debug all JS tests
|
|
12
|
-
script: ndb jest --runInBand packages/node-renderer
|
|
13
|
-
check:
|
|
14
|
-
description: Run all checks
|
|
15
|
-
script: nps lint && nps format.listDifferent && nps test && nps check-typescript
|
|
16
|
-
check-typescript:
|
|
17
|
-
description: Check for TypeScript errors
|
|
18
|
-
script: nps "build --noEmit" && tsc --project packages/node-renderer/tests && cd spec/dummy && yarn run tsc -p ./tsconfig.json --noEmit
|
|
19
2
|
fix:
|
|
20
3
|
description: Run all code fixes before committing
|
|
21
4
|
script: nps eslint.fix && nps format
|
|
22
5
|
node-renderer:
|
|
23
6
|
default:
|
|
24
7
|
description:
|
|
25
|
-
script: nps build && node --enable-source-maps packages/node-renderer/
|
|
8
|
+
script: nps build && node --enable-source-maps ../packages/react-on-rails-pro-node-renderer/lib/default-node-renderer.js
|
|
26
9
|
debug:
|
|
27
10
|
description: Debug Node Renderer
|
|
28
|
-
script: rm -rf /tmp/react-on-rails-pro-node-renderer-bundles && nps build && RENDERER_LOG_LEVEL=info NODE_DEBUG=ROR node --enable-source-maps packages/node-renderer/
|
|
11
|
+
script: rm -rf /tmp/react-on-rails-pro-node-renderer-bundles && nps build && RENDERER_LOG_LEVEL=info NODE_DEBUG=ROR node --enable-source-maps ../packages/react-on-rails-pro-node-renderer/lib/default-node-renderer.js
|
|
29
12
|
lint:
|
|
30
13
|
description: Run all linters
|
|
31
|
-
script: concurrently --prefix "[{name}]" --names "ESLINT, RUBOCOP, PRETTIER" -c "blue,yellow,magenta,orange" "nps eslint" "bundle exec rubocop" "nps format.listDifferent"
|
|
14
|
+
script: npx concurrently --prefix "[{name}]" --names "ESLINT, RUBOCOP, PRETTIER" -c "blue,yellow,magenta,orange" "nps eslint" "bundle exec rubocop" "nps format.listDifferent"
|
|
32
15
|
|
|
33
16
|
build:
|
|
34
17
|
default:
|
|
35
18
|
description: Build the project
|
|
36
|
-
script: echo "building the project" && rm -rf packages/node-renderer/
|
|
19
|
+
script: echo "building the project" && rm -rf ../packages/react-on-rails-pro-node-renderer/lib && npx tsc --project ../packages/react-on-rails-pro-node-renderer/src
|
|
37
20
|
prepack:
|
|
38
21
|
description: Build the project in the prepack/prepare scripts
|
|
39
22
|
# This is necessary when used as a Git dependency since we don't have the dist directory in the repo.
|
|
@@ -44,34 +27,34 @@ scripts:
|
|
|
44
27
|
# 3. Check if the project is built now;
|
|
45
28
|
# 4. If it failed, print an error message (still follow https://docs.npmjs.com/cli/v8/using-npm/scripts#best-practices).
|
|
46
29
|
script: >
|
|
47
|
-
[ -f packages/node-renderer/
|
|
30
|
+
[ -f ../packages/react-on-rails-pro-node-renderer/lib/ReactOnRailsProNodeRenderer.js ] ||
|
|
48
31
|
(nps build >/dev/null 2>&1 || true) &&
|
|
49
|
-
[ -f packages/node-renderer/
|
|
32
|
+
[ -f ../packages/react-on-rails-pro-node-renderer/lib/ReactOnRailsProNodeRenderer.js ] ||
|
|
50
33
|
{ echo 'Building react-on-rails-pro-node-renderer seems to have failed!'; }
|
|
51
34
|
|
|
52
35
|
clean:
|
|
53
36
|
description: Clean the project
|
|
54
|
-
script: rm -rf packages/node-renderer/
|
|
37
|
+
script: rm -rf ../packages/react-on-rails-pro-node-renderer/lib
|
|
55
38
|
|
|
56
39
|
eslint:
|
|
57
40
|
default:
|
|
58
41
|
description: Run eslint.
|
|
59
|
-
script: eslint . --report-unused-disable-directives
|
|
42
|
+
script: npx eslint . --report-unused-disable-directives
|
|
60
43
|
fix:
|
|
61
44
|
description: Run eslint and auto-fix.
|
|
62
|
-
script:
|
|
45
|
+
script: npx eslint . --report-unused-disable-directives --fix
|
|
63
46
|
debug:
|
|
64
47
|
description: Run eslint in debug mode.
|
|
65
|
-
script: DEBUG=eslint:cli-engine
|
|
48
|
+
script: DEBUG=eslint:cli-engine npx eslint . --report-unused-disable-directives
|
|
66
49
|
|
|
67
50
|
format:
|
|
68
51
|
default:
|
|
69
52
|
description: Format files using prettier.
|
|
70
|
-
script: concurrently --prefix "[{name}]" --names "js,ts,json" -c "yellow,magenta,green" "nps format.js" "nps format.ts" "nps format.json"
|
|
53
|
+
script: npx concurrently --prefix "[{name}]" --names "js,ts,json" -c "yellow,magenta,green" "nps format.js" "nps format.ts" "nps format.json"
|
|
71
54
|
listDifferent:
|
|
72
55
|
description: Check that all files were formatted using prettier.
|
|
73
56
|
script: |
|
|
74
|
-
concurrently \
|
|
57
|
+
npx concurrently \
|
|
75
58
|
--prefix "[{name}]" \
|
|
76
59
|
--names "js,ts,json" \
|
|
77
60
|
-c "yellow,magenta,green" \
|
|
@@ -81,29 +64,29 @@ scripts:
|
|
|
81
64
|
js:
|
|
82
65
|
default:
|
|
83
66
|
description: Run prettier on JS.
|
|
84
|
-
script: prettier "**/*.@(js|jsx|mjs)" --write
|
|
67
|
+
script: npx prettier "**/*.@(js|jsx|mjs)" --write
|
|
85
68
|
listDifferent:
|
|
86
69
|
description: Check if any JS files would change by running prettier.
|
|
87
|
-
script: prettier "**/*.@(js|jsx|mjs)" --list-different
|
|
70
|
+
script: npx prettier "**/*.@(js|jsx|mjs)" --list-different
|
|
88
71
|
ts:
|
|
89
72
|
default:
|
|
90
73
|
description: Run prettier on TS.
|
|
91
|
-
script: prettier "**/*.@(ts|tsx)" --write
|
|
74
|
+
script: npx prettier "**/*.@(ts|tsx)" --write
|
|
92
75
|
listDifferent:
|
|
93
76
|
description: Check if any TS files would change by running prettier.
|
|
94
|
-
script: prettier "**/*.@(ts|tsx)" --list-different
|
|
77
|
+
script: npx prettier "**/*.@(ts|tsx)" --list-different
|
|
95
78
|
json:
|
|
96
79
|
default:
|
|
97
80
|
description: Run prettier on JSON files.
|
|
98
|
-
script: rm -rf packages/node-renderer/tests/tmp && prettier "**/*.json" --write
|
|
81
|
+
script: rm -rf ../packages/react-on-rails-pro-node-renderer/tests/tmp && npx prettier "**/*.json" --write
|
|
99
82
|
listDifferent:
|
|
100
83
|
description: Check if any JSON files would change by running prettier.
|
|
101
|
-
script: prettier "**/*.json" --list-different
|
|
84
|
+
script: npx prettier "**/*.json" --list-different
|
|
102
85
|
|
|
103
86
|
renderer:
|
|
104
87
|
default:
|
|
105
88
|
description: Starts the node renderer.
|
|
106
|
-
script: nps build && RENDERER_PORT=3800 RENDERER_SUPPORT_MODULES=TRUE node
|
|
89
|
+
script: nps build && RENDERER_PORT=3800 RENDERER_SUPPORT_MODULES=TRUE node ../packages/react-on-rails-pro-node-renderer/lib/default-node-renderer.js
|
|
107
90
|
debug:
|
|
108
91
|
description: Starts the node renderer with debugging enabled. See Node.js V8 --inspector Manager (NiM)
|
|
109
|
-
script: nps build && RENDERER_WORKERS_COUNT=1 RENDERER_PORT=3800 RENDERER_SUPPORT_MODULES=TRUE ndb
|
|
92
|
+
script: nps build && RENDERER_WORKERS_COUNT=1 RENDERER_PORT=3800 RENDERER_SUPPORT_MODULES=TRUE ndb ../packages/react-on-rails-pro-node-renderer/lib/default-node-renderer.js
|
data/package.json
CHANGED
|
@@ -1,159 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "react-on-rails-pro-
|
|
3
|
-
"version": "16.2.0-
|
|
4
|
-
"
|
|
5
|
-
"description": "react-on-rails-pro
|
|
6
|
-
"exports": {
|
|
7
|
-
".": {
|
|
8
|
-
"types": "./packages/node-renderer/dist/ReactOnRailsProNodeRenderer.d.ts",
|
|
9
|
-
"default": "./packages/node-renderer/dist/ReactOnRailsProNodeRenderer.js"
|
|
10
|
-
},
|
|
11
|
-
"./integrations/*": {
|
|
12
|
-
"types": "./packages/node-renderer/dist/integrations/*.d.ts",
|
|
13
|
-
"default": "./packages/node-renderer/dist/integrations/*.js"
|
|
14
|
-
},
|
|
15
|
-
"./package.json": "./package.json"
|
|
16
|
-
},
|
|
17
|
-
"bin": {
|
|
18
|
-
"react-on-rails-pro-node-renderer": "packages/node-renderer/dist/default-node-renderer.js"
|
|
19
|
-
},
|
|
20
|
-
"directories": {
|
|
21
|
-
"doc": "docs"
|
|
22
|
-
},
|
|
23
|
-
"resolutions": {
|
|
24
|
-
"sentry-testkit/body-parser": "npm:empty-npm-package@1.0.0",
|
|
25
|
-
"sentry-testkit/express": "npm:empty-npm-package@1.0.0"
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@fastify/formbody": "^7.4.0 || ^8.0.2",
|
|
29
|
-
"@fastify/multipart": "^8.3.1 || ^9.0.3",
|
|
30
|
-
"fastify": "^4.29.0 || ^5.2.1",
|
|
31
|
-
"fs-extra": "^11.2.0",
|
|
32
|
-
"jsonwebtoken": "^9.0.2",
|
|
33
|
-
"lockfile": "^1.0.4"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@babel/core": "^7.26.10",
|
|
37
|
-
"@babel/eslint-parser": "^7.27.0",
|
|
38
|
-
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|
|
39
|
-
"@babel/preset-env": "^7.26.9",
|
|
40
|
-
"@babel/preset-react": "^7.26.3",
|
|
41
|
-
"@babel/preset-typescript": "^7.27.0",
|
|
42
|
-
"@eslint/compat": "^1.2.8",
|
|
43
|
-
"@honeybadger-io/js": "^6.10.1",
|
|
44
|
-
"@sentry/node": "^7.120.0",
|
|
45
|
-
"@tsconfig/node14": "^14.1.2",
|
|
46
|
-
"@types/fs-extra": "^11.0.4",
|
|
47
|
-
"@types/jest": "^29.5.12",
|
|
48
|
-
"@types/jsonwebtoken": "^9.0.10",
|
|
49
|
-
"@types/lockfile": "^1.0.4",
|
|
50
|
-
"@types/touch": "^3.1.5",
|
|
51
|
-
"babel-jest": "^29.7.0",
|
|
52
|
-
"concurrently": "^9.1.0",
|
|
53
|
-
"eslint": "^9.24.0",
|
|
54
|
-
"eslint-config-prettier": "^10.1.1",
|
|
55
|
-
"eslint-config-shakacode": "^19.0.0",
|
|
56
|
-
"eslint-import-resolver-alias": "^1.1.2",
|
|
57
|
-
"eslint-import-resolver-typescript": "^4.3.2",
|
|
58
|
-
"eslint-plugin-import": "^2.31.0",
|
|
59
|
-
"eslint-plugin-jest": "^28.11.0",
|
|
60
|
-
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
61
|
-
"eslint-plugin-prettier": "^5.2.6",
|
|
62
|
-
"eslint-plugin-react": "^7.37.5",
|
|
63
|
-
"eslint-plugin-react-hooks": "^5.2.0",
|
|
64
|
-
"form-auto-content": "^3.2.1",
|
|
65
|
-
"form-data": "^4.0.1",
|
|
66
|
-
"globals": "^16.0.0",
|
|
67
|
-
"husky": "^4.3.6",
|
|
68
|
-
"jest": "^29.7.0",
|
|
69
|
-
"jest-junit": "^16.0.0",
|
|
70
|
-
"jsdom": "^16.5.0",
|
|
71
|
-
"ndb": "^1.1.5",
|
|
72
|
-
"node-html-parser": "^7.0.1",
|
|
73
|
-
"nps": "^5.9.12",
|
|
74
|
-
"pino-pretty": "^13.0.0",
|
|
75
|
-
"prettier": "^3.2.5",
|
|
76
|
-
"react-on-rails": "link:.yalc/react-on-rails",
|
|
77
|
-
"redis": "^5.0.1",
|
|
78
|
-
"sentry-testkit": "^5.0.6",
|
|
79
|
-
"touch": "^3.1.0",
|
|
80
|
-
"typescript": "^5.4.3",
|
|
81
|
-
"typescript-eslint": "^8.29.1",
|
|
82
|
-
"yalc": "^1.0.0-pre.53"
|
|
83
|
-
},
|
|
84
|
-
"peerDependencies": {
|
|
85
|
-
"@honeybadger-io/js": ">=4.0.0",
|
|
86
|
-
"@sentry/node": ">=5.0.0 <9.0.0",
|
|
87
|
-
"@sentry/tracing": ">=5.0.0"
|
|
88
|
-
},
|
|
89
|
-
"peerDependenciesMeta": {
|
|
90
|
-
"@honeybadger-io/js": {
|
|
91
|
-
"optional": true
|
|
92
|
-
},
|
|
93
|
-
"@sentry/node": {
|
|
94
|
-
"optional": true
|
|
95
|
-
},
|
|
96
|
-
"@sentry/tracing": {
|
|
97
|
-
"optional": true
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"files": [
|
|
101
|
-
"packages/node-renderer/dist",
|
|
102
|
-
"script/preinstall.js"
|
|
103
|
-
],
|
|
2
|
+
"name": "react-on-rails-pro-dev",
|
|
3
|
+
"version": "16.2.0-test.2",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Development workspace for react-on-rails-pro (not published)",
|
|
104
6
|
"scripts": {
|
|
105
|
-
"
|
|
106
|
-
"postinstall": "test -f post-yarn-install.local && ./post-yarn-install.local || true",
|
|
107
|
-
"link-source": "cd ../packages/react-on-rails && yarn && yalc publish",
|
|
108
|
-
"test": "nps test",
|
|
109
|
-
"prepack": "nps build.prepack",
|
|
110
|
-
"prepare": "nps build.prepack",
|
|
111
|
-
"prepublishOnly": "nps build",
|
|
7
|
+
"nps": "nps",
|
|
112
8
|
"start": "nps",
|
|
113
|
-
"
|
|
114
|
-
"eslint": "eslint .",
|
|
115
|
-
"check": "nps lint && nps format && nps test"
|
|
116
|
-
},
|
|
117
|
-
"repository": {
|
|
118
|
-
"type": "git",
|
|
119
|
-
"url": "git+https://github.com/shakacode/react_on_rails.git"
|
|
120
|
-
},
|
|
121
|
-
"keywords": [
|
|
122
|
-
"react",
|
|
123
|
-
"webpack",
|
|
124
|
-
"JavaScript",
|
|
125
|
-
"Ruby",
|
|
126
|
-
"on",
|
|
127
|
-
"Rails"
|
|
128
|
-
],
|
|
129
|
-
"author": "justin@shakacode.com",
|
|
130
|
-
"license": "UNLICENSED",
|
|
131
|
-
"bugs": {
|
|
132
|
-
"url": "https://github.com/shakacode/react_on_rails/issues"
|
|
9
|
+
"prettier": "npx prettier"
|
|
133
10
|
},
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
"collectCoverageFrom": [
|
|
138
|
-
"packages/node-renderer/tests/**/*.{js,jsx,ts,tsx}"
|
|
139
|
-
],
|
|
140
|
-
"coverageReporters": [
|
|
141
|
-
"lcov"
|
|
142
|
-
],
|
|
143
|
-
"resetModules": true,
|
|
144
|
-
"resetMocks": true,
|
|
145
|
-
"setupFiles": [
|
|
146
|
-
"./packages/node-renderer/tests/helper.ts"
|
|
147
|
-
],
|
|
148
|
-
"testEnvironment": "node",
|
|
149
|
-
"transform": {
|
|
150
|
-
"^.+\\.[jt]sx?$": "babel-jest"
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"husky": {
|
|
154
|
-
"hooks": {
|
|
155
|
-
"pre-commit": "yalc check"
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"nps": "^5.9.3"
|
|
13
|
+
}
|
|
159
14
|
}
|
data/rakelib/run_rspec.rake
CHANGED
data/react_on_rails_pro.gemspec
CHANGED
|
@@ -6,7 +6,7 @@ require "react_on_rails_pro/version"
|
|
|
6
6
|
|
|
7
7
|
# Load the core react_on_rails version for dependency
|
|
8
8
|
# This is evaluated at build time, not on user machines
|
|
9
|
-
require_relative "../lib/react_on_rails/version"
|
|
9
|
+
require_relative "../react_on_rails/lib/react_on_rails/version"
|
|
10
10
|
|
|
11
11
|
Gem::Specification.new do |s|
|
|
12
12
|
s.name = "react_on_rails_pro"
|
|
@@ -20,12 +20,11 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
s.license = "UNLICENSED"
|
|
21
21
|
s.metadata["rubygems_mfa_required"] = "true"
|
|
22
22
|
|
|
23
|
-
s.files
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
23
|
+
s.files = Dir.chdir(__dir__) do
|
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
25
|
+
f.match(%r{^(test|spec|features|tmp|node_modules|packages|coverage|Gemfile.lock|lib/tasks)/})
|
|
26
|
+
end
|
|
27
|
+
end
|
|
29
28
|
s.bindir = "exe"
|
|
30
29
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
30
|
s.require_paths = ["lib"]
|
|
@@ -36,6 +35,9 @@ Gem::Specification.new do |s|
|
|
|
36
35
|
s.add_runtime_dependency "connection_pool"
|
|
37
36
|
s.add_runtime_dependency "execjs", "~> 2.9"
|
|
38
37
|
s.add_runtime_dependency "httpx", "~> 1.5"
|
|
38
|
+
# Needed to avoid this bug at httpx versions >= 1.6.0:
|
|
39
|
+
# https://github.com/HoneyryderChuck/httpx/issues/118
|
|
40
|
+
s.add_runtime_dependency "http-2", ">= 1.1.1"
|
|
39
41
|
s.add_runtime_dependency "jwt", "~> 2.7"
|
|
40
42
|
s.add_runtime_dependency "async", ">= 2.6"
|
|
41
43
|
s.add_runtime_dependency "rainbow"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module ReactOnRailsPro
|
|
2
|
+
module AsyncRendering
|
|
3
|
+
module ClassMethods
|
|
4
|
+
def enable_async_react_rendering: (**untyped options) -> void
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
@react_on_rails_async_barrier: untyped
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def wrap_in_async_react_context: () { () -> untyped } -> untyped
|
|
12
|
+
|
|
13
|
+
def check_for_unresolved_async_components: () -> void
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module ReactOnRailsPro
|
|
2
|
+
class ImmediateAsyncValue
|
|
3
|
+
attr_reader value: untyped
|
|
4
|
+
|
|
5
|
+
@value: untyped
|
|
6
|
+
|
|
7
|
+
def initialize: (untyped value) -> void
|
|
8
|
+
|
|
9
|
+
def resolved?: () -> bool
|
|
10
|
+
|
|
11
|
+
def to_s: () -> String
|
|
12
|
+
|
|
13
|
+
def html_safe: () -> untyped
|
|
14
|
+
end
|
|
15
|
+
end
|