Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

refactor(app): unexport file-local values and drop unused ones

Hampus4d2ebdbd5cee
diff --git a/fluxer_app/scripts/build/Config.tsx b/fluxer_app/scripts/build/Config.tsx
index d836e0146..b44e8866d 100644
--- a/fluxer_app/scripts/build/Config.tsx
+++ b/fluxer_app/scripts/build/Config.tsx
@@ -2,6 +2,6 @@
import * as path from 'node:path';
-export const ROOT_DIR = path.resolve(import.meta.dirname, '..', '..');
+const ROOT_DIR = path.resolve(import.meta.dirname, '..', '..');
export const SRC_DIR = path.join(ROOT_DIR, 'src');
export const DIST_DIR = path.join(ROOT_DIR, 'dist');
diff --git a/fluxer_app/scripts/build/rspack/static-files.mjs b/fluxer_app/scripts/build/rspack/static-files.mjs
index 099b43bb2..a6dc5df4c 100644
--- a/fluxer_app/scripts/build/rspack/static-files.mjs
+++ b/fluxer_app/scripts/build/rspack/static-files.mjs
@@ -97,7 +97,7 @@ function generateRobotsTxt() {
return 'User-agent: *\nAllow: /\n';
}
-export class StaticFilesPlugin {
+class StaticFilesPlugin {
constructor(options = {}) {
this.staticCdnEndpoint = options.staticCdnEndpoint;
this.fontsDir = options.fontsDir;
diff --git a/fluxer_app/src/app/AbortSignalPolyfill.ts b/fluxer_app/src/app/AbortSignalPolyfill.ts
index ec2a9e28e..71d35d5dd 100644
--- a/fluxer_app/src/app/AbortSignalPolyfill.ts
+++ b/fluxer_app/src/app/AbortSignalPolyfill.ts
@@ -20,7 +20,7 @@ function abortSignalAny(signals: Iterable<AbortSignal>): AbortSignal {
return controller.signal;
}
-export function installAbortSignalPolyfill(target: typeof AbortSignal = AbortSignal): void {
+function installAbortSignalPolyfill(target: typeof AbortSignal = AbortSignal): void {
if (typeof target.timeout !== 'function') {
target.timeout = abortSignalTimeout;
}
diff --git a/fluxer_app/src/features/channel/events/ChannelUpdateBulk.ts b/fluxer_app/src/features/channel/events/ChannelUpdateBulk.ts
index 9b0b248c5..234e8b344 100644
--- a/fluxer_app/src/features/channel/events/ChannelUpdateBulk.ts
+++ b/fluxer_app/src/features/channel/events/ChannelUpdateBulk.ts
@@ -8,7 +8,7 @@ import QuickSwitcher from '@app/features/search/state/QuickSwitcher';
import MediaEngine from '@app/features/voice/engine/MediaEngineFacade';
import type {Channel} from '@fluxer/schema/src/domains/channel/ChannelSchemas';
-export type ChannelBulkUpdatePayload = Partial<Channel> & {
+type ChannelBulkUpdatePayload = Partial<Channel> & {
id: string;
type: number;
};
diff --git a/fluxer_app/src/features/guild/utils/GuildAcronymUtils.ts b/fluxer_app/src/features/guild/utils/GuildAcronymUtils.ts
index abbd543f2..30865144f 100644
--- a/fluxer_app/src/features/guild/utils/GuildAcronymUtils.ts
+++ b/fluxer_app/src/features/guild/utils/GuildAcronymUtils.ts
@@ -33,7 +33,7 @@ export function getGuildAcronym(name: string): string {
return name.replace(POSSESSIVE_SUFFIX, '').replace(WORD_RUN, firstGrapheme).replace(WHITESPACE, '');
}
-export function getGuildAcronymLength(acronym: string): number {
+function getGuildAcronymLength(acronym: string): number {
if (graphemeSegmenter == null) return Array.from(acronym).length;
let length = 0;
for (const _segment of graphemeSegmenter.segment(acronym)) {
@@ -42,7 +42,7 @@ export function getGuildAcronymLength(acronym: string): number {
return length;
}
-export function getGuildAcronymFontScale(acronymLength: number): number {
+function getGuildAcronymFontScale(acronymLength: number): number {
const index = Math.min(Math.max(acronymLength, 1), GUILD_ACRONYM_FONT_SIZES_PX.length) - 1;
return GUILD_ACRONYM_FONT_SIZES_PX[index] / GUILD_ACRONYM_REFERENCE_ICON_SIZE_PX;
}
@@ -69,7 +69,7 @@ function getGuildAcronymWidthPerEm(acronym: string): number | null {
return widthPerEm;
}
-export function fitGuildAcronymFontScale(acronymLength: number, widthPerEm: number | null): number {
+function fitGuildAcronymFontScale(acronymLength: number, widthPerEm: number | null): number {
const scale = getGuildAcronymFontScale(acronymLength);
if (widthPerEm == null || widthPerEm <= 0) return scale;
const maxScale = GUILD_ACRONYM_FIT_WIDTH_RATIO / widthPerEm;
diff --git a/fluxer_app/src/features/guild/utils/GuildModerationCapabilityUtils.ts b/fluxer_app/src/features/guild/utils/GuildModerationCapabilityUtils.ts
index be1c80f63..c6f9552c6 100644
--- a/fluxer_app/src/features/guild/utils/GuildModerationCapabilityUtils.ts
+++ b/fluxer_app/src/features/guild/utils/GuildModerationCapabilityUtils.ts
@@ -8,7 +8,7 @@ import * as PermissionUtils from '@app/features/permissions/utils/PermissionUtil
import type {User} from '@app/features/user/models/User';
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
-export interface GuildModerationCapabilityOptions {
+interface GuildModerationCapabilityOptions {
isCurrentUser: boolean;
canManageTarget: boolean;
canKickMembers: boolean;
@@ -25,9 +25,7 @@ export interface GuildModerationCapabilities {
export type MemberModerationActionKey = 'timeout' | 'remove_timeout' | 'kick' | 'ban';
-export function resolveGuildModerationCapabilities(
- options: GuildModerationCapabilityOptions,
-): GuildModerationCapabilities {
+function resolveGuildModerationCapabilities(options: GuildModerationCapabilityOptions): GuildModerationCapabilities {
const canModerateTarget = !options.isCurrentUser && options.canManageTarget;
return {
canKick: canModerateTarget && options.canKickMembers,
diff --git a/fluxer_app/src/features/input/state/input_keybind/KeybindSyncCodec.ts b/fluxer_app/src/features/input/state/input_keybind/KeybindSyncCodec.ts
index 31f759191..2d0fa9eb1 100644
--- a/fluxer_app/src/features/input/state/input_keybind/KeybindSyncCodec.ts
+++ b/fluxer_app/src/features/input/state/input_keybind/KeybindSyncCodec.ts
@@ -63,7 +63,7 @@ const fromSyncedKeyCombo = (combo: SyncedKeybindCombo | undefined): KeyCombo =>
};
};
-export const toSyncedCustomKeybind = (entry: CustomKeybindEntry): SyncedCustomKeybindInit => ({
+const toSyncedCustomKeybind = (entry: CustomKeybindEntry): SyncedCustomKeybindInit => ({
id: entry.id,
action: entry.action ?? undefined,
combo: toSyncedKeyCombo(entry.combo),
diff --git a/fluxer_app/src/features/messaging/commands/MessageFetchStateMachine.ts b/fluxer_app/src/features/messaging/commands/MessageFetchStateMachine.ts
index 85771950e..cf0ff608f 100644
--- a/fluxer_app/src/features/messaging/commands/MessageFetchStateMachine.ts
+++ b/fluxer_app/src/features/messaging/commands/MessageFetchStateMachine.ts
@@ -25,7 +25,7 @@ export type MessageFetchPreflightDecision =
type: 'startFetch';
};
-export type MessageFetchPreflightState = 'inFlight' | 'accountTransition' | 'blocked' | 'cached' | 'network';
+type MessageFetchPreflightState = 'inFlight' | 'accountTransition' | 'blocked' | 'cached' | 'network';
export interface MessageFetchExecutionInput {
forceFailure: boolean;
@@ -65,10 +65,6 @@ function buildPreflightDecision(
}
}
-function buildExecutionDecision(input: MessageFetchExecutionInput): MessageFetchExecutionDecision {
- return input.forceFailure ? {type: 'simulateFailure'} : {type: 'requestNetwork'};
-}
-
export function resolveMessageFetchPreflightDecision(input: MessageFetchPreflightInput): MessageFetchPreflightDecision {
return buildPreflightDecision(resolvePreflightState(input), input);
}
diff --git a/fluxer_app/src/features/messaging/utils/ImageCacheUtils.ts b/fluxer_app/src/features/messaging/utils/ImageCacheUtils.ts
index 4feade5da..742b24e61 100644
--- a/fluxer_app/src/features/messaging/utils/ImageCacheUtils.ts
+++ b/fluxer_app/src/features/messaging/utils/ImageCacheUtils.ts
@@ -449,9 +449,3 @@ export function pinImage(src: string | null | undefined): () => void {
export function warmImage(src: string | null | undefined): void {
loadImage(src, () => {});
}
-
-export function _clearForTests(): void {
- for (const recovery of [...recoveries.values()]) stopRecovery(recovery);
- imageCache.clear();
- lastAttentionWakeAt = Number.NEGATIVE_INFINITY;
-}
diff --git a/fluxer_app/src/features/permissions/system/utils/MacPermissionGate.ts b/fluxer_app/src/features/permissions/system/utils/MacPermissionGate.ts
index 13e073786..467cd6b64 100644
--- a/fluxer_app/src/features/permissions/system/utils/MacPermissionGate.ts
+++ b/fluxer_app/src/features/permissions/system/utils/MacPermissionGate.ts
@@ -5,7 +5,7 @@ import MacPermissions, {type MacPermissionKind} from '@app/features/permissions/
import {requestNativePermission} from '@app/features/permissions/system/utils/NativePermissions';
import {getNativePlatformSync, isDesktop} from '@app/features/ui/utils/NativeUtils';
-export type MacPermissionGateBehavior = 'interactive' | 'passive';
+type MacPermissionGateBehavior = 'interactive' | 'passive';
export type MacPermissionGateResult = 'granted' | 'denied' | 'unsupported-platform';
interface MacPermissionGateOptions {
diff --git a/fluxer_app/src/features/threads/state/ThreadMemberships.ts b/fluxer_app/src/features/threads/state/ThreadMemberships.ts
index 0c8a29c68..6105bddf8 100644
--- a/fluxer_app/src/features/threads/state/ThreadMemberships.ts
+++ b/fluxer_app/src/features/threads/state/ThreadMemberships.ts
@@ -3,7 +3,7 @@
import type {ThreadMemberResponse} from '@fluxer/schema/src/domains/channel/ThreadSchemas';
import {makeAutoObservable, observable} from 'mobx';
-export interface ThreadMembership {
+interface ThreadMembership {
readonly threadId: string;
readonly joinTimestamp: string;
readonly flags: number;
diff --git a/fluxer_app/src/features/typing/rolling/RollingTypingSender.ts b/fluxer_app/src/features/typing/rolling/RollingTypingSender.ts
index 9eb68a7cf..c16eff7b1 100644
--- a/fluxer_app/src/features/typing/rolling/RollingTypingSender.ts
+++ b/fluxer_app/src/features/typing/rolling/RollingTypingSender.ts
@@ -14,7 +14,7 @@ import {
const logger = new Logger('Typing');
-export interface ComposerTypingInput {
+interface ComposerTypingInput {
channelId: string;
value: string;
previousValue: string | null;
diff --git a/fluxer_app/src/features/ui/AxisOrientation.ts b/fluxer_app/src/features/ui/AxisOrientation.ts
index 070c0b70e..98b20b1dd 100644
--- a/fluxer_app/src/features/ui/AxisOrientation.ts
+++ b/fluxer_app/src/features/ui/AxisOrientation.ts
@@ -1,18 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
-const Axis = Object.freeze({
- HORIZONTAL: 'horizontal',
- VERTICAL: 'vertical',
-} as const);
-
-export const AxisOrientation = Object.freeze({
- HORIZONTAL: Axis.HORIZONTAL,
- VERTICAL: Axis.VERTICAL,
- BOTH: 'both',
-} as const);
-
-export type AxisOrientation = (typeof AxisOrientation)[keyof typeof AxisOrientation];
-
export const Edge = Object.freeze({
LEFT: 'left',
RIGHT: 'right',
diff --git a/fluxer_app/src/features/ui/components/Pagination.tsx b/fluxer_app/src/features/ui/components/Pagination.tsx
index e19e8684f..2d7ff31d0 100644
--- a/fluxer_app/src/features/ui/components/Pagination.tsx
+++ b/fluxer_app/src/features/ui/components/Pagination.tsx
@@ -9,28 +9,24 @@ import {clsx} from 'clsx';
import type React from 'react';
import {useEffect, useRef, useState} from 'react';
-export type PaginationItem = number | 'ellipsis-left' | 'ellipsis-right';
+type PaginationItem = number | 'ellipsis-left' | 'ellipsis-right';
-export const GO_TO_PAGE_DESCRIPTOR = msg({
+const GO_TO_PAGE_DESCRIPTOR = msg({
message: 'Go to page {page}',
comment: 'Accessible label of each pagination page button. page is the 1-indexed page number.',
});
-export const GO_TO_PAGE_2_DESCRIPTOR = msg({
+const GO_TO_PAGE_2_DESCRIPTOR = msg({
message: 'Go to page',
comment: 'Accessible label of the inline page-number input shown when the user opens the pagination ellipsis.',
});
-export const JUMP_TO_PAGE_DESCRIPTOR = msg({
+const JUMP_TO_PAGE_DESCRIPTOR = msg({
message: 'Jump to page',
comment: 'Accessible label of the ellipsis button in the pagination bar that reveals the page-number input.',
});
-export const buildPaginationRange = (
- currentPage: number,
- totalPages: number,
- maxVisible: number,
-): Array<PaginationItem> => {
+const buildPaginationRange = (currentPage: number, totalPages: number, maxVisible: number): Array<PaginationItem> => {
if (totalPages <= 0) return [];
const effectiveMax = Math.max(3, maxVisible);
if (totalPages <= effectiveMax) {
diff --git a/fluxer_app/src/features/ui/state/LayerManager.ts b/fluxer_app/src/features/ui/state/LayerManager.ts
index f61af6d8c..fd8c7172a 100644
--- a/fluxer_app/src/features/ui/state/LayerManager.ts
+++ b/fluxer_app/src/features/ui/state/LayerManager.ts
@@ -12,7 +12,7 @@ export const LayerType = Object.freeze({
export type LayerType = (typeof LayerType)[keyof typeof LayerType];
-export interface Layer {
+interface Layer {
type: LayerType;
key: string | PopoutKey;
onClose?: () => void;
diff --git a/fluxer_app/src/features/ui/state/Sound.ts b/fluxer_app/src/features/ui/state/Sound.ts
index 42e31d622..eddff4d01 100644
--- a/fluxer_app/src/features/ui/state/Sound.ts
+++ b/fluxer_app/src/features/ui/state/Sound.ts
@@ -16,7 +16,7 @@ export interface SoundSettings {
soundOverrides: Partial<Record<SoundType, number>>;
}
-export interface SoundPlayOptions {
+interface SoundPlayOptions {
bypassSelfDeafened?: boolean;
ignoreGroupCooldown?: boolean;
}
diff --git a/fluxer_app/src/features/ui/stepped_carousel/SteppedCarouselStateMachine.ts b/fluxer_app/src/features/ui/stepped_carousel/SteppedCarouselStateMachine.ts
index 52e47928a..3adeebeb5 100644
--- a/fluxer_app/src/features/ui/stepped_carousel/SteppedCarouselStateMachine.ts
+++ b/fluxer_app/src/features/ui/stepped_carousel/SteppedCarouselStateMachine.ts
@@ -82,7 +82,7 @@ function shouldRequestFocus(
return context.step !== event.step || !context.focusOnStepChange;
}
-export const steppedCarouselStateMachine = setup({
+const steppedCarouselStateMachine = setup({
types: {} as {
context: SteppedCarouselMachineContext;
events: SteppedCarouselMachineEvent;