xshell 1.2.63 → 1.2.65

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/file.js CHANGED
@@ -861,7 +861,7 @@ export async function fsync(fp_src, fp_dst, { print = print_files, delete: _dele
861
861
  fpd_changeds.push(fp);
862
862
  if (print.files)
863
863
  log_action(`同步${modify ? '修改' : '新增'}`, `${fp_src}${fp}`, `${fp_dst}${fp}`);
864
- tasks.push(fcopy(`${fp_src}${fp}`, `${fp_dst}${fp}`, noprint));
864
+ tasks.push(['fcopy', `${fp_src}${fp}`, `${fp_dst}${fp}`]);
865
865
  };
866
866
  const sync_delete = ({ fp }) => {
867
867
  if (fpd_deleteds.some(fpd_deleted => fp.startsWith(fpd_deleted)))
@@ -870,7 +870,7 @@ export async function fsync(fp_src, fp_dst, { print = print_files, delete: _dele
870
870
  fpd_deleteds.push(fp);
871
871
  if (print.files)
872
872
  console.log('同步删除', `${fp_dst}${fp}`);
873
- tasks.push(fdelete(`${fp_dst}${fp}`, noprint));
873
+ tasks.push(['fdelete', `${fp_dst}${fp}`]);
874
874
  };
875
875
  for (; p < src_stats.length && q < dst_stats.length;) {
876
876
  const src = src_stats[p];
@@ -896,7 +896,13 @@ export async function fsync(fp_src, fp_dst, { print = print_files, delete: _dele
896
896
  if (_delete)
897
897
  for (; q < dst_stats.length; ++q)
898
898
  sync_delete(dst_stats[q]);
899
- await Promise.all(tasks);
899
+ const { default: pmap } = await import('p-map');
900
+ await pmap(tasks, async ([task, arg0, arg1]) => {
901
+ if (task === 'fcopy')
902
+ await fcopy(arg0, arg1, noprint);
903
+ else
904
+ await fdelete(arg0, noprint);
905
+ }, { concurrency: 2 });
900
906
  }
901
907
  else {
902
908
  let same = true;
@@ -929,7 +935,8 @@ export function fp_sorter(l, r) {
929
935
  }
930
936
  /** 返回修改时间与大小是否相同 */
931
937
  function compare_stat(src, dst) {
932
- return src.size === dst.size && Math.abs(Number(src.mtimeMs) - Number(dst.mtimeMs)) <= 1;
938
+ // exfat 时间精度为 2s
939
+ return src.size === dst.size && Math.abs(Number(src.mtimeMs) - Number(dst.mtimeMs)) <= 2000;
933
940
  }
934
941
  export function log_action(action, fp_src, fp_dst, sep = '->') {
935
942
  console.log(`${`${action} ${fp_src}`.pad(url_width)} ${sep} ${fp_dst}`);
package/net.d.ts CHANGED
@@ -15,7 +15,9 @@ export declare const websocket_states: readonly ["connecting", "open", "closing"
15
15
  export declare enum MyProxy {
16
16
  socks5 = "http://127.0.0.1:10080",
17
17
  whistle = "http://localhost:8899",
18
- work = "http://localhost:10090"
18
+ work = "http://localhost:10090",
19
+ /** 需要先启动 server.start_tunnel_server('ddb.test.proxy') */
20
+ test = "http://localhost:10091"
19
21
  }
20
22
  export declare const byproxy: {
21
23
  readonly proxy: true;
package/net.js CHANGED
@@ -17,6 +17,8 @@ export var MyProxy;
17
17
  MyProxy["socks5"] = "http://127.0.0.1:10080";
18
18
  MyProxy["whistle"] = "http://localhost:8899";
19
19
  MyProxy["work"] = "http://localhost:10090";
20
+ /** 需要先启动 server.start_tunnel_server('ddb.test.proxy') */
21
+ MyProxy["test"] = "http://localhost:10091";
20
22
  })(MyProxy || (MyProxy = {}));
21
23
  export const byproxy = { proxy: true };
22
24
  // ------------------------------------ fetch, request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.63",
3
+ "version": "1.2.65",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -53,13 +53,13 @@
53
53
  "@babel/parser": "^7.28.0",
54
54
  "@babel/traverse": "^7.28.0",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^5.2.0",
56
+ "@stylistic/eslint-plugin": "^5.2.2",
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.37.0",
61
- "@typescript-eslint/parser": "^8.37.0",
62
- "@typescript-eslint/utils": "^8.37.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
61
+ "@typescript-eslint/parser": "^8.38.0",
62
+ "@typescript-eslint/utils": "^8.38.0",
63
63
  "archiver": "^7.0.1",
64
64
  "chalk": "^5.4.1",
65
65
  "commander": "^14.0.0",
@@ -76,8 +76,9 @@
76
76
  "license-webpack-plugin": "^4.0.2",
77
77
  "map-stream": "^0.0.7",
78
78
  "mime-types": "^3.0.1",
79
+ "p-map": "^7.0.3",
79
80
  "react": "^19.1.0",
80
- "react-i18next": "^15.6.0",
81
+ "react-i18next": "^15.6.1",
81
82
  "resolve-path": "^1.4.0",
82
83
  "sass": "^1.89.2",
83
84
  "sass-loader": "^16.0.5",
@@ -180,6 +180,8 @@ declare global {
180
180
  /** 去除重复元素(可按 mapper 选择或计算某个值来去重),重复值保留最后出现的那个
181
181
  - mapper?: 可以是 key (string, number, symbol) 或 (obj: any) => any */
182
182
  unique(this: T[], mapper?: keyof T | Mapper<T>): T[];
183
+ /** map 并 select 对象中的某个属性,返回属性数组 */
184
+ select<TKey extends keyof T = keyof T>(this: T[], key: TKey): T[TKey][];
183
185
  /**
184
186
  - trim_line?: `true`
185
187
  - rm_empty_lines?: `true`
@@ -485,6 +485,9 @@ if (!globalThis.my_prototype_defined) {
485
485
  },
486
486
  join_lines(append = Boolean(this.length)) {
487
487
  return `${this.join('\n')}${append ? '\n' : ''}`;
488
+ },
489
+ select(key) {
490
+ return this.map(select(key));
488
491
  }
489
492
  })
490
493
  });
package/utils.common.d.ts CHANGED
@@ -141,4 +141,4 @@ export declare function ceil2(n: number): number;
141
141
  export declare function throttle(duration: number, func: Function, delay_first?: boolean): (this: any, ...args: any[]) => void;
142
142
  /** 防抖,间隔一段时间不再触发时调用 */
143
143
  export declare function debounce(duration: number, func: Function): (this: any, ...args: any[]) => void;
144
- export declare function tomorrow(date?: Date | string): Date;
144
+ export declare function tomorrow(date?: Date | string | number): Date;