@maiyunnet/kebab 9.1.3 → 9.2.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/doc/kebab-rag.md +2237 -437
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/buffer.d.ts +5 -0
- package/lib/buffer.js +13 -0
- package/lib/cookie.d.ts +44 -0
- package/lib/cookie.js +216 -0
- package/lib/core.d.ts +3 -2
- package/lib/core.js +15 -12
- package/lib/dns.d.ts +1 -1
- package/lib/dns.js +4 -6
- package/lib/net/request.d.ts +2 -1
- package/lib/net.d.ts +3 -38
- package/lib/net.js +6 -219
- package/lib/socket.d.ts +4 -3
- package/lib/turnstile.js +2 -2
- package/lib/undici/formdata.d.ts +83 -0
- package/lib/undici/formdata.js +166 -0
- package/lib/undici/request.d.ts +86 -0
- package/lib/undici/request.js +120 -0
- package/lib/undici/response.d.ts +39 -0
- package/lib/undici/response.js +111 -0
- package/lib/undici.d.ts +174 -0
- package/lib/undici.js +595 -0
- package/lib/ws.d.ts +6 -5
- package/lib/ws.js +9 -9
- package/package.json +3 -2
- package/sys/cmd.js +4 -1
- package/sys/route.js +5 -2
- package/www/example/ctr/middle.js +3 -2
- package/www/example/ctr/test.d.ts +32 -0
- package/www/example/ctr/test.js +526 -4
- package/www/example/route.json +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiyunnet/kebab",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
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": [
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"ssh2": "^1.17.0",
|
|
53
53
|
"svg-captcha": "^1.4.0",
|
|
54
54
|
"tailwind-merge": "^3.5.0",
|
|
55
|
-
"tencentcloud-sdk-nodejs": "^4.1.199"
|
|
55
|
+
"tencentcloud-sdk-nodejs": "^4.1.199",
|
|
56
|
+
"undici": "^8.1.0"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@litert/eslint-plugin-rules": "^0.3.1",
|
package/sys/cmd.js
CHANGED
|
@@ -506,7 +506,10 @@ async function run() {
|
|
|
506
506
|
const tmpCss = entry + '.__tw__.css';
|
|
507
507
|
await lFs.putContent(tmpCss, `@import "tailwindcss";\n@source "./**/*.tsx";\n`);
|
|
508
508
|
try {
|
|
509
|
-
|
|
509
|
+
// --- 优先从用户项目根目录查找,找不到则 fallback 到 kebab 包自身目录(用于 kebab 开发模式)---
|
|
510
|
+
const twJsUser = kebab.ROOT_CWD + 'node_modules/@tailwindcss/cli/dist/index.mjs';
|
|
511
|
+
const twJsSelf = fileURLToPath(new URL('../node_modules/@tailwindcss/cli/dist/index.mjs', import.meta.url));
|
|
512
|
+
const twJs = await lFs.isFile(twJsUser) ? twJsUser : twJsSelf;
|
|
510
513
|
await new Promise((resolve, reject) => {
|
|
511
514
|
const proc = childProcess.spawn(process.execPath, [twJs, '-i', tmpCss, '-o', cssOut, '--minify'], { 'shell': false });
|
|
512
515
|
const errLines = [];
|
package/sys/route.js
CHANGED
|
@@ -12,7 +12,8 @@ import * as lFs from '#kebab/lib/fs.js';
|
|
|
12
12
|
import * as lZlib from '#kebab/lib/zlib.js';
|
|
13
13
|
import * as lCore from '#kebab/lib/core.js';
|
|
14
14
|
import * as lText from '#kebab/lib/text.js';
|
|
15
|
-
import * as
|
|
15
|
+
import * as lNetResponse from '#kebab/lib/net/response.js';
|
|
16
|
+
import * as lUndiciResponse from '#kebab/lib/undici/response.js';
|
|
16
17
|
import * as lWs from '#kebab/lib/ws.js';
|
|
17
18
|
import * as lLang from '#kebab/lib/lang.js';
|
|
18
19
|
import * as sCtr from './ctr.js';
|
|
@@ -600,7 +601,9 @@ export async function run(data) {
|
|
|
600
601
|
}
|
|
601
602
|
}
|
|
602
603
|
}
|
|
603
|
-
else if (rtn instanceof stream.Readable ||
|
|
604
|
+
else if (rtn instanceof stream.Readable ||
|
|
605
|
+
rtn instanceof lNetResponse.Response ||
|
|
606
|
+
rtn instanceof lUndiciResponse.Response) {
|
|
604
607
|
// --- 返回的是流,那就以管道的形式输出 ---
|
|
605
608
|
const stm = rtn instanceof stream.Readable ? rtn : rtn.getStream();
|
|
606
609
|
if (!stm) {
|
|
@@ -3,11 +3,12 @@ import * as sCtr from '#kebab/sys/ctr.js';
|
|
|
3
3
|
export default class extends sCtr.Ctr {
|
|
4
4
|
async onReqStart() {
|
|
5
5
|
if (await lNet.rproxy(this, {
|
|
6
|
-
'test/net-rproxy/': 'https://cdn.jsdelivr.net/npm/deskrt@2.0.10/'
|
|
6
|
+
'test/net-rproxy/': 'https://cdn.jsdelivr.net/npm/deskrt@2.0.10/',
|
|
7
|
+
'test/undici-rproxy/': 'https://cdn.jsdelivr.net/npm/deskrt@2.0.10/'
|
|
7
8
|
})) {
|
|
8
9
|
return -1;
|
|
9
10
|
}
|
|
10
|
-
if (this._config.const.path === 'test/net-mproxy1') {
|
|
11
|
+
if (this._config.const.path === 'test/net-mproxy1' || this._config.const.path === 'test/undici-mproxy1') {
|
|
11
12
|
return 0;
|
|
12
13
|
}
|
|
13
14
|
return 1;
|
|
@@ -93,6 +93,38 @@ export default class extends sCtr.Ctr {
|
|
|
93
93
|
netGetResponseJson(): Promise<string>;
|
|
94
94
|
getResponseJson1(): any[];
|
|
95
95
|
getResponseJson2(): any[];
|
|
96
|
+
undici(): Promise<string>;
|
|
97
|
+
undiciPipe(): Promise<kebab.Json>;
|
|
98
|
+
undiciPost(): Promise<kebab.Json>;
|
|
99
|
+
undiciPost1(): string;
|
|
100
|
+
undiciPostString(): Promise<string>;
|
|
101
|
+
undiciPostString1(): kebab.Json[];
|
|
102
|
+
undiciOpen(): Promise<kebab.Json>;
|
|
103
|
+
undiciFormTest(): Promise<string>;
|
|
104
|
+
undiciUpload(): Promise<string>;
|
|
105
|
+
undiciUpload1(): Promise<string>;
|
|
106
|
+
undiciCookie(): Promise<string>;
|
|
107
|
+
undiciCookie1(): string;
|
|
108
|
+
undiciCookie2(): string;
|
|
109
|
+
undiciSave(): Promise<string>;
|
|
110
|
+
undiciFollow(): Promise<string>;
|
|
111
|
+
undiciFollow1(): void;
|
|
112
|
+
undiciFollow2(): kebab.Json;
|
|
113
|
+
undiciReuse(): Promise<string>;
|
|
114
|
+
undiciError(): Promise<string>;
|
|
115
|
+
undiciHosts(): Promise<string>;
|
|
116
|
+
undiciMproxy(): Promise<string | boolean>;
|
|
117
|
+
undiciMproxy1(): Promise<string | boolean>;
|
|
118
|
+
undiciMproxy2(): any[];
|
|
119
|
+
undiciFilterheaders(): string;
|
|
120
|
+
undiciFetch(): Promise<string | boolean>;
|
|
121
|
+
undiciFetch1(): any[];
|
|
122
|
+
undiciGetResponseJson(): Promise<string>;
|
|
123
|
+
undiciGetResponseJson1(): any[];
|
|
124
|
+
undiciGetResponseJson2(): any[];
|
|
125
|
+
/** --- 测试 ProxyAgent --- */
|
|
126
|
+
private readonly _undiciProxyAgent;
|
|
127
|
+
undiciProxy(): Promise<string>;
|
|
96
128
|
scan(): Promise<kebab.Json>;
|
|
97
129
|
scan1(): Promise<kebab.Json>;
|
|
98
130
|
scan2(): Promise<kebab.Json>;
|