@koishi-ce/plugin-explorer 1.0.2 → 1.1.0

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.
@@ -0,0 +1,6 @@
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
+ root: Stammverzeichnis des Explorers, standardmäßig der aktuelle Arbeitspfad.
6
+ ignored: Zu ignorierende Dateien oder Verzeichnisse. Unterstützt [Glob Patterns](https://github.com/micromatch/micromatch)-Syntax.
@@ -0,0 +1,6 @@
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
+ root: Root directory of the explorer, defaults to the current working path.
6
+ ignored: Files or directories to ignore. Supports [Glob Patterns](https://github.com/micromatch/micromatch) syntax.
@@ -0,0 +1,6 @@
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
+ root: Répertoire racine de l'explorateur, par défaut le répertoire de travail actuel.
6
+ ignored: Fichiers ou répertoires à ignorer. Prend en charge la syntaxe [Glob Patterns](https://github.com/micromatch/micromatch).
@@ -0,0 +1,6 @@
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
+ root: エクスプローラーのルートディレクトリ。デフォルトは現在の作業パスです。
6
+ ignored: 除外するファイルまたはディレクトリ。[Glob Patterns](https://github.com/micromatch/micromatch) 記法に対応しています。
@@ -0,0 +1,6 @@
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
+ root: Корневой каталог проводника, по умолчанию текущий рабочий путь.
6
+ ignored: Файлы или каталоги, которые следует игнорировать. Поддерживается синтаксис [Glob Patterns](https://github.com/micromatch/micromatch).
@@ -0,0 +1,6 @@
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
+ root: 檔案總管的根目錄,預設為當前工作路徑。
6
+ ignored: 要忽略的檔案或目錄。支援 [Glob Patterns](https://github.com/micromatch/micromatch) 語法。
package/lib/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { DataService } from "@koishi-ce/console";
2
- import { Context, Dict, Schema } from "@koishi-ce/koishi";
2
+ import { Context, Schema } from "@koishi-ce/koishi";
3
3
  import { Tester } from "anymatch";
4
- import { FSWatcher } from "chokidar";
5
4
  //#region src/index.d.ts
6
5
  declare module "@koishi-ce/console" {
7
6
  namespace Console {
@@ -19,7 +18,7 @@ declare module "@koishi-ce/console" {
19
18
  }
20
19
  }
21
20
  /** explorer/read 事件返回给客户端的文件内容:base64 编码 + 探测出的元信息。 */
22
- interface File {
21
+ export interface File {
23
22
  /** 文件内容的 base64 编码(客户端用 Binary.fromBase64 解码) */
24
23
  base64: string;
25
24
  /** 由 file-type 从文件头字节探测出的 MIME 类型,识别为文本时不存在 */
@@ -28,7 +27,7 @@ interface File {
28
27
  encoding?: string;
29
28
  }
30
29
  /** 文件树节点:文件 / 目录 / 符号链接三类,由 traverse() 递归生成。 */
31
- interface Entry {
30
+ export interface Entry {
32
31
  type: "file" | "directory" | "symlink";
33
32
  /** 显示名(不含路径) */
34
33
  name: string;
@@ -57,14 +56,11 @@ interface Entry {
57
56
  declare class Explorer extends DataService<Entry[]> {
58
57
  static Config: Schema<Explorer.Config>;
59
58
  task: Promise<Entry[]>;
60
- /** 已创建的文件监视器集合(键为路径),stop() 时统一关闭 */
61
- watchers: Dict<FSWatcher>;
62
59
  /** 由 ignored 配置编译出的 anymatch 过滤器 */
63
60
  globFilter: Tester;
64
61
  /** 文件树的根目录(ctx.baseDir + 配置的 root 解析出的绝对路径) */
65
62
  root: string;
66
63
  constructor(ctx: Context, config: Explorer.Config);
67
- stop(): void;
68
64
  /**
69
65
  * 递归遍历目录,生成排序后的文件树。
70
66
  * 排序规则:目录排在最前,其余按名称字母序;被 globFilter
@@ -88,4 +84,4 @@ declare namespace Explorer {
88
84
  }
89
85
  }
90
86
  //#endregion
91
- export { Entry, File, Explorer as default };
87
+ export { Explorer as default };
package/lib/index.mjs CHANGED
@@ -5,7 +5,13 @@ import { Schema } from "@koishi-ce/koishi";
5
5
  import * as anymatchModule from "anymatch";
6
6
  import { detect } from "chardet";
7
7
  import { fileTypeFromBuffer } from "file-type";
8
+ import deDE from "./assets/de-DE-II4Ckgph.yml";
9
+ import enUS from "./assets/en-US-J6VOXFdn.yml";
10
+ import frFR from "./assets/fr-FR-9iD4s5Ik.yml";
11
+ import jaJP from "./assets/ja-JP-Bvregs-c.yml";
12
+ import ruRU from "./assets/ru-RU-BzXcpw8Q.yml";
8
13
  import zhCN from "./assets/zh-CN-X-yi2Y2F.yml";
14
+ import zhTW from "./assets/zh-TW-sNsmvdmi.yml";
9
15
  //#region src/index.ts
10
16
  /**
11
17
  * explorer 插件(服务端):网页文件管理器的 node 侧实现。
@@ -31,10 +37,16 @@ var Explorer = class extends DataService {
31
37
  "**/.*",
32
38
  "cache"
33
39
  ])
34
- }).i18n({ "zh-CN": zhCN });
40
+ }).i18n({
41
+ "de-DE": deDE,
42
+ "en-US": enUS,
43
+ "fr-FR": frFR,
44
+ "ja-JP": jaJP,
45
+ "ru-RU": ruRU,
46
+ "zh-CN": zhCN,
47
+ "zh-TW": zhTW
48
+ });
35
49
  task;
36
- /** 已创建的文件监视器集合(键为路径),stop() 时统一关闭 */
37
- watchers = Object.create(null);
38
50
  /** 由 ignored 配置编译出的 anymatch 过滤器 */
39
51
  globFilter;
40
52
  /** 文件树的根目录(ctx.baseDir + 配置的 root 解析出的绝对路径) */
@@ -85,9 +97,6 @@ var Explorer = class extends DataService {
85
97
  this.refresh();
86
98
  }, { authority: 4 });
87
99
  }
88
- stop() {
89
- for (const watcher of Object.values(this.watchers)) watcher.close();
90
- }
91
100
  /**
92
101
  * 递归遍历目录,生成排序后的文件树。
93
102
  * 排序规则:目录排在最前,其余按名称字母序;被 globFilter
package/locales/de-DE.yml CHANGED
@@ -2,6 +2,5 @@
2
2
  # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
3
  # Copyright (c) 2026-present Koishi-CE contributors.
4
4
 
5
- root: 资源管理器的根目录,默认为当前工作路径。
6
- ignored: 要忽略的文件或目录。支持 [Glob Patterns](https://github.com/micromatch/micromatch) 语法。
7
-
5
+ root: Stammverzeichnis des Explorers, standardmäßig der aktuelle Arbeitspfad.
6
+ ignored: Zu ignorierende Dateien oder Verzeichnisse. Unterstützt [Glob Patterns](https://github.com/micromatch/micromatch)-Syntax.
package/locales/en-US.yml CHANGED
@@ -2,6 +2,5 @@
2
2
  # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
3
  # Copyright (c) 2026-present Koishi-CE contributors.
4
4
 
5
- root: 资源管理器的根目录,默认为当前工作路径。
5
+ root: Root directory of the explorer, defaults to the current working path.
6
6
  ignored: Files or directories to ignore. Supports [Glob Patterns](https://github.com/micromatch/micromatch) syntax.
7
-
package/locales/fr-FR.yml CHANGED
@@ -2,6 +2,5 @@
2
2
  # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
3
  # Copyright (c) 2026-present Koishi-CE contributors.
4
4
 
5
- root: 资源管理器的根目录,默认为当前工作路径。
6
- ignored: 要忽略的文件或目录。支持 [Glob Patterns](https://github.com/micromatch/micromatch) 语法。
7
-
5
+ root: Répertoire racine de l'explorateur, par défaut le répertoire de travail actuel.
6
+ ignored: Fichiers ou répertoires à ignorer. Prend en charge la syntaxe [Glob Patterns](https://github.com/micromatch/micromatch).
package/locales/ja-JP.yml CHANGED
@@ -2,6 +2,5 @@
2
2
  # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
3
  # Copyright (c) 2026-present Koishi-CE contributors.
4
4
 
5
- root: 资源管理器的根目录,默认为当前工作路径。
6
- ignored: 要忽略的文件或目录。支持 [Glob Patterns](https://github.com/micromatch/micromatch) 语法。
7
-
5
+ root: エクスプローラーのルートディレクトリ。デフォルトは現在の作業パスです。
6
+ ignored: 除外するファイルまたはディレクトリ。[Glob Patterns](https://github.com/micromatch/micromatch) 記法に対応しています。
package/locales/ru-RU.yml CHANGED
@@ -2,6 +2,5 @@
2
2
  # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
3
  # Copyright (c) 2026-present Koishi-CE contributors.
4
4
 
5
- root: 资源管理器的根目录,默认为当前工作路径。
6
- ignored: 要忽略的文件或目录。支持 [Glob Patterns](https://github.com/micromatch/micromatch) 语法。
7
-
5
+ root: Корневой каталог проводника, по умолчанию текущий рабочий путь.
6
+ ignored: Файлы или каталоги, которые следует игнорировать. Поддерживается синтаксис [Glob Patterns](https://github.com/micromatch/micromatch).
package/locales/zh-TW.yml CHANGED
@@ -2,6 +2,5 @@
2
2
  # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
3
  # Copyright (c) 2026-present Koishi-CE contributors.
4
4
 
5
- root: 資源管理器的根目錄,默認為當前工作路徑。
6
- ignored: 要忽略的文件或目錄。支援 [Glob Patterns](https://github.com/micromatch/micromatch) 語法。
7
-
5
+ root: 檔案總管的根目錄,預設為當前工作路徑。
6
+ ignored: 要忽略的檔案或目錄。支援 [Glob Patterns](https://github.com/micromatch/micromatch) 語法。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@koishi-ce/plugin-explorer",
3
3
  "description": "File explorer and editor for Koishi",
4
- "version": "1.0.2",
4
+ "version": "1.1.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
7
7
  "types": "lib/index.d.ts",
@@ -63,9 +63,9 @@
63
63
  "@koishi-ce/koishi": "^1.0.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@koishi-ce/client": "^1.0.4",
67
- "@koishi-ce/plugin-console": "^1.0.4",
68
- "@koishi-ce/koishi": "^1.0.6",
66
+ "@koishi-ce/client": "^1.1.0",
67
+ "@koishi-ce/plugin-console": "^1.1.0",
68
+ "@koishi-ce/koishi": "^1.0.8",
69
69
  "@vueuse/core": "^14.4.0",
70
70
  "monaco-editor": "~0.56.0",
71
71
  "vue": "^3.5.12",
@@ -75,7 +75,6 @@
75
75
  "@koishi-ce/console": "^1.0.0",
76
76
  "anymatch": "^3.1.3",
77
77
  "chardet": "^2.2.0",
78
- "chokidar": "^5.0.0",
79
78
  "file-type": "^22.0.2"
80
79
  }
81
80
  }
package/src/index.ts CHANGED
@@ -22,11 +22,7 @@ import {
22
22
  } from "node:fs/promises";
23
23
  import { join, relative, resolve } from "node:path";
24
24
  import { DataService } from "@koishi-ce/console";
25
- import {
26
- type Context,
27
- type Dict,
28
- Schema,
29
- } from "@koishi-ce/koishi";
25
+ import { type Context, Schema } from "@koishi-ce/koishi";
30
26
  import type { Tester } from "anymatch";
31
27
  import * as anymatchModule from "anymatch";
32
28
 
@@ -36,9 +32,14 @@ const anymatch =
36
32
  anymatchModule.default as unknown as typeof anymatchModule.default.default;
37
33
 
38
34
  import { detect } from "chardet";
39
- import type { FSWatcher } from "chokidar";
40
35
  import { fileTypeFromBuffer } from "file-type";
36
+ import deDE from "../locales/de-DE.yml";
37
+ import enUS from "../locales/en-US.yml";
38
+ import frFR from "../locales/fr-FR.yml";
39
+ import jaJP from "../locales/ja-JP.yml";
40
+ import ruRU from "../locales/ru-RU.yml";
41
41
  import zhCN from "../locales/zh-CN.yml";
42
+ import zhTW from "../locales/zh-TW.yml";
42
43
 
43
44
  declare module "@koishi-ce/console" {
44
45
  namespace Console {
@@ -114,12 +115,16 @@ class Explorer extends DataService<Entry[]> {
114
115
  .role("table")
115
116
  .default(["**/node_modules", "**/.*", "cache"]),
116
117
  }).i18n({
118
+ "de-DE": deDE,
119
+ "en-US": enUS,
120
+ "fr-FR": frFR,
121
+ "ja-JP": jaJP,
122
+ "ru-RU": ruRU,
117
123
  "zh-CN": zhCN,
124
+ "zh-TW": zhTW,
118
125
  });
119
126
 
120
127
  task!: Promise<Entry[]>;
121
- /** 已创建的文件监视器集合(键为路径),stop() 时统一关闭 */
122
- watchers: Dict<FSWatcher> = Object.create(null);
123
128
  /** 由 ignored 配置编译出的 anymatch 过滤器 */
124
129
  globFilter: Tester;
125
130
  /** 文件树的根目录(ctx.baseDir + 配置的 root 解析出的绝对路径) */
@@ -231,13 +236,6 @@ class Explorer extends DataService<Entry[]> {
231
236
  );
232
237
  }
233
238
 
234
- override stop() {
235
- // 插件停用:关闭所有已创建的文件监视器
236
- for (const watcher of Object.values(this.watchers)) {
237
- watcher.close();
238
- }
239
- }
240
-
241
239
  /**
242
240
  * 递归遍历目录,生成排序后的文件树。
243
241
  * 排序规则:目录排在最前,其余按名称字母序;被 globFilter