@koishi-ce/koishi 1.0.6 → 1.0.7
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/lib/cli/index.mjs +1 -1
- package/lib/worker/index.mjs +20 -0
- package/package.json +2 -2
- package/src/worker/index.ts +22 -0
package/lib/cli/index.mjs
CHANGED
package/lib/worker/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { t as __exportAll } from "../rolldown-runtime-BBjsoOtd.mjs";
|
|
|
2
2
|
import { t as Loader } from "../src-BnUZO8R-.mjs";
|
|
3
3
|
import { Context, Logger, Schema, Time, defineProperty } from "@koishi-ce/core";
|
|
4
4
|
import Loader$1, { resolvePlugin } from "@koishi-ce/loader";
|
|
5
|
+
import pc from "picocolors";
|
|
5
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
7
|
import net from "node:net";
|
|
7
8
|
import { dirname, resolve } from "node:path";
|
|
@@ -210,12 +211,31 @@ async function checkPorts(plugins, baseDir) {
|
|
|
210
211
|
process.exit(1);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
214
|
+
/** 启动字符画(ANSI Shadow 字体的 KOISHI CE) */
|
|
215
|
+
const banner = [
|
|
216
|
+
"██╗ ██╗ ██████╗ ██╗███████╗██╗ ██╗██╗ ██████╗███████╗",
|
|
217
|
+
"██║ ██╔╝██╔═══██╗██║██╔════╝██║ ██║██║ ██╔════╝██╔════╝",
|
|
218
|
+
"█████╔╝ ██║ ██║██║███████╗███████║██║█████╗██║ █████╗",
|
|
219
|
+
"██╔═██╗ ██║ ██║██║╚════██║██╔══██║██║╚════╝██║ ██╔══╝",
|
|
220
|
+
"██║ ██╗╚██████╔╝██║███████║██║ ██║██║ ╚██████╗███████╗",
|
|
221
|
+
"╚═╝ ╚═╝ ╚═════╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝╚══════╝"
|
|
222
|
+
].join("\n");
|
|
223
|
+
/**
|
|
224
|
+
* 输出启动字符画。直走 stdout 而非 Logger 通道(多行消息会被日志器
|
|
225
|
+
* 统一缩进、首行混入时间戳前缀,破坏字符画对齐),因此以 isTTY 收敛:
|
|
226
|
+
* 测试与重定向/CI 等非交互环境自动跳过,不产生输出噪音。
|
|
227
|
+
*/
|
|
228
|
+
function printBanner() {
|
|
229
|
+
if (!process.stdout.isTTY) return;
|
|
230
|
+
console.log(pc.cyan(banner));
|
|
231
|
+
}
|
|
213
232
|
/** 应用启动主流程 */
|
|
214
233
|
async function start() {
|
|
215
234
|
const loader = new Loader$1();
|
|
216
235
|
await loader.init(process.env["KOISHI_CONFIG_FILE"]);
|
|
217
236
|
const config = await loader.readConfig(true);
|
|
218
237
|
prepare(config.logger);
|
|
238
|
+
printBanner();
|
|
219
239
|
await checkPorts(config.plugins ?? {}, loader.baseDir);
|
|
220
240
|
if (config.timezoneOffset !== void 0) Time.setTimezoneOffset(config.timezoneOffset);
|
|
221
241
|
if (config.stackTraceLimit !== void 0) Error.stackTraceLimit = config.stackTraceLimit;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@koishi-ce/koishi",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Cross-Platform Chatbot Framework Made with Love",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.7",
|
|
6
6
|
"main": "lib/index.mjs",
|
|
7
7
|
"module": "lib/index.mjs",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@koishi-ce/core": "^1.0.1",
|
|
65
|
-
"@koishi-ce/loader": "^1.0.
|
|
65
|
+
"@koishi-ce/loader": "^1.0.6",
|
|
66
66
|
"@koishi-ce/plugin-http": "^1.0.0",
|
|
67
67
|
"@koishi-ce/plugin-proxy-agent": "^1.0.0",
|
|
68
68
|
"@koishi-ce/plugin-server": "^1.0.1",
|
package/src/worker/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
Time,
|
|
23
23
|
} from "@koishi-ce/core";
|
|
24
24
|
import Loader, { resolvePlugin } from "@koishi-ce/loader";
|
|
25
|
+
import pc from "picocolors";
|
|
25
26
|
import * as daemon from "./daemon.ts";
|
|
26
27
|
import * as logger from "./logger.ts";
|
|
27
28
|
|
|
@@ -200,12 +201,33 @@ async function checkPorts(plugins: Dict, baseDir: string) {
|
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
|
|
204
|
+
/** 启动字符画(ANSI Shadow 字体的 KOISHI CE) */
|
|
205
|
+
const banner = [
|
|
206
|
+
"██╗ ██╗ ██████╗ ██╗███████╗██╗ ██╗██╗ ██████╗███████╗",
|
|
207
|
+
"██║ ██╔╝██╔═══██╗██║██╔════╝██║ ██║██║ ██╔════╝██╔════╝",
|
|
208
|
+
"█████╔╝ ██║ ██║██║███████╗███████║██║█████╗██║ █████╗",
|
|
209
|
+
"██╔═██╗ ██║ ██║██║╚════██║██╔══██║██║╚════╝██║ ██╔══╝",
|
|
210
|
+
"██║ ██╗╚██████╔╝██║███████║██║ ██║██║ ╚██████╗███████╗",
|
|
211
|
+
"╚═╝ ╚═╝ ╚═════╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝╚══════╝",
|
|
212
|
+
].join("\n");
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* 输出启动字符画。直走 stdout 而非 Logger 通道(多行消息会被日志器
|
|
216
|
+
* 统一缩进、首行混入时间戳前缀,破坏字符画对齐),因此以 isTTY 收敛:
|
|
217
|
+
* 测试与重定向/CI 等非交互环境自动跳过,不产生输出噪音。
|
|
218
|
+
*/
|
|
219
|
+
function printBanner() {
|
|
220
|
+
if (!process.stdout.isTTY) return;
|
|
221
|
+
console.log(pc.cyan(banner));
|
|
222
|
+
}
|
|
223
|
+
|
|
203
224
|
/** 应用启动主流程 */
|
|
204
225
|
async function start() {
|
|
205
226
|
const loader = new Loader();
|
|
206
227
|
await loader.init(process.env["KOISHI_CONFIG_FILE"]);
|
|
207
228
|
const config = await loader.readConfig(true);
|
|
208
229
|
logger.prepare(config.logger);
|
|
230
|
+
printBanner();
|
|
209
231
|
|
|
210
232
|
// 端口预检须在日志配置生效后、应用创建前执行
|
|
211
233
|
await checkPorts(config.plugins ?? {}, loader.baseDir);
|