@adonisjs/inertia 2.1.2 → 2.1.3
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.
package/build/config.stub
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
exports({ to: app.configPath('inertia.ts') })
|
|
3
3
|
}}}
|
|
4
4
|
import { defineConfig } from '@adonisjs/inertia'
|
|
5
|
-
import type { InferSharedProps } from '@adonisjs/inertia/types'
|
|
5
|
+
import type { InferSharedProps, PageProps } from '@adonisjs/inertia/types'
|
|
6
6
|
|
|
7
7
|
const inertiaConfig = defineConfig({
|
|
8
8
|
/**
|
|
@@ -29,5 +29,5 @@ const inertiaConfig = defineConfig({
|
|
|
29
29
|
export default inertiaConfig
|
|
30
30
|
|
|
31
31
|
declare module '@adonisjs/inertia/types' {
|
|
32
|
-
export interface SharedProps extends InferSharedProps<typeof inertiaConfig
|
|
32
|
+
export interface SharedProps extends InferSharedProps<typeof inertiaConfig>, PageProps {}
|
|
33
33
|
}
|
package/build/svelte/app.ts.stub
CHANGED
|
@@ -8,6 +8,7 @@ import '../css/app.css';
|
|
|
8
8
|
|
|
9
9
|
import { createInertiaApp } from '@inertiajs/svelte'
|
|
10
10
|
import { resolvePageComponent } from '@adonisjs/inertia/helpers'
|
|
11
|
+
import { hydrate, mount } from 'svelte'
|
|
11
12
|
|
|
12
13
|
const appName = import.meta.env.VITE_APP_NAME || 'AdonisJS'
|
|
13
14
|
|
|
@@ -24,10 +25,10 @@ createInertiaApp({
|
|
|
24
25
|
},
|
|
25
26
|
|
|
26
27
|
setup({ el, App, props }) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
if (el.dataset.serverRendered === 'true') {
|
|
29
|
+
hydrate(App, { target: el, props })
|
|
30
|
+
} else {
|
|
31
|
+
mount(App, { target: el, props })
|
|
32
|
+
}
|
|
32
33
|
},
|
|
33
34
|
})
|
package/build/svelte/ssr.ts.stub
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
}}}
|
|
4
4
|
|
|
5
5
|
import { createInertiaApp } from '@inertiajs/svelte'
|
|
6
|
+
import { render as svelteRender } from 'svelte/server'
|
|
6
7
|
|
|
7
8
|
export default function render(page: any) {
|
|
8
9
|
return createInertiaApp({
|
|
@@ -10,6 +11,9 @@ export default function render(page: any) {
|
|
|
10
11
|
resolve: (name) => {
|
|
11
12
|
const pages = import.meta.glob('../pages/**/*.svelte', { eager: true })
|
|
12
13
|
{{ 'return pages[`../pages/${name}.svelte`]' }}
|
|
13
|
-
}
|
|
14
|
+
},
|
|
15
|
+
setup({ el, App, props }) {
|
|
16
|
+
return svelteRender(App, { props })
|
|
17
|
+
},
|
|
14
18
|
})
|
|
15
19
|
}
|