ruact 0.0.7 → 0.0.9

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +59 -1
  3. data/docs/internal/decisions/server-functions-api.md +55 -0
  4. data/lib/generators/ruact/install/install_generator.rb +378 -6
  5. data/lib/generators/ruact/install/templates/AGENTS.md.tt +159 -0
  6. data/lib/generators/ruact/install/templates/Procfile.dev.tt +3 -0
  7. data/lib/generators/ruact/install/templates/globals.css.tt +20 -0
  8. data/lib/generators/ruact/install/templates/initializer.rb.tt +9 -0
  9. data/lib/generators/ruact/install/templates/package.json.tt +7 -1
  10. data/lib/generators/ruact/install/templates/tsconfig.json.tt +18 -0
  11. data/lib/generators/ruact/scaffold/scaffold_shadcn_preflight.rb +10 -0
  12. data/lib/ruact/configuration.rb +73 -0
  13. data/lib/ruact/controller/document_rendering.rb +210 -0
  14. data/lib/ruact/controller.rb +14 -46
  15. data/lib/ruact/doctor.rb +102 -12
  16. data/lib/ruact/erb_preprocessor.rb +113 -0
  17. data/lib/ruact/errors.rb +16 -0
  18. data/lib/ruact/layout_source.rb +59 -0
  19. data/lib/ruact/manifest_resolver.rb +2 -2
  20. data/lib/ruact/serializable.rb +98 -6
  21. data/lib/ruact/server.rb +163 -0
  22. data/lib/ruact/server_functions/introspection.rb +81 -0
  23. data/lib/ruact/server_functions.rb +26 -4
  24. data/lib/ruact/testing/component_query.rb +113 -0
  25. data/lib/ruact/testing/flight_extractor.rb +221 -0
  26. data/lib/ruact/testing/flight_structure_diff.rb +267 -0
  27. data/lib/ruact/testing/flight_wire_parser.rb +138 -0
  28. data/lib/ruact/testing.rb +90 -0
  29. data/lib/ruact/version.rb +1 -1
  30. data/lib/ruact/view_helper.rb +10 -1
  31. data/lib/ruact.rb +1 -0
  32. data/lib/tasks/ruact.rake +55 -2
  33. data/spec/fixtures/story_7_9_views/controller_request_spec_support/exploding_layout_demo/show.html.erb +3 -0
  34. data/spec/fixtures/story_7_9_views/controller_request_spec_support/ghost_layout_demo/show.html.erb +3 -0
  35. data/spec/fixtures/story_7_9_views/controller_request_spec_support/layout_demo/show.html.erb +3 -0
  36. data/spec/fixtures/story_7_9_views/controller_request_spec_support/rootless_layout_demo/show.html.erb +3 -0
  37. data/spec/fixtures/story_7_9_views/controller_request_spec_support/unwired_layout_demo/show.html.erb +3 -0
  38. data/spec/fixtures/story_7_9_views/layouts/bare_host.html.erb +16 -0
  39. data/spec/fixtures/story_7_9_views/layouts/exploding_host.html.erb +24 -0
  40. data/spec/fixtures/story_7_9_views/layouts/rootless_host.html.erb +15 -0
  41. data/spec/fixtures/story_7_9_views/layouts/ruact_host.html.erb +17 -0
  42. data/spec/ruact/controller_request_spec.rb +203 -0
  43. data/spec/ruact/doctor_spec.rb +222 -6
  44. data/spec/ruact/erb_preprocessor_spec.rb +145 -0
  45. data/spec/ruact/install_generator_spec.rb +727 -70
  46. data/spec/ruact/layout_source_spec.rb +108 -0
  47. data/spec/ruact/manifest_resolver_spec.rb +15 -0
  48. data/spec/ruact/scaffold_generator_spec.rb +14 -0
  49. data/spec/ruact/serializable_spec.rb +126 -0
  50. data/spec/ruact/server_bucket_request_spec.rb +291 -0
  51. data/spec/ruact/server_functions/introspection_spec.rb +135 -0
  52. data/spec/ruact/tasks_json_introspection_spec.rb +141 -0
  53. data/spec/ruact/testing/have_ruact_component_spec.rb +170 -0
  54. data/spec/ruact/testing/no_production_load_spec.rb +41 -0
  55. data/spec/support/flight_wire_parser.rb +12 -126
  56. data/spec/support/matchers/flight_fixture_matcher.rb +7 -258
  57. data/vendor/javascript/ruact-server-functions-runtime/index.d.ts +25 -0
  58. data/vendor/javascript/ruact-server-functions-runtime/index.js +104 -7
  59. data/vendor/javascript/ruact-server-functions-runtime/index.test.mjs +173 -0
  60. data/vendor/javascript/vite-plugin-ruact/type-tests/auto-revalidate.test-d.ts +25 -0
  61. metadata +30 -4
@@ -0,0 +1,25 @@
1
+ // Story 15.6 (FR110) — type-level test for the auto-revalidate opt-in surface.
2
+ // Proves (a) `configureRuactRuntime` accepts the new `autoRevalidate?: boolean`
3
+ // key alongside `defaultHeaders`, and (b) `withRefresh` preserves the wrapped
4
+ // accessor's call signature (so `withRefresh(createPost)` is callable exactly
5
+ // like `createPost`). Runtime-only: this surface is NOT emitted by the codegen,
6
+ // so there is no byte-parity fixture to regenerate.
7
+
8
+ import { _makeServerFunction, configureRuactRuntime, withRefresh } from "ruact/server-functions-runtime";
9
+
10
+ // (a) the app-wide default key type-checks (and stays optional).
11
+ configureRuactRuntime({ autoRevalidate: true });
12
+ configureRuactRuntime({ autoRevalidate: false, defaultHeaders: { Authorization: "Bearer x" } });
13
+ configureRuactRuntime({ defaultHeaders: null });
14
+
15
+ // A non-boolean autoRevalidate is a type error.
16
+ // @ts-expect-error autoRevalidate must be a boolean
17
+ configureRuactRuntime({ autoRevalidate: "yes" });
18
+
19
+ // (b) withRefresh preserves the accessor call signature.
20
+ const createPost = _makeServerFunction({ method: "POST", path: "/posts", segments: [] });
21
+ const createPostRefreshing = withRefresh(createPost);
22
+
23
+ // Callable at the same shapes as the underlying accessor.
24
+ void createPostRefreshing({ title: "x" });
25
+ void createPostRefreshing();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruact
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luiz Garcia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-30 00:00:00.000000000 Z
11
+ date: 2026-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -46,10 +46,13 @@ files:
46
46
  - docs/internal/README.md
47
47
  - docs/internal/decisions/server-functions-api.md
48
48
  - lib/generators/ruact/install/install_generator.rb
49
+ - lib/generators/ruact/install/templates/AGENTS.md.tt
49
50
  - lib/generators/ruact/install/templates/Procfile.dev.tt
50
51
  - lib/generators/ruact/install/templates/dev.tt
52
+ - lib/generators/ruact/install/templates/globals.css.tt
51
53
  - lib/generators/ruact/install/templates/initializer.rb.tt
52
54
  - lib/generators/ruact/install/templates/package.json.tt
55
+ - lib/generators/ruact/install/templates/tsconfig.json.tt
53
56
  - lib/generators/ruact/install/templates/vite.config.js.tt
54
57
  - lib/generators/ruact/scaffold/scaffold_attribute.rb
55
58
  - lib/generators/ruact/scaffold/scaffold_form_helpers.rb
@@ -74,6 +77,7 @@ files:
74
77
  - lib/ruact/component_contract.rb
75
78
  - lib/ruact/configuration.rb
76
79
  - lib/ruact/controller.rb
80
+ - lib/ruact/controller/document_rendering.rb
77
81
  - lib/ruact/doctor.rb
78
82
  - lib/ruact/erb_preprocessor.rb
79
83
  - lib/ruact/erb_preprocessor_hook.rb
@@ -85,6 +89,7 @@ files:
85
89
  - lib/ruact/flight/row_emitter.rb
86
90
  - lib/ruact/flight/serializer.rb
87
91
  - lib/ruact/html_converter.rb
92
+ - lib/ruact/layout_source.rb
88
93
  - lib/ruact/manifest_resolver.rb
89
94
  - lib/ruact/query.rb
90
95
  - lib/ruact/railtie.rb
@@ -102,6 +107,7 @@ files:
102
107
  - lib/ruact/server_functions/error_payload.rb
103
108
  - lib/ruact/server_functions/error_rendering.rb
104
109
  - lib/ruact/server_functions/error_suggestion.rb
110
+ - lib/ruact/server_functions/introspection.rb
105
111
  - lib/ruact/server_functions/name_bridge.rb
106
112
  - lib/ruact/server_functions/query_context.rb
107
113
  - lib/ruact/server_functions/query_dispatch.rb
@@ -112,6 +118,11 @@ files:
112
118
  - lib/ruact/server_functions/validation_errors.rb
113
119
  - lib/ruact/signed_references.rb
114
120
  - lib/ruact/string_distance.rb
121
+ - lib/ruact/testing.rb
122
+ - lib/ruact/testing/component_query.rb
123
+ - lib/ruact/testing/flight_extractor.rb
124
+ - lib/ruact/testing/flight_structure_diff.rb
125
+ - lib/ruact/testing/flight_wire_parser.rb
115
126
  - lib/ruact/validation_errors_collector.rb
116
127
  - lib/ruact/version.rb
117
128
  - lib/ruact/view_helper.rb
@@ -147,6 +158,15 @@ files:
147
158
  - spec/fixtures/flight/undefined.txt
148
159
  - spec/fixtures/story_7_9_views/controller_request_spec_support/demo/show.html.erb
149
160
  - spec/fixtures/story_7_9_views/controller_request_spec_support/errors_demo/new.html.erb
161
+ - spec/fixtures/story_7_9_views/controller_request_spec_support/exploding_layout_demo/show.html.erb
162
+ - spec/fixtures/story_7_9_views/controller_request_spec_support/ghost_layout_demo/show.html.erb
163
+ - spec/fixtures/story_7_9_views/controller_request_spec_support/layout_demo/show.html.erb
164
+ - spec/fixtures/story_7_9_views/controller_request_spec_support/rootless_layout_demo/show.html.erb
165
+ - spec/fixtures/story_7_9_views/controller_request_spec_support/unwired_layout_demo/show.html.erb
166
+ - spec/fixtures/story_7_9_views/layouts/bare_host.html.erb
167
+ - spec/fixtures/story_7_9_views/layouts/exploding_host.html.erb
168
+ - spec/fixtures/story_7_9_views/layouts/rootless_host.html.erb
169
+ - spec/fixtures/story_7_9_views/layouts/ruact_host.html.erb
150
170
  - spec/ruact/client_manifest_spec.rb
151
171
  - spec/ruact/component_contract_spec.rb
152
172
  - spec/ruact/configuration_spec.rb
@@ -160,6 +180,7 @@ files:
160
180
  - spec/ruact/flight/serializer_spec.rb
161
181
  - spec/ruact/html_converter_spec.rb
162
182
  - spec/ruact/install_generator_spec.rb
183
+ - spec/ruact/layout_source_spec.rb
163
184
  - spec/ruact/manifest_resolver_spec.rb
164
185
  - spec/ruact/query_request_spec.rb
165
186
  - spec/ruact/query_spec.rb
@@ -176,6 +197,7 @@ files:
176
197
  - spec/ruact/server_functions/codegen_spec.rb
177
198
  - spec/ruact/server_functions/error_payload_spec.rb
178
199
  - spec/ruact/server_functions/error_suggestion_spec.rb
200
+ - spec/ruact/server_functions/introspection_spec.rb
179
201
  - spec/ruact/server_functions/name_bridge_spec.rb
180
202
  - spec/ruact/server_functions/query_context_spec.rb
181
203
  - spec/ruact/server_functions/query_source_spec.rb
@@ -189,6 +211,9 @@ files:
189
211
  - spec/ruact/server_upload_request_spec.rb
190
212
  - spec/ruact/signed_references_spec.rb
191
213
  - spec/ruact/string_distance_spec.rb
214
+ - spec/ruact/tasks_json_introspection_spec.rb
215
+ - spec/ruact/testing/have_ruact_component_spec.rb
216
+ - spec/ruact/testing/no_production_load_spec.rb
192
217
  - spec/ruact/validation_errors_spec.rb
193
218
  - spec/ruact/view_helper_spec.rb
194
219
  - spec/spec_helper.rb
@@ -218,6 +243,7 @@ files:
218
243
  - vendor/javascript/vite-plugin-ruact/tsconfig.json
219
244
  - vendor/javascript/vite-plugin-ruact/tsconfig.scaffold-agnostic.json
220
245
  - vendor/javascript/vite-plugin-ruact/tsconfig.scaffold.json
246
+ - vendor/javascript/vite-plugin-ruact/type-tests/auto-revalidate.test-d.ts
221
247
  - vendor/javascript/vite-plugin-ruact/type-tests/emitted-module.test-d.ts
222
248
  - vendor/javascript/vite-plugin-ruact/type-tests/scaffold/PostDeleteDialog.tsx
223
249
  - vendor/javascript/vite-plugin-ruact/type-tests/scaffold/PostForm.tsx
@@ -230,12 +256,12 @@ files:
230
256
  - vendor/javascript/vite-plugin-ruact/type-tests/typed-query.test-d.ts
231
257
  - vendor/javascript/vite-plugin-ruact/type-tests/usequery.test-d.ts
232
258
  - vendor/javascript/vite-plugin-ruact/vitest.config.mjs
233
- homepage: https://luizcg.github.io/ruact/
259
+ homepage: https://ruact.dev/
234
260
  licenses:
235
261
  - MIT
236
262
  metadata:
237
263
  allowed_push_host: https://rubygems.org
238
- homepage_uri: https://luizcg.github.io/ruact/
264
+ homepage_uri: https://ruact.dev/
239
265
  source_code_uri: https://github.com/luizcg/ruact
240
266
  changelog_uri: https://github.com/luizcg/ruact/blob/main/CHANGELOG.md
241
267
  bug_tracker_uri: https://github.com/luizcg/ruact/issues