mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: easy require resolve hook
This commit is contained in:
1 parent
06faa233f8
commit
072f165f9e
3 files changed
+6
-2
No files matched your search
@@ -40,7 +40,8 @@ export function registerResolver(
|
||||
const wrappedFunc = async (arg, ctx, info) => {
|
||||
const res = await func(arg, ctx, info);
|
||||
if (typeof res !== 'object') return res;
|
||||
if (handlers[value]) Object.assign(res, handlers[value]);
|
||||
const node = value.includes('!') ? value.split('!')[0] : value;
|
||||
if (handlers[node]) Object.assign(res, handlers[node]);
|
||||
ctx.parent = res;
|
||||
return res;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user