From 93d6d9b33df76ff77b4641ca8250a63f6661d2d6 Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Mon, 3 Apr 2023 22:50:26 +0800 Subject: [PATCH] HideGiftButton: actually use `findByName` --- .eslintrc.json | 1 + .gitignore | 5 ++++- build.mjs | 10 ++++++++-- package.json | 17 +++++++++-------- plugins/HideGiftButton/src/index.ts | 4 ++-- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 3ca2809..c3a1cd2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -37,6 +37,7 @@ "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/triple-slash-reference": "off", "@typescript-eslint/no-non-null-assertion": "off", + "react/react-in-jsx-scope": "off", "eol-last": "error" } } diff --git a/.gitignore b/.gitignore index 0ab8579..3d0abbf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ +.idea node_modules/ dist/ pnpm-lock.yaml yarn.lock package-lock.json -RichPresence +Themer +FunnyBackground +YouTabRemover diff --git a/build.mjs b/build.mjs index 1ef73c9..8ba73fb 100644 --- a/build.mjs +++ b/build.mjs @@ -54,7 +54,8 @@ async function buildPlugin(plugin) { return id.substring(1).replace(/\//g, "."); const map = { - react: "window.React" + "react": "window.React", + "react-native": "globalThis.vendetta.metro.common.ReactNative" }; return map[id] || null; @@ -71,7 +72,12 @@ async function buildPlugin(plugin) { ].includes(warning.code) && console.warn(warning); }, plugins: [ - nodeResolve(), + nodeResolve({ + resolveOnly: (id) => ![ + "react", + "react-native" + ].includes(id) + }), commonjs(), { name: "swc", diff --git a/package.json b/package.json index 82e6bb5..a81d176 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,24 @@ { "scripts": { "build": "node build.mjs", + "watch": "node build.mjs -w", "lint": "eslint plugins" }, "devDependencies": { "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-node-resolve": "^15.0.1", - "@swc/core": "^1.3.36", + "@swc/core": "^1.3.42", "@types/react": "^18.0.28", - "@types/react-native": "^0.70.11", - "@typescript-eslint/eslint-plugin": "^5.53.0", - "@typescript-eslint/parser": "^5.53.0", - "esbuild": "^0.17.11", - "eslint": "^8.35.0", + "@types/react-native": "^0.70.12", + "@typescript-eslint/eslint-plugin": "^5.56.0", + "@typescript-eslint/parser": "^5.56.0", + "esbuild": "^0.17.12", + "eslint": "^8.36.0", "eslint-plugin-react": "^7.32.2", - "rollup": "^3.17.3", + "rollup": "^3.20.1", "rollup-plugin-esbuild": "^5.0.0", "typescript": "^4.9.5", - "vendetta-types": "^2.3.16" + "vendetta-types": "^2.4.0" }, "dependencies": { "@swc/helpers": "^0.4.14" diff --git a/plugins/HideGiftButton/src/index.ts b/plugins/HideGiftButton/src/index.ts index 33e61e5..6f304f2 100644 --- a/plugins/HideGiftButton/src/index.ts +++ b/plugins/HideGiftButton/src/index.ts @@ -1,7 +1,7 @@ import { logger } from "@vendetta"; -import { find } from "@vendetta/metro"; +import { findByName } from "@vendetta/metro"; -const ChatInput = find((m) => typeof m?.defaultProps?.hideGiftButton === "boolean"); +const ChatInput = findByName("ChatInput"); export default new class HideGiftButton { origState: boolean;