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

View file

@ -80,10 +80,12 @@ function EvalSection() {
)} )}
<Text style={{ marginTop: 8, fontSize: 12.5, opacity: 0.7 }}> <Text style={{ marginTop: 8, fontSize: 12.5, opacity: 0.7 }}>
Runs as the body of an async function - a bare expression, `return ...`, or 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), (rawFind/rawFindByTypeName/rawFindByProps/rawFindByName/rawFindByStoreName),
React, ReactNative, FluxDispatcher, and window are already in scope. Nothing runs instead/before/after, getAssetIDByName, React, ReactNative, FluxDispatcher, and
until you tap the button. window - enough to prototype a real patch here before it goes in a plugin.
Nothing runs until you tap the button.
</Text> </Text>
</View> </View>
</FormSection> </FormSection>