@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
  }
@@ -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
- {{#if ssr}}
28
- new App({ target: el, props, hydrate: true })
29
- {{#else}}
30
- new App({ target: el, props })
31
- {{/if}}
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
  })
@@ -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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/inertia",
3
3
  "description": "Official Inertia.js adapter for AdonisJS",
4
- "version": "2.1.2",
4
+ "version": "2.1.3",
5
5
  "engines": {
6
6
  "node": ">=20.6.0"
7
7
  },