feat(metro): expose common components & custom jsx runtime

This commit is contained in:
pylixonly 2024-10-12 23:07:44 +08:00
parent a0c2ca7837
commit 019fdc28b3
3 changed files with 10 additions and 0 deletions

View file

@ -4,6 +4,10 @@ import { findByPropsLazy } from "@metro/wrappers";
const jsxRuntime = findByPropsLazy("jsx", "jsxs", "Fragment");
function unproxyFirstArg<T>(args: T[]) {
if (!args[0]) {
throw new Error("The first argument (Component) is falsy. Ensure that you are passing a valid component.");
}
const factory = getProxyFactory(args[0]);
if (factory) args[0] = factory();
return args;

View file

@ -12,6 +12,10 @@ export * as metro from "@metro";
import * as fonts from "./fonts";
import * as plugins from "./plugins";
import * as themes from "./themes";
/** @internal */
export * as _jsx from "react/jsx-runtime";
import { proxyLazy } from "./utils/lazy";
export const managers = proxyLazy(() => {

View file

@ -2,6 +2,8 @@ import { findByFilePathLazy, findByProps, findByPropsLazy } from "@metro/wrapper
import type { Dispatcher } from "./types/flux";
export * as components from "./components";
// Discord
export const constants = findByPropsLazy("Fonts", "Permissions");
export const channels = findByPropsLazy("getVoiceChannelId");