Skip to content

Commit

Permalink
feat(metro): expose common components & custom jsx runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly committed Oct 12, 2024
1 parent a0c2ca7 commit 019fdc2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shims/jsxRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/metro/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 019fdc2

Please sign in to comment.