@adonisjs/inertia 4.0.0-next.3 → 4.0.0-next.4
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.
|
@@ -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
|
@@ -4,11 +4,11 @@ import {
|
|
|
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
|
@@ -7,11 +7,11 @@ import {
|
|
|
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,
|
|
@@ -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/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.4",
|
|
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.0",
|
|
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",
|