xshell 1.0.209 → 1.0.210
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/net.browser.d.ts +2 -1
- package/net.browser.js +2 -1
- package/net.d.ts +2 -1
- package/net.js +2 -1
- package/package.json +1 -1
- package/path.d.ts +2 -2
- package/server.js +2 -10
- package/utils.browser.d.ts +1 -1
- package/utils.d.ts +1 -1
package/net.browser.d.ts
CHANGED
|
@@ -230,7 +230,8 @@ export declare class Remote {
|
|
|
230
230
|
/** 处理接收到的 websocket message 并解析, 根据 message.id 或 message.func 分发到对应的 handler 进行处理
|
|
231
231
|
如果 message.done == true 则对端指示当前 remote 可以清理 handler
|
|
232
232
|
如果 handler 返回了值 (一定是数组),则包装为 message 发送
|
|
233
|
-
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
233
|
+
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
234
|
+
这个方法一般不会抛出错误,也不需要 await,一般在 websocket on_message 时使用 */
|
|
234
235
|
handle(data: Uint8Array, websocket: WebSocket): Promise<void>;
|
|
235
236
|
/** 调用对端 remote 中的 func, 只适用于最简单的一元 rpc (请求, 响应)
|
|
236
237
|
作为 websocket 连接发起方,不需要传入 websocket
|
package/net.browser.js
CHANGED
|
@@ -496,7 +496,8 @@ export class Remote {
|
|
|
496
496
|
/** 处理接收到的 websocket message 并解析, 根据 message.id 或 message.func 分发到对应的 handler 进行处理
|
|
497
497
|
如果 message.done == true 则对端指示当前 remote 可以清理 handler
|
|
498
498
|
如果 handler 返回了值 (一定是数组),则包装为 message 发送
|
|
499
|
-
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
499
|
+
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
500
|
+
这个方法一般不会抛出错误,也不需要 await,一般在 websocket on_message 时使用 */
|
|
500
501
|
async handle(data, websocket) {
|
|
501
502
|
const message = Remote.parse(data);
|
|
502
503
|
const { id, func, done } = message;
|
package/net.d.ts
CHANGED
|
@@ -297,7 +297,8 @@ export declare class Remote {
|
|
|
297
297
|
/** 处理接收到的 websocket message 并解析, 根据 message.id 或 message.func 分发到对应的 handler 进行处理
|
|
298
298
|
如果 message.done == true 则对端指示当前 remote 可以清理 handler
|
|
299
299
|
如果 handler 返回了值 (一定是数组),则包装为 message 发送
|
|
300
|
-
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
300
|
+
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
301
|
+
这个方法一般不会抛出错误,也不需要 await,一般在 websocket on_message 时使用 */
|
|
301
302
|
handle(data: Uint8Array, websocket: WebSocket): Promise<void>;
|
|
302
303
|
/** 调用对端 remote 中的 func, 只适用于最简单的一元 rpc (请求, 响应)
|
|
303
304
|
作为 websocket 连接发起方,不需要传入 websocket
|
package/net.js
CHANGED
|
@@ -728,7 +728,8 @@ export class Remote {
|
|
|
728
728
|
/** 处理接收到的 websocket message 并解析, 根据 message.id 或 message.func 分发到对应的 handler 进行处理
|
|
729
729
|
如果 message.done == true 则对端指示当前 remote 可以清理 handler
|
|
730
730
|
如果 handler 返回了值 (一定是数组),则包装为 message 发送
|
|
731
|
-
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
731
|
+
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
732
|
+
这个方法一般不会抛出错误,也不需要 await,一般在 websocket on_message 时使用 */
|
|
732
733
|
async handle(data, websocket) {
|
|
733
734
|
const message = Remote.parse(data);
|
|
734
735
|
const { id, func, done } = message;
|
package/package.json
CHANGED
package/path.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export declare function extname(path: string): string;
|
|
|
55
55
|
/** `/` */
|
|
56
56
|
export declare const sep = "/";
|
|
57
57
|
/** The platform-specific file delimiter. ';' or ':'. */
|
|
58
|
-
export declare const delimiter: "
|
|
58
|
+
export declare const delimiter: ":" | ";";
|
|
59
59
|
/** Returns an object from a path string - the opposite of format().
|
|
60
60
|
@param path path to evaluate.
|
|
61
61
|
@throws {TypeError} if `path` is not a string. */
|
|
@@ -83,7 +83,7 @@ export declare let path: {
|
|
|
83
83
|
basename: typeof basename;
|
|
84
84
|
extname: typeof extname;
|
|
85
85
|
sep: string;
|
|
86
|
-
delimiter: "
|
|
86
|
+
delimiter: ":" | ";";
|
|
87
87
|
parse: typeof parse;
|
|
88
88
|
format: typeof format;
|
|
89
89
|
toNamespacedPath: typeof toNamespacedPath;
|
package/server.js
CHANGED
|
@@ -148,16 +148,8 @@ export class Server {
|
|
|
148
148
|
maxPayload: 2 ** 30 // 1 GB
|
|
149
149
|
});
|
|
150
150
|
this.websocket_server.on('connection', (ws, request) => {
|
|
151
|
-
ws.addEventListener('message',
|
|
152
|
-
|
|
153
|
-
try {
|
|
154
|
-
await this.remote.handle(new Uint8Array(data), ws);
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
this.on_error(error);
|
|
158
|
-
// 这里再往上扔会成为 uncaughtException 使进程退出,
|
|
159
|
-
// 通过上面的处理应该足够了
|
|
160
|
-
}
|
|
151
|
+
ws.addEventListener('message', ({ data }) => {
|
|
152
|
+
this.remote.handle(new Uint8Array(data), ws);
|
|
161
153
|
});
|
|
162
154
|
});
|
|
163
155
|
const on_upgrade = this.on_upgrade.bind(this);
|
package/utils.browser.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare function encode(str: string): Uint8Array<ArrayBufferLike>;
|
|
|
81
81
|
在流式处理 (buffer 可能不完整) 时,应使用独立的 TextDecoder 实例调用 decode(buffer, { stream: true }) */
|
|
82
82
|
export declare function decode(buffer: Uint8Array): string;
|
|
83
83
|
/** 字符串字典序比较 */
|
|
84
|
-
export declare function strcmp(l: string, r: string):
|
|
84
|
+
export declare function strcmp(l: string, r: string): 0 | 1 | -1;
|
|
85
85
|
/** 比较 1.10.02 这种版本号
|
|
86
86
|
- l, r: 两个版本号字符串
|
|
87
87
|
- loose?: 宽松模式,允许两个版本号格式(位数)不一致 */
|
package/utils.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare function filter_values<TObj extends Record<string, any>>(obj: TOb
|
|
|
44
44
|
/** 忽略对象中的 keys, 返回新对象 */
|
|
45
45
|
export declare function omit<TObj>(obj: TObj, omit_keys: string[]): TObj;
|
|
46
46
|
/** 字符串字典序比较 */
|
|
47
|
-
export declare function strcmp(l: string, r: string):
|
|
47
|
+
export declare function strcmp(l: string, r: string): 0 | 1 | -1;
|
|
48
48
|
/** 比较 1.10.02 这种版本号
|
|
49
49
|
- l, r: 两个版本号字符串
|
|
50
50
|
- loose?: 宽松模式,允许两个版本号格式(位数)不一致 */
|