Skip to content

feat(profiler): add resolution performance profiler plugin#626

Open
hey-amanthakur wants to merge 1 commit into
webpack:mainfrom
hey-amanthakur:feat/resolution-profiler-proposal
Open

feat(profiler): add resolution performance profiler plugin#626
hey-amanthakur wants to merge 1 commit into
webpack:mainfrom
hey-amanthakur:feat/resolution-profiler-proposal

Conversation

@hey-amanthakur

Copy link
Copy Markdown

Implements the ProfilerPlugin that taps the resolveStep sync hook to record per-hook entry timestamps, maintains a frame stack for duration tracking, and delivers profile data via resolveContext.profile callback or factory-level profileCallback.

The `profile` option is added to ResolverFactory.createResolver options:

  • `profile: true` enables profiling with per-call resolveContext.profile
  • `profile: (data) => {}` enables profiling with a factory-level callback
  • profile is propagated through createInnerContext for nested resolves

Changes:

  • lib/ProfilerPlugin.js: new plugin with frame-stack timing
  • lib/ResolverFactory.js: profile option + wiring
  • lib/Resolver.js: profile field in ResolveContext typedef
  • lib/createInnerContext.js: propagate profile to inner context
  • lib/index.js: export ProfilerPlugin via lazy getter
  • types.d.ts: ProfileData, ProfileHookEntry, ProfilerPlugin types
  • test/profiler.test.js: 6 tests covering all delivery paths

Implements the ProfilerPlugin that taps the resolveStep sync hook to
record per-hook entry timestamps, maintains a frame stack for duration
tracking, and delivers profile data via resolveContext.profile callback
or factory-level profileCallback.

The \`profile\` option is added to ResolverFactory.createResolver options:
- \`profile: true\` enables profiling with per-call resolveContext.profile
- \`profile: (data) => {}\` enables profiling with a factory-level callback
- profile is propagated through createInnerContext for nested resolves

Changes:
- lib/ProfilerPlugin.js: new plugin with frame-stack timing
- lib/ResolverFactory.js: profile option + wiring
- lib/Resolver.js: profile field in ResolveContext typedef
- lib/createInnerContext.js: propagate profile to inner context
- lib/index.js: export ProfilerPlugin via lazy getter
- types.d.ts: ProfileData, ProfileHookEntry, ProfilerPlugin types
- test/profiler.test.js: 6 tests covering all delivery paths
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 9, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: jhonsnow456 / name: jhonsnow456 (5e2b3de)

@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5e2b3de

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

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant