@kevisual/router 0.0.22 → 0.0.23
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/dist/router-browser.d.ts +10 -3
- package/dist/router-browser.js +17439 -530
- package/dist/router-sign.d.ts +1 -0
- package/dist/router-sign.js +15 -7
- package/dist/router.d.ts +8 -2
- package/dist/router.js +17446 -533
- package/package.json +11 -8
- package/src/app-browser.ts +5 -0
- package/src/app.ts +6 -0
- package/src/browser.ts +3 -1
- package/src/route.ts +8 -3
- package/src/sign.ts +22 -9
- package/src/test/static.ts +22 -0
- package/src/utils/is-engine.ts +15 -0
- package/src/validator/index.ts +2 -1
package/dist/router-sign.d.ts
CHANGED
package/dist/router-sign.js
CHANGED
|
@@ -28618,18 +28618,18 @@ var selfsignedExports = requireSelfsigned();
|
|
|
28618
28618
|
|
|
28619
28619
|
const createCert = (attrs = [], altNames = []) => {
|
|
28620
28620
|
let attributes = [
|
|
28621
|
-
{ name: 'commonName', value: '*' }, // 通配符域名
|
|
28622
28621
|
{ name: 'countryName', value: 'CN' }, // 国家代码
|
|
28623
28622
|
{ name: 'stateOrProvinceName', value: 'ZheJiang' }, // 州名
|
|
28624
|
-
{ name: 'localityName', value: '
|
|
28625
|
-
{ name: 'organizationName', value: '
|
|
28626
|
-
{ name: 'organizationalUnitName', value: '
|
|
28623
|
+
{ name: 'localityName', value: 'HangZhou' }, // 城市名
|
|
28624
|
+
{ name: 'organizationName', value: 'kevisual' }, // 组织名
|
|
28625
|
+
{ name: 'organizationalUnitName', value: 'kevisual' }, // 组织单位
|
|
28627
28626
|
...attrs,
|
|
28628
28627
|
];
|
|
28629
28628
|
// attribute 根据name去重复, 后面的覆盖前面的
|
|
28630
|
-
attributes = attributes.
|
|
28631
|
-
|
|
28632
|
-
|
|
28629
|
+
attributes = Object.values(attributes.reduce((acc, attr) => ({
|
|
28630
|
+
...acc,
|
|
28631
|
+
[attr.name]: attr,
|
|
28632
|
+
}), {}));
|
|
28633
28633
|
const options = {
|
|
28634
28634
|
days: 365, // 证书有效期(天)
|
|
28635
28635
|
extensions: [
|
|
@@ -28638,6 +28638,14 @@ const createCert = (attrs = [], altNames = []) => {
|
|
|
28638
28638
|
altNames: [
|
|
28639
28639
|
{ type: 2, value: '*' }, // DNS 名称
|
|
28640
28640
|
{ type: 2, value: 'localhost' }, // DNS
|
|
28641
|
+
{
|
|
28642
|
+
type: 2,
|
|
28643
|
+
value: '[::1]',
|
|
28644
|
+
},
|
|
28645
|
+
{
|
|
28646
|
+
type: 7,
|
|
28647
|
+
ip: 'fe80::1',
|
|
28648
|
+
},
|
|
28641
28649
|
{ type: 7, ip: '127.0.0.1' }, // IP 地址
|
|
28642
28650
|
...altNames,
|
|
28643
28651
|
],
|
package/dist/router.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ type RouteContext<T = {
|
|
|
109
109
|
}) => Promise<any>;
|
|
110
110
|
index?: number;
|
|
111
111
|
throw?: (code?: number | string, message?: string, tips?: string) => void;
|
|
112
|
-
/**
|
|
112
|
+
/** 是否需要序列化, 使用JSON.stringify和JSON.parse */
|
|
113
113
|
needSerialize?: boolean;
|
|
114
114
|
} & T;
|
|
115
115
|
type SimpleObject$1 = Record<string, any>;
|
|
@@ -326,7 +326,12 @@ declare class QueryRouter {
|
|
|
326
326
|
data: any;
|
|
327
327
|
message: any;
|
|
328
328
|
}>;
|
|
329
|
-
|
|
329
|
+
/**
|
|
330
|
+
* 设置上下文
|
|
331
|
+
* @description 这里的上下文是为了在handle函数中使用
|
|
332
|
+
* @param ctx
|
|
333
|
+
*/
|
|
334
|
+
setContext(ctx: RouteContext): void;
|
|
330
335
|
getList(): RouteInfo[];
|
|
331
336
|
/**
|
|
332
337
|
* 获取handle函数, 这里会去执行parse函数
|
|
@@ -719,6 +724,7 @@ declare class App<T = {}, U = AppReqRes> {
|
|
|
719
724
|
cookies: Record<string, string>;
|
|
720
725
|
token: string;
|
|
721
726
|
}>;
|
|
727
|
+
onServerRequest(fn: (req: IncomingMessage$1, res: ServerResponse$1) => void): void;
|
|
722
728
|
}
|
|
723
729
|
|
|
724
730
|
export { App, Connect, CustomError, QueryConnect, QueryRouter, QueryRouterServer, QueryUtil, Route, Server, createSchema, define, handleServer, util };
|