refactor(lib_commands): drop super::* + glob re-export in ui + cache

Hotspot G first slice — replace the cascade-import pattern in
lib_commands/ui/ and lib_commands/cache/ with explicit per-symbol
imports + per-command re-exports.

ui/mod.rs no longer reaches `pub(crate) use mini::*; pub(crate) use
bandsintown::*;` — instead it explicitly re-exports the 8 mini-player
Tauri commands + the 3 internal helpers consumed by lib.rs +
sync/tray.rs (PAUSE_RENDERING_JS, RESUME_RENDERING_JS,
persist_mini_pos_throttled), and fetch_bandsintown_events.

cache/mod.rs likewise lists each Tauri command from offline / hot /
downloads explicitly. The only cross-crate "internal" re-export is
`enqueue_analysis_seed` which analysis_runtime depends on.

Inside the .rs files: every `use super::*` is replaced with the
specific imports actually needed (super::offline::..., crate::audio,
crate::analysis_runtime::..., tauri::Manager, etc.).

Behaviour-preserving — no Tauri command name changed, no runtime
behaviour shift. Just removes the leak-everything-everywhere import
graph that cucadmuh's policy doc forbids.
This commit is contained in:
Psychotoxical
2026-05-08 16:18:51 +02:00
parent f43ab94cc1
commit 409d8fa964
6 changed files with 41 additions and 13 deletions
+3 -1
View File
@@ -1,4 +1,6 @@
use super::*; use tauri::{Emitter, Manager};
use crate::subsonic_wire_user_agent;
pub(crate) fn resolve_hot_cache_root( pub(crate) fn resolve_hot_cache_root(
custom_dir: Option<String>, custom_dir: Option<String>,
+6 -1
View File
@@ -1,4 +1,9 @@
use super::*; use crate::audio;
use crate::subsonic_wire_user_agent;
use super::super::file_transfer::stream_to_file;
use super::downloads::{resolve_hot_cache_root, HotCacheDownloadResult};
use super::offline::{enqueue_analysis_seed, enqueue_analysis_seed_from_file};
#[tauri::command] #[tauri::command]
pub(crate) async fn download_track_hot_cache( pub(crate) async fn download_track_hot_cache(
+14 -5
View File
@@ -1,10 +1,19 @@
use super::*;
mod fs_utils; mod fs_utils;
mod offline; mod offline;
mod downloads; mod downloads;
mod hot; mod hot;
pub(crate) use offline::*; // Tauri commands re-exported for the lib.rs invoke_handler:
pub(crate) use downloads::*; pub(crate) use offline::{
pub(crate) use hot::*; delete_offline_track, download_track_offline, get_offline_cache_size,
};
pub(crate) use hot::{
delete_hot_cache_track, download_track_hot_cache, get_hot_cache_size,
promote_stream_cache_to_hot_cache, purge_hot_cache,
};
pub(crate) use downloads::{
check_arch_linux, download_update, download_zip, fetch_netease_lyrics, get_embedded_lyrics,
open_folder,
};
// Internal helper consumed by analysis_runtime (used as analysis_runtime depends on it):
pub(crate) use offline::enqueue_analysis_seed;
+7 -1
View File
@@ -1,4 +1,10 @@
use super::*; use tauri::Manager;
use crate::analysis_cache;
use crate::analysis_runtime::{analysis_backfill_is_current_track, submit_analysis_cpu_seed};
use crate::DownloadSemaphore;
use super::super::file_transfer::{finalize_streamed_download, subsonic_http_client};
// ─── Offline Track Cache ────────────────────────────────────────────────────── // ─── Offline Track Cache ──────────────────────────────────────────────────────
+5 -1
View File
@@ -1,4 +1,8 @@
use super::*; use std::sync::{Mutex, OnceLock};
use tauri::Manager;
use crate::lib_commands::sync::is_tiling_wm;
// ── Mini Player window ────────────────────────────────────────────────────── // ── Mini Player window ──────────────────────────────────────────────────────
// Secondary always-on-top window with minimal playback controls. Uses the // Secondary always-on-top window with minimal playback controls. Uses the
+6 -4
View File
@@ -1,7 +1,9 @@
use super::*;
mod mini; mod mini;
mod bandsintown; mod bandsintown;
pub(crate) use mini::*; pub(crate) use mini::{
pub(crate) use bandsintown::*; close_mini_player, open_mini_player, pause_rendering, persist_mini_pos_throttled,
preload_mini_player, resize_mini_player, resume_rendering, set_mini_player_always_on_top,
show_main_window, PAUSE_RENDERING_JS, RESUME_RENDERING_JS,
};
pub(crate) use bandsintown::fetch_bandsintown_events;