xshell 1.0.208 → 1.0.209
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 +4 -4
- package/net.browser.js +9 -11
- package/net.d.ts +4 -4
- package/net.js +9 -11
- package/package.json +6 -6
- package/path.d.ts +2 -2
- package/server.js +2 -1
- package/utils.browser.d.ts +1 -1
- package/utils.d.ts +1 -1
package/net.browser.d.ts
CHANGED
|
@@ -207,13 +207,13 @@ export declare class Remote {
|
|
|
207
207
|
verbose?: boolean;
|
|
208
208
|
websocket?: WebSocket;
|
|
209
209
|
keeper?: RemoteKeeperOptions;
|
|
210
|
-
on_error?(error: WebSocketConnectionError, websocket?: WebSocket): void;
|
|
210
|
+
on_error?(error: WebSocketConnectionError | Error, websocket?: WebSocket): void;
|
|
211
211
|
});
|
|
212
|
-
/**
|
|
212
|
+
/** 统一处理首次连接和连接后的 websocket 错误 */
|
|
213
213
|
_on_error: (error: WebSocketConnectionError, websocket?: WebSocket) => void;
|
|
214
214
|
_on_message: (data: ArrayBuffer, websocket: WebSocket) => void;
|
|
215
|
-
/**
|
|
216
|
-
on_error
|
|
215
|
+
/** 使用者自定义的在 websocket 连接出错时,或者 handlers 出错时的处理 */
|
|
216
|
+
on_error(error: WebSocketConnectionError | Error, websocket?: WebSocket): void;
|
|
217
217
|
/** 幂等,保证 websocket 已连接,否则抛出异常
|
|
218
218
|
一般情况不需要手动调用,在其它方法中会自动调用这个方法,除非需要手动建立 websocket 连接并确保成功
|
|
219
219
|
连接断开后,通过传入 url 参数构造的 remote 实例会自动创建新的 websocket 连接,而通过传入 websocket 参数构造的实例只会检查连接状态,在断开时抛出异常
|
package/net.browser.js
CHANGED
|
@@ -369,10 +369,8 @@ export class Remote {
|
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
/**
|
|
372
|
+
/** 统一处理首次连接和连接后的 websocket 错误 */
|
|
373
373
|
_on_error = (error, websocket) => {
|
|
374
|
-
if (websocket) // 连接后出现的错误
|
|
375
|
-
this.on_error?.(error, websocket);
|
|
376
374
|
if (this.keeper && !this.reconnecting && !this.disconnected) // 在一段时间后调度错误重连
|
|
377
375
|
(async () => {
|
|
378
376
|
this.reconnecting = true;
|
|
@@ -396,18 +394,17 @@ export class Remote {
|
|
|
396
394
|
// 重连由 this.connect 里面调用 this._on_error 处理
|
|
397
395
|
}
|
|
398
396
|
})();
|
|
397
|
+
this.on_error(error, websocket);
|
|
399
398
|
};
|
|
400
399
|
_on_message = (data, websocket) => {
|
|
401
400
|
this.handle(new Uint8Array(data), websocket);
|
|
402
401
|
};
|
|
403
|
-
/**
|
|
402
|
+
/** 使用者自定义的在 websocket 连接出错时,或者 handlers 出错时的处理 */
|
|
404
403
|
on_error(error, websocket) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
else
|
|
410
|
-
throw error;
|
|
404
|
+
// 使用者未定义 Remote 如何处理 error 时,一般来说直接忽略即可,因为 handlers 中报错了也会返回给对端
|
|
405
|
+
if (this.print)
|
|
406
|
+
console.log(error);
|
|
407
|
+
// 这里继续往上层抛没有太大意义,上面一般都是 websocket on_message 这些
|
|
411
408
|
}
|
|
412
409
|
/** 幂等,保证 websocket 已连接,否则抛出异常
|
|
413
410
|
一般情况不需要手动调用,在其它方法中会自动调用这个方法,除非需要手动建立 websocket 连接并确保成功
|
|
@@ -528,7 +525,8 @@ export class Remote {
|
|
|
528
525
|
!message.error // 防止无限循环往对方发送 error, 只有在对方无错误时才可以发送
|
|
529
526
|
)
|
|
530
527
|
await this.send({ id, error, /* 不能设置 done 清理对面 handler, 理由同上 */ }, websocket);
|
|
531
|
-
|
|
528
|
+
// 这里继续往上层抛没有太大意义,上面一般都是 websocket on_message 这些,交给自定义或默认的 on_error 处理
|
|
529
|
+
this.on_error(error);
|
|
532
530
|
}
|
|
533
531
|
}
|
|
534
532
|
/** 调用对端 remote 中的 func, 只适用于最简单的一元 rpc (请求, 响应)
|
package/net.d.ts
CHANGED
|
@@ -274,13 +274,13 @@ export declare class Remote {
|
|
|
274
274
|
verbose?: boolean;
|
|
275
275
|
websocket?: WebSocket;
|
|
276
276
|
keeper?: RemoteKeeperOptions;
|
|
277
|
-
on_error?(error: WebSocketConnectionError, websocket?: WebSocket): void;
|
|
277
|
+
on_error?(error: WebSocketConnectionError | Error, websocket?: WebSocket): void;
|
|
278
278
|
});
|
|
279
|
-
/**
|
|
279
|
+
/** 统一处理首次连接和连接后的 websocket 错误 */
|
|
280
280
|
_on_error: (error: WebSocketConnectionError, websocket?: WebSocket) => void;
|
|
281
281
|
_on_message: (data: ArrayBuffer, websocket: WebSocket) => void;
|
|
282
|
-
/**
|
|
283
|
-
on_error
|
|
282
|
+
/** 使用者自定义的在 websocket 连接出错时,或者 handlers 出错时的处理 */
|
|
283
|
+
on_error(error: WebSocketConnectionError | Error, websocket?: WebSocket): void;
|
|
284
284
|
/** 幂等,保证 websocket 已连接,否则抛出异常
|
|
285
285
|
一般情况不需要手动调用,在其它方法中会自动调用这个方法,除非需要手动建立 websocket 连接并确保成功
|
|
286
286
|
连接断开后,通过传入 url 参数构造的 remote 实例会自动创建新的 websocket 连接,而通过传入 websocket 参数构造的实例只会检查连接状态,在断开时抛出异常
|
package/net.js
CHANGED
|
@@ -601,10 +601,8 @@ export class Remote {
|
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
/**
|
|
604
|
+
/** 统一处理首次连接和连接后的 websocket 错误 */
|
|
605
605
|
_on_error = (error, websocket) => {
|
|
606
|
-
if (websocket) // 连接后出现的错误
|
|
607
|
-
this.on_error?.(error, websocket);
|
|
608
606
|
if (this.keeper && !this.reconnecting && !this.disconnected) // 在一段时间后调度错误重连
|
|
609
607
|
(async () => {
|
|
610
608
|
this.reconnecting = true;
|
|
@@ -628,18 +626,17 @@ export class Remote {
|
|
|
628
626
|
// 重连由 this.connect 里面调用 this._on_error 处理
|
|
629
627
|
}
|
|
630
628
|
})();
|
|
629
|
+
this.on_error(error, websocket);
|
|
631
630
|
};
|
|
632
631
|
_on_message = (data, websocket) => {
|
|
633
632
|
this.handle(new Uint8Array(data), websocket);
|
|
634
633
|
};
|
|
635
|
-
/**
|
|
634
|
+
/** 使用者自定义的在 websocket 连接出错时,或者 handlers 出错时的处理 */
|
|
636
635
|
on_error(error, websocket) {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
else
|
|
642
|
-
throw error;
|
|
636
|
+
// 使用者未定义 Remote 如何处理 error 时,一般来说直接忽略即可,因为 handlers 中报错了也会返回给对端
|
|
637
|
+
if (this.print)
|
|
638
|
+
console.log(error);
|
|
639
|
+
// 这里继续往上层抛没有太大意义,上面一般都是 websocket on_message 这些
|
|
643
640
|
}
|
|
644
641
|
/** 幂等,保证 websocket 已连接,否则抛出异常
|
|
645
642
|
一般情况不需要手动调用,在其它方法中会自动调用这个方法,除非需要手动建立 websocket 连接并确保成功
|
|
@@ -760,7 +757,8 @@ export class Remote {
|
|
|
760
757
|
!message.error // 防止无限循环往对方发送 error, 只有在对方无错误时才可以发送
|
|
761
758
|
)
|
|
762
759
|
await this.send({ id, error, /* 不能设置 done 清理对面 handler, 理由同上 */ }, websocket);
|
|
763
|
-
|
|
760
|
+
// 这里继续往上层抛没有太大意义,上面一般都是 websocket on_message 这些,交给自定义或默认的 on_error 处理
|
|
761
|
+
this.on_error(error);
|
|
764
762
|
}
|
|
765
763
|
}
|
|
766
764
|
/** 调用对端 remote 中的 func, 只适用于最简单的一元 rpc (请求, 响应)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xshell",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.209",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@babel/core": "^7.26.0",
|
|
53
|
-
"@babel/parser": "^7.26.
|
|
54
|
-
"@babel/traverse": "^7.
|
|
53
|
+
"@babel/parser": "^7.26.3",
|
|
54
|
+
"@babel/traverse": "^7.26.3",
|
|
55
55
|
"@koa/cors": "^5.0.0",
|
|
56
56
|
"@stylistic/eslint-plugin": "^2.11.0",
|
|
57
57
|
"@svgr/webpack": "^8.1.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"react-object-model": "^1.2.18",
|
|
96
96
|
"resolve-path": "^1.4.0",
|
|
97
97
|
"sass": "^1.82.0",
|
|
98
|
-
"sass-loader": "^16.0.
|
|
98
|
+
"sass-loader": "^16.0.4",
|
|
99
99
|
"source-map-loader": "^5.0.0",
|
|
100
100
|
"strip-ansi": "^7.1.0",
|
|
101
101
|
"style-loader": "^4.0.0",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"ws": "^8.18.0"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@babel/types": "^7.26.
|
|
116
|
+
"@babel/types": "^7.26.3",
|
|
117
117
|
"@types/ali-oss": "^6.16.11",
|
|
118
118
|
"@types/archiver": "^6.0.3",
|
|
119
119
|
"@types/babel__traverse": "^7.20.6",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"@types/lodash": "^4.17.13",
|
|
128
128
|
"@types/mime-types": "^2.1.4",
|
|
129
129
|
"@types/node": "^22.10.1",
|
|
130
|
-
"@types/react": "^18.3.
|
|
130
|
+
"@types/react": "^18.3.13",
|
|
131
131
|
"@types/through2": "^2.0.41",
|
|
132
132
|
"@types/tough-cookie": "^4.0.5",
|
|
133
133
|
"@types/ua-parser-js": "^0.7.39",
|
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
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): 1 | 0 | -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): 1 | 0 | -1;
|
|
48
48
|
/** 比较 1.10.02 这种版本号
|
|
49
49
|
- l, r: 两个版本号字符串
|
|
50
50
|
- loose?: 宽松模式,允许两个版本号格式(位数)不一致 */
|