var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
    if (typeof path === "string" && /^\.\.?\//.test(path)) {
        return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
            return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
        });
    }
    return path;
};
import { Ignitor, prettyPrintError } from '@adonisjs/core';
import { fsImportAll } from '@adonisjs/core/helpers';
import 'reflect-metadata';
export const makeApp = (appRoot, booter) => {
    const importer = (filePath) => {
        if (filePath.startsWith('./') || filePath.startsWith('../'))
            return import(__rewriteRelativeImportExtension(new URL(filePath, appRoot).href));
        else
            return import(__rewriteRelativeImportExtension(filePath));
    };
    const app = new Ignitor(appRoot, { importer }).tap((app) => {
        app.booting(async () => {
            await import(__rewriteRelativeImportExtension(new URL('start/env.js', appRoot).href));
            const libConfigDir = new URL('./config', import.meta.url);
            const appConfigDir = app.configPath();
            app.useConfig({
                ...(await fsImportAll(libConfigDir)),
                ...(await fsImportAll(appConfigDir)),
            });
        });
        app.listen('SIGTERM', () => app.terminate());
        app.listen('SIGINT', () => app.terminate());
    });
    const booted = booter(app);
    booted.catch((error) => {
        process.exitCode = 1;
        prettyPrintError(error);
    });
};
export const providers = [
    () => import('@rlanz/sentry/provider'),
    () => import('@adonisjs/core/providers/app_provider'),
    () => import('@adonisjs/core/providers/hash_provider'),
    {
        file: () => import('@adonisjs/core/providers/repl_provider'),
        environment: ['repl', 'test'],
    },
    () => import('@adonisjs/core/providers/vinejs_provider'),
    () => import('@adonisjs/cors/cors_provider'),
    () => import('@adonisjs/lucid/database_provider'),
    () => import('@adonisjs/auth/auth_provider'),
    () => import('./modules/auth/jwt/jwt_provider.js'),
    () => import('./modules/auth/auth_context/provider.js'),
    () => import('./modules/insee/insee_provider.js'),
    () => import('./modules/opendata/opendata_city_provider.js'),
    () => import('./modules/email/email_provider.js'),
    () => import('./modules/push_notifications/provider.js'),
    () => import('./modules/events/event_service_provider.js'),
    () => import('./modules/auth/auth_provider.js'),
    () => import('./modules/openapi/openapi_provider.js'),
    () => import('@akago/adonisjs-drhttp/provider'),
    () => import('@akago/adonisjs-pg-boss/provider'),
    () => import('@adonisjs/mail/mail_provider'),
    () => import('@adonisjs/core/providers/edge_provider'),
    () => import('@adonisjs/drive/drive_provider'),
    () => import('@jrmc/adonis-attachment/attachment_provider'),
    () => import('./modules/attachment/attachment_patch_provider.js'),
    () => import('@adonisjs/limiter/limiter_provider'),
    () => import('@adonisjs/static/static_provider'),
    () => import('@akago/vine-lucid/vine_lucid_provider'),
];
export const preloads = [
    () => import('./kernel.js'),
    () => import('./routes.js'),
];
//# sourceMappingURL=app.js.map