import type { App } from 'vue' import type { ModulePlugin } from '@/core/types' import { container, SERVICE_TOKENS } from '@/core/di-container' import { relayHub } from './nostr/relay-hub' import { nostrclientHub } from './nostr/nostrclient-hub' // Import auth services import { auth } from './auth/auth-service' // Import PWA services import { pwaService } from './pwa/pwa-service' /** * Base Module Plugin * Provides core infrastructure: Nostr, Auth, PWA, and UI components */ export const baseModule: ModulePlugin = { name: 'base', version: '1.0.0', async install(_app: App, options?: any) { console.log('🔧 Installing base module...') // Register core Nostr services container.provide(SERVICE_TOKENS.RELAY_HUB, relayHub) container.provide(SERVICE_TOKENS.NOSTR_CLIENT_HUB, nostrclientHub) // Register auth service container.provide(SERVICE_TOKENS.AUTH_SERVICE, auth) // Register PWA service container.provide('pwaService', pwaService) // Initialize core services await relayHub.initialize(options?.config?.nostr?.relays || []) await auth.initialize() console.log('✅ Base module installed successfully') }, async uninstall() { console.log('🗑️ Uninstalling base module...') // Cleanup Nostr connections relayHub.disconnect() nostrclientHub.disconnect?.() console.log('✅ Base module uninstalled') }, services: { relayHub, nostrclientHub, auth, pwaService }, // No routes - base module is pure infrastructure routes: [], // No UI components at module level - they'll be imported as needed components: {} } export default baseModule