zenweb 3.9.0 → 3.10.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/README.md +23 -83
- package/dist/index.d.ts +2 -5
- package/dist/index.js +5 -6
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -2,95 +2,16 @@
|
|
|
2
2
|
基于 Koa 的模块化轻量级 Web 开发框架。
|
|
3
3
|
本框架全部由 typescript 编写
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
推荐使用 typescript 创建项目
|
|
8
|
-
|
|
9
|
-
package.json
|
|
10
|
-
```json
|
|
11
|
-
{
|
|
12
|
-
"name": "app",
|
|
13
|
-
"private": true,
|
|
14
|
-
"main": "app/index.js",
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "cross-env DEBUG=* NODE_ENV=development ts-node src/index.ts",
|
|
17
|
-
"build": "tsc",
|
|
18
|
-
"start": "node app"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
$ npm i zenweb
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
src/index.ts
|
|
28
|
-
```ts
|
|
29
|
-
import { create } from 'zenweb';
|
|
30
|
-
|
|
31
|
-
const app = create();
|
|
32
|
-
app.start();
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
src/controller/hello.ts
|
|
36
|
-
```ts
|
|
37
|
-
import { Context, inject, mapping } from 'zenweb';
|
|
38
|
-
|
|
39
|
-
export class HelloService {
|
|
40
|
-
@inject ctx: Context;
|
|
41
|
-
private i = 0;
|
|
42
|
-
|
|
43
|
-
say() {
|
|
44
|
-
this.i++;
|
|
45
|
-
return `Hello: ${this.ctx.path}, ${this.i}`;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export class Index {
|
|
50
|
-
@mapping({ path: '/' })
|
|
51
|
-
index(ctx: Context, hello: HelloService) {
|
|
52
|
-
ctx.success(hello.say());
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
tsconfig.json
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"compilerOptions": {
|
|
61
|
-
"experimentalDecorators": true,
|
|
62
|
-
"emitDecoratorMetadata": true,
|
|
63
|
-
"target": "ES2019",
|
|
64
|
-
"lib": [
|
|
65
|
-
"ES2019"
|
|
66
|
-
],
|
|
67
|
-
"module": "commonjs",
|
|
68
|
-
"strict": true,
|
|
69
|
-
"strictNullChecks": false,
|
|
70
|
-
"sourceMap": true,
|
|
71
|
-
"outDir": "./app"
|
|
72
|
-
},
|
|
73
|
-
"exclude": [
|
|
74
|
-
"node_modules",
|
|
75
|
-
"**/*.spec.ts"
|
|
76
|
-
],
|
|
77
|
-
"include": [
|
|
78
|
-
"src/**/*"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
$ npm run dev
|
|
85
|
-
```
|
|
5
|
+
## 文档
|
|
6
|
+
[ZenWeb 文档](https://zenweb.node.ltd)
|
|
86
7
|
|
|
87
8
|
## 内置模块
|
|
88
9
|
1. [meta](https://www.npmjs.com/package/@zenweb/meta) 运行基本信息,例如:请求耗时
|
|
89
10
|
2. [log](https://www.npmjs.com/package/@zenweb/log) 日志支持
|
|
90
11
|
3. [router](https://www.npmjs.com/package/@zenweb/router) 路由支持
|
|
91
12
|
4. [messagecode](https://www.npmjs.com/package/@zenweb/messagecode) 统一错误消息格式化
|
|
92
|
-
5. [body](https://www.npmjs.com/package/@zenweb/body)
|
|
93
|
-
6. [
|
|
13
|
+
5. [body](https://www.npmjs.com/package/@zenweb/body) 请求主体解析,JSON、Form
|
|
14
|
+
6. [result](https://www.npmjs.com/package/@zenweb/result) 统一结果返回,成功或失败
|
|
94
15
|
7. [helper](https://www.npmjs.com/package/@zenweb/helper) 输入数据验证
|
|
95
16
|
8. [inject](https://www.npmjs.com/package/@zenweb/inject) 注入支持
|
|
96
17
|
|
|
@@ -111,3 +32,22 @@ $ npm run dev
|
|
|
111
32
|
|
|
112
33
|
## 废弃模块
|
|
113
34
|
1. [service](https://www.npmjs.com/package/@zenweb/service) 废弃,已被 3.0 注入技术替代
|
|
35
|
+
|
|
36
|
+
## Changelog
|
|
37
|
+
|
|
38
|
+
### 3.10.0
|
|
39
|
+
- update:
|
|
40
|
+
- @zenweb/core: ^3.5.0
|
|
41
|
+
- 新增: Core.moduleExists
|
|
42
|
+
- 新增: SetupHelper.assertModuleExists
|
|
43
|
+
- 修改: Core.setup 方法增加 name 参数
|
|
44
|
+
- 删除: SetupHelper.checkCoreProperty
|
|
45
|
+
- 删除: SetupHelper.checkContextProperty
|
|
46
|
+
- @zenweb/body: ^3.0.0
|
|
47
|
+
- 使用依赖注入重构,去除 xml 和 文件上传表单支持,取消的这两个作为独立模块分离。
|
|
48
|
+
- @zenweb/helper: ^3.1.0
|
|
49
|
+
- 使用依赖注入重构,不再支持 ctx.helper 调用
|
|
50
|
+
- @zenweb/router: ^3.3.0
|
|
51
|
+
- @zenweb/controller: ^3.9.0
|
|
52
|
+
- @zenweb/messagecode: ^3.2.0
|
|
53
|
+
- @zenweb/inject: ^3.18.0
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import '@zenweb/meta';
|
|
2
|
-
import '@zenweb/log';
|
|
3
|
-
import '@zenweb/messagecode';
|
|
4
|
-
import '@zenweb/body';
|
|
5
|
-
import '@zenweb/helper';
|
|
6
1
|
import { Core } from '@zenweb/core';
|
|
7
2
|
import { CreateOptions } from './types';
|
|
8
3
|
export { init, inject, factory, scope } from '@zenweb/inject';
|
|
@@ -10,6 +5,8 @@ export { Router } from '@zenweb/router';
|
|
|
10
5
|
export { ResultFail } from '@zenweb/result';
|
|
11
6
|
export { Controller, controller, mapping } from '@zenweb/controller';
|
|
12
7
|
export { Next, SetupFunction, Context, Middleware } from '@zenweb/core';
|
|
8
|
+
export { Body } from '@zenweb/body';
|
|
9
|
+
export { Helper } from '@zenweb/helper';
|
|
13
10
|
export { Core, CreateOptions, };
|
|
14
11
|
/**
|
|
15
12
|
* @param options 模块配置项
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create = exports.Core = exports.Context = exports.mapping = exports.controller = exports.Controller = exports.ResultFail = exports.Router = exports.scope = exports.factory = exports.inject = exports.init = void 0;
|
|
4
|
-
require("@zenweb/meta");
|
|
5
|
-
require("@zenweb/log");
|
|
6
|
-
require("@zenweb/messagecode");
|
|
7
|
-
require("@zenweb/body");
|
|
8
|
-
require("@zenweb/helper");
|
|
3
|
+
exports.create = exports.Core = exports.Helper = exports.Body = exports.Context = exports.mapping = exports.controller = exports.Controller = exports.ResultFail = exports.Router = exports.scope = exports.factory = exports.inject = exports.init = void 0;
|
|
9
4
|
const inject_1 = require("@zenweb/inject");
|
|
10
5
|
const meta_1 = require("@zenweb/meta");
|
|
11
6
|
const log_1 = require("@zenweb/log");
|
|
@@ -32,6 +27,10 @@ Object.defineProperty(exports, "controller", { enumerable: true, get: function (
|
|
|
32
27
|
Object.defineProperty(exports, "mapping", { enumerable: true, get: function () { return controller_2.mapping; } });
|
|
33
28
|
var core_2 = require("@zenweb/core");
|
|
34
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
|
+
var helper_2 = require("@zenweb/helper");
|
|
33
|
+
Object.defineProperty(exports, "Helper", { enumerable: true, get: function () { return helper_2.Helper; } });
|
|
35
34
|
/**
|
|
36
35
|
* @param options 模块配置项
|
|
37
36
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zenweb",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "Modular lightweight web framework based on Koa",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"url": "https://github.com/yefei/zenweb/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@zenweb/body": "^
|
|
36
|
-
"@zenweb/controller": "^3.
|
|
37
|
-
"@zenweb/core": "^3.
|
|
38
|
-
"@zenweb/helper": "^3.
|
|
39
|
-
"@zenweb/inject": "^3.
|
|
35
|
+
"@zenweb/body": "^3.0.0",
|
|
36
|
+
"@zenweb/controller": "^3.9.0",
|
|
37
|
+
"@zenweb/core": "^3.5.0",
|
|
38
|
+
"@zenweb/helper": "^3.1.0",
|
|
39
|
+
"@zenweb/inject": "^3.18.0",
|
|
40
40
|
"@zenweb/log": "^3.2.0",
|
|
41
|
-
"@zenweb/messagecode": "^3.
|
|
41
|
+
"@zenweb/messagecode": "^3.2.0",
|
|
42
42
|
"@zenweb/meta": "^2.4.0",
|
|
43
43
|
"@zenweb/result": "^3.0.0",
|
|
44
|
-
"@zenweb/router": "^3.
|
|
44
|
+
"@zenweb/router": "^3.3.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"cross-env": "^7.0.3",
|