@adonisjs/inertia 1.0.0-17 → 1.0.0-18

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.
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/css/app.css') })
2
+ exports({ to: app.makePath('inertia/css/app.css') })
3
3
  }}}
4
4
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500&display=swap');
5
5
 
package/build/config.stub CHANGED
@@ -7,13 +7,13 @@ export default defineConfig({
7
7
  /**
8
8
  * Path to the Edge view that will be used as the root view for Inertia responses
9
9
  */
10
- rootView: 'root',
10
+ rootView: 'inertia_layout',
11
11
 
12
12
  /**
13
13
  * Data that should be shared with all rendered pages
14
14
  */
15
15
  sharedData: {
16
- errors: (ctx) => ctx.session.flashMessages.get('errors'),
16
+ errors: (ctx) => ctx.session?.flashMessages.get('errors'),
17
17
  },
18
18
 
19
19
  /**
package/build/index.js CHANGED
@@ -22,7 +22,7 @@ var ADAPTERS_INFO = {
22
22
  pluginCall: "vue()",
23
23
  importDeclarations: [{ isNamed: false, module: "@vitejs/plugin-vue", identifier: "vue" }]
24
24
  },
25
- ssrEntrypoint: "resources/ssr.ts"
25
+ ssrEntrypoint: "inertia/app/ssr.ts"
26
26
  },
27
27
  react: {
28
28
  stubFolder: "react",
@@ -40,7 +40,7 @@ var ADAPTERS_INFO = {
40
40
  pluginCall: "react()",
41
41
  importDeclarations: [{ isNamed: false, module: "@vitejs/plugin-react", identifier: "react" }]
42
42
  },
43
- ssrEntrypoint: "resources/ssr.tsx"
43
+ ssrEntrypoint: "inertia/app/ssr.tsx"
44
44
  },
45
45
  svelte: {
46
46
  stubFolder: "svelte",
@@ -58,7 +58,7 @@ var ADAPTERS_INFO = {
58
58
  { isNamed: true, module: "@sveltejs/vite-plugin-svelte", identifier: "svelte" }
59
59
  ]
60
60
  },
61
- ssrEntrypoint: "resources/ssr.ts"
61
+ ssrEntrypoint: "inertia/app/ssr.ts"
62
62
  },
63
63
  solid: {
64
64
  stubFolder: "solid",
@@ -75,7 +75,7 @@ var ADAPTERS_INFO = {
75
75
  ssrPluginCall: "solid({ ssr: true })",
76
76
  importDeclarations: [{ isNamed: false, module: "vite-plugin-solid", identifier: "solid" }]
77
77
  },
78
- ssrEntrypoint: "resources/ssr.tsx"
78
+ ssrEntrypoint: "inertia/app/ssr.tsx"
79
79
  }
80
80
  };
81
81
  async function defineExampleRoute(command, codemods) {
@@ -131,7 +131,7 @@ async function configure(command) {
131
131
  await codemods.updateRcFile((rcFile) => {
132
132
  rcFile.addProvider("@adonisjs/inertia/inertia_provider");
133
133
  });
134
- await codemods.registerMiddleware("router", [
134
+ await codemods.registerMiddleware("server", [
135
135
  { path: "@adonisjs/inertia/inertia_middleware", position: "after" }
136
136
  ]);
137
137
  const appExt = adapterInfo.appExtension;
@@ -146,10 +146,12 @@ async function configure(command) {
146
146
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/tsconfig.json.stub`, {});
147
147
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/app.${appExt}.stub`, { ssr });
148
148
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/home.${compExt}.stub`, {});
149
+ await codemods.makeUsingStub(stubsRoot, `${stubFolder}/errors/not_found.${compExt}.stub`, {});
150
+ await codemods.makeUsingStub(stubsRoot, `${stubFolder}/errors/server_error.${compExt}.stub`, {});
149
151
  if (ssr) {
150
152
  await codemods.makeUsingStub(stubsRoot, `${stubFolder}/ssr.${appExt}.stub`, {});
151
153
  }
152
- const inertiaPluginCall = ssr ? `inertia({ ssr: { enabled: true, entrypoint: 'resources/ssr.${appExt}' } })` : `inertia({ ssr: { enabled: false } })`;
154
+ const inertiaPluginCall = ssr ? `inertia({ ssr: { enabled: true, entrypoint: 'inertia/app/ssr.${appExt}' } })` : `inertia({ ssr: { enabled: false } })`;
153
155
  await codemods.registerVitePlugin(inertiaPluginCall, [
154
156
  { isNamed: false, module: "@adonisjs/inertia/client", identifier: "inertia" }
155
157
  ]);
@@ -157,7 +159,7 @@ async function configure(command) {
157
159
  ssr && adapterInfo.viteRegister.ssrPluginCall ? adapterInfo.viteRegister.ssrPluginCall : adapterInfo.viteRegister.pluginCall,
158
160
  adapterInfo.viteRegister.importDeclarations
159
161
  );
160
- const adonisjsPluginCall = `adonisjs({ entrypoints: ['resources/app.${appExt}'], reload: ['resources/views/**/*.edge'] })`;
162
+ const adonisjsPluginCall = `adonisjs({ entrypoints: ['inertia/app/app.${appExt}'], reload: ['resources/views/**/*.edge'] })`;
161
163
  await codemods.registerVitePlugin(adonisjsPluginCall, [
162
164
  { isNamed: false, module: "@adonisjs/vite/client", identifier: "adonisjs" }
163
165
  ]);
@@ -242,14 +244,13 @@ var FilesDetector = class {
242
244
  */
243
245
  async detectEntrypoint(defaultPath) {
244
246
  const possiblesLocations = [
247
+ "./inertia/app/app.ts",
248
+ "./inertia/app/app.tsx",
245
249
  "./resources/app.ts",
246
250
  "./resources/app.tsx",
247
- "./resources/application/app.ts",
248
- "./resources/application/app.tsx",
249
251
  "./resources/app.jsx",
250
252
  "./resources/app.js",
251
- "./resources/application/app.jsx",
252
- "./resources/application/app.js"
253
+ "./inertia/app/app.jsx"
253
254
  ];
254
255
  const path = await locatePath(possiblesLocations, { cwd: this.app.appRoot });
255
256
  return this.app.makePath(path || defaultPath);
@@ -260,14 +261,13 @@ var FilesDetector = class {
260
261
  */
261
262
  async detectSsrEntrypoint(defaultPath) {
262
263
  const possiblesLocations = [
264
+ "./inertia/app/ssr.ts",
265
+ "./inertia/app/ssr.tsx",
263
266
  "./resources/ssr.ts",
264
267
  "./resources/ssr.tsx",
265
- "./resources/application/ssr.ts",
266
- "./resources/application/ssr.tsx",
267
268
  "./resources/ssr.jsx",
268
269
  "./resources/ssr.js",
269
- "./resources/application/ssr.jsx",
270
- "./resources/application/ssr.js"
270
+ "./inertia/app/ssr.jsx"
271
271
  ];
272
272
  const path = await locatePath(possiblesLocations, { cwd: this.app.appRoot });
273
273
  return this.app.makePath(path || defaultPath);
@@ -292,13 +292,15 @@ function defineConfig(config) {
292
292
  await versionCache.computeVersion();
293
293
  return {
294
294
  versionCache,
295
- rootView: config.rootView ?? "root",
295
+ rootView: config.rootView ?? "inertia_layout",
296
296
  sharedData: config.sharedData || {},
297
- entrypoint: slash(config.entrypoint ?? await detector.detectEntrypoint("resources/app.ts")),
297
+ entrypoint: slash(
298
+ config.entrypoint ?? await detector.detectEntrypoint("inertia/app/app.ts")
299
+ ),
298
300
  ssr: {
299
301
  enabled: config.ssr?.enabled ?? false,
300
302
  pages: config.ssr?.pages,
301
- entrypoint: config.ssr?.entrypoint ?? await detector.detectSsrEntrypoint("resources/ssr.ts"),
303
+ entrypoint: config.ssr?.entrypoint ?? await detector.detectSsrEntrypoint("inertia/app/ssr.ts"),
302
304
  bundle: config.ssr?.bundle ?? await detector.detectSsrBundle("ssr/ssr.js")
303
305
  }
304
306
  };
@@ -1,7 +1,7 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/app.tsx') })
2
+ exports({ to: app.makePath('inertia/app/app.tsx') })
3
3
  }}}
4
- import './css/app.css';
4
+ import '../css/app.css';
5
5
 
6
6
  {{#if ssr}}
7
7
  import { hydrateRoot } from 'react-dom/client'
@@ -20,8 +20,8 @@ createInertiaApp({
20
20
 
21
21
  resolve: (name) => {
22
22
  return resolvePageComponent(
23
- {{ '`./pages/${name}.tsx`' }},
24
- import.meta.glob('./pages/**/*.tsx'),
23
+ {{ '`../pages/${name}.tsx`' }},
24
+ import.meta.glob('../pages/**/*.tsx'),
25
25
  )
26
26
  },
27
27
 
@@ -0,0 +1,14 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/not_found.tsx') })
3
+ }}}
4
+ export default function NotFound() {
5
+ return (
6
+ <>
7
+ <div className="container">
8
+ <div className="title">Page not found</div>
9
+
10
+ <span>This page does not exist.</span>
11
+ </div>
12
+ </>
13
+ )
14
+ }
@@ -0,0 +1,14 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/server_error.tsx') })
3
+ }}}
4
+ export default function ServerError(props: { error: any }) {
5
+ return (
6
+ <>
7
+ <div className="container">
8
+ <div className="title">Server Error</div>
9
+
10
+ <span>{props.error.message}</span>
11
+ </div>
12
+ </>
13
+ )
14
+ }
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/pages/home.tsx') })
2
+ exports({ to: app.makePath('inertia/pages/home.tsx') })
3
3
  }}}
4
4
  import { Head } from '@inertiajs/react'
5
5
 
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/views/root.edge') })
2
+ exports({ to: app.makePath('resources/views/inertia_layout.edge') })
3
3
  }}}
4
4
  <!DOCTYPE html>
5
5
  <html>
@@ -12,7 +12,7 @@
12
12
 
13
13
  @viteReactRefresh()
14
14
  @inertiaHead()
15
- {{ "@vite(['resources/app.tsx', `resources/pages/${page.component}.tsx`])" }}
15
+ {{ "@vite(['inertia/app/app.tsx', `inertia/pages/${page.component}.tsx`])" }}
16
16
  </head>
17
17
 
18
18
  <body>
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/ssr.tsx') })
2
+ exports({ to: app.makePath('inertia/app/ssr.tsx') })
3
3
  }}}
4
4
  import ReactDOMServer from 'react-dom/server'
5
5
  import { createInertiaApp } from '@inertiajs/react'
@@ -9,8 +9,8 @@ export default function render(page: any) {
9
9
  page,
10
10
  render: ReactDOMServer.renderToString,
11
11
  resolve: (name) => {
12
- const pages = import.meta.glob('./pages/**/*.tsx', { eager: true })
13
- {{ 'return pages[`./pages/${name}.tsx`]' }}
12
+ const pages = import.meta.glob('../pages/**/*.tsx', { eager: true })
13
+ {{ 'return pages[`../pages/${name}.tsx`]' }}
14
14
  },
15
15
  setup: ({ App, props }) => <App {...props} />,
16
16
  })
@@ -1,25 +1,15 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/tsconfig.json') })
2
+ exports({ to: app.makePath('inertia/tsconfig.json') })
3
3
  }}}
4
4
  {
5
+ "extends": "@adonisjs/tsconfig/tsconfig.client.json",
5
6
  "compilerOptions": {
6
- "target": "ESNext",
7
- "jsx": "react-jsx",
8
- "lib": ["DOM", "ESNext", "DOM.Iterable", "ES2020"],
9
- "useDefineForClassFields": true,
10
7
  "baseUrl": ".",
11
8
  "module": "ESNext",
12
- "moduleResolution": "Bundler",
9
+ "jsx": "react-jsx",
13
10
  "paths": {
14
- "@/*": ["./*"],
15
11
  "~/*": ["../*"],
16
12
  },
17
- "resolveJsonModule": true,
18
- "types": ["vite/client"],
19
- "allowSyntheticDefaultImports": true,
20
- "esModuleInterop": true,
21
- "verbatimModuleSyntax": true,
22
- "skipLibCheck": true,
23
13
  },
24
14
  "include": ["./**/*.ts", "./**/*.tsx"],
25
15
  }
@@ -1,7 +1,7 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/app.tsx') })
2
+ exports({ to: app.makePath('inertia/app/app.tsx') })
3
3
  }}}
4
- import './css/app.css'
4
+ import '../css/app.css'
5
5
 
6
6
  {{#if ssr}}
7
7
  import { hydrate } from 'solid-js/web';
@@ -20,8 +20,8 @@ createInertiaApp({
20
20
 
21
21
  resolve: (name) => {
22
22
  return resolvePageComponent(
23
- {{ '`./pages/${name}.tsx`' }},
24
- import.meta.glob('./pages/**/*.tsx'),
23
+ {{ '`../pages/${name}.tsx`' }},
24
+ import.meta.glob('../pages/**/*.tsx'),
25
25
  )
26
26
  },
27
27
 
@@ -0,0 +1,14 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/not_found.tsx') })
3
+ }}}
4
+ export default function NotFound() {
5
+ return (
6
+ <>
7
+ <div class="container">
8
+ <div class="title">Page not found</div>
9
+
10
+ <span>This page does not exist.</span>
11
+ </div>
12
+ </>
13
+ )
14
+ }
@@ -0,0 +1,14 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/server_error.tsx') })
3
+ }}}
4
+ export default function ServerError(props: { error: any }) {
5
+ return (
6
+ <>
7
+ <div class="container">
8
+ <div class="title">Server Error</div>
9
+
10
+ <span>{props.error.message}</span>
11
+ </div>
12
+ </>
13
+ )
14
+ }
@@ -1,13 +1,10 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/pages/home.tsx') })
2
+ exports({ to: app.makePath('inertia/pages/home.tsx') })
3
3
  }}}
4
- import { Title } from '@solidjs/meta'
5
4
 
6
5
  export default function Home(props: { version: number }) {
7
6
  return (
8
7
  <>
9
- <Title>Homepage</Title>
10
-
11
8
  <div class="container">
12
9
  <div class="title">AdonisJS {props.version} x Inertia x Solid.js</div>
13
10
 
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/views/root.edge') })
2
+ exports({ to: app.makePath('resources/views/inertia_layout.edge') })
3
3
  }}}
4
4
  <!DOCTYPE html>
5
5
  <html>
@@ -11,7 +11,7 @@
11
11
  <title inertia>AdonisJS x Inertia x SolidJS</title>
12
12
 
13
13
  @inertiaHead()
14
- {{ "@vite(['resources/app.tsx', `resources/pages/${page.component}.tsx`])" }}
14
+ {{ "@vite(['inertia/app/app.tsx', `inertia/pages/${page.component}.tsx`])" }}
15
15
  </head>
16
16
 
17
17
  <body>
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/ssr.tsx') })
2
+ exports({ to: app.makePath('inertia/app/ssr.tsx') })
3
3
  }}}
4
4
 
5
5
  import { hydrate } from 'solid-js/web'
@@ -9,8 +9,8 @@ export default function render(page: any) {
9
9
  return createInertiaApp({
10
10
  page,
11
11
  resolve: (name) => {
12
- const pages = import.meta.glob('./pages/**/*.tsx', { eager: true })
13
- {{ 'return pages[`./pages/${name}.tsx`]' }}
12
+ const pages = import.meta.glob('../pages/**/*.tsx', { eager: true })
13
+ {{ 'return pages[`../pages/${name}.tsx`]' }}
14
14
  },
15
15
  setup({ el, App, props }) {
16
16
  hydrate(() => <App {...props} />, el)
@@ -1,26 +1,16 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/tsconfig.json') })
2
+ exports({ to: app.makePath('inertia/tsconfig.json') })
3
3
  }}}
4
4
  {
5
+ "extends": "@adonisjs/tsconfig/tsconfig.client.json",
5
6
  "compilerOptions": {
6
- "target": "ESNext",
7
- "jsx": "preserve",
8
- "jsxImportSource": "solid-js",
9
- "lib": ["DOM", "ESNext", "DOM.Iterable", "ES2020"],
10
- "useDefineForClassFields": true,
11
7
  "baseUrl": ".",
8
+ "jsx": "preserve",
12
9
  "module": "ESNext",
13
- "moduleResolution": "Bundler",
10
+ "jsxImportSource": "solid-js",
14
11
  "paths": {
15
- "@/*": ["./*"],
16
- "~/*": ["../*"],
12
+ "~/*": ["./*"],
17
13
  },
18
- "resolveJsonModule": true,
19
- "types": ["vite/client"],
20
- "allowSyntheticDefaultImports": true,
21
- "esModuleInterop": true,
22
- "verbatimModuleSyntax": true,
23
- "skipLibCheck": true,
24
14
  },
25
15
  "include": ["./**/*.ts", "./**/*.tsx"],
26
16
  }
@@ -5,6 +5,7 @@ function inertia(options) {
5
5
  config: () => {
6
6
  if (!options?.ssr?.enabled)
7
7
  return {};
8
+ process.env.NODE_ENV = "production";
8
9
  return {
9
10
  buildSteps: [
10
11
  {
@@ -44,7 +44,7 @@ type AssetsVersion = string | number | undefined;
44
44
  interface InertiaConfig {
45
45
  /**
46
46
  * Path to the Edge view that will be used as the root view for Inertia responses.
47
- * @default root (resources/views/root.edge)
47
+ * @default root (resources/views/inertia_layout.edge)
48
48
  */
49
49
  rootView?: string;
50
50
  /**
@@ -1,7 +1,7 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/app.ts') })
2
+ exports({ to: app.makePath('inertia/app/app.ts') })
3
3
  }}}
4
- import './css/app.css';
4
+ import '../css/app.css';
5
5
 
6
6
  import { createInertiaApp } from '@inertiajs/svelte'
7
7
  import { resolvePageComponent } from '@adonisjs/inertia/helpers'
@@ -15,8 +15,8 @@ createInertiaApp({
15
15
 
16
16
  resolve: (name) => {
17
17
  return resolvePageComponent(
18
- {{ '`./pages/${name}.svelte`' }},
19
- import.meta.glob('./pages/**/*.svelte'),
18
+ {{ '`../pages/${name}.svelte`' }},
19
+ import.meta.glob('../pages/**/*.svelte'),
20
20
  )
21
21
  },
22
22
 
@@ -0,0 +1,10 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/not_found.svelte') })
3
+ }}}
4
+ <div>
5
+ <div class="container">
6
+ <div class="title">Page not found</div>
7
+
8
+ <span>This page does not exist.</span>
9
+ </div>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/server_error.svelte') })
3
+ }}}
4
+ <script>
5
+ export let error
6
+ </script>
7
+
8
+ <div>
9
+ <div class="container">
10
+ <div class="title">Server Error</div>
11
+
12
+ <span>{error.message}</span>
13
+ </div>
14
+ </div>
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/pages/home.svelte') })
2
+ exports({ to: app.makePath('inertia/pages/home.svelte') })
3
3
  }}}
4
4
  <script>
5
5
  export let version
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/views/root.edge') })
2
+ exports({ to: app.makePath('resources/views/inertia_layout.edge') })
3
3
  }}}
4
4
  <!DOCTYPE html>
5
5
  <html>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <title inertia>AdonisJS x Inertia x Svelte</title>
12
12
 
13
- {{ "@vite(['resources/app.ts', `resources/pages/${page.component}.svelte`])" }}
13
+ {{ "@vite(['inertia/app/app.ts', `inertia/pages/${page.component}.svelte`])" }}
14
14
  @inertiaHead()
15
15
  </head>
16
16
 
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/ssr.ts') })
2
+ exports({ to: app.makePath('inertia/app/ssr.ts') })
3
3
  }}}
4
4
 
5
5
  import { createInertiaApp } from '@inertiajs/svelte'
@@ -8,8 +8,8 @@ export default function render(page: any) {
8
8
  return createInertiaApp({
9
9
  page,
10
10
  resolve: (name) => {
11
- const pages = import.meta.glob('./pages/**/*.svelte', { eager: true })
12
- {{ 'return pages[`./pages/${name}.svelte`]' }}
11
+ const pages = import.meta.glob('../pages/**/*.svelte', { eager: true })
12
+ {{ 'return pages[`../pages/${name}.svelte`]' }}
13
13
  }
14
14
  })
15
15
  }
@@ -1,26 +1,14 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/tsconfig.json') })
2
+ exports({ to: app.makePath('inertia/tsconfig.json') })
3
3
  }}}
4
4
  {
5
+ "extends": "@adonisjs/tsconfig/tsconfig.client.json",
5
6
  "compilerOptions": {
6
- "target": "ESNext",
7
- "jsx": "preserve",
8
- "jsxImportSource": "vue",
9
- "lib": ["DOM", "ESNext", "DOM.Iterable", "ES2020"],
10
- "useDefineForClassFields": true,
11
7
  "baseUrl": ".",
12
8
  "module": "ESNext",
13
- "moduleResolution": "Bundler",
14
9
  "paths": {
15
- "@/*": ["./*"],
16
- "~/*": ["../*"],
10
+ "~/*": ["./*"],
17
11
  },
18
- "resolveJsonModule": true,
19
- "types": ["vite/client"],
20
- "allowSyntheticDefaultImports": true,
21
- "esModuleInterop": true,
22
- "verbatimModuleSyntax": true,
23
- "skipLibCheck": true,
24
12
  },
25
13
  "include": ["./**/*.ts", "./**/*.svelte"],
26
14
  }
@@ -1,7 +1,7 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/app.ts') })
2
+ exports({ to: app.makePath('inertia/app/app.ts') })
3
3
  }}}
4
- import './css/app.css';
4
+ import '../css/app.css';
5
5
 
6
6
  {{#if ssr}}
7
7
  import { createSSRApp, h } from 'vue'
@@ -21,8 +21,8 @@ createInertiaApp({
21
21
 
22
22
  resolve: (name) => {
23
23
  return resolvePageComponent(
24
- {{ '`./pages/${name}.vue`' }},
25
- import.meta.glob<DefineComponent>('./pages/**/*.vue'),
24
+ {{ '`../pages/${name}.vue`' }},
25
+ import.meta.glob<DefineComponent>('../pages/**/*.vue'),
26
26
  )
27
27
  },
28
28
 
@@ -0,0 +1,10 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/not_found.vue') })
3
+ }}}
4
+ <template>
5
+ <div class="container">
6
+ <div class="title">Page not found</div>
7
+
8
+ <span>This page does not exist.</span>
9
+ </div>
10
+ </template>
@@ -0,0 +1,14 @@
1
+ {{{
2
+ exports({ to: app.makePath('inertia/pages/errors/server_error.vue') })
3
+ }}}
4
+ <script setup lang="ts">
5
+ defineProps<{ error: any }>();
6
+ </script>
7
+
8
+ <template>
9
+ <div class="container">
10
+ <div class="title">Server Error</div>
11
+
12
+ <span>\{\{ error.message \}\}</span>
13
+ </div>
14
+ </template>
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/pages/home.vue') })
2
+ exports({ to: app.makePath('inertia/pages/home.vue') })
3
3
  }}}
4
4
  <script setup lang="ts">
5
5
  import { Head } from '@inertiajs/vue3'
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/views/root.edge') })
2
+ exports({ to: app.makePath('resources/views/inertia_layout.edge') })
3
3
  }}}
4
4
  <!DOCTYPE html>
5
5
  <html>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <title inertia>AdonisJS x Inertia x VueJS</title>
12
12
 
13
- {{ "@vite(['resources/app.ts', `resources/pages/${page.component}.vue`])" }}
13
+ {{ "@vite(['inertia/app/app.ts', `inertia/pages/${page.component}.vue`])" }}
14
14
  @inertiaHead()
15
15
  </head>
16
16
 
@@ -1,5 +1,5 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/ssr.ts') })
2
+ exports({ to: app.makePath('inertia/app/ssr.ts') })
3
3
  }}}
4
4
 
5
5
  import { createInertiaApp } from '@inertiajs/vue3'
@@ -11,8 +11,8 @@ export default function render(page: any) {
11
11
  page,
12
12
  render: renderToString,
13
13
  resolve: (name) => {
14
- const pages = import.meta.glob<DefineComponent>('./pages/**/*.vue', { eager: true })
15
- {{ 'return pages[`./pages/${name}.vue`]' }}
14
+ const pages = import.meta.glob<DefineComponent>('../pages/**/*.vue', { eager: true })
15
+ {{ 'return pages[`../pages/${name}.vue`]' }}
16
16
  },
17
17
 
18
18
  setup({ App, props, plugin }) {
@@ -1,26 +1,16 @@
1
1
  {{{
2
- exports({ to: app.makePath('resources/tsconfig.json') })
2
+ exports({ to: app.makePath('inertia/tsconfig.json') })
3
3
  }}}
4
4
  {
5
+ "extends": "@adonisjs/tsconfig/tsconfig.client.json",
5
6
  "compilerOptions": {
6
- "target": "ESNext",
7
- "jsx": "preserve",
8
- "jsxImportSource": "vue",
9
- "lib": ["DOM", "ESNext", "DOM.Iterable", "ES2020"],
10
- "useDefineForClassFields": true,
11
7
  "baseUrl": ".",
8
+ "jsx": "preserve",
12
9
  "module": "ESNext",
13
- "moduleResolution": "Bundler",
10
+ "jsxImportSource": "vue",
14
11
  "paths": {
15
- "@/*": ["./*"],
16
- "~/*": ["../*"],
12
+ "~/*": ["./*"],
17
13
  },
18
- "resolveJsonModule": true,
19
- "types": ["vite/client"],
20
- "allowSyntheticDefaultImports": true,
21
- "esModuleInterop": true,
22
- "verbatimModuleSyntax": true,
23
- "skipLibCheck": true,
24
14
  },
25
15
  "include": ["./**/*.ts", "./**/*.vue"],
26
16
  }
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-17",
4
+ "version": "1.0.0-18",
5
5
  "engines": {
6
6
  "node": ">=18.16.0"
7
7
  },