@maiyunnet/kebab 9.15.4 → 9.15.6

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 CHANGED
@@ -1361,7 +1361,7 @@ index/variables/VER.md
1361
1361
 
1362
1362
  # Variable: VER
1363
1363
 
1364
- > `const` **VER**: `"9.15.4"` = `'9.15.4'`
1364
+ > `const` **VER**: `"9.15.6"` = `'9.15.6'`
1365
1365
 
1366
1366
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1367
1367
 
@@ -3351,7 +3351,7 @@ lib/core/functions/clone.md
3351
3351
 
3352
3352
  > **clone**\<`T`\>(`obj`): `T`
3353
3353
 
3354
- Defined in: [lib/core.ts:1336](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1336)
3354
+ Defined in: [lib/core.ts:1350](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1350)
3355
3355
 
3356
3356
  完整的克隆一份数组/对象
3357
3357
 
@@ -3415,7 +3415,7 @@ lib/core/functions/debug.md
3415
3415
 
3416
3416
  > **debug**(`message?`, ...`optionalParams`): `void`
3417
3417
 
3418
- Defined in: [lib/core.ts:1382](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1382)
3418
+ Defined in: [lib/core.ts:1396](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1396)
3419
3419
 
3420
3420
  打印调试信息,线上环境不会打印
3421
3421
 
@@ -3450,7 +3450,7 @@ lib/core/functions/display.md
3450
3450
 
3451
3451
  > **display**(`message?`, ...`optionalParams`): `void`
3452
3452
 
3453
- Defined in: [lib/core.ts:1395](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1395)
3453
+ Defined in: [lib/core.ts:1409](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1409)
3454
3454
 
3455
3455
  向控制台直接显示内容,一般情况下禁止使用
3456
3456
 
@@ -3538,6 +3538,13 @@ Defined in: [lib/core.ts:680](https://github.com/maiyunnet/kebab/blob/master/lib
3538
3538
 
3539
3539
  `string`
3540
3540
 
3541
+ #### timeout?
3542
+
3543
+ `number`
3544
+
3545
+ 命令超时毫秒数,超时后终止命令并以失败返回
3546
+ 默认无超时限制:不传时命令可一直运行直至完成,与 cp.exec 默认行为一致
3547
+
3541
3548
  ## Returns
3542
3549
 
3543
3550
  `Promise`\<`string` \| `false`\>
@@ -3555,7 +3562,7 @@ lib/core/functions/getLog.md
3555
3562
 
3556
3563
  > **getLog**(`opt`): `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
3557
3564
 
3558
- Defined in: [lib/core.ts:1248](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1248)
3565
+ Defined in: [lib/core.ts:1262](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1262)
3559
3566
 
3560
3567
  获取日志内容为一个数组
3561
3568
 
@@ -3728,7 +3735,7 @@ lib/core/functions/loadEnv.md
3728
3735
 
3729
3736
  > **loadEnv**(`dir`): `Promise`\<`void`\>
3730
3737
 
3731
- Defined in: [lib/core.ts:1447](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1447)
3738
+ Defined in: [lib/core.ts:1461](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1461)
3732
3739
 
3733
3740
  加载 .env 文件到 process.env,若文件不存在则跳过
3734
3741
 
@@ -3757,7 +3764,7 @@ lib/core/functions/log.md
3757
3764
 
3758
3765
  > **log**(`opt`, `msg`, `fend?`): `void`
3759
3766
 
3760
- Defined in: [lib/core.ts:1135](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1135)
3767
+ Defined in: [lib/core.ts:1149](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1149)
3761
3768
 
3762
3769
  写入文件日志
3763
3770
 
@@ -3798,7 +3805,7 @@ lib/core/functions/ls.md
3798
3805
 
3799
3806
  > **ls**(`opt`): `Promise`\<`object`[]\>
3800
3807
 
3801
- Defined in: [lib/core.ts:1297](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1297)
3808
+ Defined in: [lib/core.ts:1311](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1311)
3802
3809
 
3803
3810
  获取目录内文件/文件夹列表
3804
3811
 
@@ -4168,7 +4175,7 @@ lib/core/functions/removeGlobal.md
4168
4175
 
4169
4176
  > **removeGlobal**(`key`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4170
4177
 
4171
- Defined in: [lib/core.ts:952](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L952)
4178
+ Defined in: [lib/core.ts:966](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L966)
4172
4179
 
4173
4180
  移除某个跨线程/跨内网服务器全局变量
4174
4181
 
@@ -4203,7 +4210,7 @@ lib/core/functions/resolveEnvVars.md
4203
4210
 
4204
4211
  > **resolveEnvVars**(`obj`): `void`
4205
4212
 
4206
- Defined in: [lib/core.ts:1477](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1477)
4213
+ Defined in: [lib/core.ts:1491](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1491)
4207
4214
 
4208
4215
  将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
4209
4216
 
@@ -4232,7 +4239,7 @@ lib/core/functions/sendNpm.md
4232
4239
 
4233
4240
  > **sendNpm**(`path`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4234
4241
 
4235
- Defined in: [lib/core.ts:851](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L851)
4242
+ Defined in: [lib/core.ts:865](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L865)
4236
4243
 
4237
4244
  向本机或局域网 RPC 发送 npm install 操作
4238
4245
 
@@ -4267,7 +4274,7 @@ lib/core/functions/sendPackage.md
4267
4274
 
4268
4275
  > **sendPackage**(`content`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4269
4276
 
4270
- Defined in: [lib/core.ts:1075](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1075)
4277
+ Defined in: [lib/core.ts:1089](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1089)
4271
4278
 
4272
4279
  向本机或局域网 RPC 发送 package.json 更新操作
4273
4280
 
@@ -4302,7 +4309,7 @@ lib/core/functions/sendPm2.md
4302
4309
 
4303
4310
  > **sendPm2**(`name`, `action?`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4304
4311
 
4305
- Defined in: [lib/core.ts:803](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L803)
4312
+ Defined in: [lib/core.ts:817](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L817)
4306
4313
 
4307
4314
  向本机或局域网 RPC 发送 PM2 操作
4308
4315
 
@@ -4343,7 +4350,7 @@ lib/core/functions/sendProject.md
4343
4350
 
4344
4351
  > **sendProject**(`path`, `key`, `value`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4345
4352
 
4346
- Defined in: [lib/core.ts:1027](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1027)
4353
+ Defined in: [lib/core.ts:1041](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1041)
4347
4354
 
4348
4355
  向本机或局域网 RPC 发送项目配置更新操作
4349
4356
 
@@ -4390,7 +4397,7 @@ lib/core/functions/sendReload.md
4390
4397
 
4391
4398
  > **sendReload**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4392
4399
 
4393
- Defined in: [lib/core.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L700)
4400
+ Defined in: [lib/core.ts:706](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L706)
4394
4401
 
4395
4402
  向主进程(或局域网同代码机子)发送广播将进行 reload 操作,等待回传
4396
4403
  主要作用除代码热更新以外的其他情况
@@ -4418,7 +4425,7 @@ lib/core/functions/sendRestart.md
4418
4425
 
4419
4426
  > **sendRestart**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4420
4427
 
4421
- Defined in: [lib/core.ts:749](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L749)
4428
+ Defined in: [lib/core.ts:759](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L759)
4422
4429
 
4423
4430
  向主进程(或局域网同代码机子)发送广播将进行 restart 操作,停止监听并启动新进程,老进程在连接全部断开后自行销毁
4424
4431
  主要用作不间断的代码热更新
@@ -4493,7 +4500,7 @@ lib/core/functions/setGlobal.md
4493
4500
 
4494
4501
  > **setGlobal**(`key`, `data`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4495
4502
 
4496
- Defined in: [lib/core.ts:902](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L902)
4503
+ Defined in: [lib/core.ts:916](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L916)
4497
4504
 
4498
4505
  设置跨线程/指定的局域网主机的全局变量
4499
4506
 
@@ -4592,7 +4599,7 @@ lib/core/functions/updateCode.md
4592
4599
 
4593
4600
  > **updateCode**(`sourcePath`, `path`, `hosts?`, `config?`, `strict?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4594
4601
 
4595
- Defined in: [lib/core.ts:967](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L967)
4602
+ Defined in: [lib/core.ts:981](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L981)
4596
4603
 
4597
4604
  上传并覆盖代码文件,config.json、kebab.json、.js.map、.ts, .gitignore 不会被覆盖和新创建
4598
4605
 
@@ -4645,7 +4652,7 @@ lib/core/functions/writeEventStreamHead.md
4645
4652
 
4646
4653
  > **writeEventStreamHead**(`res`): `void`
4647
4654
 
4648
- Defined in: [lib/core.ts:1417](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1417)
4655
+ Defined in: [lib/core.ts:1431](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1431)
4649
4656
 
4650
4657
  ## Parameters
4651
4658
 
@@ -4670,7 +4677,7 @@ lib/core/functions/writeHead.md
4670
4677
 
4671
4678
  > **writeHead**(`res`, `statusCode`, `headers?`): `void`
4672
4679
 
4673
- Defined in: [lib/core.ts:1406](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1406)
4680
+ Defined in: [lib/core.ts:1420](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1420)
4674
4681
 
4675
4682
  让 res 发送头部(前提是头部没有被发送才能调用本方法
4676
4683
 
@@ -4711,7 +4718,7 @@ lib/core/functions/write.md
4711
4718
 
4712
4719
  > **write**(`res`, `data`): `void`
4713
4720
 
4714
- Defined in: [lib/core.ts:1429](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1429)
4721
+ Defined in: [lib/core.ts:1443](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1443)
4715
4722
 
4716
4723
  向 res 发送数据
4717
4724
 
@@ -4886,7 +4893,7 @@ lib/core/interfaces/ILogOptions.md
4886
4893
 
4887
4894
  # Interface: ILogOptions
4888
4895
 
4889
- Defined in: [lib/core.ts:1118](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1118)
4896
+ Defined in: [lib/core.ts:1132](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1132)
4890
4897
 
4891
4898
  log 设置的选项
4892
4899
 
@@ -4896,7 +4903,7 @@ log 设置的选项
4896
4903
 
4897
4904
  > `optional` **cookie?**: `Record`\<`string`, `string`\>
4898
4905
 
4899
- Defined in: [lib/core.ts:1124](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1124)
4906
+ Defined in: [lib/core.ts:1138](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1138)
4900
4907
 
4901
4908
  ***
4902
4909
 
@@ -4904,7 +4911,7 @@ Defined in: [lib/core.ts:1124](https://github.com/maiyunnet/kebab/blob/master/li
4904
4911
 
4905
4912
  > `optional` **get?**: `Record`\<`string`, `any`\>
4906
4913
 
4907
- Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1123)
4914
+ Defined in: [lib/core.ts:1137](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1137)
4908
4915
 
4909
4916
  ***
4910
4917
 
@@ -4912,7 +4919,7 @@ Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/li
4912
4919
 
4913
4920
  > `optional` **headers?**: `IncomingHttpHeaders`
4914
4921
 
4915
- Defined in: [lib/core.ts:1126](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1126)
4922
+ Defined in: [lib/core.ts:1140](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1140)
4916
4923
 
4917
4924
  ***
4918
4925
 
@@ -4920,7 +4927,7 @@ Defined in: [lib/core.ts:1126](https://github.com/maiyunnet/kebab/blob/master/li
4920
4927
 
4921
4928
  > `optional` **hostname?**: `string`
4922
4929
 
4923
- Defined in: [lib/core.ts:1121](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1121)
4930
+ Defined in: [lib/core.ts:1135](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1135)
4924
4931
 
4925
4932
  ***
4926
4933
 
@@ -4928,7 +4935,7 @@ Defined in: [lib/core.ts:1121](https://github.com/maiyunnet/kebab/blob/master/li
4928
4935
 
4929
4936
  > `optional` **path?**: `string`
4930
4937
 
4931
- Defined in: [lib/core.ts:1119](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1119)
4938
+ Defined in: [lib/core.ts:1133](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1133)
4932
4939
 
4933
4940
  ***
4934
4941
 
@@ -4936,7 +4943,7 @@ Defined in: [lib/core.ts:1119](https://github.com/maiyunnet/kebab/blob/master/li
4936
4943
 
4937
4944
  > `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
4938
4945
 
4939
- Defined in: [lib/core.ts:1122](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1122)
4946
+ Defined in: [lib/core.ts:1136](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1136)
4940
4947
 
4941
4948
  ***
4942
4949
 
@@ -4944,7 +4951,7 @@ Defined in: [lib/core.ts:1122](https://github.com/maiyunnet/kebab/blob/master/li
4944
4951
 
4945
4952
  > `optional` **session?**: `Record`\<`string`, `any`\>
4946
4953
 
4947
- Defined in: [lib/core.ts:1125](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1125)
4954
+ Defined in: [lib/core.ts:1139](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1139)
4948
4955
 
4949
4956
  ***
4950
4957
 
@@ -4952,7 +4959,7 @@ Defined in: [lib/core.ts:1125](https://github.com/maiyunnet/kebab/blob/master/li
4952
4959
 
4953
4960
  > `optional` **urlFull?**: `string`
4954
4961
 
4955
- Defined in: [lib/core.ts:1120](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1120)
4962
+ Defined in: [lib/core.ts:1134](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1134)
4956
4963
 
4957
4964
  lib/core/type-aliases/TPm2Action.md
4958
4965
  ---
@@ -4967,7 +4974,7 @@ lib/core/type-aliases/TPm2Action.md
4967
4974
 
4968
4975
  > **TPm2Action** = `"start"` \| `"stop"` \| `"restart"`
4969
4976
 
4970
- Defined in: [lib/core.ts:795](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L795)
4977
+ Defined in: [lib/core.ts:809](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L809)
4971
4978
 
4972
4979
  PM2 操作类型
4973
4980
 
@@ -5041,7 +5048,7 @@ lib/core/variables/global.md
5041
5048
 
5042
5049
  > `const` **global**: `Record`\<`string`, `any`\> = `{}`
5043
5050
 
5044
- Defined in: [lib/core.ts:894](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L894)
5051
+ Defined in: [lib/core.ts:908](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L908)
5045
5052
 
5046
5053
  跨进程全局变量
5047
5054
 
@@ -19072,7 +19079,7 @@ lib/undici/interfaces/IMproxyOptions.md
19072
19079
 
19073
19080
  # Interface: IMproxyOptions
19074
19081
 
19075
- Defined in: [lib/undici.ts:818](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L818)
19082
+ Defined in: [lib/undici.ts:820](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L820)
19076
19083
 
19077
19084
  正向代理请求的传入参数选项
19078
19085
 
@@ -19082,7 +19089,7 @@ Defined in: [lib/undici.ts:818](https://github.com/maiyunnet/kebab/blob/master/l
19082
19089
 
19083
19090
  > `optional` **filter?**: (`h`) => `boolean`
19084
19091
 
19085
- Defined in: [lib/undici.ts:827](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L827)
19092
+ Defined in: [lib/undici.ts:829](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L829)
19086
19093
 
19087
19094
  过滤 header,返回 true 则留下
19088
19095
 
@@ -19102,7 +19109,7 @@ Defined in: [lib/undici.ts:827](https://github.com/maiyunnet/kebab/blob/master/l
19102
19109
 
19103
19110
  > `optional` **follow?**: `number`
19104
19111
 
19105
- Defined in: [lib/undici.ts:821](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L821)
19112
+ Defined in: [lib/undici.ts:823](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L823)
19106
19113
 
19107
19114
  ***
19108
19115
 
@@ -19110,7 +19117,7 @@ Defined in: [lib/undici.ts:821](https://github.com/maiyunnet/kebab/blob/master/l
19110
19117
 
19111
19118
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
19112
19119
 
19113
- Defined in: [lib/undici.ts:825](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L825)
19120
+ Defined in: [lib/undici.ts:827](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L827)
19114
19121
 
19115
19122
  ***
19116
19123
 
@@ -19118,7 +19125,7 @@ Defined in: [lib/undici.ts:825](https://github.com/maiyunnet/kebab/blob/master/l
19118
19125
 
19119
19126
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
19120
19127
 
19121
- Defined in: [lib/undici.ts:823](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L823)
19128
+ Defined in: [lib/undici.ts:825](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L825)
19122
19129
 
19123
19130
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
19124
19131
 
@@ -19128,7 +19135,7 @@ Defined in: [lib/undici.ts:823](https://github.com/maiyunnet/kebab/blob/master/l
19128
19135
 
19129
19136
  > `optional` **local?**: `string`
19130
19137
 
19131
- Defined in: [lib/undici.ts:824](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L824)
19138
+ Defined in: [lib/undici.ts:826](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L826)
19132
19139
 
19133
19140
  ***
19134
19141
 
@@ -19136,7 +19143,7 @@ Defined in: [lib/undici.ts:824](https://github.com/maiyunnet/kebab/blob/master/l
19136
19143
 
19137
19144
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
19138
19145
 
19139
- Defined in: [lib/undici.ts:829](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L829)
19146
+ Defined in: [lib/undici.ts:831](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L831)
19140
19147
 
19141
19148
  默认为 default
19142
19149
 
@@ -19146,7 +19153,7 @@ Defined in: [lib/undici.ts:829](https://github.com/maiyunnet/kebab/blob/master/l
19146
19153
 
19147
19154
  > `optional` **timeout?**: `number`
19148
19155
 
19149
- Defined in: [lib/undici.ts:820](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L820)
19156
+ Defined in: [lib/undici.ts:822](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L822)
19150
19157
 
19151
19158
  秒数,默认 300 秒
19152
19159
 
@@ -19161,7 +19168,7 @@ lib/undici/interfaces/IRequestOptions.md
19161
19168
 
19162
19169
  # Interface: IRequestOptions
19163
19170
 
19164
- Defined in: [lib/undici.ts:785](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L785)
19171
+ Defined in: [lib/undici.ts:787](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L787)
19165
19172
 
19166
19173
  请求的传入参数选项
19167
19174
 
@@ -19171,7 +19178,7 @@ Defined in: [lib/undici.ts:785](https://github.com/maiyunnet/kebab/blob/master/l
19171
19178
 
19172
19179
  > `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
19173
19180
 
19174
- Defined in: [lib/undici.ts:810](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L810)
19181
+ Defined in: [lib/undici.ts:812](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L812)
19175
19182
 
19176
19183
  cookie 托管对象
19177
19184
 
@@ -19181,7 +19188,7 @@ cookie 托管对象
19181
19188
 
19182
19189
  > `optional` **follow?**: `number`
19183
19190
 
19184
- Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L791)
19191
+ Defined in: [lib/undici.ts:793](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L793)
19185
19192
 
19186
19193
  追踪 location 次数,0 为不追踪,默认为 0
19187
19194
 
@@ -19191,7 +19198,7 @@ Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/l
19191
19198
 
19192
19199
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
19193
19200
 
19194
- Defined in: [lib/undici.ts:796](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L796)
19201
+ Defined in: [lib/undici.ts:798](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L798)
19195
19202
 
19196
19203
  ***
19197
19204
 
@@ -19199,7 +19206,7 @@ Defined in: [lib/undici.ts:796](https://github.com/maiyunnet/kebab/blob/master/l
19199
19206
 
19200
19207
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
19201
19208
 
19202
- Defined in: [lib/undici.ts:793](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L793)
19209
+ Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L795)
19203
19210
 
19204
19211
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
19205
19212
 
@@ -19209,7 +19216,7 @@ Defined in: [lib/undici.ts:793](https://github.com/maiyunnet/kebab/blob/master/l
19209
19216
 
19210
19217
  > `optional` **keep?**: `boolean`
19211
19218
 
19212
- Defined in: [lib/undici.ts:806](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L806)
19219
+ Defined in: [lib/undici.ts:808](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L808)
19213
19220
 
19214
19221
  连接是否保持长连接(即是否允许复用),默认为 true
19215
19222
 
@@ -19219,7 +19226,7 @@ Defined in: [lib/undici.ts:806](https://github.com/maiyunnet/kebab/blob/master/l
19219
19226
 
19220
19227
  > `optional` **local?**: `string`
19221
19228
 
19222
- Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L795)
19229
+ Defined in: [lib/undici.ts:797](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L797)
19223
19230
 
19224
19231
  ***
19225
19232
 
@@ -19227,7 +19234,7 @@ Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/l
19227
19234
 
19228
19235
  > `optional` **log?**: `boolean`
19229
19236
 
19230
- Defined in: [lib/undici.ts:812](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L812)
19237
+ Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L814)
19231
19238
 
19232
19239
  若有异常写入文件日志,默认为 true
19233
19240
 
@@ -19237,7 +19244,7 @@ Defined in: [lib/undici.ts:812](https://github.com/maiyunnet/kebab/blob/master/l
19237
19244
 
19238
19245
  > `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
19239
19246
 
19240
- Defined in: [lib/undici.ts:786](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L786)
19247
+ Defined in: [lib/undici.ts:788](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L788)
19241
19248
 
19242
19249
  ***
19243
19250
 
@@ -19245,7 +19252,7 @@ Defined in: [lib/undici.ts:786](https://github.com/maiyunnet/kebab/blob/master/l
19245
19252
 
19246
19253
  > `optional` **mproxy?**: `object`
19247
19254
 
19248
- Defined in: [lib/undici.ts:798](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L798)
19255
+ Defined in: [lib/undici.ts:800](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L800)
19249
19256
 
19250
19257
  正向 mproxy 代理,url 如 https://xxx/abc
19251
19258
 
@@ -19273,7 +19280,7 @@ Defined in: [lib/undici.ts:798](https://github.com/maiyunnet/kebab/blob/master/l
19273
19280
 
19274
19281
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
19275
19282
 
19276
- Defined in: [lib/undici.ts:808](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L808)
19283
+ Defined in: [lib/undici.ts:810](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L810)
19277
19284
 
19278
19285
  复用池名/Agent,默认为 default
19279
19286
 
@@ -19283,7 +19290,7 @@ Defined in: [lib/undici.ts:808](https://github.com/maiyunnet/kebab/blob/master/l
19283
19290
 
19284
19291
  > `optional` **save?**: `string`
19285
19292
 
19286
- Defined in: [lib/undici.ts:794](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L794)
19293
+ Defined in: [lib/undici.ts:796](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L796)
19287
19294
 
19288
19295
  ***
19289
19296
 
@@ -19291,7 +19298,7 @@ Defined in: [lib/undici.ts:794](https://github.com/maiyunnet/kebab/blob/master/l
19291
19298
 
19292
19299
  > `optional` **signal?**: `AbortSignal`
19293
19300
 
19294
- Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L814)
19301
+ Defined in: [lib/undici.ts:816](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L816)
19295
19302
 
19296
19303
  请求中止信号
19297
19304
 
@@ -19301,7 +19308,7 @@ Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/l
19301
19308
 
19302
19309
  > `optional` **timeout?**: `number`
19303
19310
 
19304
- Defined in: [lib/undici.ts:789](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L789)
19311
+ Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L791)
19305
19312
 
19306
19313
  秒数,默认 300 秒
19307
19314
 
@@ -19311,7 +19318,7 @@ Defined in: [lib/undici.ts:789](https://github.com/maiyunnet/kebab/blob/master/l
19311
19318
 
19312
19319
  > `optional` **type?**: `"form"` \| `"json"`
19313
19320
 
19314
- Defined in: [lib/undici.ts:787](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L787)
19321
+ Defined in: [lib/undici.ts:789](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L789)
19315
19322
 
19316
19323
  lib/undici/interfaces/IRproxyOptions.md
19317
19324
  ---
@@ -19324,7 +19331,7 @@ lib/undici/interfaces/IRproxyOptions.md
19324
19331
 
19325
19332
  # Interface: IRproxyOptions
19326
19333
 
19327
- Defined in: [lib/undici.ts:833](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L833)
19334
+ Defined in: [lib/undici.ts:835](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L835)
19328
19335
 
19329
19336
  反向代理请求的传入参数选项
19330
19337
 
@@ -19334,7 +19341,7 @@ Defined in: [lib/undici.ts:833](https://github.com/maiyunnet/kebab/blob/master/l
19334
19341
 
19335
19342
  > `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
19336
19343
 
19337
- Defined in: [lib/undici.ts:852](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L852)
19344
+ Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L854)
19338
19345
 
19339
19346
  手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
19340
19347
 
@@ -19344,7 +19351,7 @@ Defined in: [lib/undici.ts:852](https://github.com/maiyunnet/kebab/blob/master/l
19344
19351
 
19345
19352
  > `optional` **filter?**: (`h`) => `boolean`
19346
19353
 
19347
- Defined in: [lib/undici.ts:842](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L842)
19354
+ Defined in: [lib/undici.ts:844](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L844)
19348
19355
 
19349
19356
  过滤 header,返回 true 则留下
19350
19357
 
@@ -19364,7 +19371,7 @@ Defined in: [lib/undici.ts:842](https://github.com/maiyunnet/kebab/blob/master/l
19364
19371
 
19365
19372
  > `optional` **follow?**: `number`
19366
19373
 
19367
- Defined in: [lib/undici.ts:836](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L836)
19374
+ Defined in: [lib/undici.ts:838](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L838)
19368
19375
 
19369
19376
  ***
19370
19377
 
@@ -19372,7 +19379,7 @@ Defined in: [lib/undici.ts:836](https://github.com/maiyunnet/kebab/blob/master/l
19372
19379
 
19373
19380
  > `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
19374
19381
 
19375
- Defined in: [lib/undici.ts:840](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L840)
19382
+ Defined in: [lib/undici.ts:842](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L842)
19376
19383
 
19377
19384
  ***
19378
19385
 
@@ -19380,7 +19387,7 @@ Defined in: [lib/undici.ts:840](https://github.com/maiyunnet/kebab/blob/master/l
19380
19387
 
19381
19388
  > `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
19382
19389
 
19383
- Defined in: [lib/undici.ts:838](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L838)
19390
+ Defined in: [lib/undici.ts:840](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L840)
19384
19391
 
19385
19392
  自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
19386
19393
 
@@ -19390,7 +19397,7 @@ Defined in: [lib/undici.ts:838](https://github.com/maiyunnet/kebab/blob/master/l
19390
19397
 
19391
19398
  > `optional` **local?**: `string`
19392
19399
 
19393
- Defined in: [lib/undici.ts:839](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L839)
19400
+ Defined in: [lib/undici.ts:841](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L841)
19394
19401
 
19395
19402
  ***
19396
19403
 
@@ -19398,7 +19405,7 @@ Defined in: [lib/undici.ts:839](https://github.com/maiyunnet/kebab/blob/master/l
19398
19405
 
19399
19406
  > `optional` **mproxy?**: `object`
19400
19407
 
19401
- Defined in: [lib/undici.ts:844](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L844)
19408
+ Defined in: [lib/undici.ts:846](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L846)
19402
19409
 
19403
19410
  正向 mproxy 代理,url 如 https://xxx/abc
19404
19411
 
@@ -19426,7 +19433,7 @@ Defined in: [lib/undici.ts:844](https://github.com/maiyunnet/kebab/blob/master/l
19426
19433
 
19427
19434
  > `optional` **querys?**: `Record`\<`string`, `any`\>
19428
19435
 
19429
- Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L854)
19436
+ Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L856)
19430
19437
 
19431
19438
  自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
19432
19439
 
@@ -19436,7 +19443,7 @@ Defined in: [lib/undici.ts:854](https://github.com/maiyunnet/kebab/blob/master/l
19436
19443
 
19437
19444
  > `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
19438
19445
 
19439
- Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L856)
19446
+ Defined in: [lib/undici.ts:858](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L858)
19440
19447
 
19441
19448
  默认为 default
19442
19449
 
@@ -19446,7 +19453,7 @@ Defined in: [lib/undici.ts:856](https://github.com/maiyunnet/kebab/blob/master/l
19446
19453
 
19447
19454
  > `optional` **timeout?**: `number`
19448
19455
 
19449
- Defined in: [lib/undici.ts:835](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L835)
19456
+ Defined in: [lib/undici.ts:837](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L837)
19450
19457
 
19451
19458
  秒数,默认 300 秒
19452
19459
 
@@ -19935,7 +19942,7 @@ lib/undici/type-aliases/THttpHeaders.md
19935
19942
 
19936
19943
  > **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
19937
19944
 
19938
- Defined in: [lib/undici.ts:861](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L861)
19945
+ Defined in: [lib/undici.ts:863](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L863)
19939
19946
 
19940
19947
  http headers
19941
19948
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.15.4";
8
+ export declare const VER = "9.15.6";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.15.4';
9
+ export const VER = '9.15.6';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/core.d.ts CHANGED
@@ -181,6 +181,11 @@ export declare function passThroughAppend(passThrough: stream.PassThrough, data:
181
181
  */
182
182
  export declare function exec(command: string, options?: {
183
183
  'cwd'?: string;
184
+ /**
185
+ * --- 命令超时毫秒数,超时后终止命令并以失败返回 ---
186
+ * --- 默认无超时限制:不传时命令可一直运行直至完成,与 cp.exec 默认行为一致 ---
187
+ */
188
+ 'timeout'?: number;
184
189
  }): Promise<string | false>;
185
190
  /**
186
191
  * --- 向主进程(或局域网同代码机子)发送广播将进行 reload 操作,等待回传 ---
package/lib/core.js CHANGED
@@ -602,6 +602,7 @@ export function exec(command, options = {}) {
602
602
  return new Promise(function (resolve) {
603
603
  cp.exec(command, {
604
604
  'cwd': options.cwd,
605
+ 'timeout': options.timeout,
605
606
  }, function (err, stdout) {
606
607
  if (err) {
607
608
  resolve(false);
@@ -630,6 +631,10 @@ export async function sendReload(hosts) {
630
631
  if (hosts === 'config') {
631
632
  hosts = globalConfig.hosts;
632
633
  }
634
+ // --- 未传或 config 展开后为空数组,均回退到本机 ---
635
+ if (!hosts?.length) {
636
+ hosts = ['127.0.0.1'];
637
+ }
633
638
  // --- 局域网模式 ---
634
639
  const time = lTime.stamp();
635
640
  /** --- 返回成功的 host --- */
@@ -675,6 +680,10 @@ export async function sendRestart(hosts) {
675
680
  if (hosts === 'config') {
676
681
  hosts = globalConfig.hosts;
677
682
  }
683
+ // --- 未传或 config 展开后为空数组,均回退到本机 ---
684
+ if (!hosts?.length) {
685
+ hosts = ['127.0.0.1'];
686
+ }
678
687
  // --- 局域网模式 ---
679
688
  const time = lTime.stamp();
680
689
  /** --- 返回成功的 host --- */
package/lib/undici.js CHANGED
@@ -677,6 +677,8 @@ export async function rproxy(ctr, route, opt = {}) {
677
677
  const compress = upstreamEncoded ? null : lZlib.createCompress(req.headers['accept-encoding'] ?? '');
678
678
  if (compress) {
679
679
  res.setHeader('content-encoding', compress.type);
680
+ // --- 本层压缩后响应大小会变化,不能沿用上游的 content-length ---
681
+ res.removeHeader('content-length');
680
682
  }
681
683
  lCore.writeHead(res, rres.headers?.['http-code'] ?? 200);
682
684
  await new Promise((resolve) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.15.4",
3
+ "version": "9.15.6",
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/sys/master.js CHANGED
@@ -83,6 +83,37 @@ function normalizeArchivePath(archivePath) {
83
83
  }
84
84
  return `/${normalized}`;
85
85
  }
86
+ /**
87
+ * --- 递归判断 JSON 内容中是否包含受保护的配置参数 ---
88
+ * @param value 待检查的 JSON 值
89
+ * @returns 是否包含 pwd 或 skey 参数
90
+ */
91
+ function hasSensitiveConfigKey(value) {
92
+ if (Array.isArray(value)) {
93
+ return value.some(item => hasSensitiveConfigKey(item));
94
+ }
95
+ if ((value === null) || (typeof value !== 'object')) {
96
+ return false;
97
+ }
98
+ for (const key of Object.keys(value)) {
99
+ if ((key === 'pwd') || (key === 'skey')) {
100
+ return true;
101
+ }
102
+ if (hasSensitiveConfigKey(value[key])) {
103
+ return true;
104
+ }
105
+ }
106
+ return false;
107
+ }
108
+ /**
109
+ * --- 判断 ZIP 内的 kebab.json 是否包含受保护的配置参数 ---
110
+ * @param content ZIP 文件内容
111
+ * @returns 是否包含 pwd 或 skey 参数
112
+ */
113
+ function hasSensitiveConfig(content) {
114
+ const json = lText.parseJson(typeof content === 'string' ? content : content.toString('utf8'));
115
+ return (json !== false) && hasSensitiveConfigKey(json);
116
+ }
86
117
  /**
87
118
  * --- 等待指定 worker 开始监听端口就绪 ---
88
119
  * @param worker 要等待的 worker 对象
@@ -265,13 +296,17 @@ function createRpcListener() {
265
296
  res.end('Path not found');
266
297
  return;
267
298
  }
299
+ // --- npm install 上限与 sendNpm 客户端超时一致,超时后终止,避免无限期运行 ---
300
+ const npmTimeout = 300_000;
268
301
  let rtn = await lCore.exec('npm i --omit=dev', {
269
302
  'cwd': msg.path,
303
+ 'timeout': npmTimeout,
270
304
  });
271
305
  if (rtn === false) {
272
306
  // --- 部分项目可能存在 peerDependencies 冲突,失败后降级为 legacy-peer-deps 再试一次 ---
273
307
  rtn = await lCore.exec('npm i --omit=dev --legacy-peer-deps', {
274
308
  'cwd': msg.path,
309
+ 'timeout': npmTimeout,
275
310
  });
276
311
  }
277
312
  if (rtn === false) {
@@ -490,8 +525,12 @@ function createRpcListener() {
490
525
  // --- 开发、依赖、缓存、构建产物目录不覆盖 ---
491
526
  continue;
492
527
  }
493
- if ((pat === 'conf/' && fname === 'config.json') || fname === 'kebab.json') {
494
- // --- 特殊文件不能覆盖 ---
528
+ if (fname === 'kebab.json' && hasSensitiveConfig(ls[archivePath])) {
529
+ // --- 包含密码或密钥的 kebab.json 不覆盖,避免部署包覆盖现有敏感配置 ---
530
+ continue;
531
+ }
532
+ if (pat === 'conf/' && fname === 'config.json') {
533
+ // --- 全局配置文件不能覆盖 ---
495
534
  continue;
496
535
  }
497
536
  if (fname.endsWith('.js.map') || fname.endsWith('.ts') || fname.endsWith('.tsx') || fname.endsWith('.scss') || fname.endsWith('.gitignore') || fname.endsWith('.DS_Store')) {