inertia_rails 3.10.0 → 3.11.0
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/CHANGELOG.md +9 -0
- data/app/controllers/inertia_rails/static_controller.rb +3 -1
- data/lib/generators/inertia/install/frameworks.yml +5 -1
- data/lib/generators/inertia/install/templates/initializer.rb +2 -1
- data/lib/generators/inertia/install/templates/svelte/inertia.js +0 -5
- data/lib/generators/inertia/install/templates/svelte/inertia.ts.tt +1 -6
- data/lib/inertia_rails/configuration.rb +11 -1
- data/lib/inertia_rails/controller.rb +16 -1
- data/lib/inertia_rails/renderer.rb +14 -4
- data/lib/inertia_rails/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 416af24e523dd32daacb768be83fc88bf5465a87adbf49e8105cb630409e45f9
|
4
|
+
data.tar.gz: 4c1d7c883d6ffc3e3239777bd1b1f400f5a0f69c22093a307225d696551b2da5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23f7eeab79b5e54cc12408f6196f946f5cb5ea78086d55ac56d06827ea0243ba96c90e432e7c69583f7531ae7cd2611a026fdce15039219c36f7ef9034888fa6
|
7
|
+
data.tar.gz: c29f0e2d3c88ebc7a4cc6a405219152a3ae5f4428b23b8ec9a82de8e38e98a52c035d15389c51858b1a6534aae47adef1a26ebd179c4892c7a7b0b76427b88b0
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [3.11.0] - 2025-08-29
|
8
|
+
|
9
|
+
* Fix Svelte generator (@skryukov)
|
10
|
+
* Docs updates for SSR and 2.1.2 (@skryukov)
|
11
|
+
* Devcontainers for local dev (@kieraneglin)
|
12
|
+
* Add configurable prop transformation (@kieraneglin)
|
13
|
+
* Gradual deprecation of null errors because Inertis.js expects an empty object (@skryukov)
|
14
|
+
* Allow the more helpful UnknownFormat exception to raise when a static intertia route is requested with a non-HTML format (@skryukov)
|
15
|
+
|
7
16
|
## [3.10.0] - 2025-07-30
|
8
17
|
|
9
18
|
* llms.txt in docs (@brandonshar and @skryukov)
|
@@ -4,6 +4,7 @@ react:
|
|
4
4
|
- "@vitejs/plugin-react"
|
5
5
|
- "react"
|
6
6
|
- "react-dom"
|
7
|
+
- "vite@latest"
|
7
8
|
packages_ts:
|
8
9
|
- "@types/react"
|
9
10
|
- "@types/react-dom"
|
@@ -29,6 +30,7 @@ vue:
|
|
29
30
|
packages:
|
30
31
|
- "vue"
|
31
32
|
- "@vitejs/plugin-vue"
|
33
|
+
- "vite@latest"
|
32
34
|
packages_ts:
|
33
35
|
- "typescript@~5.6.2"
|
34
36
|
- "vue-tsc"
|
@@ -52,6 +54,7 @@ svelte4:
|
|
52
54
|
packages:
|
53
55
|
- "svelte@4"
|
54
56
|
- "@sveltejs/vite-plugin-svelte@3"
|
57
|
+
- "vite@5"
|
55
58
|
packages_ts:
|
56
59
|
- "@tsconfig/svelte@4"
|
57
60
|
- "svelte-check"
|
@@ -76,7 +79,8 @@ svelte:
|
|
76
79
|
inertia_package: "@inertiajs/svelte"
|
77
80
|
packages:
|
78
81
|
- "svelte@5"
|
79
|
-
- "@sveltejs/vite-plugin-svelte
|
82
|
+
- "@sveltejs/vite-plugin-svelte"
|
83
|
+
- "vite@latest"
|
80
84
|
packages_ts:
|
81
85
|
- "@tsconfig/svelte@5"
|
82
86
|
- "svelte-check"
|
@@ -2,11 +2,6 @@ import { createInertiaApp } from '@inertiajs/svelte'
|
|
2
2
|
import { mount } from 'svelte';
|
3
3
|
|
4
4
|
createInertiaApp({
|
5
|
-
// Set default page title
|
6
|
-
// see https://inertia-rails.dev/guide/title-and-meta
|
7
|
-
//
|
8
|
-
// title: title => title ? `${title} - App` : 'App',
|
9
|
-
|
10
5
|
// Disable progress bar
|
11
6
|
//
|
12
7
|
// see https://inertia-rails.dev/guide/progress-indicators
|
@@ -2,11 +2,6 @@ import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte'
|
|
2
2
|
import { mount } from 'svelte'
|
3
3
|
|
4
4
|
createInertiaApp({
|
5
|
-
// Set default page title
|
6
|
-
// see https://inertia-rails.dev/guide/title-and-meta
|
7
|
-
//
|
8
|
-
// title: title => title ? `${title} - App` : 'App',
|
9
|
-
|
10
5
|
// Disable progress bar
|
11
6
|
//
|
12
7
|
// see https://inertia-rails.dev/guide/progress-indicators
|
@@ -25,7 +20,7 @@ createInertiaApp({
|
|
25
20
|
// and use the following line.
|
26
21
|
// see https://inertia-rails.dev/guide/pages#default-layouts
|
27
22
|
//
|
28
|
-
// return { default: page.default, layout: page.layout || Layout }
|
23
|
+
// return { default: page.default, layout: page.layout || Layout } as ResolvedComponent
|
29
24
|
|
30
25
|
return page
|
31
26
|
},
|
@@ -12,6 +12,9 @@ module InertiaRails
|
|
12
12
|
# Allows the user to hook into the default rendering behavior and change it to fit their needs
|
13
13
|
component_path_resolver: ->(path:, action:) { "#{path}/#{action}" },
|
14
14
|
|
15
|
+
# A function that transforms the props before they are sent to the client.
|
16
|
+
prop_transformer: ->(props:) { props },
|
17
|
+
|
15
18
|
# DEPRECATED: Let Rails decide which layout should be used based on the
|
16
19
|
# controller configuration.
|
17
20
|
layout: true,
|
@@ -26,8 +29,11 @@ module InertiaRails
|
|
26
29
|
# Used to detect version drift between server and client.
|
27
30
|
version: nil,
|
28
31
|
|
29
|
-
# Allows configuring the base controller for StaticController
|
32
|
+
# Allows configuring the base controller for StaticController.
|
30
33
|
parent_controller: '::ApplicationController',
|
34
|
+
|
35
|
+
# Whether to include empty `errors` hash to the props when no errors are present.
|
36
|
+
always_include_errors_hash: nil,
|
31
37
|
}.freeze
|
32
38
|
|
33
39
|
OPTION_NAMES = DEFAULTS.keys.freeze
|
@@ -89,6 +95,10 @@ module InertiaRails
|
|
89
95
|
@options[:component_path_resolver].call(path: path, action: action)
|
90
96
|
end
|
91
97
|
|
98
|
+
def prop_transformer(props:)
|
99
|
+
@options[:prop_transformer].call(props: props)
|
100
|
+
end
|
101
|
+
|
92
102
|
OPTION_NAMES.each do |option|
|
93
103
|
unless method_defined?(option)
|
94
104
|
define_method(option) do
|
@@ -144,7 +144,22 @@ module InertiaRails
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def inertia_shared_data
|
147
|
-
initial_data =
|
147
|
+
initial_data =
|
148
|
+
if session[:inertia_errors].present?
|
149
|
+
{ errors: session[:inertia_errors] }
|
150
|
+
elsif inertia_configuration.always_include_errors_hash
|
151
|
+
{ errors: {} }
|
152
|
+
else
|
153
|
+
if inertia_configuration.always_include_errors_hash.nil?
|
154
|
+
InertiaRails.deprecator.warn(
|
155
|
+
"To comply with the Inertia protocol, an empty errors hash `{errors: {}}` " \
|
156
|
+
"will be included to all responses by default starting with InertiaRails 4.0. " \
|
157
|
+
"To opt-in now, set `config.always_include_errors_hash = true`. " \
|
158
|
+
"To disable this warning, set it to `false`."
|
159
|
+
)
|
160
|
+
end
|
161
|
+
{}
|
162
|
+
end
|
148
163
|
|
149
164
|
self.class._inertia_shared_data.filter_map { |shared_data|
|
150
165
|
if shared_data.respond_to?(:call)
|
@@ -90,10 +90,20 @@ module InertiaRails
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def computed_props
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
# rubocop:disable Style/MultilineBlockChain
|
94
|
+
merge_props(shared_data, props)
|
95
|
+
.then do |merged_props| # Always keep errors in the props
|
96
|
+
if merged_props.key?(:errors) && !merged_props[:errors].is_a?(BaseProp)
|
97
|
+
errors = merged_props[:errors]
|
98
|
+
merged_props[:errors] = InertiaRails.always { errors }
|
99
|
+
end
|
100
|
+
merged_props
|
101
|
+
end
|
102
|
+
.then { |props| deep_transform_props(props) } # Internal hydration/filtering
|
103
|
+
.then { |props| configuration.prop_transformer(props: props) } # Apply user-defined prop transformer
|
104
|
+
.tap { |props| props[:_inertia_meta] = meta_tags if meta_tags.present? } # Add meta tags last (never transformed)
|
105
|
+
|
106
|
+
# rubocop:enable Style/MultilineBlockChain
|
97
107
|
end
|
98
108
|
|
99
109
|
def page
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inertia_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Knoles
|
8
8
|
- Brandon Shar
|
9
9
|
- Eugene Granovsky
|
10
|
-
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2025-
|
12
|
+
date: 2025-08-29 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: railties
|
@@ -250,7 +249,6 @@ metadata:
|
|
250
249
|
homepage_uri: https://github.com/inertiajs/inertia-rails
|
251
250
|
source_code_uri: https://github.com/inertiajs/inertia-rails
|
252
251
|
rubygems_mfa_required: 'true'
|
253
|
-
post_install_message:
|
254
252
|
rdoc_options: []
|
255
253
|
require_paths:
|
256
254
|
- lib
|
@@ -265,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
263
|
- !ruby/object:Gem::Version
|
266
264
|
version: '0'
|
267
265
|
requirements: []
|
268
|
-
rubygems_version: 3.
|
269
|
-
signing_key:
|
266
|
+
rubygems_version: 3.6.2
|
270
267
|
specification_version: 4
|
271
268
|
summary: Inertia.js adapter for Rails
|
272
269
|
test_files: []
|