@x-9lab/xlab 1.0.0-alpha.1 → 1.0.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/@types/@config/config.d.ts +2 -0
- package/@types/@config/config.dev.d.ts +2 -0
- package/@types/@config/config.sand.d.ts +2 -0
- package/@types/business/utils/cookie/1.1.0/clean/index.d.ts +3 -0
- package/@types/business/utils/cookie/1.1.0/clean/js/index.d.ts +2 -0
- package/@types/cluster.d.ts +5 -0
- package/@types/components/assets/index.d.ts +7 -0
- package/@types/components/cache/index.d.ts +2 -0
- package/@types/components/cache/lru.d.ts +21 -0
- package/@types/components/cluster/index.d.ts +20 -0
- package/@types/components/combo/index.d.ts +4 -0
- package/@types/components/common.d.ts +169 -0
- package/@types/components/cron.d.ts +23 -0
- package/@types/components/header/index.d.ts +41 -0
- package/@types/components/header/time.d.ts +3 -0
- package/@types/components/html-processor/index.d.ts +9 -0
- package/@types/components/injection/index.d.ts +25 -0
- package/@types/components/js-processor/index.d.ts +5 -0
- package/@types/components/log.d.ts +4 -0
- package/@types/components/md5/index.d.ts +2 -0
- package/@types/components/mime/index.d.ts +11 -0
- package/@types/components/platform/index.d.ts +21 -0
- package/@types/components/proxy/index.d.ts +26 -0
- package/@types/components/querystring/index.d.ts +25 -0
- package/@types/components/redirect/index.d.ts +11 -0
- package/@types/components/return-code.d.ts +159 -0
- package/@types/components/uuid/index.d.ts +7 -0
- package/@types/components/version/index.d.ts +26 -0
- package/@types/config/getEnv.d.ts +10 -0
- package/@types/config/index.d.ts +17 -0
- package/@types/config/process-custom-config-files.d.ts +2 -0
- package/@types/config/process-def-config-file.d.ts +2 -0
- package/@types/custom.d.ts +3 -0
- package/@types/global.d.ts +185 -0
- package/@types/middleware/@bin/html-filter.d.ts +3 -0
- package/@types/middleware/bad-request.d.ts +3 -0
- package/@types/middleware/combo.d.ts +2 -0
- package/@types/middleware/compress.d.ts +2 -0
- package/@types/middleware/cors.d.ts +12 -0
- package/@types/middleware/fresh-filter.d.ts +4 -0
- package/@types/middleware/handle-pre-dir.d.ts +6 -0
- package/@types/middleware/request-filter.d.ts +4 -0
- package/@types/middleware/service-mark.d.ts +7 -0
- package/@types/middlewares.d.ts +4 -0
- package/@types/router.d.ts +4 -0
- package/@types/server.d.ts +10 -0
- package/README.md +13 -0
- package/dist/bin/watch.js +1 -1
- package/dist/components/cache/lru.js +18 -0
- package/dist/components/common.js +2 -1
- package/package.json +7 -2
- package/dist/package.json +0 -61
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 生成或获取一个缓存实例
|
|
3
|
+
* @param cacheName 实例名称
|
|
4
|
+
* @param conf 缓存配置,仅在生成的时候有效
|
|
5
|
+
* @return 缓存实例
|
|
6
|
+
*/
|
|
7
|
+
declare function create(cacheName: string, conf: Record<string, XLab.JsonValue>): any;
|
|
8
|
+
export { create };
|
|
9
|
+
/**
|
|
10
|
+
* 获取一个缓存实例
|
|
11
|
+
* @param name 缓存名称
|
|
12
|
+
* @param conf 缓存配置
|
|
13
|
+
*/
|
|
14
|
+
declare function get(name: string, conf?: Record<string, XLab.JsonValue>): any;
|
|
15
|
+
export { get };
|
|
16
|
+
/**
|
|
17
|
+
* 获取当前缓存实例数量
|
|
18
|
+
* @return 缓存数量
|
|
19
|
+
*/
|
|
20
|
+
declare function len(): number;
|
|
21
|
+
export { len };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取一个消息处理函数
|
|
3
|
+
* @param cmd 消息名称
|
|
4
|
+
* @return 消息对应处理函数
|
|
5
|
+
*/
|
|
6
|
+
declare function get(cmd: string): Function;
|
|
7
|
+
export { get };
|
|
8
|
+
/**
|
|
9
|
+
* 添加一个消息处理函数
|
|
10
|
+
* @param cmd 消息名称
|
|
11
|
+
* @param cb 消息处理函数
|
|
12
|
+
*/
|
|
13
|
+
declare function add(cmd: string, cb: Function): void;
|
|
14
|
+
export { add };
|
|
15
|
+
/**
|
|
16
|
+
* 删除一个消息处理函数
|
|
17
|
+
* @param {String} cmd 消息名称
|
|
18
|
+
*/
|
|
19
|
+
declare function del(cmd: string): void;
|
|
20
|
+
export { del };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
/**
|
|
4
|
+
* ascii字符串转为base64字符串
|
|
5
|
+
* @param str 要转化的字符串
|
|
6
|
+
* @return 转化后的字符串
|
|
7
|
+
*/
|
|
8
|
+
declare function asciiTobase64(str: string): string;
|
|
9
|
+
export { asciiTobase64 };
|
|
10
|
+
/**
|
|
11
|
+
* base64字符串转为ascii字符串
|
|
12
|
+
* @param str 要转化的字符串
|
|
13
|
+
* @return 转化后的字符串
|
|
14
|
+
*/
|
|
15
|
+
declare function base64Toascii(str: string): string;
|
|
16
|
+
export { base64Toascii };
|
|
17
|
+
/**
|
|
18
|
+
* 序列化请求参数
|
|
19
|
+
* @param dat 请求参数对象
|
|
20
|
+
* @param url 要附加请求参数的URL
|
|
21
|
+
* @return 序列化完的参数
|
|
22
|
+
*/
|
|
23
|
+
declare function params(dat: Record<string, any>, url: string): string;
|
|
24
|
+
export { params };
|
|
25
|
+
/**
|
|
26
|
+
* 按位数格式化数字
|
|
27
|
+
* @param val 要格式化的数字
|
|
28
|
+
* @param separator 分割符
|
|
29
|
+
* @param size 分割位数间隔
|
|
30
|
+
* @return 格式化完的字符串
|
|
31
|
+
*/
|
|
32
|
+
declare function numberFormat(val: number, separator: string, size: number): string;
|
|
33
|
+
export { numberFormat };
|
|
34
|
+
/**
|
|
35
|
+
* 批量替换字符串中带花括号标签为指定数据
|
|
36
|
+
* @param tpl 待处理的字符串
|
|
37
|
+
* @param data 替换数据
|
|
38
|
+
* @return 替换后端字符串
|
|
39
|
+
*/
|
|
40
|
+
declare function labelReplace(tpl: string, data: Record<string, XLab.JsonValue>): string;
|
|
41
|
+
/**
|
|
42
|
+
* 批量替换字符串中带花括号标签为指定数据
|
|
43
|
+
* @param tpl 待处理的字符串
|
|
44
|
+
* @param data 替换数据
|
|
45
|
+
* @return 替换后端字符串
|
|
46
|
+
*/
|
|
47
|
+
declare function labelReplace(tpl: string, data: XLab.JsonValue): string;
|
|
48
|
+
export { labelReplace };
|
|
49
|
+
/**
|
|
50
|
+
* 格式化数字, 自动补0前续
|
|
51
|
+
* @param number 要格式化的数字
|
|
52
|
+
* @param size 格式化后出来的数字位数
|
|
53
|
+
* @return 格式化结果
|
|
54
|
+
*/
|
|
55
|
+
declare function fix0(number: number, size: number): string;
|
|
56
|
+
export { fix0 };
|
|
57
|
+
/**
|
|
58
|
+
* 格式化时间
|
|
59
|
+
* @param format 日期格式
|
|
60
|
+
* @param date 时间戳
|
|
61
|
+
* @return 格式化后的时间
|
|
62
|
+
*/
|
|
63
|
+
declare function date(format: string, ts: number): string;
|
|
64
|
+
/**
|
|
65
|
+
* 格式化时间
|
|
66
|
+
* @param format 日期格式
|
|
67
|
+
* @param date 日期字符串
|
|
68
|
+
* @return 格式化后的时间
|
|
69
|
+
*/
|
|
70
|
+
declare function date(format: string, ts: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* 格式化时间
|
|
73
|
+
* @param format 日期格式
|
|
74
|
+
* @param date 日期对象
|
|
75
|
+
* @return 格式化后的时间
|
|
76
|
+
*/
|
|
77
|
+
declare function date(format: string, ts: Date): string;
|
|
78
|
+
export { date };
|
|
79
|
+
/**
|
|
80
|
+
* 生成操作结果数据对象
|
|
81
|
+
* @param status 返回码
|
|
82
|
+
* @param result 返回的数据,数据格式根据具体模块而定
|
|
83
|
+
* @param msg 返回的提示性信息
|
|
84
|
+
* @return 数据对象
|
|
85
|
+
*/
|
|
86
|
+
declare function responseResult<T = any>(status: number, result?: T, msg?: string): XLab.IStdRes;
|
|
87
|
+
/**
|
|
88
|
+
* 生成操作结果数据对象
|
|
89
|
+
* @param status 操作结果
|
|
90
|
+
* @param result 返回的数据,数据格式根据具体模块而定
|
|
91
|
+
* @param msg 返回的提示性信息
|
|
92
|
+
* @return 数据对象
|
|
93
|
+
*/
|
|
94
|
+
declare function responseResult<T = any>(status: boolean, result?: T, msg?: string): XLab.IStdRes;
|
|
95
|
+
/**
|
|
96
|
+
* 生成操作结果数据对象
|
|
97
|
+
* @param status 返回结果数据
|
|
98
|
+
* @param result 返回的数据,数据格式根据具体模块而定
|
|
99
|
+
* @param msg 返回的提示性信息
|
|
100
|
+
* @return 数据对象
|
|
101
|
+
*/
|
|
102
|
+
declare function responseResult<T = any>(status: XLab.ICodeItem, result?: T, msg?: string): XLab.IStdRes;
|
|
103
|
+
export { responseResult };
|
|
104
|
+
/**
|
|
105
|
+
* 根据传入的参数生成一个 MD5 值
|
|
106
|
+
*/
|
|
107
|
+
declare function getMD5(...args: any[]): string;
|
|
108
|
+
export { getMD5 };
|
|
109
|
+
/**
|
|
110
|
+
* 对象值转化为数组
|
|
111
|
+
* @param obj 待转的对象
|
|
112
|
+
* @return 转化后的数组
|
|
113
|
+
*/
|
|
114
|
+
declare function object2Array(obj: XLab.JsonObject): any[];
|
|
115
|
+
export { object2Array };
|
|
116
|
+
/**
|
|
117
|
+
* 默认 Promise 处理函数
|
|
118
|
+
* @param resolve Promise 成功处理函数
|
|
119
|
+
* @param reject Promise 异常处理函数
|
|
120
|
+
*/
|
|
121
|
+
declare function defPromiseHandler<T = any>(resolve: Function, reject: Function): (err: Error, re: T) => void;
|
|
122
|
+
export { defPromiseHandler };
|
|
123
|
+
/**Promise 包装函数 */
|
|
124
|
+
declare function promiseWapper(...args: any[]): Promise<unknown>;
|
|
125
|
+
export { promiseWapper };
|
|
126
|
+
/**
|
|
127
|
+
* 封装一个 promise 形式的 request 方法
|
|
128
|
+
*/
|
|
129
|
+
declare function requestWapper<T = any>(...args: any[]): Promise<unknown>;
|
|
130
|
+
export { requestWapper };
|
|
131
|
+
/**
|
|
132
|
+
* 格式化 JSON 数据
|
|
133
|
+
* @param data 原始数据字符串
|
|
134
|
+
* @return 格式化后的数据
|
|
135
|
+
*/
|
|
136
|
+
declare function formatJson<T = XLab.JsonObject>(data: string): T;
|
|
137
|
+
export { formatJson };
|
|
138
|
+
/**
|
|
139
|
+
* 输出 sjonp 格式
|
|
140
|
+
* @param data 待处理数据
|
|
141
|
+
* @param jsonp jsonp 回调函数名称
|
|
142
|
+
* @return 当是 jsonp 格式时返回 String, 不是时返回原始数据
|
|
143
|
+
*/
|
|
144
|
+
declare function toJsonp(data: XLab.JsonObject, jsonp: string): string | XLab.JsonObject;
|
|
145
|
+
export { toJsonp };
|
|
146
|
+
/**
|
|
147
|
+
* 查找到文件时的处理函数
|
|
148
|
+
* @param tmpPath 文件地址
|
|
149
|
+
*/
|
|
150
|
+
declare type WalkCallback = (tmpPath: string, item: string) => void;
|
|
151
|
+
/**
|
|
152
|
+
* 递归处理文件夹
|
|
153
|
+
* @param path 文件目录
|
|
154
|
+
* @param floor 层级
|
|
155
|
+
* @param callback 查找到文件时的处理函数
|
|
156
|
+
*/
|
|
157
|
+
declare function walk(path: string, floor: number, callback: WalkCallback): void;
|
|
158
|
+
export { walk };
|
|
159
|
+
/**
|
|
160
|
+
* 检测指定文件是否存在
|
|
161
|
+
* @param pathStr 文件路径
|
|
162
|
+
* @param resolve 是否使用 path 模块重新处理路径
|
|
163
|
+
* @return 文件信息,文件不存在为 null
|
|
164
|
+
*/
|
|
165
|
+
declare function checkFileStat(pathStr: string, resolve?: boolean): fs.Stats;
|
|
166
|
+
export { checkFileStat };
|
|
167
|
+
/**获取真正可执行的模块 */
|
|
168
|
+
declare function getRealDefaultMod(mod: any): any;
|
|
169
|
+
export { getRealDefaultMod };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**定时任务模块 */
|
|
2
|
+
interface ICronJob {
|
|
3
|
+
/**定时任务 */
|
|
4
|
+
(): void;
|
|
5
|
+
/**获取定时任务间隔时间 */
|
|
6
|
+
getDelay?: () => number;
|
|
7
|
+
/**获取定时任务开启状态 */
|
|
8
|
+
enable?: () => boolean;
|
|
9
|
+
}
|
|
10
|
+
export type { ICronJob };
|
|
11
|
+
/**
|
|
12
|
+
* 启动指定目录下的所有计时任务
|
|
13
|
+
* @param dirPath 任务目录
|
|
14
|
+
* @return 无返回值
|
|
15
|
+
*/
|
|
16
|
+
declare function on(dirPath: string): void;
|
|
17
|
+
export { on };
|
|
18
|
+
/**
|
|
19
|
+
* 停止一个或所有的计时器
|
|
20
|
+
* @param name 计时器名称
|
|
21
|
+
*/
|
|
22
|
+
declare function kill(name: string): void;
|
|
23
|
+
export { kill };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type Koa from "koa";
|
|
2
|
+
/**
|
|
3
|
+
* 设置 Cache-Control
|
|
4
|
+
* @param options max-age 缓存时间字符串
|
|
5
|
+
* @param res 请求上下文
|
|
6
|
+
*/
|
|
7
|
+
declare function cacheControl(options: string, res: Koa.Context): void;
|
|
8
|
+
/**
|
|
9
|
+
* 设置 Cache-Control
|
|
10
|
+
* @param options max-age 缓存时间数
|
|
11
|
+
* @param res 请求上下文
|
|
12
|
+
*/
|
|
13
|
+
declare function cacheControl(options: number, res: Koa.Context): void;
|
|
14
|
+
export { cacheControl };
|
|
15
|
+
/**
|
|
16
|
+
* 设置 Expires
|
|
17
|
+
* @param options Expires 缓存时间字符串
|
|
18
|
+
* @param res 请求上下文
|
|
19
|
+
*/
|
|
20
|
+
declare function expire(options: string, res: Koa.Context): void;
|
|
21
|
+
/**
|
|
22
|
+
* 设置 Expires
|
|
23
|
+
* @param options Expires 缓存时间
|
|
24
|
+
* @param res 请求上下文
|
|
25
|
+
*/
|
|
26
|
+
declare function expire(options: number, res: Koa.Context): void;
|
|
27
|
+
export { expire };
|
|
28
|
+
/**
|
|
29
|
+
* 设置 Content-Type
|
|
30
|
+
* @param options 类型
|
|
31
|
+
* @param res 请求上下文
|
|
32
|
+
*/
|
|
33
|
+
declare function contentType(options: string, res: Koa.Context): void;
|
|
34
|
+
export { contentType };
|
|
35
|
+
/**
|
|
36
|
+
* 设置 Last-Modified
|
|
37
|
+
* @param options 最后更新时间,传入非 String 类型时会使用当前时间
|
|
38
|
+
* @param res 请求上下文
|
|
39
|
+
*/
|
|
40
|
+
declare function lastModified(options: string, res: Koa.Context): void;
|
|
41
|
+
export { lastModified };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type Koa from "koa";
|
|
2
|
+
declare type RouteOption = Record<string, string | string[]>;
|
|
3
|
+
interface HtmlProcessorOptions {
|
|
4
|
+
route?: RouteOption;
|
|
5
|
+
}
|
|
6
|
+
declare function htmlProcessor(pathname: string, options: HtmlProcessorOptions, context: Koa.Context): string;
|
|
7
|
+
declare function init(): void;
|
|
8
|
+
export { init };
|
|
9
|
+
export { htmlProcessor };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type Koa from "koa";
|
|
2
|
+
/**
|
|
3
|
+
* 数据注入方法
|
|
4
|
+
* @param html 待处理的字符串
|
|
5
|
+
* @param req 请求对象
|
|
6
|
+
* @return 处理完的字符串
|
|
7
|
+
*/
|
|
8
|
+
declare function inject(html: string, req: Koa.Context): string;
|
|
9
|
+
export { inject };
|
|
10
|
+
/**
|
|
11
|
+
* 添加一个字段到缓存对象
|
|
12
|
+
* @param key 字段名
|
|
13
|
+
* @param val 数据
|
|
14
|
+
* @return 存储的数据
|
|
15
|
+
*/
|
|
16
|
+
declare function add(key: string, val: XLab.JsonValue): any;
|
|
17
|
+
export { add };
|
|
18
|
+
/**
|
|
19
|
+
* 修改一个字段
|
|
20
|
+
* @param key 字段名
|
|
21
|
+
* @param val 数据
|
|
22
|
+
* @return 存储的数据
|
|
23
|
+
*/
|
|
24
|
+
declare function modify(key: string, val: XLab.JsonValue): boolean;
|
|
25
|
+
export { modify };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface IPlat {
|
|
2
|
+
/**平台类型,mobile 或 desktop */
|
|
3
|
+
is: string;
|
|
4
|
+
/**是否是微信 */
|
|
5
|
+
wechat?: boolean;
|
|
6
|
+
/**是否是支付宝 */
|
|
7
|
+
alipay?: boolean;
|
|
8
|
+
/**是否是微博 */
|
|
9
|
+
weibo?: boolean;
|
|
10
|
+
/**是否是 Windows 系统 */
|
|
11
|
+
win?: boolean;
|
|
12
|
+
/**是否是 Mac 系统 */
|
|
13
|
+
mac?: boolean;
|
|
14
|
+
/**是否是 Linux 系统 */
|
|
15
|
+
linux?: string;
|
|
16
|
+
/**操作系统信息 */
|
|
17
|
+
os?: string;
|
|
18
|
+
}
|
|
19
|
+
export type { IPlat };
|
|
20
|
+
declare function check(ua: string): IPlat;
|
|
21
|
+
export { check };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type Koa from "koa";
|
|
2
|
+
/**代理配置项 */
|
|
3
|
+
interface IProxyOption {
|
|
4
|
+
/**代理目标 */
|
|
5
|
+
target: string;
|
|
6
|
+
/**代理域名 */
|
|
7
|
+
host: string;
|
|
8
|
+
}
|
|
9
|
+
declare module "http" {
|
|
10
|
+
interface IncomingMessage {
|
|
11
|
+
/**代理类型 */
|
|
12
|
+
proxyType: string;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 设置代理配置
|
|
17
|
+
* @param type 代理配置名称
|
|
18
|
+
* @param options 配置信息
|
|
19
|
+
*/
|
|
20
|
+
declare function set(type: string, options: IProxyOption | string): IProxyOption;
|
|
21
|
+
export { set };
|
|
22
|
+
/**
|
|
23
|
+
* web 代理
|
|
24
|
+
*/
|
|
25
|
+
declare function web(reqObj: Koa.Context, headers: any): Promise<unknown>;
|
|
26
|
+
export { web };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import qs from "querystring";
|
|
3
|
+
/**
|
|
4
|
+
* 将 URL 参数转换为字符串
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* query2string({"pf":"145","ss":"320x240"});
|
|
8
|
+
* query2string({"pf":"145","ss":"320x240"},["pf"]);
|
|
9
|
+
* query2string({"pf":"145","ss":"320x240"},{"fr":"android"});
|
|
10
|
+
* query2string({"pf":"145","ss":"320x240"},{"fr":"android"},["fr"]);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare function query2string(...args: Array<XLab.JsonObject | string[]>): string;
|
|
14
|
+
export { query2string };
|
|
15
|
+
/**
|
|
16
|
+
* 字符串转成参数对象
|
|
17
|
+
* @param qString 参数字符串
|
|
18
|
+
* @return 处理完的对象
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* string2query("pf=145&ss=320x240");
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function string2query(qString: string): qs.ParsedUrlQuery;
|
|
25
|
+
export { string2query };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { ParsedUrlQuery } from "querystring";
|
|
3
|
+
import type Koa from "koa";
|
|
4
|
+
declare function by302(context: Koa.Context, url: string): void;
|
|
5
|
+
export { by302 };
|
|
6
|
+
declare function byJS(context: Koa.Context, url: string, msg: string, origin: string): void;
|
|
7
|
+
export { byJS };
|
|
8
|
+
declare function byMeta(context: Koa.Context, url: string): void;
|
|
9
|
+
export { byMeta };
|
|
10
|
+
declare function makeRedirectUrl(query: ParsedUrlQuery, url: string): string;
|
|
11
|
+
export { makeRedirectUrl };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 状态详细信息
|
|
3
|
+
*/
|
|
4
|
+
declare const CODE_DETAIL: {
|
|
5
|
+
FAIL: {
|
|
6
|
+
errorcode: number;
|
|
7
|
+
msg: string;
|
|
8
|
+
};
|
|
9
|
+
SUCCESS: {
|
|
10
|
+
errorcode: number;
|
|
11
|
+
msg: string;
|
|
12
|
+
};
|
|
13
|
+
BUSY: {
|
|
14
|
+
errorcode: number;
|
|
15
|
+
msg: string;
|
|
16
|
+
};
|
|
17
|
+
WRONG_PARAMETER: {
|
|
18
|
+
errorcode: number;
|
|
19
|
+
msg: string;
|
|
20
|
+
};
|
|
21
|
+
NOT_FOUND: {
|
|
22
|
+
errorcode: number;
|
|
23
|
+
msg: string;
|
|
24
|
+
};
|
|
25
|
+
PERMISSION_DENIED: {
|
|
26
|
+
errorcode: number;
|
|
27
|
+
msg: string;
|
|
28
|
+
};
|
|
29
|
+
SERVER_BUSY: {
|
|
30
|
+
errorcode: number;
|
|
31
|
+
msg: string;
|
|
32
|
+
};
|
|
33
|
+
SERVER_TIMEOUT: {
|
|
34
|
+
errorcode: number;
|
|
35
|
+
msg: string;
|
|
36
|
+
};
|
|
37
|
+
UNCHECK_ERROR: {
|
|
38
|
+
errorcode: number;
|
|
39
|
+
msg: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 根据状态码获取错误定义信息
|
|
44
|
+
* @param code 状态码
|
|
45
|
+
* @param msg 返回信息<可选>
|
|
46
|
+
* @return 状态对象
|
|
47
|
+
*/
|
|
48
|
+
declare function getReturnCode(code: number, msg?: string): XLab.ICodeItem;
|
|
49
|
+
/**
|
|
50
|
+
* 根据状态名称获取错误定义信息
|
|
51
|
+
* @param code 状态名称
|
|
52
|
+
* @param msg 返回信息<可选>
|
|
53
|
+
* @return 状态对象
|
|
54
|
+
*/
|
|
55
|
+
declare function getReturnCode(code: keyof typeof CODE_DETAIL, msg?: string): XLab.ICodeItem;
|
|
56
|
+
/**
|
|
57
|
+
* 根据状态名称获取错误定义信息
|
|
58
|
+
* @param code 状态名称
|
|
59
|
+
* @param msg 返回信息<可选>
|
|
60
|
+
* @return 状态对象
|
|
61
|
+
*/
|
|
62
|
+
declare function getReturnCode(code: string, msg?: string): XLab.ICodeItem;
|
|
63
|
+
/**
|
|
64
|
+
* 根据状态获取错误定义信息
|
|
65
|
+
* @param code 状态
|
|
66
|
+
* @param msg 返回信息<可选>
|
|
67
|
+
* @return 状态对象
|
|
68
|
+
*/
|
|
69
|
+
declare function getReturnCode(code: boolean, msg?: string): XLab.ICodeItem;
|
|
70
|
+
export { getReturnCode };
|
|
71
|
+
/**
|
|
72
|
+
* 获取错误代码
|
|
73
|
+
* @return 错误代码
|
|
74
|
+
*/
|
|
75
|
+
declare function getCodeDetail(): {
|
|
76
|
+
FAIL: {
|
|
77
|
+
errorcode: number;
|
|
78
|
+
msg: string;
|
|
79
|
+
};
|
|
80
|
+
SUCCESS: {
|
|
81
|
+
errorcode: number;
|
|
82
|
+
msg: string;
|
|
83
|
+
};
|
|
84
|
+
BUSY: {
|
|
85
|
+
errorcode: number;
|
|
86
|
+
msg: string;
|
|
87
|
+
};
|
|
88
|
+
WRONG_PARAMETER: {
|
|
89
|
+
errorcode: number;
|
|
90
|
+
msg: string;
|
|
91
|
+
};
|
|
92
|
+
NOT_FOUND: {
|
|
93
|
+
errorcode: number;
|
|
94
|
+
msg: string;
|
|
95
|
+
};
|
|
96
|
+
PERMISSION_DENIED: {
|
|
97
|
+
errorcode: number;
|
|
98
|
+
msg: string;
|
|
99
|
+
};
|
|
100
|
+
SERVER_BUSY: {
|
|
101
|
+
errorcode: number;
|
|
102
|
+
msg: string;
|
|
103
|
+
};
|
|
104
|
+
SERVER_TIMEOUT: {
|
|
105
|
+
errorcode: number;
|
|
106
|
+
msg: string;
|
|
107
|
+
};
|
|
108
|
+
UNCHECK_ERROR: {
|
|
109
|
+
errorcode: number;
|
|
110
|
+
msg: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export { getCodeDetail };
|
|
114
|
+
/**
|
|
115
|
+
* 设置新的错误代码
|
|
116
|
+
* @param data 新的错误代码数据
|
|
117
|
+
*/
|
|
118
|
+
declare function set(data: XLab.ICodeDetail): void;
|
|
119
|
+
export { set };
|
|
120
|
+
/**错误类型对象 */
|
|
121
|
+
declare const ErrorTypes: {
|
|
122
|
+
FAIL: {
|
|
123
|
+
errorcode: number;
|
|
124
|
+
msg: string;
|
|
125
|
+
};
|
|
126
|
+
SUCCESS: {
|
|
127
|
+
errorcode: number;
|
|
128
|
+
msg: string;
|
|
129
|
+
};
|
|
130
|
+
BUSY: {
|
|
131
|
+
errorcode: number;
|
|
132
|
+
msg: string;
|
|
133
|
+
};
|
|
134
|
+
WRONG_PARAMETER: {
|
|
135
|
+
errorcode: number;
|
|
136
|
+
msg: string;
|
|
137
|
+
};
|
|
138
|
+
NOT_FOUND: {
|
|
139
|
+
errorcode: number;
|
|
140
|
+
msg: string;
|
|
141
|
+
};
|
|
142
|
+
PERMISSION_DENIED: {
|
|
143
|
+
errorcode: number;
|
|
144
|
+
msg: string;
|
|
145
|
+
};
|
|
146
|
+
SERVER_BUSY: {
|
|
147
|
+
errorcode: number;
|
|
148
|
+
msg: string;
|
|
149
|
+
};
|
|
150
|
+
SERVER_TIMEOUT: {
|
|
151
|
+
errorcode: number;
|
|
152
|
+
msg: string;
|
|
153
|
+
};
|
|
154
|
+
UNCHECK_ERROR: {
|
|
155
|
+
errorcode: number;
|
|
156
|
+
msg: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
export { ErrorTypes };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 比较版本
|
|
3
|
+
* @param v1 样本版本
|
|
4
|
+
* @param v2 对比版本
|
|
5
|
+
* @returns 对比结果:
|
|
6
|
+
* - 1 样本大于对比
|
|
7
|
+
* - 0 两者相等
|
|
8
|
+
* - -1 对比大于样本
|
|
9
|
+
*/
|
|
10
|
+
declare function compareVersion(v1: string, v2: string): 1 | -1 | 0;
|
|
11
|
+
export { compareVersion };
|
|
12
|
+
/**
|
|
13
|
+
* 匹配范围
|
|
14
|
+
* @param range 版本范围
|
|
15
|
+
* @param v 对比版本
|
|
16
|
+
*/
|
|
17
|
+
declare function matchRange(range: string, v: string): boolean;
|
|
18
|
+
export { matchRange };
|
|
19
|
+
/**
|
|
20
|
+
* 匹配任意
|
|
21
|
+
* @param range 范围
|
|
22
|
+
* @param v 对比
|
|
23
|
+
* @param ignoreCase 忽略大小写
|
|
24
|
+
*/
|
|
25
|
+
declare function matchAny(range: string, v: string, ignoreCase?: boolean): boolean;
|
|
26
|
+
export { matchAny };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通用日志方法
|
|
3
|
+
* @param cat 业务类型
|
|
4
|
+
* @param type 日志等级
|
|
5
|
+
*/
|
|
6
|
+
declare function commonLog(cat: string, type: string): void;
|
|
7
|
+
export { commonLog as log };
|
|
8
|
+
/**
|
|
9
|
+
* 默认配置
|
|
10
|
+
*/
|
|
11
|
+
declare const CONFIG: XLab.IConfig;
|
|
12
|
+
export default CONFIG;
|
|
13
|
+
declare function get(): XLab.IConfig;
|
|
14
|
+
export { get };
|
|
15
|
+
/**更新配置 */
|
|
16
|
+
declare function update(conf: XLab.IConfig): XLab.IConfig;
|
|
17
|
+
export { update };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
export type { IPlat } from "./components/platform";
|
|
2
|
+
import type Koa from "koa";
|
|
3
|
+
/**内置组件 */
|
|
4
|
+
interface InternalComponents {
|
|
5
|
+
assets: typeof import("./components/assets");
|
|
6
|
+
cache: typeof import("./components/cache");
|
|
7
|
+
cluster: typeof import("./components/cluster");
|
|
8
|
+
combo: typeof import("./components/combo");
|
|
9
|
+
header: typeof import("./components/header");
|
|
10
|
+
"html-processor": typeof import("./components/html-processor");
|
|
11
|
+
injection: typeof import("./components/injection");
|
|
12
|
+
"js-processor": typeof import("./components/js-processor");
|
|
13
|
+
md5: typeof import("./components/md5");
|
|
14
|
+
mime: typeof import("./components/mime");
|
|
15
|
+
platform: typeof import("./components/platform");
|
|
16
|
+
querystring: typeof import("./components/querystring");
|
|
17
|
+
redirect: typeof import("./components/redirect");
|
|
18
|
+
uuid: typeof import("./components/uuid");
|
|
19
|
+
version: typeof import("./components/version");
|
|
20
|
+
cron: typeof import("./components/cron");
|
|
21
|
+
log: typeof import("./components/log");
|
|
22
|
+
"return-code": typeof import("./components/return-code");
|
|
23
|
+
common: typeof import("./components/common");
|
|
24
|
+
}
|
|
25
|
+
declare global {
|
|
26
|
+
/**全局日志对象 */
|
|
27
|
+
var log: any;
|
|
28
|
+
/**只在 master 上输出的日志 */
|
|
29
|
+
var masterLog: any;
|
|
30
|
+
/**
|
|
31
|
+
* 获取应用实例对象
|
|
32
|
+
*/
|
|
33
|
+
function getApp(): Koa;
|
|
34
|
+
/**
|
|
35
|
+
* 获取内置组件
|
|
36
|
+
* @param name 模块名
|
|
37
|
+
* @return 模块对象
|
|
38
|
+
*/
|
|
39
|
+
function requireMod<T extends InternalComponents[K], K extends keyof InternalComponents>(name: K): T;
|
|
40
|
+
/**
|
|
41
|
+
* 全局获取 model 的方法
|
|
42
|
+
* @param name model 名称
|
|
43
|
+
* @return model 模块
|
|
44
|
+
*/
|
|
45
|
+
function requireModel<T extends XLab.IModels[K], K extends keyof XLab.IModels>(name: K): T;
|
|
46
|
+
/**
|
|
47
|
+
* 全局获取 service 的方法
|
|
48
|
+
* @param name service 名称
|
|
49
|
+
* @return service 模块
|
|
50
|
+
*/
|
|
51
|
+
function requireService<T extends XLab.IServices[K], K extends keyof XLab.IServices>(name: K): T;
|
|
52
|
+
/**
|
|
53
|
+
* 获取系统配置
|
|
54
|
+
*/
|
|
55
|
+
function getSysConfig(): XLab.IConfig;
|
|
56
|
+
/**
|
|
57
|
+
* 获取系统配置
|
|
58
|
+
* @param key 配置项
|
|
59
|
+
*/
|
|
60
|
+
function getSysConfig<T extends XLab.IConfig[K], K extends keyof XLab.IConfig>(key?: K): T;
|
|
61
|
+
/**
|
|
62
|
+
* 获取系统配置
|
|
63
|
+
* @param key 配置项
|
|
64
|
+
*/
|
|
65
|
+
function getSysConfig(key?: any): any;
|
|
66
|
+
/**
|
|
67
|
+
* 更新系统配置
|
|
68
|
+
* @param conf 配置项
|
|
69
|
+
*/
|
|
70
|
+
function setSysConfig(conf: XLab.IConfig): void;
|
|
71
|
+
namespace XLab {
|
|
72
|
+
/**JSON 基本数据类型 */
|
|
73
|
+
type JsonValue = boolean | string | number | null | undefined | JsonArray | JsonObject;
|
|
74
|
+
/**包含 JSON 的数组 */
|
|
75
|
+
type JsonArray = JsonValue[];
|
|
76
|
+
/**包含 JSON 数据的 JSON */
|
|
77
|
+
interface JsonObject {
|
|
78
|
+
[key: string]: JsonValue;
|
|
79
|
+
}
|
|
80
|
+
/**包含复合值的数组 */
|
|
81
|
+
type CompositeArray = CompositeValue[];
|
|
82
|
+
/**复合值 */
|
|
83
|
+
type CompositeValue = JsonValue | CompositeArray | CompositeObject;
|
|
84
|
+
/**包含复合值的对象 */
|
|
85
|
+
interface CompositeObject {
|
|
86
|
+
[key: string]: CompositeValue;
|
|
87
|
+
}
|
|
88
|
+
/**业务服务 */
|
|
89
|
+
interface IServices {
|
|
90
|
+
}
|
|
91
|
+
/**业务数据模型 */
|
|
92
|
+
interface IModels {
|
|
93
|
+
}
|
|
94
|
+
/**标准返回数据 */
|
|
95
|
+
interface IStdRes<T = any> {
|
|
96
|
+
/**业务执行状态码 */
|
|
97
|
+
code: number;
|
|
98
|
+
/**业务数据 */
|
|
99
|
+
result: T;
|
|
100
|
+
/**操作信息 */
|
|
101
|
+
msg?: string;
|
|
102
|
+
/**操作结果 */
|
|
103
|
+
success?: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface IConfig {
|
|
106
|
+
/**服务(应用)名称 */
|
|
107
|
+
name?: string;
|
|
108
|
+
/**版本 */
|
|
109
|
+
version?: string;
|
|
110
|
+
/**环境标识 */
|
|
111
|
+
env?: string;
|
|
112
|
+
/**业务绑定的域名 */
|
|
113
|
+
host?: string;
|
|
114
|
+
/**是否开启 304 协商缓存 */
|
|
115
|
+
304?: boolean;
|
|
116
|
+
/**Worker 数量 */
|
|
117
|
+
workers?: number;
|
|
118
|
+
/**业务服务器地址 */
|
|
119
|
+
biServer?: string;
|
|
120
|
+
/**业务服务器协议 */
|
|
121
|
+
protocol?: string;
|
|
122
|
+
/**是否开启 debug 模式 */
|
|
123
|
+
debug?: boolean;
|
|
124
|
+
/**静态文件缓存时间 */
|
|
125
|
+
staticMaxage?: number;
|
|
126
|
+
/**静态 html 文件缓存时间 */
|
|
127
|
+
staticHtmlFileMaxage?: number;
|
|
128
|
+
/**是否开启 Combo 缓存 */
|
|
129
|
+
enableComboCache?: boolean;
|
|
130
|
+
/**是否开启定时任务 */
|
|
131
|
+
enableCron?: boolean;
|
|
132
|
+
/**开启的中间件列表 */
|
|
133
|
+
middleware?: (string | (string | Record<string, any>)[])[];
|
|
134
|
+
/**自定模块配置 */
|
|
135
|
+
custom?: string[];
|
|
136
|
+
/**是否启用严格 ssl */
|
|
137
|
+
strictSSL?: boolean;
|
|
138
|
+
/**页端注入的 api 设置 */
|
|
139
|
+
apis?: Record<string, string>;
|
|
140
|
+
/**服务 ip 地址 */
|
|
141
|
+
ip?: string;
|
|
142
|
+
/**本地是否存在本地开发配置文件 config.lo.json */
|
|
143
|
+
hasLo?: boolean;
|
|
144
|
+
/**不处理业务 api */
|
|
145
|
+
passExtApis?: boolean;
|
|
146
|
+
/**是否是生产环境 */
|
|
147
|
+
isProd?: boolean;
|
|
148
|
+
/**是否允许页端缓存 */
|
|
149
|
+
allowCache?: boolean;
|
|
150
|
+
/**静态文件根目录 */
|
|
151
|
+
root?: string;
|
|
152
|
+
/**监听端口 */
|
|
153
|
+
port?: number;
|
|
154
|
+
/**是否是主进程 */
|
|
155
|
+
isMaster?: boolean;
|
|
156
|
+
/**是否每次都强制清除 LocalStorage */
|
|
157
|
+
clearLocalStorage?: boolean;
|
|
158
|
+
/**处理代理过来多余的地址层级路径替换判断正则 */
|
|
159
|
+
pathReplaceRegExp?: string;
|
|
160
|
+
/**移动端入口文件地址(旧版逻辑) */
|
|
161
|
+
routeMobile?: string;
|
|
162
|
+
/**不同端入口地址设置 */
|
|
163
|
+
launchRouter?: Record<string, string>;
|
|
164
|
+
/**定时任务设置 */
|
|
165
|
+
cron?: {
|
|
166
|
+
def?: number;
|
|
167
|
+
};
|
|
168
|
+
/**注入参数列表 */
|
|
169
|
+
injection?: string[];
|
|
170
|
+
/**首页缓存时间 */
|
|
171
|
+
indexPageCacheTime?: number;
|
|
172
|
+
/**静态资源缓存时间 */
|
|
173
|
+
staticResourceCacheTime?: number;
|
|
174
|
+
}
|
|
175
|
+
/**业务错误数据对象 */
|
|
176
|
+
interface ICodeItem {
|
|
177
|
+
/**错误码 */
|
|
178
|
+
errorcode: number;
|
|
179
|
+
/**错误信息 */
|
|
180
|
+
msg: string;
|
|
181
|
+
}
|
|
182
|
+
/**业务错误定义 */
|
|
183
|
+
type ICodeDetail = Record<string, ICodeItem>;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type Koa from "koa";
|
|
2
|
+
interface ICorsConfig {
|
|
3
|
+
/**检测函数, 与 type 互斥 */
|
|
4
|
+
check?: (origin?: string, url?: string) => boolean;
|
|
5
|
+
/**跨域类型, 与 check 互斥 */
|
|
6
|
+
type?: "sameroot" | "all";
|
|
7
|
+
/**跨域开关 */
|
|
8
|
+
enable?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**跨域请求处理中间件初始化函数 */
|
|
11
|
+
export default function (config?: ICorsConfig): (ctx: Koa.Context, next: Koa.Next) => Promise<void>;
|
|
12
|
+
export {};
|
package/README.md
CHANGED
|
@@ -14,6 +14,19 @@ X-9lab 通用服务端
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
```
|
|
17
|
+
- `watch` 模式
|
|
18
|
+
`xlab` 支持自动重启业务,开发中使用该功能可以减少大量手动重启业务的操作。
|
|
19
|
+
启用方式:
|
|
20
|
+
- 启动命令使用 `w` 参数
|
|
21
|
+
- 在配置文件中开启
|
|
22
|
+
```js
|
|
23
|
+
const { NODE_ENV } = process.env;
|
|
24
|
+
module.exports = {
|
|
25
|
+
"watch": {
|
|
26
|
+
"enable": NODE_ENV === "development"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
17
30
|
- 除了静态资源,服务端业务需要放在项目根目录下的 `@server` 目录中
|
|
18
31
|
- 支持业务自定义以下内容 (无特殊说明的都是存放在 @server 目录中)
|
|
19
32
|
- 配置项,存放于 `@config` 目录
|
package/dist/bin/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const { date } = require("@x-drive/utils");
|
|
3
3
|
const crossSpawn = require("cross-spawn");
|
|
4
|
-
colors = require("colors/safe");
|
|
4
|
+
const colors = require("colors/safe");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
/**输出内容名称 */ const X_LAB_STR = colors.bold(colors.cyan("🛸 XLab"));
|
|
@@ -10,8 +10,10 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
create: ()=>create,
|
|
13
|
+
get: ()=>get,
|
|
13
14
|
len: ()=>len
|
|
14
15
|
});
|
|
16
|
+
const _utils = require("@x-drive/utils");
|
|
15
17
|
const _lruCache = /*#__PURE__*/ _interopRequireDefault(require("lru-cache"));
|
|
16
18
|
function _interopRequireDefault(obj) {
|
|
17
19
|
return obj && obj.__esModule ? obj : {
|
|
@@ -67,6 +69,22 @@ const CACHE_LIST = [];
|
|
|
67
69
|
}
|
|
68
70
|
return LRU_CACHES[cacheName];
|
|
69
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* 获取一个缓存实例
|
|
74
|
+
* @param name 缓存名称
|
|
75
|
+
* @param conf 缓存配置
|
|
76
|
+
*/ function get(name, conf) {
|
|
77
|
+
if (!(0, _utils.isString)(name)) {
|
|
78
|
+
throw new Error("必须指定缓存名称");
|
|
79
|
+
}
|
|
80
|
+
if (LRU_CACHES[name]) {
|
|
81
|
+
return LRU_CACHES[name];
|
|
82
|
+
}
|
|
83
|
+
if ((0, _utils.isObject)(conf)) {
|
|
84
|
+
return create(name, conf);
|
|
85
|
+
}
|
|
86
|
+
throw new Error(`找不到缓存 ${name}, 你可以先创建再调用本方法获取,或传入配置对象自动生成`);
|
|
87
|
+
}
|
|
70
88
|
/**
|
|
71
89
|
* 获取当前缓存实例数量
|
|
72
90
|
* @return 缓存数量
|
|
@@ -29,6 +29,7 @@ _export(exports, {
|
|
|
29
29
|
getRealDefaultMod: ()=>getRealDefaultMod
|
|
30
30
|
});
|
|
31
31
|
const _returnCode = require("./return-code");
|
|
32
|
+
const _utils = require("@x-drive/utils");
|
|
32
33
|
const _querystring = /*#__PURE__*/ _interopRequireDefault(require("querystring"));
|
|
33
34
|
const _request = /*#__PURE__*/ _interopRequireDefault(require("request"));
|
|
34
35
|
const _crypto = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
|
|
@@ -187,7 +188,7 @@ const format_exp = /[YymndjNwaAghGHis]/g;
|
|
|
187
188
|
* @param msg 返回的提示性信息
|
|
188
189
|
* @return 数据对象
|
|
189
190
|
*/ function responseResult(status, result, msg) {
|
|
190
|
-
var code = (0, _returnCode.getReturnCode)(status);
|
|
191
|
+
var code = (0, _utils.isObject)(status) ? status : (0, _returnCode.getReturnCode)(status);
|
|
191
192
|
var dat = {
|
|
192
193
|
"success": code.errorcode === 0,
|
|
193
194
|
"code": code.errorcode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-9lab/xlab",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "9lab 服务端模块",
|
|
5
5
|
"versionDesc": "",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"main": "./dist/server.js",
|
|
17
17
|
"types": "./@types/global.d.ts",
|
|
18
18
|
"files": [
|
|
19
|
-
"dist"
|
|
19
|
+
"dist",
|
|
20
|
+
"@types"
|
|
20
21
|
],
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"koa": "2.13.1",
|
|
@@ -55,5 +56,9 @@
|
|
|
55
56
|
},
|
|
56
57
|
"bin": {
|
|
57
58
|
"xlab": "dist/bin/xlab"
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/x-9lab/xlab.git"
|
|
58
63
|
}
|
|
59
64
|
}
|
package/dist/package.json
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@x-9lab/xlab",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"description": "9lab 服务端模块",
|
|
6
|
-
"versionDesc": "",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"dev": "swc src -D ./src/bin --config-file .swcrc -d dist -w",
|
|
9
|
-
"compile": "swc src -D ./src/bin --config-file .swcrc -d dist",
|
|
10
|
-
"build": "yarn compile && yarn gen-declaration",
|
|
11
|
-
"gen-declaration": "tsc --emitDeclarationOnly",
|
|
12
|
-
"changelog": "changelog"
|
|
13
|
-
},
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">10.0.0"
|
|
16
|
-
},
|
|
17
|
-
"main": "./dist/server.js",
|
|
18
|
-
"types": "./@types/global.d.ts",
|
|
19
|
-
"files": [
|
|
20
|
-
"dist",
|
|
21
|
-
"@types"
|
|
22
|
-
],
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"koa": "2.13.1",
|
|
25
|
-
"cron": "1.8.2",
|
|
26
|
-
"redis": "4.0.3",
|
|
27
|
-
"log4js": "1.1.1",
|
|
28
|
-
"liftoff": "3.1.0",
|
|
29
|
-
"koa-ejs": "4.3.0",
|
|
30
|
-
"minimist": "1.2.5",
|
|
31
|
-
"request": "2.86.0",
|
|
32
|
-
"koa-body": "4.2.0",
|
|
33
|
-
"lru-cache": "6.0.0",
|
|
34
|
-
"koa-static": "5.0.0",
|
|
35
|
-
"koa-router": "10.0.0",
|
|
36
|
-
"http-proxy": "1.18.1",
|
|
37
|
-
"koa-compress": "5.0.1",
|
|
38
|
-
"@x-drive/utils": "1.1.19"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"co": "4.6.0",
|
|
42
|
-
"mocha": "10.0.0",
|
|
43
|
-
"tslib": "2.3.0",
|
|
44
|
-
"colors": "1.4.0",
|
|
45
|
-
"should": "11.2.1",
|
|
46
|
-
"nodemon": "2.0.12",
|
|
47
|
-
"socket.io": "2.0.3",
|
|
48
|
-
"chokidar": "3.5.3",
|
|
49
|
-
"typescript": "4.3.4",
|
|
50
|
-
"@types/node": "16.11.40",
|
|
51
|
-
"@types/log4js": "2.3.5",
|
|
52
|
-
"@types/koa-static": "4.0.2",
|
|
53
|
-
"@types/koa-router": "7.4.4",
|
|
54
|
-
"@swc/cli": "0.1.57",
|
|
55
|
-
"@swc/core": "1.2.212",
|
|
56
|
-
"@x-drive/changelog": "1.1.6"
|
|
57
|
-
},
|
|
58
|
-
"bin": {
|
|
59
|
-
"xlab": "dist/bin/xlab"
|
|
60
|
-
}
|
|
61
|
-
}
|