@adonisjs/inertia 4.0.0-next.3 → 4.0.0-next.5
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-PJU4O2LR.js → chunk-N5YXFHD2.js} +1 -2
- package/build/{chunk-A6EKUU4C.js → chunk-XFUDVODO.js} +13 -13
- package/build/factories/main.js +3 -3
- package/build/index.js +3 -3
- package/build/providers/inertia_provider.js +2 -2
- package/build/src/inertia.d.ts +3 -3
- package/build/src/inertia_middleware.js +4 -4
- package/build/src/props.d.ts +3 -2
- package/build/src/types.d.ts +0 -4
- package/package.json +5 -5
|
@@ -67,14 +67,13 @@ function defineConfig(config) {
|
|
|
67
67
|
return lodash.merge(
|
|
68
68
|
{
|
|
69
69
|
rootView: "inertia_layout",
|
|
70
|
-
entrypoint: "inertia/app/app.ts",
|
|
71
70
|
history: {
|
|
72
71
|
encrypt: false
|
|
73
72
|
},
|
|
74
73
|
ssr: {
|
|
75
74
|
enabled: false,
|
|
76
75
|
bundle: "ssr/ssr.js",
|
|
77
|
-
entrypoint: "inertia/
|
|
76
|
+
entrypoint: "inertia/ssr.tsx"
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
79
|
config
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
debug_default
|
|
3
|
-
} from "./chunk-4EZ2J6OA.js";
|
|
4
1
|
import {
|
|
5
2
|
InertiaHeaders
|
|
6
3
|
} from "./chunk-DISC5OYC.js";
|
|
4
|
+
import {
|
|
5
|
+
debug_default
|
|
6
|
+
} from "./chunk-4EZ2J6OA.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
9
|
} from "./chunk-MLKGABMK.js";
|
|
@@ -79,10 +79,10 @@ function isAlwaysProp(propValue) {
|
|
|
79
79
|
function isOptionalProp(propValue) {
|
|
80
80
|
return OPTIONAL_PROP in propValue;
|
|
81
81
|
}
|
|
82
|
-
async function unpackPropValue(value) {
|
|
83
|
-
return serialize(value);
|
|
82
|
+
async function unpackPropValue(value, containerResolver) {
|
|
83
|
+
return serialize(value, containerResolver);
|
|
84
84
|
}
|
|
85
|
-
async function buildStandardVisitProps(pageProps) {
|
|
85
|
+
async function buildStandardVisitProps(pageProps, containerResolver) {
|
|
86
86
|
const mergeProps = [];
|
|
87
87
|
const deepMergeProps = [];
|
|
88
88
|
const newProps = {};
|
|
@@ -141,11 +141,11 @@ async function buildStandardVisitProps(pageProps) {
|
|
|
141
141
|
await Promise.all(
|
|
142
142
|
unpackedValues.map(async ({ key, value }) => {
|
|
143
143
|
if (typeof value === "function") {
|
|
144
|
-
return Promise.resolve(value()).then((r) => unpackPropValue(r)).then((jsonValue) => {
|
|
144
|
+
return Promise.resolve(value()).then((r) => unpackPropValue(r, containerResolver)).then((jsonValue) => {
|
|
145
145
|
newProps[key] = jsonValue;
|
|
146
146
|
});
|
|
147
147
|
} else {
|
|
148
|
-
return unpackPropValue(value).then((jsonValue) => {
|
|
148
|
+
return unpackPropValue(value, containerResolver).then((jsonValue) => {
|
|
149
149
|
newProps[key] = jsonValue;
|
|
150
150
|
});
|
|
151
151
|
}
|
|
@@ -158,7 +158,7 @@ async function buildStandardVisitProps(pageProps) {
|
|
|
158
158
|
deferredProps
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
async function buildPartialRequestProps(pageProps, cherryPickProps) {
|
|
161
|
+
async function buildPartialRequestProps(pageProps, cherryPickProps, containerResolver) {
|
|
162
162
|
const mergeProps = [];
|
|
163
163
|
const deepMergeProps = [];
|
|
164
164
|
const newProps = {};
|
|
@@ -208,11 +208,11 @@ async function buildPartialRequestProps(pageProps, cherryPickProps) {
|
|
|
208
208
|
await Promise.all(
|
|
209
209
|
unpackedValues.map(async ({ key, value }) => {
|
|
210
210
|
if (typeof value === "function") {
|
|
211
|
-
return Promise.resolve(value()).then((r) => unpackPropValue(r)).then((jsonValue) => {
|
|
211
|
+
return Promise.resolve(value()).then((r) => unpackPropValue(r, containerResolver)).then((jsonValue) => {
|
|
212
212
|
newProps[key] = jsonValue;
|
|
213
213
|
});
|
|
214
214
|
} else {
|
|
215
|
-
return unpackPropValue(value).then((jsonValue) => {
|
|
215
|
+
return unpackPropValue(value, containerResolver).then((jsonValue) => {
|
|
216
216
|
newProps[key] = jsonValue;
|
|
217
217
|
});
|
|
218
218
|
}
|
|
@@ -367,10 +367,10 @@ var Inertia = class {
|
|
|
367
367
|
});
|
|
368
368
|
debug_default("building props for a partial reload %O", requestInfo);
|
|
369
369
|
debug_default("cherry picking props %s", cherryPickProps);
|
|
370
|
-
return buildPartialRequestProps(finalProps, cherryPickProps);
|
|
370
|
+
return buildPartialRequestProps(finalProps, cherryPickProps, this.ctx.containerResolver);
|
|
371
371
|
}
|
|
372
372
|
debug_default("building props for a standard visit %O", requestInfo);
|
|
373
|
-
return buildStandardVisitProps(finalProps);
|
|
373
|
+
return buildStandardVisitProps(finalProps, this.ctx.containerResolver);
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Handle Inertia request by setting headers and returning page object
|
package/build/factories/main.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineConfig
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-N5YXFHD2.js";
|
|
4
4
|
import {
|
|
5
5
|
Inertia,
|
|
6
6
|
ServerRenderer
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-4EZ2J6OA.js";
|
|
7
|
+
} from "../chunk-XFUDVODO.js";
|
|
9
8
|
import {
|
|
10
9
|
InertiaHeaders
|
|
11
10
|
} from "../chunk-DISC5OYC.js";
|
|
11
|
+
import "../chunk-4EZ2J6OA.js";
|
|
12
12
|
import "../chunk-MLKGABMK.js";
|
|
13
13
|
|
|
14
14
|
// factories/inertia_factory.ts
|
package/build/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineConfig,
|
|
3
3
|
indexPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-N5YXFHD2.js";
|
|
5
5
|
import {
|
|
6
6
|
Inertia,
|
|
7
7
|
InertiaManager,
|
|
8
8
|
ServerRenderer,
|
|
9
9
|
symbols_exports
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-4EZ2J6OA.js";
|
|
10
|
+
} from "./chunk-XFUDVODO.js";
|
|
12
11
|
import {
|
|
13
12
|
InertiaHeaders
|
|
14
13
|
} from "./chunk-DISC5OYC.js";
|
|
14
|
+
import "./chunk-4EZ2J6OA.js";
|
|
15
15
|
import "./chunk-MLKGABMK.js";
|
|
16
16
|
export {
|
|
17
17
|
Inertia,
|
package/build/src/inertia.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Vite } from '@adonisjs/vite';
|
|
2
2
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
3
3
|
import { type ServerRenderer } from './server_renderer.js';
|
|
4
|
-
import type { PageProps, PageObject, AsPageProps, RequestInfo, InertiaConfig, ComponentProps } from './types.js';
|
|
4
|
+
import type { PageProps, PageObject, AsPageProps, RequestInfo, InertiaConfig, ComponentProps, SharedProps } from './types.js';
|
|
5
5
|
import { defer, merge, always, optional, deepMerge } from './props.ts';
|
|
6
6
|
/**
|
|
7
7
|
* Main class used to interact with Inertia
|
|
@@ -175,7 +175,7 @@ export declare class Inertia<Pages> {
|
|
|
175
175
|
* })
|
|
176
176
|
* ```
|
|
177
177
|
*/
|
|
178
|
-
page<Page extends keyof Pages & string>(page: Page, pageProps: Pages[Page] extends ComponentProps ? AsPageProps<Pages[Page]
|
|
178
|
+
page<Page extends keyof Pages & string>(page: Page, pageProps: Pages[Page] extends ComponentProps ? AsPageProps<Omit<Pages[Page], keyof SharedProps>> : never): Promise<PageObject<Pages[Page]>>;
|
|
179
179
|
/**
|
|
180
180
|
* Render a page using Inertia
|
|
181
181
|
*
|
|
@@ -202,7 +202,7 @@ export declare class Inertia<Pages> {
|
|
|
202
202
|
* const html = await inertia.render('Home', { welcome: 'Hello World' })
|
|
203
203
|
* ```
|
|
204
204
|
*/
|
|
205
|
-
render<Page extends keyof Pages & string>(page: Page, pageProps: Pages[Page] extends ComponentProps ? AsPageProps<Pages[Page]
|
|
205
|
+
render<Page extends keyof Pages & string>(page: Page, pageProps: Pages[Page] extends ComponentProps ? AsPageProps<Omit<Pages[Page], keyof SharedProps>> : never, viewProps?: Record<string, any>): Promise<string | PageObject<Pages[Page]>>;
|
|
206
206
|
/**
|
|
207
207
|
* Clear the browser history on the next navigation
|
|
208
208
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InertiaManager
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import {
|
|
5
|
-
debug_default
|
|
6
|
-
} from "../chunk-4EZ2J6OA.js";
|
|
3
|
+
} from "../chunk-XFUDVODO.js";
|
|
7
4
|
import {
|
|
8
5
|
InertiaHeaders
|
|
9
6
|
} from "../chunk-DISC5OYC.js";
|
|
7
|
+
import {
|
|
8
|
+
debug_default
|
|
9
|
+
} from "../chunk-4EZ2J6OA.js";
|
|
10
10
|
import "../chunk-MLKGABMK.js";
|
|
11
11
|
|
|
12
12
|
// src/inertia_middleware.ts
|
package/build/src/props.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AsyncOrSync } from '@poppinss/utils/types';
|
|
2
2
|
import { type DeferProp, type PageProps, type AlwaysProp, type OptionalProp, type MergeableProp, type ComponentProps, type UnPackedPageProps } from './types.ts';
|
|
3
|
+
import { type ContainerResolver } from '@adonisjs/core/container';
|
|
3
4
|
/**
|
|
4
5
|
* Creates a deferred prop that is never included in standard visits but must be shared with
|
|
5
6
|
* the client during standard visits. Can be explicitly requested and supports merging.
|
|
@@ -230,7 +231,7 @@ export declare function isOptionalProp<T extends UnPackedPageProps>(propValue: O
|
|
|
230
231
|
* // Returns: { props: { user: {...} }, deferredProps: { default: ['posts'] }, mergeProps: ['settings'] }
|
|
231
232
|
* ```
|
|
232
233
|
*/
|
|
233
|
-
export declare function buildStandardVisitProps(pageProps: PageProps): Promise<{
|
|
234
|
+
export declare function buildStandardVisitProps(pageProps: PageProps, containerResolver: ContainerResolver<any>): Promise<{
|
|
234
235
|
props: ComponentProps;
|
|
235
236
|
mergeProps: string[];
|
|
236
237
|
deepMergeProps: string[];
|
|
@@ -261,7 +262,7 @@ export declare function buildStandardVisitProps(pageProps: PageProps): Promise<{
|
|
|
261
262
|
* // Returns: { props: { posts: [...], stats: [...] }, mergeProps: [], deferredProps: {} }
|
|
262
263
|
* ```
|
|
263
264
|
*/
|
|
264
|
-
export declare function buildPartialRequestProps(pageProps: PageProps, cherryPickProps: string[]): Promise<{
|
|
265
|
+
export declare function buildPartialRequestProps(pageProps: PageProps, cherryPickProps: string[], containerResolver: ContainerResolver<any>): Promise<{
|
|
265
266
|
props: ComponentProps;
|
|
266
267
|
mergeProps: string[];
|
|
267
268
|
deepMergeProps: string[];
|
package/build/src/types.d.ts
CHANGED
|
@@ -242,10 +242,6 @@ export type InertiaConfig = {
|
|
|
242
242
|
* application
|
|
243
243
|
*/
|
|
244
244
|
rootView: string | ((ctx: HttpContext) => string);
|
|
245
|
-
/**
|
|
246
|
-
* The entrypoint file to load in order to boot the frontend application.
|
|
247
|
-
*/
|
|
248
|
-
entrypoint: string;
|
|
249
245
|
/**
|
|
250
246
|
* A fixed asset version value to use. Otherwise, it will be read from the
|
|
251
247
|
* Vite manifest file.
|
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": "4.0.0-next.
|
|
4
|
+
"version": "4.0.0-next.5",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0"
|
|
7
7
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@adonisjs/assembler": "^8.0.0-next.9",
|
|
46
46
|
"@adonisjs/core": "^7.0.0-next.1",
|
|
47
|
-
"@adonisjs/eslint-config": "^3.0.0-next.
|
|
47
|
+
"@adonisjs/eslint-config": "^3.0.0-next.4",
|
|
48
48
|
"@adonisjs/prettier-config": "^1.4.5",
|
|
49
49
|
"@adonisjs/session": "^8.0.0-next.0",
|
|
50
50
|
"@adonisjs/tsconfig": "^2.0.0-next.0",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"@japa/snapshot": "^2.0.9",
|
|
59
59
|
"@poppinss/ts-exec": "^1.4.1",
|
|
60
60
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
61
|
-
"@types/node": "^24.
|
|
61
|
+
"@types/node": "^24.6.2",
|
|
62
62
|
"@types/supertest": "^6.0.3",
|
|
63
63
|
"c8": "^10.1.3",
|
|
64
64
|
"copyfiles": "^2.4.1",
|
|
65
|
-
"cross-env": "^10.
|
|
65
|
+
"cross-env": "^10.1.0",
|
|
66
66
|
"del-cli": "^7.0.0",
|
|
67
67
|
"edge.js": "^6.3.0",
|
|
68
68
|
"eslint": "^9.36.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"release-it": "^19.0.5",
|
|
72
72
|
"supertest": "^7.1.4",
|
|
73
73
|
"tsup": "^8.5.0",
|
|
74
|
-
"typescript": "~5.9.
|
|
74
|
+
"typescript": "~5.9.3",
|
|
75
75
|
"vite": "^7.1.7"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|