Key Inspector: expand Eval scope to findByTypeName/findByStoreName/instead/before/after/getAssetIDByName

This commit is contained in:
everestmcarthur 2026-08-01 20:27:40 -04:00
parent 3dc639e305
commit 64027dfa0d
2 changed files with 24 additions and 4 deletions

View file

@ -1,5 +1,7 @@
import { findByProps, findByName, find } from "@vendetta/metro";
import { findByProps, findByName, findByTypeName, findByStoreName, findByPropsAll, findByNameAll, find } from "@vendetta/metro";
import { React, ReactNative, FluxDispatcher } from "@vendetta/metro/common";
import { instead, before, after } from "@vendetta/patcher";
import { getAssetIDByName } from "@vendetta/ui/assets";
import { rawFind, rawFindByTypeName, rawFindByProps, rawFindByName, rawFindByStoreName } from "@shared/lib/rawFind";
declare const window: any;
@ -50,12 +52,20 @@ export async function runEval(code: string): Promise<string> {
const fn = new Function(
"findByProps",
"findByName",
"findByTypeName",
"findByStoreName",
"findByPropsAll",
"findByNameAll",
"find",
"rawFind",
"rawFindByTypeName",
"rawFindByProps",
"rawFindByName",
"rawFindByStoreName",
"instead",
"before",
"after",
"getAssetIDByName",
"React",
"ReactNative",
"FluxDispatcher",
@ -66,12 +76,20 @@ export async function runEval(code: string): Promise<string> {
const result = await fn(
findByProps,
findByName,
findByTypeName,
findByStoreName,
findByPropsAll,
findByNameAll,
find,
rawFind,
rawFindByTypeName,
rawFindByProps,
rawFindByName,
rawFindByStoreName,
instead,
before,
after,
getAssetIDByName,
React,
ReactNative,
FluxDispatcher,

View file

@ -80,10 +80,12 @@ function EvalSection() {
)}
<Text style={{ marginTop: 8, fontSize: 12.5, opacity: 0.7 }}>
Runs as the body of an async function - a bare expression, `return ...`, or
`await ...` all work. findByProps/findByName/find, the raw* passive variants
`await ...` all work. In scope: findByProps/findByName/findByTypeName/
findByStoreName/findByPropsAll/findByNameAll/find, the raw* passive variants
(rawFind/rawFindByTypeName/rawFindByProps/rawFindByName/rawFindByStoreName),
React, ReactNative, FluxDispatcher, and window are already in scope. Nothing runs
until you tap the button.
instead/before/after, getAssetIDByName, React, ReactNative, FluxDispatcher, and
window - enough to prototype a real patch here before it goes in a plugin.
Nothing runs until you tap the button.
</Text>
</View>
</FormSection>