feat(metro): expose common components & custom jsx runtime
This commit is contained in:
parent
a0c2ca7837
commit
019fdc28b3
3 changed files with 10 additions and 0 deletions
|
|
@ -4,6 +4,10 @@ import { findByPropsLazy } from "@metro/wrappers";
|
||||||
const jsxRuntime = findByPropsLazy("jsx", "jsxs", "Fragment");
|
const jsxRuntime = findByPropsLazy("jsx", "jsxs", "Fragment");
|
||||||
|
|
||||||
function unproxyFirstArg<T>(args: T[]) {
|
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]);
|
const factory = getProxyFactory(args[0]);
|
||||||
if (factory) args[0] = factory();
|
if (factory) args[0] = factory();
|
||||||
return args;
|
return args;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ export * as metro from "@metro";
|
||||||
import * as fonts from "./fonts";
|
import * as fonts from "./fonts";
|
||||||
import * as plugins from "./plugins";
|
import * as plugins from "./plugins";
|
||||||
import * as themes from "./themes";
|
import * as themes from "./themes";
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
|
export * as _jsx from "react/jsx-runtime";
|
||||||
|
|
||||||
import { proxyLazy } from "./utils/lazy";
|
import { proxyLazy } from "./utils/lazy";
|
||||||
|
|
||||||
export const managers = proxyLazy(() => {
|
export const managers = proxyLazy(() => {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import { findByFilePathLazy, findByProps, findByPropsLazy } from "@metro/wrapper
|
||||||
|
|
||||||
import type { Dispatcher } from "./types/flux";
|
import type { Dispatcher } from "./types/flux";
|
||||||
|
|
||||||
|
export * as components from "./components";
|
||||||
|
|
||||||
// Discord
|
// Discord
|
||||||
export const constants = findByPropsLazy("Fonts", "Permissions");
|
export const constants = findByPropsLazy("Fonts", "Permissions");
|
||||||
export const channels = findByPropsLazy("getVoiceChannelId");
|
export const channels = findByPropsLazy("getVoiceChannelId");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue