fix: never discover a plugin's dependency, build or asset directories - #372
Merged
Merged
Conversation
A plugin with neither app/ nor src/ was scanned from its root, node_modules included: 2 to 7 s per request in debug mode on a blocks-only plugin with a Vite build.
…ry-legitimate-directories
Merged
This file contains hidden or 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
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.
Problem
A plugin with neither
app/norsrc/was discovered from its root. That is the shape of a plugin that only ships blocks — blocks are registered by convention and need no class — and such a plugin hasnode_modules/at its root as soon as it has a Vite build.Measured on pollora-test (
pollora-blocks-demo, blocks inresources/views/blocks, noapp/): every request loggedPollora discovery scanned …/pollora-blocks-demo in 2168–6985ms, front page at 3–8 s.Change
PluginRegistrar::getPluginDiscoveryPaths()(wasgetPluginDiscoveryPath()):app/, elsesrc/— unchanged;node_modules,vendor,bower_components,build,dist,public,resources,assets,languages,langor a hidden directory. A plugin with classes in e.g.includes/is still discovered; a blocks-only plugin is not scanned at all.Tests
PluginDiscoveryPathTest: other top-level directories scanned; none of the excluded ones ever returned.app/: front page 0.55–0.68 s, no slow-scan warning,pollora-blocks-demo/accordionstill registered.