egg-core
Advanced tools
Comparing version 3.21.3 to 3.21.4
3.21.4 / 2019-05-14 | ||
================== | ||
**fixes** | ||
* [[`e94f55a`](http://github.com/eggjs/egg-core/commit/e94f55a2f9caa931e68b5d5d6d565229fc620850)] - fix: app.js is not support class (#212) (TZ | 天猪 <<atian25@qq.com>>) | ||
3.21.3 / 2018-05-08 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const assert = require('assert'); | ||
const isFunction = require('is-type-of').function; | ||
const is = require('is-type-of'); | ||
const debug = require('debug')('egg-core'); | ||
@@ -299,3 +299,3 @@ const homedir = require('node-homedir'); | ||
let ret = this.requireFile(filepath); | ||
ret = isFunction(ret) ? ret(...inject) : ret; | ||
ret = is.function(ret) && !is.class(ret) ? ret(...inject) : ret; | ||
return ret; | ||
@@ -302,0 +302,0 @@ } |
'use strict'; | ||
const path = require('path'); | ||
const is = require('is-type-of'); | ||
module.exports = { | ||
@@ -26,4 +26,7 @@ | ||
this.timing.start('Load app.js'); | ||
this.getLoadUnits() | ||
.forEach(unit => this.loadFile(path.join(unit.path, 'app.js'))); | ||
this.getLoadUnits().forEach(unit => { | ||
const fullPath = path.join(unit.path, 'app.js'); | ||
const mod = this.loadFile(fullPath); | ||
if (is.class(mod)) throw new Error(`${fullPath} is not support class at this version, please upgrade your framework`); | ||
}); | ||
this.timing.end('Load app.js'); | ||
@@ -37,7 +40,9 @@ }, | ||
this.timing.start('Load agent.js'); | ||
this.getLoadUnits() | ||
.forEach(unit => this.loadFile(path.join(unit.path, 'agent.js'))); | ||
this.getLoadUnits().forEach(unit => { | ||
const fullPath = path.join(unit.path, 'agent.js'); | ||
const mod = this.loadFile(fullPath); | ||
if (is.class(mod)) throw new Error(`${fullPath} is not support class at this version, please upgrade your framework`); | ||
}); | ||
this.timing.end('Load agent.js'); | ||
}, | ||
}; |
{ | ||
"name": "egg-core", | ||
"version": "3.21.3", | ||
"version": "3.21.4", | ||
"description": "A core Pluggable framework based on koa", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
99731
2428