UNPKG

@adonisjs/inertia

Version:

Official Inertia.js adapter for AdonisJS

29 lines (28 loc) 939 B
import { t as InertiaManager } from "../inertia_manager-BGHA4cDP.js"; import "../headers-DafWEpBh.js"; import "../debug-CBMTuPUm.js"; import { BriskRoute } from "@adonisjs/core/http"; var InertiaProvider = class { constructor(app) { this.app = app; } async registerEdgePlugin() { const edgeExports = await import("edge.js"); const { edgePluginInertia } = await import("../src/plugins/edge/plugin.js"); edgeExports.default.use(edgePluginInertia()); } async register() { this.app.container.singleton(InertiaManager, async (resolver) => { return new InertiaManager(this.app.config.get("inertia", {}), await resolver.make("vite")); }); } async boot() { await this.registerEdgePlugin(); BriskRoute.macro("renderInertia", function(template, props, viewProps) { return this.setHandler(({ inertia }) => { return inertia.render(template, props, viewProps); }); }); } }; export { InertiaProvider as default };