Commit graph

88 commits

Author SHA1 Message Date
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
PalmDevs
0ad8e79bac
chore(lib/utils): remove generators 2025-06-14 22:09:59 +07:00
PalmDevs
6594fc6fa1
chore(lib/utils): remove logger 2025-06-14 21:48:52 +07:00
PalmDevs
285e87fe1b
feat(lib/utils/callbacks): add noop 2025-06-14 17:54:04 +07:00
PalmDevs
1272ed9e39
chore: remove blocks from arrow functions where not needed 2025-06-14 17:53:28 +07:00
PalmDevs
7953056b94
chore(lib/utils/errors): make getCurrentStack a little more performant 2025-06-13 22:47:28 +07:00
PalmDevs
e57fd88846
chore: add build flag to debug proxified values 2025-06-12 23:24:55 +07:00
PalmDevs
b4923296e5
feat(lib/utils/errors): add getCurrentStack 2025-06-12 23:23:16 +07:00
PalmDevs
38d5aa3833
feat(lib/utils/react): get type from predicate in findInReactFiber 2025-06-10 22:14:26 +07:00
PalmDevs
5ec7e9bf5c
fix(lib/utils/proxy)!: retain function references by default with optional method binding in options 2025-06-10 22:13:08 +07:00