()
| 231 | }; |
| 232 | |
| 233 | const loadModules = () => { |
| 234 | console.log('(re)loading renderer plugins'); |
| 235 | const paths = plugins.getPaths(); |
| 236 | |
| 237 | // initialize cache that we populate with extension methods |
| 238 | connectors = { |
| 239 | Terms: {state: [], dispatch: []}, |
| 240 | Header: {state: [], dispatch: []}, |
| 241 | Hyper: {state: [], dispatch: []}, |
| 242 | Notifications: {state: [], dispatch: []} |
| 243 | }; |
| 244 | uiReducers = []; |
| 245 | middlewares = []; |
| 246 | sessionsReducers = []; |
| 247 | termGroupsReducers = []; |
| 248 | tabPropsDecorators = []; |
| 249 | tabsPropsDecorators = []; |
| 250 | termPropsDecorators = []; |
| 251 | termGroupPropsDecorators = []; |
| 252 | |
| 253 | propsDecorators = { |
| 254 | getTermProps: termPropsDecorators, |
| 255 | getTabProps: tabPropsDecorators, |
| 256 | getTabsProps: tabsPropsDecorators, |
| 257 | getTermGroupProps: termGroupPropsDecorators |
| 258 | }; |
| 259 | |
| 260 | reducersDecorators = { |
| 261 | reduceUI: uiReducers, |
| 262 | reduceSessions: sessionsReducers, |
| 263 | reduceTermGroups: termGroupsReducers |
| 264 | }; |
| 265 | |
| 266 | const loadedPlugins = plugins.getLoadedPluginVersions().map((plugin: any) => plugin.name); |
| 267 | modules = paths.plugins |
| 268 | .concat(paths.localPlugins) |
| 269 | .filter((plugin) => loadedPlugins.indexOf(basename(plugin)) !== -1) |
| 270 | .map((path) => { |
| 271 | let mod: hyperPlugin; |
| 272 | const pluginName = getPluginName(path); |
| 273 | const pluginVersion = getPluginVersion(path); |
| 274 | |
| 275 | // window.require allows us to ensure this doesn't get |
| 276 | // in the way of our build |
| 277 | try { |
| 278 | mod = window.require(path); |
| 279 | } catch (err) { |
| 280 | notify( |
| 281 | 'Plugin load error', |
| 282 | `"${pluginName}" failed to load in the renderer process. Check Developer Tools for details.`, |
| 283 | {error: err} |
| 284 | ); |
| 285 | return undefined; |
| 286 | } |
| 287 | |
| 288 | ObjectTypedKeys(mod).forEach((i) => { |
| 289 | if (Object.hasOwnProperty.call(mod, i)) { |
| 290 | mod[i]._pluginName = pluginName; |
no test coverage detected