* Configures an internal feature plugin before Aurelia starts. * @param plugin The folder for the internal plugin to configure (expects an index.js in that folder). * @param config The configuration for the specified plugin. * @return Returns the current FrameworkConfiguration instance.
(plugin: string | ((config: FrameworkConfiguration, pluginConfig?: any) => any), config: any = {})
| 286 | * @return Returns the current FrameworkConfiguration instance. |
| 287 | */ |
| 288 | feature(plugin: string | ((config: FrameworkConfiguration, pluginConfig?: any) => any), config: any = {}): FrameworkConfiguration { |
| 289 | switch (typeof plugin) { |
| 290 | case 'string': |
| 291 | let hasIndex = /\/index$/i.test(plugin); |
| 292 | let moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; |
| 293 | let root = hasIndex ? plugin.slice(0, -6) : plugin; |
| 294 | this.info.push({ moduleId, resourcesRelativeTo: [root, ''], config }); |
| 295 | break; |
| 296 | // return this.plugin({ moduleId, resourcesRelativeTo: [root, ''], config }); |
| 297 | case 'function': |
| 298 | this.info.push({ configure: plugin, config: config || {} }); |
| 299 | break; |
| 300 | default: |
| 301 | throw new Error(invalidConfigMsg(plugin, 'feature')); |
| 302 | } |
| 303 | return this; |
| 304 | // return this.plugin(plugin, config); |
| 305 | } |
| 306 | |
| 307 | /** |
| 308 | * Adds globally available view resources to be imported into the Aurelia framework. |
no test coverage detected