xshell 1.3.39 → 1.3.41

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.
@@ -1,2 +1,2 @@
1
- declare const red: import("chalk").ChalkInstance, green: import("chalk").ChalkInstance, yellow: import("chalk").ChalkInstance, blue: import("chalk").ChalkInstance, magenta: import("chalk").ChalkInstance, cyan: import("chalk").ChalkInstance, grey: import("chalk").ChalkInstance, red_: import("chalk").ChalkInstance, green_: import("chalk").ChalkInstance, yellow_: import("chalk").ChalkInstance, blue_: import("chalk").ChalkInstance, magenta_: import("chalk").ChalkInstance, cyan_: import("chalk").ChalkInstance, underline: import("chalk").ChalkInstance;
2
- export { red, green, yellow, blue, magenta, cyan, grey, red_, green_, yellow_, blue_, magenta_, cyan_, underline };
1
+ declare const red: import("chalk").ChalkInstance, green: import("chalk").ChalkInstance, yellow: import("chalk").ChalkInstance, blue: import("chalk").ChalkInstance, magenta: import("chalk").ChalkInstance, cyan: import("chalk").ChalkInstance, gray: import("chalk").ChalkInstance, red_: import("chalk").ChalkInstance, green_: import("chalk").ChalkInstance, yellow_: import("chalk").ChalkInstance, blue_: import("chalk").ChalkInstance, magenta_: import("chalk").ChalkInstance, cyan_: import("chalk").ChalkInstance, underline: import("chalk").ChalkInstance;
2
+ export { red, green, yellow, blue, magenta, cyan, gray, red_, green_, yellow_, blue_, magenta_, cyan_, underline };
package/chalk.browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Chalk } from 'chalk';
2
2
  const chalk = new Chalk({ level: 2 });
3
- const { red, green, yellow, blue, magenta, cyan, grey, redBright: red_, greenBright: green_, yellowBright: yellow_, blueBright: blue_, magentaBright: magenta_, cyanBright: cyan_, underline, } = chalk;
4
- export { red, green, yellow, blue, magenta, cyan, grey, red_, green_, yellow_, blue_, magenta_, cyan_, underline };
3
+ const { red, green, yellow, blue, magenta, cyan, gray, redBright: red_, greenBright: green_, yellowBright: yellow_, blueBright: blue_, magentaBright: magenta_, cyanBright: cyan_, underline, } = chalk;
4
+ export { red, green, yellow, blue, magenta, cyan, gray, red_, green_, yellow_, blue_, magenta_, cyan_, underline };
5
5
  //# sourceMappingURL=chalk.browser.js.map
package/git.d.ts CHANGED
@@ -28,10 +28,12 @@ export declare class Git {
28
28
  message: string;
29
29
  }[]>;
30
30
  get_last_commit_hash(short?: boolean): Promise<string>;
31
- fetch({ print, remote }?: {
31
+ /** @example form.fetch({ remote: 'origin', args: ['pull/770/head:form-list-fields-value'] }) */
32
+ fetch({ print, remote, args }?: {
32
33
  print?: boolean;
33
34
  remote?: string;
34
- }): Promise<void>;
35
+ args?: string[];
36
+ }): Promise<string>;
35
37
  /** 创建或者切换到分支
36
38
  - branch?: `'main'` */
37
39
  checkout(branch?: 'main'): Promise<void>;
package/git.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { call, noprint, print_no_command } from "./process.js";
2
2
  import { fread, fmkdir } from "./file.js";
3
+ import { colored } from "./utils.js";
3
4
  export class Git {
4
5
  static exe = 'git';
5
6
  cwd;
@@ -91,14 +92,35 @@ export class Git {
91
92
  .trim();
92
93
  return short ? hash.slice(0, 6) : hash;
93
94
  }
94
- async fetch({ print = true, remote } = {}) {
95
+ /** @example form.fetch({ remote: 'origin', args: ['pull/770/head:form-list-fields-value'] }) */
96
+ async fetch({ print = true, remote, args = [] } = {}) {
97
+ let stderrs = [];
95
98
  await this.call([
96
99
  'fetch',
97
100
  remote || '--all',
98
- '--prune'
99
- ], print_stdout);
101
+ '--prune',
102
+ ...args
103
+ ], {
104
+ ...print_stdout,
105
+ on_stderr(chunk) {
106
+ stderrs.push(chunk);
107
+ if (chunk.includes('main'))
108
+ chunk = chunk.replaceAll('main', 'main'.yellow);
109
+ if (stderrs.length === 1 && chunk.startsWith('来自')) {
110
+ const lf = chunk.indexOf('\n');
111
+ chunk = chunk.slice(0, lf).replace('来自', '更新源').blue + chunk.slice(lf);
112
+ }
113
+ process.stdout.write(chunk);
114
+ }
115
+ });
116
+ const stderr = stderrs.join('');
100
117
  if (print)
101
- console.log(`${this.cwd.fname.slice(0, -1)} 更新远程分支成功`);
118
+ console.log(colored((stderr ? '更新 ' : '') +
119
+ `${this.cwd.fname.slice(0, -1)} 仓库` +
120
+ (remote ? ` ${remote} 源` : '') +
121
+ (args.length > 0 ? ` ${args.join(' ')} ` : '') +
122
+ (stderr ? '成功' : '无更新'), 'green', Boolean(stderr)));
123
+ return stderr;
102
124
  }
103
125
  async checkout(branch = 'main') {
104
126
  let create = false;
package/net.d.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  import net from 'node:net';
2
2
  import { type Readable } from 'node:stream';
3
3
  import type { Cookie, CookieJar, MemoryCookieStore } from 'tough-cookie';
4
+ import { type ValueOf } from './prototype.ts';
4
5
  import type { Encoding } from './file.ts';
5
6
  import { inspect, type Deferred2, type OnTimeout } from './utils.ts';
6
7
  import { type BasicAuth, type BearerAuth } from './net.common.ts';
7
8
  export * from './net.common.ts';
8
- export declare enum MyProxy {
9
- socks5 = "http://127.0.0.1:10080",
10
- whistle = "http://localhost:8899",
11
- work = "http://localhost:10090",
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";
12
13
  /** 需要先启动 server.start_tunnel_server('ddb.test.proxy') */
13
- test = "http://localhost:10091"
14
- }
14
+ readonly test: "http://localhost:10091";
15
+ };
15
16
  export declare const byproxy: {
16
17
  readonly proxy: true;
17
18
  };
@@ -37,7 +38,7 @@ export interface RequestOptions {
37
38
  headers?: Record<string, string>;
38
39
  body?: string | Record<string, any> | Uint8Array | URLSearchParams | Readable;
39
40
  type?: 'application/json' | 'application/x-www-form-urlencoded' | 'multipart/form-data';
40
- proxy?: boolean | MyProxy | string;
41
+ proxy?: boolean | ValueOf<typeof MyProxy> | string;
41
42
  encoding?: Encoding | 'binary';
42
43
  retries?: true | number;
43
44
  timeout?: number;
package/net.js CHANGED
@@ -6,14 +6,13 @@ import { noop } from "./prototype.js";
6
6
  import { inspect, assert, delay, map_values, unique, timeout, check, colored, encode, TimeoutError, set_error_message, defer2, nowstr } from "./utils.js";
7
7
  import { drop_request_headers } from "./net.common.js";
8
8
  export * from "./net.common.js";
9
- export var MyProxy;
10
- (function (MyProxy) {
11
- MyProxy["socks5"] = "http://127.0.0.1:10080";
12
- MyProxy["whistle"] = "http://localhost:8899";
13
- MyProxy["work"] = "http://localhost:10090";
9
+ export const MyProxy = {
10
+ socks5: 'http://127.0.0.1:10080',
11
+ whistle: 'http://localhost:8899',
12
+ work: 'http://localhost:10090',
14
13
  /** 需要先启动 server.start_tunnel_server('ddb.test.proxy') */
15
- MyProxy["test"] = "http://localhost:10091";
16
- })(MyProxy || (MyProxy = {}));
14
+ test: 'http://localhost:10091'
15
+ };
17
16
  export const byproxy = { proxy: true };
18
17
  // ------------------------------------ fetch, request
19
18
  export const cookies = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.3.39",
3
+ "version": "1.3.41",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -53,42 +53,41 @@
53
53
  "@babel/parser": "^7.29.0",
54
54
  "@babel/traverse": "^7.29.0",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^5.8.0",
56
+ "@stylistic/eslint-plugin": "^5.10.0",
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.10",
59
- "@typescript-eslint/eslint-plugin": "^8.55.0",
60
- "@typescript-eslint/parser": "^8.55.0",
61
- "@typescript-eslint/utils": "^8.55.0",
59
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
60
+ "@typescript-eslint/parser": "^8.57.0",
61
+ "@typescript-eslint/utils": "^8.57.0",
62
62
  "archiver": "^7.0.1",
63
63
  "chalk": "^5.6.2",
64
64
  "commander": "^14.0.3",
65
- "css-loader": "^7.1.3",
65
+ "css-loader": "^7.1.4",
66
66
  "emoji-regex": "^10.6.0",
67
- "eslint": "^10.0.0",
68
- "eslint-plugin-import": "^2.32.0",
67
+ "eslint": "^10.0.3",
69
68
  "eslint-plugin-react": "^7.37.5",
70
69
  "https-proxy-agent": "^7.0.6",
71
70
  "i18next": "25.8.1",
72
71
  "i18next-scanner": "^4.6.0",
73
- "koa": "^3.1.1",
72
+ "koa": "^3.1.2",
74
73
  "koa-compress": "^5.2.0",
75
74
  "license-webpack-plugin": "^4.0.2",
76
75
  "mime-types": "^3.0.2",
77
76
  "p-map": "^7.0.4",
78
77
  "react": "^19.2.4",
79
- "react-i18next": "^16.5.4",
78
+ "react-i18next": "^16.5.6",
80
79
  "resolve-path": "^1.4.0",
81
- "sass": "^1.97.3",
80
+ "sass": "^1.98.0",
82
81
  "sass-loader": "^16.0.7",
83
82
  "source-map-loader": "^5.0.0",
84
- "strip-ansi": "^7.1.2",
83
+ "strip-ansi": "^7.2.0",
85
84
  "style-loader": "^4.0.0",
86
85
  "tough-cookie": "^6.0.0",
87
86
  "ts-loader": "^9.5.4",
88
87
  "tslib": "^2.8.1",
89
88
  "typescript": "^5.9.3",
90
- "undici": "^7.21.0",
91
- "webpack": "^5.105.2",
89
+ "undici": "^7.22.0",
90
+ "webpack": "^5.105.4",
92
91
  "webpack-bundle-analyzer": "^5.2.0",
93
92
  "ws": "^8.19.0"
94
93
  },
@@ -101,10 +100,10 @@
101
100
  "@types/koa": "^3.0.1",
102
101
  "@types/koa-compress": "^4.0.7",
103
102
  "@types/mime-types": "^3.0.1",
104
- "@types/node": "^25.2.3",
103
+ "@types/node": "^25.4.0",
105
104
  "@types/react": "^19.2.14",
106
105
  "@types/tough-cookie": "^4.0.5",
107
- "@types/vscode": "^1.109.0",
106
+ "@types/vscode": "^1.110.0",
108
107
  "@types/webpack-bundle-analyzer": "^4.7.0",
109
108
  "@types/ws": "^8.18.1"
110
109
  }
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;
package/process.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { InspectOptions } from 'node:util';
2
2
  import { type ChildProcess } from 'node:child_process';
3
3
  import './prototype.ts';
4
+ import type { ValueOf } from './prototype.ts';
4
5
  import { type Encoding } from './file.ts';
5
6
  import type { MyProxy } from './net.ts';
6
7
  export declare const sea: boolean;
@@ -30,7 +31,7 @@ interface BaseOptions {
30
31
  /** `process.env` 覆盖/添加到 process.env 的环境变量 */
31
32
  envs?: Record<string, string>;
32
33
  /** 创建子进程时添加 http_proxy, https_proxy, no_proxy 环境变量以启用代理 */
33
- proxy?: MyProxy | true;
34
+ proxy?: ValueOf<typeof MyProxy> | true;
34
35
  /** 控制子进程 stdin,默认为 `Boolean(input)` (false 时读空设备),除非传入了 {@link CallOptions.input} 属性
35
36
  - 默认值:
36
37
  - start(): false ('ignore', 空设备)
@@ -236,8 +236,16 @@ export type Greater<T = any> = (a: T, b: T) => boolean;
236
236
  export declare const greater: Greater;
237
237
  export type Less = Greater;
238
238
  export declare const less: Less;
239
+ export type ValueOf<T> = T[keyof T];
239
240
  export declare function to_snake_case(str: string): string;
240
241
  export declare function to_space_case(str: string): string;
242
+ /** 在常量对象上添加反向映射(value -> key)
243
+ ```ts
244
+ const Modifier = { lshift: 0xa0, rshift: 0xa1 } as const
245
+ set_reverse(Modifier)
246
+ // Modifier[0xa0] === 'lshift'
247
+ ``` */
248
+ export declare function set_reverse<T extends Record<string, number | string>>(obj: T): T;
241
249
  export declare function to_method_property_descriptors(methods: {
242
250
  [name: string]: Function;
243
251
  }): PropertyDescriptorMap;
@@ -28,6 +28,17 @@ export function to_space_case(str) {
28
28
  .replaceAll('_', ' ')
29
29
  .strip_if_start(' ');
30
30
  }
31
+ /** 在常量对象上添加反向映射(value -> key)
32
+ ```ts
33
+ const Modifier = { lshift: 0xa0, rshift: 0xa1 } as const
34
+ set_reverse(Modifier)
35
+ // Modifier[0xa0] === 'lshift'
36
+ ``` */
37
+ export function set_reverse(obj) {
38
+ for (const key in obj)
39
+ obj[obj[key]] = key;
40
+ return obj;
41
+ }
31
42
  export function to_method_property_descriptors(methods) {
32
43
  return Object.fromEntries(Object.entries(methods)
33
44
  .map(([name, value]) => ([name, {
package/prototype.d.ts CHANGED
@@ -21,7 +21,7 @@ declare global {
21
21
  readonly magenta_: string;
22
22
  readonly cyan: string;
23
23
  readonly cyan_: string;
24
- readonly grey: string;
24
+ readonly gray: string;
25
25
  readonly underline: string;
26
26
  strip_ansi(this: string): string;
27
27
  }
package/prototype.js CHANGED
@@ -29,7 +29,7 @@ if (!globalThis.my_prototype_defined) {
29
29
  }),
30
30
  // ------------ colors
31
31
  ...Object.fromEntries([
32
- 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'grey',
32
+ 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'gray',
33
33
  'red_', 'green_', 'yellow_', 'blue_', 'magenta_', 'cyan_',
34
34
  'underline',
35
35
  ].map(color => {
@@ -30733,12 +30733,6 @@ if (false) // removed by dead control flow
30733
30733
  /******/ if (cachedModule !== undefined) {
30734
30734
  /******/ return cachedModule.exports;
30735
30735
  /******/ }
30736
- /******/ // Check if module exists (development only)
30737
- /******/ if (__webpack_modules__[moduleId] === undefined) {
30738
- /******/ var e = new Error("Cannot find module '" + moduleId + "'");
30739
- /******/ e.code = 'MODULE_NOT_FOUND';
30740
- /******/ throw e;
30741
- /******/ }
30742
30736
  /******/ // Create a new module (and put it into the cache)
30743
30737
  /******/ var module = __webpack_module_cache__[moduleId] = {
30744
30738
  /******/ id: moduleId,
@@ -30747,6 +30741,12 @@ if (false) // removed by dead control flow
30747
30741
  /******/ };
30748
30742
  /******/
30749
30743
  /******/ // Execute the module function
30744
+ /******/ if (!(moduleId in __webpack_modules__)) {
30745
+ /******/ delete __webpack_module_cache__[moduleId];
30746
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
30747
+ /******/ e.code = 'MODULE_NOT_FOUND';
30748
+ /******/ throw e;
30749
+ /******/ }
30750
30750
  /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
30751
30751
  /******/
30752
30752
  /******/ // Flag the module as loaded