Module: Ruact
- Extended by:
- SignedReferences
- Defined in:
- lib/ruact.rb,
lib/ruact/query.rb,
lib/ruact/doctor.rb,
lib/ruact/errors.rb,
lib/ruact/flight.rb,
lib/ruact/server.rb,
lib/ruact/railtie.rb,
lib/ruact/routing.rb,
lib/ruact/version.rb,
lib/ruact/controller.rb,
lib/ruact/view_helper.rb,
lib/ruact/serializable.rb,
lib/ruact/configuration.rb,
lib/ruact/flight/request.rb,
lib/ruact/html_converter.rb,
lib/ruact/render_context.rb,
lib/ruact/client_manifest.rb,
lib/ruact/flight/renderer.rb,
lib/ruact/render_pipeline.rb,
lib/ruact/string_distance.rb,
lib/ruact/erb_preprocessor.rb,
lib/ruact/server_functions.rb,
lib/ruact/flight/serializer.rb,
lib/ruact/manifest_resolver.rb,
lib/ruact/signed_references.rb,
lib/ruact/component_contract.rb,
lib/ruact/flight/row_emitter.rb,
lib/ruact/flight/react_element.rb,
lib/ruact/erb_preprocessor_hook.rb,
lib/ruact/server_functions/codegen.rb,
lib/ruact/server_functions/snapshot.rb,
lib/ruact/server_functions/codegen_v2.rb,
lib/ruact/validation_errors_collector.rb,
lib/ruact/server_functions/name_bridge.rb,
lib/ruact/server_functions/query_source.rb,
lib/ruact/server_functions/route_source.rb,
lib/ruact/server_functions/error_payload.rb,
lib/ruact/server_functions/query_context.rb,
lib/ruact/server_functions/query_dispatch.rb,
lib/ruact/server_functions/error_rendering.rb,
lib/ruact/server_functions/snapshot_writer.rb,
lib/ruact/server_functions/error_suggestion.rb,
lib/ruact/server_functions/backtrace_cleaner.rb,
lib/ruact/server_functions/validation_errors.rb,
lib/ruact/server_functions/bucket_two_payload.rb,
lib/generators/ruact/install/install_generator.rb,
lib/generators/ruact/scaffold/scaffold_attribute.rb,
lib/generators/ruact/scaffold/scaffold_generator.rb,
lib/ruact/server_functions/codegen_v2_query_params.rb,
lib/generators/ruact/scaffold/scaffold_form_helpers.rb,
lib/generators/ruact/scaffold/scaffold_shadcn_preflight.rb,
sig/ruact.rbs
Defined Under Namespace
Modules: ComponentContract, Controller, ErbPreprocessorHook, Flight, Generators, ManifestResolver, Routing, Serializable, Server, ServerFunctions, SignedReferences, StringDistance, ValidationErrorsCollector, ViewHelper Classes: BadRequestError, ClientManifest, ComponentContractError, Configuration, ConfigurationError, Doctor, ErbPreprocessor, Error, HtmlConverter, HtmlConverterError, InvalidSignedGlobalIDError, ManifestError, PreprocessorError, Query, Railtie, RenderContext, RenderPipeline, SerializationError, UploadTooLargeError
Constant Summary collapse
- VERSION =
"0.0.7"
Class Attribute Summary collapse
-
.manifest ⇒ Object
Returns the value of attribute manifest.
-
.streaming_mode ⇒ Object
Returns the value of attribute streaming_mode.
Class Method Summary collapse
-
.bootstrap_virtual_id ⇒ String
Story 14.2 (FR104) — the SINGLE source of truth for the bootstrap entry id.
-
.config ⇒ Ruact::Configuration
Returns the singleton configuration instance, frozen on first access so that mutation outside
Ruact.configurealways raises (Story 7.3). -
.configure {|mutable| ... } ⇒ Object
Yields a mutable Configuration draft for block-style setup.
-
.gem_path ⇒ String
Story 8.4 — Absolute path to the gem's
lib/root. -
.vite_plugin_path ⇒ String
Returns the absolute path to the Vite plugin bundled inside this gem.
Methods included from SignedReferences
locate_signed, signed_global_id
Class Attribute Details
.manifest ⇒ Object
Returns the value of attribute manifest.
26 27 28 |
# File 'lib/ruact.rb', line 26 def manifest @manifest end |
.streaming_mode ⇒ Object
Returns the value of attribute streaming_mode.
26 27 28 |
# File 'lib/ruact.rb', line 26 def streaming_mode @streaming_mode end |
Class Method Details
.bootstrap_virtual_id ⇒ String
Story 14.2 (FR104) — the SINGLE source of truth for the bootstrap entry id.
ruact's React entry is served as the virtual module virtual:ruact/bootstrap
(by the bundled Vite plugin) instead of a app/javascript/application.jsx
file in the user's tree. Every reference point must agree on this id:
- the generated `vite.config` `rollupOptions.input`
- the dev `<script src>` (`/@id/__x00__virtual:ruact/bootstrap`)
- the production Vite-manifest lookup key
- the plugin's `resolveId`/`load` (`BOOTSTRAP_VIRTUAL_ID` in index.js)
Ruact::ViewHelper#ruact_js_assets and templates/vite.config.js.tt both
read this constant so they can never drift (the regression AC3 guards).
60 61 62 |
# File 'lib/ruact.rb', line 60 def bootstrap_virtual_id "virtual:ruact/bootstrap" end |
.config ⇒ Ruact::Configuration
Returns the singleton configuration instance, frozen on first access so
that mutation outside Ruact.configure always raises (Story 7.3).
First-access publication counts as the boot configuration, so a later
Ruact.configure call after default reads triggers the AC3 warning
(otherwise the warning would be silently bypassed in apps that never
call Ruact.configure at boot but reconfigure later).
99 100 101 102 103 104 105 |
# File 'lib/ruact.rb', line 99 def config return @config if defined?(@config) && @config @config = Configuration.new.__send__(:seal!) @configured_at_least_once = true @config end |
.configure {|mutable| ... } ⇒ Object
Yields a mutable Configuration draft for block-style setup. The draft is
frozen and atomically swapped into Ruact.config when the block returns.
Mutating Ruact.config outside this block raises
Ruact::ConfigurationError (Story 7.3).
When called a second time after boot, this method emits a [ruact]
warning advising that runtime re-configuration is unusual.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ruact.rb', line 78 def configure draft = if defined?(@config) && @config Configuration.new(template: @config) else Configuration.new end yield draft warn_if_re_configuration! @config = draft.__send__(:seal!) end |
.gem_path ⇒ String
Story 8.4 — Absolute path to the gem's lib/ root. Used by
Ruact::ServerFunctions::BacktraceCleaner to classify backtrace frames as
APP or GEM. Memoised at first call so the per-frame start_with? check
stays constant-time. Anchors on this file's directory: lib/ruact.rb
resolves to lib/ after expand_path("..", __dir__).
35 36 37 |
# File 'lib/ruact.rb', line 35 def gem_path @gem_path ||= File.("..", __dir__) end |
.vite_plugin_path ⇒ String
Returns the absolute path to the Vite plugin bundled inside this gem.
Use this in vite.config.js: import ruact from '<%= Ruact.vite_plugin_path %>'
Re-run rails generate ruact:install after gem upgrades to refresh the path.
44 45 46 |
# File 'lib/ruact.rb', line 44 def vite_plugin_path File.("../vendor/javascript/vite-plugin-ruact/index.js", __dir__) end |