xshell 1.3.60 → 1.3.63

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.
Files changed (57) hide show
  1. package/antd.development.js +4105 -4328
  2. package/antd.development.js.map +1 -1
  3. package/antd.production.js +973 -1149
  4. package/antd.production.js.map +1 -1
  5. package/antd.sass +7 -0
  6. package/apps.js +1 -1
  7. package/builder.js +5 -5
  8. package/development.js +2 -2
  9. package/fflate.js +1 -1
  10. package/file.d.ts +4 -4
  11. package/file.js +7 -7
  12. package/fzip.js +4 -4
  13. package/git.d.ts +2 -2
  14. package/git.js +3 -3
  15. package/i18n/i18n-scan.js +2 -2
  16. package/i18n/index.d.ts +1 -1
  17. package/i18n/index.js +1 -1
  18. package/i18n/instance.js +1 -1
  19. package/i18n/rwdict.d.ts +9 -9
  20. package/i18n/rwdict.js +2 -2
  21. package/i18n/scanner/index.d.ts +3 -3
  22. package/i18n/scanner/index.js +8 -8
  23. package/i18n/scanner/parser.js +1 -1
  24. package/index.js +7 -7
  25. package/io.common.js +2 -2
  26. package/net.browser.js +4 -4
  27. package/net.common.d.ts +2 -2
  28. package/net.common.js +5 -5
  29. package/net.d.ts +12 -9
  30. package/net.js +17 -10
  31. package/package.json +11 -11
  32. package/platform.browser.js +4 -4
  33. package/platform.common.d.ts +2 -2
  34. package/platform.js +2 -2
  35. package/process.d.ts +3 -2
  36. package/process.js +4 -4
  37. package/prototype.browser.js +2 -2
  38. package/prototype.common.d.ts +8 -8
  39. package/prototype.common.js +2 -2
  40. package/prototype.js +3 -3
  41. package/react.development.js +35 -35
  42. package/react.development.js.map +1 -1
  43. package/react.production.js +34 -34
  44. package/react.production.js.map +1 -1
  45. package/repl.js +6 -13
  46. package/server.d.ts +2 -2
  47. package/server.js +5 -5
  48. package/storage.d.ts +1 -1
  49. package/toaster.browser.d.ts +2 -2
  50. package/toaster.browser.js +1 -1
  51. package/utils.browser.js +4 -4
  52. package/utils.common.d.ts +9 -8
  53. package/utils.common.js +15 -4
  54. package/utils.d.ts +6 -4
  55. package/utils.js +4 -4
  56. package/xlint.js +2 -2
  57. package/xshell.js +1 -1
package/antd.sass CHANGED
@@ -14,3 +14,10 @@
14
14
 
15
15
  .ant-splitter .ant-splitter-panel
16
16
  scrollbar-width: unset
17
+
18
+ .ant-tooltip
19
+ max-width: 800px
20
+ white-space: break-spaces
21
+
22
+ .empty-placeholder
23
+ height: 80px
package/apps.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import util from 'node:util';
2
- import { call_nodejs, platform, username } from "./process.js";
2
+ import { call_nodejs, platform, username } from './process.js';
3
3
  export let npm = {
4
4
  bin: platform == 'win32' ? `C:/Users/${username}/AppData/Roaming/npm/node_modules/pnpm/bin/pnpm.cjs` : '/usr/bin/pnpm',
5
5
  async call(cwd, bin, args, options) {
package/builder.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { fileURLToPath } from 'node:url';
2
- import { not_empty } from "./prototype.js";
3
- import { noprint } from "./process.js";
4
- import { Lock, check, filter_values } from "./utils.js";
5
- import { fcopy, fmkdir, fwrite, print_info, ramdisk, fread_lines } from "./file.js";
6
- import { path } from "./path.js";
2
+ import { not_empty } from './prototype.js';
3
+ import { noprint } from './process.js';
4
+ import { Lock, check, filter_values } from './utils.js';
5
+ import { fcopy, fmkdir, fwrite, print_info, ramdisk, fread_lines } from './file.js';
6
+ import { path } from './path.js';
7
7
  const get_target = (production) => production ? 'production' : 'development';
8
8
  function get_react_js(production, src, map) {
9
9
  return `${src ? import.meta.dirname.fpd : 'vendors/react/'}react.${get_target(production)}.js${map ? '.map' : ''}`;
package/development.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import process from 'node:process';
2
- import { fcopy, fexists, ramdisk } from "./file.js";
3
- import { noprint } from "./process.js";
2
+ import { fcopy, fexists, ramdisk } from './file.js';
3
+ import { noprint } from './process.js';
4
4
  /** 监听终端按键 (输入),并调用 key_processor 处理
5
5
  - on_key: 按键处理函数
6
6
  - on_exit?: ctrl + c 会退出进程,可加入退出前自定义处理逻辑 */
package/fflate.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // 从 https://github.com/101arrowz/fflate v0.7.4 复制过来并修改,github commit 0f439ed3293b1da1f439fbbc5125b1097b75d3ac
2
2
  // 删掉了 worker, async, stream 相关的实现和接口,主要保证 unzipSync 能够使用
3
3
  // 增加了 decoder 参数以支持文件名使用别的编码方式解码,如 gb18030, shift-jis
4
- import { encode } from "./utils.js";
4
+ import { encode } from './utils.js';
5
5
  // DEFLATE is a complex format; to read this code, you should probably check the RFC first:
6
6
  // https://tools.ietf.org/html/rfc1951
7
7
  // You may also wish to take a look at the guide I made about this program:
package/file.d.ts CHANGED
@@ -2,7 +2,7 @@ import { promises as fsp, default as fs } from 'node:fs';
2
2
  import type { UnzipFileFilter } from './fflate.ts';
3
3
  export { fsp };
4
4
  export type Encoding = 'utf-8' | 'gb18030' | 'shift-jis' | 'utf-16le';
5
- export declare const encodings: readonly ["utf-8", "gb18030", "shift-jis", "utf-16le"];
5
+ export declare const encodings: readonly ['utf-8', 'gb18030', 'shift-jis', 'utf-16le'];
6
6
  export declare const print_files: {
7
7
  readonly info: true;
8
8
  readonly files: true;
@@ -18,7 +18,7 @@ export declare const print_info_options: {
18
18
  };
19
19
  };
20
20
  export declare const binary_encoding: {
21
- readonly encoding: "binary";
21
+ readonly encoding: 'binary';
22
22
  };
23
23
  export declare const ramdisk: boolean;
24
24
  /** fp 所指向的 文件/ 文件夹 是否存在
@@ -174,7 +174,7 @@ export interface FCopyOptions {
174
174
 
175
175
  @example
176
176
  fcopy('D:/temp/camera/', 'D:/camera/') */
177
- export declare function fcopy(fp_src: string, fp_dst: string, { print, overwrite, filter, }?: FCopyOptions): Promise<string>;
177
+ export declare function fcopy(fp_src: string, fp_dst: string, { print, overwrite, filter }?: FCopyOptions): Promise<string>;
178
178
  export interface FMoveOptions {
179
179
  overwrite?: boolean;
180
180
  print?: boolean;
@@ -289,5 +289,5 @@ export declare function fp_sorter(l: {
289
289
  fp: string;
290
290
  }, r: {
291
291
  fp: string;
292
- }): 0 | 1 | -1;
292
+ }): -1 | 0 | 1;
293
293
  export declare function log_action(action: string, fp_src: string, fp_dst: string, sep?: string): void;
package/file.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { promises as fsp, default as fs } from 'node:fs';
2
2
  import { isArrayBuffer, isUint8Array } from 'util/types';
3
- import { t } from "./i18n/instance.js";
4
- import { noop, to_json } from "./prototype.js";
5
- import { pack, parse } from "./io.common.js";
6
- import { path } from "./path.js";
7
- import { check, url_width, decode, strcmp } from "./utils.js";
8
- import { noprint } from "./process.js";
3
+ import { t } from './i18n/instance.js';
4
+ import { noop, to_json } from './prototype.js';
5
+ import { pack, parse } from './io.common.js';
6
+ import { path } from './path.js';
7
+ import { check, url_width, decode, strcmp } from './utils.js';
8
+ import { noprint } from './process.js';
9
9
  export { fsp };
10
10
  export const encodings = ['utf-8', 'gb18030', 'shift-jis', 'utf-16le'];
11
11
  export const print_files = { info: true, files: true };
@@ -541,7 +541,7 @@ async function _unzip(zip, fpd_out, { encoding = 'utf-8', dryrun = false, print
541
541
  if (!dryrun && fpd_out)
542
542
  await fmkdir(fpd_out, { print: print.info });
543
543
  let dryrun_unzipped = {};
544
- const { unzipSync } = await import("./fflate.js");
544
+ const { unzipSync } = await import('./fflate.js');
545
545
  let unzipped = unzipSync(zip, {
546
546
  decoder: encoding === 'utf-8'
547
547
  ? decode
package/fzip.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import fs from 'node:fs';
2
- import { path } from "./path.js";
3
- import { flist, log_action } from "./file.js";
4
- import { noprint } from "./process.js";
5
- import { WritableMemoryStream, check } from "./utils.js";
2
+ import { path } from './path.js';
3
+ import { flist, log_action } from './file.js';
4
+ import { noprint } from './process.js';
5
+ import { WritableMemoryStream, check } from './utils.js';
6
6
  /** 将文件夹或文件列表压缩为 zip,返回生成的压缩包路径 (fp_zip)
7
7
  - data:
8
8
  - fpd_src: 被压缩文件夹路径 (string) 或
package/git.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare class Git {
5
5
  constructor(cwd: string);
6
6
  static init(cwd: string, print?: boolean): Promise<Git>;
7
7
  static clone(repo: string, fpd: string, shallow?: boolean | string): Promise<Git>;
8
- call(args?: any[], { color, print, on_stderr, throw_code, }?: {
8
+ call(args?: any[], { color, print, on_stderr, throw_code }?: {
9
9
  color?: boolean;
10
10
  print?: CallOptions['print'];
11
11
  on_stderr?: CallOptions['on_stderr'];
@@ -16,7 +16,7 @@ export declare class Git {
16
16
  get_branches(print?: boolean): Promise<string[]>;
17
17
  has_branch(branch: string): Promise<boolean>;
18
18
  /** - last?: `4` */
19
- log({ n, graph, format, }?: {
19
+ log({ n, graph, format }?: {
20
20
  n?: number;
21
21
  graph?: boolean;
22
22
  format?: string;
package/git.js CHANGED
@@ -1,6 +1,6 @@
1
- import { call, noprint, print_no_command } from "./process.js";
2
- import { fread, fmkdir } from "./file.js";
3
- import { colored } from "./utils.js";
1
+ import { call, noprint, print_no_command } from './process.js';
2
+ import { fread, fmkdir } from './file.js';
3
+ import { colored } from './utils.js';
4
4
  export class Git {
5
5
  static exe = 'git';
6
6
  cwd;
package/i18n/i18n-scan.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { program } from 'commander';
3
- import { path } from "../path.js";
4
- import { scanner } from "./scanner/index.js";
3
+ import { path } from '../path.js';
4
+ import { scanner } from './scanner/index.js';
5
5
  program.name('i18n-scan')
6
6
  .option('-r, --rootdir [rootdir]', '根目录:默认为当前工作目录', path.normalize(process.cwd()).fpd)
7
7
  .option('-o, --output [output]', 'i18n 目录:默认为 <rootdir>/i18n/')
package/i18n/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type i18n as I18Next } from 'i18next';
2
2
  import type { Trans } from 'react-i18next';
3
3
  import { type _Dict, type Item } from './dict.ts';
4
4
  export type Language = 'zh' | 'en' | 'ja' | 'ko';
5
- export declare const languages: readonly ["zh", "en", "ja", "ko"];
5
+ export declare const languages: readonly ['zh', 'en', 'ja', 'ko'];
6
6
  declare global {
7
7
  interface Window {
8
8
  language: Language;
package/i18n/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { default as i18next } from 'i18next';
2
- import { Dict } from "./dict.js";
2
+ import { Dict } from './dict.js';
3
3
  export const languages = ['zh', 'en', 'ja', 'ko'];
4
4
  /**
5
5
  提供翻译文本功能,自动解析当前语言
package/i18n/instance.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I18N } from "./index.js";
1
+ import { I18N } from './index.js';
2
2
  import _dict from './dict.json' with { type: 'json' };
3
3
  export let i18n = new I18N(_dict);
4
4
  const { t, language } = i18n;
package/i18n/rwdict.d.ts CHANGED
@@ -5,11 +5,11 @@ import { Dict, type Item, type _Dict } from './dict.ts';
5
5
  export declare class RWDict extends Dict {
6
6
  /** 更新词条 */
7
7
  set_item(key: string, item: Item, { print, placeholder, overwrite, dryrun, create }?: {
8
- print?: boolean;
9
- placeholder?: boolean;
10
- overwrite?: boolean;
11
- dryrun?: boolean;
12
8
  create?: boolean;
9
+ dryrun?: boolean;
10
+ overwrite?: boolean;
11
+ placeholder?: boolean;
12
+ print?: boolean;
13
13
  }): void;
14
14
  /** 更新词条翻译 */
15
15
  set_translation(key: string, language: Language, translation: string, {
@@ -18,10 +18,10 @@ export declare class RWDict extends Dict {
18
18
  /** 允许更新翻译 */
19
19
  overwrite, print, placeholder, dryrun }?: {
20
20
  create?: boolean;
21
+ dryrun?: boolean;
21
22
  overwrite?: boolean;
22
- print?: boolean;
23
23
  placeholder?: boolean;
24
- dryrun?: boolean;
24
+ print?: boolean;
25
25
  }): void;
26
26
  /** 合并、更新词典
27
27
  print?: true
@@ -30,10 +30,10 @@ export declare class RWDict extends Dict {
30
30
  create?: true
31
31
  */
32
32
  merge(_dict: _Dict, { print, overwrite, dryrun, create }?: {
33
- print?: boolean;
34
- overwrite?: boolean;
35
- dryrun?: boolean;
36
33
  create?: boolean;
34
+ dryrun?: boolean;
35
+ overwrite?: boolean;
36
+ print?: boolean;
37
37
  }): this;
38
38
  /** trim?: [true] 是否过滤掉空词条及空翻译 */
39
39
  to_json(trim?: boolean): string;
package/i18n/rwdict.js CHANGED
@@ -1,5 +1,5 @@
1
- import "../prototype.js";
2
- import { Dict, } from "./dict.js";
1
+ import '../prototype.js';
2
+ import { Dict, } from './dict.js';
3
3
  /** read write Dict for scanner */
4
4
  export class RWDict extends Dict {
5
5
  /** 更新词条 */
@@ -15,12 +15,12 @@ declare const default_config: {
15
15
  defaultNs: string;
16
16
  func: {
17
17
  list: string[];
18
- extensions: any[];
18
+ extensions: undefined[];
19
19
  };
20
20
  trans: {
21
- extensions: any[];
21
+ extensions: undefined[];
22
22
  fallbackKey: boolean;
23
- babylon: import("@babel/parser").ParserOptions;
23
+ babylon: import('@babel/parser').ParserOptions;
24
24
  acorn: {
25
25
  ecmaVersion: string;
26
26
  sourceType: string;
@@ -1,12 +1,12 @@
1
1
  import { Parser } from 'i18next-scanner';
2
- import "../../prototype.js";
3
- import { path } from "../../path.js";
4
- import { flist, fread, fwrite, fread_json } from "../../file.js";
5
- import { noprint } from "../../process.js";
6
- import { rethrow } from "../../prototype.js";
7
- import { languages } from "../index.js";
8
- import { RWDict } from "../rwdict.js";
9
- import { parse_trans_from_string_by_babel } from "./parser.js";
2
+ import '../../prototype.js';
3
+ import { path } from '../../path.js';
4
+ import { flist, fread, fwrite, fread_json } from '../../file.js';
5
+ import { noprint } from '../../process.js';
6
+ import { rethrow } from '../../prototype.js';
7
+ import { languages } from '../index.js';
8
+ import { RWDict } from '../rwdict.js';
9
+ import { parse_trans_from_string_by_babel } from './parser.js';
10
10
  /** 扫描源码中的词条,以及收集未翻译的词条,将结果保存到 dict.json 和 untranslateds.json
11
11
  - `process.cwd()` rootdir 要扫描根目录
12
12
  - config 配置信息 */
@@ -3,7 +3,7 @@ import babel_traverse from '@babel/traverse';
3
3
  const { default: traverse } = babel_traverse;
4
4
  import { parse } from '@babel/parser';
5
5
  import t from '@babel/types';
6
- import "../../prototype.js";
6
+ import '../../prototype.js';
7
7
  // import { Checker } from './checker'
8
8
  /** i18next-scanner/src/parser.js */
9
9
  export function parse_trans_from_string_by_babel(code, options = {}, custom_handler = null, on_error = () => { }) {
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export * from "./prototype.js";
2
- export * from "./io.common.js";
3
- export * from "./utils.js";
4
- export * from "./file.js";
5
- export * from "./process.js";
6
- export * from "./net.js";
7
- export { path } from "./path.js";
1
+ export * from './prototype.js';
2
+ export * from './io.common.js';
3
+ export * from './utils.js';
4
+ export * from './file.js';
5
+ export * from './process.js';
6
+ export * from './net.js';
7
+ export { path } from './path.js';
8
8
  //# sourceMappingURL=index.js.map
package/io.common.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./prototype.common.js";
2
- import { decode, encode_into, ceil2, seq } from "./utils.common.js";
1
+ import './prototype.common.js';
2
+ import { decode, encode_into, ceil2, seq } from './utils.common.js';
3
3
  // 类型 | 编码
4
4
  // --------------- | -------------------
5
5
  // small int + | 0x00 - 0x1f (0 - 31 自然数)
package/net.browser.js CHANGED
@@ -1,7 +1,7 @@
1
- import { t } from "./i18n/instance.js";
2
- import { assert, check, delay } from "./utils.browser.js";
3
- import { drop_request_headers } from "./net.common.js";
4
- export * from "./net.common.js";
1
+ import { t } from './i18n/instance.js';
2
+ import { assert, check, delay } from './utils.browser.js';
3
+ import { drop_request_headers } from './net.common.js';
4
+ export * from './net.common.js';
5
5
  async function fetch_retry(url, options, timeout, retries = 0, count = 0) {
6
6
  try {
7
7
  // 旧的浏览器可能没有这个函数
package/net.common.d.ts CHANGED
@@ -21,9 +21,9 @@ export declare const WebSocketConnecting = 0;
21
21
  export declare const WebSocketOpen = 1;
22
22
  export declare const WebSocketClosing = 2;
23
23
  export declare const WebSocketClosed = 3;
24
- export declare const websocket_states: readonly ["connecting", "open", "closing", "closed"];
24
+ export declare const websocket_states: readonly ['connecting', 'open', 'closing', 'closed'];
25
25
  export declare class WebSocketConnectionError extends Error {
26
- name: "WebSocketConnectionError";
26
+ name: 'WebSocketConnectionError';
27
27
  url: string;
28
28
  protocols?: string[];
29
29
  type?: 'close' | 'error';
package/net.common.js CHANGED
@@ -1,8 +1,8 @@
1
- import { platform } from "./platform.common.js";
2
- import { rethrow } from "./prototype.common.js"; // .bracket()
3
- import { message_symbol, pack, parse } from "./io.common.js";
4
- import { check, defer, defer2, genid, Lock, nowstr, set_error_message, timeout, TimeoutError } from "./utils.common.js";
5
- import { t } from "./i18n/instance.js";
1
+ import { platform } from './platform.common.js';
2
+ import { rethrow } from './prototype.common.js'; // .bracket()
3
+ import { message_symbol, pack, parse } from './io.common.js';
4
+ import { check, defer, defer2, genid, Lock, nowstr, set_error_message, timeout, TimeoutError } from './utils.common.js';
5
+ import { t } from './i18n/instance.js';
6
6
  /** 对于 request() 函数来说无意义的 headers,会自动过滤掉 */
7
7
  export const drop_request_headers = new Set([
8
8
  // : 开头的 key
package/net.d.ts CHANGED
@@ -3,15 +3,15 @@ import { type Readable } from 'node:stream';
3
3
  import type { Cookie, CookieJar, MemoryCookieStore } from 'tough-cookie';
4
4
  import { type ValueOf } from './prototype.ts';
5
5
  import type { Encoding } from './file.ts';
6
- import { inspect, type Deferred2, type OnTimeout } from './utils.ts';
6
+ import { type Deferred2, type OnTimeout } from './utils.ts';
7
7
  import { type BasicAuth, type BearerAuth } from './net.common.ts';
8
8
  export * from './net.common.ts';
9
9
  export declare const MyProxy: {
10
- readonly socks5: "http://127.0.0.1:10080";
11
- readonly whistle: "http://localhost:8899";
12
- readonly work: "http://localhost:10090";
10
+ readonly socks5: 'http://127.0.0.1:10080';
11
+ readonly whistle: 'http://localhost:8899';
12
+ readonly work: 'http://localhost:10090';
13
13
  /** 需要先启动 server.start_tunnel_server('ddb.test.proxy') */
14
- readonly test: "http://localhost:10091";
14
+ readonly test: 'http://localhost:10091';
15
15
  };
16
16
  export declare const byproxy: {
17
17
  readonly proxy: true;
@@ -25,6 +25,7 @@ export type { Cookie };
25
25
  export interface RawResponse {
26
26
  status: number;
27
27
  headers: Record<string, string>;
28
+ /** 需要注意返回的 Readable 调用 setEncoding 无效 */
28
29
  body: Readable;
29
30
  }
30
31
  export interface FullResponse<TBody extends Buffer | string> {
@@ -49,6 +50,7 @@ export interface RequestOptions {
49
50
  dryrun?: boolean;
50
51
  browser?: boolean;
51
52
  ua?: string;
53
+ signal?: AbortSignal;
52
54
  print?: {
53
55
  retry: boolean;
54
56
  timeout: boolean;
@@ -64,16 +66,16 @@ export interface RequestError<TBody extends string | Buffer = string> extends Er
64
66
  url: URL;
65
67
  options: RequestOptions | RequestFullOptions | RequestRawOptions;
66
68
  response?: FullResponse<TBody>;
67
- [inspect.custom]: Function;
68
69
  }
69
70
  export interface StatusCodeError {
70
71
  status: number;
71
72
  }
72
73
  export declare class StatusCodeError extends Error {
73
- name: "StatusCodeError";
74
+ name: 'StatusCodeError';
74
75
  constructor(status: number, url: string);
75
76
  }
76
- /**
77
+ /** 发起 http 请求,返回响应
78
+ 注意: RawResponse 的 body.setEncoding 无效,总是读取到 Buffer
77
79
  - url: 必须是完整 url
78
80
  - options?:
79
81
  - method?: `有 body 时为 POST, 否则为 GET` 'GET' | 'POST' | ··
@@ -102,6 +104,7 @@ export declare class StatusCodeError extends Error {
102
104
  - browser?: `false` 使用 chrome 浏览器的 ua
103
105
  - ua?: `无 user-agent 头` 快捷设置 user-agent 头,默认不发送
104
106
  - dryrun?: `false` 仅打印 undici options, 并不实际发送请求,返回 undefined
107
+ - signal?: AbortSignal
105
108
  - print?:
106
109
  - retry: `true` 是否打印 "等待 1 秒后重试 request" 提示信息
107
110
  - timeout: `true` 是否打印最后一次超时重试失败时的错误 */
@@ -135,7 +138,7 @@ export interface ConnectOptions {
135
138
  - options?:
136
139
  - local_port?: `随机端口` 使用的本地端口
137
140
  - timeout?: `2000` 超时时间
138
- - keep_alive_duration?: 毫秒数,设置后启用操作系统级的 keep alive
141
+ - keep_alive_duration?: `undefined` 毫秒数,设置后启用操作系统级的 keep alive
139
142
  - print?: 打印连接日志,错误日志
140
143
  - error?: `true`
141
144
  - connect: `false` */
package/net.js CHANGED
@@ -2,10 +2,10 @@ import zlib from 'node:zlib';
2
2
  import net from 'node:net';
3
3
  import { buffer as stream_to_buffer, text as stream_to_text } from 'node:stream/consumers';
4
4
  import { pipeline, isReadable } from 'node:stream';
5
- import { noop } from "./prototype.js";
6
- import { inspect, assert, delay, map_values, unique, timeout, check, colored, encode, TimeoutError, set_error_message, defer2, nowstr } from "./utils.js";
7
- import { drop_request_headers } from "./net.common.js";
8
- export * from "./net.common.js";
5
+ import { noop } from './prototype.js';
6
+ import { inspect, assert, delay, map_values, unique, timeout, check, colored, encode, TimeoutError, set_error_message, defer2, nowstr } from './utils.js';
7
+ import { drop_request_headers } from './net.common.js';
8
+ export * from './net.common.js';
9
9
  export const MyProxy = {
10
10
  socks5: 'http://127.0.0.1:10080',
11
11
  whistle: 'http://localhost:8899',
@@ -30,10 +30,16 @@ let dispatchers = {};
30
30
  async function request_retry(url, options, _timeout, retries = 0, count = 0, print) {
31
31
  try {
32
32
  if (_timeout > 0) {
33
- // 设置给 undici 设置 timeout, signal 不一定管用,还是得自己兜底
34
- options.signal = AbortSignal.timeout(_timeout);
33
+ let timeout_signal = AbortSignal.timeout(_timeout);
35
34
  return await timeout(_timeout + 300, // 为 undici 兜底
36
- undici.request(url, options), undefined, print.timeout && count >= retries); // 只打印最后一次超时的错误,避免太多冗余输出
35
+ undici.request(url, {
36
+ ...options,
37
+ // 设置给 undici 设置 timeout, signal 不一定管用,还是得自己兜底
38
+ signal: options.signal ?
39
+ AbortSignal.any([options.signal, timeout_signal])
40
+ :
41
+ timeout_signal
42
+ }), undefined, print.timeout && count >= retries); // 只打印最后一次超时的错误,避免太多冗余输出
37
43
  }
38
44
  else
39
45
  return await undici.request(url, options);
@@ -67,7 +73,7 @@ export async function request(url, options = {}) {
67
73
  undici ??= (await import('undici')).default;
68
74
  const { Cookie } = await import('tough-cookie');
69
75
  await cookies.init();
70
- const { queries, headers: _headers, body, type = 'application/json', timeout = 5 * 1000, auth, cookies: _cookies, raw = false, full = false, redirect = 'follow', decode = true, dryrun, ua, browser: browser_ua, print = {
76
+ const { queries, headers: _headers, body, type = 'application/json', timeout = 5 * 1000, auth, cookies: _cookies, raw = false, full = false, redirect = 'follow', decode = true, dryrun, ua, browser: browser_ua, signal, print = {
71
77
  timeout: true,
72
78
  retry: true
73
79
  } } = options;
@@ -87,7 +93,7 @@ export async function request(url, options = {}) {
87
93
  retries = 2;
88
94
  // --- headers, http/2 开始都用小写的 headers
89
95
  let headers = {
90
- 'accept-language': 'zh-CN,zh;q=0.9',
96
+ 'accept-language': 'zh-CN',
91
97
  'accept-encoding': 'gzip, deflate, br, zstd',
92
98
  ...browser_ua ? {
93
99
  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36',
@@ -133,6 +139,7 @@ export async function request(url, options = {}) {
133
139
  let undici_options = {
134
140
  ...method ? { method } : {},
135
141
  dispatcher: get_dispatcher(proxy, redirect),
142
+ signal,
136
143
  // 下面这些 timeout 都不是总的时间
137
144
  headersTimeout: timeout,
138
145
  // 从收完 headers 开始算
@@ -318,7 +325,7 @@ export async function request_json(url, options) {
318
325
  - options?:
319
326
  - local_port?: `随机端口` 使用的本地端口
320
327
  - timeout?: `2000` 超时时间
321
- - keep_alive_duration?: 毫秒数,设置后启用操作系统级的 keep alive
328
+ - keep_alive_duration?: `undefined` 毫秒数,设置后启用操作系统级的 keep alive
322
329
  - print?: 打印连接日志,错误日志
323
330
  - error?: `true`
324
331
  - connect: `false` */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.3.60",
3
+ "version": "1.3.63",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -49,21 +49,21 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@babel/core": "^7.29.0",
52
- "@babel/parser": "^7.29.2",
52
+ "@babel/parser": "^7.29.3",
53
53
  "@babel/traverse": "^7.29.0",
54
54
  "@koa/cors": "^5.0.0",
55
55
  "@stylistic/eslint-plugin": "^5.10.0",
56
56
  "@svgr/webpack": "^8.1.0",
57
57
  "@types/sass-loader": "^8.0.10",
58
- "@typescript-eslint/eslint-plugin": "^8.58.2",
59
- "@typescript-eslint/parser": "^8.58.2",
60
- "@typescript-eslint/utils": "^8.58.2",
58
+ "@typescript-eslint/eslint-plugin": "^8.59.2",
59
+ "@typescript-eslint/parser": "^8.59.2",
60
+ "@typescript-eslint/utils": "^8.59.2",
61
61
  "archiver": "^7.0.1",
62
62
  "chalk": "^5.6.2",
63
63
  "commander": "^14.0.3",
64
64
  "css-loader": "^7.1.4",
65
65
  "emoji-regex": "^10.6.0",
66
- "eslint": "^10.2.1",
66
+ "eslint": "^10.3.0",
67
67
  "eslint-plugin-react": "^7.37.5",
68
68
  "https-proxy-agent": "^9.0.0",
69
69
  "i18next": "25.8.1",
@@ -73,8 +73,8 @@
73
73
  "license-webpack-plugin": "^4.0.2",
74
74
  "mime-types": "^3.0.2",
75
75
  "p-map": "^7.0.4",
76
- "react": "^19.2.5",
77
- "react-i18next": "^17.0.4",
76
+ "react": "^19.2.6",
77
+ "react-i18next": "^17.0.6",
78
78
  "resolve-path": "^1.4.0",
79
79
  "sass": "^1.99.0",
80
80
  "sass-loader": "^16.0.7",
@@ -85,7 +85,7 @@
85
85
  "ts-loader": "^9.5.7",
86
86
  "tslib": "^2.8.1",
87
87
  "typescript": "^6.0.3",
88
- "undici": "^8.1.0",
88
+ "undici": "^8.2.0",
89
89
  "webpack": "^5.106.2",
90
90
  "webpack-bundle-analyzer": "^5.3.0",
91
91
  "ws": "^8.20.0"
@@ -95,14 +95,14 @@
95
95
  "@types/archiver": "^7.0.0",
96
96
  "@types/babel__traverse": "^7.28.0",
97
97
  "@types/eslint": "^9.6.1",
98
- "@types/estree": "^1.0.8",
98
+ "@types/estree": "^1.0.9",
99
99
  "@types/koa": "^3.0.2",
100
100
  "@types/koa-compress": "^4.0.7",
101
101
  "@types/mime-types": "^3.0.1",
102
102
  "@types/node": "^25.6.0",
103
103
  "@types/react": "^19.2.14",
104
104
  "@types/tough-cookie": "^4.0.5",
105
- "@types/vscode": "^1.116.0",
105
+ "@types/vscode": "^1.118.0",
106
106
  "@types/webpack-bundle-analyzer": "^4.7.0",
107
107
  "@types/ws": "^8.18.1"
108
108
  }
@@ -1,7 +1,7 @@
1
- import { set_platform } from "./platform.common.js";
2
- import { ident } from "./prototype.common.js";
3
- import { encoder } from "./utils.common.js";
4
- export * from "./platform.common.js";
1
+ import { set_platform } from './platform.common.js';
2
+ import { ident } from './prototype.common.js';
3
+ import { encoder } from './utils.common.js';
4
+ export * from './platform.common.js';
5
5
  function get_buffer(length) {
6
6
  return new Uint8Array(length);
7
7
  }
@@ -7,8 +7,8 @@ interface Platform {
7
7
  nodejs: boolean;
8
8
  /** 在 browser 环境中 */
9
9
  browser: boolean;
10
- get_buffer(length: number): Uint8Array;
11
- encode(str: string): Uint8Array;
10
+ get_buffer(length: number): Uint8Array<ArrayBuffer>;
11
+ encode(str: string): Uint8Array<ArrayBuffer>;
12
12
  delay(milliseconds: number, options?: TimerOptions): Promise<void>;
13
13
  strip_ansi(str: string): string;
14
14
  /** 根据环境返回 ws 包的 WebSocket 或者浏览器全局的 WebSocket */
package/platform.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import timers from 'timers/promises';
2
2
  import strip_ansi from 'strip-ansi';
3
- import { set_platform } from "./platform.common.js";
4
- export * from "./platform.common.js";
3
+ import { set_platform } from './platform.common.js';
4
+ export * from './platform.common.js';
5
5
  function get_buffer(length) {
6
6
  return Buffer.allocUnsafe(length);
7
7
  }