@adonisjs/inertia 1.0.0-1 → 1.0.0-2

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.
@@ -61,11 +61,11 @@ var Inertia = class {
61
61
  /**
62
62
  * Render a page using Inertia
63
63
  */
64
- async render(component, pageProps) {
64
+ async render(component, pageProps, viewProps) {
65
65
  const pageObject = await this.#buildPageObject(component, pageProps);
66
66
  const isInertiaRequest = !!this.ctx.request.header("x-inertia");
67
67
  if (!isInertiaRequest) {
68
- return this.ctx.view.render(this.config.rootView, { page: pageObject });
68
+ return this.ctx.view.render(this.config.rootView, { ...viewProps, page: pageObject });
69
69
  }
70
70
  return pageObject;
71
71
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InertiaMiddleware
3
- } from "../chunk-TO74VVAR.js";
3
+ } from "../chunk-GDULL3NT.js";
4
4
 
5
5
  // providers/inertia_provider.ts
6
6
  import { configProvider } from "@adonisjs/core";
@@ -17,7 +17,7 @@ declare class Inertia {
17
17
  /**
18
18
  * Render a page using Inertia
19
19
  */
20
- render<T extends PageProps>(component: string, pageProps?: T): Promise<string | {
20
+ render<TPageProps extends Record<string, any> = PageProps, TViewProps extends Record<string, any> = PageProps>(component: string, pageProps?: TPageProps, viewProps?: TViewProps): Promise<string | {
21
21
  component: string;
22
22
  version: string | number;
23
23
  props: any;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InertiaMiddleware
3
- } from "../chunk-TO74VVAR.js";
3
+ } from "../chunk-GDULL3NT.js";
4
4
  export {
5
5
  InertiaMiddleware as default
6
6
  };
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-1",
4
+ "version": "1.0.0-2",
5
5
  "engines": {
6
6
  "node": ">=18.16.0"
7
7
  },
@@ -44,6 +44,7 @@
44
44
  "@adonisjs/tsconfig": "^1.1.8",
45
45
  "@japa/api-client": "^2.0.1",
46
46
  "@japa/assert": "2.0.1",
47
+ "@japa/expect-type": "^2.0.0",
47
48
  "@japa/file-system": "^2.0.1",
48
49
  "@japa/plugin-adonisjs": "^2.0.1",
49
50
  "@japa/runner": "3.0.5",
@@ -63,7 +64,7 @@
63
64
  "tinybench": "^2.5.1",
64
65
  "ts-node": "^10.9.1",
65
66
  "tsup": "^7.3.0",
66
- "typescript": "^5.2.2"
67
+ "typescript": "~5.2.2"
67
68
  },
68
69
  "dependencies": {
69
70
  "@poppinss/utils": "^6.5.1",