xshell 1.3.48 → 1.3.49
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.common.d.ts +1 -1
- package/net.common.js +4 -2
- package/package.json +10 -10
- package/polyfill.browser.js +1 -0
- package/process.d.ts +1 -1
- package/server.d.ts +1 -1
- package/server.js +1 -1
- package/toaster.browser.js +1 -0
- package/tsconfig.json +3 -5
- package/xlint.js +6 -6
package/net.common.d.ts
CHANGED
|
@@ -197,7 +197,7 @@ export declare class Remote {
|
|
|
197
197
|
try_send(message: Message): void;
|
|
198
198
|
/** 处理接收到的 websocket message 并解析, 根据 message.id 或 message.func 分发到对应的 handler 进行处理,
|
|
199
199
|
handler 处理完成后:
|
|
200
|
-
- 传了 func: 调用函数的情况下 (通常是一元 rpc)
|
|
200
|
+
- 传了 func: 调用函数的情况下 (通常是一元 rpc,也有可能是仅 send),如果有 id,则总是将非 undefined 返回值包装为 message 回传
|
|
201
201
|
- 未传 func: 通过 id 调用,如果 handler 返回非 undefined 的值,也包装为 message 回传
|
|
202
202
|
|
|
203
203
|
如果 message.done == true 则对端指示当前 remote 可以清理 handler
|
package/net.common.js
CHANGED
|
@@ -446,7 +446,7 @@ export class Remote {
|
|
|
446
446
|
}
|
|
447
447
|
/** 处理接收到的 websocket message 并解析, 根据 message.id 或 message.func 分发到对应的 handler 进行处理,
|
|
448
448
|
handler 处理完成后:
|
|
449
|
-
- 传了 func: 调用函数的情况下 (通常是一元 rpc)
|
|
449
|
+
- 传了 func: 调用函数的情况下 (通常是一元 rpc,也有可能是仅 send),如果有 id,则总是将非 undefined 返回值包装为 message 回传
|
|
450
450
|
- 未传 func: 通过 id 调用,如果 handler 返回非 undefined 的值,也包装为 message 回传
|
|
451
451
|
|
|
452
452
|
如果 message.done == true 则对端指示当前 remote 可以清理 handler
|
|
@@ -484,7 +484,9 @@ export class Remote {
|
|
|
484
484
|
}
|
|
485
485
|
if (handler) {
|
|
486
486
|
const data = await handler(message, this);
|
|
487
|
-
|
|
487
|
+
// 有 id 才能回复(说明需要回复),有 func 一定回,否则根据 data 返回
|
|
488
|
+
// 单方 .send({ 无 id 消息 }) 说明不需要回,也没法回
|
|
489
|
+
if (id && (func || data !== undefined))
|
|
488
490
|
await this.send({ id, data });
|
|
489
491
|
}
|
|
490
492
|
else if (message.error)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xshell",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
57
57
|
"@svgr/webpack": "^8.1.0",
|
|
58
58
|
"@types/sass-loader": "^8.0.10",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^8.57.
|
|
60
|
-
"@typescript-eslint/parser": "^8.57.
|
|
61
|
-
"@typescript-eslint/utils": "^8.57.
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
60
|
+
"@typescript-eslint/parser": "^8.57.2",
|
|
61
|
+
"@typescript-eslint/utils": "^8.57.2",
|
|
62
62
|
"archiver": "^7.0.1",
|
|
63
63
|
"chalk": "^5.6.2",
|
|
64
64
|
"commander": "^14.0.3",
|
|
65
65
|
"css-loader": "^7.1.4",
|
|
66
66
|
"emoji-regex": "^10.6.0",
|
|
67
|
-
"eslint": "^10.0
|
|
67
|
+
"eslint": "^10.1.0",
|
|
68
68
|
"eslint-plugin-react": "^7.37.5",
|
|
69
69
|
"https-proxy-agent": "^8.0.0",
|
|
70
70
|
"i18next": "25.8.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"mime-types": "^3.0.2",
|
|
76
76
|
"p-map": "^7.0.4",
|
|
77
77
|
"react": "^19.2.4",
|
|
78
|
-
"react-i18next": "^16.
|
|
78
|
+
"react-i18next": "^16.6.2",
|
|
79
79
|
"resolve-path": "^1.4.0",
|
|
80
80
|
"sass": "^1.98.0",
|
|
81
81
|
"sass-loader": "^16.0.7",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
"tough-cookie": "^6.0.1",
|
|
86
86
|
"ts-loader": "^9.5.4",
|
|
87
87
|
"tslib": "^2.8.1",
|
|
88
|
-
"typescript": "^
|
|
89
|
-
"undici": "^7.24.
|
|
88
|
+
"typescript": "^6.0.2",
|
|
89
|
+
"undici": "^7.24.5",
|
|
90
90
|
"webpack": "^5.105.4",
|
|
91
91
|
"webpack-bundle-analyzer": "^5.2.0",
|
|
92
|
-
"ws": "^8.
|
|
92
|
+
"ws": "^8.20.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@babel/types": "^7.29.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@types/babel__traverse": "^7.28.0",
|
|
98
98
|
"@types/eslint": "^9.6.1",
|
|
99
99
|
"@types/estree": "^1.0.8",
|
|
100
|
-
"@types/koa": "^3.0.
|
|
100
|
+
"@types/koa": "^3.0.2",
|
|
101
101
|
"@types/koa-compress": "^4.0.7",
|
|
102
102
|
"@types/mime-types": "^3.0.1",
|
|
103
103
|
"@types/node": "^25.5.0",
|
package/polyfill.browser.js
CHANGED
package/process.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ export declare class CallError<TOutput extends string | Buffer = string> extends
|
|
|
144
144
|
constructor({ message, pid, stdout, stderr, code, signal, command, print }: CallResult<TOutput>);
|
|
145
145
|
[inspect.custom](depth: number, options: InspectOptions, inspect: Function): string;
|
|
146
146
|
}
|
|
147
|
-
/** 调用 exe
|
|
147
|
+
/** 调用 exe 启动子进程,等待并获取返回结果和输出,错误时抛出 CallError
|
|
148
148
|
- exe: exe 路径或文件名 (建议使用路径,跳过 path 搜索,性能更高)
|
|
149
149
|
- args?: `[ ]` 参数列表
|
|
150
150
|
- options?: {@link CallOptions} 继承自 {@link BaseOptions}
|
package/server.d.ts
CHANGED
|
@@ -161,7 +161,7 @@ export declare class Server {
|
|
|
161
161
|
- options?:
|
|
162
162
|
- fpd_root?: 只能访问 fpd_root 下面的文件
|
|
163
163
|
- absolute?: `false` 使用绝对路径指定发送的文件
|
|
164
|
-
- download?: `
|
|
164
|
+
- download?: `false` 在 response.headers 中加上 content-disposition: attachment 指示浏览器下载文件
|
|
165
165
|
- assets_root?: 替换模板 xxx.template.html 中 {root} 占位符 */
|
|
166
166
|
fsend(ctx: Context, fp: string, { fpd_root, absolute, download, assets_root, sea: _sea }?: {
|
|
167
167
|
fpd_root?: string;
|
package/server.js
CHANGED
|
@@ -688,7 +688,7 @@ export class Server {
|
|
|
688
688
|
- options?:
|
|
689
689
|
- fpd_root?: 只能访问 fpd_root 下面的文件
|
|
690
690
|
- absolute?: `false` 使用绝对路径指定发送的文件
|
|
691
|
-
- download?: `
|
|
691
|
+
- download?: `false` 在 response.headers 中加上 content-disposition: attachment 指示浏览器下载文件
|
|
692
692
|
- assets_root?: 替换模板 xxx.template.html 中 {root} 占位符 */
|
|
693
693
|
async fsend(ctx, fp, { fpd_root, absolute, download, assets_root, sea: _sea = sea } = {}) {
|
|
694
694
|
check(absolute || _sea || fpd_root?.isdir, t('fsend 必须传 absolute 选项, sea 选项, 或 fpd_root 文件夹'));
|
package/toaster.browser.js
CHANGED
package/tsconfig.json
CHANGED
|
@@ -5,15 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
"compilerOptions": {
|
|
7
7
|
// --- module
|
|
8
|
-
"module": "
|
|
9
|
-
"moduleResolution": "
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
10
|
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"esModuleInterop": false,
|
|
12
11
|
"resolveJsonModule": true,
|
|
13
12
|
"isolatedModules": true,
|
|
14
13
|
|
|
15
14
|
// --- build
|
|
16
|
-
"target": "
|
|
15
|
+
"target": "esnext",
|
|
17
16
|
"allowJs": false,
|
|
18
17
|
"checkJs": false,
|
|
19
18
|
"pretty": true,
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
|
|
51
50
|
// --- type checking
|
|
52
51
|
"strict": false,
|
|
53
|
-
"alwaysStrict": false,
|
|
54
52
|
"noImplicitAny": false,
|
|
55
53
|
"noImplicitReturns": false,
|
|
56
54
|
"noImplicitThis": true,
|
package/xlint.js
CHANGED
|
@@ -775,8 +775,8 @@ export const xlint_config = {
|
|
|
775
775
|
projectService: true,
|
|
776
776
|
ecmaFeatures: {
|
|
777
777
|
jsx: true
|
|
778
|
-
}
|
|
779
|
-
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
780
|
},
|
|
781
781
|
plugins: {
|
|
782
782
|
'@typescript-eslint': ts_plugin,
|
|
@@ -1044,7 +1044,7 @@ function format_source(pkgs, aliases, cwd, fp, source) {
|
|
|
1044
1044
|
if (fext && fext !== 'js')
|
|
1045
1045
|
return ['subpath'];
|
|
1046
1046
|
source = source.strip_if_end('.js');
|
|
1047
|
-
return ['subpath', `${source}
|
|
1047
|
+
return ['subpath', `${source}${resolve_suffix(path.resolve(fp.fdir, source))}`];
|
|
1048
1048
|
}
|
|
1049
1049
|
// ../ 父级路径,或者 @/... 等 alias 路径
|
|
1050
1050
|
// 先 resolve 到完整路径,再修复后缀,最后通过 alias 简化
|
|
@@ -1056,7 +1056,7 @@ function format_source(pkgs, aliases, cwd, fp, source) {
|
|
|
1056
1056
|
const { fext } = source;
|
|
1057
1057
|
if (!fext || fext === 'js') {
|
|
1058
1058
|
source = source.strip_if_end('.js');
|
|
1059
|
-
source = `${source}
|
|
1059
|
+
source = `${source}${resolve_suffix(source)}`;
|
|
1060
1060
|
}
|
|
1061
1061
|
const relative = source.strip_start(cwd, true);
|
|
1062
1062
|
const ialias = aliases.findIndex(({ fp }) => relative.startsWith(fp));
|
|
@@ -1066,8 +1066,8 @@ function format_source(pkgs, aliases, cwd, fp, source) {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
let cache_exists = new Map();
|
|
1068
1068
|
function resolve_suffix(fp_base) {
|
|
1069
|
-
for (const suffix of ['ts', 'tsx']) {
|
|
1070
|
-
const fp = `${fp_base}
|
|
1069
|
+
for (const suffix of ['.ts', '.tsx', '/index.ts', '/index.tsx']) {
|
|
1070
|
+
const fp = `${fp_base}${suffix}`;
|
|
1071
1071
|
const c = cache_exists.get(fp);
|
|
1072
1072
|
if (c !== undefined)
|
|
1073
1073
|
if (c)
|