@adonisjs/inertia 4.0.0 → 4.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.
@@ -25,7 +25,7 @@ const indexPages = function(config) {
25
25
  if (!SUPPORTED_FRAMEWORKS.includes(config.framework)) throw new Error(`Unsupported framework "${config.framework}". Types generation is available only for ${SUPPORTED_FRAMEWORKS.join(",")}`);
26
26
  return { run(_, __, indexGenerator) {
27
27
  indexGenerator.add("inertiaPages", {
28
- source: "inertia/pages",
28
+ source: config.source ?? "inertia/pages",
29
29
  glob: GLOB[config.framework],
30
30
  output: ".adonisjs/server/pages.d.ts",
31
31
  as(vfs, buffer, ___, helpers) {
@@ -1,7 +1,7 @@
1
- import { n as ServerRenderer, r as Inertia } from "../inertia_manager-Ra2dhBKa.js";
1
+ import { n as ServerRenderer, r as Inertia } from "../inertia_manager-BGHA4cDP.js";
2
2
  import { t as InertiaHeaders } from "../headers-DafWEpBh.js";
3
3
  import "../debug-CBMTuPUm.js";
4
- import { t as defineConfig } from "../define_config-O1Y9QfzM.js";
4
+ import { t as defineConfig } from "../define_config-Du2hAFGX.js";
5
5
  import "../index.js";
6
6
  import { HttpContextFactory } from "@adonisjs/core/factories/http";
7
7
  var InertiaFactory = class {
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { i as symbols_exports, n as ServerRenderer, r as Inertia, t as InertiaManager } from "./inertia_manager-Ra2dhBKa.js";
1
+ import { i as symbols_exports, n as ServerRenderer, r as Inertia, t as InertiaManager } from "./inertia_manager-BGHA4cDP.js";
2
2
  import { t as InertiaHeaders } from "./headers-DafWEpBh.js";
3
3
  import "./debug-CBMTuPUm.js";
4
- import { n as indexPages, t as defineConfig } from "./define_config-O1Y9QfzM.js";
4
+ import { n as indexPages, t as defineConfig } from "./define_config-Du2hAFGX.js";
5
5
  export { Inertia, InertiaHeaders, InertiaManager, ServerRenderer, defineConfig, indexPages, symbols_exports as symbols };
@@ -369,6 +369,7 @@ var Inertia = class {
369
369
  };
370
370
  var ServerRenderer = class {
371
371
  #runtime;
372
+ #ssrEnvironment;
372
373
  #config;
373
374
  #vite;
374
375
  constructor(config, vite) {
@@ -377,8 +378,15 @@ var ServerRenderer = class {
377
378
  }
378
379
  async render(pageObject) {
379
380
  let render;
380
- if (this.#vite.getDevServer()) {
381
+ const devServer = this.#vite.getDevServer();
382
+ if (devServer) {
381
383
  debug_default("creating SSR bundle using dev-server");
384
+ const currentSsrEnv = devServer.environments.ssr;
385
+ if (this.#ssrEnvironment !== currentSsrEnv) {
386
+ if (this.#runtime) await this.#runtime.close();
387
+ this.#runtime = void 0;
388
+ this.#ssrEnvironment = currentSsrEnv;
389
+ }
382
390
  this.#runtime ??= await this.#vite.createModuleRunner();
383
391
  this.#runtime.clearCache();
384
392
  render = await this.#runtime.import(this.#config.ssr.entrypoint);
@@ -1,4 +1,4 @@
1
- import { t as InertiaManager } from "../inertia_manager-Ra2dhBKa.js";
1
+ import { t as InertiaManager } from "../inertia_manager-BGHA4cDP.js";
2
2
  import "../headers-DafWEpBh.js";
3
3
  import "../debug-CBMTuPUm.js";
4
4
  import { BriskRoute } from "@adonisjs/core/http";
@@ -8,19 +8,19 @@ export type FormParams<Route extends keyof Routes> = RouteParams<Route>;
8
8
  /**
9
9
  * Props for the Form component when using route-based navigation
10
10
  */
11
- type FormRouteProps<Route extends keyof Routes> = Omit<React.ComponentPropsWithoutRef<typeof InertiaForm>, 'action' | 'method'> & FormParams<Route> & {
11
+ export type FormRouteProps<Route extends keyof Routes> = Omit<React.ComponentPropsWithoutRef<typeof InertiaForm>, 'action' | 'method'> & FormParams<Route> & {
12
12
  action?: never;
13
13
  };
14
14
  /**
15
15
  * Props for the Form component when using direct action
16
16
  */
17
- type FormActionProps = Omit<React.ComponentPropsWithoutRef<typeof InertiaForm>, 'route'> & {
17
+ export type FormActionProps = Omit<React.ComponentPropsWithoutRef<typeof InertiaForm>, 'route'> & {
18
18
  route?: never;
19
19
  };
20
20
  /**
21
21
  * Union type for Form component props - either route-based or direct action
22
22
  */
23
- type FormProps<Route extends keyof Routes = keyof Routes> = FormRouteProps<Route> | FormActionProps;
23
+ export type FormProps<Route extends keyof Routes = keyof Routes> = FormRouteProps<Route> | FormActionProps;
24
24
  /**
25
25
  * Internal Form component implementation with forward ref support.
26
26
  * Resolves route parameters and generates the appropriate URL and HTTP method
@@ -8,19 +8,19 @@ export type LinkParams<Route extends keyof Routes> = RouteParams<Route>;
8
8
  /**
9
9
  * Props for the Link component when using route-based navigation
10
10
  */
11
- type LinkRouteProps<Route extends keyof Routes> = Omit<React.ComponentPropsWithoutRef<typeof InertiaLink>, 'href' | 'method'> & LinkParams<Route> & {
11
+ export type LinkRouteProps<Route extends keyof Routes> = Omit<React.ComponentPropsWithoutRef<typeof InertiaLink>, 'href' | 'method'> & LinkParams<Route> & {
12
12
  href?: never;
13
13
  };
14
14
  /**
15
15
  * Props for the Link component when using direct href
16
16
  */
17
- type LinkHrefProps = Omit<React.ComponentPropsWithoutRef<typeof InertiaLink>, 'route'> & {
17
+ export type LinkHrefProps = Omit<React.ComponentPropsWithoutRef<typeof InertiaLink>, 'route'> & {
18
18
  route?: never;
19
19
  };
20
20
  /**
21
21
  * Union type for Link component props - either route-based or direct href
22
22
  */
23
- type LinkProps<Route extends keyof Routes = keyof Routes> = LinkRouteProps<Route> | LinkHrefProps;
23
+ export type LinkProps<Route extends keyof Routes = keyof Routes> = LinkRouteProps<Route> | LinkHrefProps;
24
24
  /**
25
25
  * Internal Link component implementation with forward ref support.
26
26
  * Resolves route parameters and generates the appropriate URL and HTTP method
@@ -1,9 +1,9 @@
1
1
  import type { PropType, SlotsType } from 'vue';
2
2
  import { Form as InertiaForm } from '@inertiajs/vue3';
3
3
  import type { RouteParams, RouteParamsFormats, Routes } from '../common.ts';
4
- type InertiaFormSlots = InstanceType<typeof InertiaForm>['$slots'];
5
- type InertiaFormDefaultSlot = InertiaFormSlots['default'];
6
- type InertiaFormSlotProps = InertiaFormDefaultSlot extends (...args: any[]) => any ? Parameters<InertiaFormDefaultSlot>[0] : never;
4
+ export type InertiaFormSlots = InstanceType<typeof InertiaForm>['$slots'];
5
+ export type InertiaFormDefaultSlot = InertiaFormSlots['default'];
6
+ export type InertiaFormSlotProps = InertiaFormDefaultSlot extends (...args: any[]) => any ? Parameters<InertiaFormDefaultSlot>[0] : never;
7
7
  /**
8
8
  * Parameters required for route navigation with proper type safety.
9
9
  */
@@ -66,4 +66,3 @@ export declare const Form: import("vue").DefineComponent<import("vue").ExtractPr
66
66
  }>> & Readonly<{}>, {}, SlotsType<{
67
67
  default: InertiaFormSlotProps;
68
68
  }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
69
- export {};
@@ -7,6 +7,7 @@
7
7
  *
8
8
  * @param config - Configuration object specifying the frontend framework
9
9
  * @param config.framework - The frontend framework ('vue3' or 'react')
10
+ * @param config.source - The path to Inertia pages (default: inertia/pages)
10
11
  * @returns Assembler hook object with run method for generating page types
11
12
  *
12
13
  * @example
@@ -21,6 +22,7 @@
21
22
  */
22
23
  export declare const indexPages: (config: {
23
24
  framework: "vue3" | "react";
25
+ source?: string;
24
26
  }) => {
25
27
  /**
26
28
  * Executes the page indexing process to generate TypeScript definitions.
@@ -1,4 +1,4 @@
1
- import { t as InertiaManager } from "../inertia_manager-Ra2dhBKa.js";
1
+ import { t as InertiaManager } from "../inertia_manager-BGHA4cDP.js";
2
2
  import { t as InertiaHeaders } from "../headers-DafWEpBh.js";
3
3
  import { t as debug_default } from "../debug-CBMTuPUm.js";
4
4
  const MUTATION_METHODS = [
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",
4
+ "version": "4.1.1",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },