Skip to content

Commit

Permalink
fix(libraries): remove @revenge-mod/debug
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmDevs committed Jan 11, 2025
1 parent a0ccca0 commit c5fc531
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 128 deletions.
1 change: 0 additions & 1 deletion libraries/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
".": "./src/index.tsx"
},
"dependencies": {
"@revenge-mod/debug": "workspace:*",
"@revenge-mod/modules": "workspace:*",
"@revenge-mod/patcher": "workspace:*",
"@revenge-mod/utils": "workspace:*"
Expand Down
9 changes: 0 additions & 9 deletions libraries/app/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { recordTimestamp } from '@revenge-mod/debug'
import { React, ReactNative } from '@revenge-mod/modules/common'
import { findByName } from '@revenge-mod/modules/finders'
import { BundleUpdaterManager } from '@revenge-mod/modules/native'
Expand Down Expand Up @@ -38,12 +37,8 @@ const unpatchRunApplication = patcher.after(
() => {
unpatchRunApplication()

recordTimestamp('App_RunApplicationCalled')
logger.log('AppRegistry.runApplication called')

for (const callback of initializeCallbacks) callback()

recordTimestamp('App_AfterRunRACallbacks')
logger.log('Initialized callbacks called')
},
'runInitializeCallbacks',
Expand All @@ -55,12 +50,8 @@ const unpatchCreateElement = patcher.after(
() => {
unpatchCreateElement()

recordTimestamp('App_CreateElementCalled')
logger.log('React.createElement called')

for (const callback of renderCallbacks) callback()

recordTimestamp('App_AfterRunCECallbacks')
logger.log('Rendered callbacks called')
},
'runRenderCallbacks',
Expand Down
8 changes: 0 additions & 8 deletions libraries/debug/package.json

This file was deleted.

30 changes: 0 additions & 30 deletions libraries/debug/src/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion libraries/modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"./native": "./src/native/index.ts"
},
"dependencies": {
"@revenge-mod/debug": "workspace:*",
"@revenge-mod/utils": "workspace:*"
},
"devDependencies": {
Expand Down
11 changes: 1 addition & 10 deletions libraries/modules/src/metro/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { recordTimestamp } from '@revenge-mod/debug'

import {
IndexMetroModuleId,
MetroModuleFlags,
Expand Down Expand Up @@ -121,7 +119,6 @@ function hookModule(id: Metro.ModuleID, metroModule: Metro.ModuleDefinition) {
*/
export async function initializeModules() {
const cacheRestored = await restoreCache()
recordTimestamp('Modules_TriedRestoreCache')

// Patches modules on load
initializeModulePatches(patcher, logger)
Expand All @@ -141,20 +138,14 @@ export async function initializeModules() {
logger.log('Importing index module...')
// ! Do NOT use requireModule for this
__r(IndexMetroModuleId)
recordTimestamp('Modules_IndexRequired')

for (let next = moduleIds.next(); !next.done; next = moduleIds.next()) {
const id = next.value
if (!moduleShouldNotBeHooked(id)) hookModule(id, modules.get(id)!)
}

recordTimestamp('Modules_HookedFactories')

// Since cold starts are obsolete, we need to manually import all assets to cache their module IDs as they are imported lazily
if (!cacheRestored) {
requireAssetModules()
recordTimestamp('Modules_RequiredAssets')
}
if (!cacheRestored) requireAssetModules()

cache.totalModules = metroDependencies.size
saveCache()
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"dependencies": {
"@revenge-mod/app": "workspace:*",
"@revenge-mod/assets": "workspace:*",
"@revenge-mod/debug": "workspace:*",
"@revenge-mod/keyutil": "https://github.com/revenge-mod/revenge-keyutil#2f5db07",
"@revenge-mod/modules": "workspace:*",
"@revenge-mod/plugins": "workspace:*",
Expand Down
9 changes: 0 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import '@revenge-mod/utils/functions'

import { createLogger } from '@revenge-mod/utils/library'

import { recordTimestamp } from '@revenge-mod/debug'
import { IndexMetroModuleId } from '@revenge-mod/modules/constants'
import { ClientInfoModule } from '@revenge-mod/modules/native'
import { createPatcherInstance } from '@revenge-mod/patcher'
Expand All @@ -15,8 +14,6 @@ Object.freeze = Object.seal = o => o

// ! This function is BLOCKING, so we need to make sure it's as fast as possible
async function initialize() {
recordTimestamp('Init_Initialize')

try {
const { createModulesLibrary } = await import('@revenge-mod/modules')
const ModulesLibraryPromise = createModulesLibrary()
Expand Down Expand Up @@ -56,15 +53,12 @@ async function initialize() {

await import('./plugins')
await registerExternalPlugins()
recordTimestamp('Plugins_Registered')

await awaitStorage(settings, pluginsStates)
recordTimestamp('Storage_Initialized')

// TODO: Safe mode when plugins fail to load
// Maybe put logic in ErrorBoundary
await startPlugins()
recordTimestamp('Plugins_Started')
} catch (e) {
onError(e)
}
Expand Down Expand Up @@ -100,8 +94,6 @@ if (typeof __r !== 'undefined') initialize()

// We hold calls from the native side
function onceIndexRequired() {
recordTimestamp('Native_RequiredIndex')

const batchedBridge = __fbBatchedBridge

const callQueue: any[] = []
Expand All @@ -121,7 +113,6 @@ function onceIndexRequired() {

initialize()
.then(() => {
recordTimestamp('Init_PromiseResolved')
unpatch()
for (const queue of callQueue)
batchedBridge.getCallableModule(queue[0]) && batchedBridge.__callFunction(...queue)
Expand Down
9 changes: 1 addition & 8 deletions src/plugins/developer-settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { registerPlugin } from '@revenge-mod/plugins/internals'
import { sleep } from '@revenge-mod/utils/functions'

import AssetBrowserSettingsPage from './pages/AssetBrowser'
import DebugPerformanceTimesSettingsPage from './pages/DebugPerformanceTimes'
import DeveloperSettingsPage from './pages/Developer'

import { DebuggerContext, connectToDebugger, disconnectFromDebugger } from './debugger'
Expand Down Expand Up @@ -85,19 +84,13 @@ const plugin = registerPlugin<{
},
}),

sui.createRoute('RevengeDebugPerformanceTimes', {
type: 'route',
label: 'Debug Performance Times',
component: DebugPerformanceTimesSettingsPage,
icon: assets.getIndexByName('TimerIcon'),
}),

sui.createRoute('RevengeAssetBrowser', {
type: 'route',
label: 'Asset Browser',
component: AssetBrowserSettingsPage,
icon: assets.getIndexByName('ImageIcon'),
}),

disconnectFromDebugger,
disconnectFromDevTools,
)
Expand Down
45 changes: 0 additions & 45 deletions src/plugins/developer-settings/pages/DebugPerformanceTimes.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ declare module '@revenge-mod/assets' {
export default assets
}

declare module '@revenge-mod/debug' {
const debug: typeof import('./libraries/debug')
export * from './libraries/debug'
export default debug
}

declare module '@revenge-mod/modules' {
const modules: typeof import('./libraries/modules')
export * from './libraries/modules'
Expand Down

0 comments on commit c5fc531

Please sign in to comment.