UNPKG

@scalar/api-client

Version:

the open source API testing client

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