MCPcopy
hub / github.com/electron/forge / resolveHooks

Function resolveHooks

packages/api/core/src/api/package.ts:44–59  ·  view source on GitHub ↗

* Resolves hooks if they are a path to a file (instead of a `Function`).

(
  hooks: (string | F)[] | undefined,
  dir: string,
)

Source from the content-addressed store, hash-verified

42 * Resolves hooks if they are a path to a file (instead of a `Function`).
43 */
44async function resolveHooks<F = HookFunction>(
45 hooks: (string | F)[] | undefined,
46 dir: string,
47) {
48 if (hooks) {
49 return await Promise.all(
50 hooks.map(async (hook) =>
51 typeof hook === 'string'
52 ? ((await importSearch<F>(dir, [hook])) as F)
53 : hook,
54 ),
55 );
56 }
57
58 return [];
59}
60
61type DoneFunction = (err?: Error) => void;
62type PromisifiedHookFunction = (

Callers 1

listrPackageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected