@adonisjs/inertia 1.0.0-15 → 1.0.0-17

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/index.js CHANGED
@@ -53,6 +53,7 @@ var ADAPTERS_INFO = {
53
53
  ],
54
54
  viteRegister: {
55
55
  pluginCall: "svelte()",
56
+ ssrPluginCall: "svelte({ compilerOptions: { hydratable: true } })",
56
57
  importDeclarations: [
57
58
  { isNamed: true, module: "@sveltejs/vite-plugin-svelte", identifier: "svelte" }
58
59
  ]
@@ -143,7 +144,7 @@ async function configure(command) {
143
144
  await codemods.makeUsingStub(stubsRoot, `app.css.stub`, {});
144
145
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/root.edge.stub`, {});
145
146
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/tsconfig.json.stub`, {});
146
- await codemods.makeUsingStub(stubsRoot, `${stubFolder}/app.${appExt}.stub`, {});
147
+ await codemods.makeUsingStub(stubsRoot, `${stubFolder}/app.${appExt}.stub`, { ssr });
147
148
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/home.${compExt}.stub`, {});
148
149
  if (ssr) {
149
150
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/ssr.${appExt}.stub`, {});
@@ -3,7 +3,11 @@
3
3
  }}}
4
4
  import './css/app.css';
5
5
 
6
+ {{#if ssr}}
7
+ import { hydrateRoot } from 'react-dom/client'
8
+ {{#else}}
6
9
  import { createRoot } from 'react-dom/client';
10
+ {{/if}}
7
11
  import { createInertiaApp } from '@inertiajs/react';
8
12
  import { resolvePageComponent } from '@adonisjs/inertia/helpers'
9
13
 
@@ -22,7 +26,10 @@ createInertiaApp({
22
26
  },
23
27
 
24
28
  setup({ el, App, props }) {
25
- const root = createRoot(el);
26
- root.render(<App {...props} />);
29
+ {{#if ssr}}
30
+ hydrateRoot(el, <App {...props} />)
31
+ {{#else}}
32
+ createRoot(el).render(<App {...props} />);
33
+ {{/if}}
27
34
  },
28
35
  });
@@ -3,7 +3,11 @@
3
3
  }}}
4
4
  import './css/app.css'
5
5
 
6
+ {{#if ssr}}
7
+ import { hydrate } from 'solid-js/web';
8
+ {{#else}}
6
9
  import { render } from 'solid-js/web'
10
+ {{/if}}
7
11
  import { createInertiaApp } from 'inertia-adapter-solid'
8
12
  import { resolvePageComponent } from '@adonisjs/inertia/helpers'
9
13
 
@@ -22,6 +26,10 @@ createInertiaApp({
22
26
  },
23
27
 
24
28
  setup({ el, App, props }) {
29
+ {{#if ssr}}
30
+ hydrate(() => <App {...props} />, el)
31
+ {{#else}}
25
32
  render(() => <App {...props} />, el)
33
+ {{/if}}
26
34
  },
27
35
  })
@@ -21,6 +21,10 @@ createInertiaApp({
21
21
  },
22
22
 
23
23
  setup({ el, App, props }) {
24
+ {{#if ssr}}
25
+ new App({ target: el, props, hydrate: true })
26
+ {{#else}}
24
27
  new App({ target: el, props })
28
+ {{/if}}
25
29
  },
26
30
  })
@@ -2,15 +2,15 @@
2
2
  exports({ to: app.makePath('resources/pages/home.svelte') })
3
3
  }}}
4
4
  <script>
5
- export let version: number
5
+ export let version
6
6
  </script>
7
7
 
8
8
  <svelte:head>
9
9
  <title>Homepage</title>
10
10
  </svelte:head>
11
11
 
12
- <div className="container">
13
- <div className="title">AdonisJS \{ version \} x Inertia x Svelte</div>
12
+ <div class="container">
13
+ <div class="title">AdonisJS \{ version \} x Inertia x Svelte</div>
14
14
 
15
15
  <span>
16
16
  Learn more about AdonisJS and Inertia.js by visiting the
@@ -3,7 +3,11 @@
3
3
  }}}
4
4
  import './css/app.css';
5
5
 
6
+ {{#if ssr}}
7
+ import { createSSRApp, h } from 'vue'
8
+ {{#else}}
6
9
  import { createApp, h } from 'vue'
10
+ {{/if}}
7
11
  import type { DefineComponent } from 'vue'
8
12
  import { createInertiaApp } from '@inertiajs/vue3'
9
13
  import { resolvePageComponent } from '@adonisjs/inertia/helpers'
@@ -23,7 +27,11 @@ createInertiaApp({
23
27
  },
24
28
 
25
29
  setup({ el, App, props, plugin }) {
30
+ {{#if ssr}}
31
+ createSSRApp({ render: () => h(App, props) })
32
+ {{#else}}
26
33
  createApp({ render: () => h(App, props) })
34
+ {{/if}}
27
35
  .use(plugin)
28
36
  .mount(el)
29
37
  },
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": "1.0.0-15",
4
+ "version": "1.0.0-17",
5
5
  "engines": {
6
6
  "node": ">=18.16.0"
7
7
  },