xshell 1.2.15 → 1.2.16

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.d.ts CHANGED
@@ -285,5 +285,5 @@ export declare class RemoteClient {
285
285
  [inspect.custom](): {
286
286
  remote: string;
287
287
  websocket: string;
288
- } & Omit<this, "websocket" | typeof import("util").inspect.custom | "call" | "remote" | "send">;
288
+ } & Omit<this, typeof import("util").inspect.custom | "websocket" | "call" | "remote" | "send">;
289
289
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -53,7 +53,7 @@
53
53
  "@babel/parser": "^7.26.9",
54
54
  "@babel/traverse": "^7.26.9",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^4.0.0",
56
+ "@stylistic/eslint-plugin": "^4.0.1",
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.9",
59
59
  "@types/ws": "^8.5.14",
package/process.d.ts CHANGED
@@ -68,6 +68,8 @@ export interface StartOptions extends BaseOptions {
68
68
  print?: boolean;
69
69
  }
70
70
  export declare function get_command(exe: string, args?: string[]): string;
71
+ /** 处理 print 选项 */
72
+ export declare function get_print_options(print?: boolean | Partial<FullPrintOptions>, stdout?: string | boolean, stderr?: string | boolean): FullPrintOptions;
71
73
  export interface SubProcess<TOutput extends string | Buffer = string> extends ChildProcess {
72
74
  /** 由创建进程的调用者设置的,用于区分、识别、记忆的可选名称 */
73
75
  title?: string;
package/process.js CHANGED
@@ -16,6 +16,22 @@ export function get_command(exe, args) {
16
16
  ? ` ${args.map(arg => arg.quote_if_space()).join(' ')}`
17
17
  : '');
18
18
  }
19
+ /** 处理 print 选项 */
20
+ export function get_print_options(print = true, stdout = true, stderr = true) {
21
+ if (typeof print === 'boolean')
22
+ print = {
23
+ command: print,
24
+ code: print,
25
+ stdout: print,
26
+ stderr: print
27
+ };
28
+ return {
29
+ command: print.command ?? true,
30
+ code: print.code ?? true,
31
+ stdout: stdout === true && (print.stdout ?? true),
32
+ stderr: stderr === true && (print.stderr ?? true)
33
+ };
34
+ }
19
35
  async function prepare_spawn(detached, exe, args, { cwd, window: _window = false, envs,
20
36
  // @ts-ignore
21
37
  input, stdin = Boolean(input), stdout = !detached, stderr = stdout, print = true, proxy, }) {
@@ -70,20 +86,8 @@ input, stdin = Boolean(input), stdout = !detached, stderr = stdout, print = true
70
86
  await close_all_handles();
71
87
  throw error;
72
88
  }
73
- // --- 处理 print
74
- if (typeof print === 'boolean')
75
- print = {
76
- command: print,
77
- code: print,
78
- stdout: print,
79
- stderr: print
80
- };
81
- print = {
82
- command: print.command ?? true,
83
- code: print.code ?? true,
84
- stdout: stdout && (print.stdout ?? true),
85
- stderr: stderr && (print.stderr ?? true)
86
- };
89
+ // 处理 print
90
+ print = get_print_options(print, stdout, stderr);
87
91
  const command = get_command(exe, args);
88
92
  if (print.command)
89
93
  console.log(command.blue);