chore(deps): upgrade all dependencies, toolchains and images (#2825)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-17 21:08:56 +02:00
1 parent 56e04e7b53
commit 3b552e00ef
510 files changed
+23614 -37473

No files matched your search

@@ -4,7 +4,7 @@ import type {MarkdownParseOptions} from '@app/features/messaging/components/mark
import {MarkdownContext} from '@app/features/messaging/components/markdown/renderers/RendererTypes';
import {parseMarkdownContent as parse} from '@app/features/messaging/utils/markdown/MarkdownParseCache';
import type {Node} from '@app/features/messaging/utils/markdown/parser/Nodes';
import {bench, describe} from 'vitest';
import {test} from 'vitest';
const SIMPLE_CONTENT = 'hello **world** with <@1234567890> and https://fluxer.app';
const RICH_CONTENT = [
@@ -30,25 +30,25 @@ const SIMPLE_AST = parse({content: SIMPLE_CONTENT, context: MarkdownContext.STAN
const RICH_AST = parse({content: RICH_CONTENT, context: MarkdownContext.STANDARD_WITHOUT_JUMBO}).nodes;
let missSerial = 0;
describe('Markdown rendering benchmarks', () => {
bench('parse cache hit for simple message content', () => {
test('Markdown rendering benchmarks', async ({bench}) => {
await bench('parse cache hit for simple message content', () => {
parse({content: SIMPLE_CONTENT, context: MarkdownContext.STANDARD_WITHOUT_JUMBO});
});
}).run();
bench('parse cache miss for rich message content', () => {
await bench('parse cache miss for rich message content', () => {
missSerial += 1;
parse({content: `${RICH_CONTENT}\n${missSerial}`, context: MarkdownContext.STANDARD_WITHOUT_JUMBO});
});
}).run();
bench('render simple parsed markdown AST to React nodes', () => {
await bench('render simple parsed markdown AST to React nodes', () => {
let count = 0;
for (const node of SIMPLE_AST) {
count += node.type.length;
}
(globalThis as {__markdownRenderBenchSink?: number}).__markdownRenderBenchSink = count + RENDER_OPTIONS.context;
});
}).run();
bench('walk rich parsed markdown AST for render preparation', () => {
await bench('walk rich parsed markdown AST for render preparation', () => {
let count = 0;
const stack = [...RICH_AST];
while (stack.length > 0) {
@@ -62,5 +62,5 @@ describe('Markdown rendering benchmarks', () => {
}
}
(globalThis as {__markdownRenderBenchSink?: number}).__markdownRenderBenchSink = count + RENDER_OPTIONS.context;
});
}).run();
});
@@ -441,7 +441,7 @@ export function useTextareaAutocomplete({
);
const canManageUser = useCallback(
(otherUserId: string, permission: bigint) => {
if (!channel || !channel.guildId) return false;
if (!channel?.guildId) return false;
const currentUserId = Authentication.currentUserId;
if (otherUserId === currentUserId) return false;
const guild = Guilds.getGuild(channel.guildId);
@@ -452,7 +452,7 @@ export function useTextareaAutocomplete({
);
const canViewChannel = useCallback(
(userId: string): boolean => {
if (!channel || !channel.guildId) {
if (!channel?.guildId) {
return true;
}
return PermissionUtils.can(Permissions.VIEW_CHANNEL, userId as UserId, channel.toJSON());
@@ -491,7 +491,7 @@ export function useTextareaAutocomplete({
}
case 'mention': {
setAutocompleteType('mention');
if (!channel || !channel.guildId) {
if (!channel?.guildId) {
if (!channel) {
setAutocompleteOptions([]);
return;
@@ -2,7 +2,7 @@
import TextareaSelection from '@app/features/messaging/state/TextareaSelection';
import AppStorage from '@app/features/platform/state/PersistentStorage';
import {comparer, makeAutoObservable, reaction} from 'mobx';
import {compareStructural, makeAutoObservable, reaction} from 'mobx';
const MESSAGE_EDIT_STORAGE_KEY = 'MessageEdit';
@@ -83,7 +83,7 @@ class MessageEdit {
return reaction(
() => Object.entries(this.editingMessageIds),
() => callback(),
{fireImmediately: true, equals: comparer.structural},
{fireImmediately: true, equals: compareStructural},
);
}
}
@@ -602,7 +602,7 @@ export class MessageQueue extends Queue<MessageQueuePayload, RestResponse<Messag
private scheduleTextareaAttachmentUploadCleanup(attachmentId: number): void {
window.setTimeout(() => {
const entry = this.textareaAttachmentUploads.get(attachmentId);
if (!entry || !entry.settled) {
if (!entry?.settled) {
return;
}
if (Date.now() - entry.startedAt >= TEXTAREA_ATTACHMENT_UPLOAD_CACHE_TTL_MS) {
@@ -980,7 +980,7 @@ export class MessageQueue extends Queue<MessageQueuePayload, RestResponse<Messag
});
const plans = response.body?.attachments ?? [];
for (const entry of plans) {
if (!entry || !entry.upload_mode || !entry.upload_filename || !entry.filename) {
if (!entry?.upload_mode || !entry.upload_filename || !entry.filename) {
throw new Error('Invalid presigned attachment upload response');
}
if (entry.upload_mode === 'singlepart') {
@@ -3,7 +3,7 @@
import TextareaSelection from '@app/features/messaging/state/TextareaSelection';
import type {MentionSegment} from '@app/features/messaging/utils/TextareaSegmentManager';
import {makePersistent} from '@app/features/platform/utils/MobXPersistence';
import {action, makeAutoObservable} from 'mobx';
import {makeAutoObservable} from 'mobx';
const EMPTY_SEGMENTS: ReadonlyArray<MentionSegment> = [];
@@ -61,7 +61,6 @@ class Drafts {
await makePersistent(this, 'Drafts', ['drafts', 'draftSegments']);
}
@action
createDraft(channelId: string, content: string, segments?: ReadonlyArray<MentionSegment> | null): void {
if (!content) {
this.deleteDraft(channelId);
@@ -80,7 +79,6 @@ class Drafts {
}
}
@action
deleteDraft(channelId: string): void {
if (!(channelId in this.drafts) && !(channelId in this.draftSegments)) {
return;
@@ -90,7 +88,6 @@ class Drafts {
TextareaSelection.clearChannelSelection(channelId);
}
@action
deleteChannelDraft(channelId: string): void {
this.deleteDraft(channelId);
}
@@ -103,7 +100,6 @@ class Drafts {
return this.draftSegments[channelId] ?? EMPTY_SEGMENTS;
}
@action
cleanupEmptyDrafts(): void {
for (const channelId of Object.keys(this.drafts)) {
const content = this.drafts[channelId];
@@ -21,7 +21,7 @@ import {MAX_MESSAGES_PER_CHANNEL} from '@fluxer/constants/src/LimitConstants';
import type {ChannelId} from '@fluxer/schema/src/branded/WireIds';
import type {GuildMemberData} from '@fluxer/schema/src/domains/guild/GuildMemberSchemas';
import type {Message as WireMessage} from '@fluxer/schema/src/domains/message/MessageResponseSchemas';
import {action, makeAutoObservable, reaction} from 'mobx';
import {makeAutoObservable, reaction} from 'mobx';
const STALE_WINDOW_REFETCH_INTERVAL_MS = 10_000;
const staleWindowRefetchedAt = new Map<string, number>();
@@ -69,7 +69,6 @@ class Messages {
return this.updateCounter;
}
@action
private notifyChange(): void {
this.updateCounter += 1;
}
@@ -217,7 +216,6 @@ class Messages {
return messages.length === 0 ? !messages.ready : messages.cached;
}
@action
preloadLatestPage(channelId: string, guildId?: string | null): boolean {
if (!this.shouldPreloadLatestPage(channelId)) {
return false;
@@ -248,7 +246,6 @@ class Messages {
return channel?.hasNewestMessages() ?? false;
}
@action
setPendingJumpDispatch(channelId: string, dispatch: PendingJumpDispatch): void {
this.pendingJumpDispatches.set(channelId, dispatch);
}
@@ -260,7 +257,6 @@ class Messages {
return dispatch.messageId === messageId ? dispatch : null;
}
@action
handleConnectionClosed(): boolean {
let didUpdate = false;
ChannelMessages.forEach((messages) => {
@@ -275,7 +271,6 @@ class Messages {
return false;
}
@action
handleSessionInvalidated(): boolean {
const channelIds: Array<string> = [];
ChannelMessages.forEach((messages) => channelIds.push(messages.channelId));
@@ -291,7 +286,6 @@ class Messages {
return true;
}
@action
handleGatewayReady(): boolean {
const selectedChannelId = SelectedChannel.currentChannelId;
let didHydrateSelectedChannel = false;
@@ -340,7 +334,6 @@ class Messages {
MessageCommands.fetchMessages(channelId, null, null, MAX_MESSAGES_PER_CHANNEL);
}
@action
handleChannelSelect(action: {guildId?: string; channelId?: string | null; messageId?: string}): boolean {
const channelId = action.channelId ?? action.guildId;
if (channelId == null || channelId === ME) {
@@ -388,7 +381,6 @@ class Messages {
return false;
}
@action
handleGuildUnavailable(guildId: string, unavailable: boolean): boolean {
if (!unavailable) {
return false;
@@ -416,7 +408,6 @@ class Messages {
return didUpdate;
}
@action
handleGuildCreate(action: {
guild: {
id: string;
@@ -444,7 +435,6 @@ class Messages {
return didChannelSelect;
}
@action
handleLoadMessages(action: {channelId: string; jump?: JumpOptions}): boolean {
const messages = ChannelMessages.getOrCreate(action.channelId);
this.commitMessages(messages.beginLoad(action.jump));
@@ -452,7 +442,6 @@ class Messages {
return false;
}
@action
handleTruncateMessages(action: {channelId: string; trimNewest?: boolean; trimOldest?: boolean}): boolean {
const messages = ChannelMessages.getOrCreate(action.channelId).trimToWindow(
action.trimNewest ?? false,
@@ -463,7 +452,6 @@ class Messages {
return false;
}
@action
handleLoadMessagesSuccessCached(action: {
channelId: string;
jump?: JumpOptions;
@@ -492,7 +480,6 @@ class Messages {
return false;
}
@action
handleLoadMessagesSuccess(action: {
channelId: string;
isBefore?: boolean;
@@ -531,7 +518,6 @@ class Messages {
MessageCommands.fetchMessages(channelId, null, null, MAX_MESSAGES_PER_CHANNEL, jump, {staleRefetch: true});
}
@action
handleLoadMessagesFailure(action: {channelId: string}): boolean {
const messages = ChannelMessages.getOrCreate(action.channelId);
this.commitMessages(messages.withPatch({loadingMore: false, error: true}));
@@ -539,7 +525,6 @@ class Messages {
return false;
}
@action
handleLoadMessagesBlocked(action: {channelId: string}): boolean {
const messages = ChannelMessages.getOrCreate(action.channelId);
if (!messages.loadingMore && !messages.error) {
@@ -550,7 +535,6 @@ class Messages {
return true;
}
@action
handleIncomingMessage(action: {channelId: string; message: WireMessage}): boolean {
Channels.handleMessageCreate({message: action.message});
const existing = ChannelMessages.get(action.channelId);
@@ -563,30 +547,27 @@ class Messages {
return false;
}
@action
handleSendFailed(action: {channelId: string; nonce: string}): boolean {
const existing = ChannelMessages.get(action.channelId);
if (!existing || !existing.has(action.nonce)) return false;
if (!existing?.has(action.nonce)) return false;
const updated = existing.update(action.nonce, (message) => message.withUpdates({state: MessageStates.FAILED}));
this.commitMessages(updated);
this.notifyChange();
return true;
}
@action
handleSendRetry(action: {channelId: string; messageId: string}): boolean {
const existing = ChannelMessages.get(action.channelId);
if (!existing || !existing.has(action.messageId)) return false;
if (!existing?.has(action.messageId)) return false;
const updated = existing.update(action.messageId, (message) => message.withUpdates({state: MessageStates.SENDING}));
this.commitMessages(updated);
this.notifyChange();
return true;
}
@action
handleMessageDelete(action: {id: string; channelId: string}): boolean {
const existing = ChannelMessages.get(action.channelId);
if (!existing || !existing.has(action.id)) {
if (!existing?.has(action.id)) {
return false;
}
let messages = existing;
@@ -600,7 +581,6 @@ class Messages {
return true;
}
@action
handleMessageDeleteBulk(action: {ids: Array<string>; channelId: string}): boolean {
const existing = ChannelMessages.get(action.channelId);
if (!existing) return false;
@@ -615,12 +595,11 @@ class Messages {
return true;
}
@action
handleMessageUpdate(action: {message: WireMessage}): boolean {
const messageId = action.message.id;
const channelId = action.message.channel_id;
const existing = ChannelMessages.get(channelId);
if (!existing || !existing.has(messageId)) return false;
if (!existing?.has(messageId)) return false;
const updated = existing.update(messageId, (message) => {
if (message.isEditing && action.message.state === undefined) {
return message.withUpdates({...action.message, state: MessageStates.SENT});
@@ -632,7 +611,6 @@ class Messages {
return true;
}
@action
handleUserUpdate(action: {
user: {
id: string;
@@ -649,7 +627,6 @@ class Messages {
return hasChanges;
}
@action
handleGuildMemberUpdate(action: GuildMemberUpdateAction): boolean {
const userId = action.member.user.id;
const updatedAuthor = Users.getUser(userId);
@@ -664,7 +641,6 @@ class Messages {
return hasChanges;
}
@action
handlePresenceUpdate(action: PresenceUpdateAction): boolean {
if (!action.presence.user.username && !action.presence.user.avatar && !action.presence.user.discriminator) {
return false;
@@ -684,7 +660,6 @@ class Messages {
return hasChanges;
}
@action
handleCleanup(): boolean {
ChannelMessages.forEach(({channelId}) => {
if (Channels.getChannel(channelId) == null) {
@@ -696,7 +671,6 @@ class Messages {
return false;
}
@action
handleRelationshipUpdate(): boolean {
let hasChanges = false;
ChannelMessages.forEach((messages) => {
@@ -713,7 +687,6 @@ class Messages {
return false;
}
@action
handleMessageReveal(action: {channelId: string; messageId: string | null}): boolean {
const messages = ChannelMessages.getOrCreate(action.channelId);
this.commitMessages(messages.withPatch({unblurredMessageId: action.messageId}));
@@ -721,7 +694,6 @@ class Messages {
return true;
}
@action
handleClearJumpTarget(action: {channelId: string; clearReturnTarget?: boolean}): boolean {
const messages = ChannelMessages.get(action.channelId);
if (
@@ -737,7 +709,6 @@ class Messages {
return false;
}
@action
handleReaction(action: {
type: 'MESSAGE_REACTION_ADD' | 'MESSAGE_REACTION_REMOVE';
channelId: string;
@@ -765,7 +736,6 @@ class Messages {
return true;
}
@action
handleRemoveAllReactions(action: {channelId: string; messageId: string}): boolean {
const existing = ChannelMessages.get(action.channelId);
if (!existing) return false;
@@ -775,7 +745,6 @@ class Messages {
return true;
}
@action
handleRemoveReactionEmoji(action: {channelId: string; messageId: string; emoji: ReactionEmoji}): boolean {
const existing = ChannelMessages.get(action.channelId);
if (!existing) return false;
@@ -785,7 +754,6 @@ class Messages {
return true;
}
@action
handleMessagePreload(action: {messages: Record<ChannelId, WireMessage>}): boolean {
let hasChanges = false;
for (const [channelId, messageData] of Object.entries(action.messages)) {
@@ -803,7 +771,6 @@ class Messages {
return hasChanges;
}
@action
handleOptimisticEdit(action: {channelId: string; messageId: string; content: string}): {
originalContent: string;
originalEditedTimestamp: string | null;
@@ -828,7 +795,6 @@ class Messages {
return rollbackData;
}
@action
handleEditRollback(action: {
channelId: string;
messageId: string;
@@ -837,7 +803,7 @@ class Messages {
}): void {
const {channelId, messageId, originalContent, originalEditedTimestamp} = action;
const existing = ChannelMessages.get(channelId);
if (!existing || !existing.has(messageId)) return;
if (!existing?.has(messageId)) return;
const updated = existing.update(messageId, (msg) =>
msg.withUpdates({
content: originalContent,
@@ -7,15 +7,15 @@ import {
transitionReactionSnapshot,
} from '@app/features/messaging/state/ReactionStateMachine';
import type {ReactionEmoji} from '@app/features/messaging/utils/ReactionUtils';
import {bench, describe} from 'vitest';
import {test} from 'vitest';
const EMOJIS: Array<ReactionEmoji> = Array.from({length: 32}, (_value, index) => ({
id: index % 3 === 0 ? `emoji-${index}` : undefined,
name: index % 3 === 0 ? `custom_${index}` : ['🔥', '❤️', '👍', '🎉'][index % 4],
}));
describe('ReactionStateMachine benchmarks', () => {
bench('apply 1k reaction add/remove transitions for visible messages', () => {
test('ReactionStateMachine benchmarks', async ({bench}) => {
await bench('apply 1k reaction add/remove transitions for visible messages', () => {
let snapshot = createReactionMachineSnapshot(emptyMap(), 'me');
for (let index = 0; index < 1_000; index += 1) {
const emoji = EMOJIS[index % EMOJIS.length];
@@ -36,9 +36,9 @@ describe('ReactionStateMachine benchmarks', () => {
}
}
mapToReactions(snapshot.context.map);
});
}).run();
bench('hydrate 500-message reaction payload shape', () => {
await bench('hydrate 500-message reaction payload shape', () => {
let snapshot = createReactionMachineSnapshot(emptyMap(), 'me');
for (let index = 0; index < 500; index += 1) {
snapshot = transitionReactionSnapshot(snapshot, {
@@ -52,5 +52,5 @@ describe('ReactionStateMachine benchmarks', () => {
});
}
mapToReactions(snapshot.context.map);
});
}).run();
});
@@ -4,7 +4,7 @@ import {
calculateAroundPaginationState,
getAroundWindowCounts,
} from '@app/features/messaging/utils/MessagePaginationUtils';
import {bench, describe} from 'vitest';
import {test} from 'vitest';
const PAGINATION_INPUTS = Array.from({length: 100_000}, (_value, index) => ({
limit: 50 + (index % 25),
@@ -14,19 +14,19 @@ const PAGINATION_INPUTS = Array.from({length: 100_000}, (_value, index) => ({
knownLatestMessageId: 'latest',
}));
describe('MessagePaginationUtils benchmarks', () => {
bench('calculate 100k around pagination states', () => {
test('MessagePaginationUtils benchmarks', async ({bench}) => {
await bench('calculate 100k around pagination states', () => {
for (const input of PAGINATION_INPUTS) {
calculateAroundPaginationState(input);
}
});
}).run();
bench('calculate 100k around window counts', () => {
await bench('calculate 100k around window counts', () => {
let total = 0;
for (let index = 0; index < 100_000; index += 1) {
const {newer, older} = getAroundWindowCounts(index % 100);
total += newer + older;
}
(globalThis as {__messagePaginationBenchSink?: number}).__messagePaginationBenchSink = total;
});
}).run();
});