-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(Webpack): Immediate finds using waitFor #2409
Open
Nuckyz
wants to merge
178
commits into
dev
Choose a base branch
from
immediate-finds
base: dev
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Documented the changes |
…f lazy extractAndLoadChunks
…gins; Fix running in wrong pages
This reverts commit a1e72e7.
Nuckyz
referenced
this pull request
Jun 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Completely deprecates the
lazy
way that we currently do Webpack finds. Instead, now the default will be a unified way which is a combination of the plaincacheFind
for already loaded modules, and usage ofwaitFor
for when modules were not yet loaded.The way this works is:
waitFor
alternative. By using waitFor, everytime a new module is loaded, Vencord will check if that module matches any of the finds requested, and if it does, it sets the result of that find to the module. This avoids having to iterate through the module cache for every find.By having the unified way, we no longer need a lazy alternative of the methods, so the following changes to the API occurred:
find
->cacheFind
find
(wrapper aroundwaitFor
andcacheFind
)findLazy
->find
(the wrapper)findByProps
,findByPropsLazy
->findByProps
findByCode
,findByCodeLazy
->findByCode
findStore
,findStoreLazy
->findStore
findComponent
,findComponentLazy
->findComponent
findExportedComponent
,findExportedComponentLazy
->findExportedComponent
findComponentByCode
,findComponentByCodeLazy
->findComponentByCode
The following were changed for more appropriate names:
findAll
->cacheFindAll
findBulk
->cacheFindBulk
The following were changed for less weird names:
proxyLazyWebpack
->webpackDependantLazy
LazyComponentWebpack
->webpackDependantLazyComponent
The following were not changed:
findModuleId
findModuleFactory
cacheFindAll
andfilters
internally, so it doesn't rely on the way the old methods worked.Additional:
Warning
These are the files that the most changes were introduced: webpack.tsx, lazy.ts, lazyReact.tsx, proxyInner.ts, generateReport.ts and the commons in webpack
The rest is mainly just changing to use the new methods instead of the deprecated ones
Important
This change is fully backwards compatible for now, as the old methods were kept and just point to the new APIs now.
The plan is to remove them in the future.