xshell 1.3.29 → 1.3.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.3.29",
3
+ "version": "1.3.30",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -49,16 +49,16 @@
49
49
  ]
50
50
  },
51
51
  "dependencies": {
52
- "@babel/core": "^7.28.5",
53
- "@babel/parser": "^7.28.5",
54
- "@babel/traverse": "^7.28.5",
52
+ "@babel/core": "^7.28.6",
53
+ "@babel/parser": "^7.28.6",
54
+ "@babel/traverse": "^7.28.6",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^5.6.1",
56
+ "@stylistic/eslint-plugin": "^5.7.0",
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.10",
59
- "@typescript-eslint/eslint-plugin": "^8.52.0",
60
- "@typescript-eslint/parser": "^8.52.0",
61
- "@typescript-eslint/utils": "^8.52.0",
59
+ "@typescript-eslint/eslint-plugin": "^8.53.0",
60
+ "@typescript-eslint/parser": "^8.53.0",
61
+ "@typescript-eslint/utils": "^8.53.0",
62
62
  "archiver": "^7.0.1",
63
63
  "chalk": "^5.6.2",
64
64
  "commander": "^14.0.2",
@@ -68,7 +68,7 @@
68
68
  "eslint-plugin-import": "^2.32.0",
69
69
  "eslint-plugin-react": "^7.37.5",
70
70
  "https-proxy-agent": "^7.0.6",
71
- "i18next": "^25.7.3",
71
+ "i18next": "^25.7.4",
72
72
  "i18next-scanner": "^4.6.0",
73
73
  "koa": "^3.1.1",
74
74
  "koa-compress": "^5.1.1",
@@ -76,7 +76,7 @@
76
76
  "mime-types": "^3.0.2",
77
77
  "p-map": "^7.0.4",
78
78
  "react": "^19.2.3",
79
- "react-i18next": "^16.5.1",
79
+ "react-i18next": "^16.5.3",
80
80
  "resolve-path": "^1.4.0",
81
81
  "sass": "^1.97.2",
82
82
  "sass-loader": "^16.0.6",
@@ -89,11 +89,11 @@
89
89
  "typescript": "^5.9.3",
90
90
  "undici": "^7.18.2",
91
91
  "webpack": "^5.104.1",
92
- "webpack-bundle-analyzer": "^5.1.0",
92
+ "webpack-bundle-analyzer": "^5.1.1",
93
93
  "ws": "^8.19.0"
94
94
  },
95
95
  "devDependencies": {
96
- "@babel/types": "^7.28.5",
96
+ "@babel/types": "^7.28.6",
97
97
  "@types/archiver": "^7.0.0",
98
98
  "@types/babel__traverse": "^7.28.0",
99
99
  "@types/eslint": "^9.6.1",
@@ -101,10 +101,10 @@
101
101
  "@types/koa": "^3.0.1",
102
102
  "@types/koa-compress": "^4.0.7",
103
103
  "@types/mime-types": "^3.0.1",
104
- "@types/node": "^25.0.3",
105
- "@types/react": "^19.2.7",
104
+ "@types/node": "^25.0.8",
105
+ "@types/react": "^19.2.8",
106
106
  "@types/tough-cookie": "^4.0.5",
107
- "@types/vscode": "^1.107.0",
107
+ "@types/vscode": "^1.108.1",
108
108
  "@types/webpack-bundle-analyzer": "^4.7.0",
109
109
  "@types/ws": "^8.18.1"
110
110
  }
@@ -179,10 +179,10 @@ declare global {
179
179
  sum<TKey extends keyof T>(this: T[], zero: T[TKey], mapper: TKey): T[TKey];
180
180
  sum<TMapper extends Mapper<T>>(this: T[], zero: ReturnType<TMapper>, mapper: TMapper): ReturnType<TMapper>;
181
181
  sum<TReturn = T>(this: T[], zero: TReturn, mapper?: keyof T | Mapper<T>): TReturn;
182
- /** 查找数组中最大的元素,可传入 mapper 计算出某个值,用作大小比较 */
183
- max(this: T[], mapper?: keyof T | Mapper<T>): T;
184
- /** 查找数组中最小的元素,可传入 mapper 计算出某个值,用作大小比较 */
185
- min(this: T[], mapper?: keyof T | Mapper<T>): T;
182
+ /** 查找数组中最大的元素,可传入 mapper 计算出某个值,用作大小比较,可传 greater 定义大于逻辑 (计算之后的值) */
183
+ max(this: T[], mapper?: keyof T | Mapper<T>, greater?: Greater): T;
184
+ /** 查找数组中最小的元素,可传入 mapper 计算出某个值,用作大小比较,可设置 less 定义小于逻辑 (计算之后的值) */
185
+ min(this: T[], mapper?: keyof T | Mapper<T>, less?: Less): T;
186
186
  /** 去除重复元素(可按 mapper 选择或计算某个值来去重),重复值保留最后出现的那个
187
187
  - mapper?: 可以是 key (string, number, symbol) 或 (obj: any) => any */
188
188
  unique(this: T[], mapper?: keyof T | Mapper<T>): T[];
@@ -232,6 +232,10 @@ export declare const empty: (value: any) => boolean;
232
232
  export declare const is_key_type: IsKeyType;
233
233
  type IsKeyType = (key: any) => key is string | number | symbol;
234
234
  export declare function rethrow(error: Error): void;
235
+ export type Greater<T = any> = (a: T, b: T) => boolean;
236
+ export declare const greater: Greater;
237
+ export type Less = Greater;
238
+ export declare const less: Less;
235
239
  export declare function to_snake_case(str: string): string;
236
240
  export declare function to_space_case(str: string): string;
237
241
  export declare function to_method_property_descriptors(methods: {
@@ -14,6 +14,8 @@ export const is_key_type = ((key) => key_types.includes(typeof key));
14
14
  export function rethrow(error) {
15
15
  throw error;
16
16
  }
17
+ export const greater = (a, b) => a > b;
18
+ export const less = (a, b) => a < b;
17
19
  export function to_snake_case(str) {
18
20
  return str.replace(/([A-Z])/g, '_$1')
19
21
  .toLowerCase()
@@ -532,32 +534,32 @@ if (!globalThis.my_prototype_defined) {
532
534
  mapper ??= ident;
533
535
  return this.reduce((acc, x) => acc + mapper(x), zero);
534
536
  },
535
- max(mapper = ident) {
537
+ max(mapper = ident, _greater = greater) {
536
538
  if (!this.length)
537
539
  return undefined;
538
540
  if (is_key_type(mapper))
539
541
  mapper = select(mapper);
540
542
  let max = mapper(this[0]);
541
543
  let imax = 0;
542
- for (let i = 0; i < this.length; i++) {
544
+ for (let i = 1; i < this.length; i++) {
543
545
  const value = mapper(this[i]);
544
- if (value > max) {
546
+ if (_greater(value, max)) {
545
547
  max = value;
546
548
  imax = i;
547
549
  }
548
550
  }
549
551
  return this[imax];
550
552
  },
551
- min(mapper = ident) {
553
+ min(mapper = ident, _less = less) {
552
554
  if (!this.length)
553
555
  return undefined;
554
556
  if (is_key_type(mapper))
555
557
  mapper = select(mapper);
556
558
  let min = mapper(this[0]);
557
559
  let imin = 0;
558
- for (let i = 0; i < this.length; i++) {
560
+ for (let i = 1; i < this.length; i++) {
559
561
  const value = mapper(this[i]);
560
- if (value < min) {
562
+ if (_less(value, min)) {
561
563
  min = value;
562
564
  imin = i;
563
565
  }
package/server.d.ts CHANGED
@@ -46,6 +46,7 @@ export declare class Server {
46
46
  /** platform_version (1 ~ 8) - 1 作为索引下标 */
47
47
  win10: string[];
48
48
  };
49
+ static ignore_error_codes: Set<string>;
49
50
  app: Koa;
50
51
  handler: ReturnType<Koa['callback']>;
51
52
  /** 启用 http server */
package/server.js CHANGED
@@ -57,6 +57,7 @@ export class Server {
57
57
  'win10 1909',
58
58
  ]
59
59
  };
60
+ static ignore_error_codes = new Set(['ERR_STREAM_PREMATURE_CLOSE', 'EPIPE', 'ECONNRESET']);
60
61
  app;
61
62
  handler;
62
63
  /** 启用 http server */
@@ -260,14 +261,11 @@ export class Server {
260
261
  on_error(error, ctx) {
261
262
  if (!this.print.errors)
262
263
  return;
263
- const code = error?.code;
264
- if (code === 'EPIPE' || code === 'ECONNRESET')
265
- console.log(`${error.code}:`, ctx?.request?.url);
266
- else {
267
- console.error(error);
268
- if (ctx)
269
- console.log('ctx:', ctx);
270
- }
264
+ if (Server.ignore_error_codes.has(error?.code))
265
+ return;
266
+ console.error(error);
267
+ if (ctx)
268
+ console.log('ctx:', ctx);
271
269
  }
272
270
  on_upgrade(request, socket, head) {
273
271
  // url 只有路径部分