Commit graph

97 commits

Author SHA1 Message Date
PalmDevs
c49f3eb471
fix(lib/discord/common)!: split to own submodules + don't restrict everything to init+ 2026-07-31 14:51:15 +07:00
PalmDevs
1c58b7a5a1
chore: use AnyFunction from lib everywhere 2026-07-31 02:38:45 +07:00
PalmDevs
10371ff000
fix: settings UI refreshing 2026-07-31 02:38:41 +07:00
PalmDevs
49c1b1e68d
fix(lib/utils/object): lazy properties shouldn't delete itself when loader errors 2026-07-29 21:48:15 +07:00
PalmDevs
70dd0501fe
fix(lib/utils/object): incorrect lazy values debug logic for lazyPropDesc 2026-06-13 01:30:14 +07:00
PalmDevs
5c892bb8a1
fix(lib/plugins/apis): set most APIs during pre-init phase 2026-04-07 22:03:13 +07:00
PalmDevs
b6d1cff9f5
feat(lib/modules)!: filter scopes + fixes and improvements
# Features

- Filters now control what types of modules they see.
- Filters can be reinstantiated via `.new()`
- Added the `Not` type in @revenge-mod/utils/types

# Fixes

- Pitfall with `lookupModules` and `withDependencies` without `uninitialize: true` fixed.
- Filter type-metadata is now stored in a single object instead of multiple parameters.
- Incorrect caching behavior for `lookupModules` where cache always reports not found if you finish the iterator.
- Also attempt to report not found when using `lookupModule`.
2025-10-28 01:01:17 +07:00
PalmDevs
a2f330e7e2
chore: remove #lib syntax
Autocomplete is annoying.
2025-10-22 22:24:26 +07:00
PalmDevs
d44ec8fd6d
feat(lib/utils/object): add cloneDeep 2025-10-22 22:18:33 +07:00
PalmDevs
fbf2396d94
feat: catch and report fatal initialization errors 2025-10-17 15:49:50 +07:00
PalmDevs
349c23eced
fix: correct misleading terms 2025-09-17 17:14:22 +07:00
PalmDevs
790c30a6d5
fix: debug build flags 2025-09-04 01:29:18 +07:00
Palm
5f5fc6f2b2
feat!: module finders refactor (#6)
- Renamed `byX` filters to `withX`.
  It is more correct. For example: You don't lookup, wait for, or get modules **BY** props. You lookup, wait for, and get modules **WITH** props.
- Renamed `*byImportedPath` to `*withImportedPath`
  For consistency with the above change.
- Renamed `getModule` to `getModules`.
  The API allows getting multiple modules and not just a single one. Types are renamed as well.
  `getModuleByImportedPath` remains the same as it only gets one single module with a unique imported path.
- `withX` filter **helpers** removed.
  They can now be replaced with the new capability-based `and` filter.
- `preferExports` and `moduleStateAware` filters removed.
  They can now be replaced with the new capability-based `and` filter.
- Composite finders renamed.
  `some` -> `or`, `every` -> `and`
- Composite finders takes a capability-based approach.
- Filter generators now need to attach runtime flag to let the system know whether the generated filter can be used to filter modules without proper exports or not.

## Misc.

- Removed useless unsub call in Profile Badges
- Use `queueMicrotask` with `asap`

# Features

## Capability-based approach to composite filters

```js
// Old
byProps(...).withDependencies(...)
// Old, same as: preferExports(byProps(...), byDependencies(...))
every(byDependencies(...), byProps(...))
// Old, ordering matters, this would fail unexpectedly!
every(byProps(...), byDependencies(...))

// New
withProps(...).and(withDependencies(...))
// New (as well), ordering doesn't matter, this has the same result as above
withDependencies(...).and(withProps(...))
```
2025-08-30 09:19:57 +07:00
PalmDevs
c33086435e
feat(lib/modules/finders/filters): deprecate undefined and allow null in byDependencies
`null` is more correct semantically (and also shorter to type). `undefined` should only be module IDs that cannot be found, in which case, a warning log has been added.
2025-08-25 21:22:06 +07:00
PalmDevs
d5941354fa
fix(lib/utils/proxy): update types and documentation for destructure 2025-08-25 19:03:00 +07:00
PalmDevs
c2d12321f6
chore(lib/modules): simplify imports 2025-08-13 01:27:49 +07:00
PalmDevs
7f1b116a63
fix(lib/utils/callback): only use enqueueJob if engine queue is used 2025-08-11 16:49:50 +07:00
PalmDevs
0d1fcb5c2d
feat(lib/utils/proxy)!: return non-proxified value if passed to unproxify 2025-08-04 09:36:11 +07:00
PalmDevs
1598a4940c
chore(lib): use asap function to queue tasks 2025-08-03 14:18:16 +07:00
PalmDevs
f1e94fe634
fix(lib/modules/finders/get): undefined unsub function on immediately found lookup 2025-08-03 14:17:47 +07:00
PalmDevs
7d7d6a4358
feat(lib): small performance improvements 2025-07-27 17:07:50 +07:00
PalmDevs
b81344f1d1
fix(lib/utils/proxy): attempt to use HermesInternal.enqueueJob to delay call with DEBUG_PROXIFIED_VALUES build flag 2025-07-26 12:37:58 +07:00
PalmDevs
7ecce136a8
chore: remove useless Object.freeze patch 2025-07-26 12:13:33 +07:00
PalmDevs
282685aabb
fix(lib/utils/discord): return early if unregistered asset used in lookupIconComponent 2025-07-23 17:14:24 +07:00
PalmDevs
3c6aa155ca
feat(lib): switch to typeof for better performance 2025-07-22 19:00:20 +07:00
PalmDevs
2e455cf2c5
feat: add ability to decorate plugin APIs, move private properties to WeakMap stores 2025-07-20 23:06:56 +07:00
PalmDevs
c1f56c7e60
feat(lib/utils/proxy): switch to objects for storage 2025-07-18 23:44:16 +07:00
PalmDevs
4670dc0451
feat(lib/utils/discord): change lookupGeneratedIconComponent to use a proper filter 2025-07-18 02:04:01 +07:00
PalmDevs
bcb82e1f4f
chore: format 2025-07-17 16:55:23 +07:00
PalmDevs
188e88ae47
fix(lib/utils/proxy): with DBEUG_PROXIFIED_VALUES flag, run factory on next event loop if possible
Prevents an edge case where `proxify` with a cleanup causes subsequent `destructure` calls to error because the assigned value is no longer a proxified value.

See ./lib/externals/src/react-native-clipboard.ts for reference.
2025-07-14 10:02:17 +07:00
PalmDevs
e48e45226f
fix(utils/proxy): accept nested options in destructure 2025-07-14 09:53:06 +07:00
PalmDevs
996e4f5994
fix(lib/utils/proxy)!: disallow passing type-strings to ProxifyOptions.hint 2025-07-13 19:18:41 +07:00
PalmDevs
6a38136762
fix(lib)!: breaking changes
- Remove `noopFalse` from `@revenge-mod/utils/callback`
- Do not return result from unpatch/undo/unsub functions
- `onSettingsModulesLoaded` from `@revenge-mod/discord/modules/settings` now calls the callback immediately if settings modules are already loaded instead of throwing
2025-07-13 15:53:44 +07:00
PalmDevs
0746db3648
chore(lib/plugins): move utils assignments to own lib 2025-07-11 17:55:54 +07:00
PalmDevs
4b2a612374
chore(lib/utils): do not pluralize submodules 2025-07-11 17:33:06 +07:00
PalmDevs
a2c97abd3b
feat(lib/utils/objects): export original Object.freeze 2025-07-11 17:16:33 +07:00
PalmDevs
8bd9f4f8b2
fix(lib/storage): allow imports during preinit 2025-07-11 16:58:53 +07:00
PalmDevs
c66dace21b
chore: cleanup questionable code 2025-07-11 15:53:12 +07:00
PalmDevs
2b05b34a28
chore: lint and format 2025-07-11 01:15:50 +07:00
PalmDevs
9e6614a1bd
chore: lint and format 2025-07-10 21:26:27 +07:00
PalmDevs
78e8a96034
fix(lib/react)!: ReactJsxRuntime -> ReactJSXRuntime
JSX is JavaScript XML, which should be capitalized
2025-07-10 21:23:39 +07:00
PalmDevs
84c6edcfe2
fix: revert using Object.defineProperty instead of delete
Apparently it's somewhat faster to `delete` and set, than to use Object.defineProperty
2025-07-10 12:43:05 +07:00
PalmDevs
aacb038d09
fix(lib/utils/objects): use Object.defineProperty instead of delete 2025-07-09 19:09:05 +07:00
PalmDevs
7645bfdf61
chore: new DEBUG_WAITS build flag, improve DBEUG_LOOKUPS build flag logs, other dev env fixes 2025-07-08 11:24:48 +07:00
PalmDevs
e9fedc8db4
feat: small performance wins
- Delay initializing unimportant parts until index module (ID 0) is required
- Lower memory usage by interacting with Metro's internal module list directly
2025-07-07 20:00:20 +07:00
PalmDevs
2cff8ebf07
feat(lib/modules)!: add new options for lookup finders, include prefix from finders options, make utils functions safe again 2025-07-04 21:38:37 +07:00
PalmDevs
e714960335
fix(lib): fix type errors 2025-07-01 17:30:53 +07:00
PalmDevs
77f8d62720
fix: improve perf by not returning implicitly 2025-06-17 19:53:58 +07:00
PalmDevs
87521ddd5e
feat(lib/utils/objects): add defineLazyProperties 2025-06-16 08:59:33 +07:00
PalmDevs
8851f6867b
fix(scripts/build): turn on DEBUG_MODULE_LOOKUPS build flag if dev build 2025-06-15 17:57:55 +07:00