diff --git a/.gitignore b/.gitignore index adc4bff..0ab8579 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules/ dist/ pnpm-lock.yaml yarn.lock -package-lock.json \ No newline at end of file +package-lock.json +RichPresence diff --git a/build.mjs b/build.mjs index 2fe6f8c..c70acf2 100644 --- a/build.mjs +++ b/build.mjs @@ -5,7 +5,7 @@ import { createHash } from "crypto"; import { readdirSync, readFileSync, writeFileSync } from "fs"; import { argv } from "process"; import { rollup, watch } from "rollup"; -import esbuild from "rollup-plugin-esbuild"; +import { swc } from "rollup-plugin-swc3"; const args = argv.slice(2); console.clear(); @@ -69,12 +69,14 @@ async function buildPlugin(plugin) { plugins: [ nodeResolve(), commonjs(), - esbuild({ - target: "esnext", - supported: { - "arrow": false, // arrows are supported but not with async await - "class": false, - "bigint": false, + swc({ + env: { + targets: "defaults", + include: [ + "transform-classes", + "transform-arrow-functions", + ], + minify: {} }, minify: true, }) diff --git a/package.json b/package.json index 9c6c7c0..f0ec976 100644 --- a/package.json +++ b/package.json @@ -6,16 +6,16 @@ "devDependencies": { "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-node-resolve": "^15.0.1", + "@swc/core": "^1.3.36", "@types/react": "^18.0.28", "@types/react-native": "^0.70.11", - "@typescript-eslint/eslint-plugin": "^5.52.0", - "@typescript-eslint/parser": "^5.52.0", - "esbuild": "^0.16.17", - "eslint": "^8.34.0", + "@typescript-eslint/eslint-plugin": "^5.53.0", + "@typescript-eslint/parser": "^5.53.0", + "eslint": "^8.35.0", "eslint-plugin-react": "^7.32.2", - "rollup": "^3.15.0", - "rollup-plugin-esbuild": "^5.0.0", + "rollup": "^3.17.3", + "rollup-plugin-swc3": "^0.8.0", "typescript": "^4.9.5", - "vendetta-types": "^2.3.6" + "vendetta-types": "^2.3.16" } } diff --git a/plugins/HideGiftButton/src/index.ts b/plugins/HideGiftButton/src/index.ts index 80df01e..bc9119c 100644 --- a/plugins/HideGiftButton/src/index.ts +++ b/plugins/HideGiftButton/src/index.ts @@ -4,14 +4,15 @@ import { findByDisplayName } from "@vendetta/metro"; let origState: boolean; const ChatInput = findByDisplayName("ChatInput"); -export default { - onLoad: () => { +export default class HideGiftButton { + onLoad() { logger.log("Starting HideGiftButton..."); origState = ChatInput.defaultProps.hideGiftButton; ChatInput.defaultProps.hideGiftButton = true; - }, - onUnload: () => { + } + onUnload() { logger.log("Unloading HideGiftButton.."); ChatInput.defaultProps.hideGiftButton = origState; } -}; +} + diff --git a/plugins/Last.fm/src/index.ts b/plugins/Last.fm/src/index.ts index b579eb3..a6d46cd 100644 --- a/plugins/Last.fm/src/index.ts +++ b/plugins/Last.fm/src/index.ts @@ -21,8 +21,8 @@ export const SET_ACTIVITY = findByProps("SET_ACTIVITY").SET_ACTIVITY; export const verboseLog = (...message: any) => currentSettings.verboseLogging && console.log(...message); // Plugin entry point -export default { - onLoad: () => { +export default class LastFM { + onLoad() { console.log("Starting last.fm plugin.."); global.pluginStopped = false; @@ -34,12 +34,15 @@ export default { FluxDispatcher.subscribe("CONNECTION_OPEN", () => { initialize().catch(console.error); }); - }, - onUnload: () => { + } + + onUnload() { console.log("Stopping last.fm..."); global.pluginStopped = true; flush(); - }, - settings: Settings -}; + } + + settings = Settings; +} + diff --git a/plugins/MoreConfirm/src/index.ts b/plugins/MoreConfirm/src/index.ts index b48eedf..5c892ec 100644 --- a/plugins/MoreConfirm/src/index.ts +++ b/plugins/MoreConfirm/src/index.ts @@ -23,8 +23,8 @@ import { findByProps } from "@vendetta/metro"; const dialog = findByProps("show", "confirm", "close"); const CallManager = findByProps("handleStartCall"); -export default { - onLoad: () => { +export default class MoreConfirm { + onLoad() { // Patch voice/video calls logger.log("MoreConfirm: patching calls..."); @@ -49,4 +49,4 @@ export default { }); }); } -}; +} diff --git a/plugins/NoIdle/src/index.ts b/plugins/NoIdle/src/index.ts index c261aff..e8ae102 100644 --- a/plugins/NoIdle/src/index.ts +++ b/plugins/NoIdle/src/index.ts @@ -3,8 +3,8 @@ import { FluxDispatcher } from "@vendetta/metro/common"; let unpatch: () => void; -export default { - onLoad: () => { +export default class NoIdle { + onLoad() { logger.log("Starting NoIdle..."); unpatch = patcher.before("dispatch", FluxDispatcher, ([{ type }]) => { @@ -12,9 +12,10 @@ export default { return [{ type: "IDLE", idle: false }]; }); - }, - onUnload: () => { + } + onUnload() { logger.log("Disabling NoIdle.."); unpatch?.(); } -}; +} +