@adonisjs/inertia 1.0.0-16 → 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.
- package/build/app.css.stub +1 -1
- package/build/config.stub +2 -2
- package/build/index.js +20 -18
- package/build/react/app.tsx.stub +5 -5
- package/build/react/errors/not_found.tsx.stub +14 -0
- package/build/react/errors/server_error.tsx.stub +14 -0
- package/build/react/home.tsx.stub +1 -1
- package/build/react/root.edge.stub +2 -2
- package/build/react/ssr.tsx.stub +3 -3
- package/build/react/tsconfig.json.stub +3 -13
- package/build/solid/app.tsx.stub +4 -4
- package/build/solid/errors/not_found.tsx.stub +14 -0
- package/build/solid/errors/server_error.tsx.stub +14 -0
- package/build/solid/home.tsx.stub +1 -4
- package/build/solid/root.edge.stub +2 -2
- package/build/solid/ssr.tsx.stub +3 -3
- package/build/solid/tsconfig.json.stub +5 -15
- package/build/src/plugins/vite.js +1 -0
- package/build/src/types.d.ts +1 -1
- package/build/svelte/app.ts.stub +4 -4
- package/build/svelte/errors/not_found.svelte.stub +10 -0
- package/build/svelte/errors/server_error.svelte.stub +14 -0
- package/build/svelte/home.svelte.stub +1 -1
- package/build/svelte/root.edge.stub +2 -2
- package/build/svelte/ssr.ts.stub +3 -3
- package/build/svelte/tsconfig.json.stub +3 -15
- package/build/vue/app.ts.stub +4 -4
- package/build/vue/errors/not_found.vue.stub +10 -0
- package/build/vue/errors/server_error.vue.stub +14 -0
- package/build/vue/home.vue.stub +1 -1
- package/build/vue/root.edge.stub +2 -2
- package/build/vue/ssr.ts.stub +3 -3
- package/build/vue/tsconfig.json.stub +5 -15
- package/package.json +1 -1
package/build/app.css.stub
CHANGED
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: '
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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("
|
|
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: '
|
|
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: ['
|
|
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
|
-
"./
|
|
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
|
-
"./
|
|
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 ?? "
|
|
295
|
+
rootView: config.rootView ?? "inertia_layout",
|
|
296
296
|
sharedData: config.sharedData || {},
|
|
297
|
-
entrypoint: slash(
|
|
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("
|
|
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
|
};
|
package/build/react/app.tsx.stub
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
2
|
+
exports({ to: app.makePath('inertia/app/app.tsx') })
|
|
3
3
|
}}}
|
|
4
|
-
import '
|
|
4
|
+
import '../css/app.css';
|
|
5
5
|
|
|
6
6
|
{{#if ssr}}
|
|
7
7
|
import { hydrateRoot } from 'react-dom/client'
|
|
@@ -20,14 +20,14 @@ createInertiaApp({
|
|
|
20
20
|
|
|
21
21
|
resolve: (name) => {
|
|
22
22
|
return resolvePageComponent(
|
|
23
|
-
{{ '
|
|
24
|
-
import.meta.glob('
|
|
23
|
+
{{ '`../pages/${name}.tsx`' }},
|
|
24
|
+
import.meta.glob('../pages/**/*.tsx'),
|
|
25
25
|
)
|
|
26
26
|
},
|
|
27
27
|
|
|
28
28
|
setup({ el, App, props }) {
|
|
29
29
|
{{#if ssr}}
|
|
30
|
-
hydrateRoot(el
|
|
30
|
+
hydrateRoot(el, <App {...props} />)
|
|
31
31
|
{{#else}}
|
|
32
32
|
createRoot(el).render(<App {...props} />);
|
|
33
33
|
{{/if}}
|
|
@@ -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/views/
|
|
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(['
|
|
15
|
+
{{ "@vite(['inertia/app/app.tsx', `inertia/pages/${page.component}.tsx`])" }}
|
|
16
16
|
</head>
|
|
17
17
|
|
|
18
18
|
<body>
|
package/build/react/ssr.tsx.stub
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
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('
|
|
13
|
-
{{ 'return pages[
|
|
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('
|
|
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
|
-
"
|
|
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
|
}
|
package/build/solid/app.tsx.stub
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
2
|
+
exports({ to: app.makePath('inertia/app/app.tsx') })
|
|
3
3
|
}}}
|
|
4
|
-
import '
|
|
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
|
-
{{ '
|
|
24
|
-
import.meta.glob('
|
|
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('
|
|
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/
|
|
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(['
|
|
14
|
+
{{ "@vite(['inertia/app/app.tsx', `inertia/pages/${page.component}.tsx`])" }}
|
|
15
15
|
</head>
|
|
16
16
|
|
|
17
17
|
<body>
|
package/build/solid/ssr.tsx.stub
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
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('
|
|
13
|
-
{{ 'return pages[
|
|
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('
|
|
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
|
-
"
|
|
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
|
}
|
package/build/src/types.d.ts
CHANGED
|
@@ -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/
|
|
47
|
+
* @default root (resources/views/inertia_layout.edge)
|
|
48
48
|
*/
|
|
49
49
|
rootView?: string;
|
|
50
50
|
/**
|
package/build/svelte/app.ts.stub
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
2
|
+
exports({ to: app.makePath('inertia/app/app.ts') })
|
|
3
3
|
}}}
|
|
4
|
-
import '
|
|
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
|
-
{{ '
|
|
19
|
-
import.meta.glob('
|
|
18
|
+
{{ '`../pages/${name}.svelte`' }},
|
|
19
|
+
import.meta.glob('../pages/**/*.svelte'),
|
|
20
20
|
)
|
|
21
21
|
},
|
|
22
22
|
|
|
@@ -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/views/
|
|
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(['
|
|
13
|
+
{{ "@vite(['inertia/app/app.ts', `inertia/pages/${page.component}.svelte`])" }}
|
|
14
14
|
@inertiaHead()
|
|
15
15
|
</head>
|
|
16
16
|
|
package/build/svelte/ssr.ts.stub
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
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('
|
|
12
|
-
{{ 'return pages[
|
|
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('
|
|
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
|
}
|
package/build/vue/app.ts.stub
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
2
|
+
exports({ to: app.makePath('inertia/app/app.ts') })
|
|
3
3
|
}}}
|
|
4
|
-
import '
|
|
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
|
-
{{ '
|
|
25
|
-
import.meta.glob<DefineComponent>('
|
|
24
|
+
{{ '`../pages/${name}.vue`' }},
|
|
25
|
+
import.meta.glob<DefineComponent>('../pages/**/*.vue'),
|
|
26
26
|
)
|
|
27
27
|
},
|
|
28
28
|
|
|
@@ -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>
|
package/build/vue/home.vue.stub
CHANGED
package/build/vue/root.edge.stub
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('resources/views/
|
|
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(['
|
|
13
|
+
{{ "@vite(['inertia/app/app.ts', `inertia/pages/${page.component}.vue`])" }}
|
|
14
14
|
@inertiaHead()
|
|
15
15
|
</head>
|
|
16
16
|
|
package/build/vue/ssr.ts.stub
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{{{
|
|
2
|
-
exports({ to: app.makePath('
|
|
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>('
|
|
15
|
-
{{ 'return pages[
|
|
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('
|
|
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
|
-
"
|
|
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
|
}
|