You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re-implements the perf wins from PR #445 (constant-shape ResolveRequest
objects so V8 keeps a single hidden class on the resolver hot path)
without the breaking change for plugin authors that attach custom
properties directly to a request.
Each plugin now builds the new ResolveRequest as an explicit object
literal in a fixed property order. A new lib/util/cloneRequest.js
helper exports copyExtras(target, source) which copies any
non-canonical own string keys plus any symbol keys from the source
request, preserving the historical behavior of { ...request, ... }
for callers that pass through values via custom keys (e.g. webpack's
ResolverCachePlugin).
ParsePlugin keeps its public (source, requestOptions, target)
constructor; the partial overrides are applied via Object.assign
after the canonical literal so the { fullySpecified } use case used
by ResolverFactory does not transition the hidden class. MainFieldPlugin
keeps its alreadyTriedMainField Symbol-based recursion guard, set
after copyExtras so the current attempt's value always wins.
Adds a regression test in test/plugins.test.js that taps the resolve
hook to attach both a string-keyed and a Symbol-keyed property and
asserts both survive through the plugin chain to hooks.result.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.66%. Comparing base (42b6620) to head (9d3549d). ⚠️ Report is 1 commits behind head on main.
Merging this PR will degrade performance by 44.79%
⚠️Different runtime environments detected
Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.
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
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.
Re-implements the perf wins from PR #445 (constant-shape ResolveRequest
objects so V8 keeps a single hidden class on the resolver hot path)
without the breaking change for plugin authors that attach custom
properties directly to a request.
Each plugin now builds the new ResolveRequest as an explicit object
literal in a fixed property order. A new
lib/util/cloneRequest.jshelper exports
copyExtras(target, source)which copies anynon-canonical own string keys plus any symbol keys from the source
request, preserving the historical behavior of
{ ...request, ... }for callers that pass through values via custom keys (e.g. webpack's
ResolverCachePlugin).
ParsePlugin keeps its public
(source, requestOptions, target)constructor; the partial overrides are applied via
Object.assignafter the canonical literal so the
{ fullySpecified }use case usedby ResolverFactory does not transition the hidden class. MainFieldPlugin
keeps its
alreadyTriedMainFieldSymbol-based recursion guard, setafter
copyExtrasso the current attempt's value always wins.Adds a regression test in
test/plugins.test.jsthat taps the resolvehook to attach both a string-keyed and a Symbol-keyed property and
asserts both survive through the plugin chain to
hooks.result.