Function: sourcesHookOf()
Documentation / @wtf/project-resolve / hooks / sourcesHookOf
function sourcesHookOf(packages, realpath): ResolveHookSync;Defined in: packages/project-resolve/src/hooks.ts:86
The hook of the packages given, each a package of the workspace: an import of one of them, or of
one of its subpaths, resolves by its @wtf/source condition first. A package of the registry is
never given, so a condition of its own it ships is never read.
An export of the @wtf/source condition resolves by its source itself, the specifier the hook
hands on: a loader of module.register, as Storybook registers one for its TypeScript config,
runs as the last step of the hooks of registerHooks, and Node hands it the specifier, but none
of the conditions a hook gives. By its URL to an import, and by its path to a require, which
takes no URL. Any other import of a package, as of a subpath of a pattern, resolves by the
condition.
Every module resolves at the real path of its file, by the realpath it is given, the system’s,
unless Node is told to keep the links (--preserve-symlinks, --preserve-symlinks-main or
NODE_PRESERVE_SYMLINKS).
Parameters
| Parameter | Type |
|---|---|
packages | readonly WorkspacePackage[] |
realpath | (path) => string |
Returns
ResolveHookSync
