@koishi-ce/plugin-market 1.0.7 → 1.0.9
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/README.md +85 -0
- package/dist/index.js +3 -3
- package/dist/style.css +1 -1
- package/lib/assets/{message.zh-CN-B_nH77kB.yml → message.zh-CN-D1DbsO3I.yml} +4 -0
- package/lib/assets/{schema.zh-CN-CLU01Lrj.yml → schema.zh-CN-Bj0_jaVr.yml} +4 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.mjs +34 -38
- package/package.json +12 -13
- package/src/__tests__/index.test.ts +11 -8
- package/src/browser/index.ts +4 -0
- package/src/browser/market.ts +4 -0
- package/src/index.ts +4 -0
- package/src/node/deps.ts +4 -0
- package/src/node/index.ts +4 -0
- package/src/node/installer.ts +34 -69
- package/src/node/locales/message.de-DE.yml +4 -0
- package/src/node/locales/message.en-US.yml +4 -0
- package/src/node/locales/message.fr-FR.yml +4 -0
- package/src/node/locales/message.ja-JP.yml +4 -0
- package/src/node/locales/message.ru-RU.yml +4 -0
- package/src/node/locales/message.zh-CN.yml +4 -0
- package/src/node/locales/message.zh-TW.yml +4 -0
- package/src/node/locales/schema.de-DE.yml +4 -0
- package/src/node/locales/schema.en-US.yml +4 -0
- package/src/node/locales/schema.fr-FR.yml +4 -0
- package/src/node/locales/schema.ja-JP.yml +4 -0
- package/src/node/locales/schema.ru-RU.yml +4 -0
- package/src/node/locales/schema.zh-CN.yml +4 -0
- package/src/node/locales/schema.zh-TW.yml +4 -0
- package/src/node/market.ts +4 -0
- package/src/node/proc.ts +25 -0
- package/src/shared/index.ts +4 -0
package/src/node/market.ts
CHANGED
package/src/node/proc.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (c) 2019-present Shigma and Koishijs contributors.
|
|
3
|
+
// Copyright (c) 2026-present Koishi-CE contributors.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 安装子进程的创建封装(原依赖 execa)。
|
|
7
|
+
*
|
|
8
|
+
* execa 本质是 node:child_process 的事件流封装,本仓只用到其
|
|
9
|
+
* spawn + exit/error 事件 + stdout/stderr 流读取的子集,直接用
|
|
10
|
+
* node:child_process 等价实现即可,Bun 运行时完全兼容。刻意不用
|
|
11
|
+
* Bun.spawn 的捕获管道:win32 下其读端存在 EOF 竞态(见
|
|
12
|
+
* tooling/release/proc.ts 注释),而单进程安装场景 child_process
|
|
13
|
+
* 无此问题。子进程以 process.execPath 启动——宿主必为 Bun 运行时,
|
|
14
|
+
* 直接复用当前可执行文件,不依赖 PATH 中的 bun。
|
|
15
|
+
*
|
|
16
|
+
* 独立成模块是为了让测试能以 mock.module 按相对路径精确拦截,
|
|
17
|
+
* 不真正拉起安装进程(此前 mock execa 包名,全局替换同样可行,
|
|
18
|
+
* 但本地模块拦截范围更小、不受其它包使用 child_process 的干扰)。
|
|
19
|
+
*/
|
|
20
|
+
import { type ChildProcess, spawn } from "node:child_process";
|
|
21
|
+
|
|
22
|
+
/** 在指定工作目录启动 bun 子进程(args 已含子命令与参数),stdio 三路 pipe。 */
|
|
23
|
+
export function spawnBun(args: string[], cwd: string): ChildProcess {
|
|
24
|
+
return spawn(process.execPath, args, { cwd });
|
|
25
|
+
}
|
package/src/shared/index.ts
CHANGED