From 890f8d5917ed86190181a037b03134d932609645 Mon Sep 17 00:00:00 2001 From: jods Date: Sat, 4 Feb 2017 18:12:35 +0100 Subject: [PATCH] feat(config): .feature() accepts explicit /index. --- src/framework-configuration.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/framework-configuration.js b/src/framework-configuration.js index dba67e29..9dd12d36 100644 --- a/src/framework-configuration.js +++ b/src/framework-configuration.js @@ -202,12 +202,15 @@ export class FrameworkConfiguration { * @param config The configuration for the specified plugin. * @return Returns the current FrameworkConfiguration instance. */ - feature(plugin: string, config?: any): FrameworkConfiguration { - if (getExt(plugin)) { - return this.plugin({ moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: config || {} }); - } - - return this.plugin({ moduleId: plugin + '/index', resourcesRelativeTo: [plugin, ''], config: config || {} }); + feature(plugin: string, config?: any = {}): FrameworkConfiguration { + let hasIndex = /\/index$/i.test(plugin); + let moduleId = hasIndex || getExt(plugin) ? + plugin : + plugin + '/index'; + let root = hasIndex ? + plugin.substr(0, plugin.length - 6) : + plugin; + return this.plugin({ moduleId, resourcesRelativeTo: [root, ''], config }); } /**