From d92a0331a6552c95cf578c6a07952b40ba41c1b2 Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Tue, 7 Jul 2026 17:04:34 -0400 Subject: [PATCH] refactor: console messages Signed-off-by: Sebastian Krupinski --- core/src/utils/modules.ts | 45 ++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/core/src/utils/modules.ts b/core/src/utils/modules.ts index 2c708a3..98c5ec5 100644 --- a/core/src/utils/modules.ts +++ b/core/src/utils/modules.ts @@ -15,10 +15,10 @@ function installModuleCSS(moduleHandle: string, cssPaths: string | string[]): vo link.rel = 'stylesheet'; link.href = cssPath; link.onload = () => { - console.log(`Module Loader - Loaded CSS for ${moduleHandle}: ${cssFile}`); + console.log(`[Core][Module Loader] - Loaded CSS for ${moduleHandle}: ${cssFile}`); }; link.onerror = () => { - console.error(`Module Loader - Failed to load CSS for ${moduleHandle}: ${cssPath}`); + console.error(`[Core][Module Loader] - Failed to load CSS for ${moduleHandle}: ${cssPath}`); }; document.head.appendChild(link); } @@ -73,47 +73,48 @@ export async function initializeModules(app: App): Promise { for (const [moduleId, moduleInfo] of Object.entries(availableModules)) { if (!moduleInfo) { - console.warn(`Module ${moduleId} has no configuration, skipping`); + console.warn(`[Core][Module Loader] - Module ${moduleId} has no configuration, skipping`); continue; } if (moduleInfo.handle && moduleInfo.boot && !moduleInfo.booted) { const moduleHandle = moduleInfo.handle; const moduleUrl = `/modules/${moduleInfo.handle}/${moduleInfo.boot}`; - console.log(`Module Loader - Loading ${moduleInfo.handle} from ${moduleUrl}`); + console.log(`[Core][Module Loader] - Loading ${moduleInfo.handle} from ${moduleUrl}`); const loadPromise = import(/* @vite-ignore */ moduleUrl) .then(async (module) => { + // install module + if (module.default && typeof module.default.install === 'function') { + console.log(`[Core][Module Loader] - Installing ${moduleInfo.handle}`); + app.use(module.default); + } + // prefix routes with /m/{moduleHandle} + if (module.routes) { + console.log(`[Core][Module Loader] - Installing Routes ${moduleInfo.handle}`); + installModuleRoutes(moduleHandle, module.routes); + } + // register integrations + if (module.integrations) { + console.log(`[Core][Module Loader] - Installing Integrations ${moduleInfo.handle}`); + installModuleIntegrations(moduleHandle, module.integrations); + } // Load CSS if module explicitly exports css path(s) if (module.css) { + console.log(`[Core][Module Loader] - Installing CSS ${moduleInfo.handle}`); installModuleCSS(moduleInfo.handle, module.css); } // Load translation catalogs if module explicitly exports l10n flag if (module.l10n) { - console.log(`Module Loader - Installing Catalogs ${moduleInfo.handle}`); + console.log(`[Core][Module Loader] - Installing Localizations ${moduleInfo.handle}`); await installModuleLocalizations(moduleHandle); } - // install module - console.log(`Module Loader - Installing ${moduleInfo.handle}`); - if (module.default && typeof module.default.install === 'function') { - app.use(module.default); - } - // prefix routes with /m/{moduleHandle} - console.log(`Module Loader - Installing Routes ${moduleInfo.handle}`); - if (module.routes) { - installModuleRoutes(moduleHandle, module.routes); - } - // register integrations - console.log(`Module Loader - Installing Integrations ${moduleInfo.handle}`); - if (module.integrations) { - installModuleIntegrations(moduleHandle, module.integrations); - } }) .catch((error) => { - console.error(`Failed to load module ${moduleId} from ${moduleUrl}:`, error); + console.error(`[Core][Module Loader] - Failed to load module ${moduleId} from ${moduleUrl}:`, error); }); loadPromises.push(loadPromise); } else if (!moduleInfo.boot) { - console.warn(`No boot path specified for module: ${moduleId}`); + console.warn(`[Core][Module Loader] - No boot path specified for module: ${moduleId}`); } }