import { type Edge } from 'edge.js'; import type { ApplicationService } from '../src/types.ts'; import { type Route } from '../modules/http/main.ts'; declare module '@adonisjs/core/http' { interface HttpContext { /** * Reference to the edge renderer to render templates * during an HTTP request */ view: ReturnType; } interface BriskRoute { /** * Render an edge template without defining an * explicit route handler */ render(template: string, data?: Record): Route; } } /** * The Edge service provider configures Edge to work within * an AdonisJS application environment * * This provider integrates EdgeJS template engine with AdonisJS by: * - Mounting the views directory * - Configuring template caching for production * - Adding global helpers for route generation * - Creating isolated renderer instances for HTTP contexts * - Adding render macro to BriskRoute for template rendering * * @example * const provider = new EdgeServiceProvider(app) * await provider.boot() */ export default class EdgeServiceProvider { protected app: ApplicationService; /** * Edge service provider constructor * * Sets the usingEdgeJS flag to true to indicate EdgeJS is being used. * * @param app - The application service instance */ constructor(app: ApplicationService); /** * Bridge AdonisJS and Edge * * Configures EdgeJS integration by: * - Setting up template mounting and caching * - Defining global helpers (route, signedRoute, app, config) * - Adding view getter to HttpContext for isolated rendering * - Adding render macro to BriskRoute * - Registering dumper plugin * * @example * await provider.boot() * // Now edge templates can use {{ route('home') }} helper */ boot(): Promise; }