From 1ac2359e910f05351d14e74f293d650e14224b23 Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:50:46 +0800 Subject: [PATCH] Fix windowObject --- packages/bunny-types/def.tt | 6 ++- packages/bunny-types/package.json | 2 +- src/lib/api/native/index.ts | 3 +- src/lib/windowObject.ts | 75 ++++++++++++++++++------------- 4 files changed, 52 insertions(+), 34 deletions(-) diff --git a/packages/bunny-types/def.tt b/packages/bunny-types/def.tt index 2700c3a..a09596b 100644 --- a/packages/bunny-types/def.tt +++ b/packages/bunny-types/def.tt @@ -4,7 +4,11 @@ @bunny from BunnyObject { api { commands - native + native { + fs + modules + loader + } storage assets patcher diff --git a/packages/bunny-types/package.json b/packages/bunny-types/package.json index e8ddaa3..9596623 100644 --- a/packages/bunny-types/package.json +++ b/packages/bunny-types/package.json @@ -1,6 +1,6 @@ { "name": "bunny-types", - "version": "0.0.2", + "version": "0.0.3", "description": "Types for Bunny, a mod for Discord's mobile apps", "author": "pylixonly", "publishConfig": { diff --git a/src/lib/api/native/index.ts b/src/lib/api/native/index.ts index e168b1e..717425f 100644 --- a/src/lib/api/native/index.ts +++ b/src/lib/api/native/index.ts @@ -1,2 +1,3 @@ export * as fs from "./fs"; -export * as modules from "./modules"; \ No newline at end of file +export * as modules from "./modules"; +export * as loader from "./loader"; diff --git a/src/lib/windowObject.ts b/src/lib/windowObject.ts index 41bff1c..207d611 100644 --- a/src/lib/windowObject.ts +++ b/src/lib/windowObject.ts @@ -1,41 +1,57 @@ import { createVendettaObject } from "../core/vendettaObject"; -import * as constants from "@lib/utils/constants"; -import * as native from "@lib/api/native"; -import * as plugins from "@lib/managers/plugins"; -import * as themes from "@lib/managers/themes"; -import * as commands from "@/lib/api/commands"; -import * as storage from "@/lib/api/storage"; -import * as common from "@metro/common"; -import * as components from "@ui/components"; -import * as toasts from "@ui/toasts"; -import * as alerts from "@ui/alerts"; -import * as assets from "@/lib/api/assets"; -import * as color from "@ui/color"; -import logger from "./utils/logger"; -import patcher from "./api/patcher"; import * as api from "@lib/api"; -import * as managers from "@lib/api"; +import * as debug from "@lib/debug"; +import * as managers from "@lib/managers"; import * as metro from "@lib/metro"; +import * as settings from "@lib/settings"; import * as ui from "@lib/ui"; import * as utils from "@lib/utils"; -import * as debug from "@lib/debug"; -import * as settings from "@lib/settings"; -function createBunnyObject(unloads: any[]) { +import patcher from "@lib/api/patcher"; + +// You may now worry about my mental state. +function createBunnyObject(unloads: any[]) { return { api: { - commands: { ...commands }, - native: { ...native }, - storage: { ...storage }, - assets: { ...assets }, - patcher: { ...patcher } + commands: { ...api.commands }, + native: { + fs: { ...api.native.fs }, + modules: { ...api.native.modules }, + loader: { ...api.native.loader } + }, + storage: { ...api.storage }, + assets: { ...api.assets }, + patcher: { + before: patcher.before, + instead: patcher.instead, + after: patcher.after + } + }, + managers: { + plugins: { ...managers.plugins }, + themes: { ...managers.themes } + }, + metro: { + common: { ...metro.common }, + filters: { ...metro.filters }, + ...metro.filters + }, + ui: { + components: { ...ui.components }, + alerts: { ...ui.alerts }, + color: { ...ui.color }, + toasts: { ...ui.toasts }, + }, + utils: { + constants: { ...utils.constants }, + types: { ...utils.types }, + logger: { ...utils.logger } + }, + settings: { + settings: settings.settings, + loaderConfig: { ...settings.loaderConfig } }, - managers: { ...managers }, - metro: { ...metro }, - ui: { ...ui }, - utils: { ...utils }, - settings, version: debug.versionHash, unload: () => { unloads.filter(i => typeof i === "function").forEach(p => p()); @@ -45,9 +61,6 @@ function createBunnyObject(unloads: any[]) { } } -const dest = { ...api }; -type Y = typeof dest; - export type BunnyObject = ReturnType; export default function initWindowObject(unloads: any[]) {