docs: document resolver hooks and their pipeline workflow#541
docs: document resolver hooks and their pipeline workflow#541alexander-akait merged 5 commits intomainfrom
Conversation
Adds a new Hooks section to the README that enumerates the lifecycle hooks on resolver.hooks, every pipeline hook in execution order, the before-/after- stage modifiers, and short examples showing tracing, short-circuiting, and doResolve-based rewrites.
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #541 +/- ##
=======================================
Coverage 96.46% 96.46%
=======================================
Files 50 50
Lines 2687 2687
Branches 824 824
=======================================
Hits 2592 2592
Misses 80 80
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Follow-up to the Hooks section: walks through the hook chain for a relative path, bare module, internal import, alias hit, exports-field match, and a failed resolve, so readers can see which hooks run for which kind of request without having to trace ResolverFactory.js.
For each of the 29 built-in plugins, adds a one-line goal plus the hook it taps and where it forwards — so readers of the Built-in Plugins table can see how each plugin plugs into the hook pipeline.
Summary
resolver.hooks(resolveStep,noResolve,resolve,result) and every pipeline hook in the order the default pipeline visits them.ensureHook/getHooksemantics, theAsyncSeriesBailHookcallback contract (callback()/callback(err)/callback(null, request)), and thebefore-/after-stage modifiers used insideResolverFactory.filehook, and a cross-link to the existingMyLibSrcPlugindoResolvewalkthrough.The hook list and ordering were derived from
lib/ResolverFactory.js(the//// pipeline ////section) and theKnownHookstypedef inlib/Resolver.js.Test plan
resolver.hooks.resolveStep.tap,resolver.getHook("file").tapAsync,callback(null, request)short-circuit shape).#hooksresolves.