revenge-bundle-next/src/plugins/logging/index.ts
PalmDevs a43cd5d564
feat!: plugins page, tons of API changes, and bug fixes
Plugins
- Settings: Plugins page is now semi-functional
- No Track: Added new plugin
- Developer Settings: Clean up properly
- Logging: Log in preInit stage
- Staff Settings: Add ReloadRequired flags when late-running

@revenge-mod/init
- Moved to the top-level src/index.ts instead

@revenge-mod/modules
- Switch `exports` and `id` parameters in finders APIs
- Lookups now return an array of exports and ID instead of just exports
  - Lookup ID APIs have been removed
- Add `finders.get` helper, a new alternative for `finders.find`
- Corrected documentation for subscription APIs

@revenge-mod/plugins
- Added new APIs for plugins to allow running during pre-init stages
- Added `unscoped.modules.finders.get*`
- Added `unscoped.react.native`

@revenge-mod/react
- native: Added `onRunApplication` and `onRunApplicationFinished`

@revenge-mod/utils
- callbacks: Add `noopFalse`
- promises: Fix `allSettled`
- promises: Add `sleep`
2025-05-18 22:24:48 +07:00

38 lines
1.2 KiB
TypeScript

import { AppStartPerformance } from '@revenge-mod/discord/preinit'
import { PluginFlags } from '@revenge-mod/plugins/constants'
import { InternalPluginFlags, registerPlugin } from '@revenge-mod/plugins/_'
AppStartPerformance.mark('👊', 'Plugins register')
const tsReg = performance.now()
let tsPreInit: number
let tsInit: number
registerPlugin(
{
id: 'revenge.logging',
name: 'Logging',
description: "Extra logging for Revenge's internal modules",
author: 'Revenge',
icon: 'PaperIcon',
},
{
preInit() {
tsPreInit = performance.now()
AppStartPerformance.mark('👊', 'Plugins preInit', tsPreInit - tsReg)
},
init() {
tsInit = performance.now()
AppStartPerformance.mark('👊', 'Plugins init', tsInit - tsPreInit)
},
start({ logger }) {
AppStartPerformance.mark('👊', 'Plugins start', performance.now() - tsInit)
logger.log(
`👊 Revenge. Discord, your way. (${__BUILD_VERSION__}-${__BUILD_COMMIT__}-${__BUILD_BRANCH__} (${__BUILD_ENV__}))`,
)
},
},
PluginFlags.Enabled,
InternalPluginFlags.Internal,
)