node-karin 1.12.1 → 1.12.2
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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +258 -146
- package/dist/index.mjs +209 -47
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.12.2](https://github.com/KarinJS/Karin/compare/core-v1.12.1...core-v1.12.2) (2025-10-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 🐛 Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **update:** 增强版本比较功能,支持严格语义化版本模式 ([#568](https://github.com/KarinJS/Karin/issues/568)) ([da3843a](https://github.com/KarinJS/Karin/commit/da3843ae3c770b308583d9b0671d4dbd36ce37ec))
|
|
9
|
+
|
|
3
10
|
## [1.12.1](https://github.com/KarinJS/Karin/compare/core-v1.12.0...core-v1.12.1) (2025-10-17)
|
|
4
11
|
|
|
5
12
|
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { Readable } from 'node:stream';
|
|
|
10
10
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
11
11
|
import YAML from 'yaml';
|
|
12
12
|
import { FSWatcher } from 'chokidar';
|
|
13
|
-
import {
|
|
13
|
+
import { ExecException as ExecException$1, exec as exec$2 } from 'node:child_process';
|
|
14
14
|
import { Request as Request$1, Router, Response, RequestHandler, Express } from 'express';
|
|
15
15
|
import { exec as exec$1, ExecException } from 'child_process';
|
|
16
16
|
export { ExecException } from 'child_process';
|
|
@@ -8325,6 +8325,174 @@ declare const lock: {
|
|
|
8325
8325
|
};
|
|
8326
8326
|
};
|
|
8327
8327
|
|
|
8328
|
+
/** 版本号对比模式 */
|
|
8329
|
+
type CompareMode = {
|
|
8330
|
+
/**
|
|
8331
|
+
* 版本号对比模式,怎么对比才算是有更新
|
|
8332
|
+
*
|
|
8333
|
+
* **xyz 模式(默认)**
|
|
8334
|
+
* - 只看前三段数字 `X.Y.Z`,忽略预发布/构建后缀。
|
|
8335
|
+
* - 示例:
|
|
8336
|
+
* - 本地 `2.6.7`,远程 `2.6.8` → 有更新
|
|
8337
|
+
* - 本地 `2.6.7-beta.1`,远程 `2.6.7` → 无更新(都视为 `2.6.7`)
|
|
8338
|
+
* - 本地 `1.0.0+20230101`,远程 `1.0.1` → 有更新(只看 `1.0.0` vs `1.0.1`)
|
|
8339
|
+
* - 本地 `3.2.0-rc.3`,远程 `3.2.0` → 无更新(都视为 `3.2.0`)
|
|
8340
|
+
*
|
|
8341
|
+
* **semver 模式(语义化版本)**
|
|
8342
|
+
* - 严格遵循 [SemVer](https://semver.org/) 规则。
|
|
8343
|
+
* - 示例:
|
|
8344
|
+
* - 本地 `2.6.7-beta.1`,远程 `2.6.6` → 本地更高,已最新,不提示升级
|
|
8345
|
+
* - 本地 `1.0.0-alpha`,远程 `1.0.0` → 远程更高,提示升级
|
|
8346
|
+
* - 本地 `1.0.0+20230101`,远程 `1.0.0` → 仅比较版本核心,不比较构建元数据,视为相同
|
|
8347
|
+
* - 本地 `2.0.0-beta.2`,远程 `2.0.0-beta.10` → 远程更高,提示升级(按预发布号逐段比较)
|
|
8348
|
+
* - 本地 `3.1.0-rc.1`,远程 `3.1.0` → 远程更高,提示升级(稳定版 > 预发布)
|
|
8349
|
+
*
|
|
8350
|
+
* @default 'xyz'
|
|
8351
|
+
*/
|
|
8352
|
+
compare?: 'xyz' | 'semver';
|
|
8353
|
+
};
|
|
8354
|
+
/**
|
|
8355
|
+
* @description 传入npm包名 检查是否存在更新
|
|
8356
|
+
* @param name 包名
|
|
8357
|
+
* @param opts 额外参数
|
|
8358
|
+
* @returns 是否存在更新 true: 存在更新 false: 无更新
|
|
8359
|
+
*/
|
|
8360
|
+
declare const checkPkgUpdate: (name: string, opts?: CompareMode) => Promise<{
|
|
8361
|
+
/** 存在更新 */
|
|
8362
|
+
status: "yes";
|
|
8363
|
+
/** 本地版本号 */
|
|
8364
|
+
local: string;
|
|
8365
|
+
/** 远程版本号 */
|
|
8366
|
+
remote: string;
|
|
8367
|
+
} | {
|
|
8368
|
+
/** 无更新 */
|
|
8369
|
+
status: "no";
|
|
8370
|
+
/** 本地版本号 */
|
|
8371
|
+
local: string;
|
|
8372
|
+
} | {
|
|
8373
|
+
/** 检查发生错误 */
|
|
8374
|
+
status: "error";
|
|
8375
|
+
/** 错误信息 */
|
|
8376
|
+
error: Error;
|
|
8377
|
+
}>;
|
|
8378
|
+
/**
|
|
8379
|
+
* @description 获取指定包的本地版本号 如果获取失败则会获取package.json中的版本号
|
|
8380
|
+
* @param name 包名
|
|
8381
|
+
*/
|
|
8382
|
+
declare const getPkgVersion: (name: string) => Promise<string>;
|
|
8383
|
+
/**
|
|
8384
|
+
* @description 获取指定包的远程版本号
|
|
8385
|
+
* @param name 包名
|
|
8386
|
+
* @param tag 标签,默认为 `latest`
|
|
8387
|
+
*/
|
|
8388
|
+
declare const getRemotePkgVersion: (name: string, tag?: string) => Promise<string>;
|
|
8389
|
+
/**
|
|
8390
|
+
* @description 更新指定的npm插件
|
|
8391
|
+
* @param name 包名
|
|
8392
|
+
* @param tag 标签 默认 `latest`
|
|
8393
|
+
*/
|
|
8394
|
+
declare const updatePkg: (name: string, tag?: string) => Promise<{
|
|
8395
|
+
/** 更新失败 */
|
|
8396
|
+
status: "failed";
|
|
8397
|
+
/** 更新失败信息 */
|
|
8398
|
+
data: string | ExecException$1;
|
|
8399
|
+
} | {
|
|
8400
|
+
/** 更新成功 */
|
|
8401
|
+
status: "ok";
|
|
8402
|
+
/** 更新成功信息 */
|
|
8403
|
+
data: string;
|
|
8404
|
+
/** 本地版本号 */
|
|
8405
|
+
local: string;
|
|
8406
|
+
/** 远程版本号 */
|
|
8407
|
+
remote: string;
|
|
8408
|
+
}>;
|
|
8409
|
+
/**
|
|
8410
|
+
* @description 更新全部npm插件
|
|
8411
|
+
*/
|
|
8412
|
+
declare const updateAllPkg: () => Promise<string>;
|
|
8413
|
+
/**
|
|
8414
|
+
* @description 检查git插件是否有更新
|
|
8415
|
+
* @param filePath 插件路径
|
|
8416
|
+
* @param time 任务执行超时时间 默认120s
|
|
8417
|
+
*/
|
|
8418
|
+
declare const checkGitPluginUpdate: (filePath: string, time?: number) => Promise<{
|
|
8419
|
+
/** 存在更新 */
|
|
8420
|
+
status: "yes";
|
|
8421
|
+
/** 更新内容 */
|
|
8422
|
+
data: string;
|
|
8423
|
+
/** 落后次数 */
|
|
8424
|
+
count: number;
|
|
8425
|
+
} | {
|
|
8426
|
+
/** 无更新 */
|
|
8427
|
+
status: "no";
|
|
8428
|
+
/** 最后更新时间描述 */
|
|
8429
|
+
data: string;
|
|
8430
|
+
} | {
|
|
8431
|
+
/** 检查发生错误 */
|
|
8432
|
+
status: "error";
|
|
8433
|
+
data: Error;
|
|
8434
|
+
}>;
|
|
8435
|
+
/**
|
|
8436
|
+
* @description 获取指定仓库的提交记录
|
|
8437
|
+
* @param options 参数
|
|
8438
|
+
* @returns 提交记录
|
|
8439
|
+
*/
|
|
8440
|
+
declare const getCommit: (options: {
|
|
8441
|
+
/** 指令命令路径 */
|
|
8442
|
+
path: string;
|
|
8443
|
+
/** 获取几次提交 默认1次 */
|
|
8444
|
+
count?: number;
|
|
8445
|
+
/** 指定哈希 */
|
|
8446
|
+
hash?: string;
|
|
8447
|
+
/** 指定分支 */
|
|
8448
|
+
branch?: string;
|
|
8449
|
+
}) => Promise<string>;
|
|
8450
|
+
/**
|
|
8451
|
+
* @description 获取指定仓库最后一次提交哈希值
|
|
8452
|
+
* @param filePath - 插件相对路径
|
|
8453
|
+
* @param short - 是否获取短哈希 默认true
|
|
8454
|
+
*/
|
|
8455
|
+
declare const getHash: (filePath: string, short?: boolean) => Promise<string>;
|
|
8456
|
+
/**
|
|
8457
|
+
* 获取指定仓库最后一次提交时间日期
|
|
8458
|
+
* @param filePath - 插件相对路径
|
|
8459
|
+
* @returns 最后一次提交时间
|
|
8460
|
+
* @example
|
|
8461
|
+
* ```ts
|
|
8462
|
+
* console.log(await getTime('./plugins/karin-plugin-example'))
|
|
8463
|
+
* // -> '2021-09-01 12:00:00'
|
|
8464
|
+
* ```
|
|
8465
|
+
*/
|
|
8466
|
+
declare const getTime: (filePath: string) => Promise<string>;
|
|
8467
|
+
/**
|
|
8468
|
+
* @description 更新指定git插件
|
|
8469
|
+
* @param filePath 插件路径
|
|
8470
|
+
* @param cmd 执行命令 默认`git pull`
|
|
8471
|
+
* @param time 任务执行超时时间 默认120s
|
|
8472
|
+
*/
|
|
8473
|
+
declare const updateGitPlugin: (filePath: string, cmd?: string, time?: number) => Promise<{
|
|
8474
|
+
/** 更新失败 */
|
|
8475
|
+
status: "failed";
|
|
8476
|
+
/** 更新失败信息 */
|
|
8477
|
+
data: string | ExecException$1;
|
|
8478
|
+
} | {
|
|
8479
|
+
/** 更新成功 */
|
|
8480
|
+
status: "ok";
|
|
8481
|
+
/** 更新成功信息 */
|
|
8482
|
+
data: string;
|
|
8483
|
+
/** 更新详情 */
|
|
8484
|
+
commit: string;
|
|
8485
|
+
} | {
|
|
8486
|
+
/** 检查发生错误 */
|
|
8487
|
+
status: "error";
|
|
8488
|
+
data: Error;
|
|
8489
|
+
}>;
|
|
8490
|
+
/**
|
|
8491
|
+
* @description 更新所有git插件
|
|
8492
|
+
* @param time 任务执行超时时间 默认120s
|
|
8493
|
+
*/
|
|
8494
|
+
declare const updateAllGitPlugin: (cmd?: string, time?: number) => Promise<string>;
|
|
8495
|
+
|
|
8328
8496
|
/**
|
|
8329
8497
|
* 提取指定版本号的更新日志
|
|
8330
8498
|
* @param version 版本号,可包含预发布/构建元数据(如 `-beta`)
|
|
@@ -8335,36 +8503,120 @@ declare const lock: {
|
|
|
8335
8503
|
* - 不存在时按新 -> 旧顺序回退到不超过目标稳定版的最新版本。
|
|
8336
8504
|
*/
|
|
8337
8505
|
declare const log: (version: string, data: string) => string | null;
|
|
8506
|
+
/**
|
|
8507
|
+
* 从指定版本开始提取连续的更新日志
|
|
8508
|
+
*/
|
|
8509
|
+
declare function logs(options: LogsOptions): string;
|
|
8338
8510
|
/**
|
|
8339
8511
|
* 从指定版本开始提取连续的更新日志
|
|
8340
8512
|
* @param version 起始版本号
|
|
8341
8513
|
* @param data `CHANGELOG.md` 文件内容
|
|
8342
8514
|
* @param length 提取条数,默认为 1
|
|
8343
8515
|
* @param reverse 是否反向提取;`false` 向后,`true` 向前
|
|
8516
|
+
* @param opts 版本号对比模式
|
|
8344
8517
|
* @returns 拼接后的更新日志字符串;找不到起始版本返回空字符串
|
|
8345
8518
|
* @description
|
|
8346
8519
|
* - 起始版本会规范化并回退到不超过目标稳定版的最新版本;
|
|
8347
8520
|
* - 切片范围将做边界裁剪以避免越界。
|
|
8521
|
+
* @deprecated 此调用方式将在未来版本废弃,请改用对象参数重载 logs({ ... }) 进行调用
|
|
8522
|
+
*/
|
|
8523
|
+
declare function logs(version: string, data: string, length?: number, reverse?: boolean, opts?: CompareMode): string;
|
|
8524
|
+
/**
|
|
8525
|
+
* 提取指定版本区间的更新日志
|
|
8348
8526
|
*/
|
|
8349
|
-
declare
|
|
8527
|
+
declare function range(options: RangeOptions): string;
|
|
8350
8528
|
/**
|
|
8351
8529
|
* 提取指定版本区间的更新日志
|
|
8352
8530
|
* @param data `CHANGELOG.md` 文件内容
|
|
8353
8531
|
* @param startVersion 起始版本号(较旧)
|
|
8354
8532
|
* @param endVersion 结束版本号(较新)
|
|
8533
|
+
* @param opts 版本号对比模式
|
|
8355
8534
|
* @returns 拼接后的更新日志字符串;若任一版本无法定位返回空字符串
|
|
8356
8535
|
* @description
|
|
8357
8536
|
* - CHANGELOG 的版本排序约定为从新到旧;
|
|
8358
8537
|
* - 若传入版本不存在,将回退到不超过目标稳定版的最新版本;
|
|
8359
8538
|
* - 当 `start > end` 时会自动调整为有效区间。
|
|
8539
|
+
* @deprecated 此调用方式将在未来版本废弃,请改用对象参数重载 range({ ... }) 进行调用
|
|
8360
8540
|
*/
|
|
8361
|
-
declare
|
|
8541
|
+
declare function range(data: string, startVersion: string, endVersion: string, opts?: CompareMode): string;
|
|
8362
8542
|
/**
|
|
8363
8543
|
* 对更新日志进行解析并形成对象
|
|
8364
8544
|
* @param data 更新日志内容
|
|
8365
8545
|
* @returns 以版本号为键的更新日志对象
|
|
8366
8546
|
*/
|
|
8367
8547
|
declare const parseChangelog: (data: string) => Record<string, string>;
|
|
8548
|
+
/** logs 方法的配置 */
|
|
8549
|
+
type LogsOptions = {
|
|
8550
|
+
/** 起始版本号 */
|
|
8551
|
+
version: string;
|
|
8552
|
+
/** CHANGELOG.md 内容 */
|
|
8553
|
+
data: string;
|
|
8554
|
+
/**
|
|
8555
|
+
* 提取条数
|
|
8556
|
+
* @default 1
|
|
8557
|
+
*/
|
|
8558
|
+
length?: number;
|
|
8559
|
+
/**
|
|
8560
|
+
* 是否反向提取
|
|
8561
|
+
* @default false
|
|
8562
|
+
*/
|
|
8563
|
+
reverse?: boolean;
|
|
8564
|
+
/**
|
|
8565
|
+
* 版本号对比模式,怎么对比才算是有更新
|
|
8566
|
+
*
|
|
8567
|
+
* **xyz 模式(默认)**
|
|
8568
|
+
* - 只看前三段数字 `X.Y.Z`,忽略预发布/构建后缀。
|
|
8569
|
+
* - 示例:
|
|
8570
|
+
* - 本地 `2.6.7`,远程 `2.6.8` → 有更新
|
|
8571
|
+
* - 本地 `2.6.7-beta.1`,远程 `2.6.7` → 无更新(都视为 `2.6.7`)
|
|
8572
|
+
* - 本地 `1.0.0+20230101`,远程 `1.0.1` → 有更新(只看 `1.0.0` vs `1.0.1`)
|
|
8573
|
+
* - 本地 `3.2.0-rc.3`,远程 `3.2.0` → 无更新(都视为 `3.2.0`)
|
|
8574
|
+
*
|
|
8575
|
+
* **semver 模式(语义化版本)**
|
|
8576
|
+
* - 严格遵循 [SemVer](https://semver.org/) 规则。
|
|
8577
|
+
* - 示例:
|
|
8578
|
+
* - 本地 `2.6.7-beta.1`,远程 `2.6.6` → 本地更高,已最新,不提示升级
|
|
8579
|
+
* - 本地 `1.0.0-alpha`,远程 `1.0.0` → 远程更高,提示升级
|
|
8580
|
+
* - 本地 `1.0.0+20230101`,远程 `1.0.0` → 仅比较版本核心,不比较构建元数据,视为相同
|
|
8581
|
+
* - 本地 `2.0.0-beta.2`,远程 `2.0.0-beta.10` → 远程更高,提示升级(按预发布号逐段比较)
|
|
8582
|
+
* - 本地 `3.1.0-rc.1`,远程 `3.1.0` → 远程更高,提示升级(稳定版 > 预发布)
|
|
8583
|
+
*
|
|
8584
|
+
* @default 'xyz'
|
|
8585
|
+
*/
|
|
8586
|
+
compare?: CompareMode['compare'];
|
|
8587
|
+
};
|
|
8588
|
+
/** range 方法的配置 */
|
|
8589
|
+
type RangeOptions = {
|
|
8590
|
+
/** CHANGELOG.md 内容 */
|
|
8591
|
+
data: string;
|
|
8592
|
+
/** 起始版本号(较旧) */
|
|
8593
|
+
startVersion: string;
|
|
8594
|
+
/** 结束版本号(较新) */
|
|
8595
|
+
endVersion: string;
|
|
8596
|
+
/**
|
|
8597
|
+
* 版本号对比模式,怎么对比才算是有更新
|
|
8598
|
+
*
|
|
8599
|
+
* **xyz 模式(默认)**
|
|
8600
|
+
* - 只看前三段数字 `X.Y.Z`,忽略预发布/构建后缀。
|
|
8601
|
+
* - 示例:
|
|
8602
|
+
* - 本地 `2.6.7`,远程 `2.6.8` → 有更新
|
|
8603
|
+
* - 本地 `2.6.7-beta.1`,远程 `2.6.7` → 无更新(都视为 `2.6.7`)
|
|
8604
|
+
* - 本地 `1.0.0+20230101`,远程 `1.0.1` → 有更新(只看 `1.0.0` vs `1.0.1`)
|
|
8605
|
+
* - 本地 `3.2.0-rc.3`,远程 `3.2.0` → 无更新(都视为 `3.2.0`)
|
|
8606
|
+
*
|
|
8607
|
+
* **semver 模式(语义化版本)**
|
|
8608
|
+
* - 严格遵循 [SemVer](https://semver.org/) 规则。
|
|
8609
|
+
* - 示例:
|
|
8610
|
+
* - 本地 `2.6.7-beta.1`,远程 `2.6.6` → 本地更高,已最新,不提示升级
|
|
8611
|
+
* - 本地 `1.0.0-alpha`,远程 `1.0.0` → 远程更高,提示升级
|
|
8612
|
+
* - 本地 `1.0.0+20230101`,远程 `1.0.0` → 仅比较版本核心,不比较构建元数据,视为相同
|
|
8613
|
+
* - 本地 `2.0.0-beta.2`,远程 `2.0.0-beta.10` → 远程更高,提示升级(按预发布号逐段比较)
|
|
8614
|
+
* - 本地 `3.1.0-rc.1`,远程 `3.1.0` → 远程更高,提示升级(稳定版 > 预发布)
|
|
8615
|
+
*
|
|
8616
|
+
* @default 'xyz'
|
|
8617
|
+
*/
|
|
8618
|
+
compare?: CompareMode['compare'];
|
|
8619
|
+
};
|
|
8368
8620
|
|
|
8369
8621
|
declare const changelog_log: typeof log;
|
|
8370
8622
|
declare const changelog_logs: typeof logs;
|
|
@@ -8869,147 +9121,6 @@ declare const isDocker: boolean;
|
|
|
8869
9121
|
/** 是否为root用户 仅linux */
|
|
8870
9122
|
declare const isRoot: boolean;
|
|
8871
9123
|
|
|
8872
|
-
/**
|
|
8873
|
-
* @description 传入npm包名 检查是否存在更新
|
|
8874
|
-
* @param name 包名
|
|
8875
|
-
* @returns 是否存在更新 true: 存在更新 false: 无更新
|
|
8876
|
-
*/
|
|
8877
|
-
declare const checkPkgUpdate: (name: string) => Promise<{
|
|
8878
|
-
/** 存在更新 */
|
|
8879
|
-
status: "yes";
|
|
8880
|
-
/** 本地版本号 */
|
|
8881
|
-
local: string;
|
|
8882
|
-
/** 远程版本号 */
|
|
8883
|
-
remote: string;
|
|
8884
|
-
} | {
|
|
8885
|
-
/** 无更新 */
|
|
8886
|
-
status: "no";
|
|
8887
|
-
/** 本地版本号 */
|
|
8888
|
-
local: string;
|
|
8889
|
-
} | {
|
|
8890
|
-
/** 检查发生错误 */
|
|
8891
|
-
status: "error";
|
|
8892
|
-
/** 错误信息 */
|
|
8893
|
-
error: Error;
|
|
8894
|
-
}>;
|
|
8895
|
-
/**
|
|
8896
|
-
* @description 获取指定包的本地版本号 如果获取失败则会获取package.json中的版本号
|
|
8897
|
-
* @param name 包名
|
|
8898
|
-
*/
|
|
8899
|
-
declare const getPkgVersion: (name: string) => Promise<string>;
|
|
8900
|
-
/**
|
|
8901
|
-
* @description 获取指定包的远程版本号
|
|
8902
|
-
* @param name 包名
|
|
8903
|
-
* @param tag 标签,默认为 `latest`
|
|
8904
|
-
*/
|
|
8905
|
-
declare const getRemotePkgVersion: (name: string, tag?: string) => Promise<string>;
|
|
8906
|
-
/**
|
|
8907
|
-
* @description 更新指定的npm插件
|
|
8908
|
-
* @param name 包名
|
|
8909
|
-
* @param tag 标签 默认 `latest`
|
|
8910
|
-
*/
|
|
8911
|
-
declare const updatePkg: (name: string, tag?: string) => Promise<{
|
|
8912
|
-
/** 更新失败 */
|
|
8913
|
-
status: "failed";
|
|
8914
|
-
/** 更新失败信息 */
|
|
8915
|
-
data: string | ExecException$1;
|
|
8916
|
-
} | {
|
|
8917
|
-
/** 更新成功 */
|
|
8918
|
-
status: "ok";
|
|
8919
|
-
/** 更新成功信息 */
|
|
8920
|
-
data: string;
|
|
8921
|
-
/** 本地版本号 */
|
|
8922
|
-
local: string;
|
|
8923
|
-
/** 远程版本号 */
|
|
8924
|
-
remote: string;
|
|
8925
|
-
}>;
|
|
8926
|
-
/**
|
|
8927
|
-
* @description 更新全部npm插件
|
|
8928
|
-
*/
|
|
8929
|
-
declare const updateAllPkg: () => Promise<string>;
|
|
8930
|
-
/**
|
|
8931
|
-
* @description 检查git插件是否有更新
|
|
8932
|
-
* @param filePath 插件路径
|
|
8933
|
-
* @param time 任务执行超时时间 默认120s
|
|
8934
|
-
*/
|
|
8935
|
-
declare const checkGitPluginUpdate: (filePath: string, time?: number) => Promise<{
|
|
8936
|
-
/** 存在更新 */
|
|
8937
|
-
status: "yes";
|
|
8938
|
-
/** 更新内容 */
|
|
8939
|
-
data: string;
|
|
8940
|
-
/** 落后次数 */
|
|
8941
|
-
count: number;
|
|
8942
|
-
} | {
|
|
8943
|
-
/** 无更新 */
|
|
8944
|
-
status: "no";
|
|
8945
|
-
/** 最后更新时间描述 */
|
|
8946
|
-
data: string;
|
|
8947
|
-
} | {
|
|
8948
|
-
/** 检查发生错误 */
|
|
8949
|
-
status: "error";
|
|
8950
|
-
data: Error;
|
|
8951
|
-
}>;
|
|
8952
|
-
/**
|
|
8953
|
-
* @description 获取指定仓库的提交记录
|
|
8954
|
-
* @param options 参数
|
|
8955
|
-
* @returns 提交记录
|
|
8956
|
-
*/
|
|
8957
|
-
declare const getCommit: (options: {
|
|
8958
|
-
/** 指令命令路径 */
|
|
8959
|
-
path: string;
|
|
8960
|
-
/** 获取几次提交 默认1次 */
|
|
8961
|
-
count?: number;
|
|
8962
|
-
/** 指定哈希 */
|
|
8963
|
-
hash?: string;
|
|
8964
|
-
/** 指定分支 */
|
|
8965
|
-
branch?: string;
|
|
8966
|
-
}) => Promise<string>;
|
|
8967
|
-
/**
|
|
8968
|
-
* @description 获取指定仓库最后一次提交哈希值
|
|
8969
|
-
* @param filePath - 插件相对路径
|
|
8970
|
-
* @param short - 是否获取短哈希 默认true
|
|
8971
|
-
*/
|
|
8972
|
-
declare const getHash: (filePath: string, short?: boolean) => Promise<string>;
|
|
8973
|
-
/**
|
|
8974
|
-
* 获取指定仓库最后一次提交时间日期
|
|
8975
|
-
* @param filePath - 插件相对路径
|
|
8976
|
-
* @returns 最后一次提交时间
|
|
8977
|
-
* @example
|
|
8978
|
-
* ```ts
|
|
8979
|
-
* console.log(await getTime('./plugins/karin-plugin-example'))
|
|
8980
|
-
* // -> '2021-09-01 12:00:00'
|
|
8981
|
-
* ```
|
|
8982
|
-
*/
|
|
8983
|
-
declare const getTime: (filePath: string) => Promise<string>;
|
|
8984
|
-
/**
|
|
8985
|
-
* @description 更新指定git插件
|
|
8986
|
-
* @param filePath 插件路径
|
|
8987
|
-
* @param cmd 执行命令 默认`git pull`
|
|
8988
|
-
* @param time 任务执行超时时间 默认120s
|
|
8989
|
-
*/
|
|
8990
|
-
declare const updateGitPlugin: (filePath: string, cmd?: string, time?: number) => Promise<{
|
|
8991
|
-
/** 更新失败 */
|
|
8992
|
-
status: "failed";
|
|
8993
|
-
/** 更新失败信息 */
|
|
8994
|
-
data: string | ExecException$1;
|
|
8995
|
-
} | {
|
|
8996
|
-
/** 更新成功 */
|
|
8997
|
-
status: "ok";
|
|
8998
|
-
/** 更新成功信息 */
|
|
8999
|
-
data: string;
|
|
9000
|
-
/** 更新详情 */
|
|
9001
|
-
commit: string;
|
|
9002
|
-
} | {
|
|
9003
|
-
/** 检查发生错误 */
|
|
9004
|
-
status: "error";
|
|
9005
|
-
data: Error;
|
|
9006
|
-
}>;
|
|
9007
|
-
/**
|
|
9008
|
-
* @description 更新所有git插件
|
|
9009
|
-
* @param time 任务执行超时时间 默认120s
|
|
9010
|
-
*/
|
|
9011
|
-
declare const updateAllGitPlugin: (cmd?: string, time?: number) => Promise<string>;
|
|
9012
|
-
|
|
9013
9124
|
/**
|
|
9014
9125
|
* 重启Bot
|
|
9015
9126
|
* @param selfId - 机器人的id 传e.self_id
|
|
@@ -9073,6 +9184,7 @@ declare const fileToUrl: FileToUrlHandler;
|
|
|
9073
9184
|
*/
|
|
9074
9185
|
declare const satisfies: (satisfies: string, version: string) => boolean;
|
|
9075
9186
|
|
|
9187
|
+
type index$2_CompareMode = CompareMode;
|
|
9076
9188
|
declare const index$2_checkGitPluginUpdate: typeof checkGitPluginUpdate;
|
|
9077
9189
|
declare const index$2_checkPkgUpdate: typeof checkPkgUpdate;
|
|
9078
9190
|
declare const index$2_checkPort: typeof checkPort;
|
|
@@ -9116,7 +9228,7 @@ declare const index$2_updateGitPlugin: typeof updateGitPlugin;
|
|
|
9116
9228
|
declare const index$2_updatePkg: typeof updatePkg;
|
|
9117
9229
|
declare const index$2_waitPort: typeof waitPort;
|
|
9118
9230
|
declare namespace index$2 {
|
|
9119
|
-
export { index$2_checkGitPluginUpdate as checkGitPluginUpdate, index$2_checkPkgUpdate as checkPkgUpdate, index$2_checkPort as checkPort, index$2_errorToString as errorToString, index$2_exec as exec, index$2_ffmpeg as ffmpeg, index$2_ffplay as ffplay, index$2_ffprobe as ffprobe, index$2_fileToUrl as fileToUrl, index$2_fileToUrlHandlerKey as fileToUrlHandlerKey, formatTime$1 as formatTime, index$2_getCommit as getCommit, index$2_getHash as getHash, index$2_getPid as getPid, index$2_getPkgVersion as getPkgVersion, index$2_getRemotePkgVersion as getRemotePkgVersion, index$2_getRequestIp as getRequestIp, index$2_getTime as getTime, index$2_importModule as importModule, index$2_imports as imports, index$2_isClass as isClass, index$2_isDocker as isDocker, index$2_isIPv4Loop as isIPv4Loop, index$2_isIPv6Loop as isIPv6Loop, index$2_isLinux as isLinux, index$2_isLocalRequest as isLocalRequest, index$2_isLoopback as isLoopback, index$2_isMac as isMac, index$2_isRoot as isRoot, index$2_isWin as isWin, index$2_killApp as killApp, index$2_lock as lock, index$2_lockMethod as lockMethod, index$2_lockProp as lockProp, index$2_restart as restart, index$2_restartDirect as restartDirect, index$2_satisfies as satisfies, index$2_stringifyError as stringifyError, index$2_updateAllGitPlugin as updateAllGitPlugin, index$2_updateAllPkg as updateAllPkg, index$2_updateGitPlugin as updateGitPlugin, index$2_updatePkg as updatePkg, uptime$1 as uptime, index$2_waitPort as waitPort };
|
|
9231
|
+
export { type index$2_CompareMode as CompareMode, index$2_checkGitPluginUpdate as checkGitPluginUpdate, index$2_checkPkgUpdate as checkPkgUpdate, index$2_checkPort as checkPort, index$2_errorToString as errorToString, index$2_exec as exec, index$2_ffmpeg as ffmpeg, index$2_ffplay as ffplay, index$2_ffprobe as ffprobe, index$2_fileToUrl as fileToUrl, index$2_fileToUrlHandlerKey as fileToUrlHandlerKey, formatTime$1 as formatTime, index$2_getCommit as getCommit, index$2_getHash as getHash, index$2_getPid as getPid, index$2_getPkgVersion as getPkgVersion, index$2_getRemotePkgVersion as getRemotePkgVersion, index$2_getRequestIp as getRequestIp, index$2_getTime as getTime, index$2_importModule as importModule, index$2_imports as imports, index$2_isClass as isClass, index$2_isDocker as isDocker, index$2_isIPv4Loop as isIPv4Loop, index$2_isIPv6Loop as isIPv6Loop, index$2_isLinux as isLinux, index$2_isLocalRequest as isLocalRequest, index$2_isLoopback as isLoopback, index$2_isMac as isMac, index$2_isRoot as isRoot, index$2_isWin as isWin, index$2_killApp as killApp, index$2_lock as lock, index$2_lockMethod as lockMethod, index$2_lockProp as lockProp, index$2_restart as restart, index$2_restartDirect as restartDirect, index$2_satisfies as satisfies, index$2_stringifyError as stringifyError, index$2_updateAllGitPlugin as updateAllGitPlugin, index$2_updateAllPkg as updateAllPkg, index$2_updateGitPlugin as updateGitPlugin, index$2_updatePkg as updatePkg, uptime$1 as uptime, index$2_waitPort as waitPort };
|
|
9120
9232
|
}
|
|
9121
9233
|
|
|
9122
9234
|
/**
|
|
@@ -17668,4 +17780,4 @@ type Client = RedisClientType & {
|
|
|
17668
17780
|
*/
|
|
17669
17781
|
declare const start: () => Promise<void>;
|
|
17670
17782
|
|
|
17671
|
-
export { type Accept, type AccordionItemProps, type AccordionKV, type AccordionProProps, type AccordionProResult, type AccordionProps, type AccordionResult, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, AdapterConvertKarin, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AddDependenciesParams, type AddTaskResult, type AfterForwardMessageCallback, type AfterMessageCallback, type AllPluginMethods, type Apps, type ArrayField, type AtElement, type Author, BASE_ROUTER, BATCH_UPDATE_PLUGINS_ROUTER, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BaseForwardCallback, type BaseMessageCallback, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, CHECK_PLUGIN_ROUTER, CLOSE_TERMINAL_ROUTER, CONSOLE_ROUTER, CREATE_TERMINAL_ROUTER, type Cache, type CacheEntry, type CheckboxField, type CheckboxGroupProps, type CheckboxProps, type CheckboxResult, type Children, type CmdFnc, type Command, type CommandClass, type ComponentConfig, type ComponentProps, type ComponentType, type Components, type ComponentsClass, type Config, type Contact, type ContactElement, type Count, type CreateGroupFolderResponse, type CreatePty, type CreateTask, type CreateTaskParams, type CreateTaskResult, type CronProps, type CustomMusicElement, type CustomNodeElement, type DbStreamStatus, type DbStreams, type DefineConfig, type DependenciesManage, type DependenciesManageBase, type Dependency, type DiceElement, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectSender, type DividerField, type DividerProps, type DownloadFileErrorResult, type DownloadFileOptions, type DownloadFileResponse, type DownloadFileResult, type DownloadFileSuccessResult, type DownloadFilesOptions, EVENT_COUNT, EXIT_ROUTER, type ElementTypes, type Elements, type Env, type Event, type EventCallCallback, type EventCallHookItem, type EventParent, type EventToSubEvent, type ExecOptions$1 as ExecOptions, type ExecReturn, type ExecType, type ExtendedAxiosRequestConfig, FILE_CHANGE, type FaceElement, type FieldType, type FileElement, type FileList, type FileListMap, type FileToUrlHandler, type FileToUrlResult, type FormField, type ForwardMessageCallback, type ForwardOptions, type FriendContact, type FriendData, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendRequestOptions, type FriendSender, type FrontendInstalledPluginListResponse, GET_BOTS_ROUTER, GET_CONFIG_ROUTER, GET_DEPENDENCIES_LIST_ROUTER, GET_LOADED_COMMAND_PLUGIN_CACHE_LIST_ROUTER, GET_LOCAL_PLUGIN_FRONTEND_LIST_ROUTER, GET_LOCAL_PLUGIN_LIST_ROUTER, GET_LOG_FILE_LIST_ROUTER, GET_LOG_FILE_ROUTER, GET_LOG_ROUTER, GET_NETWORK_STATUS_ROUTER, GET_NPMRC_LIST_ROUTER, GET_NPM_BASE_CONFIG_ROUTER, GET_NPM_CONFIG_ROUTER, GET_ONLINE_PLUGIN_LIST_ROUTER, GET_PLUGIN_APPS_ROUTER, GET_PLUGIN_CONFIG_ROUTER, GET_PLUGIN_FILE_ROUTER, GET_PLUGIN_LIST_PLUGIN_ADMIN_ROUTER, GET_PLUGIN_LIST_ROUTER, GET_PLUGIN_MARKET_LIST_ROUTER, GET_TASK_LIST_ROUTER, GET_TASK_STATUS_ROUTER, GET_TERMINAL_LIST_ROUTER, GET_UPDATABLE_PLUGINS_ROUTER, GET_WEBUI_PLUGIN_LIST_ROUTER, GET_WEBUI_PLUGIN_VERSIONS_ROUTER, type GeneralHookCallback, type GeneralHookItem, type GetAiCharactersResponse, type GetAtAllCountResponse, type GetBot, type GetCommitHashOptions, type GetConfigRequest, type GetConfigResponse, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupMuteListResponse, type GetPluginLocalOptions, type GetPluginLocalReturn, type GetPluginReturn, type GetPluginType, type GetRkeyResponse, type GiftElement, type GitLocalBranches, type GitPullOptions, type GitPullResult, type GitRemoteBranches, type GithubConfig, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, type GroupData, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, type GroupMemberData, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GroupsObjectValue, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, HTTPStatusCode, type Handler, type HandlerType, type HookCache, type HookCallback, type HookEmitForward, type HookEmitMessage, type HookNext, type HookOptions, type HooksType, INSTALL_PLUGIN_ROUTER, INSTALL_WEBUI_PLUGIN_ROUTER, IS_PLUGIN_CONFIG_EXIST_ROUTER, type Icon, type ImageElement, type ImportModuleResult, type InputGroupProps, type InputProps, type InputResult, type JsonElement, type JwtVerifyBase, type JwtVerifyError, type JwtVerifyExpired, type JwtVerifyResult, type JwtVerifySuccess, type JwtVerifyUnauthorized, type KarinButton, KarinConvertAdapter, type KarinPluginAppsType, type KeyboardElement, LOGIN_ROUTER, type LoadPluginResult, type LoadedPluginCacheList, type LocalApiResponse, type LocationElement, type Log, LogMethodNames, Logger, LoggerLevel, type LongMsgElement, MANAGE_DEPENDENCIES_ROUTER, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message, MessageBase$1 as MessageBase, type MessageEventMap, type MessageEventSub, type MessageHookItem, type MessageOptions, type MessageResponse, type MusicElement, type MusicPlatform, type NetworkStatus, type NodeElement, type NormalMessageCallback, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type NpmBaseConfigResponse, type NpmRegistryResponse, type NpmrcFileResponse, type NumberField, type ObjectArrayField, type ObjectField, createMessage as OneBotCreateMessage, createNotice as OneBotCreateNotice, createRequest as OneBotCreateRequest, type Option, type Options, PING_ROUTER, PLUGIN_ADMIN_ROUTER, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PingRequestResult, type PkgData, type PkgEnv, type PkgInfo, Plugin$1 as Plugin, type PluginAdminCustomInstall, type PluginAdminCustomInstallApp, type PluginAdminInstall, type PluginAdminListResponse, type PluginAdminMarketInstall, type PluginAdminMarketInstallApp, type PluginAdminParams, type PluginAdminResult, type PluginAdminUninstall, type PluginAdminUpdate, type PluginFile, type PluginFncTypes, type PluginLists, type PluginMarketAuthor, type PluginMarketLocalBase, type PluginMarketLocalOptions, type PluginMarketOptions, type PluginMarketRequest, type PluginMarketResponse, type PluginOptions, type PluginRule, type PluginUpdateInfo, type PnpmDependencies, type PnpmDependency, type Point, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PrivatesObjectValue, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, RECV_MSG, REFRESH_ROUTER, RESTART_ROUTER, type RaceResult, type Radio, type RadioField, type RadioGroupProps, type RadioResult, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type Redis, type RemoveDependenciesParams, type Render, type RenderResult, Renderer, type Renders$1 as Renders, type Reply, type ReplyElement, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, SAVE_CONFIG_ROUTER, SAVE_NPMRC_ROUTER, SAVE_PLUGIN_CONFIG_ROUTER, SEND_MSG, SET_LOG_LEVEL_ROUTER, SYSTEM_INFO_ROUTER, SYSTEM_STATUS_KARIN_ROUTER, SYSTEM_STATUS_ROUTER, SYSTEM_STATUS_WS_ROUTER, type SandBoxAccountInfo, type SandboxMsgRecord, type SandboxSendApi, type SandboxSendSendFriendMsg, type SandboxSendSendGroupMsg, type SandboxSendSendMsg, type SaveConfigResponse, type SaveResult, type Scene, type ScreenshotClip, type ScreenshotOptions, type SectionField, type SelectField, type SelectItem, type SelectProps, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgHookItem, type SendMsgResults, type Sender, type SenderBase, type SenderGroup$1 as SenderGroup, type Sex$1 as Sex, type ShareElement, type Snapka, type SnapkaResult, type SrcReply, type StandardResult, type SwitchField, type SwitchProps, type SwitchResult, TASK_DELETE_ROUTER, TASK_LIST_ROUTER, TASK_LOGS_ROUTER, TASK_RUN_ROUTER, type Task, type TaskCallbacks, type TaskEntity, type TaskExecutor, type TaskFilter, type TaskStatus, type TaskType, type TerminalInstance, type TerminalShell, type TestNetworkRequestDetail, type TextElement, type TextField, type TitleField, UNINSTALL_PLUGIN_ROUTER, UNINSTALL_WEBUI_PLUGIN_ROUTER, UPDATE_CORE_ROUTER, UPDATE_PLUGIN_ROUTER, UPDATE_TASK_STATUS_ROUTER, UPDATE_WEBUI_PLUGIN_VERSION_ROUTER, type UnionMessage, type UnregisterBot, type UpgradeDependenciesParams, type UserInfo, type ValidationRule, type ValueType, type VideoElement, WS_CLOSE, WS_CLOSE_ONEBOT, WS_CLOSE_PUPPETEER, WS_CLOSE_SANDBOX, WS_CONNECTION, WS_CONNECTION_ONEBOT, WS_CONNECTION_PUPPETEER, WS_CONNECTION_SANDBOX, WS_CONNECTION_TERMINAL, WS_SNAPKA, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type YamlComment, YamlEditor, type YamlValue, absPath, accordion, accordionItem, accordionPro, app, applyComments, authMiddleware, base64, buffer, buildError, buildGithub, buttonHandle, cacheMap, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, checkPort, clearRequire, clearRequireFile, comment, index$1 as common, components, index as config, contact$1 as contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, convertOneBotMessageToKarin, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createAccessTokenExpiredResponse, createBadRequestResponse, createDirectMessage, createForbiddenResponse, createFriendDecreaseNotice, createFriendIncreaseNotice, createFriendMessage, createGroupAdminChangedNotice, createGroupApplyRequest, createGroupCardChangedNotice, createGroupFileUploadedNotice, createGroupHlightsChangedNotice, createGroupHonorChangedNotice, createGroupInviteRequest, createGroupLuckKingNotice, createGroupMemberAddNotice, createGroupMemberBanNotice, createGroupMemberDelNotice, createGroupMemberTitleUpdatedNotice, createGroupMessage, createGroupMessageReactionNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupSignInNotice, createGroupTempMessage, createGroupWholeBanNotice, createGuildMessage, createINIParser, createMethodNotAllowedResponse, createNotFoundResponse, createOneBotClient, createOneBotHttp, createOneBotWsServer, createPayloadTooLargeResponse, createPluginDir, createPrivateApplyRequest, createPrivateFileUploadedNotice, createPrivatePokeNotice, createPrivateRecallNotice, createRawMessage, createReceiveLikeNotice, createRefreshTokenExpiredResponse, createResponse, createServerErrorResponse, createSuccessResponse, createTaskDatabase, createUnauthorizedResponse, cron, db, debug, karin as default, defineConfig, disconnectAllOneBotServer, divider, downFile, downloadFile, errorToString, exec, executeTask, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToBase64, fileToUrl, fileToUrlHandlerKey, filesByExt, formatLogString, formatPath, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getAllFiles, getAllFilesSync, getBot, getBotCount, getCommit, getDefaultBranch, getFastGithub, getFastRegistry, getFileMessage, getFiles, getHash, getLocalBranches, getLocalCommitHash, getMimeType, getPackageJson, getPid, getPkgVersion, getPluginInfo, getPlugins, getRelPath, getRemoteBranches, getRemoteCommitHash, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTaskCallback, getTaskDatabase, getTime, gitPull, handler$1 as handler, hooks, importModule, imports, ini, initOneBotAdapter, initTaskSystem, input, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPathEqual, isPlugin, isPublic, isRoot, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, killApp, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, parseGithubUrl, pingRequest, pkgRoot, qqbotToKarin, raceRequest, randomStr, range, read, readFile, readJson, readJsonSync, redis, registerBot, registerRender, removeTaskCallback, render, renderHtml, renderMultiHtml, renderTpl, requireFile, requireFileSync, restart, restartDirect, rmSync, router, satisfies, save, type screenshot, segment, select, sendMsg$1 as sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, setTaskCallback, setTaskDatabase, splitPath, start, stream, stringifyError, switchComponent, index$2 as system, taskAdd, taskExists, taskGet, taskList, taskSystem, taskUpdateLogs, taskUpdateStatus, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, updateTaskLogs, updateTaskStatus, uptime$1 as uptime, urlToPath, waitPort, watch, watchAndMerge, write, writeJson, writeJsonSync, yaml };
|
|
17783
|
+
export { type Accept, type AccordionItemProps, type AccordionKV, type AccordionProProps, type AccordionProResult, type AccordionProps, type AccordionResult, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, AdapterConvertKarin, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AddDependenciesParams, type AddTaskResult, type AfterForwardMessageCallback, type AfterMessageCallback, type AllPluginMethods, type Apps, type ArrayField, type AtElement, type Author, BASE_ROUTER, BATCH_UPDATE_PLUGINS_ROUTER, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BaseForwardCallback, type BaseMessageCallback, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, CHECK_PLUGIN_ROUTER, CLOSE_TERMINAL_ROUTER, CONSOLE_ROUTER, CREATE_TERMINAL_ROUTER, type Cache, type CacheEntry, type CheckboxField, type CheckboxGroupProps, type CheckboxProps, type CheckboxResult, type Children, type CmdFnc, type Command, type CommandClass, type CompareMode, type ComponentConfig, type ComponentProps, type ComponentType, type Components, type ComponentsClass, type Config, type Contact, type ContactElement, type Count, type CreateGroupFolderResponse, type CreatePty, type CreateTask, type CreateTaskParams, type CreateTaskResult, type CronProps, type CustomMusicElement, type CustomNodeElement, type DbStreamStatus, type DbStreams, type DefineConfig, type DependenciesManage, type DependenciesManageBase, type Dependency, type DiceElement, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectSender, type DividerField, type DividerProps, type DownloadFileErrorResult, type DownloadFileOptions, type DownloadFileResponse, type DownloadFileResult, type DownloadFileSuccessResult, type DownloadFilesOptions, EVENT_COUNT, EXIT_ROUTER, type ElementTypes, type Elements, type Env, type Event, type EventCallCallback, type EventCallHookItem, type EventParent, type EventToSubEvent, type ExecOptions$1 as ExecOptions, type ExecReturn, type ExecType, type ExtendedAxiosRequestConfig, FILE_CHANGE, type FaceElement, type FieldType, type FileElement, type FileList, type FileListMap, type FileToUrlHandler, type FileToUrlResult, type FormField, type ForwardMessageCallback, type ForwardOptions, type FriendContact, type FriendData, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendRequestOptions, type FriendSender, type FrontendInstalledPluginListResponse, GET_BOTS_ROUTER, GET_CONFIG_ROUTER, GET_DEPENDENCIES_LIST_ROUTER, GET_LOADED_COMMAND_PLUGIN_CACHE_LIST_ROUTER, GET_LOCAL_PLUGIN_FRONTEND_LIST_ROUTER, GET_LOCAL_PLUGIN_LIST_ROUTER, GET_LOG_FILE_LIST_ROUTER, GET_LOG_FILE_ROUTER, GET_LOG_ROUTER, GET_NETWORK_STATUS_ROUTER, GET_NPMRC_LIST_ROUTER, GET_NPM_BASE_CONFIG_ROUTER, GET_NPM_CONFIG_ROUTER, GET_ONLINE_PLUGIN_LIST_ROUTER, GET_PLUGIN_APPS_ROUTER, GET_PLUGIN_CONFIG_ROUTER, GET_PLUGIN_FILE_ROUTER, GET_PLUGIN_LIST_PLUGIN_ADMIN_ROUTER, GET_PLUGIN_LIST_ROUTER, GET_PLUGIN_MARKET_LIST_ROUTER, GET_TASK_LIST_ROUTER, GET_TASK_STATUS_ROUTER, GET_TERMINAL_LIST_ROUTER, GET_UPDATABLE_PLUGINS_ROUTER, GET_WEBUI_PLUGIN_LIST_ROUTER, GET_WEBUI_PLUGIN_VERSIONS_ROUTER, type GeneralHookCallback, type GeneralHookItem, type GetAiCharactersResponse, type GetAtAllCountResponse, type GetBot, type GetCommitHashOptions, type GetConfigRequest, type GetConfigResponse, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupMuteListResponse, type GetPluginLocalOptions, type GetPluginLocalReturn, type GetPluginReturn, type GetPluginType, type GetRkeyResponse, type GiftElement, type GitLocalBranches, type GitPullOptions, type GitPullResult, type GitRemoteBranches, type GithubConfig, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, type GroupData, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, type GroupMemberData, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GroupsObjectValue, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, HTTPStatusCode, type Handler, type HandlerType, type HookCache, type HookCallback, type HookEmitForward, type HookEmitMessage, type HookNext, type HookOptions, type HooksType, INSTALL_PLUGIN_ROUTER, INSTALL_WEBUI_PLUGIN_ROUTER, IS_PLUGIN_CONFIG_EXIST_ROUTER, type Icon, type ImageElement, type ImportModuleResult, type InputGroupProps, type InputProps, type InputResult, type JsonElement, type JwtVerifyBase, type JwtVerifyError, type JwtVerifyExpired, type JwtVerifyResult, type JwtVerifySuccess, type JwtVerifyUnauthorized, type KarinButton, KarinConvertAdapter, type KarinPluginAppsType, type KeyboardElement, LOGIN_ROUTER, type LoadPluginResult, type LoadedPluginCacheList, type LocalApiResponse, type LocationElement, type Log, LogMethodNames, Logger, LoggerLevel, type LongMsgElement, MANAGE_DEPENDENCIES_ROUTER, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message, MessageBase$1 as MessageBase, type MessageEventMap, type MessageEventSub, type MessageHookItem, type MessageOptions, type MessageResponse, type MusicElement, type MusicPlatform, type NetworkStatus, type NodeElement, type NormalMessageCallback, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type NpmBaseConfigResponse, type NpmRegistryResponse, type NpmrcFileResponse, type NumberField, type ObjectArrayField, type ObjectField, createMessage as OneBotCreateMessage, createNotice as OneBotCreateNotice, createRequest as OneBotCreateRequest, type Option, type Options, PING_ROUTER, PLUGIN_ADMIN_ROUTER, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PingRequestResult, type PkgData, type PkgEnv, type PkgInfo, Plugin$1 as Plugin, type PluginAdminCustomInstall, type PluginAdminCustomInstallApp, type PluginAdminInstall, type PluginAdminListResponse, type PluginAdminMarketInstall, type PluginAdminMarketInstallApp, type PluginAdminParams, type PluginAdminResult, type PluginAdminUninstall, type PluginAdminUpdate, type PluginFile, type PluginFncTypes, type PluginLists, type PluginMarketAuthor, type PluginMarketLocalBase, type PluginMarketLocalOptions, type PluginMarketOptions, type PluginMarketRequest, type PluginMarketResponse, type PluginOptions, type PluginRule, type PluginUpdateInfo, type PnpmDependencies, type PnpmDependency, type Point, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PrivatesObjectValue, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, RECV_MSG, REFRESH_ROUTER, RESTART_ROUTER, type RaceResult, type Radio, type RadioField, type RadioGroupProps, type RadioResult, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type Redis, type RemoveDependenciesParams, type Render, type RenderResult, Renderer, type Renders$1 as Renders, type Reply, type ReplyElement, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, SAVE_CONFIG_ROUTER, SAVE_NPMRC_ROUTER, SAVE_PLUGIN_CONFIG_ROUTER, SEND_MSG, SET_LOG_LEVEL_ROUTER, SYSTEM_INFO_ROUTER, SYSTEM_STATUS_KARIN_ROUTER, SYSTEM_STATUS_ROUTER, SYSTEM_STATUS_WS_ROUTER, type SandBoxAccountInfo, type SandboxMsgRecord, type SandboxSendApi, type SandboxSendSendFriendMsg, type SandboxSendSendGroupMsg, type SandboxSendSendMsg, type SaveConfigResponse, type SaveResult, type Scene, type ScreenshotClip, type ScreenshotOptions, type SectionField, type SelectField, type SelectItem, type SelectProps, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgHookItem, type SendMsgResults, type Sender, type SenderBase, type SenderGroup$1 as SenderGroup, type Sex$1 as Sex, type ShareElement, type Snapka, type SnapkaResult, type SrcReply, type StandardResult, type SwitchField, type SwitchProps, type SwitchResult, TASK_DELETE_ROUTER, TASK_LIST_ROUTER, TASK_LOGS_ROUTER, TASK_RUN_ROUTER, type Task, type TaskCallbacks, type TaskEntity, type TaskExecutor, type TaskFilter, type TaskStatus, type TaskType, type TerminalInstance, type TerminalShell, type TestNetworkRequestDetail, type TextElement, type TextField, type TitleField, UNINSTALL_PLUGIN_ROUTER, UNINSTALL_WEBUI_PLUGIN_ROUTER, UPDATE_CORE_ROUTER, UPDATE_PLUGIN_ROUTER, UPDATE_TASK_STATUS_ROUTER, UPDATE_WEBUI_PLUGIN_VERSION_ROUTER, type UnionMessage, type UnregisterBot, type UpgradeDependenciesParams, type UserInfo, type ValidationRule, type ValueType, type VideoElement, WS_CLOSE, WS_CLOSE_ONEBOT, WS_CLOSE_PUPPETEER, WS_CLOSE_SANDBOX, WS_CONNECTION, WS_CONNECTION_ONEBOT, WS_CONNECTION_PUPPETEER, WS_CONNECTION_SANDBOX, WS_CONNECTION_TERMINAL, WS_SNAPKA, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type YamlComment, YamlEditor, type YamlValue, absPath, accordion, accordionItem, accordionPro, app, applyComments, authMiddleware, base64, buffer, buildError, buildGithub, buttonHandle, cacheMap, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, checkPort, clearRequire, clearRequireFile, comment, index$1 as common, components, index as config, contact$1 as contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, convertOneBotMessageToKarin, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createAccessTokenExpiredResponse, createBadRequestResponse, createDirectMessage, createForbiddenResponse, createFriendDecreaseNotice, createFriendIncreaseNotice, createFriendMessage, createGroupAdminChangedNotice, createGroupApplyRequest, createGroupCardChangedNotice, createGroupFileUploadedNotice, createGroupHlightsChangedNotice, createGroupHonorChangedNotice, createGroupInviteRequest, createGroupLuckKingNotice, createGroupMemberAddNotice, createGroupMemberBanNotice, createGroupMemberDelNotice, createGroupMemberTitleUpdatedNotice, createGroupMessage, createGroupMessageReactionNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupSignInNotice, createGroupTempMessage, createGroupWholeBanNotice, createGuildMessage, createINIParser, createMethodNotAllowedResponse, createNotFoundResponse, createOneBotClient, createOneBotHttp, createOneBotWsServer, createPayloadTooLargeResponse, createPluginDir, createPrivateApplyRequest, createPrivateFileUploadedNotice, createPrivatePokeNotice, createPrivateRecallNotice, createRawMessage, createReceiveLikeNotice, createRefreshTokenExpiredResponse, createResponse, createServerErrorResponse, createSuccessResponse, createTaskDatabase, createUnauthorizedResponse, cron, db, debug, karin as default, defineConfig, disconnectAllOneBotServer, divider, downFile, downloadFile, errorToString, exec, executeTask, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToBase64, fileToUrl, fileToUrlHandlerKey, filesByExt, formatLogString, formatPath, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getAllFiles, getAllFilesSync, getBot, getBotCount, getCommit, getDefaultBranch, getFastGithub, getFastRegistry, getFileMessage, getFiles, getHash, getLocalBranches, getLocalCommitHash, getMimeType, getPackageJson, getPid, getPkgVersion, getPluginInfo, getPlugins, getRelPath, getRemoteBranches, getRemoteCommitHash, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTaskCallback, getTaskDatabase, getTime, gitPull, handler$1 as handler, hooks, importModule, imports, ini, initOneBotAdapter, initTaskSystem, input, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPathEqual, isPlugin, isPublic, isRoot, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, killApp, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, parseGithubUrl, pingRequest, pkgRoot, qqbotToKarin, raceRequest, randomStr, range, read, readFile, readJson, readJsonSync, redis, registerBot, registerRender, removeTaskCallback, render, renderHtml, renderMultiHtml, renderTpl, requireFile, requireFileSync, restart, restartDirect, rmSync, router, satisfies, save, type screenshot, segment, select, sendMsg$1 as sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, setTaskCallback, setTaskDatabase, splitPath, start, stream, stringifyError, switchComponent, index$2 as system, taskAdd, taskExists, taskGet, taskList, taskSystem, taskUpdateLogs, taskUpdateStatus, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, updateTaskLogs, updateTaskStatus, uptime$1 as uptime, urlToPath, waitPort, watch, watchAndMerge, write, writeJson, writeJsonSync, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -1960,7 +1960,49 @@ __export(changelog_exports, {
|
|
|
1960
1960
|
parseChangelog: () => parseChangelog,
|
|
1961
1961
|
range: () => range
|
|
1962
1962
|
});
|
|
1963
|
-
|
|
1963
|
+
function logs(arg1, arg2, lengthParam = 1, reverseParam = false, optsParam) {
|
|
1964
|
+
if (typeof lengthParam !== "number") {
|
|
1965
|
+
throw new TypeError("\u63D0\u53D6\u957F\u5EA6\u5FC5\u987B\u4E3A\u6570\u5B57");
|
|
1966
|
+
}
|
|
1967
|
+
const isObj = typeof arg1 === "object";
|
|
1968
|
+
const version2 = isObj ? arg1.version : arg1;
|
|
1969
|
+
const data = isObj ? arg1.data : arg2;
|
|
1970
|
+
const length = isObj ? arg1.length ?? 1 : lengthParam ?? 1;
|
|
1971
|
+
const reverse = isObj ? arg1.reverse ?? false : reverseParam ?? false;
|
|
1972
|
+
const compareMode = isObj ? arg1.compare ?? "xyz" : optsParam?.compare ?? "xyz";
|
|
1973
|
+
const list2 = parseChangelog(data);
|
|
1974
|
+
const keys = Object.keys(list2);
|
|
1975
|
+
const startKey = findFallbackVersionKey(keys, version2, { compare: compareMode });
|
|
1976
|
+
if (!startKey) return "";
|
|
1977
|
+
const index5 = keys.indexOf(startKey);
|
|
1978
|
+
const start3 = reverse ? index5 - length : index5;
|
|
1979
|
+
const end = reverse ? index5 : index5 + length;
|
|
1980
|
+
const sliceStart = Math.max(0, start3);
|
|
1981
|
+
const sliceEnd = Math.min(keys.length, end);
|
|
1982
|
+
const versions = keys.slice(sliceStart, sliceEnd).map((key) => list2[key] ? list2[key] : "");
|
|
1983
|
+
return versions.join("");
|
|
1984
|
+
}
|
|
1985
|
+
function range(arg1, startVersionArg, endVersionArg, optsParam) {
|
|
1986
|
+
const isObj = typeof arg1 === "object";
|
|
1987
|
+
const data = isObj ? arg1.data : arg1;
|
|
1988
|
+
const startVersion = isObj ? arg1.startVersion : startVersionArg;
|
|
1989
|
+
const endVersion = isObj ? arg1.endVersion : endVersionArg;
|
|
1990
|
+
const compareMode = isObj ? arg1.compare ?? "xyz" : optsParam?.compare ?? "xyz";
|
|
1991
|
+
const list2 = parseChangelog(data);
|
|
1992
|
+
const keys = Object.keys(list2);
|
|
1993
|
+
const startKey = findFallbackVersionKey(keys, startVersion, { compare: compareMode });
|
|
1994
|
+
const endKey = findFallbackVersionKey(keys, endVersion, { compare: compareMode });
|
|
1995
|
+
if (!startKey || !endKey) return "";
|
|
1996
|
+
const start3 = keys.indexOf(startKey);
|
|
1997
|
+
const end = keys.indexOf(endKey);
|
|
1998
|
+
if (start3 > end) {
|
|
1999
|
+
const versions2 = keys.slice(end, start3).map((key) => list2[key] ? list2[key] : "");
|
|
2000
|
+
return versions2.join("");
|
|
2001
|
+
}
|
|
2002
|
+
const versions = keys.slice(start3, end).map((key) => list2[key] ? list2[key] : "");
|
|
2003
|
+
return versions.join("");
|
|
2004
|
+
}
|
|
2005
|
+
var escapeRegex, log, parseChangelog, normalizeStableVersion, parseSemverParts, compareSemver, findFallbackVersionKey, parseSemverFull, compareSemverFull, compareByMode;
|
|
1964
2006
|
var init_changelog = __esm({
|
|
1965
2007
|
"src/utils/fs/changelog.ts"() {
|
|
1966
2008
|
escapeRegex = (str) => {
|
|
@@ -1972,37 +2014,6 @@ var init_changelog = __esm({
|
|
|
1972
2014
|
const match = data.match(regex);
|
|
1973
2015
|
return match ? match[0] : null;
|
|
1974
2016
|
};
|
|
1975
|
-
logs = (version2, data, length = 1, reverse = false) => {
|
|
1976
|
-
if (typeof length !== "number") {
|
|
1977
|
-
throw new TypeError("\u63D0\u53D6\u957F\u5EA6\u5FC5\u987B\u4E3A\u6570\u5B57");
|
|
1978
|
-
}
|
|
1979
|
-
const list2 = parseChangelog(data);
|
|
1980
|
-
const keys = Object.keys(list2);
|
|
1981
|
-
const startKey = findFallbackVersionKey(keys, version2);
|
|
1982
|
-
if (!startKey) return "";
|
|
1983
|
-
const index5 = keys.indexOf(startKey);
|
|
1984
|
-
const start3 = reverse ? index5 - length : index5;
|
|
1985
|
-
const end = reverse ? index5 : index5 + length;
|
|
1986
|
-
const sliceStart = Math.max(0, start3);
|
|
1987
|
-
const sliceEnd = Math.min(keys.length, end);
|
|
1988
|
-
const versions = keys.slice(sliceStart, sliceEnd).map((key) => list2[key] ? list2[key] : "");
|
|
1989
|
-
return versions.join("");
|
|
1990
|
-
};
|
|
1991
|
-
range = (data, startVersion, endVersion) => {
|
|
1992
|
-
const list2 = parseChangelog(data);
|
|
1993
|
-
const keys = Object.keys(list2);
|
|
1994
|
-
const startKey = findFallbackVersionKey(keys, startVersion);
|
|
1995
|
-
const endKey = findFallbackVersionKey(keys, endVersion);
|
|
1996
|
-
if (!startKey || !endKey) return "";
|
|
1997
|
-
const start3 = keys.indexOf(startKey);
|
|
1998
|
-
const end = keys.indexOf(endKey);
|
|
1999
|
-
if (start3 > end) {
|
|
2000
|
-
const versions2 = keys.slice(end, start3).map((key) => list2[key] ? list2[key] : "");
|
|
2001
|
-
return versions2.join("");
|
|
2002
|
-
}
|
|
2003
|
-
const versions = keys.slice(start3, end).map((key) => list2[key] ? list2[key] : "");
|
|
2004
|
-
return versions.join("");
|
|
2005
|
-
};
|
|
2006
2017
|
parseChangelog = (data) => {
|
|
2007
2018
|
const regex = /## \[(.*?)\]([\s\S]*?)(?=## \[|$)/g;
|
|
2008
2019
|
const changelog = {};
|
|
@@ -2033,18 +2044,89 @@ var init_changelog = __esm({
|
|
|
2033
2044
|
if (pa[2] !== pb[2]) return pa[2] - pb[2];
|
|
2034
2045
|
return 0;
|
|
2035
2046
|
};
|
|
2036
|
-
findFallbackVersionKey = (keys, input2) => {
|
|
2047
|
+
findFallbackVersionKey = (keys, input2, opts) => {
|
|
2048
|
+
const mode = opts?.compare ?? "xyz";
|
|
2037
2049
|
if (keys.includes(input2)) return input2;
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
|
|
2050
|
+
if (mode === "xyz") {
|
|
2051
|
+
const target = normalizeStableVersion(input2);
|
|
2052
|
+
if (keys.includes(target)) return target;
|
|
2053
|
+
for (const key of keys) {
|
|
2054
|
+
const kval = normalizeStableVersion(key);
|
|
2055
|
+
if (compareByMode(kval, target, "xyz") <= 0) {
|
|
2056
|
+
return key;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
return null;
|
|
2060
|
+
}
|
|
2061
|
+
const parsedInput = parseSemverFull(input2);
|
|
2062
|
+
if (!parsedInput) {
|
|
2063
|
+
const target = normalizeStableVersion(input2);
|
|
2064
|
+
if (keys.includes(target)) return target;
|
|
2065
|
+
for (const key of keys) {
|
|
2066
|
+
const kval = normalizeStableVersion(key);
|
|
2067
|
+
if (compareByMode(kval, target, "xyz") <= 0) {
|
|
2068
|
+
return key;
|
|
2069
|
+
}
|
|
2044
2070
|
}
|
|
2071
|
+
return null;
|
|
2072
|
+
}
|
|
2073
|
+
for (const key of keys) {
|
|
2074
|
+
const parsedKey = parseSemverFull(key);
|
|
2075
|
+
const cmp = parsedKey ? compareSemverFull(key, input2) : compareByMode(key, input2, "xyz");
|
|
2076
|
+
if (cmp <= 0) return key;
|
|
2045
2077
|
}
|
|
2046
2078
|
return null;
|
|
2047
2079
|
};
|
|
2080
|
+
parseSemverFull = (input2) => {
|
|
2081
|
+
const core = input2.split("+")[0];
|
|
2082
|
+
const m = core.match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-.]+))?$/);
|
|
2083
|
+
if (!m) return null;
|
|
2084
|
+
const prerelease = m[4] ? m[4].split(".").map((id) => /^\d+$/.test(id) ? Number(id) : id) : null;
|
|
2085
|
+
return {
|
|
2086
|
+
major: Number(m[1]),
|
|
2087
|
+
minor: Number(m[2]),
|
|
2088
|
+
patch: Number(m[3]),
|
|
2089
|
+
prerelease
|
|
2090
|
+
};
|
|
2091
|
+
};
|
|
2092
|
+
compareSemverFull = (a, b) => {
|
|
2093
|
+
const pa = parseSemverFull(a);
|
|
2094
|
+
const pb = parseSemverFull(b);
|
|
2095
|
+
if (!pa || !pb) return 0;
|
|
2096
|
+
if (pa.major !== pb.major) return pa.major > pb.major ? 1 : -1;
|
|
2097
|
+
if (pa.minor !== pb.minor) return pa.minor > pb.minor ? 1 : -1;
|
|
2098
|
+
if (pa.patch !== pb.patch) return pa.patch > pb.patch ? 1 : -1;
|
|
2099
|
+
const ra = pa.prerelease;
|
|
2100
|
+
const rb = pb.prerelease;
|
|
2101
|
+
if (!ra && !rb) return 0;
|
|
2102
|
+
if (!ra && rb) return 1;
|
|
2103
|
+
if (ra && !rb) return -1;
|
|
2104
|
+
const len = Math.max(ra.length, rb.length);
|
|
2105
|
+
for (let i = 0; i < len; i++) {
|
|
2106
|
+
const ai = ra[i];
|
|
2107
|
+
const bi = rb[i];
|
|
2108
|
+
if (ai === void 0) return -1;
|
|
2109
|
+
if (bi === void 0) return 1;
|
|
2110
|
+
const aNum = typeof ai === "number";
|
|
2111
|
+
const bNum = typeof bi === "number";
|
|
2112
|
+
if (aNum && bNum) {
|
|
2113
|
+
if (ai !== bi) return ai > bi ? 1 : -1;
|
|
2114
|
+
} else if (aNum !== bNum) {
|
|
2115
|
+
return aNum ? -1 : 1;
|
|
2116
|
+
} else {
|
|
2117
|
+
if (ai !== bi) return String(ai) > String(bi) ? 1 : -1;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
return 0;
|
|
2121
|
+
};
|
|
2122
|
+
compareByMode = (a, b, mode) => {
|
|
2123
|
+
if (mode === "xyz") {
|
|
2124
|
+
const an = normalizeStableVersion(a);
|
|
2125
|
+
const bn = normalizeStableVersion(b);
|
|
2126
|
+
return compareSemver(an, bn);
|
|
2127
|
+
}
|
|
2128
|
+
return compareSemverFull(a, b);
|
|
2129
|
+
};
|
|
2048
2130
|
}
|
|
2049
2131
|
});
|
|
2050
2132
|
|
|
@@ -11423,21 +11505,95 @@ var init_import = __esm({
|
|
|
11423
11505
|
};
|
|
11424
11506
|
}
|
|
11425
11507
|
});
|
|
11426
|
-
var getPkg, checkPkgUpdate, getPkgVersion, getRemotePkgVersion, updatePkg, updateAllPkg, checkGitPluginUpdate, getCommit, getHash, getTime, updateGitPlugin, updateAllGitPlugin;
|
|
11508
|
+
var extractSemver, escapeRegex2, normalizeStableVersion2, parseSemver, compareSemver2, getPkg, checkPkgUpdate, getPkgVersion, getRemotePkgVersion, updatePkg, updateAllPkg, checkGitPluginUpdate, getCommit, getHash, getTime, updateGitPlugin, updateAllGitPlugin;
|
|
11427
11509
|
var init_update = __esm({
|
|
11428
11510
|
"src/utils/system/update.ts"() {
|
|
11429
11511
|
init_exec();
|
|
11430
11512
|
init_require();
|
|
11431
11513
|
init_list();
|
|
11514
|
+
extractSemver = (spec) => {
|
|
11515
|
+
const m = spec.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?/);
|
|
11516
|
+
return m ? m[0] : null;
|
|
11517
|
+
};
|
|
11518
|
+
escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11519
|
+
normalizeStableVersion2 = (ver) => {
|
|
11520
|
+
const m = ver.match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
11521
|
+
return m ? m[0] : ver;
|
|
11522
|
+
};
|
|
11523
|
+
parseSemver = (input2) => {
|
|
11524
|
+
const core = input2.split("+")[0];
|
|
11525
|
+
const m = core.match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-.]+))?$/);
|
|
11526
|
+
if (!m) return null;
|
|
11527
|
+
const prerelease = m[4] ? m[4].split(".").map((id) => /^\d+$/.test(id) ? Number(id) : id) : null;
|
|
11528
|
+
return {
|
|
11529
|
+
major: Number(m[1]),
|
|
11530
|
+
minor: Number(m[2]),
|
|
11531
|
+
patch: Number(m[3]),
|
|
11532
|
+
prerelease
|
|
11533
|
+
};
|
|
11534
|
+
};
|
|
11535
|
+
compareSemver2 = (a, b) => {
|
|
11536
|
+
const pa = parseSemver(a);
|
|
11537
|
+
const pb = parseSemver(b);
|
|
11538
|
+
if (!pa || !pb) return 0;
|
|
11539
|
+
if (pa.major !== pb.major) return pa.major > pb.major ? 1 : -1;
|
|
11540
|
+
if (pa.minor !== pb.minor) return pa.minor > pb.minor ? 1 : -1;
|
|
11541
|
+
if (pa.patch !== pb.patch) return pa.patch > pb.patch ? 1 : -1;
|
|
11542
|
+
const ra = pa.prerelease;
|
|
11543
|
+
const rb = pb.prerelease;
|
|
11544
|
+
if (!ra && !rb) return 0;
|
|
11545
|
+
if (!ra && rb) return 1;
|
|
11546
|
+
if (ra && !rb) return -1;
|
|
11547
|
+
const len = Math.max(ra.length, rb.length);
|
|
11548
|
+
for (let i = 0; i < len; i++) {
|
|
11549
|
+
const ai = ra[i];
|
|
11550
|
+
const bi = rb[i];
|
|
11551
|
+
if (ai === void 0) return -1;
|
|
11552
|
+
if (bi === void 0) return 1;
|
|
11553
|
+
const aNum = typeof ai === "number";
|
|
11554
|
+
const bNum = typeof bi === "number";
|
|
11555
|
+
if (aNum && bNum) {
|
|
11556
|
+
if (ai !== bi) return ai > bi ? 1 : -1;
|
|
11557
|
+
} else if (aNum !== bNum) {
|
|
11558
|
+
return aNum ? -1 : 1;
|
|
11559
|
+
} else {
|
|
11560
|
+
if (ai !== bi) return String(ai) > String(bi) ? 1 : -1;
|
|
11561
|
+
}
|
|
11562
|
+
}
|
|
11563
|
+
return 0;
|
|
11564
|
+
};
|
|
11432
11565
|
getPkg = (isForcibly = false) => {
|
|
11433
11566
|
return requireFile("package.json", { force: isForcibly });
|
|
11434
11567
|
};
|
|
11435
|
-
checkPkgUpdate = async (name) => {
|
|
11568
|
+
checkPkgUpdate = async (name, opts) => {
|
|
11436
11569
|
const logger3 = global?.logger || console;
|
|
11437
11570
|
try {
|
|
11438
11571
|
const local = await getPkgVersion(name);
|
|
11439
11572
|
const remote = await getRemotePkgVersion(name);
|
|
11440
|
-
|
|
11573
|
+
const mode = opts?.compare ?? "xyz";
|
|
11574
|
+
let noUpdate = false;
|
|
11575
|
+
if (mode === "xyz") {
|
|
11576
|
+
const l = normalizeStableVersion2(local);
|
|
11577
|
+
const r = normalizeStableVersion2(remote);
|
|
11578
|
+
const lm = parseSemver(l);
|
|
11579
|
+
const rm = parseSemver(r);
|
|
11580
|
+
if (lm && rm) {
|
|
11581
|
+
const cmp = compareSemver2(l, r);
|
|
11582
|
+
noUpdate = cmp >= 0;
|
|
11583
|
+
} else {
|
|
11584
|
+
noUpdate = l === r;
|
|
11585
|
+
}
|
|
11586
|
+
} else {
|
|
11587
|
+
const pl = parseSemver(local);
|
|
11588
|
+
const pr = parseSemver(remote);
|
|
11589
|
+
if (pl && pr) {
|
|
11590
|
+
const cmp = compareSemver2(local, remote);
|
|
11591
|
+
noUpdate = cmp >= 0;
|
|
11592
|
+
} else {
|
|
11593
|
+
noUpdate = local === remote;
|
|
11594
|
+
}
|
|
11595
|
+
}
|
|
11596
|
+
if (noUpdate) return { status: "no", local };
|
|
11441
11597
|
return { status: "yes", local, remote };
|
|
11442
11598
|
} catch (error) {
|
|
11443
11599
|
logger3.error(error);
|
|
@@ -11451,18 +11607,24 @@ var init_update = __esm({
|
|
|
11451
11607
|
if (data.includes("empty") || data.includes("extraneous")) {
|
|
11452
11608
|
throw new Error(`\u83B7\u53D6\u5931\u8D25\uFF0C${name} \u672A\u5B89\u88C5`);
|
|
11453
11609
|
}
|
|
11454
|
-
const
|
|
11455
|
-
const
|
|
11456
|
-
|
|
11610
|
+
const esc = escapeRegex2(name);
|
|
11611
|
+
const reg = new RegExp(`${esc}@([0-9A-Za-z-.+]+)`, "gm");
|
|
11612
|
+
const match = reg.exec(data);
|
|
11613
|
+
if (match?.[1]) {
|
|
11614
|
+
return match[1].trim();
|
|
11615
|
+
}
|
|
11457
11616
|
}
|
|
11458
11617
|
if (error) {
|
|
11459
|
-
|
|
11618
|
+
const stack = error?.stack?.toString() || "";
|
|
11619
|
+
if (stack.includes("empty") || stack.includes("extraneous")) {
|
|
11460
11620
|
throw new Error(`\u83B7\u53D6\u5931\u8D25\uFF0C${name} \u672A\u5B89\u88C5`);
|
|
11461
11621
|
}
|
|
11462
11622
|
throw error;
|
|
11463
11623
|
}
|
|
11464
11624
|
const pkg2 = await getPkg();
|
|
11465
|
-
|
|
11625
|
+
const spec = pkg2?.dependencies?.[name] || pkg2?.devDependencies?.[name] || pkg2?.peerDependencies?.[name];
|
|
11626
|
+
if (!spec) return "";
|
|
11627
|
+
return extractSemver(spec) || spec;
|
|
11466
11628
|
};
|
|
11467
11629
|
getRemotePkgVersion = async (name, tag = "latest") => {
|
|
11468
11630
|
const cmd = tag === "latest" ? `npm show ${name} version` : `npm show ${name} dist-tags.${tag}`;
|