xshell 1.2.43 → 1.2.45

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.2.43",
3
+ "version": "1.2.45",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -49,17 +49,17 @@
49
49
  ]
50
50
  },
51
51
  "dependencies": {
52
- "@babel/core": "^7.27.1",
53
- "@babel/parser": "^7.27.2",
54
- "@babel/traverse": "^7.27.1",
52
+ "@babel/core": "^7.27.3",
53
+ "@babel/parser": "^7.27.3",
54
+ "@babel/traverse": "^7.27.3",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^4.2.0",
56
+ "@stylistic/eslint-plugin": "^4.4.0",
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.9",
59
59
  "@types/ws": "^8.18.1",
60
- "@typescript-eslint/eslint-plugin": "^8.32.1",
61
- "@typescript-eslint/parser": "^8.32.1",
62
- "@typescript-eslint/utils": "^8.32.1",
60
+ "@typescript-eslint/eslint-plugin": "^8.33.0",
61
+ "@typescript-eslint/parser": "^8.33.0",
62
+ "@typescript-eslint/utils": "^8.33.0",
63
63
  "archiver": "^7.0.1",
64
64
  "chalk": "^5.4.1",
65
65
  "cli-table3": "^0.6.5",
@@ -72,7 +72,7 @@
72
72
  "eslint-plugin-react": "^7.37.5",
73
73
  "gulp-sort": "^2.0.0",
74
74
  "https-proxy-agent": "^7.0.6",
75
- "i18next": "^25.2.0",
75
+ "i18next": "^25.2.1",
76
76
  "i18next-scanner": "^4.6.0",
77
77
  "koa": "^3.0.0",
78
78
  "koa-compress": "^5.1.1",
@@ -81,7 +81,7 @@
81
81
  "mime-types": "^3.0.1",
82
82
  "ora": "^8.2.0",
83
83
  "react": "^19.1.0",
84
- "react-i18next": "^15.5.1",
84
+ "react-i18next": "^15.5.2",
85
85
  "react-object-model": "^1.2.24",
86
86
  "resolve-path": "^1.4.0",
87
87
  "sass": "^1.89.0",
@@ -95,15 +95,15 @@
95
95
  "tslib": "^2.8.1",
96
96
  "typescript": "^5.8.3",
97
97
  "ua-parser-js": "^2.0.3",
98
- "undici": "^7.9.0",
98
+ "undici": "^7.10.0",
99
99
  "vinyl": "^3.0.0",
100
100
  "vinyl-fs": "^4.0.0",
101
- "webpack": "^5.99.8",
101
+ "webpack": "^5.99.9",
102
102
  "webpack-bundle-analyzer": "^4.10.2",
103
103
  "ws": "^8.18.2"
104
104
  },
105
105
  "devDependencies": {
106
- "@babel/types": "^7.27.1",
106
+ "@babel/types": "^7.27.3",
107
107
  "@types/archiver": "^6.0.3",
108
108
  "@types/babel__traverse": "^7.20.7",
109
109
  "@types/eslint": "^9.6.1",
@@ -112,8 +112,8 @@
112
112
  "@types/koa": "^2.15.0",
113
113
  "@types/koa-compress": "^4.0.6",
114
114
  "@types/mime-types": "^2.1.4",
115
- "@types/node": "^22.15.19",
116
- "@types/react": "^19.1.4",
115
+ "@types/node": "^22.15.26",
116
+ "@types/react": "^19.1.6",
117
117
  "@types/through2": "^2.0.41",
118
118
  "@types/tough-cookie": "^4.0.5",
119
119
  "@types/ua-parser-js": "^0.7.39",
@@ -170,7 +170,9 @@ declare global {
170
170
  last: T;
171
171
  indent(this: string[], width?: number, c?: string): string[];
172
172
  /** 对数组中所有元素求和 (+), 返回结果,可传入 mapper 计算出某个值,用作求和 */
173
- sum<TReturn = T>(this: T[], mapper?: keyof T | Mapper<T>): TReturn;
173
+ sum<TKey extends keyof T>(this: T[], zero: T[TKey], mapper: TKey): T[TKey];
174
+ sum<TMapper extends Mapper<T>>(this: T[], zero: ReturnType<TMapper>, mapper: TMapper): ReturnType<TMapper>;
175
+ sum<TReturn = T>(this: T[], zero: TReturn, mapper?: keyof T | Mapper<T>): TReturn;
174
176
  /** 查找数组中最大的元素,可传入 mapper 计算出某个值,用作大小比较 */
175
177
  max(this: T[], mapper?: keyof T | Mapper<T>): T;
176
178
  /** 查找数组中最小的元素,可传入 mapper 计算出某个值,用作大小比较 */
@@ -214,7 +216,7 @@ interface SliceOptions {
214
216
  export declare const emoji_regex: RegExp;
215
217
  export declare const noop: () => void;
216
218
  export declare const ident: <T>(x: T) => T;
217
- export declare const build_mapper: <TObj, TKey extends keyof TObj>(key: TKey) => (obj: TObj) => TObj[TKey];
219
+ export declare const build_mapper: <TObj = any, TKey extends keyof TObj = keyof TObj>(key: TKey) => (obj: TObj) => TObj[TKey];
218
220
  export type Mapper<TObj = any, TKey extends keyof TObj = keyof TObj> = (obj: TObj) => TObj[TKey];
219
221
  /** value 不为 null 或 undefined */
220
222
  export declare const not_empty: (value: any) => boolean;
@@ -501,17 +501,17 @@ Object.defineProperties(Array.prototype, {
501
501
  const indent = character.repeat(width);
502
502
  return this.map(line => indent + line);
503
503
  },
504
- sum(mapper) {
504
+ sum(zero, mapper) {
505
505
  if (!this.length)
506
506
  return undefined;
507
507
  // 快捷路径
508
508
  const first = this[0];
509
509
  if ((typeof first === 'number' || typeof first === 'bigint') && !mapper)
510
- return this.reduce((acc, x) => acc + x, first);
510
+ return this.reduce((acc, x) => acc + x, zero);
511
511
  if (is_key_type(mapper))
512
512
  mapper = build_mapper(mapper);
513
513
  mapper ??= ident;
514
- return this.reduce((acc, x) => acc + mapper(x), mapper(first));
514
+ return this.reduce((acc, x) => acc + mapper(x), zero);
515
515
  },
516
516
  max(mapper = ident) {
517
517
  if (!this.length)
package/prototype.d.ts CHANGED
@@ -195,7 +195,9 @@ declare global {
195
195
  indent(this: string[], width?: number, c?: string): string[];
196
196
  indent2to4(this: string[]): string[];
197
197
  /** 对数组中所有元素求和 (+), 返回结果,可传入 mapper 计算出某个值,用作求和 */
198
- sum<TReturn = T>(this: T[], mapper?: keyof T | Mapper<T>): TReturn;
198
+ sum<TKey extends keyof T>(this: T[], zero: T[TKey], mapper: TKey): T[TKey];
199
+ sum<TMapper extends Mapper<T>>(this: T[], zero: ReturnType<TMapper>, mapper: TMapper): ReturnType<TMapper>;
200
+ sum<TReturn = T>(this: T[], zero: TReturn, mapper?: keyof T | Mapper<T>): TReturn;
199
201
  /** 查找数组中最大的元素,可传入 mapper 计算出某个值,用作大小比较 */
200
202
  max(this: T[], mapper?: keyof T | Mapper<T>): T;
201
203
  /** 查找数组中最小的元素,可传入 mapper 计算出某个值,用作大小比较 */
@@ -244,7 +246,7 @@ interface SliceOptions {
244
246
  export declare const emoji_regex: RegExp;
245
247
  export declare const noop: () => void;
246
248
  export declare const ident: <T>(x: T) => T;
247
- export declare const build_mapper: <TObj, TKey extends keyof TObj>(key: TKey) => (obj: TObj) => TObj[TKey];
249
+ export declare const build_mapper: <TObj = any, TKey extends keyof TObj = keyof TObj>(key: TKey) => (obj: TObj) => TObj[TKey];
248
250
  export type Mapper<TObj = any, TKey extends keyof TObj = keyof TObj> = (obj: TObj) => TObj[TKey];
249
251
  /** value 不为 null 或 undefined */
250
252
  export declare const not_empty: (value: any) => boolean;
package/prototype.js CHANGED
@@ -574,17 +574,17 @@ if (!globalThis.my_prototype_defined) {
574
574
  return this.split_indents()
575
575
  .map(line => ' '.repeat(line.indent * 2) + line.text);
576
576
  },
577
- sum(mapper) {
577
+ sum(zero, mapper) {
578
578
  if (!this.length)
579
579
  return undefined;
580
580
  // 快捷路径
581
581
  const first = this[0];
582
582
  if ((typeof first === 'number' || typeof first === 'bigint') && !mapper)
583
- return this.reduce((acc, x) => acc + x, first);
583
+ return this.reduce((acc, x) => acc + x, zero);
584
584
  if (is_key_type(mapper))
585
585
  mapper = build_mapper(mapper);
586
586
  mapper ??= ident;
587
- return this.reduce((acc, x) => acc + mapper(x), mapper(first));
587
+ return this.reduce((acc, x) => acc + mapper(x), zero);
588
588
  },
589
589
  max(mapper = ident) {
590
590
  if (!this.length)