Commit graph

30 commits

Author SHA1 Message Date
PalmDevs
9258695ec7
feat(lib/modules/finders)!: initialized boolean for filter predicates + remove FilterFlag and weird assumptions + fix partial matches causing modules skip in lookup 2026-08-12 01:12:48 +07:00
PalmDevs
9a10e9d509
fix(lib/modules): don't make assumptions about what consumers are filtering 2026-08-02 16:57:18 +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
d8d85cfab1
fix(lib/modules/metro/runtime): add flag once importedAll or importedDefault exports cached 2025-09-16 01:02:16 +07:00
PalmDevs
d5a7ab6d7b
fix(lib/modules/finders): early return if non-dynamic filter used on uninitialized module 2025-09-04 01:29:17 +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
63fd1938cf
feat(lib/modules): micro-optimizations + logic fixes
FIXES:
- `getInitializedModuleExports` now returns `undefined` correctly on uninitialized modules instead of empty objects.
- `NotFoundResult` for lookups is now a frozen array
- `lookupModuleByImportedPath` now returns `LookupNotFoundResult` as a union instead of `[]`

PERFORMANCE:
- Optimized Array checks with `byDependencies` filter
- Micro-optimized finders and filters
- `ModuleDefinition`s no longer allocate their `Module` object immediately after defined
2025-08-22 02:32:07 +07:00
PalmDevs
79ce47c2bc
feat(lib/modules/metro): use Map for storing module dependencies for quicker access, rename file 2025-07-17 16:55:08 +07:00
PalmDevs
874c074f1e
fix(lib/modules/finders): only run filter again if module is not blacklisted 2025-07-13 19:20:07 +07:00
PalmDevs
4b2a612374
chore(lib/utils): do not pluralize submodules 2025-07-11 17:33:06 +07:00
PalmDevs
fe97059933
feat(lib/modules): cache blacklisted modules 2025-07-11 17:15:49 +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
075f33f6c6
chore: cleanup 2025-07-05 13:56:52 +07:00
PalmDevs
c067dc520d
fix(lib/modules/finders): correct filtering logic for prod builds 2025-07-04 22:14:42 +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
981e9dc080
feat(lib/modules): initial impl of modules caching
- Lookup caches have been fully implemented
- Wait caches will not exist
  - Wait APIs should simply wait until a matching module is initialized. Caching is useless when the API is for this purpose.
- Get APIs will inherit the benefits from using Lookup APIs
2025-06-16 20:25:45 +07:00
PalmDevs
2b905801c3
chore: format 2025-06-03 16:24:58 +07:00
PalmDevs
bea3439c5e
fix(lib): refactor modules, react, utils 2025-05-09 21:21:06 +07:00
PalmDevs
6407b0518f
fix: optimize typechecking performance 2025-05-07 17:34:19 +07:00
PalmDevs
384f669c68
feat(lib/modules/finders)!: check namespace before default exports, improve performance marginally 2025-05-01 00:18:42 +07:00
PalmDevs
b785bc574a
feat(lib/modules/finders)!: make filters work with returning CJS modules 2025-04-30 23:46:21 +07:00
PalmDevs
ede2a582a0
chore: remove unnecessary returns and blocks 2025-04-30 18:53:41 +07:00
PalmDevs
20af127254
fix(lib)!: move modules/native/discord and its types to discord/native 2025-04-29 18:41:22 +07:00
PalmDevs
727afef487
fix(lib/modules): only do hot blacklisting, fix bad module checks 2025-04-27 14:42:24 +07:00
PalmDevs
af23c2352e
feat(lib/modules/finders)!: add ability to use finders with blacklisted modules, add isModuleInitialized Metro util, added and changed filters 2025-04-16 14:23:48 +07:00
PalmDevs
f9c048b623
feat(lib/modules): export metro, fix finders result checks, refactor filters to use creator function, add loose dependency checks 2025-04-10 02:06:43 +07:00
PalmDevs
e5178632ba
feat(lib/modules/finders)!: refactor, fix find bugs, add more lookup shorthands, add moduleStateAware filter 2025-04-09 03:42:06 +07:00
PalmDevs
ee31884246
fix: revert a few changes that broke building 2025-04-05 23:35:01 +07:00
PalmDevs
f15c3d38db
feat(lib/modules)!: refactor finders and metro APIs 2025-04-05 20:52:09 +07:00
PalmDevs
d92898ccc8
feat(lib): initial implementation of @revenge-mod/modules 2025-03-30 23:32:17 +07:00