xshell 1.0.115 → 1.0.117

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/net.browser.js CHANGED
@@ -290,6 +290,7 @@ export class Remote {
290
290
  const len_json = dv.getUint32(0, true);
291
291
  let offset = 4 + len_json;
292
292
  let message = JSON.parse(decode(buffer.subarray(4, offset)));
293
+ message.data ??= [];
293
294
  if (message.bins) {
294
295
  const { bins } = message;
295
296
  let { data } = message;
package/net.js CHANGED
@@ -501,6 +501,7 @@ export class Remote {
501
501
  const len_json = dv.getUint32(0, true);
502
502
  let offset = 4 + len_json;
503
503
  let message = JSON.parse(decode(buffer.subarray(4, offset)));
504
+ message.data ??= [];
504
505
  if (message.bins) {
505
506
  const { bins } = message;
506
507
  let { data } = message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.115",
3
+ "version": "1.0.117",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -58,9 +58,9 @@
58
58
  "@babel/traverse": "^7.24.6",
59
59
  "@koa/cors": "^5.0.0",
60
60
  "@types/ws": "^8.5.10",
61
- "@typescript-eslint/eslint-plugin": "^7.11.0",
62
- "@typescript-eslint/parser": "^7.11.0",
63
- "@typescript-eslint/utils": "^7.11.0",
61
+ "@typescript-eslint/eslint-plugin": "^7.12.0",
62
+ "@typescript-eslint/parser": "^7.12.0",
63
+ "@typescript-eslint/utils": "^7.12.0",
64
64
  "@xterm/addon-fit": "^0.10.0",
65
65
  "@xterm/addon-web-links": "^0.11.0",
66
66
  "@xterm/addon-webgl": "^0.18.0",
@@ -75,7 +75,7 @@
75
75
  "colors": "^1.4.0",
76
76
  "commander": "^12.1.0",
77
77
  "emoji-regex": "^10.3.0",
78
- "eslint": "^9.3.0",
78
+ "eslint": "^9.4.0",
79
79
  "eslint-plugin-import": "^2.29.1",
80
80
  "eslint-plugin-react": "^7.34.2",
81
81
  "gulp-sort": "^2.0.0",
@@ -96,7 +96,7 @@
96
96
  "strip-ansi": "^7.1.0",
97
97
  "through2": "^4.0.2",
98
98
  "tough-cookie": "^4.1.4",
99
- "tslib": "^2.6.2",
99
+ "tslib": "^2.6.3",
100
100
  "typescript": "^5.4.5",
101
101
  "ua-parser-js": "^2.0.0-beta.2",
102
102
  "undici": "^6.18.2",
@@ -118,7 +118,7 @@
118
118
  "@types/koa-compress": "^4.0.6",
119
119
  "@types/lodash": "^4.17.4",
120
120
  "@types/mime-types": "^2.1.4",
121
- "@types/node": "^20.12.13",
121
+ "@types/node": "^20.14.1",
122
122
  "@types/react": "^18.3.3",
123
123
  "@types/through2": "^2.0.41",
124
124
  "@types/tough-cookie": "^4.0.5",
package/repl.js CHANGED
@@ -33,12 +33,7 @@ export async function start_repl() {
33
33
  name: 'repl',
34
34
  http: true,
35
35
  http_port: 8421,
36
- funcs: {
37
- echo({ data: [data] }) {
38
- console.log('echo:', data);
39
- return [data];
40
- },
41
- }
36
+ funcs: {}
42
37
  });
43
38
  await server.start();
44
39
  })(),
@@ -8,7 +8,9 @@ export declare function log<T>(obj: T): T;
8
8
  export declare function seq<T = number>(n: number, generator?: (index: number) => T): T[];
9
9
  /** 将 keys, values 数组按对应的顺序组合成一个对象 */
10
10
  export declare function zip_object<TValue>(keys: (string | number)[], values: TValue[]): Record<string, TValue>;
11
- export declare function delay(milliseconds: number): Promise<void>;
11
+ export declare function delay(milliseconds: number, { signal }?: {
12
+ signal?: AbortSignal;
13
+ }): Promise<void>;
12
14
  export declare class TimeoutError extends Error {
13
15
  constructor(message?: string, options?: ErrorOptions);
14
16
  }
package/utils.browser.js CHANGED
@@ -27,9 +27,18 @@ export function zip_object(keys, values) {
27
27
  return obj;
28
28
  }, {});
29
29
  }
30
- export async function delay(milliseconds) {
31
- return new Promise(resolve => {
32
- setTimeout(resolve, milliseconds);
30
+ export async function delay(milliseconds, { signal } = {}) {
31
+ signal?.throwIfAborted();
32
+ return new Promise((resolve, reject) => {
33
+ function on_signal_abort() {
34
+ clearTimeout(timeout);
35
+ reject(signal.reason);
36
+ }
37
+ signal?.addEventListener('abort', on_signal_abort);
38
+ let timeout = setTimeout(() => {
39
+ signal?.removeEventListener('abort', on_signal_abort);
40
+ resolve();
41
+ }, milliseconds);
33
42
  });
34
43
  }
35
44
  export class TimeoutError extends Error {
package/utils.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  /// <reference types="node" resolution-mode="require"/>
4
+ /// <reference types="node" resolution-mode="require"/>
4
5
  import { Writable, Transform, type Readable, type Duplex, type TransformCallback } from 'stream';
5
6
  import util from 'util';
7
+ import type { TimerOptions } from 'timers';
6
8
  import type Vinyl from 'vinyl';
7
9
  import './prototype.js';
8
10
  export declare const noop: () => void;
@@ -66,7 +68,7 @@ export declare class Timer {
66
68
  print(): void;
67
69
  }
68
70
  export declare function log_line(): void;
69
- export declare function delay(milliseconds: number): Promise<void>;
71
+ export declare function delay(milliseconds: number, options?: TimerOptions): Promise<void>;
70
72
  export declare class TimeoutError extends Error {
71
73
  constructor(message?: string, options?: ErrorOptions);
72
74
  }
package/utils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Stream, Writable, Transform } from 'stream';
2
2
  import util from 'util';
3
+ import timers from 'timers/promises';
3
4
  import { t } from './i18n/instance.js';
4
5
  import './prototype.js';
5
6
  export const noop = () => { };
@@ -194,10 +195,8 @@ export class Timer {
194
195
  export function log_line() {
195
196
  console.log('---');
196
197
  }
197
- export async function delay(milliseconds) {
198
- return new Promise(resolve => {
199
- setTimeout(resolve, milliseconds);
200
- });
198
+ export async function delay(milliseconds, options) {
199
+ return timers.setTimeout(milliseconds, undefined, options);
201
200
  }
202
201
  export class TimeoutError extends Error {
203
202
  constructor(message, options) {