jj.js 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/app.js CHANGED
@@ -49,7 +49,7 @@ class App extends Koa
49
49
  cfg_app.static_dir && this.use(require('koa-static')(path.join(cfg_app.base_dir, cfg_app.static_dir)));
50
50
 
51
51
  // koa-body
52
- cfg_app.koa_body && this.use(require('koa-body')(cfg_app.koa_body));
52
+ cfg_app.koa_body && this.use(require('koa-body').koaBody(cfg_app.koa_body));
53
53
 
54
54
  // router
55
55
  this.use(router.routes()).use(router.allowedMethods());
package/lib/config.js CHANGED
@@ -41,7 +41,7 @@ const db = {
41
41
 
42
42
  const log = {
43
43
  log_level: ['system', 'error'], // [system, error, warning, info, debug, http, sql]
44
- log_handle: function(level, ...args) {console.log(`[${format('YY-mm-dd HH:ii:ss')}] [${level}]`, ...args.map(msg => typeof msg == 'string' ? msg : JSON.stringify(msg)));}
44
+ log_handle: function(level, ...args) {console.log(`[${format('YY-mm-dd HH:ii:ss')}] [${level}]`, ...args.map(msg => typeof msg == 'object' ? JSON.stringify(msg) : String(msg)));}
45
45
  }
46
46
 
47
47
  const cache = {
package/lib/router.js CHANGED
@@ -32,14 +32,14 @@ if (cfg_routes) {
32
32
  }
33
33
 
34
34
  // 注册系统路由
35
- router.all(cfg_app.app_multi ? '/:APP?/:CONTROLLER?/:ACTION?' : '/:CONTROLLER?/:ACTION?', async (ctx, next) => {
35
+ router.all(cfg_app.app_multi ? '{/:APP}{/:CONTROLLER}{/:ACTION}' : '{/:CONTROLLER}{/:ACTION}', async (ctx, next) => {
36
36
  ctx.APP = ctx.params.APP || cfg_app.default_app;
37
37
  ctx.CONTROLLER = ctx.params.CONTROLLER || cfg_app.default_controller;
38
38
  ctx.ACTION = ctx.params.ACTION || cfg_app.default_action;
39
39
  delete ctx.params.APP;
40
40
  delete ctx.params.CONTROLLER;
41
41
  delete ctx.params.ACTION;
42
- ctx.APP != 'favicon.ico' && ctx.CONTROLLER != 'favicon.ico' && await run(ctx, next);
42
+ await run(ctx, next);
43
43
  });
44
44
 
45
45
  module.exports = router;
package/lib/run.js CHANGED
@@ -33,7 +33,8 @@ async function run(ctx, next, control_type=cfg_app.controller_folder) {
33
33
 
34
34
  // 应用、控制器、方法名字验证
35
35
  if(~ctx.APP.indexOf('.') || ~ctx.CONTROLLER.indexOf('.') || ~ctx.ACTION.indexOf('.')) {
36
- throw new Error(`RunError: 应用、控制器或方法名字不合法!`);
36
+ // throw new Error(`RunError: 应用、控制器或方法名字不合法!`);
37
+ return false;
37
38
  }
38
39
 
39
40
  if(ctx.APP[0] == '_' || ctx.APP[0] == '$' || !store._[ctx.APP]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jj.js",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "A super simple lightweight NodeJS MVC framework(一个超级简单轻量的NodeJS MVC框架)",
5
5
  "main": "jj.js",
6
6
  "scripts": {},
@@ -20,12 +20,12 @@
20
20
  },
21
21
  "homepage": "https://github.com/yafoo/jj.js#readme",
22
22
  "dependencies": {
23
- "@koa/router": "^12.0.1",
23
+ "@koa/router": "^13.0.1",
24
24
  "art-template": "^4.13.2",
25
25
  "escape-html": "^1.0.3",
26
26
  "is-class": "0.0.9",
27
- "koa": "^2.15.0",
28
- "koa-body": "^5.0.0",
27
+ "koa": "^2.15.3",
28
+ "koa-body": "^6.0.1",
29
29
  "koa-static": "^5.0.0",
30
30
  "mysql": "^2.18.1",
31
31
  "watch": "^1.0.2"