UNPKG

@scalar/api-client

Version:

the open source API testing client

27 lines (26 loc) 631 B
const s = ({ plugins: a = [] }) => { const t = /* @__PURE__ */ new Map(); return a.forEach((r) => { const e = r(); t.set(e.name, e); }), { /** * Get all components for a specific view */ getViewComponents: (r) => Array.from(t.values()).flatMap((e) => e.views?.[r] || []), /** * Execute a hook for a specific event */ executeHook: (r, ...e) => { const o = Array.from(t.values()).flatMap( (n) => n.hooks?.[r] || [] ); return Promise.all( o.filter((n) => n != null).map((n) => n?.(...e)) ); } }; }; export { s as createPluginManager };