express-enrouten
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -0,1 +1,5 @@ | ||
##### v1.3.0 - 20160129 | ||
**Features** | ||
- Add support for babel 6 transformed controllers wth default export | ||
##### v1.2.3 - 20160129 | ||
@@ -2,0 +6,0 @@ **Bugs** |
@@ -56,10 +56,7 @@ 'use strict'; | ||
return function handler(basedir, ancestors, current) { | ||
var abs, impl, filename, mountpath, subrouter; | ||
var abs, impl, filename; | ||
abs = path.join(basedir, ancestors, current); | ||
filename = path.basename(current, path.extname(current)); | ||
function mount(impl, filename) { | ||
var mountpath, subrouter; | ||
if (isFileModule(abs)) { | ||
impl = require(abs); | ||
if (typeof impl === 'function' && impl.length === 1) { | ||
@@ -75,4 +72,17 @@ // Build current pount path, ignoring `index` in lieu of `/` | ||
router.use(mountpath, subrouter._router); | ||
return true; | ||
} | ||
} | ||
abs = path.join(basedir, ancestors, current); | ||
filename = path.basename(current, path.extname(current)); | ||
if (isFileModule(abs)) { | ||
impl = require(abs); | ||
if (!mount(impl, filename)) { | ||
if (impl && impl.default) { | ||
mount(impl.default, filename); | ||
} | ||
} | ||
} | ||
}; | ||
@@ -79,0 +89,0 @@ |
@@ -16,2 +16,7 @@ 'use strict'; | ||
module = require(file); | ||
if (typeof module === 'object' && module.default) { | ||
module = module.default; | ||
} | ||
assert.equal(typeof module, 'function', 'An index file must export a function.'); | ||
@@ -18,0 +23,0 @@ assert.equal(module.length, 1, 'An index file must export a function that accepts a single argument.'); |
{ | ||
"name": "express-enrouten", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "An express route initialization and configuration module.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27641
318