@koishi-ce/plugin-config 1.0.7 → 1.0.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@koishi-ce/plugin-config",
3
3
  "description": "Manage your bots and plugins with console",
4
- "version": "1.0.7",
4
+ "version": "1.0.8",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
7
7
  "types": "lib/index.d.ts",
@@ -67,12 +67,15 @@
67
67
  "@koishi-ce/koishi": "^1.0.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@koishi-ce/client": "^1.0.2",
71
- "@koishi-ce/plugin-hmr": "^1.0.4"
70
+ "@koishi-ce/client": "^1.0.3",
71
+ "@koishi-ce/plugin-hmr": "^1.0.5",
72
+ "element-plus": "^2.14.5",
73
+ "vue": "^3.5.12",
74
+ "vue-router": "^5.2.0"
72
75
  },
73
76
  "dependencies": {
74
77
  "@koishi-ce/console": "^1.0.0",
75
- "@koishi-ce/loader": "^1.0.3",
76
- "@koishi-ce/registry": "^1.0.4"
78
+ "@koishi-ce/loader": "^1.0.4",
79
+ "@koishi-ce/registry": "^1.0.5"
77
80
  }
78
81
  }
@@ -12,7 +12,10 @@
12
12
  */
13
13
 
14
14
  import { afterAll, beforeAll, describe, expect, it } from "bun:test";
15
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
15
16
  import type { IncomingMessage } from "node:http";
17
+ import { tmpdir } from "node:os";
18
+ import { join } from "node:path";
16
19
  import { type Client, Console, type Entry } from "@koishi-ce/console";
17
20
  import {
18
21
  App,
@@ -132,6 +135,35 @@ class TestLoader extends Loader {
132
135
  }
133
136
 
134
137
  const loader = new TestLoader();
138
+
139
+ /**
140
+ * Hermetic 应用根:本机包扫描(LocalScanner)与 workspace 路径键解析均以
141
+ * loader.baseDir 为锚,固定到临时 fixture,避免断言依赖真实仓库 node_modules
142
+ * 的链接状态(哪些 workspace 包被链入由包管理器布局决定,换环境即挂)。
143
+ */
144
+ const fixtureRoot = mkdtempSync(join(tmpdir(), "koishi-config-pkg-"));
145
+ mkdirSync(join(fixtureRoot, "node_modules/@koishi-ce/plugin-fixture"), {
146
+ recursive: true,
147
+ });
148
+ writeFileSync(
149
+ join(fixtureRoot, "node_modules/@koishi-ce/plugin-fixture/package.json"),
150
+ JSON.stringify(
151
+ {
152
+ name: "@koishi-ce/plugin-fixture",
153
+ version: "1.0.0",
154
+ peerDependencies: { koishi: "^4.18.0" },
155
+ },
156
+ null,
157
+ "\t",
158
+ ),
159
+ );
160
+ mkdirSync(join(fixtureRoot, "plugins/webui/auth"), { recursive: true });
161
+ writeFileSync(
162
+ join(fixtureRoot, "plugins/webui/auth/package.json"),
163
+ JSON.stringify({ name: "@koishi-ce/plugin-auth", version: "1.0.0" }),
164
+ );
165
+ loader.baseDir = fixtureRoot;
166
+
135
167
  loader.config = {
136
168
  plugins: {
137
169
  $sfolded: true,
@@ -182,6 +214,7 @@ afterAll(async () => {
182
214
  }
183
215
  await tick();
184
216
  await app.stop();
217
+ rmSync(fixtureRoot, { recursive: true, force: true });
185
218
  });
186
219
 
187
220
  describe("@koishi-ce/plugin-config", () => {
@@ -232,8 +265,8 @@ describe("@koishi-ce/plugin-config", () => {
232
265
  const auth = data["@koishi-ce/plugin-auth"];
233
266
  expect(auth?.["paths"]).toEqual(["./plugins/webui/auth"]);
234
267
  expect(auth?.["runtime"]).toBeTruthy();
235
- // 本机 node_modules 扫描出的已装插件包
236
- expect(data["@koishi-ce/plugin-server"]).toBeTruthy();
268
+ // 本机 node_modules 扫描出的已装插件包(fixture 预置,见文件头说明)
269
+ expect(data["@koishi-ce/plugin-fixture"]).toBeTruthy();
237
270
  });
238
271
 
239
272
  it("request-runtime 按路径键 / 短名解析并刷新,解析失败不缓存", async () => {