xshell 1.2.88 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.88",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -49,66 +49,63 @@
49
49
  ]
50
50
  },
51
51
  "dependencies": {
52
- "@babel/core": "^7.28.4",
53
- "@babel/parser": "^7.28.4",
54
- "@babel/traverse": "^7.28.4",
52
+ "@babel/core": "^7.28.5",
53
+ "@babel/parser": "^7.28.5",
54
+ "@babel/traverse": "^7.28.5",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^5.3.1",
56
+ "@stylistic/eslint-plugin": "^5.5.0",
57
57
  "@svgr/webpack": "^8.1.0",
58
- "@types/sass-loader": "^8.0.9",
59
- "@types/ws": "^8.18.1",
60
- "@typescript-eslint/eslint-plugin": "^8.43.0",
61
- "@typescript-eslint/parser": "^8.43.0",
62
- "@typescript-eslint/utils": "^8.43.0",
58
+ "@types/sass-loader": "^8.0.10",
59
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
60
+ "@typescript-eslint/parser": "^8.46.2",
61
+ "@typescript-eslint/utils": "^8.46.2",
63
62
  "archiver": "^7.0.1",
64
63
  "chalk": "^5.6.2",
65
- "commander": "^14.0.1",
64
+ "commander": "^14.0.2",
66
65
  "css-loader": "^7.1.2",
67
- "emoji-regex": "^10.5.0",
68
- "eslint": "^9.35.0",
66
+ "emoji-regex": "^10.6.0",
67
+ "eslint": "^9.38.0",
69
68
  "eslint-plugin-import": "^2.32.0",
70
69
  "eslint-plugin-react": "^7.37.5",
71
70
  "https-proxy-agent": "^7.0.6",
72
- "i18next": "^25.5.2",
71
+ "i18next": "^25.6.0",
73
72
  "i18next-scanner": "^4.6.0",
74
- "koa": "^3.0.1",
73
+ "koa": "^3.1.1",
75
74
  "koa-compress": "^5.1.1",
76
75
  "license-webpack-plugin": "^4.0.2",
77
- "map-stream": "^0.0.7",
78
76
  "mime-types": "^3.0.1",
79
77
  "p-map": "^7.0.3",
80
- "react": "^19.1.1",
81
- "react-i18next": "^15.7.3",
78
+ "react": "^19.2.0",
79
+ "react-i18next": "^16.2.1",
82
80
  "resolve-path": "^1.4.0",
83
- "sass": "^1.92.1",
84
- "sass-loader": "^16.0.5",
81
+ "sass": "^1.93.2",
82
+ "sass-loader": "^16.0.6",
85
83
  "source-map-loader": "^5.0.0",
86
84
  "strip-ansi": "^7.1.2",
87
85
  "style-loader": "^4.0.0",
88
86
  "tough-cookie": "^6.0.0",
89
87
  "ts-loader": "^9.5.4",
90
88
  "tslib": "^2.8.1",
91
- "typescript": "^5.9.2",
92
- "ua-parser-js": "^2.0.5",
89
+ "typescript": "^5.9.3",
93
90
  "undici": "^7.16.0",
94
- "webpack": "^5.101.3",
91
+ "webpack": "^5.102.1",
95
92
  "webpack-bundle-analyzer": "^4.10.2",
96
93
  "ws": "^8.18.3"
97
94
  },
98
95
  "devDependencies": {
99
- "@babel/types": "^7.28.4",
100
- "@types/archiver": "^6.0.3",
96
+ "@babel/types": "^7.28.5",
97
+ "@types/archiver": "^7.0.0",
101
98
  "@types/babel__traverse": "^7.28.0",
102
99
  "@types/eslint": "^9.6.1",
103
100
  "@types/estree": "^1.0.8",
104
- "@types/koa": "^3.0.0",
105
- "@types/koa-compress": "^4.0.6",
101
+ "@types/koa": "^3.0.1",
102
+ "@types/koa-compress": "^4.0.7",
106
103
  "@types/mime-types": "^3.0.1",
107
- "@types/node": "^24.3.3",
108
- "@types/react": "^19.1.13",
104
+ "@types/node": "^24.9.2",
105
+ "@types/react": "^19.2.2",
109
106
  "@types/tough-cookie": "^4.0.5",
110
- "@types/ua-parser-js": "^0.7.39",
111
- "@types/vscode": "^1.104.0",
112
- "@types/webpack-bundle-analyzer": "^4.7.0"
107
+ "@types/vscode": "^1.105.0",
108
+ "@types/webpack-bundle-analyzer": "^4.7.0",
109
+ "@types/ws": "^8.18.1"
113
110
  }
114
111
  }
package/path.d.ts CHANGED
@@ -54,7 +54,7 @@ export declare function extname(path: string): string;
54
54
  /** `/` */
55
55
  export declare const sep = "/";
56
56
  /** The platform-specific file delimiter. ';' or ':'. */
57
- export declare const delimiter: ":" | ";";
57
+ export declare const delimiter: ";" | ":";
58
58
  /** Returns an object from a path string - the opposite of format().
59
59
  @param path path to evaluate.
60
60
  @throws {TypeError} if `path` is not a string. */
@@ -81,7 +81,7 @@ export declare let path: {
81
81
  basename: typeof basename;
82
82
  extname: typeof extname;
83
83
  sep: string;
84
- delimiter: ":" | ";";
84
+ delimiter: ";" | ":";
85
85
  parse: typeof parse;
86
86
  format: typeof format;
87
87
  toNamespacedPath: typeof toNamespacedPath;
@@ -23,9 +23,17 @@ async function delay(milliseconds, { signal } = {}) {
23
23
  });
24
24
  }
25
25
  set_platform({
26
+ nodejs: false,
27
+ browser: true,
26
28
  get_buffer,
27
29
  encode,
28
30
  delay,
29
- strip_ansi: ident
31
+ strip_ansi: ident,
32
+ get_websocket() {
33
+ return globalThis.WebSocket;
34
+ },
35
+ get_https_proxy_agent() {
36
+ return null;
37
+ }
30
38
  });
31
39
  //# sourceMappingURL=platform.browser.js.map
@@ -1,10 +1,19 @@
1
1
  import type { TimerOptions } from 'timers';
2
+ import type { HttpsProxyAgent } from 'https-proxy-agent';
2
3
  export declare let platform: Platform;
3
4
  export declare function set_platform(_platform: Platform): void;
4
5
  interface Platform {
6
+ /** 在 nodejs 环境中 */
7
+ nodejs: boolean;
8
+ /** 在 browser 环境中 */
9
+ browser: boolean;
5
10
  get_buffer(length: number): Uint8Array;
6
11
  encode(str: string): Uint8Array;
7
12
  delay(milliseconds: number, options?: TimerOptions): Promise<void>;
8
13
  strip_ansi(str: string): string;
14
+ /** 根据环境返回 ws 包的 WebSocket 或者浏览器全局的 WebSocket */
15
+ get_websocket(): Promise<typeof WebSocket> | typeof WebSocket;
16
+ /** (仅 nodejs 环境有) */
17
+ get_https_proxy_agent?(): Promise<typeof HttpsProxyAgent>;
9
18
  }
10
19
  export {};
package/platform.js CHANGED
@@ -13,9 +13,19 @@ async function delay(milliseconds, options) {
13
13
  return timers.setTimeout(milliseconds, undefined, options);
14
14
  }
15
15
  set_platform({
16
+ nodejs: true,
17
+ browser: false,
16
18
  get_buffer,
17
19
  encode,
18
20
  delay,
19
- strip_ansi
21
+ strip_ansi,
22
+ async get_websocket() {
23
+ return (await import('ws'))
24
+ .WebSocket;
25
+ },
26
+ async get_https_proxy_agent() {
27
+ return (await import('https-proxy-agent'))
28
+ .HttpsProxyAgent;
29
+ }
20
30
  });
21
31
  //# sourceMappingURL=platform.js.map
@@ -163,7 +163,7 @@ declare global {
163
163
  to_formal_str(this: Date, ms?: boolean): string;
164
164
  }
165
165
  interface Number {
166
- /** 12.4 kb (1 kb = 1024 b) */
166
+ /** 12 kb (1 kb = 1024 b) */
167
167
  to_fsize_str(this: number): string;
168
168
  to_bin_str(this: number): string;
169
169
  /** 转换为 0x???? 这样的十六进制形式
@@ -201,7 +201,7 @@ declare global {
201
201
  join_lines(append?: boolean): string;
202
202
  }
203
203
  interface BigInt {
204
- /** 12.4 kb (1 kb = 1024 b) */
204
+ /** 12 kb (1 kb = 1024 b) */
205
205
  to_fsize_str(this: bigint): string;
206
206
  toJSON(this: bigint): string;
207
207
  }
@@ -511,12 +511,8 @@ if (!globalThis.my_prototype_defined) {
511
511
  if (rm_empty_lines)
512
512
  return lines.filter(Boolean);
513
513
  if (rm_last_empty_lines) {
514
- lines.reverse();
515
- const i_not_empty = lines.findIndex(Boolean);
516
- if (i_not_empty !== -1)
517
- lines = lines.slice(i_not_empty);
518
- lines.reverse();
519
- return lines;
514
+ const index = lines.findLastIndex(Boolean);
515
+ return index === -1 ? [] : lines.slice(0, index + 1);
520
516
  }
521
517
  return lines;
522
518
  },
@@ -628,10 +624,14 @@ const bytes_table = units.map((unit, i) => ({
628
624
  }));
629
625
  export function byte_size(bytes) {
630
626
  bytes = Number(bytes);
627
+ if (Number.isNaN(bytes)) {
628
+ console.error(new Error('Number.byte_size() 不能传入 NaN'));
629
+ return '';
630
+ }
631
631
  const sign = bytes < 0 ? '-' : '';
632
632
  bytes = Math.abs(bytes);
633
- const { unit, start } = bytes_table.find(range => bytes >= range.start && bytes < range.end);
634
- return `${sign}${start === 0 ? bytes : (bytes / start).toFixed()} ${unit}`;
633
+ const { unit, start } = bytes_table.find(range => range.start <= bytes && bytes < range.end);
634
+ return `${sign}${(start === 0 ? bytes : bytes / start).toFixed()} ${unit}`;
635
635
  }
636
636
  export function is_codepoint_fullwidth(codepoint) {
637
637
  // code points are derived from: