@webgal/language-service 0.0.2-alpha.5 → 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.
- package/README.en.md +15 -0
- package/README.md +15 -0
- package/build/{client-handlers-niazfK9_.mjs → client-handlers-B6JBICcy.mjs} +35 -1
- package/build/{client-handlers-B-uz20CX.cjs → client-handlers-BOZETgwF.cjs} +35 -1
- package/build/index-Bbu_H5AG.d.mts +46 -0
- package/build/index.cjs +1 -1
- package/build/index.d.cts +35 -1
- package/build/index.d.mts +14 -2
- package/build/index.mjs +1 -1
- package/build/monaco/index.cjs +34 -1
- package/build/monaco/index.d.cts +34 -1
- package/build/monaco/index.d.mts +35 -2
- package/build/monaco/index.mjs +34 -1
- package/build/node.d.cts +1 -1
- package/build/node.d.mts +1 -1
- package/build/{providerState-Du_Ge3bW.cjs → providerState-Dip2XHx4.cjs} +60 -60
- package/build/{providerState-DrFcJbqe.mjs → providerState-_ZvKXErw.mjs} +60 -60
- package/build/types-B7zc-Eke.d.mts +166 -0
- package/build/types-DwRo8Zlp.d.cts +166 -0
- package/build/utils/index.cjs +1 -1
- package/build/utils/index.mjs +1 -1
- package/package.json +7 -2
- package/build/index-BF2WhBpG.d.mts +0 -24
- package/build/types-BPQnQEAd.d.cts +0 -111
- package/build/types-CBH-p_Iu.d.mts +0 -111
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,4 +1,4 @@
|
|
|
1
|
-
import { t as getState } from "./providerState-
|
|
1
|
+
import { t as getState } from "./providerState-_ZvKXErw.mjs";
|
|
2
2
|
import { FileType } from "@volar/language-service";
|
|
3
3
|
import { URI } from "vscode-uri";
|
|
4
4
|
|
|
@@ -33,6 +33,12 @@ const toVfsPath = (value) => value.startsWith("file://") ? uriToPath(value) : va
|
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/vfs/adapter.ts
|
|
36
|
+
/**
|
|
37
|
+
* 创建虚拟文件系统适配器
|
|
38
|
+
* 将Volar可写文件系统封装为统一的虚拟文件系统接口
|
|
39
|
+
* @param fs - Volar可写文件系统实例
|
|
40
|
+
* @returns 返回虚拟文件系统实例,提供文件读写、目录操作等功能
|
|
41
|
+
*/
|
|
36
42
|
function createVirtualFileSystem(fs) {
|
|
37
43
|
const root = fs.root;
|
|
38
44
|
return {
|
|
@@ -116,6 +122,14 @@ function createVirtualFileSystem(fs) {
|
|
|
116
122
|
onDidChange: (listener) => fs.onDidChange(listener)
|
|
117
123
|
};
|
|
118
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* 创建Volar文件系统适配器
|
|
127
|
+
* 将虚拟文件系统封装为Volar语言服务所需的FileSystem接口
|
|
128
|
+
* @param vfs - 虚拟文件系统实例
|
|
129
|
+
* @param options - 配置选项
|
|
130
|
+
* @param options.uriToPath - 可选的URI到路径的转换函数,默认使用内置的转换函数
|
|
131
|
+
* @returns 返回符合Volar FileSystem接口的文件系统实例
|
|
132
|
+
*/
|
|
119
133
|
function createVolarFileSystem(vfs, options) {
|
|
120
134
|
const uriToPathImpl = options?.uriToPath ?? ((uri) => uriToPath(uri));
|
|
121
135
|
return {
|
|
@@ -145,6 +159,14 @@ function createVolarFileSystem(vfs, options) {
|
|
|
145
159
|
|
|
146
160
|
//#endregion
|
|
147
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
|
+
*/
|
|
148
170
|
function createMemoryVolarFileSystem(options) {
|
|
149
171
|
const root = normalizePath(toVfsPath(options?.root ?? "/"));
|
|
150
172
|
let rootEntry = options?.tree && options.tree.type === "dir" ? options.tree : {
|
|
@@ -298,6 +320,12 @@ function createMemoryVolarFileSystem(options) {
|
|
|
298
320
|
|
|
299
321
|
//#endregion
|
|
300
322
|
//#region src/client-handlers.ts
|
|
323
|
+
/**
|
|
324
|
+
* 创建Webgal客户端处理器
|
|
325
|
+
*
|
|
326
|
+
* @param options - 创建处理器的配置选项
|
|
327
|
+
* @returns 返回一个包含各种客户端处理器方法的对象
|
|
328
|
+
*/
|
|
301
329
|
function createWebgalClientHandlers(options) {
|
|
302
330
|
const normalizeChange = (change) => {
|
|
303
331
|
if (change.type === "writeFile") return {
|
|
@@ -342,6 +370,12 @@ function createWebgalClientHandlers(options) {
|
|
|
342
370
|
...options.overrides ?? {}
|
|
343
371
|
};
|
|
344
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* 注册WebGal客户端处理器
|
|
375
|
+
*
|
|
376
|
+
* @param client - 语言客户端实例,实现了LanguageClientLike接口
|
|
377
|
+
* @param handlers - WebGal客户端处理器的可选映射对象,包含要注册的各种处理器方法
|
|
378
|
+
*/
|
|
345
379
|
function registerWebgalClientHandlers(client, handlers) {
|
|
346
380
|
for (const [method, handler] of Object.entries(handlers)) client.onRequest(method, handler);
|
|
347
381
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
const require_providerState = require('./providerState-
|
|
2
|
+
const require_providerState = require('./providerState-Dip2XHx4.cjs');
|
|
3
3
|
let _volar_language_service = require("@volar/language-service");
|
|
4
4
|
let vscode_uri = require("vscode-uri");
|
|
5
5
|
|
|
@@ -34,6 +34,12 @@ const toVfsPath = (value) => value.startsWith("file://") ? uriToPath(value) : va
|
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/vfs/adapter.ts
|
|
37
|
+
/**
|
|
38
|
+
* 创建虚拟文件系统适配器
|
|
39
|
+
* 将Volar可写文件系统封装为统一的虚拟文件系统接口
|
|
40
|
+
* @param fs - Volar可写文件系统实例
|
|
41
|
+
* @returns 返回虚拟文件系统实例,提供文件读写、目录操作等功能
|
|
42
|
+
*/
|
|
37
43
|
function createVirtualFileSystem(fs) {
|
|
38
44
|
const root = fs.root;
|
|
39
45
|
return {
|
|
@@ -117,6 +123,14 @@ function createVirtualFileSystem(fs) {
|
|
|
117
123
|
onDidChange: (listener) => fs.onDidChange(listener)
|
|
118
124
|
};
|
|
119
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* 创建Volar文件系统适配器
|
|
128
|
+
* 将虚拟文件系统封装为Volar语言服务所需的FileSystem接口
|
|
129
|
+
* @param vfs - 虚拟文件系统实例
|
|
130
|
+
* @param options - 配置选项
|
|
131
|
+
* @param options.uriToPath - 可选的URI到路径的转换函数,默认使用内置的转换函数
|
|
132
|
+
* @returns 返回符合Volar FileSystem接口的文件系统实例
|
|
133
|
+
*/
|
|
120
134
|
function createVolarFileSystem(vfs, options) {
|
|
121
135
|
const uriToPathImpl = options?.uriToPath ?? ((uri) => uriToPath(uri));
|
|
122
136
|
return {
|
|
@@ -146,6 +160,14 @@ function createVolarFileSystem(vfs, options) {
|
|
|
146
160
|
|
|
147
161
|
//#endregion
|
|
148
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
|
+
*/
|
|
149
171
|
function createMemoryVolarFileSystem(options) {
|
|
150
172
|
const root = normalizePath(toVfsPath(options?.root ?? "/"));
|
|
151
173
|
let rootEntry = options?.tree && options.tree.type === "dir" ? options.tree : {
|
|
@@ -299,6 +321,12 @@ function createMemoryVolarFileSystem(options) {
|
|
|
299
321
|
|
|
300
322
|
//#endregion
|
|
301
323
|
//#region src/client-handlers.ts
|
|
324
|
+
/**
|
|
325
|
+
* 创建Webgal客户端处理器
|
|
326
|
+
*
|
|
327
|
+
* @param options - 创建处理器的配置选项
|
|
328
|
+
* @returns 返回一个包含各种客户端处理器方法的对象
|
|
329
|
+
*/
|
|
302
330
|
function createWebgalClientHandlers(options) {
|
|
303
331
|
const normalizeChange = (change) => {
|
|
304
332
|
if (change.type === "writeFile") return {
|
|
@@ -343,6 +371,12 @@ function createWebgalClientHandlers(options) {
|
|
|
343
371
|
...options.overrides ?? {}
|
|
344
372
|
};
|
|
345
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* 注册WebGal客户端处理器
|
|
376
|
+
*
|
|
377
|
+
* @param client - 语言客户端实例,实现了LanguageClientLike接口
|
|
378
|
+
* @param handlers - WebGal客户端处理器的可选映射对象,包含要注册的各种处理器方法
|
|
379
|
+
*/
|
|
346
380
|
function registerWebgalClientHandlers(client, handlers) {
|
|
347
381
|
for (const [method, handler] of Object.entries(handlers)) client.onRequest(method, handler);
|
|
348
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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 };
|
package/build/monaco/index.cjs
CHANGED
|
@@ -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-
|
|
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 () => {
|
package/build/monaco/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as VirtualFileSystem, o as VirtualEntry } from "../types-
|
|
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 };
|
package/build/monaco/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as VirtualFileSystem, o as VirtualEntry } from "../types-
|
|
2
|
-
import "../index-
|
|
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 };
|
package/build/monaco/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as createVirtualFileSystem, n as registerWebgalClientHandlers, r as createMemoryVolarFileSystem, t as createWebgalClientHandlers } from "../client-handlers-
|
|
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
package/build/node.d.mts
CHANGED