@maiyunnet/kebab 3.1.3 → 3.1.4

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/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * ------------------------
9
9
  */
10
10
  /** --- 当前系统版本号 --- */
11
- export declare const VER = "3.1.3";
11
+ export declare const VER = "3.1.4";
12
12
  /** --- 框架根目录,以 / 结尾 --- */
13
13
  export declare const ROOT_PATH: string;
14
14
  export declare const LIB_PATH: string;
package/index.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * ------------------------
9
9
  */
10
10
  /** --- 当前系统版本号 --- */
11
- export const VER = '3.1.3';
11
+ export const VER = '3.1.4';
12
12
  // --- 服务端用的路径 ---
13
13
  const imu = import.meta.url.replace('file://', '').replace(/^\/(\w:)/, '$1').replace(/\\/g, '/');
14
14
  /** --- /xxx/xxx --- */
package/lib/net.d.ts CHANGED
@@ -11,7 +11,7 @@ import * as ctr from '#sys/ctr.js';
11
11
  import * as types from '#types/index.js';
12
12
  import * as fd from './net/formdata.js';
13
13
  import * as lRequest from './net/request.js';
14
- import * as response from './net/response.js';
14
+ import * as lResponse from './net/response.js';
15
15
  /** --- 请求的传入参数选项 --- */
16
16
  export interface IRequestOptions {
17
17
  'method'?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS';
@@ -74,26 +74,26 @@ export declare function open(u: string): lRequest.Request;
74
74
  * @param u 请求的 URL
75
75
  * @param opt 参数
76
76
  */
77
- export declare function get(u: string, opt?: IRequestOptions): Promise<response.Response>;
77
+ export declare function get(u: string, opt?: IRequestOptions): Promise<lResponse.Response>;
78
78
  /**
79
79
  * --- 发起一个 post 请求 ---
80
80
  * @param u 请求的 URL
81
81
  * @param data 要发送的数据
82
82
  * @param opt 参数
83
83
  */
84
- export declare function post(u: string, data: Record<string, types.Json> | Buffer | string | stream.Readable, opt?: IRequestOptions): Promise<response.Response>;
84
+ export declare function post(u: string, data: Record<string, types.Json> | Buffer | string | stream.Readable, opt?: IRequestOptions): Promise<lResponse.Response>;
85
85
  /**
86
86
  * --- 发起 JSON 请求 ---
87
87
  * @param u
88
88
  * @param data
89
89
  * @param opt
90
90
  */
91
- export declare function postJson(u: string, data: types.Json[] | Record<string, types.Json>, opt?: IRequestOptions): Promise<response.Response>;
91
+ export declare function postJson(u: string, data: types.Json[] | Record<string, types.Json>, opt?: IRequestOptions): Promise<lResponse.Response>;
92
92
  /**
93
93
  * --- 发起一个请求 ---
94
94
  * @param opt 配置项
95
95
  */
96
- export declare function request(u: string, data?: Record<string, types.Json> | Buffer | string | stream.Readable, opt?: IRequestOptions): Promise<response.Response>;
96
+ export declare function request(u: string, data?: Record<string, types.Json> | Buffer | string | stream.Readable, opt?: IRequestOptions): Promise<lResponse.Response>;
97
97
  /**
98
98
  * --- 对 cookie 对象进行操作 ---
99
99
  * @param cookie 要操作的对象
package/lib/net.js CHANGED
@@ -15,7 +15,7 @@ import * as kebab from '#index.js';
15
15
  // --- 自己 ---
16
16
  import * as fd from './net/formdata.js';
17
17
  import * as lRequest from './net/request.js';
18
- import * as response from './net/response.js';
18
+ import * as lResponse from './net/response.js';
19
19
  /** --- ca 根证书内容 --- */
20
20
  let ca = '';
21
21
  /** --- 获取 CA 证书 --- */
@@ -28,7 +28,7 @@ export async function getCa() {
28
28
  }
29
29
  /** --- 复用的 hc 对象列表 --- */
30
30
  const reuses = {
31
- 'default': hc.createHttpClient()
31
+ 'default': hc.createHttpClient(),
32
32
  };
33
33
  /**
34
34
  * --- 创建一个请求对象 ---
@@ -129,7 +129,7 @@ export async function request(u, data, opt = {}) {
129
129
  // --- 重定义 IP ---
130
130
  const host = (puri ? puri.hostname : uri.hostname) ?? '';
131
131
  if (!host) {
132
- const res = new response.Response(null);
132
+ const res = new lResponse.Response(null);
133
133
  res.error = {
134
134
  'name': 'Possible mProxy error',
135
135
  'message': 'host not found'
@@ -137,7 +137,7 @@ export async function request(u, data, opt = {}) {
137
137
  return res;
138
138
  }
139
139
  if (hosts[host] !== undefined && !hosts[host]) {
140
- const res = new response.Response(null);
140
+ const res = new lResponse.Response(null);
141
141
  res.error = {
142
142
  'name': 'hosts error',
143
143
  'message': 'hosts param error'
@@ -165,7 +165,7 @@ export async function request(u, data, opt = {}) {
165
165
  });
166
166
  }
167
167
  catch (err) {
168
- const res = new response.Response(null);
168
+ const res = new lResponse.Response(null);
169
169
  res.error = err;
170
170
  return res;
171
171
  }
@@ -193,7 +193,7 @@ export async function request(u, data, opt = {}) {
193
193
  });
194
194
  }
195
195
  // --- 创建 Response 对象 ---
196
- const res = new response.Response(req);
196
+ const res = new lResponse.Response(req);
197
197
  if (total) {
198
198
  res.setContent(total.toString());
199
199
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "esnext",
4
+ "removeComments": false,
5
+ "preserveConstEnums": true, // 保留 const 和 enum 声明
6
+ "outDir": "./",
7
+ "sourceMap": false,
8
+ "target": "ES2021",
9
+ "strict": true, // 严格模式
10
+ "declaration": true, // d.ts
11
+ "declarationMap": false, // d.ts 的 map
12
+ "newLine": "LF",
13
+ "paths": {
14
+ "#*": ["./*"]
15
+ },
16
+ "moduleResolution": "node",
17
+ "resolveJsonModule": true,
18
+ "esModuleInterop": true
19
+ },
20
+ "include": [
21
+ "./**/*.ts"
22
+ ],
23
+ "exclude": [
24
+ "node_modules"
25
+ ]
26
+ }
package/types/index.d.ts CHANGED
@@ -106,7 +106,7 @@ export interface IConfigTurnstile {
106
106
  'skey': string;
107
107
  'aid': string;
108
108
  'akey': string;
109
- }
109
+ },
110
110
  }
111
111
 
112
112
  /** --- 动配数据库 --- */