fix(lib): define lazy properties with arrow functions
This commit is contained in:
parent
0d08d0ad6a
commit
a04cacf9d8
3 changed files with 19 additions and 19 deletions
|
|
@ -1,11 +1,11 @@
|
|||
/** biome-ignore-all lint/complexity/useArrowFunction: Rolldown issue: Bug requires us to use normal functions instead of arrow functions */
|
||||
|
||||
import { _uapi } from '@revenge-mod/plugins/_'
|
||||
import { defineLazyProperty } from '@revenge-mod/utils/objects'
|
||||
import type { UnscopedInitPluginApi } from '@revenge-mod/plugins/types'
|
||||
|
||||
const uapi = _uapi as UnscopedInitPluginApi
|
||||
|
||||
defineLazyProperty(uapi, 'components', function () {
|
||||
return require('./index')
|
||||
// ROLLDOWN ISSUE: Requires us to do () => { return require(...) } instead of () => require(...)
|
||||
|
||||
defineLazyProperty(uapi, 'components', () => {
|
||||
return require('.')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
/** biome-ignore-all lint/complexity/useArrowFunction: Rolldown issue: Bug requires us to use normal functions instead of arrow functions */
|
||||
|
||||
import { _initExts, _uapi } from '@revenge-mod/plugins/_'
|
||||
import { defineLazyProperty } from '@revenge-mod/utils/objects'
|
||||
import { Logger } from './common'
|
||||
|
|
@ -9,30 +7,32 @@ import type { PluginApiDiscord } from './types/revenge'
|
|||
const uapi = _uapi as UnscopedInitPluginApi
|
||||
const discord = (uapi.discord = {} as PluginApiDiscord)
|
||||
|
||||
defineLazyProperty(discord, 'actions', function () {
|
||||
// ROLLDOWN ISSUE: Requires us to do () => { return require(...) } instead of () => require(...)
|
||||
|
||||
defineLazyProperty(discord, 'actions', () => {
|
||||
return require('@revenge-mod/discord/actions')
|
||||
})
|
||||
|
||||
defineLazyProperty(discord, 'common', function () {
|
||||
defineLazyProperty(discord, 'common', () => {
|
||||
return require('@revenge-mod/discord/common')
|
||||
})
|
||||
|
||||
defineLazyProperty(discord, 'design', function () {
|
||||
defineLazyProperty(discord, 'design', () => {
|
||||
return require('@revenge-mod/discord/design')
|
||||
})
|
||||
|
||||
defineLazyProperty(discord, 'native', function () {
|
||||
defineLazyProperty(discord, 'native', () => {
|
||||
return require('@revenge-mod/discord/native')
|
||||
})
|
||||
|
||||
defineLazyProperty(discord, 'modules', function () {
|
||||
defineLazyProperty(discord, 'modules', () => {
|
||||
const modules = {} as PluginApiDiscord.Modules
|
||||
|
||||
defineLazyProperty(modules, 'mainTabsV2', function () {
|
||||
defineLazyProperty(modules, 'mainTabsV2', () => {
|
||||
return require('@revenge-mod/discord/modules/main_tabs_v2')
|
||||
})
|
||||
|
||||
defineLazyProperty(modules, 'settings', function () {
|
||||
defineLazyProperty(modules, 'settings', () => {
|
||||
return {
|
||||
...require('@revenge-mod/discord/modules/settings'),
|
||||
renderer: require('@revenge-mod/discord/modules/settings/renderer'),
|
||||
|
|
|
|||
12
lib/externals/src/init.ts
vendored
12
lib/externals/src/init.ts
vendored
|
|
@ -1,5 +1,3 @@
|
|||
/** biome-ignore-all lint/complexity/useArrowFunction: Rolldown issue: Bug requires us to use normal functions instead of arrow functions */
|
||||
|
||||
import { _uapi } from '@revenge-mod/plugins/_'
|
||||
import { defineLazyProperty } from '@revenge-mod/utils/objects'
|
||||
import type { UnscopedInitPluginApi } from '@revenge-mod/plugins/types'
|
||||
|
|
@ -8,18 +6,20 @@ import type { PluginApiExternals } from './types'
|
|||
const uapi = _uapi as UnscopedInitPluginApi
|
||||
const externals = (uapi.externals = {} as PluginApiExternals)
|
||||
|
||||
defineLazyProperty(externals, 'Browserify', function () {
|
||||
// ROLLDOWN ISSUE: Requires us to do () => { return require(...) } instead of () => require(...)
|
||||
|
||||
defineLazyProperty(externals, 'Browserify', () => {
|
||||
return require('@revenge-mod/externals/browserify')
|
||||
})
|
||||
|
||||
defineLazyProperty(externals, 'ReactNativeClipboard', function () {
|
||||
defineLazyProperty(externals, 'ReactNativeClipboard', () => {
|
||||
return require('@revenge-mod/externals/react-native-clipboard')
|
||||
})
|
||||
|
||||
defineLazyProperty(externals, 'ReactNavigation', function () {
|
||||
defineLazyProperty(externals, 'ReactNavigation', () => {
|
||||
return require('@revenge-mod/externals/react-navigation')
|
||||
})
|
||||
|
||||
defineLazyProperty(externals, 'Shopify', function () {
|
||||
defineLazyProperty(externals, 'Shopify', () => {
|
||||
return require('@revenge-mod/externals/shopify')
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue