收窄仅限本文件使用的类型导出
导出符号审计发现 7 个类型仅在定义文件内使用却带着 export: AppState、CarrierSlot、FormattedBytes、LatencyBucket、 LiveTransportHandlers、LiveTransportOptions、NodeLatencyStats。 去掉 export 关键字,行为无变化。
This commit is contained in:
1 parent
9504733114
commit
ce0fe626b2
5 files changed
+7
-7
No files matched your search
@@ -32,7 +32,7 @@ const defaultConfig: Config = { ...demoViewConfig, site_description: "", site_na
|
||||
|
||||
type Access = "ok" | "login" | "turnstile";
|
||||
|
||||
export interface AppState {
|
||||
interface AppState {
|
||||
config: Config;
|
||||
configReady: boolean;
|
||||
servers: Server[];
|
||||
|
||||
@@ -10,7 +10,7 @@ export function percent(used: number | null, total: number | null) {
|
||||
return safeTotal > 0 ? Math.min(100, Math.max(0, (number(used) / safeTotal) * 100)) : 0;
|
||||
}
|
||||
|
||||
export interface FormattedBytes {
|
||||
interface FormattedBytes {
|
||||
value: string;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface CarrierLatencyRow {
|
||||
lossBars: LatencyBar[];
|
||||
}
|
||||
|
||||
export interface NodeLatencyStats {
|
||||
interface NodeLatencyStats {
|
||||
latencyDisplay: string;
|
||||
lossDisplay: string;
|
||||
latencyBars: LatencyBar[];
|
||||
|
||||
@@ -24,7 +24,7 @@ export const CARRIER_SLOTS = [
|
||||
{ key: "unicom" as const, label: "联通", labelEn: "Unicom", color: "#60a5fa", aliases: ["联通", "chinaunicom", "unicom", "cucc", "cu"] },
|
||||
] as const;
|
||||
|
||||
export type CarrierSlot = typeof CARRIER_SLOTS[number];
|
||||
type CarrierSlot = typeof CARRIER_SLOTS[number];
|
||||
|
||||
function latencyTone(value: number): LatencyTone {
|
||||
if (value <= 60) return "good";
|
||||
@@ -97,7 +97,7 @@ export function selectCarrierTasks(
|
||||
return selected;
|
||||
}
|
||||
|
||||
export interface LatencyBucket {
|
||||
interface LatencyBucket {
|
||||
timestamp: number;
|
||||
latency: number | null;
|
||||
loss: number | null;
|
||||
|
||||
@@ -40,12 +40,12 @@ export function reconnectDelay(attempt: number, randomValue = Math.random()) {
|
||||
return Math.min(RECONNECT_MAX_DELAY, Math.round(jitteredDelay));
|
||||
}
|
||||
|
||||
export interface LiveTransportHandlers {
|
||||
interface LiveTransportHandlers {
|
||||
onBatch: (updates: BatchUpdate[]) => void;
|
||||
onConnectedChange: (connected: boolean) => void;
|
||||
}
|
||||
|
||||
export interface LiveTransportOptions {
|
||||
interface LiveTransportOptions {
|
||||
serverId: string | null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user