@adonisjs/inertia 4.0.0-next.0 → 4.0.0-next.10

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.
Files changed (89) hide show
  1. package/README.md +8 -5
  2. package/build/bin/test.d.ts +1 -0
  3. package/build/chunk-4EZ2J6OA.js +7 -0
  4. package/build/chunk-5QRJHXXQ.js +91 -0
  5. package/build/chunk-DISC5OYC.js +46 -0
  6. package/build/chunk-MLKGABMK.js +9 -0
  7. package/build/chunk-YQ72YL64.js +813 -0
  8. package/build/factories/inertia_factory.d.ts +137 -0
  9. package/build/factories/main.d.ts +1 -0
  10. package/build/factories/main.js +175 -0
  11. package/build/index.d.ts +7 -19
  12. package/build/index.js +21 -307
  13. package/build/providers/inertia_provider.d.ts +86 -13
  14. package/build/providers/inertia_provider.js +48 -18
  15. package/build/src/client/helpers.d.ts +27 -0
  16. package/build/src/client/helpers.js +30 -0
  17. package/build/src/client/react/context.d.ts +24 -0
  18. package/build/src/client/react/index.d.ts +3 -0
  19. package/build/src/client/react/index.js +72 -0
  20. package/build/src/client/react/link.d.ts +64 -0
  21. package/build/src/client/react/router.d.ts +33 -0
  22. package/build/src/client/vite.d.ts +65 -0
  23. package/build/src/{plugins → client}/vite.js +6 -2
  24. package/build/src/debug.d.ts +22 -0
  25. package/build/src/define_config.d.ts +30 -0
  26. package/build/src/headers.d.ts +61 -0
  27. package/build/src/index_pages.d.ts +32 -0
  28. package/build/src/inertia.d.ts +261 -0
  29. package/build/src/inertia_manager.d.ts +47 -0
  30. package/build/src/inertia_middleware.d.ts +76 -86
  31. package/build/src/inertia_middleware.js +110 -3
  32. package/build/src/plugins/edge/plugin.d.ts +30 -6
  33. package/build/src/plugins/edge/plugin.js +13 -9
  34. package/build/src/plugins/edge/tags.d.ts +47 -0
  35. package/build/src/plugins/edge/utils.d.ts +26 -0
  36. package/build/src/plugins/japa/api_client.d.ts +136 -22
  37. package/build/src/plugins/japa/api_client.js +36 -48
  38. package/build/src/props.d.ts +276 -0
  39. package/build/src/server_renderer.d.ts +54 -0
  40. package/build/src/symbols.d.ts +25 -0
  41. package/build/src/types.d.ts +400 -4
  42. package/build/tests/helpers.d.ts +35 -0
  43. package/build/tests/index_pages.spec.d.ts +1 -0
  44. package/build/tests/inertia.spec.d.ts +1 -0
  45. package/build/tests/inertia_page.spec.d.ts +1 -0
  46. package/build/tests/middleware.spec.d.ts +1 -0
  47. package/build/tests/plugins/api_client.spec.d.ts +1 -0
  48. package/build/tests/plugins/edge.plugin.spec.d.ts +1 -0
  49. package/build/tests/provider.spec.d.ts +1 -0
  50. package/build/tests/types/react.spec.d.ts +65 -0
  51. package/build/tests/types/shared_props.spec.d.ts +1 -0
  52. package/build/tests/types/to_component_props.spec.d.ts +1 -0
  53. package/build/tests/types/to_page_props.spec.d.ts +1 -0
  54. package/package.json +99 -71
  55. package/build/app.css.stub +0 -13
  56. package/build/chunk-AWCR2NAY.js +0 -412
  57. package/build/config.stub +0 -33
  58. package/build/react/app.tsx.stub +0 -38
  59. package/build/react/errors/not_found.tsx.stub +0 -14
  60. package/build/react/errors/server_error.tsx.stub +0 -14
  61. package/build/react/home.tsx.stub +0 -349
  62. package/build/react/root.edge.stub +0 -76
  63. package/build/react/ssr.tsx.stub +0 -17
  64. package/build/react/tsconfig.json.stub +0 -15
  65. package/build/solid/app.tsx.stub +0 -38
  66. package/build/solid/errors/not_found.tsx.stub +0 -14
  67. package/build/solid/errors/server_error.tsx.stub +0 -14
  68. package/build/solid/home.tsx.stub +0 -358
  69. package/build/solid/root.edge.stub +0 -73
  70. package/build/solid/ssr.tsx.stub +0 -19
  71. package/build/solid/tsconfig.json.stub +0 -16
  72. package/build/src/helpers.d.ts +0 -12
  73. package/build/src/helpers.js +0 -14
  74. package/build/src/plugins/vite.d.ts +0 -26
  75. package/build/svelte/app.ts.stub +0 -32
  76. package/build/svelte/errors/not_found.svelte.stub +0 -10
  77. package/build/svelte/errors/server_error.svelte.stub +0 -14
  78. package/build/svelte/home.svelte.stub +0 -339
  79. package/build/svelte/root.edge.stub +0 -75
  80. package/build/svelte/ssr.ts.stub +0 -19
  81. package/build/svelte/tsconfig.json.stub +0 -14
  82. package/build/types-DVqEHBD1.d.ts +0 -240
  83. package/build/vue/app.ts.stub +0 -41
  84. package/build/vue/errors/not_found.vue.stub +0 -10
  85. package/build/vue/errors/server_error.vue.stub +0 -14
  86. package/build/vue/home.vue.stub +0 -343
  87. package/build/vue/root.edge.stub +0 -75
  88. package/build/vue/ssr.ts.stub +0 -22
  89. package/build/vue/tsconfig.json.stub +0 -16
@@ -0,0 +1,54 @@
1
+ import { type Vite } from '@adonisjs/vite';
2
+ import type { PageObject, InertiaConfig } from './types.js';
3
+ /**
4
+ * Server-side renderer for Inertia.js applications.
5
+ *
6
+ * Handles rendering Inertia pages on the server using either Vite's development
7
+ * runtime API or production SSR bundles.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const renderer = new ServerRenderer(config, vite)
12
+ * const { head, body } = await renderer.render(pageObject)
13
+ * ```
14
+ */
15
+ export declare class ServerRenderer {
16
+ #private;
17
+ /**
18
+ * Creates a new ServerRenderer instance.
19
+ *
20
+ * @param config - Inertia configuration object containing SSR settings
21
+ * @param vite - Vite instance for development mode rendering and asset management
22
+ *
23
+ * @example
24
+ * ```js
25
+ * const renderer = new ServerRenderer(config, vite)
26
+ * ```
27
+ */
28
+ constructor(config: InertiaConfig, vite: Vite);
29
+ /**
30
+ * Renders an Inertia page on the server.
31
+ *
32
+ * In development mode, uses Vite's Runtime API to execute the SSR entrypoint.
33
+ * In production mode, imports and uses the pre-built SSR bundle.
34
+ *
35
+ * @param pageObject - The Inertia page object containing component, props, and metadata
36
+ * @returns Promise resolving to an object with rendered head and body HTML
37
+ *
38
+ * @example
39
+ * ```js
40
+ * const pageObject = {
41
+ * component: 'Home',
42
+ * props: { user: { name: 'John' } },
43
+ * url: '/dashboard',
44
+ * version: '1.0.0'
45
+ * }
46
+ *
47
+ * const { head, body } = await renderer.render(pageObject)
48
+ * ```
49
+ */
50
+ render(pageObject: PageObject<any>): Promise<{
51
+ head: string[];
52
+ body: string;
53
+ }>;
54
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Symbol used to mark props that should always be included in responses.
3
+ * Props marked with this symbol cannot be filtered out during cherry-picking.
4
+ */
5
+ export declare const ALWAYS_PROP: unique symbol;
6
+ /**
7
+ * Symbol used to mark props that are optional and only included when explicitly requested.
8
+ * These props are never included in standard visits and must be cherry-picked.
9
+ */
10
+ export declare const OPTIONAL_PROP: unique symbol;
11
+ /**
12
+ * Symbol used to mark props that should be merged with existing props on the client.
13
+ * Props marked with this symbol will be merged rather than replaced during updates.
14
+ */
15
+ export declare const TO_BE_MERGED: unique symbol;
16
+ /**
17
+ * Symbol used to mark props that are deferred and computed lazily.
18
+ * These props are skipped in standard visits but communicated to the client for potential loading.
19
+ */
20
+ export declare const DEFERRED_PROP: unique symbol;
21
+ /**
22
+ * Symbol used to indicate that a mergeable prop should use deep merging behavior.
23
+ * Deep merging recursively merges nested objects and arrays.
24
+ */
25
+ export declare const DEEP_MERGE: unique symbol;
@@ -1,4 +1,400 @@
1
- import '@adonisjs/core/types';
2
- import '@adonisjs/core/http';
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-DVqEHBD1.js';
1
+ import type { HttpContext } from '@adonisjs/core/http';
2
+ import { type ContainerResolver } from '@adonisjs/core/container';
3
+ import type { JSONDataTypes } from '@adonisjs/core/types/transformers';
4
+ import type { AsyncOrSync, DeepPartial, Prettify } from '@adonisjs/core/types/common';
5
+ import { type DEEP_MERGE, type ALWAYS_PROP, type OPTIONAL_PROP, type TO_BE_MERGED, type DEFERRED_PROP } from './symbols.ts';
6
+ /**
7
+ * Representation of a resource item, collection and paginator that can be serialized
8
+ *
9
+ * @template T - The type that the serializable object resolves to
10
+ */
11
+ export type SerializableOf<T> = {
12
+ /**
13
+ * Serializes the object using the container resolver
14
+ *
15
+ * @param container - The container resolver instance
16
+ * @param depth - Current serialization depth
17
+ * @param maxDepth - Maximum allowed serialization depth
18
+ * @returns Promise that resolves to the serialized object
19
+ */
20
+ serialize(container: ContainerResolver<any>, depth: number, maxDepth?: number): Promise<T>;
21
+ };
22
+ /**
23
+ * Union type representing unpacked page prop values that can be either JSON data or serializable objects
24
+ *
25
+ * @template T - The JSON data type, defaults to JSONDataTypes
26
+ */
27
+ export type UnPackedPageProps<T extends JSONDataTypes = JSONDataTypes> = T | SerializableOf<T>;
28
+ /**
29
+ * Utility type that extracts the resolved type from a SerializableOf wrapper
30
+ * If the type is already unwrapped, returns it as-is
31
+ *
32
+ * @template T - The type to unwrap, potentially wrapped in SerializableOf
33
+ */
34
+ export type UnpackProp<T> = T extends SerializableOf<infer A> ? A : T;
35
+ /**
36
+ * Information extracted from Inertia request headers
37
+ * Contains metadata about the current request type and filtering preferences
38
+ */
39
+ export type RequestInfo = {
40
+ /** Asset version sent by the client for cache busting */
41
+ version?: string;
42
+ /** Whether this is an Inertia AJAX request */
43
+ isInertiaRequest: boolean;
44
+ /** Whether this is a partial data request */
45
+ isPartialRequest: boolean;
46
+ /** Component name for partial reloads */
47
+ partialComponent?: string;
48
+ /** Props to include in partial requests */
49
+ onlyProps?: string[];
50
+ /** Props to exclude in partial requests */
51
+ exceptProps?: string[];
52
+ /** Props to reset during merging */
53
+ resetProps?: string[];
54
+ /** Error bag identifier for validation errors */
55
+ errorBag?: string;
56
+ };
57
+ /**
58
+ * Represents a prop that is always included in responses and cannot be removed during cherry-picking
59
+ *
60
+ * @template T - The type of the prop value
61
+ */
62
+ export type AlwaysProp<T extends UnPackedPageProps> = {
63
+ /** The actual value of the prop */
64
+ value: T;
65
+ /** Brand symbol to identify this as an always prop */
66
+ [ALWAYS_PROP]: true;
67
+ };
68
+ /**
69
+ * Represents a prop that is never included in standard visits but can be explicitly requested
70
+ * The prop value is computed lazily when requested
71
+ *
72
+ * @template T - The type of the computed prop value
73
+ */
74
+ export type OptionalProp<T extends UnPackedPageProps> = {
75
+ /** Function that computes the prop value when requested */
76
+ compute: () => AsyncOrSync<T>;
77
+ /** Brand symbol to identify this as an optional prop */
78
+ [OPTIONAL_PROP]: true;
79
+ };
80
+ /**
81
+ * Represents a deferred prop that is never included in standard visits but must be shared with
82
+ * the client during standard visits. Can be explicitly requested and supports merging
83
+ *
84
+ * @template T - The type of the computed prop value
85
+ */
86
+ export type DeferProp<T extends UnPackedPageProps> = {
87
+ group: string;
88
+ /** Function that computes the prop value when requested */
89
+ compute: () => AsyncOrSync<T>;
90
+ /** Creates a mergeable version of this deferred prop */
91
+ merge(): MergeableProp<DeferProp<T>>;
92
+ /** Brand symbol to identify this as a deferred prop */
93
+ [DEFERRED_PROP]: true;
94
+ };
95
+ /**
96
+ * Represents a prop that should be merged with existing props on the page rather than replaced
97
+ *
98
+ * @template T - The type of the prop value to be merged
99
+ */
100
+ export type MergeableProp<T extends UnPackedPageProps | DeferProp<UnPackedPageProps>> = {
101
+ /** The prop value to be merged */
102
+ value: T;
103
+ /** Brand symbol to identify this prop for merging */
104
+ [TO_BE_MERGED]: true;
105
+ [DEEP_MERGE]: boolean;
106
+ };
107
+ /**
108
+ * Lazy props are never included during standard Inertia visits
109
+ * These props must be explicitly requested by the client
110
+ *
111
+ * @template T - The data type of the prop value
112
+ */
113
+ type PagePropsLazyDataTypes<T extends JSONDataTypes> =
114
+ /**
115
+ * - Never included on standard visit
116
+ * - Must be shared with the client during standard visit
117
+ * - Can be explicitly requested for
118
+ * - Can be dropped during cherry-picking
119
+ */
120
+ DeferProp<T | SerializableOf<T>>
121
+ /**
122
+ * - Never included on standard visit
123
+ * - Can be explicitly requested for
124
+ * - Can be dropped during cherry-picking
125
+ */
126
+ | OptionalProp<T | SerializableOf<T>>;
127
+ /**
128
+ * Eager props are always included during standard Inertia visits, but
129
+ * can be removed via cherry-picking when only specific props are requested
130
+ *
131
+ * @template T - The data type of the prop value
132
+ */
133
+ type PagePropsEagerDataTypes<T extends JSONDataTypes> =
134
+ /**
135
+ * - Always included on standard visit.
136
+ * - Can be dropped during cherry-picking
137
+ */
138
+ T
139
+ /**
140
+ * - Always included on standard visit.
141
+ * - Can be dropped during cherry-picking
142
+ */
143
+ | SerializableOf<T>
144
+ /**
145
+ * - Always included on standard visit.
146
+ * - Can be dropped during cherry-picking
147
+ */
148
+ | (() => AsyncOrSync<T | SerializableOf<T>>)
149
+ /**
150
+ * - Always included on standard visit
151
+ * - Cannot be dropped during cherry-picking
152
+ */
153
+ | AlwaysProp<T | SerializableOf<T>>;
154
+ /**
155
+ * Following is the list of acceptable Page props data types
156
+ * Combines both eager and lazy prop data types for comprehensive prop handling
157
+ *
158
+ * @template T - The data type extending JSONDataTypes, defaults to JSONDataTypes
159
+ */
160
+ export type PagePropsDataTypes<T extends JSONDataTypes = JSONDataTypes> = PagePropsEagerDataTypes<T> | PagePropsLazyDataTypes<T>;
161
+ /**
162
+ * Record type representing all page props that can be passed to an Inertia page
163
+ * Maps prop names to their corresponding data types, including branded types for special behavior
164
+ */
165
+ export type PageProps = Record<string, PagePropsDataTypes | MergeableProp<UnPackedPageProps | DeferProp<UnPackedPageProps>>>;
166
+ /**
167
+ * Record type representing component props as they appear on the frontend after serialization
168
+ * Maps prop names to JSON-serializable values that components can consume directly
169
+ */
170
+ export type ComponentProps = Record<string, JSONDataTypes>;
171
+ /**
172
+ * Utility type to extract optional and deferred prop keys from a props object
173
+ * Identifies props that are not required and may not be present in the component
174
+ *
175
+ * @template Props - The page props object type to analyze
176
+ */
177
+ export type GetOptionalProps<Props> = {
178
+ [K in keyof Props]: Props[K] extends OptionalProp<any> ? K : Props[K] extends DeferProp<any> ? K : [undefined] extends Props[K] ? K : Props[K] extends MergeableProp<infer A> ? A extends DeferProp<any> ? K : never : never;
179
+ }[keyof Props];
180
+ /**
181
+ * Utility type to extract required prop keys from a props object
182
+ * Identifies props that are always present and required by the component
183
+ *
184
+ * @template Props - The page props object type to analyze
185
+ */
186
+ export type GetRequiredProps<Props> = {
187
+ [K in keyof Props]: Props[K] extends OptionalProp<any> ? never : Props[K] extends DeferProp<any> ? never : [undefined] extends Props[K] ? never : Props[K] extends MergeableProp<infer A> ? A extends DeferProp<any> ? never : K : K;
188
+ }[keyof Props];
189
+ /**
190
+ * Utility type to simplify value of a required prop by unwrapping branded types
191
+ * Extracts the actual value type from wrapped prop types like AlwaysProp, functions, etc.
192
+ *
193
+ * @template Value - The prop value type to unwrap
194
+ */
195
+ export type GetRequiredPropValue<Value> = Value extends AlwaysProp<infer A> ? UnpackProp<A> : Value extends MergeableProp<infer B> ? UnpackProp<B> : Value extends () => AsyncOrSync<infer C> ? UnpackProp<C> : UnpackProp<Value>;
196
+ /**
197
+ * Utility type to simplify value of an optional prop by unwrapping branded types
198
+ * Extracts the actual value type from wrapped optional prop types like DeferProp, OptionalProp, etc.
199
+ *
200
+ * @template Value - The optional prop value type to unwrap
201
+ */
202
+ export type GetOptionalPropValue<Value> = Value extends DeferProp<infer A> ? UnpackProp<A> : Value extends MergeableProp<infer B> ? B extends DeferProp<infer BA> ? UnpackProp<BA> : UnpackProp<B> : Value extends OptionalProp<infer C> ? UnpackProp<C> : Value extends () => AsyncOrSync<infer D> ? UnpackProp<D> : UnpackProp<Value>;
203
+ /**
204
+ * Converts the Page props to Component props that will be available to the frontend
205
+ * app after serialization. Maps server-side prop definitions to client-side prop types
206
+ *
207
+ * @template Props - The page props object with branded prop types
208
+ */
209
+ export type ToComponentProps<Props extends PageProps> = Prettify<{
210
+ [K in GetRequiredProps<Props>]: GetRequiredPropValue<Props[K]>;
211
+ } & {
212
+ [K in GetOptionalProps<Props>]?: GetOptionalPropValue<Props[K]>;
213
+ }>;
214
+ /**
215
+ * Converts the Component props to Page props to allow computing the same values
216
+ * via branded types and lazy evaluated callbacks and promises
217
+ * Maps client-side prop types back to server-side prop definitions
218
+ *
219
+ * @template Props - The component props object with JSON data types
220
+ */
221
+ export type AsPageProps<Props extends ComponentProps> = Prettify<{
222
+ [K in {
223
+ [O in keyof Props]: [undefined] extends [Props[O]] ? O : never;
224
+ }[keyof Props]]?: PagePropsDataTypes<Props[K]> | MergeableProp<UnPackedPageProps<Props[K]> | DeferProp<UnPackedPageProps<Props[K]>>>;
225
+ } & {
226
+ [K in {
227
+ [O in keyof Props]: [undefined] extends [Props[O]] ? never : O;
228
+ }[keyof Props]]: PagePropsEagerDataTypes<Props[K]> | MergeableProp<UnPackedPageProps<Props[K]>>;
229
+ }>;
230
+ /**
231
+ * Allowed values for the assets version used for cache busting
232
+ * Can be a string, number, or undefined for auto-detection
233
+ */
234
+ export type AssetsVersion = string | number | undefined;
235
+ /**
236
+ * Resolved configuration returned by the `defineConfig` helper
237
+ * Contains all settings needed to configure Inertia.js integration
238
+ */
239
+ export type InertiaConfig = {
240
+ /**
241
+ * Root Edge template to use for rendering the shell for the inertia
242
+ * application
243
+ */
244
+ rootView: string | ((ctx: HttpContext) => string);
245
+ /**
246
+ * A fixed asset version value to use. Otherwise, it will be read from the
247
+ * Vite manifest file.
248
+ */
249
+ assetsVersion?: AssetsVersion;
250
+ /**
251
+ * History encryption settings. https://inertiajs.com/history-encryption
252
+ */
253
+ encryptHistory: boolean;
254
+ /**
255
+ * Configuration settings for server-side rendering of the frontend
256
+ * app
257
+ */
258
+ ssr: {
259
+ /**
260
+ * Enable/disable the SSR. Disabled by default
261
+ */
262
+ enabled: boolean;
263
+ /**
264
+ * Cherry pick the pages you want to render server side
265
+ */
266
+ pages?: string[] | ((ctx: HttpContext, page: string) => AsyncOrSync<boolean>);
267
+ /**
268
+ * The entrypoint file to load in order to boot the frontend application on
269
+ * the server
270
+ */
271
+ entrypoint: string;
272
+ /**
273
+ * The SSR bundle output to load during production. This bundle is created
274
+ * using Vite
275
+ */
276
+ bundle: string;
277
+ };
278
+ };
279
+ /**
280
+ * Input configuration type allowing partial configuration objects
281
+ * Used when defining configuration where all properties are optional and can be deeply partial
282
+ */
283
+ export type InertiaConfigInput = DeepPartial<InertiaConfig>;
284
+ /**
285
+ * Represents a page object that is passed between server and client
286
+ *
287
+ * @template Props - The props type for the page component
288
+ */
289
+ export type PageObject<Props> = {
290
+ /**
291
+ * The name/path of the component to render
292
+ */
293
+ component: string;
294
+ /**
295
+ * Version identifier sent to the client with every request. Inertia
296
+ * will trigger a full page refresh (in case of version mis-match)
297
+ */
298
+ version: string | number;
299
+ /**
300
+ * Props data to pass to the component. These should be JSON values
301
+ */
302
+ props: Props;
303
+ /**
304
+ * Current URL of the page
305
+ */
306
+ url: string;
307
+ /**
308
+ * Grouped deferred props that can be loaded after the initial page
309
+ * load
310
+ */
311
+ deferredProps?: {
312
+ [group: string]: string[];
313
+ };
314
+ /**
315
+ * An array with the keys of props that should be merged with the
316
+ * existing props on the page
317
+ */
318
+ mergeProps?: string[];
319
+ /**
320
+ * An array with the keys of props that should be deeply merged with the
321
+ * existing props on the page
322
+ */
323
+ deepMergeProps?: string[];
324
+ /**
325
+ * Encrypt history flag to be sent to the client with every request.
326
+ */
327
+ encryptHistory?: boolean;
328
+ /**
329
+ * Optionally clear the browser history
330
+ */
331
+ clearHistory?: boolean;
332
+ };
333
+ /**
334
+ * The shared props inferred from the user-land
335
+ * Should be augmented in the host application to define globally available props
336
+ *
337
+ * @example
338
+ * ```typescript
339
+ * declare module '@adonisjs/inertia/types' {
340
+ * interface SharedProps {
341
+ * user: { id: number; name: string } | null
342
+ * flash: { success?: string; error?: string }
343
+ * }
344
+ * }
345
+ * ```
346
+ */
347
+ export interface SharedProps {
348
+ }
349
+ /**
350
+ * Discovered known pages with their props
351
+ * Should be augmented in the host application to define page-specific prop types
352
+ *
353
+ * @example
354
+ * ```typescript
355
+ * declare module '@adonisjs/inertia/types' {
356
+ * interface InertiaPages {
357
+ * 'users/index': { users: User[] }
358
+ * 'users/show': { user: User }
359
+ * }
360
+ * }
361
+ * ```
362
+ */
363
+ export interface InertiaPages {
364
+ }
365
+ /**
366
+ * Function signature for the SSR render method that should be exported
367
+ * from the SSR entrypoint file to render Inertia pages on the server
368
+ *
369
+ * @param page - The page object containing component and props data
370
+ * @returns Promise resolving to an object with head tags and body HTML
371
+ */
372
+ export type RenderInertiaSsrApp = (page: PageObject<any>) => Promise<{
373
+ head: string[];
374
+ body: string;
375
+ }>;
376
+ /**
377
+ * Type helper to infer the return type of InertiaMiddleware.share method
378
+ * and augment the SharedProps interface automatically
379
+ *
380
+ * @template T - The middleware class type that extends BaseInertiaMiddleware
381
+ *
382
+ * @example
383
+ * ```typescript
384
+ * class InertiaMiddleware extends BaseInertiaMiddleware {
385
+ * async share() {
386
+ * return {
387
+ * user: { id: 1, name: 'John' },
388
+ * flash: { success: 'Welcome!' }
389
+ * }
390
+ * }
391
+ * }
392
+ *
393
+ * // Automatically infer and augment SharedProps
394
+ * type InferredSharedProps = InferSharedProps<InertiaMiddleware>
395
+ * ```
396
+ */
397
+ export type InferSharedProps<T> = T extends {
398
+ share(...args: any[]): infer R;
399
+ } ? Awaited<R> extends PageProps ? ToComponentProps<Awaited<R>> : never : never;
400
+ export {};
@@ -0,0 +1,35 @@
1
+ import { type InlineConfig } from 'vite';
2
+ import type { Test } from '@japa/runner/core';
3
+ import { type ProviderNode } from '@adonisjs/core/types/app';
4
+ import { type ApplicationService } from '@adonisjs/core/types';
5
+ import { Vite } from '@adonisjs/vite';
6
+ import { type IncomingMessage, type ServerResponse } from 'node:http';
7
+ export declare const BASE_URL: import("url").URL;
8
+ /**
9
+ * Create a http server that will be closed automatically
10
+ * when the test ends
11
+ */
12
+ export declare const httpServer: {
13
+ create: (callback: (req: IncomingMessage, res: ServerResponse) => any) => import("http").Server<typeof IncomingMessage, typeof ServerResponse>;
14
+ };
15
+ /**
16
+ * Mock the `view` macro on HttpContext to return a fake
17
+ */
18
+ export declare function setupViewMacroMock(): void;
19
+ /**
20
+ * Runs a japa test in isolation
21
+ */
22
+ export declare function runJapaTest(app: ApplicationService, callback: Parameters<Test['run']>[0]): Promise<void>;
23
+ /**
24
+ * Spin up a Vite server for the test
25
+ */
26
+ export declare const setupVite: (options: InlineConfig) => Promise<Vite>;
27
+ /**
28
+ * Setup an AdonisJS app for testing
29
+ */
30
+ export declare function setupApp(providers?: ProviderNode[]): Promise<{
31
+ ace: import("@adonisjs/core/ace").Kernel;
32
+ app: ApplicationService;
33
+ ignitor: import("@adonisjs/core").Ignitor;
34
+ }>;
35
+ export declare const setupFakeAdonisProject: () => Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,65 @@
1
+ declare const routes: {
2
+ readonly 'users.index': {
3
+ readonly methods: ["GET", "HEAD"];
4
+ readonly pattern: "/";
5
+ readonly tokens: [{
6
+ readonly old: "/";
7
+ readonly type: 0;
8
+ readonly val: "/";
9
+ readonly end: "";
10
+ }];
11
+ readonly types: {
12
+ body: {};
13
+ paramsTuple: [];
14
+ params: {};
15
+ query: {};
16
+ response: unknown;
17
+ };
18
+ };
19
+ readonly 'users.comments.edit': {
20
+ readonly methods: ["GET", "HEAD"];
21
+ readonly pattern: "/users/:id/comments/:comment_id/edit";
22
+ readonly tokens: [{
23
+ readonly old: "/users";
24
+ readonly type: 0;
25
+ readonly val: "users";
26
+ readonly end: "/";
27
+ }, {
28
+ readonly old: ":id";
29
+ readonly type: 1;
30
+ readonly val: "id";
31
+ readonly end: "/";
32
+ }, {
33
+ readonly old: "/comments";
34
+ readonly type: 0;
35
+ readonly val: "comments";
36
+ readonly end: "/";
37
+ }, {
38
+ readonly old: ":comment_id";
39
+ readonly type: 1;
40
+ readonly val: "comment_id";
41
+ readonly end: "/edit";
42
+ }, {
43
+ readonly old: "/edit";
44
+ readonly type: 0;
45
+ readonly val: "edit";
46
+ readonly end: "";
47
+ }];
48
+ readonly types: {
49
+ body: {};
50
+ paramsTuple: [string, string];
51
+ params: {
52
+ id: string;
53
+ comment_id: string;
54
+ };
55
+ query: {};
56
+ response: unknown;
57
+ };
58
+ };
59
+ };
60
+ declare module '@tuyau/core/types' {
61
+ type Registry = typeof routes;
62
+ interface UserRegistry extends Registry {
63
+ }
64
+ }
65
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};