Class: ReactOnRails::Configuration
- Inherits:
-
Object
- Object
- ReactOnRails::Configuration
- Defined in:
- lib/react_on_rails/configuration.rb
Class Attribute Summary collapse
-
.immediate_hydration_mutex ⇒ Object
Returns the value of attribute immediate_hydration_mutex.
-
.immediate_hydration_warned ⇒ Object
Returns the value of attribute immediate_hydration_warned.
Instance Attribute Summary collapse
-
#auto_load_bundle ⇒ Object
Returns the value of attribute auto_load_bundle.
-
#build_production_command ⇒ Object
Returns the value of attribute build_production_command.
-
#build_test_command ⇒ Object
Returns the value of attribute build_test_command.
-
#component_registry_timeout ⇒ Object
Returns the value of attribute component_registry_timeout.
-
#components_subdirectory ⇒ Object
Returns the value of attribute components_subdirectory.
-
#defer_generated_component_packs ⇒ Object
Returns the value of attribute defer_generated_component_packs.
-
#development_mode ⇒ Object
Returns the value of attribute development_mode.
-
#enforce_private_server_bundles ⇒ Object
Returns the value of attribute enforce_private_server_bundles.
-
#generated_assets_dir ⇒ Object
Returns the value of attribute generated_assets_dir.
-
#generated_assets_dirs ⇒ Object
Returns the value of attribute generated_assets_dirs.
-
#generated_component_packs_loading_strategy ⇒ Object
Returns the value of attribute generated_component_packs_loading_strategy.
-
#i18n_dir ⇒ Object
Returns the value of attribute i18n_dir.
-
#i18n_output_format ⇒ Object
Returns the value of attribute i18n_output_format.
-
#i18n_yml_dir ⇒ Object
Returns the value of attribute i18n_yml_dir.
-
#i18n_yml_safe_load_options ⇒ Object
Returns the value of attribute i18n_yml_safe_load_options.
-
#logging_on_server ⇒ Object
Returns the value of attribute logging_on_server.
-
#make_generated_server_bundle_the_entrypoint ⇒ Object
Returns the value of attribute make_generated_server_bundle_the_entrypoint.
-
#node_modules_location ⇒ Object
Returns the value of attribute node_modules_location.
-
#prerender ⇒ Object
Returns the value of attribute prerender.
-
#raise_on_prerender_error ⇒ Object
Returns the value of attribute raise_on_prerender_error.
-
#random_dom_id ⇒ Object
Returns the value of attribute random_dom_id.
-
#rendering_extension ⇒ Object
Returns the value of attribute rendering_extension.
-
#rendering_props_extension ⇒ Object
Returns the value of attribute rendering_props_extension.
-
#replay_console ⇒ Object
Returns the value of attribute replay_console.
-
#same_bundle_for_client_and_server ⇒ Object
Returns the value of attribute same_bundle_for_client_and_server.
-
#server_bundle_js_file ⇒ Object
Returns the value of attribute server_bundle_js_file.
-
#server_bundle_output_path ⇒ Object
Returns the value of attribute server_bundle_output_path.
-
#server_render_method ⇒ Object
Returns the value of attribute server_render_method.
-
#server_renderer_pool_size ⇒ Object
Returns the value of attribute server_renderer_pool_size.
-
#server_renderer_timeout ⇒ Object
Returns the value of attribute server_renderer_timeout.
-
#skip_display_none ⇒ Object
Returns the value of attribute skip_display_none.
-
#trace ⇒ Object
Returns the value of attribute trace.
-
#webpack_generated_files ⇒ Object
Returns the value of attribute webpack_generated_files.
Instance Method Summary collapse
- #immediate_hydration ⇒ Object
-
#immediate_hydration=(value) ⇒ Object
Deprecated: immediate_hydration configuration has been removed.
-
#initialize(node_modules_location: nil, server_bundle_js_file: nil, prerender: nil, replay_console: nil, make_generated_server_bundle_the_entrypoint: nil, trace: nil, development_mode: nil, defer_generated_component_packs: nil, logging_on_server: nil, server_renderer_pool_size: nil, server_renderer_timeout: nil, raise_on_prerender_error: true, skip_display_none: nil, generated_assets_dirs: nil, generated_assets_dir: nil, webpack_generated_files: nil, rendering_extension: nil, build_test_command: nil, build_production_command: nil, generated_component_packs_loading_strategy: nil, same_bundle_for_client_and_server: nil, i18n_dir: nil, i18n_yml_dir: nil, i18n_output_format: nil, i18n_yml_safe_load_options: nil, random_dom_id: nil, server_render_method: nil, rendering_props_extension: nil, components_subdirectory: nil, auto_load_bundle: nil, component_registry_timeout: nil, server_bundle_output_path: nil, enforce_private_server_bundles: nil) ⇒ Configuration
constructor
rubocop:disable Metrics/AbcSize.
-
#setup_config_values ⇒ Object
on ReactOnRails.
Constructor Details
#initialize(node_modules_location: nil, server_bundle_js_file: nil, prerender: nil, replay_console: nil, make_generated_server_bundle_the_entrypoint: nil, trace: nil, development_mode: nil, defer_generated_component_packs: nil, logging_on_server: nil, server_renderer_pool_size: nil, server_renderer_timeout: nil, raise_on_prerender_error: true, skip_display_none: nil, generated_assets_dirs: nil, generated_assets_dir: nil, webpack_generated_files: nil, rendering_extension: nil, build_test_command: nil, build_production_command: nil, generated_component_packs_loading_strategy: nil, same_bundle_for_client_and_server: nil, i18n_dir: nil, i18n_yml_dir: nil, i18n_output_format: nil, i18n_yml_safe_load_options: nil, random_dom_id: nil, server_render_method: nil, rendering_props_extension: nil, components_subdirectory: nil, auto_load_bundle: nil, component_registry_timeout: nil, server_bundle_output_path: nil, enforce_private_server_bundles: nil) ⇒ Configuration
rubocop:disable Metrics/AbcSize
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/react_on_rails/configuration.rb', line 115 def initialize(node_modules_location: nil, server_bundle_js_file: nil, prerender: nil, replay_console: nil, make_generated_server_bundle_the_entrypoint: nil, trace: nil, development_mode: nil, defer_generated_component_packs: nil, logging_on_server: nil, server_renderer_pool_size: nil, server_renderer_timeout: nil, raise_on_prerender_error: true, skip_display_none: nil, generated_assets_dirs: nil, generated_assets_dir: nil, webpack_generated_files: nil, rendering_extension: nil, build_test_command: nil, build_production_command: nil, generated_component_packs_loading_strategy: nil, same_bundle_for_client_and_server: nil, i18n_dir: nil, i18n_yml_dir: nil, i18n_output_format: nil, i18n_yml_safe_load_options: nil, random_dom_id: nil, server_render_method: nil, rendering_props_extension: nil, components_subdirectory: nil, auto_load_bundle: nil, component_registry_timeout: nil, server_bundle_output_path: nil, enforce_private_server_bundles: nil) self.node_modules_location = node_modules_location.present? ? node_modules_location : Rails.root self.generated_assets_dirs = generated_assets_dirs self.generated_assets_dir = generated_assets_dir self.build_test_command = build_test_command self.build_production_command = build_production_command self.i18n_dir = i18n_dir self.i18n_yml_dir = i18n_yml_dir self.i18n_output_format = i18n_output_format self. = self.random_dom_id = random_dom_id self.prerender = prerender self.replay_console = replay_console self.logging_on_server = logging_on_server self.development_mode = if development_mode.nil? Rails.env.development? else development_mode end self.trace = trace.nil? ? Rails.env.development? : trace self.raise_on_prerender_error = raise_on_prerender_error self.skip_display_none = skip_display_none self.rendering_props_extension = rendering_props_extension self.component_registry_timeout = component_registry_timeout # Server rendering: self.server_bundle_js_file = server_bundle_js_file self.same_bundle_for_client_and_server = same_bundle_for_client_and_server self.server_renderer_pool_size = self.development_mode ? 1 : server_renderer_pool_size self.server_renderer_timeout = server_renderer_timeout # seconds self.webpack_generated_files = webpack_generated_files self.rendering_extension = rendering_extension self.server_render_method = server_render_method self.components_subdirectory = components_subdirectory self.auto_load_bundle = auto_load_bundle self.make_generated_server_bundle_the_entrypoint = make_generated_server_bundle_the_entrypoint self.defer_generated_component_packs = defer_generated_component_packs self.generated_component_packs_loading_strategy = generated_component_packs_loading_strategy self.server_bundle_output_path = server_bundle_output_path self.enforce_private_server_bundles = enforce_private_server_bundles end |
Class Attribute Details
.immediate_hydration_mutex ⇒ Object
Returns the value of attribute immediate_hydration_mutex.
75 76 77 |
# File 'lib/react_on_rails/configuration.rb', line 75 def immediate_hydration_mutex @immediate_hydration_mutex end |
.immediate_hydration_warned ⇒ Object
Returns the value of attribute immediate_hydration_warned.
75 76 77 |
# File 'lib/react_on_rails/configuration.rb', line 75 def immediate_hydration_warned @immediate_hydration_warned end |
Instance Attribute Details
#auto_load_bundle ⇒ Object
Returns the value of attribute auto_load_bundle.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def auto_load_bundle @auto_load_bundle end |
#build_production_command ⇒ Object
Returns the value of attribute build_production_command.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def build_production_command @build_production_command end |
#build_test_command ⇒ Object
Returns the value of attribute build_test_command.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def build_test_command @build_test_command end |
#component_registry_timeout ⇒ Object
Returns the value of attribute component_registry_timeout.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def component_registry_timeout @component_registry_timeout end |
#components_subdirectory ⇒ Object
Returns the value of attribute components_subdirectory.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def components_subdirectory @components_subdirectory end |
#defer_generated_component_packs ⇒ Object
Returns the value of attribute defer_generated_component_packs.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def defer_generated_component_packs @defer_generated_component_packs end |
#development_mode ⇒ Object
Returns the value of attribute development_mode.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def development_mode @development_mode end |
#enforce_private_server_bundles ⇒ Object
Returns the value of attribute enforce_private_server_bundles.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def enforce_private_server_bundles @enforce_private_server_bundles end |
#generated_assets_dir ⇒ Object
Returns the value of attribute generated_assets_dir.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def generated_assets_dir @generated_assets_dir end |
#generated_assets_dirs ⇒ Object
Returns the value of attribute generated_assets_dirs.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def generated_assets_dirs @generated_assets_dirs end |
#generated_component_packs_loading_strategy ⇒ Object
Returns the value of attribute generated_component_packs_loading_strategy.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def generated_component_packs_loading_strategy @generated_component_packs_loading_strategy end |
#i18n_dir ⇒ Object
Returns the value of attribute i18n_dir.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def i18n_dir @i18n_dir end |
#i18n_output_format ⇒ Object
Returns the value of attribute i18n_output_format.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def i18n_output_format @i18n_output_format end |
#i18n_yml_dir ⇒ Object
Returns the value of attribute i18n_yml_dir.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def i18n_yml_dir @i18n_yml_dir end |
#i18n_yml_safe_load_options ⇒ Object
Returns the value of attribute i18n_yml_safe_load_options.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def @i18n_yml_safe_load_options end |
#logging_on_server ⇒ Object
Returns the value of attribute logging_on_server.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def logging_on_server @logging_on_server end |
#make_generated_server_bundle_the_entrypoint ⇒ Object
Returns the value of attribute make_generated_server_bundle_the_entrypoint.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def make_generated_server_bundle_the_entrypoint @make_generated_server_bundle_the_entrypoint end |
#node_modules_location ⇒ Object
Returns the value of attribute node_modules_location.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def node_modules_location @node_modules_location end |
#prerender ⇒ Object
Returns the value of attribute prerender.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def prerender @prerender end |
#raise_on_prerender_error ⇒ Object
Returns the value of attribute raise_on_prerender_error.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def raise_on_prerender_error @raise_on_prerender_error end |
#random_dom_id ⇒ Object
Returns the value of attribute random_dom_id.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def random_dom_id @random_dom_id end |
#rendering_extension ⇒ Object
Returns the value of attribute rendering_extension.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def rendering_extension @rendering_extension end |
#rendering_props_extension ⇒ Object
Returns the value of attribute rendering_props_extension.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def rendering_props_extension @rendering_props_extension end |
#replay_console ⇒ Object
Returns the value of attribute replay_console.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def replay_console @replay_console end |
#same_bundle_for_client_and_server ⇒ Object
Returns the value of attribute same_bundle_for_client_and_server.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def same_bundle_for_client_and_server @same_bundle_for_client_and_server end |
#server_bundle_js_file ⇒ Object
Returns the value of attribute server_bundle_js_file.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def server_bundle_js_file @server_bundle_js_file end |
#server_bundle_output_path ⇒ Object
Returns the value of attribute server_bundle_output_path.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def server_bundle_output_path @server_bundle_output_path end |
#server_render_method ⇒ Object
Returns the value of attribute server_render_method.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def server_render_method @server_render_method end |
#server_renderer_pool_size ⇒ Object
Returns the value of attribute server_renderer_pool_size.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def server_renderer_pool_size @server_renderer_pool_size end |
#server_renderer_timeout ⇒ Object
Returns the value of attribute server_renderer_timeout.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def server_renderer_timeout @server_renderer_timeout end |
#skip_display_none ⇒ Object
Returns the value of attribute skip_display_none.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def skip_display_none @skip_display_none end |
#trace ⇒ Object
Returns the value of attribute trace.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def trace @trace end |
#webpack_generated_files ⇒ Object
Returns the value of attribute webpack_generated_files.
55 56 57 |
# File 'lib/react_on_rails/configuration.rb', line 55 def webpack_generated_files @webpack_generated_files end |
Instance Method Details
#immediate_hydration ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/react_on_rails/configuration.rb', line 96 def immediate_hydration warned = false self.class.immediate_hydration_mutex.synchronize do warned = self.class.immediate_hydration_warned self.class.immediate_hydration_warned = true unless warned end return nil if warned Rails.logger.warn <<~WARNING [REACT ON RAILS] The 'config.immediate_hydration' configuration option is deprecated and no longer used. Immediate hydration is now automatically enabled for React on Rails Pro users. Please remove any references to 'config.immediate_hydration' from your config/initializers/react_on_rails.rb file. See CHANGELOG.md for migration instructions. WARNING nil end |
#immediate_hydration=(value) ⇒ Object
Deprecated: immediate_hydration configuration has been removed
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/react_on_rails/configuration.rb', line 79 def immediate_hydration=(value) warned = false self.class.immediate_hydration_mutex.synchronize do warned = self.class.immediate_hydration_warned self.class.immediate_hydration_warned = true unless warned end return if warned Rails.logger.warn <<~WARNING [REACT ON RAILS] The 'config.immediate_hydration' configuration option is deprecated and no longer used. Immediate hydration is now automatically enabled for React on Rails Pro users. Please remove 'config.immediate_hydration = #{value}' from your config/initializers/react_on_rails.rb file. See CHANGELOG.md for migration instructions. WARNING end |
#setup_config_values ⇒ Object
on ReactOnRails
175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/react_on_rails/configuration.rb', line 175 def setup_config_values check_autobundling_requirements if auto_load_bundle ensure_webpack_generated_files_exists configure_generated_assets_dirs_deprecation configure_skip_display_none_deprecation check_server_render_method_is_only_execjs error_if_using_packer_and_generated_assets_dir_not_match_public_output_path # check_deprecated_settings adjust_precompile_task check_component_registry_timeout validate_generated_component_packs_loading_strategy validate_enforce_private_server_bundles end |