@webgal/language-service 0.0.2-alpha.4 → 0.0.2-alpha.6

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.
Files changed (35) hide show
  1. package/README.en.md +15 -0
  2. package/README.md +15 -0
  3. package/build/{client-handlers-CrU8stw6.mjs → client-handlers-B6JBICcy.mjs} +36 -1
  4. package/build/{client-handlers-DVUjG46C.cjs → client-handlers-BOZETgwF.cjs} +36 -1
  5. package/build/index-Bbu_H5AG.d.mts +46 -0
  6. package/build/index.cjs +1 -1
  7. package/build/index.d.cts +35 -1
  8. package/build/index.d.mts +14 -2
  9. package/build/index.mjs +1 -1
  10. package/build/monaco/index.cjs +34 -1
  11. package/build/monaco/index.d.cts +34 -1
  12. package/build/monaco/index.d.mts +35 -2
  13. package/build/monaco/index.mjs +34 -1
  14. package/build/node.d.cts +1 -1
  15. package/build/node.d.mts +1 -1
  16. package/build/providerState-Dip2XHx4.cjs +3133 -0
  17. package/build/providerState-_ZvKXErw.mjs +3127 -0
  18. package/build/syntaxes.cjs +1 -1
  19. package/build/syntaxes.mjs +1 -1
  20. package/build/themes.cjs +1 -1
  21. package/build/themes.mjs +1 -1
  22. package/build/types-B7zc-Eke.d.mts +166 -0
  23. package/build/types-DwRo8Zlp.d.cts +166 -0
  24. package/build/utils/index.cjs +4 -0
  25. package/build/utils/index.d.cts +15 -0
  26. package/build/utils/index.d.mts +15 -0
  27. package/build/utils/index.mjs +3 -0
  28. package/package.json +22 -10
  29. package/build/index-75hRTxvB.d.mts +0 -24
  30. package/build/types-BPQnQEAd.d.cts +0 -111
  31. package/build/types-FltMUZDB.d.mts +0 -111
  32. /package/build/{language-configuration-CXgHqltm.mjs → language-configuration-BpugOv-W.mjs} +0 -0
  33. /package/build/{language-configuration-Dogb_mCE.cjs → language-configuration-DsFXNyL0.cjs} +0 -0
  34. /package/build/{white-DKaUkz8d.cjs → white-C5tT5Wl0.cjs} +0 -0
  35. /package/build/{white-DO2qVBHF.mjs → white-kL9BQca_.mjs} +0 -0
package/README.en.md ADDED
@@ -0,0 +1,15 @@
1
+ # @webgal/language-service
2
+
3
+ English | [中文](./README.md)
4
+
5
+ WebGAL language service integration package, providing capabilities such as Monaco initialization, syntax and theme resources, VFS, and client processors.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i @webgal/language-service
11
+ ```
12
+
13
+ ## Repository
14
+
15
+ https://github.com/xiaoxustudio/webgal-language-tools/tree/main/packages/language-service
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @webgal/language-service
2
+
3
+ [English](./README.en.md) | 中文
4
+
5
+ WebGAL 语言服务集成包,提供 Monaco 初始化、语法与主题资源、VFS 与客户端处理器等能力。
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ npm i @webgal/language-service
11
+ ```
12
+
13
+ ## 仓库
14
+
15
+ https://github.com/xiaoxustudio/webgal-language-tools/tree/main/packages/language-service
@@ -1,3 +1,4 @@
1
+ import { t as getState } from "./providerState-_ZvKXErw.mjs";
1
2
  import { FileType } from "@volar/language-service";
2
3
  import { URI } from "vscode-uri";
3
4
 
@@ -32,6 +33,12 @@ const toVfsPath = (value) => value.startsWith("file://") ? uriToPath(value) : va
32
33
 
33
34
  //#endregion
34
35
  //#region src/vfs/adapter.ts
36
+ /**
37
+ * 创建虚拟文件系统适配器
38
+ * 将Volar可写文件系统封装为统一的虚拟文件系统接口
39
+ * @param fs - Volar可写文件系统实例
40
+ * @returns 返回虚拟文件系统实例,提供文件读写、目录操作等功能
41
+ */
35
42
  function createVirtualFileSystem(fs) {
36
43
  const root = fs.root;
37
44
  return {
@@ -115,6 +122,14 @@ function createVirtualFileSystem(fs) {
115
122
  onDidChange: (listener) => fs.onDidChange(listener)
116
123
  };
117
124
  }
125
+ /**
126
+ * 创建Volar文件系统适配器
127
+ * 将虚拟文件系统封装为Volar语言服务所需的FileSystem接口
128
+ * @param vfs - 虚拟文件系统实例
129
+ * @param options - 配置选项
130
+ * @param options.uriToPath - 可选的URI到路径的转换函数,默认使用内置的转换函数
131
+ * @returns 返回符合Volar FileSystem接口的文件系统实例
132
+ */
118
133
  function createVolarFileSystem(vfs, options) {
119
134
  const uriToPathImpl = options?.uriToPath ?? ((uri) => uriToPath(uri));
120
135
  return {
@@ -144,6 +159,14 @@ function createVolarFileSystem(vfs, options) {
144
159
 
145
160
  //#endregion
146
161
  //#region src/vfs/memory.ts
162
+ /**
163
+ * 创建基于内存的Volar可写文件系统
164
+ * 该文件系统将所有文件和目录存储在内存中,不持久化到磁盘
165
+ * @param options - 配置选项
166
+ * @param options.root - 根目录路径,默认为"/"
167
+ * @param options.tree - 可选的初始虚拟文件树结构
168
+ * @returns 返回Volar可写文件系统实例,支持文件读写、目录操作和变更监听
169
+ */
147
170
  function createMemoryVolarFileSystem(options) {
148
171
  const root = normalizePath(toVfsPath(options?.root ?? "/"));
149
172
  let rootEntry = options?.tree && options.tree.type === "dir" ? options.tree : {
@@ -297,6 +320,12 @@ function createMemoryVolarFileSystem(options) {
297
320
 
298
321
  //#endregion
299
322
  //#region src/client-handlers.ts
323
+ /**
324
+ * 创建Webgal客户端处理器
325
+ *
326
+ * @param options - 创建处理器的配置选项
327
+ * @returns 返回一个包含各种客户端处理器方法的对象
328
+ */
300
329
  function createWebgalClientHandlers(options) {
301
330
  const normalizeChange = (change) => {
302
331
  if (change.type === "writeFile") return {
@@ -326,7 +355,7 @@ function createWebgalClientHandlers(options) {
326
355
  "client/FJoin": (args) => options.vfs.join(...Array.isArray(args) ? args : [args]),
327
356
  "client/FStat": (path) => options.vfs.stat(toVfsPath(path)),
328
357
  "client/findFile": ([startPath, targetName]) => options.vfs.findFile(toVfsPath(startPath), targetName),
329
- "client/goPropertyDoc": options.goPropertyDoc ?? (() => null),
358
+ "client/goPropertyDoc": options.goPropertyDoc ?? ((path) => getState(path)),
330
359
  "client/readDirectory": (uriString) => options.vfs.readDirectory(uriToPath(uriString)),
331
360
  "client/getAllTextWithScene": () => options.vfs.getAllTextWithScene(),
332
361
  "client/getResourceDirectory": (urls) => options.vfs.getResourceDirectory(urls),
@@ -341,6 +370,12 @@ function createWebgalClientHandlers(options) {
341
370
  ...options.overrides ?? {}
342
371
  };
343
372
  }
373
+ /**
374
+ * 注册WebGal客户端处理器
375
+ *
376
+ * @param client - 语言客户端实例,实现了LanguageClientLike接口
377
+ * @param handlers - WebGal客户端处理器的可选映射对象,包含要注册的各种处理器方法
378
+ */
344
379
  function registerWebgalClientHandlers(client, handlers) {
345
380
  for (const [method, handler] of Object.entries(handlers)) client.onRequest(method, handler);
346
381
  }
@@ -1,4 +1,5 @@
1
1
  const require_chunk = require('./chunk-C0xms8kb.cjs');
2
+ const require_providerState = require('./providerState-Dip2XHx4.cjs');
2
3
  let _volar_language_service = require("@volar/language-service");
3
4
  let vscode_uri = require("vscode-uri");
4
5
 
@@ -33,6 +34,12 @@ const toVfsPath = (value) => value.startsWith("file://") ? uriToPath(value) : va
33
34
 
34
35
  //#endregion
35
36
  //#region src/vfs/adapter.ts
37
+ /**
38
+ * 创建虚拟文件系统适配器
39
+ * 将Volar可写文件系统封装为统一的虚拟文件系统接口
40
+ * @param fs - Volar可写文件系统实例
41
+ * @returns 返回虚拟文件系统实例,提供文件读写、目录操作等功能
42
+ */
36
43
  function createVirtualFileSystem(fs) {
37
44
  const root = fs.root;
38
45
  return {
@@ -116,6 +123,14 @@ function createVirtualFileSystem(fs) {
116
123
  onDidChange: (listener) => fs.onDidChange(listener)
117
124
  };
118
125
  }
126
+ /**
127
+ * 创建Volar文件系统适配器
128
+ * 将虚拟文件系统封装为Volar语言服务所需的FileSystem接口
129
+ * @param vfs - 虚拟文件系统实例
130
+ * @param options - 配置选项
131
+ * @param options.uriToPath - 可选的URI到路径的转换函数,默认使用内置的转换函数
132
+ * @returns 返回符合Volar FileSystem接口的文件系统实例
133
+ */
119
134
  function createVolarFileSystem(vfs, options) {
120
135
  const uriToPathImpl = options?.uriToPath ?? ((uri) => uriToPath(uri));
121
136
  return {
@@ -145,6 +160,14 @@ function createVolarFileSystem(vfs, options) {
145
160
 
146
161
  //#endregion
147
162
  //#region src/vfs/memory.ts
163
+ /**
164
+ * 创建基于内存的Volar可写文件系统
165
+ * 该文件系统将所有文件和目录存储在内存中,不持久化到磁盘
166
+ * @param options - 配置选项
167
+ * @param options.root - 根目录路径,默认为"/"
168
+ * @param options.tree - 可选的初始虚拟文件树结构
169
+ * @returns 返回Volar可写文件系统实例,支持文件读写、目录操作和变更监听
170
+ */
148
171
  function createMemoryVolarFileSystem(options) {
149
172
  const root = normalizePath(toVfsPath(options?.root ?? "/"));
150
173
  let rootEntry = options?.tree && options.tree.type === "dir" ? options.tree : {
@@ -298,6 +321,12 @@ function createMemoryVolarFileSystem(options) {
298
321
 
299
322
  //#endregion
300
323
  //#region src/client-handlers.ts
324
+ /**
325
+ * 创建Webgal客户端处理器
326
+ *
327
+ * @param options - 创建处理器的配置选项
328
+ * @returns 返回一个包含各种客户端处理器方法的对象
329
+ */
301
330
  function createWebgalClientHandlers(options) {
302
331
  const normalizeChange = (change) => {
303
332
  if (change.type === "writeFile") return {
@@ -327,7 +356,7 @@ function createWebgalClientHandlers(options) {
327
356
  "client/FJoin": (args) => options.vfs.join(...Array.isArray(args) ? args : [args]),
328
357
  "client/FStat": (path) => options.vfs.stat(toVfsPath(path)),
329
358
  "client/findFile": ([startPath, targetName]) => options.vfs.findFile(toVfsPath(startPath), targetName),
330
- "client/goPropertyDoc": options.goPropertyDoc ?? (() => null),
359
+ "client/goPropertyDoc": options.goPropertyDoc ?? ((path) => require_providerState.getState(path)),
331
360
  "client/readDirectory": (uriString) => options.vfs.readDirectory(uriToPath(uriString)),
332
361
  "client/getAllTextWithScene": () => options.vfs.getAllTextWithScene(),
333
362
  "client/getResourceDirectory": (urls) => options.vfs.getResourceDirectory(urls),
@@ -342,6 +371,12 @@ function createWebgalClientHandlers(options) {
342
371
  ...options.overrides ?? {}
343
372
  };
344
373
  }
374
+ /**
375
+ * 注册WebGal客户端处理器
376
+ *
377
+ * @param client - 语言客户端实例,实现了LanguageClientLike接口
378
+ * @param handlers - WebGal客户端处理器的可选映射对象,包含要注册的各种处理器方法
379
+ */
345
380
  function registerWebgalClientHandlers(client, handlers) {
346
381
  for (const [method, handler] of Object.entries(handlers)) client.onRequest(method, handler);
347
382
  }
@@ -0,0 +1,46 @@
1
+ import { c as VirtualFileSystem, d as VolarWritableFileSystem, o as VirtualEntry } from "./types-B7zc-Eke.mjs";
2
+ import { FileSystem } from "@volar/language-service";
3
+ import { URI } from "vscode-uri";
4
+
5
+ //#region src/vfs/adapter.d.ts
6
+ /**
7
+ * 创建虚拟文件系统适配器
8
+ * 将Volar可写文件系统封装为统一的虚拟文件系统接口
9
+ * @param fs - Volar可写文件系统实例
10
+ * @returns 返回虚拟文件系统实例,提供文件读写、目录操作等功能
11
+ */
12
+ declare function createVirtualFileSystem(fs: VolarWritableFileSystem): VirtualFileSystem;
13
+ /**
14
+ * 创建Volar文件系统适配器
15
+ * 将虚拟文件系统封装为Volar语言服务所需的FileSystem接口
16
+ * @param vfs - 虚拟文件系统实例
17
+ * @param options - 配置选项
18
+ * @param options.uriToPath - 可选的URI到路径的转换函数,默认使用内置的转换函数
19
+ * @returns 返回符合Volar FileSystem接口的文件系统实例
20
+ */
21
+ declare function createVolarFileSystem(vfs: VirtualFileSystem, options?: {
22
+ uriToPath?: (uri: URI) => string;
23
+ }): FileSystem;
24
+ //#endregion
25
+ //#region src/vfs/memory.d.ts
26
+ /**
27
+ * 创建基于内存的Volar可写文件系统
28
+ * 该文件系统将所有文件和目录存储在内存中,不持久化到磁盘
29
+ * @param options - 配置选项
30
+ * @param options.root - 根目录路径,默认为"/"
31
+ * @param options.tree - 可选的初始虚拟文件树结构
32
+ * @returns 返回Volar可写文件系统实例,支持文件读写、目录操作和变更监听
33
+ */
34
+ declare function createMemoryVolarFileSystem(options?: {
35
+ root?: string;
36
+ tree?: VirtualEntry;
37
+ }): VolarWritableFileSystem;
38
+ //#endregion
39
+ //#region src/vfs/utils.d.ts
40
+ declare const normalizePath: (input: string) => string;
41
+ declare const joinPaths: (...parts: string[]) => string;
42
+ declare const uriToPath: (value: string | URI) => string;
43
+ declare const pathToUri: (path: string) => URI;
44
+ declare const toVfsPath: (value: string) => string;
45
+ //#endregion
46
+ export { uriToPath as a, createVolarFileSystem as c, toVfsPath as i, normalizePath as n, createMemoryVolarFileSystem as o, pathToUri as r, createVirtualFileSystem as s, joinPaths as t };
package/build/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_client_handlers = require('./client-handlers-DVUjG46C.cjs');
2
+ const require_client_handlers = require('./client-handlers-BOZETgwF.cjs');
3
3
 
4
4
  exports.createMemoryVolarFileSystem = require_client_handlers.createMemoryVolarFileSystem;
5
5
  exports.createVirtualFileSystem = require_client_handlers.createVirtualFileSystem;
package/build/index.d.cts CHANGED
@@ -1,14 +1,36 @@
1
- import { a as VirtualDirectoryEntry, c as VirtualFileSystem, d as VolarWritableFileSystem, f as WebgalClientHandlers, i as MaybePromise, l as VirtualFileSystemChange, n as DirectoryEntry, o as VirtualEntry, r as LanguageClientLike, s as VirtualFileEntry, t as CreateWebgalClientHandlersOptions, u as VirtualFileSystemChangeListener } from "./types-BPQnQEAd.cjs";
1
+ import { a as VirtualDirectoryEntry, c as VirtualFileSystem, d as VolarWritableFileSystem, f as WebgalClientHandlers, i as MaybePromise, l as VirtualFileSystemChange, n as DirectoryEntry, o as VirtualEntry, r as LanguageClientLike, s as VirtualFileEntry, t as CreateWebgalClientHandlersOptions, u as VirtualFileSystemChangeListener } from "./types-DwRo8Zlp.cjs";
2
2
  import { FileSystem } from "@volar/language-service";
3
3
  import { URI } from "vscode-uri";
4
4
 
5
5
  //#region src/vfs/adapter.d.ts
6
+ /**
7
+ * 创建虚拟文件系统适配器
8
+ * 将Volar可写文件系统封装为统一的虚拟文件系统接口
9
+ * @param fs - Volar可写文件系统实例
10
+ * @returns 返回虚拟文件系统实例,提供文件读写、目录操作等功能
11
+ */
6
12
  declare function createVirtualFileSystem(fs: VolarWritableFileSystem): VirtualFileSystem;
13
+ /**
14
+ * 创建Volar文件系统适配器
15
+ * 将虚拟文件系统封装为Volar语言服务所需的FileSystem接口
16
+ * @param vfs - 虚拟文件系统实例
17
+ * @param options - 配置选项
18
+ * @param options.uriToPath - 可选的URI到路径的转换函数,默认使用内置的转换函数
19
+ * @returns 返回符合Volar FileSystem接口的文件系统实例
20
+ */
7
21
  declare function createVolarFileSystem(vfs: VirtualFileSystem, options?: {
8
22
  uriToPath?: (uri: URI) => string;
9
23
  }): FileSystem;
10
24
  //#endregion
11
25
  //#region src/vfs/memory.d.ts
26
+ /**
27
+ * 创建基于内存的Volar可写文件系统
28
+ * 该文件系统将所有文件和目录存储在内存中,不持久化到磁盘
29
+ * @param options - 配置选项
30
+ * @param options.root - 根目录路径,默认为"/"
31
+ * @param options.tree - 可选的初始虚拟文件树结构
32
+ * @returns 返回Volar可写文件系统实例,支持文件读写、目录操作和变更监听
33
+ */
12
34
  declare function createMemoryVolarFileSystem(options?: {
13
35
  root?: string;
14
36
  tree?: VirtualEntry;
@@ -22,7 +44,19 @@ declare const pathToUri: (path: string) => URI;
22
44
  declare const toVfsPath: (value: string) => string;
23
45
  //#endregion
24
46
  //#region src/client-handlers.d.ts
47
+ /**
48
+ * 创建Webgal客户端处理器
49
+ *
50
+ * @param options - 创建处理器的配置选项
51
+ * @returns 返回一个包含各种客户端处理器方法的对象
52
+ */
25
53
  declare function createWebgalClientHandlers(options: CreateWebgalClientHandlersOptions): WebgalClientHandlers;
54
+ /**
55
+ * 注册WebGal客户端处理器
56
+ *
57
+ * @param client - 语言客户端实例,实现了LanguageClientLike接口
58
+ * @param handlers - WebGal客户端处理器的可选映射对象,包含要注册的各种处理器方法
59
+ */
26
60
  declare function registerWebgalClientHandlers(client: LanguageClientLike, handlers: Partial<WebgalClientHandlers>): void;
27
61
  //#endregion
28
62
  export { CreateWebgalClientHandlersOptions, DirectoryEntry, LanguageClientLike, MaybePromise, VirtualDirectoryEntry, VirtualEntry, VirtualFileEntry, VirtualFileSystem, VirtualFileSystemChange, VirtualFileSystemChangeListener, VolarWritableFileSystem, WebgalClientHandlers, createMemoryVolarFileSystem, createVirtualFileSystem, createVolarFileSystem, createWebgalClientHandlers, joinPaths, normalizePath, pathToUri, registerWebgalClientHandlers, toVfsPath, uriToPath };
package/build/index.d.mts CHANGED
@@ -1,8 +1,20 @@
1
- import { a as VirtualDirectoryEntry, c as VirtualFileSystem, d as VolarWritableFileSystem, f as WebgalClientHandlers, i as MaybePromise, l as VirtualFileSystemChange, n as DirectoryEntry, o as VirtualEntry, r as LanguageClientLike, s as VirtualFileEntry, t as CreateWebgalClientHandlersOptions, u as VirtualFileSystemChangeListener } from "./types-FltMUZDB.mjs";
2
- import { a as uriToPath, c as createVolarFileSystem, i as toVfsPath, n as normalizePath, o as createMemoryVolarFileSystem, r as pathToUri, s as createVirtualFileSystem, t as joinPaths } from "./index-75hRTxvB.mjs";
1
+ import { a as VirtualDirectoryEntry, c as VirtualFileSystem, d as VolarWritableFileSystem, f as WebgalClientHandlers, i as MaybePromise, l as VirtualFileSystemChange, n as DirectoryEntry, o as VirtualEntry, r as LanguageClientLike, s as VirtualFileEntry, t as CreateWebgalClientHandlersOptions, u as VirtualFileSystemChangeListener } from "./types-B7zc-Eke.mjs";
2
+ import { a as uriToPath, c as createVolarFileSystem, i as toVfsPath, n as normalizePath, o as createMemoryVolarFileSystem, r as pathToUri, s as createVirtualFileSystem, t as joinPaths } from "./index-Bbu_H5AG.mjs";
3
3
 
4
4
  //#region src/client-handlers.d.ts
5
+ /**
6
+ * 创建Webgal客户端处理器
7
+ *
8
+ * @param options - 创建处理器的配置选项
9
+ * @returns 返回一个包含各种客户端处理器方法的对象
10
+ */
5
11
  declare function createWebgalClientHandlers(options: CreateWebgalClientHandlersOptions): WebgalClientHandlers;
12
+ /**
13
+ * 注册WebGal客户端处理器
14
+ *
15
+ * @param client - 语言客户端实例,实现了LanguageClientLike接口
16
+ * @param handlers - WebGal客户端处理器的可选映射对象,包含要注册的各种处理器方法
17
+ */
6
18
  declare function registerWebgalClientHandlers(client: LanguageClientLike, handlers: Partial<WebgalClientHandlers>): void;
7
19
  //#endregion
8
20
  export { CreateWebgalClientHandlersOptions, DirectoryEntry, LanguageClientLike, MaybePromise, VirtualDirectoryEntry, VirtualEntry, VirtualFileEntry, VirtualFileSystem, VirtualFileSystemChange, VirtualFileSystemChangeListener, VolarWritableFileSystem, WebgalClientHandlers, createMemoryVolarFileSystem, createVirtualFileSystem, createVolarFileSystem, createWebgalClientHandlers, joinPaths, normalizePath, pathToUri, registerWebgalClientHandlers, toVfsPath, uriToPath };
package/build/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as createVolarFileSystem, c as pathToUri, i as createVirtualFileSystem, l as toVfsPath, n as registerWebgalClientHandlers, o as joinPaths, r as createMemoryVolarFileSystem, s as normalizePath, t as createWebgalClientHandlers, u as uriToPath } from "./client-handlers-CrU8stw6.mjs";
1
+ import { a as createVolarFileSystem, c as pathToUri, i as createVirtualFileSystem, l as toVfsPath, n as registerWebgalClientHandlers, o as joinPaths, r as createMemoryVolarFileSystem, s as normalizePath, t as createWebgalClientHandlers, u as uriToPath } from "./client-handlers-B6JBICcy.mjs";
2
2
 
3
3
  export { createMemoryVolarFileSystem, createVirtualFileSystem, createVolarFileSystem, createWebgalClientHandlers, joinPaths, normalizePath, pathToUri, registerWebgalClientHandlers, toVfsPath, uriToPath };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('../chunk-C0xms8kb.cjs');
3
- const require_client_handlers = require('../client-handlers-DVUjG46C.cjs');
3
+ const require_client_handlers = require('../client-handlers-BOZETgwF.cjs');
4
4
  const require_syntaxes = require('../syntaxes.cjs');
5
5
  const require_themes = require('../themes.cjs');
6
6
  let vscode_ws_jsonrpc = require("vscode-ws-jsonrpc");
@@ -17,9 +17,24 @@ _codingame_monaco_vscode_textmate_service_override = require_chunk.__toESM(_codi
17
17
  require("vscode/localExtensionHost");
18
18
 
19
19
  //#region src/monaco/monaco.ts
20
+ /**
21
+ * 创建虚拟文件系统
22
+ * @param options - 配置选项
23
+ * @param options.root - 根目录路径,默认为 "file:///"
24
+ * @param options.tree - 可选的虚拟文件树结构
25
+ * @returns 返回一个虚拟文件系统实例
26
+ */
20
27
  function createMemoryFileSystem(options) {
21
28
  return require_client_handlers.createVirtualFileSystem(require_client_handlers.createMemoryVolarFileSystem(options));
22
29
  }
30
+ /**
31
+ * 创建WebGAL Monaco语言客户端(WebSocket连接模式)
32
+ * @param options - 配置选项
33
+ * @param options.languageServerUrl - 语言服务器WebSocket URL
34
+ * @param options.editor - Monaco编辑器实例
35
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
36
+ * @returns 返回包含WebSocket连接和虚拟文件系统的对象
37
+ */
23
38
  const createWebgalMonacoLanguageClient = (options) => {
24
39
  const { languageServerUrl, editor } = options;
25
40
  const editorInstance = editor;
@@ -47,6 +62,14 @@ const createWebgalMonacoLanguageClient = (options) => {
47
62
  vfs
48
63
  };
49
64
  };
65
+ /**
66
+ * 创建WebGAL Monaco语言客户端(Worker模式)
67
+ * @param options - 配置选项
68
+ * @param options.editor - Monaco编辑器实例
69
+ * @param options.worker - Web Worker实例
70
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
71
+ * @returns 返回包含Worker实例和虚拟文件系统的对象
72
+ */
50
73
  const createWebgalMonacoLanguageClientWithWorker = (options) => {
51
74
  const { worker, editor } = options;
52
75
  const editorInstance = editor;
@@ -138,6 +161,10 @@ const createLanguageClient = (messageTransports, options) => {
138
161
  //#endregion
139
162
  //#region src/monaco/monaco-init.ts
140
163
  let initPromise = null;
164
+ /**
165
+ * 初始化资源映射对象
166
+ * 包含WebGAL语言服务所需的语法高亮、语言配置和主题等资源
167
+ */
141
168
  const initResources = {
142
169
  "./webgal.tmLanguage.json": require_syntaxes.webgalGrammar,
143
170
  "./webgal-config.tmLanguage.json": require_syntaxes.webgalConfigGrammar,
@@ -145,6 +172,12 @@ const initResources = {
145
172
  "./dark.json": require_themes.webgalDarkTheme,
146
173
  "./white.json": require_themes.webgalWhiteTheme
147
174
  };
175
+ /**
176
+ * 初始化WebGAL Monaco编辑器环境
177
+ * 该函数会注册WebGAL语言扩展、语法高亮、主题配置等,并初始化Monaco编辑器的服务
178
+ * 使用单例模式,多次调用只会执行一次初始化
179
+ * @returns Promise<void> 初始化完成的Promise
180
+ */
148
181
  async function initWebgalMonaco() {
149
182
  if (initPromise) return initPromise;
150
183
  initPromise = (async () => {
@@ -1,4 +1,4 @@
1
- import { c as VirtualFileSystem, o as VirtualEntry } from "../types-BPQnQEAd.cjs";
1
+ import { c as VirtualFileSystem, o as VirtualEntry } from "../types-DwRo8Zlp.cjs";
2
2
 
3
3
  //#region src/monaco/monaco.d.ts
4
4
  interface CreateWebgalMonacoLanguageClientOptions {
@@ -6,10 +6,25 @@ interface CreateWebgalMonacoLanguageClientOptions {
6
6
  editor: any;
7
7
  virtualFileSystem?: VirtualFileSystem;
8
8
  }
9
+ /**
10
+ * 创建虚拟文件系统
11
+ * @param options - 配置选项
12
+ * @param options.root - 根目录路径,默认为 "file:///"
13
+ * @param options.tree - 可选的虚拟文件树结构
14
+ * @returns 返回一个虚拟文件系统实例
15
+ */
9
16
  declare function createMemoryFileSystem(options?: {
10
17
  root?: string;
11
18
  tree?: VirtualEntry;
12
19
  }): VirtualFileSystem;
20
+ /**
21
+ * 创建WebGAL Monaco语言客户端(WebSocket连接模式)
22
+ * @param options - 配置选项
23
+ * @param options.languageServerUrl - 语言服务器WebSocket URL
24
+ * @param options.editor - Monaco编辑器实例
25
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
26
+ * @returns 返回包含WebSocket连接和虚拟文件系统的对象
27
+ */
13
28
  declare const createWebgalMonacoLanguageClient: (options: CreateWebgalMonacoLanguageClientOptions) => {
14
29
  webSocket: WebSocket;
15
30
  vfs: VirtualFileSystem;
@@ -19,12 +34,24 @@ interface CreateWebgalMonacoLanguageClientWorkerOptions {
19
34
  worker: Worker;
20
35
  virtualFileSystem?: VirtualFileSystem;
21
36
  }
37
+ /**
38
+ * 创建WebGAL Monaco语言客户端(Worker模式)
39
+ * @param options - 配置选项
40
+ * @param options.editor - Monaco编辑器实例
41
+ * @param options.worker - Web Worker实例
42
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
43
+ * @returns 返回包含Worker实例和虚拟文件系统的对象
44
+ */
22
45
  declare const createWebgalMonacoLanguageClientWithWorker: (options: CreateWebgalMonacoLanguageClientWorkerOptions) => {
23
46
  worker: Worker;
24
47
  vfs: VirtualFileSystem;
25
48
  };
26
49
  //#endregion
27
50
  //#region src/monaco/monaco-init.d.ts
51
+ /**
52
+ * 初始化资源映射对象
53
+ * 包含WebGAL语言服务所需的语法高亮、语言配置和主题等资源
54
+ */
28
55
  declare const initResources: {
29
56
  "./webgal.tmLanguage.json": {
30
57
  $schema: string;
@@ -600,6 +627,12 @@ declare const initResources: {
600
627
  encodedTokensColors: never[];
601
628
  };
602
629
  };
630
+ /**
631
+ * 初始化WebGAL Monaco编辑器环境
632
+ * 该函数会注册WebGAL语言扩展、语法高亮、主题配置等,并初始化Monaco编辑器的服务
633
+ * 使用单例模式,多次调用只会执行一次初始化
634
+ * @returns Promise<void> 初始化完成的Promise
635
+ */
603
636
  declare function initWebgalMonaco(): Promise<void>;
604
637
  //#endregion
605
638
  export { CreateWebgalMonacoLanguageClientOptions, CreateWebgalMonacoLanguageClientWorkerOptions, createMemoryFileSystem, createWebgalMonacoLanguageClient, createWebgalMonacoLanguageClientWithWorker, initResources, initWebgalMonaco };
@@ -1,5 +1,5 @@
1
- import { c as VirtualFileSystem, o as VirtualEntry } from "../types-FltMUZDB.mjs";
2
- import "../index-75hRTxvB.mjs";
1
+ import { c as VirtualFileSystem, o as VirtualEntry } from "../types-B7zc-Eke.mjs";
2
+ import "../index-Bbu_H5AG.mjs";
3
3
  import "vscode/localExtensionHost";
4
4
 
5
5
  //#region src/monaco/monaco.d.ts
@@ -8,10 +8,25 @@ interface CreateWebgalMonacoLanguageClientOptions {
8
8
  editor: any;
9
9
  virtualFileSystem?: VirtualFileSystem;
10
10
  }
11
+ /**
12
+ * 创建虚拟文件系统
13
+ * @param options - 配置选项
14
+ * @param options.root - 根目录路径,默认为 "file:///"
15
+ * @param options.tree - 可选的虚拟文件树结构
16
+ * @returns 返回一个虚拟文件系统实例
17
+ */
11
18
  declare function createMemoryFileSystem(options?: {
12
19
  root?: string;
13
20
  tree?: VirtualEntry;
14
21
  }): VirtualFileSystem;
22
+ /**
23
+ * 创建WebGAL Monaco语言客户端(WebSocket连接模式)
24
+ * @param options - 配置选项
25
+ * @param options.languageServerUrl - 语言服务器WebSocket URL
26
+ * @param options.editor - Monaco编辑器实例
27
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
28
+ * @returns 返回包含WebSocket连接和虚拟文件系统的对象
29
+ */
15
30
  declare const createWebgalMonacoLanguageClient: (options: CreateWebgalMonacoLanguageClientOptions) => {
16
31
  webSocket: WebSocket;
17
32
  vfs: VirtualFileSystem;
@@ -21,12 +36,24 @@ interface CreateWebgalMonacoLanguageClientWorkerOptions {
21
36
  worker: Worker;
22
37
  virtualFileSystem?: VirtualFileSystem;
23
38
  }
39
+ /**
40
+ * 创建WebGAL Monaco语言客户端(Worker模式)
41
+ * @param options - 配置选项
42
+ * @param options.editor - Monaco编辑器实例
43
+ * @param options.worker - Web Worker实例
44
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
45
+ * @returns 返回包含Worker实例和虚拟文件系统的对象
46
+ */
24
47
  declare const createWebgalMonacoLanguageClientWithWorker: (options: CreateWebgalMonacoLanguageClientWorkerOptions) => {
25
48
  worker: Worker;
26
49
  vfs: VirtualFileSystem;
27
50
  };
28
51
  //#endregion
29
52
  //#region src/monaco/monaco-init.d.ts
53
+ /**
54
+ * 初始化资源映射对象
55
+ * 包含WebGAL语言服务所需的语法高亮、语言配置和主题等资源
56
+ */
30
57
  declare const initResources: {
31
58
  "./webgal.tmLanguage.json": {
32
59
  $schema: string;
@@ -602,6 +629,12 @@ declare const initResources: {
602
629
  encodedTokensColors: never[];
603
630
  };
604
631
  };
632
+ /**
633
+ * 初始化WebGAL Monaco编辑器环境
634
+ * 该函数会注册WebGAL语言扩展、语法高亮、主题配置等,并初始化Monaco编辑器的服务
635
+ * 使用单例模式,多次调用只会执行一次初始化
636
+ * @returns Promise<void> 初始化完成的Promise
637
+ */
605
638
  declare function initWebgalMonaco(): Promise<void>;
606
639
  //#endregion
607
640
  export { CreateWebgalMonacoLanguageClientOptions, CreateWebgalMonacoLanguageClientWorkerOptions, createMemoryFileSystem, createWebgalMonacoLanguageClient, createWebgalMonacoLanguageClientWithWorker, initResources, initWebgalMonaco };
@@ -1,4 +1,4 @@
1
- import { i as createVirtualFileSystem, n as registerWebgalClientHandlers, r as createMemoryVolarFileSystem, t as createWebgalClientHandlers } from "../client-handlers-CrU8stw6.mjs";
1
+ import { i as createVirtualFileSystem, n as registerWebgalClientHandlers, r as createMemoryVolarFileSystem, t as createWebgalClientHandlers } from "../client-handlers-B6JBICcy.mjs";
2
2
  import { webgalConfigGrammar, webgalGrammar, webgalLanguageConfiguration } from "../syntaxes.mjs";
3
3
  import { webgalDarkTheme, webgalWhiteTheme } from "../themes.mjs";
4
4
  import { WebSocketMessageReader, WebSocketMessageWriter, toSocket } from "vscode-ws-jsonrpc";
@@ -12,9 +12,24 @@ import getTextMateServiceOverride from "@codingame/monaco-vscode-textmate-servic
12
12
  import "vscode/localExtensionHost";
13
13
 
14
14
  //#region src/monaco/monaco.ts
15
+ /**
16
+ * 创建虚拟文件系统
17
+ * @param options - 配置选项
18
+ * @param options.root - 根目录路径,默认为 "file:///"
19
+ * @param options.tree - 可选的虚拟文件树结构
20
+ * @returns 返回一个虚拟文件系统实例
21
+ */
15
22
  function createMemoryFileSystem(options) {
16
23
  return createVirtualFileSystem(createMemoryVolarFileSystem(options));
17
24
  }
25
+ /**
26
+ * 创建WebGAL Monaco语言客户端(WebSocket连接模式)
27
+ * @param options - 配置选项
28
+ * @param options.languageServerUrl - 语言服务器WebSocket URL
29
+ * @param options.editor - Monaco编辑器实例
30
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
31
+ * @returns 返回包含WebSocket连接和虚拟文件系统的对象
32
+ */
18
33
  const createWebgalMonacoLanguageClient = (options) => {
19
34
  const { languageServerUrl, editor } = options;
20
35
  const editorInstance = editor;
@@ -42,6 +57,14 @@ const createWebgalMonacoLanguageClient = (options) => {
42
57
  vfs
43
58
  };
44
59
  };
60
+ /**
61
+ * 创建WebGAL Monaco语言客户端(Worker模式)
62
+ * @param options - 配置选项
63
+ * @param options.editor - Monaco编辑器实例
64
+ * @param options.worker - Web Worker实例
65
+ * @param options.virtualFileSystem - 可选的虚拟文件系统,未提供时将创建默认的内存文件系统
66
+ * @returns 返回包含Worker实例和虚拟文件系统的对象
67
+ */
45
68
  const createWebgalMonacoLanguageClientWithWorker = (options) => {
46
69
  const { worker, editor } = options;
47
70
  const editorInstance = editor;
@@ -133,6 +156,10 @@ const createLanguageClient = (messageTransports, options) => {
133
156
  //#endregion
134
157
  //#region src/monaco/monaco-init.ts
135
158
  let initPromise = null;
159
+ /**
160
+ * 初始化资源映射对象
161
+ * 包含WebGAL语言服务所需的语法高亮、语言配置和主题等资源
162
+ */
136
163
  const initResources = {
137
164
  "./webgal.tmLanguage.json": webgalGrammar,
138
165
  "./webgal-config.tmLanguage.json": webgalConfigGrammar,
@@ -140,6 +167,12 @@ const initResources = {
140
167
  "./dark.json": webgalDarkTheme,
141
168
  "./white.json": webgalWhiteTheme
142
169
  };
170
+ /**
171
+ * 初始化WebGAL Monaco编辑器环境
172
+ * 该函数会注册WebGAL语言扩展、语法高亮、主题配置等,并初始化Monaco编辑器的服务
173
+ * 使用单例模式,多次调用只会执行一次初始化
174
+ * @returns Promise<void> 初始化完成的Promise
175
+ */
143
176
  async function initWebgalMonaco() {
144
177
  if (initPromise) return initPromise;
145
178
  initPromise = (async () => {
package/build/node.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as VirtualFileSystem } from "./types-BPQnQEAd.cjs";
1
+ import { c as VirtualFileSystem } from "./types-DwRo8Zlp.cjs";
2
2
 
3
3
  //#region src/node.d.ts
4
4
  type NodeFileSystemOptions = {
package/build/node.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as VirtualFileSystem } from "./types-FltMUZDB.mjs";
1
+ import { c as VirtualFileSystem } from "./types-B7zc-Eke.mjs";
2
2
 
3
3
  //#region src/node.d.ts
4
4
  type NodeFileSystemOptions = {