@adonisjs/inertia 1.0.0-14 → 1.0.0-16
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/{chunk-NVJNYWGW.js → chunk-7ZZGYDYU.js} +2 -2
- package/build/index.js +7 -2
- package/build/providers/inertia_provider.js +1 -1
- package/build/react/app.tsx.stub +10 -3
- package/build/react/home.tsx.stub +1 -1
- package/build/react/root.edge.stub +1 -1
- package/build/solid/app.tsx.stub +9 -1
- package/build/solid/home.tsx.stub +1 -1
- package/build/solid/root.edge.stub +1 -1
- package/build/src/inertia_middleware.js +1 -1
- package/build/svelte/app.ts.stub +30 -0
- package/build/svelte/home.svelte.stub +19 -0
- package/build/svelte/root.edge.stub +21 -0
- package/build/svelte/ssr.ts.stub +15 -0
- package/build/svelte/tsconfig.json.stub +26 -0
- package/build/vue/app.ts.stub +8 -0
- package/build/vue/home.vue.stub +3 -3
- package/package.json +1 -1
|
@@ -60,8 +60,8 @@ var ServerRenderer = class {
|
|
|
60
60
|
async render(pageObject) {
|
|
61
61
|
let render;
|
|
62
62
|
let preloadTags = [];
|
|
63
|
-
|
|
64
|
-
|
|
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
|
@@ -53,8 +53,9 @@ var ADAPTERS_INFO = {
|
|
|
53
53
|
],
|
|
54
54
|
viteRegister: {
|
|
55
55
|
pluginCall: "svelte()",
|
|
56
|
+
ssrPluginCall: "svelte({ compilerOptions: { hydratable: true } })",
|
|
56
57
|
importDeclarations: [
|
|
57
|
-
{ isNamed:
|
|
58
|
+
{ isNamed: true, module: "@sveltejs/vite-plugin-svelte", identifier: "svelte" }
|
|
58
59
|
]
|
|
59
60
|
},
|
|
60
61
|
ssrEntrypoint: "resources/ssr.ts"
|
|
@@ -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`, {});
|
|
@@ -156,6 +157,10 @@ async function configure(command) {
|
|
|
156
157
|
ssr && adapterInfo.viteRegister.ssrPluginCall ? adapterInfo.viteRegister.ssrPluginCall : adapterInfo.viteRegister.pluginCall,
|
|
157
158
|
adapterInfo.viteRegister.importDeclarations
|
|
158
159
|
);
|
|
160
|
+
const adonisjsPluginCall = `adonisjs({ entrypoints: ['resources/app.${appExt}'], reload: ['resources/views/**/*.edge'] })`;
|
|
161
|
+
await codemods.registerVitePlugin(adonisjsPluginCall, [
|
|
162
|
+
{ isNamed: false, module: "@adonisjs/vite/client", identifier: "adonisjs" }
|
|
163
|
+
]);
|
|
159
164
|
await defineExampleRoute(command, codemods);
|
|
160
165
|
const pkgToInstall = adapterInfo.dependencies;
|
|
161
166
|
if (ssr && adapterInfo.ssrDependencies) {
|
package/build/react/app.tsx.stub
CHANGED
|
@@ -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
|
|
|
@@ -17,12 +21,15 @@ createInertiaApp({
|
|
|
17
21
|
resolve: (name) => {
|
|
18
22
|
return resolvePageComponent(
|
|
19
23
|
{{ '`./pages/${name}.tsx`' }},
|
|
20
|
-
import.meta.glob
|
|
24
|
+
import.meta.glob('./pages/**/*.tsx'),
|
|
21
25
|
)
|
|
22
26
|
},
|
|
23
27
|
|
|
24
28
|
setup({ el, App, props }) {
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
{{#if ssr}}
|
|
30
|
+
hydrateRoot(el).render(<App {...props} />);
|
|
31
|
+
{{#else}}
|
|
32
|
+
createRoot(el).render(<App {...props} />);
|
|
33
|
+
{{/if}}
|
|
27
34
|
},
|
|
28
35
|
});
|
|
@@ -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>
|
package/build/solid/app.tsx.stub
CHANGED
|
@@ -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
|
|
|
@@ -17,11 +21,15 @@ createInertiaApp({
|
|
|
17
21
|
resolve: (name) => {
|
|
18
22
|
return resolvePageComponent(
|
|
19
23
|
{{ '`./pages/${name}.tsx`' }},
|
|
20
|
-
import.meta.glob
|
|
24
|
+
import.meta.glob('./pages/**/*.tsx'),
|
|
21
25
|
)
|
|
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
|
})
|
|
@@ -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>
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
{{#if ssr}}
|
|
25
|
+
new App({ target: el, props, hydrate: true })
|
|
26
|
+
{{#else}}
|
|
27
|
+
new App({ target: el, props })
|
|
28
|
+
{{/if}}
|
|
29
|
+
},
|
|
30
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{{
|
|
2
|
+
exports({ to: app.makePath('resources/pages/home.svelte') })
|
|
3
|
+
}}}
|
|
4
|
+
<script>
|
|
5
|
+
export let version
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<svelte:head>
|
|
9
|
+
<title>Homepage</title>
|
|
10
|
+
</svelte:head>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<div class="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
|
+
}
|
package/build/vue/app.ts.stub
CHANGED
|
@@ -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/build/vue/home.vue.stub
CHANGED
|
@@ -10,12 +10,12 @@ defineProps<{ version: number }>()
|
|
|
10
10
|
<template>
|
|
11
11
|
<Head title="Homepage" />
|
|
12
12
|
|
|
13
|
-
<div
|
|
14
|
-
<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>
|