@adonisjs/inertia 1.0.0-14 → 1.0.0-15

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.
@@ -60,8 +60,8 @@ var ServerRenderer = class {
60
60
  async render(pageObject) {
61
61
  let render;
62
62
  let preloadTags = [];
63
- if (this.vite) {
64
- const devServer = this.vite.getDevServer();
63
+ const devServer = this.vite?.getDevServer();
64
+ if (devServer) {
65
65
  const runtime = await this.vite.createRuntime();
66
66
  render = await runtime.executeEntrypoint(this.config.ssr.entrypoint);
67
67
  const entryMod = devServer.moduleGraph.getModuleById(this.config.entrypoint);
package/build/index.js CHANGED
@@ -54,7 +54,7 @@ var ADAPTERS_INFO = {
54
54
  viteRegister: {
55
55
  pluginCall: "svelte()",
56
56
  importDeclarations: [
57
- { isNamed: false, module: "@sveltejs/vite-plugin-svelte", identifier: "svelte" }
57
+ { isNamed: true, module: "@sveltejs/vite-plugin-svelte", identifier: "svelte" }
58
58
  ]
59
59
  },
60
60
  ssrEntrypoint: "resources/ssr.ts"
@@ -156,6 +156,10 @@ async function configure(command) {
156
156
  ssr && adapterInfo.viteRegister.ssrPluginCall ? adapterInfo.viteRegister.ssrPluginCall : adapterInfo.viteRegister.pluginCall,
157
157
  adapterInfo.viteRegister.importDeclarations
158
158
  );
159
+ const adonisjsPluginCall = `adonisjs({ entrypoints: ['resources/app.${appExt}'], reload: ['resources/views/**/*.edge'] })`;
160
+ await codemods.registerVitePlugin(adonisjsPluginCall, [
161
+ { isNamed: false, module: "@adonisjs/vite/client", identifier: "adonisjs" }
162
+ ]);
159
163
  await defineExampleRoute(command, codemods);
160
164
  const pkgToInstall = adapterInfo.dependencies;
161
165
  if (ssr && adapterInfo.ssrDependencies) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InertiaMiddleware
3
- } from "../chunk-NVJNYWGW.js";
3
+ } from "../chunk-7ZZGYDYU.js";
4
4
 
5
5
  // providers/inertia_provider.ts
6
6
  import { configProvider } from "@adonisjs/core";
@@ -17,7 +17,7 @@ createInertiaApp({
17
17
  resolve: (name) => {
18
18
  return resolvePageComponent(
19
19
  {{ '`./pages/${name}.tsx`' }},
20
- import.meta.glob<DefineComponent>('./pages/**/*.tsx'),
20
+ import.meta.glob('./pages/**/*.tsx'),
21
21
  )
22
22
  },
23
23
 
@@ -13,7 +13,7 @@ export default function Home(props: { version: number }) {
13
13
 
14
14
  <span>
15
15
  Learn more about AdonisJS and Inertia.js by visiting the{' '}
16
- <a href="https://docs.adonisjs.com/inertia">AdonisJS documentation</a>.
16
+ <a href="https://docs.adonisjs.com/guides/inertia">AdonisJS documentation</a>.
17
17
  </span>
18
18
  </div>
19
19
  </>
@@ -11,8 +11,8 @@
11
11
  <title inertia>AdonisJS x Inertia x React</title>
12
12
 
13
13
  @viteReactRefresh()
14
- {{ "@vite(['resources/app.tsx', `resources/pages/${page.component}.tsx`])" }}
15
14
  @inertiaHead()
15
+ {{ "@vite(['resources/app.tsx', `resources/pages/${page.component}.tsx`])" }}
16
16
  </head>
17
17
 
18
18
  <body>
@@ -17,7 +17,7 @@ createInertiaApp({
17
17
  resolve: (name) => {
18
18
  return resolvePageComponent(
19
19
  {{ '`./pages/${name}.tsx`' }},
20
- import.meta.glob<DefineComponent>('./pages/**/*.tsx'),
20
+ import.meta.glob('./pages/**/*.tsx'),
21
21
  )
22
22
  },
23
23
 
@@ -13,7 +13,7 @@ export default function Home(props: { version: number }) {
13
13
 
14
14
  <span>
15
15
  Learn more about AdonisJS and Inertia.js by visiting the{' '}
16
- <a href="https://docs.adonisjs.com/inertia">AdonisJS documentation</a>.
16
+ <a href="https://docs.adonisjs.com/guides/inertia">AdonisJS documentation</a>.
17
17
  </span>
18
18
  </div>
19
19
  </>
@@ -10,8 +10,8 @@
10
10
 
11
11
  <title inertia>AdonisJS x Inertia x SolidJS</title>
12
12
 
13
- {{ "@vite(['resources/app.tsx', `resources/pages/${page.component}.tsx`])" }}
14
13
  @inertiaHead()
14
+ {{ "@vite(['resources/app.tsx', `resources/pages/${page.component}.tsx`])" }}
15
15
  </head>
16
16
 
17
17
  <body>
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InertiaMiddleware
3
- } from "../chunk-NVJNYWGW.js";
3
+ } from "../chunk-7ZZGYDYU.js";
4
4
  export {
5
5
  InertiaMiddleware as default
6
6
  };
@@ -0,0 +1,26 @@
1
+ {{{
2
+ exports({ to: app.makePath('resources/app.ts') })
3
+ }}}
4
+ import './css/app.css';
5
+
6
+ import { createInertiaApp } from '@inertiajs/svelte'
7
+ import { resolvePageComponent } from '@adonisjs/inertia/helpers'
8
+
9
+ const appName = import.meta.env.VITE_APP_NAME || 'AdonisJS'
10
+
11
+ createInertiaApp({
12
+ progress: { color: '#5468FF' },
13
+
14
+ title: (title) => {{ '`${title} - ${appName}`' }},
15
+
16
+ resolve: (name) => {
17
+ return resolvePageComponent(
18
+ {{ '`./pages/${name}.svelte`' }},
19
+ import.meta.glob('./pages/**/*.svelte'),
20
+ )
21
+ },
22
+
23
+ setup({ el, App, props }) {
24
+ new App({ target: el, props })
25
+ },
26
+ })
@@ -0,0 +1,19 @@
1
+ {{{
2
+ exports({ to: app.makePath('resources/pages/home.svelte') })
3
+ }}}
4
+ <script>
5
+ export let version: number
6
+ </script>
7
+
8
+ <svelte:head>
9
+ <title>Homepage</title>
10
+ </svelte:head>
11
+
12
+ <div className="container">
13
+ <div className="title">AdonisJS \{ version \} x Inertia x Svelte</div>
14
+
15
+ <span>
16
+ Learn more about AdonisJS and Inertia.js by visiting the
17
+ <a href="https://docs.adonisjs.com/guides/inertia">AdonisJS documentation</a>.
18
+ </span>
19
+ </div>
@@ -0,0 +1,21 @@
1
+ {{{
2
+ exports({ to: app.makePath('resources/views/root.edge') })
3
+ }}}
4
+ <!DOCTYPE html>
5
+ <html>
6
+
7
+ <head>
8
+ <meta charset="utf-8">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+
11
+ <title inertia>AdonisJS x Inertia x Svelte</title>
12
+
13
+ {{ "@vite(['resources/app.ts', `resources/pages/${page.component}.svelte`])" }}
14
+ @inertiaHead()
15
+ </head>
16
+
17
+ <body>
18
+ @inertia()
19
+ </body>
20
+
21
+ </html>
@@ -0,0 +1,15 @@
1
+ {{{
2
+ exports({ to: app.makePath('resources/ssr.ts') })
3
+ }}}
4
+
5
+ import { createInertiaApp } from '@inertiajs/svelte'
6
+
7
+ export default function render(page: any) {
8
+ return createInertiaApp({
9
+ page,
10
+ resolve: (name) => {
11
+ const pages = import.meta.glob('./pages/**/*.svelte', { eager: true })
12
+ {{ 'return pages[`./pages/${name}.svelte`]' }}
13
+ }
14
+ })
15
+ }
@@ -0,0 +1,26 @@
1
+ {{{
2
+ exports({ to: app.makePath('resources/tsconfig.json') })
3
+ }}}
4
+ {
5
+ "compilerOptions": {
6
+ "target": "ESNext",
7
+ "jsx": "preserve",
8
+ "jsxImportSource": "vue",
9
+ "lib": ["DOM", "ESNext", "DOM.Iterable", "ES2020"],
10
+ "useDefineForClassFields": true,
11
+ "baseUrl": ".",
12
+ "module": "ESNext",
13
+ "moduleResolution": "Bundler",
14
+ "paths": {
15
+ "@/*": ["./*"],
16
+ "~/*": ["../*"],
17
+ },
18
+ "resolveJsonModule": true,
19
+ "types": ["vite/client"],
20
+ "allowSyntheticDefaultImports": true,
21
+ "esModuleInterop": true,
22
+ "verbatimModuleSyntax": true,
23
+ "skipLibCheck": true,
24
+ },
25
+ "include": ["./**/*.ts", "./**/*.svelte"],
26
+ }
@@ -10,12 +10,12 @@ defineProps<{ version: number }>()
10
10
  <template>
11
11
  <Head title="Homepage" />
12
12
 
13
- <div className="container">
14
- <div className="title">AdonisJS \{\{ version \}\} x Inertia x Vue.js</div>
13
+ <div class="container">
14
+ <div class="title">AdonisJS \{\{ version \}\} x Inertia x Vue.js</div>
15
15
 
16
16
  <span>
17
17
  Learn more about AdonisJS and Inertia.js by visiting the
18
- <a href="https://docs.adonisjs.com/inertia">AdonisJS documentation</a>.
18
+ <a href="https://docs.adonisjs.com/guides/inertia">AdonisJS documentation</a>.
19
19
  </span>
20
20
  </div>
21
21
  </template>
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-14",
4
+ "version": "1.0.0-15",
5
5
  "engines": {
6
6
  "node": ">=18.16.0"
7
7
  },