@adonisjs/inertia 3.1.0 → 3.1.1

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import Configure from '@adonisjs/core/commands/configure';
2
2
  import { ConfigProvider } from '@adonisjs/core/types';
3
- import { S as SharedData, I as InertiaConfig, R as ResolvedConfig } from './types-D6QX_SeH.js';
3
+ import { S as SharedData, I as InertiaConfig, R as ResolvedConfig } from './types-DVqEHBD1.js';
4
4
  import '@adonisjs/core/http';
5
5
  import '@tuyau/utils/types';
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { Vite } from '@adonisjs/vite';
2
2
  import { HttpContext } from '@adonisjs/core/http';
3
3
  import { NextFn } from '@adonisjs/core/types/http';
4
- import { R as ResolvedConfig, D as Data, P as PageObject, M as MaybePromise, O as OptionalProp, a as MergeProp, A as AlwaysProp, b as DeferProp } from '../types-D6QX_SeH.js';
4
+ import { R as ResolvedConfig, D as Data, P as PageObject, M as MaybePromise, O as OptionalProp, a as MergeProp, A as AlwaysProp, b as DeferProp } from '../types-DVqEHBD1.js';
5
5
  import '@adonisjs/core/types';
6
6
  import '@tuyau/utils/types';
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { PluginFn } from '@japa/runner/types';
2
2
  import { ApplicationService } from '@adonisjs/core/types';
3
- import { c as PageProps } from '../../../types-D6QX_SeH.js';
3
+ import { c as PageProps } from '../../../types-DVqEHBD1.js';
4
4
  import '@adonisjs/core/http';
5
5
  import '@tuyau/utils/types';
6
6
 
@@ -1,4 +1,4 @@
1
1
  import '@adonisjs/core/types';
2
2
  import '@adonisjs/core/http';
3
3
  import '@tuyau/utils/types';
4
- export { e as AssetsVersion, D as Data, I as InertiaConfig, h as InferPageProps, f as InferSharedProps, M as MaybePromise, P as PageObject, c as PageProps, i as RenderInertiaSsrApp, R as ResolvedConfig, S as SharedData, d as SharedDatumFactory, g as SharedProps } from '../types-D6QX_SeH.js';
4
+ export { e as AssetsVersion, D as Data, I as InertiaConfig, h as InferPageProps, f as InferSharedProps, M as MaybePromise, P as PageObject, c as PageProps, i as RenderInertiaSsrApp, R as ResolvedConfig, S as SharedData, d as SharedDatumFactory, g as SharedProps } from '../types-DVqEHBD1.js';
@@ -6,25 +6,23 @@
6
6
 
7
7
  import '../css/app.css';
8
8
 
9
- import { createInertiaApp } from '@inertiajs/svelte'
9
+ import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte'
10
10
  import { resolvePageComponent } from '@adonisjs/inertia/helpers'
11
11
  import { hydrate, mount } from 'svelte'
12
12
 
13
- const appName = import.meta.env.VITE_APP_NAME || 'AdonisJS'
14
-
15
13
  createInertiaApp({
16
14
  progress: { color: '#5468FF' },
17
15
 
18
- title: (title) => {{ '`${title} - ${appName}`' }},
19
-
20
16
  resolve: (name) => {
21
- return resolvePageComponent(
17
+ return resolvePageComponent<ResolvedComponent>(
22
18
  {{ '`../pages/${name}.svelte`' }},
23
- import.meta.glob('../pages/**/*.svelte'),
19
+ import.meta.glob<ResolvedComponent>('../pages/**/*.svelte'),
24
20
  )
25
21
  },
26
22
 
27
23
  setup({ el, App, props }) {
24
+ if (!el) throw new Error('Missing root element. Make sure to add a div#app to your page')
25
+
28
26
  if (el.dataset.serverRendered === 'true') {
29
27
  hydrate(App, { target: el, props })
30
28
  } else {
@@ -2,17 +2,17 @@
2
2
  exports({ to: app.makePath('inertia/app/ssr.ts') })
3
3
  }}}
4
4
 
5
- import { createInertiaApp } from '@inertiajs/svelte'
5
+ import { createInertiaApp, type ResolvedComponent } from '@inertiajs/svelte'
6
6
  import { render as svelteRender } from 'svelte/server'
7
7
 
8
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/**/*.svelte', { eager: true })
12
+ const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.svelte', { eager: true })
13
13
  {{ 'return pages[`../pages/${name}.svelte`]' }}
14
14
  },
15
- setup({ el, App, props }) {
15
+ setup({ App, props }) {
16
16
  return svelteRender(App, { props })
17
17
  },
18
18
  })
@@ -194,7 +194,7 @@ type InferProps<T> = {
194
194
  } & {
195
195
  [K in keyof T as IsOptionalProp<T[K]> extends true ? never : K]: T[K] extends {
196
196
  callback: () => MaybePromise<infer U>;
197
- } ? U : T[K];
197
+ } ? U : T[K] extends () => MaybePromise<infer U> ? U : T[K];
198
198
  };
199
199
  type ReturnsTypesSharedData<T extends SharedData> = {} extends T ? {} : InferProps<{
200
200
  [K in keyof T]: T[K] extends (...args: any[]) => MaybePromise<infer U> ? U : T[K];
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": "3.1.0",
4
+ "version": "3.1.1",
5
5
  "engines": {
6
6
  "node": ">=20.6.0"
7
7
  },
@@ -40,8 +40,8 @@
40
40
  "devDependencies": {
41
41
  "@adonisjs/assembler": "^7.8.2",
42
42
  "@adonisjs/core": "6.17.1",
43
- "@adonisjs/eslint-config": "^2.0.0-beta.7",
44
- "@adonisjs/prettier-config": "^1.4.0",
43
+ "@adonisjs/eslint-config": "^2.0.0",
44
+ "@adonisjs/prettier-config": "^1.4.2",
45
45
  "@adonisjs/session": "^7.5.1",
46
46
  "@adonisjs/tsconfig": "^1.4.0",
47
47
  "@adonisjs/vite": "^4.0.0",
@@ -54,7 +54,7 @@
54
54
  "@japa/snapshot": "^2.0.8",
55
55
  "@release-it/conventional-changelog": "^10.0.0",
56
56
  "@swc/core": "1.10.7",
57
- "@types/node": "^22.12.0",
57
+ "@types/node": "^22.13.9",
58
58
  "@types/qs": "^6.9.18",
59
59
  "@types/supertest": "^6.0.2",
60
60
  "@vavite/multibuild": "^5.1.0",
@@ -63,19 +63,19 @@
63
63
  "del-cli": "^6.0.0",
64
64
  "edge-parser": "^9.0.4",
65
65
  "edge.js": "^6.2.1",
66
- "eslint": "^9.19.0",
66
+ "eslint": "^9.21.0",
67
67
  "get-port": "^7.1.0",
68
- "prettier": "^3.4.2",
68
+ "prettier": "^3.5.3",
69
69
  "release-it": "^18.1.2",
70
70
  "supertest": "^7.0.0",
71
71
  "ts-node-maintained": "^10.9.5",
72
- "tsup": "^8.3.6",
73
- "typescript": "~5.7.3",
74
- "vite": "^6.0.11"
72
+ "tsup": "^8.4.0",
73
+ "typescript": "~5.8.2",
74
+ "vite": "^6.2.1"
75
75
  },
76
76
  "dependencies": {
77
77
  "@poppinss/utils": "^6.9.2",
78
- "@tuyau/utils": "^0.0.6",
78
+ "@tuyau/utils": "^0.0.7",
79
79
  "edge-error": "^4.0.2",
80
80
  "html-entities": "^2.5.2",
81
81
  "locate-path": "^7.2.0",