stimulus_reflex 3.5.0.pre8 → 3.5.0.pre10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of stimulus_reflex might be problematic. Click here for more details.

Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -1218
  3. data/Gemfile +0 -1
  4. data/Gemfile.lock +145 -193
  5. data/README.md +48 -20
  6. data/Rakefile +0 -8
  7. data/app/assets/javascripts/stimulus_reflex.js +1174 -0
  8. data/app/assets/javascripts/stimulus_reflex.min.js +2 -0
  9. data/app/assets/javascripts/stimulus_reflex.min.js.map +1 -0
  10. data/app/assets/javascripts/stimulus_reflex.umd.js +1064 -0
  11. data/app/assets/javascripts/stimulus_reflex.umd.min.js +1065 -0
  12. data/app/assets/javascripts/stimulus_reflex.umd.min.js.map +1 -0
  13. data/app/channels/stimulus_reflex/channel.rb +28 -7
  14. data/bin/console +0 -2
  15. data/bin/standardize +2 -1
  16. data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +72 -7
  17. data/lib/generators/stimulus_reflex/templates/app/controllers/examples_controller.rb.tt +9 -0
  18. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/consumer.js.tt +6 -0
  19. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.esbuild.tt +4 -0
  20. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.importmap.tt +2 -0
  21. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.shakapacker.tt +5 -0
  22. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.vite.tt +1 -0
  23. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.webpacker.tt +5 -0
  24. data/lib/generators/stimulus_reflex/templates/app/javascript/config/cable_ready.js.tt +4 -0
  25. data/lib/generators/stimulus_reflex/templates/app/javascript/config/index.js.tt +2 -0
  26. data/lib/generators/stimulus_reflex/templates/app/javascript/config/mrujs.js.tt +9 -0
  27. data/lib/generators/stimulus_reflex/templates/app/javascript/config/stimulus_reflex.js.tt +5 -0
  28. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +114 -74
  29. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application.js.tt +11 -0
  30. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application_controller.js.tt +49 -35
  31. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.esbuild.tt +7 -0
  32. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.importmap.tt +5 -0
  33. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.shakapacker.tt +5 -0
  34. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.vite.tt +5 -0
  35. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.webpacker.tt +5 -0
  36. data/lib/generators/stimulus_reflex/templates/app/reflexes/%file_name%_reflex.rb.tt +38 -7
  37. data/lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt +10 -2
  38. data/lib/generators/stimulus_reflex/templates/app/views/examples/show.html.erb.tt +207 -0
  39. data/lib/generators/stimulus_reflex/templates/config/initializers/cable_ready.rb +22 -0
  40. data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +18 -13
  41. data/lib/generators/stimulus_reflex/templates/esbuild.config.mjs.tt +94 -0
  42. data/lib/install/action_cable.rb +155 -0
  43. data/lib/install/broadcaster.rb +90 -0
  44. data/lib/install/bundle.rb +56 -0
  45. data/lib/install/compression.rb +41 -0
  46. data/lib/install/config.rb +87 -0
  47. data/lib/install/development.rb +110 -0
  48. data/lib/install/esbuild.rb +114 -0
  49. data/lib/install/example.rb +22 -0
  50. data/lib/install/importmap.rb +133 -0
  51. data/lib/install/initializers.rb +25 -0
  52. data/lib/install/mrujs.rb +133 -0
  53. data/lib/install/npm_packages.rb +25 -0
  54. data/lib/install/reflexes.rb +25 -0
  55. data/lib/install/shakapacker.rb +64 -0
  56. data/lib/install/spring.rb +54 -0
  57. data/lib/install/updatable.rb +34 -0
  58. data/lib/install/vite.rb +64 -0
  59. data/lib/install/webpacker.rb +90 -0
  60. data/lib/install/yarn.rb +55 -0
  61. data/lib/stimulus_reflex/broadcasters/broadcaster.rb +15 -8
  62. data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +7 -8
  63. data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +10 -10
  64. data/lib/stimulus_reflex/broadcasters/update.rb +3 -0
  65. data/lib/stimulus_reflex/cable_readiness.rb +29 -0
  66. data/lib/stimulus_reflex/cable_ready_channels.rb +5 -5
  67. data/lib/stimulus_reflex/callbacks.rb +17 -1
  68. data/lib/stimulus_reflex/concern_enhancer.rb +6 -4
  69. data/lib/stimulus_reflex/configuration.rb +12 -2
  70. data/lib/stimulus_reflex/dataset.rb +11 -1
  71. data/lib/stimulus_reflex/engine.rb +40 -0
  72. data/lib/stimulus_reflex/html/document.rb +59 -0
  73. data/lib/stimulus_reflex/html/document_fragment.rb +13 -0
  74. data/lib/stimulus_reflex/importmap.rb +7 -0
  75. data/lib/stimulus_reflex/installer.rb +274 -0
  76. data/lib/stimulus_reflex/open_struct_fix.rb +31 -0
  77. data/lib/stimulus_reflex/reflex.rb +32 -25
  78. data/lib/stimulus_reflex/reflex_data.rb +18 -2
  79. data/lib/stimulus_reflex/reflex_factory.rb +6 -3
  80. data/lib/stimulus_reflex/request_parameters.rb +2 -0
  81. data/lib/stimulus_reflex/utils/logger.rb +12 -0
  82. data/lib/stimulus_reflex/utils/sanity_checker.rb +8 -106
  83. data/lib/stimulus_reflex/version.rb +1 -1
  84. data/lib/stimulus_reflex.rb +4 -6
  85. data/lib/tasks/stimulus_reflex/stimulus_reflex.rake +252 -0
  86. data/package.json +73 -0
  87. data/rollup.config.mjs +86 -0
  88. data/stimulus_reflex.gemspec +60 -0
  89. data/web-test-runner.config.mjs +12 -0
  90. data/yarn.lock +5098 -0
  91. metadata +191 -78
  92. data/LATEST +0 -1
  93. data/lib/generators/USAGE +0 -14
  94. data/lib/generators/stimulus_reflex/initializer_generator.rb +0 -14
  95. data/lib/tasks/stimulus_reflex/install.rake +0 -116
  96. data/test/broadcasters/broadcaster_test.rb +0 -11
  97. data/test/broadcasters/broadcaster_test_case.rb +0 -39
  98. data/test/broadcasters/nothing_broadcaster_test.rb +0 -30
  99. data/test/broadcasters/page_broadcaster_test.rb +0 -77
  100. data/test/broadcasters/selector_broadcaster_test.rb +0 -167
  101. data/test/callbacks_test.rb +0 -652
  102. data/test/concern_enhancer_test.rb +0 -54
  103. data/test/element_test.rb +0 -254
  104. data/test/generators/stimulus_reflex_generator_test.rb +0 -58
  105. data/test/reflex_test.rb +0 -43
  106. data/test/test_helper.rb +0 -71
  107. data/test/tmp/app/reflexes/application_reflex.rb +0 -19
  108. data/test/tmp/app/reflexes/demo_reflex.rb +0 -35
@@ -1,50 +1,57 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ClientAttributes = Struct.new(:reflex_id, :tab_id, :reflex_controller, :xpath_controller, :xpath_element, :permanent_attribute_name, :suppress_logging, keyword_init: true)
3
+ require "stimulus_reflex/cable_readiness"
4
+
5
+ # TODO remove xpath_controller and xpath_element for v4
6
+ ClientAttributes = Struct.new(:id, :tab_id, :reflex_controller, :xpath_controller, :xpath_element, :permanent_attribute_name, :version, :suppress_logging, keyword_init: true)
4
7
 
5
8
  class StimulusReflex::Reflex
9
+ class VersionMismatchError < StandardError; end
10
+
11
+ prepend StimulusReflex::CableReadiness
6
12
  include ActiveSupport::Rescuable
7
13
  include StimulusReflex::Callbacks
8
14
  include ActionView::Helpers::TagHelper
9
15
  include CableReady::Identifiable
10
16
 
11
17
  attr_accessor :payload, :headers
12
- attr_reader :cable_ready, :channel, :url, :element, :selectors, :method_name, :broadcaster, :client_attributes, :logger
18
+ attr_reader :channel, :url, :element, :selectors, :method_name, :broadcaster, :client_attributes, :logger
13
19
 
14
20
  alias_method :action_name, :method_name # for compatibility with controller libraries like Pundit that expect an action name
15
21
 
16
22
  delegate :connection, :stream_name, to: :channel
17
23
  delegate :controller_class, :flash, :session, to: :request
18
- delegate :broadcast, :halted, :error, to: :broadcaster
19
- delegate :reflex_id, :tab_id, :reflex_controller, :xpath_controller, :xpath_element, :permanent_attribute_name, :suppress_logging, to: :client_attributes
24
+ delegate :broadcast, :broadcast_halt, :broadcast_forbid, :broadcast_error, to: :broadcaster
25
+ # TODO remove xpath_controller and xpath_element for v4
26
+ delegate :id, :tab_id, :reflex_controller, :xpath_controller, :xpath_element, :permanent_attribute_name, :version, :suppress_logging, to: :client_attributes
20
27
 
21
28
  def initialize(channel, url: nil, element: nil, selectors: [], method_name: nil, params: {}, client_attributes: {})
22
- if is_a? CableReady::Broadcaster
23
- message = <<~MSG
24
-
25
- #{self.class.name} includes CableReady::Broadcaster, and you need to remove it.
26
- Reflexes have their own CableReady interface. You can just assume that it's present.
27
- See https://docs.stimulusreflex.com/rtfm/cableready#using-cableready-inside-a-reflex-action for more details.
28
-
29
- MSG
30
- raise TypeError.new(message.strip)
31
- end
32
-
33
29
  @channel = channel
34
30
  @url = url
35
31
  @element = element
36
32
  @selectors = selectors
37
33
  @method_name = method_name
38
34
  @params = params
39
- @broadcaster = StimulusReflex::PageBroadcaster.new(self)
40
35
  @client_attributes = ClientAttributes.new(client_attributes)
36
+ @broadcaster = StimulusReflex::PageBroadcaster.new(self)
41
37
  @logger = suppress_logging ? nil : StimulusReflex::Logger.new(self)
42
- @cable_ready = StimulusReflex::CableReadyChannels.new(stream_name, reflex_id)
43
38
  @payload = {}
44
39
  @headers = {}
40
+
41
+ if version != StimulusReflex::VERSION && StimulusReflex.config.on_failed_sanity_checks != :ignore
42
+ raise VersionMismatchError.new("stimulus_reflex gem / NPM package version mismatch")
43
+ end
44
+
45
45
  self.params
46
46
  end
47
47
 
48
+ # TODO: remove this for v4
49
+ def reflex_id
50
+ warn "Deprecation warning: reflex_id will be removed in v4. Use id instead!" if Rails.env.development?
51
+ id
52
+ end
53
+ # END TODO: remove
54
+
48
55
  def request
49
56
  @request ||= begin
50
57
  uri = URI.parse(url)
@@ -87,10 +94,10 @@ class StimulusReflex::Reflex
87
94
  when :page
88
95
  raise StandardError.new("Cannot call :page morph after :#{broadcaster.to_sym} morph") unless broadcaster.page?
89
96
  when :nothing
90
- raise StandardError.new("Cannot call :nothing morph after :selector morph") if broadcaster.selector?
97
+ raise StandardError.new("#{broadcaster.to_sym} morph type has already been set") if broadcaster.selector?
91
98
  @broadcaster = StimulusReflex::NothingBroadcaster.new(self) unless broadcaster.nothing?
92
99
  else
93
- raise StandardError.new("Cannot call :selector morph after :nothing morph") if broadcaster.nothing?
100
+ raise StandardError.new("#{broadcaster.to_sym} morph type has already been set") if broadcaster.nothing?
94
101
  @broadcaster = StimulusReflex::SelectorBroadcaster.new(self) unless broadcaster.selector?
95
102
  broadcaster.append_morph(selectors, html)
96
103
  end
@@ -121,12 +128,7 @@ class StimulusReflex::Reflex
121
128
 
122
129
  # Invoke the reflex action specified by `name` and run all callbacks
123
130
  def process(name, *args)
124
- reflex_invoked = false
125
- result = run_callbacks(:process) {
126
- public_send(name, *args).tap { reflex_invoked = true }
127
- }
128
- @halted ||= result == false && !reflex_invoked
129
- result
131
+ run_callbacks(:process) { public_send(name, *args) }
130
132
  end
131
133
 
132
134
  # Indicates if the callback chain was halted via a throw(:abort) in a before_reflex callback.
@@ -136,6 +138,11 @@ class StimulusReflex::Reflex
136
138
  !!@halted
137
139
  end
138
140
 
141
+ # Indicates if the callback chain was halted via a throw(:forbidden) in a before_reflex callback.
142
+ def forbidden?
143
+ !!@forbidden
144
+ end
145
+
139
146
  def default_reflex
140
147
  # noop default reflex to force page reloads
141
148
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class StimulusReflex::ReflexData
2
4
  attr_reader :data
3
5
 
@@ -49,18 +51,27 @@ class StimulusReflex::ReflexData
49
51
  Rack::Utils.parse_nested_query(data["formData"])
50
52
  end
51
53
 
54
+ def params
55
+ form_params.merge(url_params)
56
+ end
57
+
52
58
  def form_params
53
59
  form_data.deep_merge(data["params"] || {})
54
60
  end
55
61
 
56
- def reflex_id
57
- data["reflexId"]
62
+ def url_params
63
+ Rack::Utils.parse_nested_query(URI.parse(url).query)
64
+ end
65
+
66
+ def id
67
+ data["id"]
58
68
  end
59
69
 
60
70
  def tab_id
61
71
  data["tabId"]
62
72
  end
63
73
 
74
+ # TODO: remove this in v4
64
75
  def xpath_controller
65
76
  data["xpathController"]
66
77
  end
@@ -68,11 +79,16 @@ class StimulusReflex::ReflexData
68
79
  def xpath_element
69
80
  data["xpathElement"]
70
81
  end
82
+ # END TODO remove
71
83
 
72
84
  def reflex_controller
73
85
  data["reflexController"]
74
86
  end
75
87
 
88
+ def version
89
+ data["version"].to_s.gsub("-pre", ".pre")
90
+ end
91
+
76
92
  private
77
93
 
78
94
  def object_with_indifferent_access(object)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class StimulusReflex::ReflexFactory
2
4
  class << self
3
5
  attr_reader :reflex_data
@@ -9,15 +11,16 @@ class StimulusReflex::ReflexFactory
9
11
  element: reflex_data.element,
10
12
  selectors: reflex_data.selectors,
11
13
  method_name: reflex_data.method_name,
12
- params: reflex_data.form_params,
14
+ params: reflex_data.params,
13
15
  client_attributes: {
14
- reflex_id: reflex_data.reflex_id,
16
+ id: reflex_data.id,
15
17
  tab_id: reflex_data.tab_id,
16
18
  xpath_controller: reflex_data.xpath_controller,
17
19
  xpath_element: reflex_data.xpath_element,
18
20
  reflex_controller: reflex_data.reflex_controller,
19
21
  permanent_attribute_name: reflex_data.permanent_attribute_name,
20
- suppress_logging: reflex_data.suppress_logging
22
+ suppress_logging: reflex_data.suppress_logging,
23
+ version: reflex_data.version
21
24
  })
22
25
  end
23
26
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module StimulusReflex
2
4
  class RequestParameters
3
5
  def initialize(params:, req:, url:)
@@ -27,6 +27,8 @@ module StimulusReflex
27
27
  def config_logging
28
28
  return @config_logging if @config_logging
29
29
 
30
+ return unless StimulusReflex.config.logging.instance_of?(Proc)
31
+
30
32
  StimulusReflex.config.logging.binding.eval("using StimulusReflex::Utils::Colorize")
31
33
  @config_logging = StimulusReflex.config.logging
32
34
  end
@@ -44,6 +46,15 @@ module StimulusReflex
44
46
  reflex.class.to_s + "#" + reflex.method_name
45
47
  end
46
48
 
49
+ def id_full
50
+ reflex.id
51
+ end
52
+
53
+ def id
54
+ id_full[0..7]
55
+ end
56
+
57
+ # TODO: remove for v4
47
58
  def reflex_id_full
48
59
  reflex.reflex_id
49
60
  end
@@ -51,6 +62,7 @@ module StimulusReflex
51
62
  def reflex_id
52
63
  reflex_id_full[0..7]
53
64
  end
65
+ # END TODO remove
54
66
 
55
67
  def mode
56
68
  reflex.broadcaster.to_s
@@ -1,10 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class StimulusReflex::SanityChecker
4
- LATEST_VERSION_FORMAT = /^(\d+\.\d+\.\d+)$/
5
- NODE_VERSION_FORMAT = /(\d+\.\d+\.\d+.*):/
6
- JSON_VERSION_FORMAT = /(\d+\.\d+\.\d+.*)"/
7
-
8
4
  class << self
9
5
  def check!
10
6
  return if ENV["SKIP_SANITY_CHECK"]
@@ -15,9 +11,7 @@ class StimulusReflex::SanityChecker
15
11
 
16
12
  instance = new
17
13
  instance.check_caching_enabled
18
- instance.check_package_versions_match
19
14
  # instance.check_default_url_config
20
- instance.check_new_version_available
21
15
  end
22
16
 
23
17
  private
@@ -51,7 +45,7 @@ class StimulusReflex::SanityChecker
51
45
  if using_null_store?
52
46
  warn_and_exit <<~WARN
53
47
  👉 StimulusReflex requires caching to be enabled.
54
-
48
+
55
49
  Caching allows the session to be modified during ActionCable requests. Your config.cache_store is set to :null_store, so it won't work.
56
50
  WARN
57
51
  end
@@ -59,7 +53,7 @@ class StimulusReflex::SanityChecker
59
53
 
60
54
  def check_default_url_config
61
55
  return if StimulusReflex.config.on_missing_default_urls == :ignore
62
- if default_url_config_set? == false
56
+ if default_url_config_missing?
63
57
  puts <<~WARN
64
58
  👉 StimulusReflex strongly suggests that you set default_url_options in your environment files. Otherwise, ActionController #{"and ActionMailer " if defined?(ActionMailer)}will default to example.com when rendering route helpers.
65
59
 
@@ -73,51 +67,6 @@ class StimulusReflex::SanityChecker
73
67
  end
74
68
  end
75
69
 
76
- def check_package_versions_match
77
- if npm_version.nil?
78
- warn_and_exit <<~WARN
79
- 👉 Can't locate the stimulus_reflex npm package.
80
-
81
- yarn add stimulus_reflex@#{gem_version}
82
-
83
- Either add it to your package.json as a dependency or use "yarn link stimulus_reflex" if you are doing development.
84
- WARN
85
- end
86
-
87
- if package_version_mismatch?
88
- warn_and_exit <<~WARN
89
- 👉 The stimulus_reflex npm package version (#{npm_version}) does not match the Rubygem version (#{gem_version}).
90
-
91
- To update the stimulus_reflex npm package:
92
-
93
- yarn upgrade stimulus_reflex@#{gem_version}
94
- WARN
95
- end
96
- end
97
-
98
- def check_new_version_available
99
- return if StimulusReflex.config.on_new_version_available == :ignore
100
- return if Rails.env.development? == false
101
- return if using_preview_release?
102
- begin
103
- latest_version = URI.open("https://raw.githubusercontent.com/stimulusreflex/stimulus_reflex/master/LATEST", open_timeout: 1, read_timeout: 1).read.strip
104
- if latest_version != StimulusReflex::VERSION
105
- puts <<~WARN
106
-
107
- 👉 There is a new version of StimulusReflex available!
108
- Current: #{StimulusReflex::VERSION} Latest: #{latest_version}
109
-
110
- If you upgrade, it is very important that you update BOTH Gemfile and package.json
111
- Then, run `bundle install && yarn install` to update to #{latest_version}.
112
-
113
- WARN
114
- exit if StimulusReflex.config.on_new_version_available == :exit
115
- end
116
- rescue
117
- puts "👉 StimulusReflex #{StimulusReflex::VERSION} update check skipped: connection timeout"
118
- end
119
- end
120
-
121
70
  def caching_not_enabled?
122
71
  Rails.application.config.action_controller.perform_caching == false
123
72
  end
@@ -126,57 +75,18 @@ class StimulusReflex::SanityChecker
126
75
  Rails.application.config.cache_store == :null_store
127
76
  end
128
77
 
78
+ def initializer_missing?
79
+ File.exist?(Rails.root.join("config", "initializers", "stimulus_reflex.rb")) == false
80
+ end
81
+
129
82
  def default_url_config_set?
130
83
  if defined?(ActionMailer)
131
- Rails.application.config.action_controller.default_url_options.blank? && Rails.application.config.action_mailer.default_url_options.blank?
84
+ Rails.application.config.action_controller.default_url_options.blank? || Rails.application.config.action_mailer.default_url_options.blank?
132
85
  else
133
86
  Rails.application.config.action_controller.default_url_options.blank?
134
87
  end
135
88
  end
136
89
 
137
- def package_version_mismatch?
138
- npm_version != gem_version
139
- end
140
-
141
- def using_preview_release?
142
- preview = StimulusReflex::VERSION.match?(LATEST_VERSION_FORMAT) == false
143
- puts "👉 StimulusReflex #{StimulusReflex::VERSION} update check skipped: pre-release build" if preview
144
- preview
145
- end
146
-
147
- def gem_version
148
- @_gem_version ||= StimulusReflex::VERSION.gsub(".pre", "-pre")
149
- end
150
-
151
- def npm_version
152
- @_npm_version ||= find_npm_version
153
- end
154
-
155
- def find_npm_version
156
- if (match = search_file(package_json_path, regex: /version/))
157
- match[JSON_VERSION_FORMAT, 1]
158
- elsif (match = search_file(yarn_lock_path, regex: /^stimulus_reflex/))
159
- match[NODE_VERSION_FORMAT, 1]
160
- end
161
- end
162
-
163
- def search_file(path, regex:)
164
- return if File.exist?(path) == false
165
- File.foreach(path).grep(regex).first
166
- end
167
-
168
- def package_json_path
169
- Rails.root.join("node_modules", "stimulus_reflex", "package.json")
170
- end
171
-
172
- def yarn_lock_path
173
- Rails.root.join("yarn.lock")
174
- end
175
-
176
- def initializer_missing?
177
- File.exist?(Rails.root.join("config", "initializers", "stimulus_reflex.rb")) == false
178
- end
179
-
180
90
  def warn_and_exit(text)
181
91
  puts
182
92
  puts "Heads up! 🔥"
@@ -196,15 +106,7 @@ class StimulusReflex::SanityChecker
196
106
  end
197
107
 
198
108
  INFO
199
- if initializer_missing?
200
- puts <<~INFO
201
- You can create a StimulusReflex initializer with the command:
202
-
203
- bundle exec rails generate stimulus_reflex:initializer
204
-
205
- INFO
206
- end
207
- exit false if Rails.env.test? == false
109
+ exit false unless Rails.env.test?
208
110
  end
209
111
  end
210
112
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusReflex
4
- VERSION = "3.5.0.pre8"
4
+ VERSION = "3.5.0.pre10"
5
5
  end
@@ -3,7 +3,6 @@
3
3
  require "uri"
4
4
  require "open-uri"
5
5
  require "rack"
6
- require "rails/engine"
7
6
  require "active_support/all"
8
7
  require "action_dispatch"
9
8
  require "action_cable"
@@ -11,15 +10,19 @@ require "action_view"
11
10
  require "nokogiri"
12
11
  require "cable_ready"
13
12
  require "stimulus_reflex/version"
13
+ require "stimulus_reflex/open_struct_fix"
14
14
  require "stimulus_reflex/cable_ready_channels"
15
15
  require "stimulus_reflex/concern_enhancer"
16
16
  require "stimulus_reflex/configuration"
17
17
  require "stimulus_reflex/callbacks"
18
+ require "stimulus_reflex/html/document"
19
+ require "stimulus_reflex/html/document_fragment"
18
20
  require "stimulus_reflex/request_parameters"
19
21
  require "stimulus_reflex/reflex"
20
22
  require "stimulus_reflex/reflex_data"
21
23
  require "stimulus_reflex/reflex_factory"
22
24
  require "stimulus_reflex/element"
25
+ require "stimulus_reflex/engine"
23
26
  require "stimulus_reflex/broadcasters/broadcaster"
24
27
  require "stimulus_reflex/broadcasters/nothing_broadcaster"
25
28
  require "stimulus_reflex/broadcasters/page_broadcaster"
@@ -31,9 +34,4 @@ require "stimulus_reflex/utils/logger"
31
34
  require "stimulus_reflex/utils/sanity_checker"
32
35
 
33
36
  module StimulusReflex
34
- class Engine < Rails::Engine
35
- initializer "stimulus_reflex.sanity_check" do
36
- SanityChecker.check! unless Rails.env.production?
37
- end
38
- end
39
37
  end