(fns: PluginLoad[])
| 143 | } |
| 144 | |
| 145 | async function loadPlugins<T>(fns: PluginLoad[]) { |
| 146 | let plugin: Plugin<T> = { |
| 147 | parsers: Object.create(null), |
| 148 | printers: Object.create(null), |
| 149 | options: Object.create(null), |
| 150 | defaultOptions: Object.create(null), |
| 151 | languages: [], |
| 152 | } |
| 153 | |
| 154 | for (let source of fns) { |
| 155 | let loaded = await loadPlugin(source) |
| 156 | Object.assign(plugin.parsers!, loaded.parsers ?? {}) |
| 157 | Object.assign(plugin.printers!, loaded.printers ?? {}) |
| 158 | Object.assign(plugin.options!, loaded.options ?? {}) |
| 159 | Object.assign(plugin.defaultOptions!, loaded.defaultOptions ?? {}) |
| 160 | |
| 161 | plugin.languages = [...(plugin.languages ?? []), ...(loaded.languages ?? [])] |
| 162 | } |
| 163 | |
| 164 | return plugin |
| 165 | } |
| 166 | |
| 167 | const EMPTY_PLUGIN: Plugin<any> = { |
| 168 | parsers: {}, |
no test coverage detected
searching dependent graphs…