xshell 1.2.89 → 1.3.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.
- package/antd.sass +4 -31
- package/builder.js +5 -14
- package/file.d.ts +2 -2
- package/file.js +1 -1
- package/i18n/dict.json +12 -0
- package/i18n/scanner/index.d.ts +1 -0
- package/i18n/scanner/index.js +14 -5
- package/net.browser.d.ts +1 -142
- package/net.browser.js +1 -408
- package/net.common.d.ts +178 -0
- package/net.common.js +564 -0
- package/net.d.ts +2 -173
- package/net.js +1 -466
- package/package.json +29 -30
- package/path.d.ts +2 -2
- package/platform.browser.js +9 -1
- package/platform.common.d.ts +9 -0
- package/platform.js +11 -1
- package/prototype.common.d.ts +2 -2
- package/prototype.common.js +8 -8
- package/react.development.js +9199 -6036
- package/react.development.js.map +1 -1
- package/react.production.js +4958 -4306
- package/react.production.js.map +1 -1
- package/repl.js +5 -1
- package/server.d.ts +26 -11
- package/server.js +203 -65
- package/utils.browser.d.ts +1 -1
- package/utils.browser.js +3 -1
- package/utils.common.d.ts +11 -9
- package/utils.common.js +50 -35
- package/utils.js +7 -1
- package/i18n/utils.d.ts +0 -1
- package/i18n/utils.js +0 -11
package/antd.sass
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// 全局的 antd 覆盖样式,使用 antd 的都需要
|
|
2
|
+
|
|
1
3
|
.ant-modal-root
|
|
2
4
|
// 增加 modal 标题下方空白
|
|
3
5
|
.ant-modal-header
|
|
@@ -10,34 +12,5 @@
|
|
|
10
12
|
.ant-modal-content
|
|
11
13
|
padding: 20px
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.ant-table-wrapper
|
|
16
|
-
height: 100%
|
|
17
|
-
|
|
18
|
-
.ant-spin-nested-loading
|
|
19
|
-
height: 100%
|
|
20
|
-
|
|
21
|
-
.ant-spin-container
|
|
22
|
-
height: 100%
|
|
23
|
-
display: flex
|
|
24
|
-
flex-direction: column
|
|
25
|
-
|
|
26
|
-
.ant-table-container
|
|
27
|
-
height: 100%
|
|
28
|
-
display: flex
|
|
29
|
-
flex-direction: column
|
|
30
|
-
|
|
31
|
-
.ant-table-body
|
|
32
|
-
position: relative
|
|
33
|
-
flex: 1
|
|
34
|
-
|
|
35
|
-
table
|
|
36
|
-
position: absolute
|
|
37
|
-
left: 0
|
|
38
|
-
top: 0
|
|
39
|
-
right: 0
|
|
40
|
-
bottom: 0
|
|
41
|
-
|
|
42
|
-
.ant-table
|
|
43
|
-
flex: 1
|
|
15
|
+
.ant-splitter .ant-splitter-panel
|
|
16
|
+
scrollbar-width: unset
|
package/builder.js
CHANGED
|
@@ -4,18 +4,6 @@ import { noprint } from "./process.js";
|
|
|
4
4
|
import { Lock, filter_values } from "./utils.js";
|
|
5
5
|
import { fcopy, fmkdir, fwrite, fread, print_info } from "./file.js";
|
|
6
6
|
import { path } from "./path.js";
|
|
7
|
-
const monaco_files = [
|
|
8
|
-
'loader.js',
|
|
9
|
-
'nls.messages.zh-cn.js',
|
|
10
|
-
'editor/editor.main.js',
|
|
11
|
-
'editor/editor.main.css',
|
|
12
|
-
'base/worker/workerMain.js',
|
|
13
|
-
'base/browser/ui/codicons/codicon/codicon.ttf',
|
|
14
|
-
...['python', 'javascript', 'typescript', 'css', 'html', 'cpp', 'sql', 'scss', 'shell'].map(language => `basic-languages/${language}/${language}.js`),
|
|
15
|
-
// 太大了,先不加
|
|
16
|
-
// 'language/typescript/tsMode.js',
|
|
17
|
-
// 'language/typescript/tsWorker.js',
|
|
18
|
-
];
|
|
19
7
|
function get_react_js(production, src, map) {
|
|
20
8
|
return `${src ? import.meta.dirname.fpd : 'vendors/react/'}react.${production ? 'production' : 'development'}.js${map ? '.map' : ''}`;
|
|
21
9
|
}
|
|
@@ -89,8 +77,8 @@ const dependencies = {
|
|
|
89
77
|
},
|
|
90
78
|
monaco: {
|
|
91
79
|
assets: {
|
|
92
|
-
productions:
|
|
93
|
-
devs:
|
|
80
|
+
productions: ['monaco-editor/min/vs/'],
|
|
81
|
+
devs: ['monaco-editor/dev/vs/']
|
|
94
82
|
},
|
|
95
83
|
maps: {
|
|
96
84
|
productions: [
|
|
@@ -227,6 +215,9 @@ export class Bundler {
|
|
|
227
215
|
loader: get_loader('sass-loader'),
|
|
228
216
|
options: {
|
|
229
217
|
api: 'modern-compiler',
|
|
218
|
+
sassOptions: {
|
|
219
|
+
style: 'expanded'
|
|
220
|
+
},
|
|
230
221
|
...sass ? {
|
|
231
222
|
implementation: sass
|
|
232
223
|
} : {},
|
package/file.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface FReadOptions {
|
|
|
51
51
|
print?: boolean;
|
|
52
52
|
}
|
|
53
53
|
export declare function fread(fp: string | FileHandle): Promise<string>;
|
|
54
|
-
export declare function fread(fp: string | FileHandle, options
|
|
54
|
+
export declare function fread(fp: string | FileHandle, options: FReadOptions & {
|
|
55
55
|
encoding: 'binary';
|
|
56
56
|
}): Promise<Buffer>;
|
|
57
57
|
export declare function fread(fp: string | FileHandle, options?: FReadOptions & {
|
|
@@ -287,7 +287,7 @@ export declare function ftail(fp: string, handler: (lines: string[]) => void | P
|
|
|
287
287
|
print?: boolean;
|
|
288
288
|
}): Promise<fs.FSWatcher>;
|
|
289
289
|
/** 打开一个文件并搜索替换某个 pattern */
|
|
290
|
-
export declare function freplace(fp: string, pattern: string | RegExp, replacement: string, { print }?: {
|
|
290
|
+
export declare function freplace(fp: string, pattern: string | RegExp, replacement: string | ((substring: string, ...args: any[]) => string), { print }?: {
|
|
291
291
|
print?: boolean;
|
|
292
292
|
}): Promise<void>;
|
|
293
293
|
interface FSyncOptions {
|
package/file.js
CHANGED
|
@@ -12,7 +12,7 @@ export const print_files = { info: true, files: true };
|
|
|
12
12
|
export const print_info = { info: true, files: false };
|
|
13
13
|
export const print_info_options = { print: print_info };
|
|
14
14
|
export const binary_encoding = { encoding: 'binary' };
|
|
15
|
-
export const ramdisk = fexists('T:/TEMP/',
|
|
15
|
+
export const ramdisk = fexists('T:/TEMP/', { print: false });
|
|
16
16
|
/** fp 所指向的 文件/ 文件夹 是否存在
|
|
17
17
|
- print?: `true` */
|
|
18
18
|
export function fexists(fp, { print = true } = {}) {
|
package/i18n/dict.json
CHANGED
|
@@ -385,5 +385,17 @@
|
|
|
385
385
|
},
|
|
386
386
|
"fsend 必须传 absolute 选项, sea 选项, 或 fpd_root 文件夹": {
|
|
387
387
|
"en": "fsend must be passed the absolute option, the sea option, or the fpd_root folder"
|
|
388
|
+
},
|
|
389
|
+
"对端关闭": {
|
|
390
|
+
"en": "endpoint is going away"
|
|
391
|
+
},
|
|
392
|
+
"网络中断": {
|
|
393
|
+
"en": "network interruption"
|
|
394
|
+
},
|
|
395
|
+
"chtext": {
|
|
396
|
+
"en": "chtext"
|
|
397
|
+
},
|
|
398
|
+
"key": {
|
|
399
|
+
"en": "key"
|
|
388
400
|
}
|
|
389
401
|
}
|
package/i18n/scanner/index.d.ts
CHANGED
package/i18n/scanner/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Parser } from 'i18next-scanner';
|
|
2
2
|
import "../../prototype.js";
|
|
3
3
|
import { path } from "../../path.js";
|
|
4
|
-
import { flist, fread, fwrite } from "../../file.js";
|
|
4
|
+
import { flist, fread, fwrite, fread_json } from "../../file.js";
|
|
5
5
|
import { noprint } from "../../process.js";
|
|
6
6
|
import { rethrow } from "../../prototype.js";
|
|
7
7
|
import { languages } from "../index.js";
|
|
8
8
|
import { RWDict } from "../rwdict.js";
|
|
9
|
-
import { try_load_dict } from "../utils.js";
|
|
10
9
|
import { parse_trans_from_string_by_babel } from "./parser.js";
|
|
11
10
|
/** 扫描源码中的词条,以及收集未翻译的词条,将结果保存到 dict.json 和 untranslateds.json
|
|
12
11
|
- `process.cwd()` rootdir 要扫描根目录
|
|
@@ -65,7 +64,7 @@ export async function scanner(fpd_root, config = {}) {
|
|
|
65
64
|
print: false,
|
|
66
65
|
deep: true,
|
|
67
66
|
filter: fp => fp.isdir ?
|
|
68
|
-
!(fp.startsWith('.') || excludes.
|
|
67
|
+
!(fp.startsWith('.') || excludes.has(fp.fname))
|
|
69
68
|
:
|
|
70
69
|
fp.endsWith('.ts') && !fp.endsWith('.d.ts') || fp.endsWith('.tsx')
|
|
71
70
|
}))
|
|
@@ -141,11 +140,12 @@ function pad(str, index) {
|
|
|
141
140
|
return str.pad(widths[index], { position: 'left' });
|
|
142
141
|
}
|
|
143
142
|
const widths = [6, 8, 8];
|
|
144
|
-
const excludes = [
|
|
143
|
+
const excludes = new Set([
|
|
145
144
|
'node_modules/',
|
|
146
145
|
'out/',
|
|
147
146
|
'dist/',
|
|
148
|
-
|
|
147
|
+
'test/'
|
|
148
|
+
]);
|
|
149
149
|
/** 默认 i18next 扫描配置 */
|
|
150
150
|
const default_config = {
|
|
151
151
|
debug: false,
|
|
@@ -221,4 +221,13 @@ const default_config = {
|
|
|
221
221
|
suffix: '}}' // suffix for interpolation
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
+
export async function try_load_dict(fp_dict) {
|
|
225
|
+
try {
|
|
226
|
+
return await fread_json(fp_dict, { print: false });
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// console.error('未找到或解析错误,跳过加载:' + modpath)
|
|
230
|
+
return {};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
224
233
|
//# sourceMappingURL=index.js.map
|
package/net.browser.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { Lock } from './utils.browser.ts';
|
|
3
|
-
import { type BasicAuth, type BearerAuth, type RemoteKeeperOptions } from './net.common.ts';
|
|
1
|
+
import { type BasicAuth, type BearerAuth } from './net.common.ts';
|
|
4
2
|
export * from './net.common.ts';
|
|
5
3
|
export interface FullResponse<TBody extends ArrayBuffer | string> {
|
|
6
4
|
status: number;
|
|
@@ -58,142 +56,3 @@ export declare function request(url: string | URL, options: RequestOptions & {
|
|
|
58
56
|
export declare function request(url: string | URL, options: RequestOptions): Promise<string>;
|
|
59
57
|
/** 发起 http 请求并将响应体作为 json 解析 */
|
|
60
58
|
export declare function request_json<T = any>(url: string, options?: RequestOptions): Promise<T>;
|
|
61
|
-
export declare class WebSocketConnectionError extends Error {
|
|
62
|
-
name: "WebSocketConnectionError";
|
|
63
|
-
url: string;
|
|
64
|
-
protocols?: string[];
|
|
65
|
-
event: CloseEvent | /* error 事件时的 event,没有 event.error */ Event;
|
|
66
|
-
type: 'close' | 'error';
|
|
67
|
-
code?: number;
|
|
68
|
-
reason?: string;
|
|
69
|
-
constructor(url: string, protocols: string[] | undefined, event: CloseEvent | Event, message?: string);
|
|
70
|
-
}
|
|
71
|
-
/** 连接 websocket url, 设置各种事件监听器。在 open 事件后 resolve, 返回 websocket
|
|
72
|
-
遇到 error 时会创建 WebSocketConnectionError:
|
|
73
|
-
- reject 掉返回的 promise (若此时未 settle)
|
|
74
|
-
- 作为参数调用 on_error (已 settle 且有 on_error 回调)
|
|
75
|
-
可以用 WebSocket.bufferedAmount 来显示大消息的发送进度
|
|
76
|
-
https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/bufferedAmount
|
|
77
|
-
- url
|
|
78
|
-
- options:
|
|
79
|
-
- protocols?
|
|
80
|
-
- on_message: 根据 websocket frame 的 opcode 不同 (text frame 或 binary frame),event 中的 data 对应为 ArrayBuffer 或者 string
|
|
81
|
-
https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
|
|
82
|
-
- on_error?: 在 websocket 出错和非正常关闭 (close, error 事件) 时都调用,可以根据 error.type 来区分,error 的类型是 WebSocketConnectionError,
|
|
83
|
-
type 为 'close' 时有 code 和 reason 属性
|
|
84
|
-
- on_close?: 和 websocket 的 'close' 事件不相同,只在正常关闭 (close code 为 1000) 时才调用,否则都会调用 on_error
|
|
85
|
-
https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes
|
|
86
|
-
- print?: 是否打印连接、关闭信息 */
|
|
87
|
-
export declare function connect_websocket(url: string | URL, { protocols, on_message, on_error, on_close, print }: {
|
|
88
|
-
protocols?: string[];
|
|
89
|
-
on_message(data: ArrayBuffer | string, websocket: WebSocket): any;
|
|
90
|
-
on_error?(error: WebSocketConnectionError, websocket: WebSocket): any;
|
|
91
|
-
on_close?(event: CloseEvent, websocket: WebSocket): any;
|
|
92
|
-
print?: boolean;
|
|
93
|
-
}): Promise<WebSocket>;
|
|
94
|
-
/** 接收到消息后的处理函数
|
|
95
|
-
返回值会自动被 await,然后可能被封装为 message 回传 */
|
|
96
|
-
export type MessageHandler<TData = any> = (message: Message<TData>, websocket?: WebSocket) => void | any | Promise<void | any>;
|
|
97
|
-
/** 通过创建 remote 对象对 websocket rpc 进行抽象
|
|
98
|
-
创建 remote 对象时传入 funcs 注册处理函数,使得对端能通过 (rpc message).func 调用
|
|
99
|
-
使用 remote.handle 方法处理对端发来的 websocket message,对于 websocket 连接接收方需要手动绑定 websocket message 事件到 remote.handle
|
|
100
|
-
使用 remote.call 进行一元 rpc
|
|
101
|
-
使用 remote.send 结合 message.id 进行复杂 rpc
|
|
102
|
-
创建后等到首个 remote.call 或 remote.send 时自动建立实际 websocket 连接
|
|
103
|
-
rpc 状态与底层连接的状态无关,如果是传入 url 创建的 remote 实例,remote.send 时检测到断线会自动建立新的 websocket 连接
|
|
104
|
-
|
|
105
|
-
@example
|
|
106
|
-
// Zero 继承自 Remote 并通过 call 实现了一些方法
|
|
107
|
-
let zero = new Zero({ local: true })
|
|
108
|
-
|
|
109
|
-
// 一元 rpc
|
|
110
|
-
await zero.repl_ts('1234')
|
|
111
|
-
|
|
112
|
-
// 订阅流
|
|
113
|
-
const id = genid()
|
|
114
|
-
|
|
115
|
-
zero.handlers.set(id, ({ data: [chunk] }: Message<[Uint8Array]>) => {
|
|
116
|
-
term.write(chunk)
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
zero.send({ id, func: 'subscribe_stdio' }) */
|
|
120
|
-
export declare class Remote {
|
|
121
|
-
/** 在构造 Remote 时, this.initiator = Boolean(url || websocket)
|
|
122
|
-
- true: 作为 websocket 连接发起方
|
|
123
|
-
- false: 作为 websocket 连接接收方 */
|
|
124
|
-
initiator: boolean;
|
|
125
|
-
/** 作为 websocket 连接发起方,对端的 url 地址 */
|
|
126
|
-
url?: string;
|
|
127
|
-
/** 作为 websocket 连接发起方有 websocket lock */
|
|
128
|
-
lwebsocket?: Lock<WebSocket>;
|
|
129
|
-
/** websocket 连接发起方,接收方,都能被对端通过 (rpc message).func 调用的 rpc 函数 */
|
|
130
|
-
funcs: Record<string, MessageHandler>;
|
|
131
|
-
/** map<id, message handler>: 通过 (rpc message).id 找到对应的 handler
|
|
132
|
-
一元 rpc 接收方不需要设置 handlers, 发送方需要 */
|
|
133
|
-
handlers: Map<number, MessageHandler<any>>;
|
|
134
|
-
keeper?: RemoteKeeperOptions;
|
|
135
|
-
/** `true` 是否打印连接信息、错误信息 */
|
|
136
|
-
print: boolean;
|
|
137
|
-
/** `false` 打印所有交互的 rpc messages */
|
|
138
|
-
verbose: boolean;
|
|
139
|
-
first_error: boolean;
|
|
140
|
-
keeping: boolean;
|
|
141
|
-
reconnecting: boolean;
|
|
142
|
-
disconnected: boolean;
|
|
143
|
-
/** 作为 websocket 连接发起方,传入 url 或 websocket,定义远程 Remote
|
|
144
|
-
作为 websocket 连接接收方,不传 url 和 websocket,定义本地 Remote */
|
|
145
|
-
constructor({ url, funcs, print, verbose, websocket, keeper, on_error, }?: {
|
|
146
|
-
url?: string;
|
|
147
|
-
funcs?: Remote['funcs'];
|
|
148
|
-
print?: boolean;
|
|
149
|
-
verbose?: boolean;
|
|
150
|
-
websocket?: WebSocket;
|
|
151
|
-
keeper?: RemoteKeeperOptions;
|
|
152
|
-
on_error?(error: WebSocketConnectionError | Error, websocket?: WebSocket): void;
|
|
153
|
-
});
|
|
154
|
-
/** 统一处理首次连接和连接后的 websocket 错误 */
|
|
155
|
-
_on_error: (error: WebSocketConnectionError, websocket?: WebSocket) => void;
|
|
156
|
-
_on_message: (data: ArrayBuffer, websocket: WebSocket) => void;
|
|
157
|
-
/** 使用者自定义的在 websocket 连接出错时,或者 handlers 出错时的处理 */
|
|
158
|
-
on_error(error: WebSocketConnectionError | Error, websocket?: WebSocket): void;
|
|
159
|
-
/** 幂等,保证 websocket 已连接,否则抛出异常
|
|
160
|
-
一般情况不需要手动调用,在其它方法中会自动调用这个方法,除非需要手动建立 websocket 连接并确保成功
|
|
161
|
-
连接断开后,通过传入 url 参数构造的 remote 实例会自动创建新的 websocket 连接,而通过传入 websocket 参数构造的实例只会检查连接状态,在断开时抛出异常
|
|
162
|
-
作为 websocket 连接发起方,不需要传入 websocket
|
|
163
|
-
作为 websocket 连接接收方,需要传入使用的 websocket 连接,确保这个这个连接的状态 */
|
|
164
|
-
connect(websocket?: WebSocket): Promise<void>;
|
|
165
|
-
/** 作为 websocket 连接发起方手动关闭到对端的 websocket 连接 */
|
|
166
|
-
disconnect(): void;
|
|
167
|
-
/** 发送 message 到对端 remote
|
|
168
|
-
作为 websocket 连接发起方,不需要传入 websocket
|
|
169
|
-
作为 websocket 连接接收方,必传 websocket 参数
|
|
170
|
-
发送或连接出错时自动清理 message.id 对应的 handler */
|
|
171
|
-
send(message: Message, websocket?: WebSocket): Promise<void>;
|
|
172
|
-
/** 处理接收到的 websocket message 并解析, 根据 message.id 或 message.func 分发到对应的 handler 进行处理,
|
|
173
|
-
handler 处理完成后:
|
|
174
|
-
- 传了 func: 调用函数的情况下 (通常是一元 rpc),总是将返回值包装为 message 回传
|
|
175
|
-
- 未传 func: 通过 id 调用,如果 handler 返回非 undefined 的值,也包装为 message 回传
|
|
176
|
-
|
|
177
|
-
如果 message.done == true 则对端指示当前 remote 可以清理 handler
|
|
178
|
-
使用 Uint8Array 作为参数更灵活 https://stackoverflow.com/a/74505197/7609214
|
|
179
|
-
这个方法一般不会抛出错误,也不需要 await,一般在 websocket on_message 时使用 */
|
|
180
|
-
handle(data: Uint8Array, websocket: WebSocket): Promise<void>;
|
|
181
|
-
/** 调用对端 remote 中的 func, 只适用于最简单的一元 rpc (请求, 响应)
|
|
182
|
-
作为 websocket 连接发起方,不需要传入 websocket
|
|
183
|
-
作为 websocket 连接接收方,必传 websocket 参数 */
|
|
184
|
-
call<TReturn = any>(func: string, args?: any[], websocket?: WebSocket): Promise<TReturn>;
|
|
185
|
-
/** 调用对端 remote 中的 func, 开始订阅并接收连续的消息 (订阅流)
|
|
186
|
-
- func: 订阅处理函数
|
|
187
|
-
- on_data: 接收开始订阅后的数据
|
|
188
|
-
- options?:
|
|
189
|
-
- on_error?: 处理开始订阅后的错误
|
|
190
|
-
- websocket?: 作为 websocket 连接接收方,必传 websocket 参数 */
|
|
191
|
-
subscribe<TData, TSubscribed = void>(func: string, on_data: (data: TData) => void, { on_error, websocket }?: RemoteSubscribeOptions): Promise<{
|
|
192
|
-
id: number;
|
|
193
|
-
data: TSubscribed;
|
|
194
|
-
}>;
|
|
195
|
-
}
|
|
196
|
-
export interface RemoteSubscribeOptions {
|
|
197
|
-
on_error?(error: Error): void;
|
|
198
|
-
websocket?: WebSocket;
|
|
199
|
-
}
|