(state: RuntimeState, ready: PluginLoad[])
| 774 | } |
| 775 | |
| 776 | async function addExternalPluginEntries(state: RuntimeState, ready: PluginLoad[]) { |
| 777 | if (!ready.length) return { plugins: [] as PluginEntry[], ok: true } |
| 778 | |
| 779 | const meta = await PluginMeta.touchMany( |
| 780 | ready.map((item) => ({ |
| 781 | spec: item.spec, |
| 782 | target: item.target, |
| 783 | id: item.id, |
| 784 | })), |
| 785 | ).catch(() => undefined) |
| 786 | |
| 787 | const plugins: PluginEntry[] = [] |
| 788 | let ok = true |
| 789 | for (let i = 0; i < ready.length; i++) { |
| 790 | const entry = ready[i] |
| 791 | if (!entry) continue |
| 792 | const hit = meta?.[i] |
| 793 | const info = createMeta(entry.source, entry.spec, entry.target, hit, entry.id) |
| 794 | const themes = hit?.entry.themes ? { ...hit.entry.themes } : {} |
| 795 | const plugin: PluginEntry = { |
| 796 | id: entry.id, |
| 797 | load: entry, |
| 798 | meta: info, |
| 799 | themes, |
| 800 | plugin: entry.module.tui, |
| 801 | enabled: true, |
| 802 | } |
| 803 | if (!addPluginEntry(state, plugin)) { |
| 804 | ok = false |
| 805 | continue |
| 806 | } |
| 807 | plugins.push(plugin) |
| 808 | } |
| 809 | |
| 810 | return { plugins, ok } |
| 811 | } |
| 812 | |
| 813 | function defaultPluginOrigin(state: RuntimeState, spec: string): ConfigPlugin.Origin { |
| 814 | return { |
no test coverage detected