chore(frontend): remove custom Webpack sqlite-wasm integration plugins and cleanup config

- Deleted `dummy.js` and its usage for sqlite-wasm integration as custom Webpack adjustments are no longer necessary.
- Removed outdated Webpack configuration files: `ignore-sqlite-wasm.js`, `ignore-sqlite-wasm-critical-dependency.js`, and `sqljs-fix.js`.
- Introduced `sqlite-config.js` for simplified and streamlined sqlite-wasm and Skiko Webpack configuration.
- Minor code formatting adjustments across frontend modules for improved consistency.
This commit is contained in:
2026-01-26 20:37:23 +01:00
parent 29ad73b508
commit 3e587381ed
30 changed files with 1535 additions and 941 deletions
@@ -11,7 +11,7 @@ import org.koin.core.qualifier.named
import org.koin.dsl.module
/**
* Simple token provider interface so core network module does not depend on auth-feature.
* Simple token provider interface so the core network module does not depend on auth-feature.
*/
interface TokenProvider {
fun getAccessToken(): String?
@@ -41,7 +41,11 @@ val networkModule = module {
// 2. API Client (Configured for Gateway & Auth Header)
single(named("apiClient")) {
val tokenProvider: TokenProvider? = try { get<TokenProvider>() } catch (_: Throwable) { null }
val tokenProvider: TokenProvider? = try {
get<TokenProvider>()
} catch (_: Throwable) {
null
}
HttpClient {
// JSON (kotlinx) configuration
install(ContentNegotiation) {
@@ -79,7 +83,7 @@ val networkModule = module {
// Inject Authorization header if token is present
val token = tokenProvider?.getAccessToken()
if (token != null) {
header("Authorization", "Bearer $token")
header("Authorization", "Bearer $token")
}
}
@@ -13,9 +13,9 @@ actual object PlatformConfig {
// In Wasm, we can access a window directly if we are in the browser main thread.
// However, we need to be careful about exceptions.
val origin = try {
window.location.origin
window.location.origin
} catch (e: Throwable) {
null
null
}
if (!origin.isNullOrBlank()) return origin.removeSuffix("/")
@@ -28,9 +28,11 @@ actual object PlatformConfig {
// Helper function for JS interop in Wasm
// Kotlin/Wasm does not support 'dynamic' type or complex js() blocks inside functions.
// We must use top-level external functions or simple js() expressions.
private fun getGlobalApiBaseUrl(): String = js("""
private fun getGlobalApiBaseUrl(): String = js(
"""
(function() {
var global = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {}));
return (global.API_BASE_URL && typeof global.API_BASE_URL === 'string') ? global.API_BASE_URL : "";
})()
""")
"""
)