zenweb 3.14.0 → 3.15.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/CHANGELOG.md +71 -56
- package/README.md +37 -37
- package/dist/index.d.ts +14 -14
- package/dist/index.js +66 -66
- package/dist/types.d.ts +20 -20
- package/dist/types.js +2 -2
- package/package.json +52 -52
package/CHANGELOG.md
CHANGED
|
@@ -1,56 +1,71 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [3.
|
|
4
|
-
- 更新: @zenweb/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- 更新: @zenweb/
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## 3.
|
|
35
|
-
- @zenweb/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
- @zenweb/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [3.15.0] - 2023-3-21
|
|
4
|
+
- 更新: @zenweb/messagecode: ^3.4.0
|
|
5
|
+
- number 类型支持,如果为 number 则直接获取不进行递归查找
|
|
6
|
+
- 可以格式化不在配置项中的字符串
|
|
7
|
+
- 增加 has 方法用于判断配置项是否存在
|
|
8
|
+
- 更新: @zenweb/result: ^3.1.0
|
|
9
|
+
- 使用 messagecode 统一处理错误代码消息
|
|
10
|
+
- 更新: @zenweb/helper: ^3.4.0
|
|
11
|
+
- 使用新的 result.fail 简化错误输出代码
|
|
12
|
+
- 去除配置项中的 requiredErrorCode 和 validateErrorCode
|
|
13
|
+
- 增加全局配置 page 选项
|
|
14
|
+
- 更新: @zenweb/controller: ^3.10.0
|
|
15
|
+
- discoverPaths 支持使用 "./" 开头的相对路径
|
|
16
|
+
- 增加 debug 信息
|
|
17
|
+
|
|
18
|
+
## [3.14.0] - 2023-3-19
|
|
19
|
+
- 更新: @zenweb/body: ^3.6.0
|
|
20
|
+
|
|
21
|
+
## [3.13.1] - 2023-3-18
|
|
22
|
+
- 导出: RawBody, TextBody
|
|
23
|
+
|
|
24
|
+
## [3.13.0] - 2023-3-17
|
|
25
|
+
- 更新: @zenweb/body: ^3.5.0
|
|
26
|
+
- 重构数据流读取, 新增 RawBody 和 TextBody,可扩展的解析器
|
|
27
|
+
|
|
28
|
+
## [3.12.2] - 2023-3-15
|
|
29
|
+
- 更新:@zenweb/body: ^3.2.2 xml 类型
|
|
30
|
+
|
|
31
|
+
## 3.12.1
|
|
32
|
+
- 导出: ParamHelper
|
|
33
|
+
|
|
34
|
+
## 3.12.0
|
|
35
|
+
- 更新: @zenweb/body: ^3.2.0 ObjectBody
|
|
36
|
+
|
|
37
|
+
## 3.11.1
|
|
38
|
+
> null 大检查! 所有项目强制开启 TS strict 模式,不再忽略 null 检查
|
|
39
|
+
- 更新:
|
|
40
|
+
- @zenweb/body: ^3.1.1
|
|
41
|
+
- @zenweb/controller: ^3.9.1
|
|
42
|
+
- @zenweb/core: ^3.5.1
|
|
43
|
+
- @zenweb/helper: ^3.3.1
|
|
44
|
+
- @zenweb/log: ^3.2.1
|
|
45
|
+
- @zenweb/messagecode: ^3.2.1
|
|
46
|
+
- @zenweb/meta: ^2.4.1
|
|
47
|
+
- @zenweb/result: ^3.0.1
|
|
48
|
+
|
|
49
|
+
## 3.11.0
|
|
50
|
+
- @zenweb/helper: ^3.3.0
|
|
51
|
+
- 去除 Helper
|
|
52
|
+
- 新增 QueryHelper, ParamHelper, TypeCastHelper
|
|
53
|
+
- @zenweb/body: ^3.1.0
|
|
54
|
+
- 新增 BodyHelper 数据类型转换&校验
|
|
55
|
+
|
|
56
|
+
## 3.10.0
|
|
57
|
+
- update:
|
|
58
|
+
- @zenweb/core: ^3.5.0
|
|
59
|
+
- 新增: Core.moduleExists
|
|
60
|
+
- 新增: SetupHelper.assertModuleExists
|
|
61
|
+
- 修改: Core.setup 方法增加 name 参数
|
|
62
|
+
- 删除: SetupHelper.checkCoreProperty
|
|
63
|
+
- 删除: SetupHelper.checkContextProperty
|
|
64
|
+
- @zenweb/body: ^3.0.0
|
|
65
|
+
- 使用依赖注入重构,去除 xml 和 文件上传表单支持,取消的这两个作为独立模块分离。
|
|
66
|
+
- @zenweb/helper: ^3.1.0
|
|
67
|
+
- 使用依赖注入重构,不再支持 ctx.helper 调用
|
|
68
|
+
- @zenweb/router: ^3.3.0
|
|
69
|
+
- @zenweb/controller: ^3.9.0
|
|
70
|
+
- @zenweb/messagecode: ^3.2.0
|
|
71
|
+
- @zenweb/inject: ^3.18.0
|
package/README.md
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
# ZenWeb
|
|
2
|
-
基于 Koa 的模块化轻量级 Web 开发框架。
|
|
3
|
-
本框架全部由 typescript 编写
|
|
4
|
-
|
|
5
|
-
## 文档
|
|
6
|
-
[ZenWeb 文档](https://zenweb.node.ltd)
|
|
7
|
-
|
|
8
|
-
## 内置模块
|
|
9
|
-
- [meta](https://www.npmjs.com/package/@zenweb/meta) 运行基本信息,例如:请求耗时
|
|
10
|
-
- [log](https://www.npmjs.com/package/@zenweb/log) 日志支持
|
|
11
|
-
- [router](https://www.npmjs.com/package/@zenweb/router) 路由支持
|
|
12
|
-
- [messagecode](https://www.npmjs.com/package/@zenweb/messagecode) 统一错误消息格式化
|
|
13
|
-
- [body](https://www.npmjs.com/package/@zenweb/body) 请求主体解析,JSON、Form
|
|
14
|
-
- [result](https://www.npmjs.com/package/@zenweb/result) 统一结果返回,成功或失败
|
|
15
|
-
- [helper](https://www.npmjs.com/package/@zenweb/helper) 输入数据验证
|
|
16
|
-
- [inject](https://www.npmjs.com/package/@zenweb/inject) 注入支持
|
|
17
|
-
|
|
18
|
-
内置模块默认开启,可以通过设置配置项为 **false** 关闭
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## 可选模块
|
|
22
|
-
- [cors](https://www.npmjs.com/package/@zenweb/cors) 跨域支持
|
|
23
|
-
- [sentry](https://www.npmjs.com/package/@zenweb/sentry) sentry 错误收集
|
|
24
|
-
- [metric](https://www.npmjs.com/package/@zenweb/metric) 生产运行健康信息收集
|
|
25
|
-
- [validation](https://www.npmjs.com/package/@zenweb/validation) JSONSchema 验证
|
|
26
|
-
- [mysql](https://www.npmjs.com/package/@zenweb/mysql) MySQL 数据库支持
|
|
27
|
-
- [orm](https://www.npmjs.com/package/@zenweb/orm) ORM 支持
|
|
28
|
-
- [view](https://www.npmjs.com/package/@zenweb/view) 视图模版渲染
|
|
29
|
-
- [schedule](https://www.npmjs.com/package/@zenweb/schedule) 定时任务
|
|
30
|
-
- [form](https://www.npmjs.com/package/@zenweb/form) 统一表单(多用于后台)
|
|
31
|
-
- [grid](https://www.npmjs.com/package/@zenweb/grid) 统一表格(多用于后台)
|
|
32
|
-
- [upload](https://www.npmjs.com/package/@zenweb/upload) 文件上传支持
|
|
33
|
-
- [xmlBody](https://www.npmjs.com/package/@zenweb/xml-body) XML Body 解析
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## 废弃模块
|
|
37
|
-
- [service](https://www.npmjs.com/package/@zenweb/service) 废弃,已被 3.0 注入技术替代
|
|
1
|
+
# ZenWeb
|
|
2
|
+
基于 Koa 的模块化轻量级 Web 开发框架。
|
|
3
|
+
本框架全部由 typescript 编写
|
|
4
|
+
|
|
5
|
+
## 文档
|
|
6
|
+
[ZenWeb 文档](https://zenweb.node.ltd)
|
|
7
|
+
|
|
8
|
+
## 内置模块
|
|
9
|
+
- [meta](https://www.npmjs.com/package/@zenweb/meta) 运行基本信息,例如:请求耗时
|
|
10
|
+
- [log](https://www.npmjs.com/package/@zenweb/log) 日志支持
|
|
11
|
+
- [router](https://www.npmjs.com/package/@zenweb/router) 路由支持
|
|
12
|
+
- [messagecode](https://www.npmjs.com/package/@zenweb/messagecode) 统一错误消息格式化
|
|
13
|
+
- [body](https://www.npmjs.com/package/@zenweb/body) 请求主体解析,JSON、Form
|
|
14
|
+
- [result](https://www.npmjs.com/package/@zenweb/result) 统一结果返回,成功或失败
|
|
15
|
+
- [helper](https://www.npmjs.com/package/@zenweb/helper) 输入数据验证
|
|
16
|
+
- [inject](https://www.npmjs.com/package/@zenweb/inject) 注入支持
|
|
17
|
+
|
|
18
|
+
内置模块默认开启,可以通过设置配置项为 **false** 关闭
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## 可选模块
|
|
22
|
+
- [cors](https://www.npmjs.com/package/@zenweb/cors) 跨域支持
|
|
23
|
+
- [sentry](https://www.npmjs.com/package/@zenweb/sentry) sentry 错误收集
|
|
24
|
+
- [metric](https://www.npmjs.com/package/@zenweb/metric) 生产运行健康信息收集
|
|
25
|
+
- [validation](https://www.npmjs.com/package/@zenweb/validation) JSONSchema 验证
|
|
26
|
+
- [mysql](https://www.npmjs.com/package/@zenweb/mysql) MySQL 数据库支持
|
|
27
|
+
- [orm](https://www.npmjs.com/package/@zenweb/orm) ORM 支持
|
|
28
|
+
- [view](https://www.npmjs.com/package/@zenweb/view) 视图模版渲染
|
|
29
|
+
- [schedule](https://www.npmjs.com/package/@zenweb/schedule) 定时任务
|
|
30
|
+
- [form](https://www.npmjs.com/package/@zenweb/form) 统一表单(多用于后台)
|
|
31
|
+
- [grid](https://www.npmjs.com/package/@zenweb/grid) 统一表格(多用于后台)
|
|
32
|
+
- [upload](https://www.npmjs.com/package/@zenweb/upload) 文件上传支持
|
|
33
|
+
- [xmlBody](https://www.npmjs.com/package/@zenweb/xml-body) XML Body 解析
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## 废弃模块
|
|
37
|
+
- [service](https://www.npmjs.com/package/@zenweb/service) 废弃,已被 3.0 注入技术替代
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Core } from '@zenweb/core';
|
|
2
|
-
import { CreateOptions } from './types';
|
|
3
|
-
export { init, inject, factory, scope } from '@zenweb/inject';
|
|
4
|
-
export { Router } from '@zenweb/router';
|
|
5
|
-
export { ResultFail } from '@zenweb/result';
|
|
6
|
-
export { Controller, controller, mapping } from '@zenweb/controller';
|
|
7
|
-
export { Next, SetupFunction, Context, Middleware } from '@zenweb/core';
|
|
8
|
-
export { Body, ObjectBody, BodyHelper, RawBody, TextBody } from '@zenweb/body';
|
|
9
|
-
export { QueryHelper, TypeCastHelper, ParamHelper } from '@zenweb/helper';
|
|
10
|
-
export { Core, CreateOptions, };
|
|
11
|
-
/**
|
|
12
|
-
* @param options 模块配置项
|
|
13
|
-
*/
|
|
14
|
-
export declare function create(options?: CreateOptions): Core;
|
|
1
|
+
import { Core } from '@zenweb/core';
|
|
2
|
+
import { CreateOptions } from './types';
|
|
3
|
+
export { init, inject, factory, scope } from '@zenweb/inject';
|
|
4
|
+
export { Router } from '@zenweb/router';
|
|
5
|
+
export { ResultFail } from '@zenweb/result';
|
|
6
|
+
export { Controller, controller, mapping } from '@zenweb/controller';
|
|
7
|
+
export { Next, SetupFunction, Context, Middleware } from '@zenweb/core';
|
|
8
|
+
export { Body, ObjectBody, BodyHelper, RawBody, TextBody } from '@zenweb/body';
|
|
9
|
+
export { QueryHelper, TypeCastHelper, ParamHelper } from '@zenweb/helper';
|
|
10
|
+
export { Core, CreateOptions, };
|
|
11
|
+
/**
|
|
12
|
+
* @param options 模块配置项
|
|
13
|
+
*/
|
|
14
|
+
export declare function create(options?: CreateOptions): Core;
|
package/dist/index.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = exports.Core = exports.ParamHelper = exports.TypeCastHelper = exports.QueryHelper = exports.TextBody = exports.RawBody = exports.BodyHelper = exports.ObjectBody = exports.Body = exports.Context = exports.mapping = exports.controller = exports.Controller = exports.ResultFail = exports.Router = exports.scope = exports.factory = exports.inject = exports.init = void 0;
|
|
4
|
-
const inject_1 = require("@zenweb/inject");
|
|
5
|
-
const meta_1 = require("@zenweb/meta");
|
|
6
|
-
const log_1 = require("@zenweb/log");
|
|
7
|
-
const router_1 = require("@zenweb/router");
|
|
8
|
-
const messagecode_1 = require("@zenweb/messagecode");
|
|
9
|
-
const body_1 = require("@zenweb/body");
|
|
10
|
-
const result_1 = require("@zenweb/result");
|
|
11
|
-
const helper_1 = require("@zenweb/helper");
|
|
12
|
-
const controller_1 = require("@zenweb/controller");
|
|
13
|
-
const core_1 = require("@zenweb/core");
|
|
14
|
-
Object.defineProperty(exports, "Core", { enumerable: true, get: function () { return core_1.Core; } });
|
|
15
|
-
var inject_2 = require("@zenweb/inject");
|
|
16
|
-
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return inject_2.init; } });
|
|
17
|
-
Object.defineProperty(exports, "inject", { enumerable: true, get: function () { return inject_2.inject; } });
|
|
18
|
-
Object.defineProperty(exports, "factory", { enumerable: true, get: function () { return inject_2.factory; } });
|
|
19
|
-
Object.defineProperty(exports, "scope", { enumerable: true, get: function () { return inject_2.scope; } });
|
|
20
|
-
var router_2 = require("@zenweb/router");
|
|
21
|
-
Object.defineProperty(exports, "Router", { enumerable: true, get: function () { return router_2.Router; } });
|
|
22
|
-
var result_2 = require("@zenweb/result");
|
|
23
|
-
Object.defineProperty(exports, "ResultFail", { enumerable: true, get: function () { return result_2.ResultFail; } });
|
|
24
|
-
var controller_2 = require("@zenweb/controller");
|
|
25
|
-
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return controller_2.Controller; } });
|
|
26
|
-
Object.defineProperty(exports, "controller", { enumerable: true, get: function () { return controller_2.controller; } });
|
|
27
|
-
Object.defineProperty(exports, "mapping", { enumerable: true, get: function () { return controller_2.mapping; } });
|
|
28
|
-
var core_2 = require("@zenweb/core");
|
|
29
|
-
Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return core_2.Context; } });
|
|
30
|
-
var body_2 = require("@zenweb/body");
|
|
31
|
-
Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return body_2.Body; } });
|
|
32
|
-
Object.defineProperty(exports, "ObjectBody", { enumerable: true, get: function () { return body_2.ObjectBody; } });
|
|
33
|
-
Object.defineProperty(exports, "BodyHelper", { enumerable: true, get: function () { return body_2.BodyHelper; } });
|
|
34
|
-
Object.defineProperty(exports, "RawBody", { enumerable: true, get: function () { return body_2.RawBody; } });
|
|
35
|
-
Object.defineProperty(exports, "TextBody", { enumerable: true, get: function () { return body_2.TextBody; } });
|
|
36
|
-
var helper_2 = require("@zenweb/helper");
|
|
37
|
-
Object.defineProperty(exports, "QueryHelper", { enumerable: true, get: function () { return helper_2.QueryHelper; } });
|
|
38
|
-
Object.defineProperty(exports, "TypeCastHelper", { enumerable: true, get: function () { return helper_2.TypeCastHelper; } });
|
|
39
|
-
Object.defineProperty(exports, "ParamHelper", { enumerable: true, get: function () { return helper_2.ParamHelper; } });
|
|
40
|
-
/**
|
|
41
|
-
* @param options 模块配置项
|
|
42
|
-
*/
|
|
43
|
-
function create(options) {
|
|
44
|
-
options = options || {};
|
|
45
|
-
const core = new core_1.Core(options.core);
|
|
46
|
-
if (options.inject !== false)
|
|
47
|
-
core.setup((0, inject_1.default)());
|
|
48
|
-
if (options.meta !== false)
|
|
49
|
-
core.setup((0, meta_1.default)(options.meta));
|
|
50
|
-
if (options.log !== false)
|
|
51
|
-
core.setup((0, log_1.default)(options.log));
|
|
52
|
-
if (options.router !== false)
|
|
53
|
-
core.setup((0, router_1.default)());
|
|
54
|
-
if (options.messagecode !== false)
|
|
55
|
-
core.setup((0, messagecode_1.default)(options.messagecode));
|
|
56
|
-
if (options.body !== false)
|
|
57
|
-
core.setup((0, body_1.default)(options.body));
|
|
58
|
-
if (options.result !== false)
|
|
59
|
-
core.setup((0, result_1.default)(options.result));
|
|
60
|
-
if (options.helper !== false)
|
|
61
|
-
core.setup((0, helper_1.default)(options.helper));
|
|
62
|
-
if (options.controller !== false)
|
|
63
|
-
core.setup((0, controller_1.default)(options.controller));
|
|
64
|
-
return core;
|
|
65
|
-
}
|
|
66
|
-
exports.create = create;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.create = exports.Core = exports.ParamHelper = exports.TypeCastHelper = exports.QueryHelper = exports.TextBody = exports.RawBody = exports.BodyHelper = exports.ObjectBody = exports.Body = exports.Context = exports.mapping = exports.controller = exports.Controller = exports.ResultFail = exports.Router = exports.scope = exports.factory = exports.inject = exports.init = void 0;
|
|
4
|
+
const inject_1 = require("@zenweb/inject");
|
|
5
|
+
const meta_1 = require("@zenweb/meta");
|
|
6
|
+
const log_1 = require("@zenweb/log");
|
|
7
|
+
const router_1 = require("@zenweb/router");
|
|
8
|
+
const messagecode_1 = require("@zenweb/messagecode");
|
|
9
|
+
const body_1 = require("@zenweb/body");
|
|
10
|
+
const result_1 = require("@zenweb/result");
|
|
11
|
+
const helper_1 = require("@zenweb/helper");
|
|
12
|
+
const controller_1 = require("@zenweb/controller");
|
|
13
|
+
const core_1 = require("@zenweb/core");
|
|
14
|
+
Object.defineProperty(exports, "Core", { enumerable: true, get: function () { return core_1.Core; } });
|
|
15
|
+
var inject_2 = require("@zenweb/inject");
|
|
16
|
+
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return inject_2.init; } });
|
|
17
|
+
Object.defineProperty(exports, "inject", { enumerable: true, get: function () { return inject_2.inject; } });
|
|
18
|
+
Object.defineProperty(exports, "factory", { enumerable: true, get: function () { return inject_2.factory; } });
|
|
19
|
+
Object.defineProperty(exports, "scope", { enumerable: true, get: function () { return inject_2.scope; } });
|
|
20
|
+
var router_2 = require("@zenweb/router");
|
|
21
|
+
Object.defineProperty(exports, "Router", { enumerable: true, get: function () { return router_2.Router; } });
|
|
22
|
+
var result_2 = require("@zenweb/result");
|
|
23
|
+
Object.defineProperty(exports, "ResultFail", { enumerable: true, get: function () { return result_2.ResultFail; } });
|
|
24
|
+
var controller_2 = require("@zenweb/controller");
|
|
25
|
+
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return controller_2.Controller; } });
|
|
26
|
+
Object.defineProperty(exports, "controller", { enumerable: true, get: function () { return controller_2.controller; } });
|
|
27
|
+
Object.defineProperty(exports, "mapping", { enumerable: true, get: function () { return controller_2.mapping; } });
|
|
28
|
+
var core_2 = require("@zenweb/core");
|
|
29
|
+
Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return core_2.Context; } });
|
|
30
|
+
var body_2 = require("@zenweb/body");
|
|
31
|
+
Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return body_2.Body; } });
|
|
32
|
+
Object.defineProperty(exports, "ObjectBody", { enumerable: true, get: function () { return body_2.ObjectBody; } });
|
|
33
|
+
Object.defineProperty(exports, "BodyHelper", { enumerable: true, get: function () { return body_2.BodyHelper; } });
|
|
34
|
+
Object.defineProperty(exports, "RawBody", { enumerable: true, get: function () { return body_2.RawBody; } });
|
|
35
|
+
Object.defineProperty(exports, "TextBody", { enumerable: true, get: function () { return body_2.TextBody; } });
|
|
36
|
+
var helper_2 = require("@zenweb/helper");
|
|
37
|
+
Object.defineProperty(exports, "QueryHelper", { enumerable: true, get: function () { return helper_2.QueryHelper; } });
|
|
38
|
+
Object.defineProperty(exports, "TypeCastHelper", { enumerable: true, get: function () { return helper_2.TypeCastHelper; } });
|
|
39
|
+
Object.defineProperty(exports, "ParamHelper", { enumerable: true, get: function () { return helper_2.ParamHelper; } });
|
|
40
|
+
/**
|
|
41
|
+
* @param options 模块配置项
|
|
42
|
+
*/
|
|
43
|
+
function create(options) {
|
|
44
|
+
options = options || {};
|
|
45
|
+
const core = new core_1.Core(options.core);
|
|
46
|
+
if (options.inject !== false)
|
|
47
|
+
core.setup((0, inject_1.default)());
|
|
48
|
+
if (options.meta !== false)
|
|
49
|
+
core.setup((0, meta_1.default)(options.meta));
|
|
50
|
+
if (options.log !== false)
|
|
51
|
+
core.setup((0, log_1.default)(options.log));
|
|
52
|
+
if (options.router !== false)
|
|
53
|
+
core.setup((0, router_1.default)());
|
|
54
|
+
if (options.messagecode !== false)
|
|
55
|
+
core.setup((0, messagecode_1.default)(options.messagecode));
|
|
56
|
+
if (options.body !== false)
|
|
57
|
+
core.setup((0, body_1.default)(options.body));
|
|
58
|
+
if (options.result !== false)
|
|
59
|
+
core.setup((0, result_1.default)(options.result));
|
|
60
|
+
if (options.helper !== false)
|
|
61
|
+
core.setup((0, helper_1.default)(options.helper));
|
|
62
|
+
if (options.controller !== false)
|
|
63
|
+
core.setup((0, controller_1.default)(options.controller));
|
|
64
|
+
return core;
|
|
65
|
+
}
|
|
66
|
+
exports.create = create;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { CoreOption } from '@zenweb/core';
|
|
2
|
-
import { MetaOption } from '@zenweb/meta';
|
|
3
|
-
import { LogOption } from '@zenweb/log';
|
|
4
|
-
import { MessageCodeOption } from '@zenweb/messagecode';
|
|
5
|
-
import { BodyOption } from '@zenweb/body';
|
|
6
|
-
import { ResultOption } from '@zenweb/result';
|
|
7
|
-
import { HelperOption } from '@zenweb/helper';
|
|
8
|
-
import { ControllerOption } from '@zenweb/controller';
|
|
9
|
-
export interface CreateOptions {
|
|
10
|
-
core?: CoreOption;
|
|
11
|
-
inject?: false;
|
|
12
|
-
meta?: MetaOption | false;
|
|
13
|
-
log?: LogOption | false;
|
|
14
|
-
router?: false;
|
|
15
|
-
messagecode?: MessageCodeOption | false;
|
|
16
|
-
body?: BodyOption | false;
|
|
17
|
-
result?: ResultOption | false;
|
|
18
|
-
helper?: HelperOption | false;
|
|
19
|
-
controller?: ControllerOption | false;
|
|
20
|
-
}
|
|
1
|
+
import { CoreOption } from '@zenweb/core';
|
|
2
|
+
import { MetaOption } from '@zenweb/meta';
|
|
3
|
+
import { LogOption } from '@zenweb/log';
|
|
4
|
+
import { MessageCodeOption } from '@zenweb/messagecode';
|
|
5
|
+
import { BodyOption } from '@zenweb/body';
|
|
6
|
+
import { ResultOption } from '@zenweb/result';
|
|
7
|
+
import { HelperOption } from '@zenweb/helper';
|
|
8
|
+
import { ControllerOption } from '@zenweb/controller';
|
|
9
|
+
export interface CreateOptions {
|
|
10
|
+
core?: CoreOption;
|
|
11
|
+
inject?: false;
|
|
12
|
+
meta?: MetaOption | false;
|
|
13
|
+
log?: LogOption | false;
|
|
14
|
+
router?: false;
|
|
15
|
+
messagecode?: MessageCodeOption | false;
|
|
16
|
+
body?: BodyOption | false;
|
|
17
|
+
result?: ResultOption | false;
|
|
18
|
+
helper?: HelperOption | false;
|
|
19
|
+
controller?: ControllerOption | false;
|
|
20
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "zenweb",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "Modular lightweight web framework based on Koa",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"typings": "./dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "rimraf dist && tsc",
|
|
12
|
-
"prepublishOnly": "npm run build",
|
|
13
|
-
"dev": "cd example && cross-env APP_NAME=testapp DEBUG=* NODE_ENV=development ts-node src"
|
|
14
|
-
},
|
|
15
|
-
"author": {
|
|
16
|
-
"name": "YeFei",
|
|
17
|
-
"email": "316606233@qq.com"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"web",
|
|
21
|
-
"app",
|
|
22
|
-
"http",
|
|
23
|
-
"framework",
|
|
24
|
-
"koa"
|
|
25
|
-
],
|
|
26
|
-
"license": "MIT",
|
|
27
|
-
"repository": {
|
|
28
|
-
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/yefei/zenweb.git"
|
|
30
|
-
},
|
|
31
|
-
"bugs": {
|
|
32
|
-
"url": "https://github.com/yefei/zenweb/issues"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@zenweb/body": "^3.6.0",
|
|
36
|
-
"@zenweb/controller": "^3.
|
|
37
|
-
"@zenweb/core": "^3.5.1",
|
|
38
|
-
"@zenweb/helper": "^3.
|
|
39
|
-
"@zenweb/inject": "^3.18.0",
|
|
40
|
-
"@zenweb/log": "^3.2.1",
|
|
41
|
-
"@zenweb/messagecode": "^3.
|
|
42
|
-
"@zenweb/meta": "^2.4.1",
|
|
43
|
-
"@zenweb/result": "^3.0
|
|
44
|
-
"@zenweb/router": "^3.3.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"cross-env": "^7.0.3",
|
|
48
|
-
"rimraf": "^4.1.2",
|
|
49
|
-
"ts-node": "^10.9.1",
|
|
50
|
-
"typescript": "^4.9.4"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "zenweb",
|
|
3
|
+
"version": "3.15.0",
|
|
4
|
+
"description": "Modular lightweight web framework based on Koa",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"typings": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rimraf dist && tsc",
|
|
12
|
+
"prepublishOnly": "npm run build",
|
|
13
|
+
"dev": "cd example && cross-env APP_NAME=testapp DEBUG=* NODE_ENV=development ts-node src"
|
|
14
|
+
},
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "YeFei",
|
|
17
|
+
"email": "316606233@qq.com"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"web",
|
|
21
|
+
"app",
|
|
22
|
+
"http",
|
|
23
|
+
"framework",
|
|
24
|
+
"koa"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/yefei/zenweb.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/yefei/zenweb/issues"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@zenweb/body": "^3.6.0",
|
|
36
|
+
"@zenweb/controller": "^3.10.0",
|
|
37
|
+
"@zenweb/core": "^3.5.1",
|
|
38
|
+
"@zenweb/helper": "^3.4.0",
|
|
39
|
+
"@zenweb/inject": "^3.18.0",
|
|
40
|
+
"@zenweb/log": "^3.2.1",
|
|
41
|
+
"@zenweb/messagecode": "^3.4.0",
|
|
42
|
+
"@zenweb/meta": "^2.4.1",
|
|
43
|
+
"@zenweb/result": "^3.1.0",
|
|
44
|
+
"@zenweb/router": "^3.3.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"cross-env": "^7.0.3",
|
|
48
|
+
"rimraf": "^4.1.2",
|
|
49
|
+
"ts-node": "^10.9.1",
|
|
50
|
+
"typescript": "^4.9.4"
|
|
51
|
+
}
|
|
52
|
+
}
|