[Utils] Reorganise
This commit is contained in:
parent
2a50814721
commit
119060a43b
4 changed files with 12 additions and 12 deletions
1
src/def.d.ts
vendored
1
src/def.d.ts
vendored
|
@ -235,6 +235,7 @@ interface VendettaObject {
|
|||
copyText: (content: string) => void;
|
||||
findInReactTree: (tree: { [key: string]: any }, filter: SearchFilter) => void;
|
||||
findInTree: (tree: { [key: string]: any }, filter: SearchFilter, options: FindInTreeOptions) => any;
|
||||
safeFetch: (input: RequestInfo, options: RequestInit) => Promise<Response>;
|
||||
unfreeze: (obj: object) => object;
|
||||
};
|
||||
debug: {
|
||||
|
|
6
src/lib/utils/index.ts
Normal file
6
src/lib/utils/index.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
// Makes mass-importing utils cleaner, chosen over moving utils to one file
|
||||
export { default as copyText } from "@utils/copyText";
|
||||
export { default as findInReactTree } from "@utils/findInReactTree";
|
||||
export { default as findInTree } from "@utils/findInTree";
|
||||
export { default as safeFetch } from "@utils/safeFetch";
|
||||
export { default as unfreeze } from "@utils/unfreeze";
|
|
@ -2,10 +2,6 @@ import { VendettaObject } from "@types";
|
|||
import patcher from "@lib/patcher";
|
||||
import logger from "@lib/logger";
|
||||
import settings from "@lib/settings";
|
||||
import copyText from "@utils/copyText";
|
||||
import findInReactTree from "@utils/findInReactTree";
|
||||
import findInTree from "@utils/findInTree";
|
||||
import unfreeze from "@utils/unfreeze";
|
||||
import * as constants from "@lib/constants";
|
||||
import * as debug from "@lib/debug";
|
||||
import * as plugins from "@lib/plugins";
|
||||
|
@ -16,6 +12,7 @@ import * as common from "@metro/common";
|
|||
import * as components from "@ui/components";
|
||||
import * as toasts from "@ui/toasts";
|
||||
import * as assets from "@ui/assets";
|
||||
import * as utils from "@utils";
|
||||
|
||||
function without<T extends Record<string, any>>(object: T, ...keys: string[]) {
|
||||
const cloned = { ...object };
|
||||
|
@ -28,13 +25,8 @@ export default async function windowObject(unloads: any[]): Promise<VendettaObje
|
|||
return {
|
||||
patcher: without(patcher, "unpatchAll"),
|
||||
metro: { ...metro, common: { ...common } },
|
||||
constants: { ...constants },
|
||||
utils: {
|
||||
copyText,
|
||||
findInReactTree,
|
||||
findInTree,
|
||||
unfreeze,
|
||||
},
|
||||
constants,
|
||||
utils,
|
||||
debug: without(debug, "versionHash", "patchLogHook"),
|
||||
ui: {
|
||||
components,
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
"@/*": ["src/*"],
|
||||
"@types": ["src/def.d.ts"],
|
||||
"@lib/*": ["src/lib/*"],
|
||||
"@metro/*": ["src/lib/metro/*"],
|
||||
"@utils": ["src/lib/utils/index.ts"],
|
||||
"@utils/*": ["src/lib/utils/*"],
|
||||
"@metro/*": ["src/lib/metro/*"],
|
||||
"@ui/*": ["src/ui/*"]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue