xshell 1.2.14 → 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/file.js CHANGED
@@ -4,7 +4,7 @@ import { t } from "./i18n/instance.js";
4
4
  import { to_json } from "./prototype.js";
5
5
  import { pack, parse } from "./io.js";
6
6
  import { path } from "./path.js";
7
- import { check, Lock, WritableMemoryStream, url_width } from "./utils.js";
7
+ import { check, Lock, WritableMemoryStream, url_width, throttle } from "./utils.js";
8
8
  export { fsp };
9
9
  export const encodings = ['utf-8', 'gb18030', 'shift-jis', 'utf-16le'];
10
10
  export const ramdisk = fexists('T:/TEMP/', { print: false });
@@ -525,8 +525,7 @@ export async function ftail(fp, handler, { print = true } = {}) {
525
525
  let decoder = new TextDecoder();
526
526
  if (print)
527
527
  console.log('开始跟踪追加内容', fp);
528
- const { default: throttle } = await import('lodash/throttle.js');
529
- const onchange_throttled = throttle(async () => {
528
+ const onchange_throttled = throttle(250, async () => {
530
529
  if (lock.locked)
531
530
  return;
532
531
  await lock.request(async (handle) => {
@@ -547,7 +546,7 @@ export async function ftail(fp, handler, { print = true } = {}) {
547
546
  strbuf = chunk.slice(j);
548
547
  await handler(lines);
549
548
  });
550
- }, 250);
549
+ });
551
550
  let watcher = fs.watch(fp, event => {
552
551
  if (event === 'change')
553
552
  onchange_throttled();
@@ -1,6 +1,3 @@
1
- import castArray from 'lodash/castArray.js';
2
- import trim from 'lodash/trim.js';
3
- import _get from 'lodash/get.js';
4
1
  import babel_traverse from '@babel/traverse';
5
2
  // @ts-ignore
6
3
  const { default: traverse } = babel_traverse;
@@ -69,7 +66,7 @@ export function mix_parse_trans_from_string_by_babel(parser) {
69
66
  }
70
67
  return acc;
71
68
  }, {});
72
- const transKey = trim(attr[i18nKey]);
69
+ const transKey = attr[i18nKey].trim();
73
70
  const defaultsString = attr[defaultsKey] || '';
74
71
  if (typeof defaultsString !== 'string')
75
72
  this.log(`defaults value must be a static string, saw ${defaultsString.yellow}`);
@@ -132,7 +129,7 @@ function nodes_to_string(nodes, filepath, onError) {
132
129
  if (t.isStringLiteral(expression))
133
130
  memo += expression.value;
134
131
  else if (t.isObjectExpression(expression) &&
135
- t.isObjectProperty(_get(expression, 'properties[0]')))
132
+ t.isObjectProperty(expression?.properties?.[0]))
136
133
  memo += '{{' + expression.properties[0].key.name + '}}';
137
134
  else
138
135
  onError(() => {
@@ -148,4 +145,7 @@ function nodes_to_string(nodes, filepath, onError) {
148
145
  });
149
146
  return memo;
150
147
  }
148
+ function castArray(value) {
149
+ return Array.isArray(value) ? value : [value];
150
+ }
151
151
  //# sourceMappingURL=parser.js.map
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.14",
3
+ "version": "1.2.16",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -49,17 +49,17 @@
49
49
  ]
50
50
  },
51
51
  "dependencies": {
52
- "@babel/core": "^7.26.8",
53
- "@babel/parser": "^7.26.8",
54
- "@babel/traverse": "^7.26.8",
52
+ "@babel/core": "^7.26.9",
53
+ "@babel/parser": "^7.26.9",
54
+ "@babel/traverse": "^7.26.9",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^3.1.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",
60
- "@typescript-eslint/eslint-plugin": "^8.24.0",
61
- "@typescript-eslint/parser": "^8.24.0",
62
- "@typescript-eslint/utils": "^8.24.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.24.1",
61
+ "@typescript-eslint/parser": "^8.24.1",
62
+ "@typescript-eslint/utils": "^8.24.1",
63
63
  "archiver": "^7.0.1",
64
64
  "chalk": "^5.4.1",
65
65
  "cli-table3": "^0.6.5",
@@ -77,16 +77,15 @@
77
77
  "koa": "^2.15.4",
78
78
  "koa-compress": "^5.1.1",
79
79
  "license-webpack-plugin": "^4.0.2",
80
- "lodash": "^4.17.21",
81
80
  "map-stream": "^0.0.7",
82
81
  "mime-types": "^2.1.35",
83
82
  "ora": "^8.2.0",
84
83
  "react": "^19.0.0",
85
- "react-i18next": "^15.4.0",
84
+ "react-i18next": "^15.4.1",
86
85
  "react-object-model": "^1.2.23",
87
86
  "resolve-path": "^1.4.0",
88
- "sass": "^1.84.0",
89
- "sass-loader": "^16.0.4",
87
+ "sass": "^1.85.0",
88
+ "sass-loader": "^16.0.5",
90
89
  "source-map-loader": "^5.0.0",
91
90
  "strip-ansi": "^7.1.0",
92
91
  "style-loader": "^4.0.0",
@@ -99,12 +98,12 @@
99
98
  "undici": "^7.3.0",
100
99
  "vinyl": "^3.0.0",
101
100
  "vinyl-fs": "^4.0.0",
102
- "webpack": "^5.97.1",
101
+ "webpack": "^5.98.0",
103
102
  "webpack-bundle-analyzer": "^4.10.2",
104
103
  "ws": "^8.18.0"
105
104
  },
106
105
  "devDependencies": {
107
- "@babel/types": "^7.26.8",
106
+ "@babel/types": "^7.26.9",
108
107
  "@types/archiver": "^6.0.3",
109
108
  "@types/babel__traverse": "^7.20.6",
110
109
  "@types/eslint": "^9.6.1",
@@ -112,10 +111,9 @@
112
111
  "@types/gulp-sort": "^2.0.4",
113
112
  "@types/koa": "^2.15.0",
114
113
  "@types/koa-compress": "^4.0.6",
115
- "@types/lodash": "^4.17.15",
116
114
  "@types/mime-types": "^2.1.4",
117
- "@types/node": "^22.13.1",
118
- "@types/react": "^19.0.8",
115
+ "@types/node": "^22.13.4",
116
+ "@types/react": "^19.0.10",
119
117
  "@types/through2": "^2.0.41",
120
118
  "@types/tough-cookie": "^4.0.5",
121
119
  "@types/ua-parser-js": "^0.7.39",
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);
@@ -20,6 +20,7 @@ declare global {
20
20
  position?: 'left' | 'right';
21
21
  }): string;
22
22
  to_regexp(this: string, preservations?: string, flags?: string): RegExp;
23
+ to_snake_case(this: string): string;
23
24
  /** 字符串模式替换
24
25
  - pattern: 匹配部分的格式
25
26
  - pattern_: 替换后的格式
@@ -116,6 +116,12 @@ Object.defineProperties(String.prototype, {
116
116
  .map((c) => c === ']' ? '\\]' : c).join('');
117
117
  return new RegExp(this.replace(new RegExp(`[${replace_chars}]`, 'g'), '\\$&'), flags);
118
118
  },
119
+ to_snake_case() {
120
+ return this.replace(/([A-Z])/g, '_$1')
121
+ .toLowerCase()
122
+ .replace('-', '_')
123
+ .replace(/^_+/, '');
124
+ },
119
125
  refmt(pattern, pattern_, preservations = '', flags = '', transformer = (name, value) => value || '', pattern_placeholder = /\{.*?\}/g) {
120
126
  // --- 转换 pattern 为 pattern_regx
121
127
  let last_end = 0;
package/prototype.d.ts CHANGED
@@ -20,6 +20,7 @@ declare global {
20
20
  position?: 'left' | 'right';
21
21
  }): string;
22
22
  to_regexp(this: string, preservations?: string, flags?: string): RegExp;
23
+ to_snake_case(this: string): string;
23
24
  /** 字符串模式替换
24
25
  - pattern: 匹配部分的格式
25
26
  - pattern_: 替换后的格式
package/prototype.js CHANGED
@@ -120,6 +120,12 @@ if (!globalThis.my_prototype_defined) {
120
120
  .map((c) => c === ']' ? '\\]' : c).join('');
121
121
  return new RegExp(this.replace(new RegExp(`[${replace_chars}]`, 'g'), '\\$&'), flags);
122
122
  },
123
+ to_snake_case() {
124
+ return this.replace(/([A-Z])/g, '_$1')
125
+ .toLowerCase()
126
+ .replace('-', '_')
127
+ .replace(/^_+/, '');
128
+ },
123
129
  refmt(pattern, pattern_, preservations = '', flags = '', transformer = (name, value) => value || '', pattern_placeholder = /\{.*?\}/g) {
124
130
  // --- 转换 pattern 为 pattern_regx
125
131
  let last_end = 0;