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
Add parcel-query function to locate a symbol by local name #8452
Conversation
Benchmark ResultsKitchen Sink ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
React HackerNews ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. AtlasKit Editor ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. |
|
||
// If the asset couldn't be found by searching for the id, | ||
// search for the local name in asset used symbols. | ||
if (asset == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you actually run into such a case? I can't think of a situation where the first search would fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right that this shouldn't be possible, but if there is an undefined symbol at runtime (due to a bug in Parcel), it likely won't be discoverable via the asset graph, but might still be discoverable in used symbols. (I have one such case that I am investigating and can share).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the case i mentioned: #8468
First pass optimistically looks for a matching id. Second pass will examine asset symbols, which could be much slower if there are a lot of assets and symbols.
2408949
to
518a398
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is super useful in debugging issues that manifest as missing symbol (even if its not a Parcel bug, but a user's mishap)
Based on the output for
findAsset
.Some examples of how it works:
An imported symbol:
A declared symbol: