Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
thororen1234 2026-04-24 13:54:32 -04:00
commit 36b1dfee2a
No known key found for this signature in database
5 changed files with 27 additions and 26 deletions

View file

@ -204,13 +204,6 @@ export async function loadLazyChunks() {
}
})));
// Manually require all modules to make sure all lazily required modules are patched
for (const moduleId of Object.keys(wreq.m)) {
try {
wreq(moduleId);
} catch { }
}
LazyChunkLoaderLogger.log("Finished loading all chunks!");
} catch (e) {
LazyChunkLoaderLogger.log("A fatal error occurred:", e);

View file

@ -22,13 +22,19 @@ import { Auth } from "@plugins/reviewDB/auth";
import { ReviewType } from "@plugins/reviewDB/entities";
import { REVIEWS_PER_PAGE, UserReviewsData } from "@plugins/reviewDB/reviewDbApi";
import { cl } from "@plugins/reviewDB/utils";
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModalLazy } from "@utils/modal";
import { useForceUpdater } from "@utils/react";
import { Paginator, useRef, useState } from "@webpack/common";
import * as t from "@vencord/discord-types";
import { DefaultExtractAndLoadChunksRegex, extractAndLoadChunksLazy, findComponentByCodeLazy } from "@webpack";
import { useRef, useState } from "@webpack/common";
import { ComponentProps } from "react";
import ReviewComponent from "./ReviewComponent";
import ReviewsView, { ReviewsInputComponent } from "./ReviewsView";
const Paginator = findComponentByCodeLazy<ComponentProps<t.Paginator>>('rel:"prev",children:');
const requirePaginator = extractAndLoadChunksLazy(['name:"SearchResults"'], new RegExp(`${DefaultExtractAndLoadChunksRegex.source}.{0,30}?name:"SearchResults"`));
function Modal({ modalProps, modalKey, discordId, name, type }: { modalProps: any; modalKey: string, discordId: string; name: string; type: ReviewType; }) {
const [data, setData] = useState<UserReviewsData>();
const [signal, refetch] = useForceUpdater(true);
@ -101,13 +107,15 @@ function Modal({ modalProps, modalKey, discordId, name, type }: { modalProps: an
export function openReviewsModal(discordId: string, name: string, type: ReviewType) {
const modalKey = "vc-rdb-modal-" + Date.now();
openModal(props => (
<Modal
modalKey={modalKey}
modalProps={props}
discordId={discordId}
name={name}
type={type}
/>
), { modalKey });
openModalLazy(async () => {
await requirePaginator();
return props => (
<Modal
modalKey={modalKey}
modalProps={props}
discordId={discordId}
name={name}
type={type} />
);
}, { modalKey });
}

View file

@ -29,6 +29,7 @@ import deviconStyle from "./devicon.css?managed";
import { settings } from "./settings";
import { DeviconSetting } from "./types";
import { clearStyles } from "./utils/createStyle";
import { requireHljs } from "./utils/misc";
export default definePlugin({
name: "ShikiCodeblocks",
@ -74,6 +75,7 @@ export default definePlugin({
shiki,
createHighlighter,
renderHighlighter: ({ lang, content }: { lang: string; content: string; }) => {
requireHljs();
return createHighlighter({
lang,
content,

View file

@ -20,14 +20,12 @@ import { resolveLang } from "@plugins/shikiCodeblocks.desktop/api/languages";
import { HighlighterProps } from "@plugins/shikiCodeblocks.desktop/components/Highlighter";
import { HljsSetting } from "@plugins/shikiCodeblocks.desktop/types";
import { classNameFactory } from "@utils/css";
import { DefaultExtractAndLoadChunksRegex, extractAndLoadChunks, findByPropsLazy, proxyLazyWebpack } from "@webpack";
import { DefaultExtractAndLoadChunksRegex, extractAndLoadChunksLazy, findByPropsLazy } from "@webpack";
export const cl = classNameFactory("vc-shiki-");
export const hljs: typeof import("highlight.js").default = proxyLazyWebpack(() => {
extractAndLoadChunks(["codeBlock:{react("], new RegExp(`"hljs".+?${DefaultExtractAndLoadChunksRegex.source}`));
return findByPropsLazy("highlight", "registerLanguage");
});
export const hljs: typeof import("highlight.js").default = findByPropsLazy("highlight", "registerLanguage");
export const requireHljs = extractAndLoadChunksLazy(["codeBlock:{react("], new RegExp(`"hljs".+?${DefaultExtractAndLoadChunksRegex.source}`));
export const shouldUseHljs = ({
lang,

View file

@ -56,15 +56,15 @@ export const Tooltip = waitForComponent<t.Tooltip>("Tooltip", m => m.prototype?.
/** @deprecated import from @vencord/components */
export const TooltipContainer = TooltipContainerComponent as never;
export const TextInput = waitForComponent<t.TextInput>("TextInput", filters.componentByCode("#{intl::MAXIMUM_LENGTH_ERROR}", '"input"'));
export const TextArea = waitForComponent<t.TextArea>("TextArea", filters.componentByCode('"data-mana-component":"text-area"'));
// FIXME: t.TextInput was for the old void components, and is not 100% correct for the mana component
export const TextInput = waitForComponent<t.TextInput>("TextInput", filters.componentByCode('setHasValue?.(""!==', '="text",'));
export const TextArea = waitForComponent<t.TextArea>("TextArea", filters.componentByCode("!0,rows:", "showRemainingCharacterCount:"));
export const Select = waitForComponent<t.Select>("Select", filters.componentByCode('selectionMode:"single",onSelectionChange:', "isSelected:"));
export const SearchableSelect = waitForComponent<t.SearchableSelect>("SearchableSelect", filters.componentByCode('?"multiple":"single",required:'));
export const Slider = waitForComponent<t.Slider>("Slider", filters.componentByCode("markDash", "this.renderMark("));
export const Popout = waitForComponent<t.Popout>("Popout", filters.componentByCode("ref:this.ref,", "renderPopout:this.renderPopout,"));
export const Dialog = waitForComponent<t.Dialog>("Dialog", filters.componentByCode('role:"dialog",tabIndex:-1'));
export const TabBar = waitForComponent("TabBar", filters.componentByCode("ref:this.tabBarRef,className:"));
export const Paginator = waitForComponent<t.Paginator>("Paginator", filters.componentByCode('rel:"prev",children:'));
// TODO: remake this component
export const Clickable = waitForComponent<t.Clickable>("Clickable", filters.componentByCode("this.context?this.renderNonInteractive():"));
export const Avatar = waitForComponent<t.Avatar>("Avatar", filters.componentByCode(".size-1.375*"));