xshell 1.0.162 → 1.0.164

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/builder.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Webpack from 'webpack';
1
+ import type Webpack from 'webpack';
2
2
  import { Lock } from './utils.js';
3
3
  /** target web 时的 npm 包依赖管理
4
4
  有 productions 但无 devs 时,大部分情况是相同配置,因此在 dev 模式下会用 productions
@@ -90,6 +90,8 @@ export declare class Bundler {
90
90
  config: Webpack.Configuration;
91
91
  htmls?: Record<string, HtmlOptions>;
92
92
  assets?: Assets;
93
+ globals?: BundlerOptions['globals'];
94
+ exclude_modules?: BundlerOptions['exclude_modules'];
93
95
  license?: {
94
96
  ignores?: string[];
95
97
  };
package/builder.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { fileURLToPath } from 'url';
2
- import Webpack from 'webpack';
3
2
  import { noprint } from './process.js';
4
3
  import { Lock, Timer, assert, filter_values, not_empty } from './utils.js';
5
4
  import { fcopy, fmkdir, fwrite } from './file.js';
@@ -112,6 +111,8 @@ export class Bundler {
112
111
  config;
113
112
  htmls;
114
113
  assets;
114
+ globals;
115
+ exclude_modules;
115
116
  license;
116
117
  lcompiler;
117
118
  /** 通过 webpack 从入口文件打包所有依赖生成单个 index.{mjs,cjs} 文件
@@ -154,6 +155,8 @@ export class Bundler {
154
155
  this.source_map = source_map;
155
156
  this.htmls = htmls;
156
157
  this.assets = assets;
158
+ this.globals = globals;
159
+ this.exclude_modules = exclude_modules;
157
160
  if (dependencies) {
158
161
  assert(target === 'web');
159
162
  this.dependencies = dependencies;
@@ -263,6 +266,8 @@ export class Bundler {
263
266
  module: 'ESNext',
264
267
  moduleResolution: 'Bundler',
265
268
  declaration: dts,
269
+ noEmit: false,
270
+ allowImportingTsExtensions: false,
266
271
  ...commonjs2 ? {
267
272
  // 编译为 commonjs 后 import 的依赖是通过 require 引入的,所以需要 interop 去生成 default
268
273
  // nodejs 默认的 import 会自动加上 default,所以不需要 interop
@@ -324,22 +329,6 @@ export class Bundler {
324
329
  }
325
330
  ]
326
331
  },
327
- plugins: [
328
- ...globals ? [
329
- new Webpack.DefinePlugin({
330
- ...globals
331
- // process: { env: { }, argv: [] }
332
- })
333
- ] : [],
334
- // 使用 IgnorePlugin 能够不打包,但是一旦导入就会报错
335
- ...exclude_modules ? [
336
- new Webpack.IgnorePlugin({
337
- resourceRegExp: exclude_modules,
338
- // checkResource: (resource, context) =>
339
- // resource.startsWith('./vendors/') && !context.fp.startsWith(fpd_node_modules) ,
340
- })
341
- ] : [],
342
- ],
343
332
  optimization: {
344
333
  minimize: false
345
334
  },
@@ -387,42 +376,63 @@ export class Bundler {
387
376
  async build(print = true) {
388
377
  let timer = new Timer();
389
378
  if (!this.lcompiler) {
390
- if (this.analyzer) {
391
- const { BundleAnalyzerPlugin } = await import('webpack-bundle-analyzer');
392
- this.config.plugins.push(new BundleAnalyzerPlugin({
393
- analyzerPort: 8880,
394
- openAnalyzer: false,
395
- }));
396
- }
397
- if (this.license) {
398
- const { LicenseWebpackPlugin } = await import('license-webpack-plugin');
399
- const ignores = new Set([
400
- 'xshell',
401
- 'react-object-model',
402
- '@ant-design/icons-svg',
403
- '@ant-design/pro-layout',
404
- '@ant-design/pro-provider',
405
- '@ant-design/pro-table',
406
- '@ant-design/pro-utils',
407
- '@ant-design/pro-form',
408
- '@ant-design/pro-card',
409
- '@ant-design/pro-field',
410
- 'toggle-selection',
411
- 'ahooks',
412
- 'size-sensor',
413
- 'client-only',
414
- 'only',
415
- 'koa-compose',
416
- 'cache-content-type',
417
- 'isarray',
418
- ...this.license.ignores || []
419
- ]);
420
- this.config.plugins.push(new LicenseWebpackPlugin({
421
- perChunkOutput: false,
422
- outputFilename: 'ThirdPartyNotice.txt',
423
- excludedPackageTest: pkgname => ignores.has(pkgname),
424
- }));
425
- }
379
+ const { default: Webpack } = await import('webpack');
380
+ this.config.plugins = [
381
+ ...this.globals ? [
382
+ new Webpack.DefinePlugin({
383
+ ...this.globals
384
+ // process: { env: { }, argv: [] }
385
+ })
386
+ ] : [],
387
+ // 使用 IgnorePlugin 能够不打包,但是一旦导入就会报错
388
+ ...this.exclude_modules ? [
389
+ new Webpack.IgnorePlugin({
390
+ resourceRegExp: this.exclude_modules,
391
+ // checkResource: (resource, context) =>
392
+ // resource.startsWith('./vendors/') && !context.fp.startsWith(fpd_node_modules) ,
393
+ })
394
+ ] : [],
395
+ ...this.analyzer ? await (async () => {
396
+ const { BundleAnalyzerPlugin } = await import('webpack-bundle-analyzer');
397
+ return [
398
+ new BundleAnalyzerPlugin({
399
+ analyzerPort: 8880,
400
+ openAnalyzer: false,
401
+ })
402
+ ];
403
+ })() : [],
404
+ ...this.license ? await (async () => {
405
+ const { LicenseWebpackPlugin } = await import('license-webpack-plugin');
406
+ const ignores = new Set([
407
+ 'xshell',
408
+ 'react-object-model',
409
+ '@ant-design/icons-svg',
410
+ '@ant-design/pro-layout',
411
+ '@ant-design/pro-provider',
412
+ '@ant-design/pro-table',
413
+ '@ant-design/pro-utils',
414
+ '@ant-design/pro-form',
415
+ '@ant-design/pro-card',
416
+ '@ant-design/pro-field',
417
+ 'toggle-selection',
418
+ 'ahooks',
419
+ 'size-sensor',
420
+ 'client-only',
421
+ 'only',
422
+ 'koa-compose',
423
+ 'cache-content-type',
424
+ 'isarray',
425
+ ...this.license.ignores || []
426
+ ]);
427
+ return [
428
+ new LicenseWebpackPlugin({
429
+ perChunkOutput: false,
430
+ outputFilename: 'ThirdPartyNotice.txt',
431
+ excludedPackageTest: pkgname => ignores.has(pkgname),
432
+ })
433
+ ];
434
+ })() : [],
435
+ ];
426
436
  this.lcompiler = new Lock(Webpack(this.config));
427
437
  }
428
438
  const stats = await this.lcompiler.request(async (compiler) => new Promise((resolve, reject) => {
package/git.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare class Git {
4
4
  cwd: string;
5
5
  constructor(cwd: string);
6
6
  static init(cwd: string, print?: boolean): Promise<Git>;
7
- static clone(repo: string, fpd: string): Promise<void>;
7
+ static clone(repo: string, fpd: string, shallow?: boolean): Promise<void>;
8
8
  call(args?: any[], { color, print, printers }?: {
9
9
  color?: boolean;
10
10
  print?: CallOptions['print'];
package/git.js CHANGED
@@ -11,9 +11,15 @@ export class Git {
11
11
  await git.call(['init'], { print });
12
12
  return git;
13
13
  }
14
- static async clone(repo, fpd) {
14
+ static async clone(repo, fpd, shallow = false) {
15
15
  await fmkdir(fpd);
16
- await new this(fpd).call(['clone', repo, '.']);
16
+ await new this(fpd)
17
+ .call([
18
+ 'clone',
19
+ ...shallow ? ['--depth', '1'] : [],
20
+ repo,
21
+ '.'
22
+ ]);
17
23
  }
18
24
  async call(args = [], { color = true, print, printers } = {}) {
19
25
  return call(Git.exe, [
@@ -9,7 +9,7 @@ import CliTable from 'cli-table3';
9
9
  import '../../prototype.js';
10
10
  import { path } from '../../path.js';
11
11
  import { map_stream } from '../../utils.js';
12
- import { LANGUAGES, } from '../index.js';
12
+ import { LANGUAGES } from '../index.js';
13
13
  import { RWDict } from '../rwdict.js';
14
14
  import { try_load_dict } from '../utils.js';
15
15
  import { mix_parse_trans_from_string_by_babel } from './parser.js';
@@ -2,6 +2,7 @@ import castArray from 'lodash/castArray.js';
2
2
  import trim from 'lodash/trim.js';
3
3
  import _get from 'lodash/get.js';
4
4
  import babel_traverse from '@babel/traverse';
5
+ // @ts-ignore
5
6
  const { default: traverse } = babel_traverse;
6
7
  import { parse } from '@babel/parser';
7
8
  import t from '@babel/types';
package/net.d.ts CHANGED
@@ -2,11 +2,6 @@ import { type Readable } from 'stream';
2
2
  import type { FormData } from 'undici';
3
3
  import type { WebSocket, CloseEvent, ErrorEvent } from 'ws';
4
4
  import type { Cookie, CookieJar, MemoryCookieStore } from 'tough-cookie';
5
- declare module 'tough-cookie' {
6
- interface MemoryCookieStore {
7
- idx: Record<string, any>;
8
- }
9
- }
10
5
  import './prototype.js';
11
6
  import type { Encoding } from './file.js';
12
7
  import { inspect, Lock } from './utils.js';
package/net.js CHANGED
@@ -39,7 +39,8 @@ const drop_request_headers = new Set([
39
39
  ]);
40
40
  let proxy_agents = {};
41
41
  async function request_retry(url, options, timeout, retries = 0, count = 0) {
42
- const { request: undici_request } = await import('undici');
42
+ let { default: undici, request: undici_request } = await import('undici');
43
+ undici_request ??= undici.request;
43
44
  try {
44
45
  if (timeout > 0)
45
46
  options.signal = AbortSignal.timeout(timeout);
@@ -60,7 +61,9 @@ async function request_retry(url, options, timeout, retries = 0, count = 0) {
60
61
  }
61
62
  }
62
63
  export async function request(url, options = {}) {
63
- const { ProxyAgent: UndiciProxyAgent, FormData } = await import('undici');
64
+ let { default: undici, ProxyAgent: UndiciProxyAgent, FormData } = await import('undici');
65
+ UndiciProxyAgent ??= undici.ProxyAgent;
66
+ FormData ??= undici.FormData;
64
67
  const { Cookie } = await import('tough-cookie');
65
68
  await cookies.init();
66
69
  const { queries, headers: _headers, body, type = 'application/json', timeout = 5 * 1000, auth, cookies: _cookies, raw = false, full = false, redirect = 'follow', decode = true, } = options;
@@ -82,7 +85,7 @@ export async function request(url, options = {}) {
82
85
  let headers = {
83
86
  'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja-JP;q=0.6,ja;q=0.5',
84
87
  'accept-encoding': 'gzip, deflate, br',
85
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36',
88
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
86
89
  'sec-ch-ua-platform': '"Windows"',
87
90
  'sec-ch-ua-platform-version': '"15.0.0"',
88
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.162",
3
+ "version": "1.0.164",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -50,16 +50,16 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@babel/core": "^7.25.2",
53
- "@babel/parser": "^7.25.3",
54
- "@babel/traverse": "^7.25.3",
53
+ "@babel/parser": "^7.25.4",
54
+ "@babel/traverse": "^7.25.4",
55
55
  "@koa/cors": "^5.0.0",
56
56
  "@stylistic/eslint-plugin": "^2.6.4",
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.9",
59
59
  "@types/ws": "^8.5.12",
60
- "@typescript-eslint/eslint-plugin": "^8.2.0",
61
- "@typescript-eslint/parser": "^8.2.0",
62
- "@typescript-eslint/utils": "^8.2.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.3.0",
61
+ "@typescript-eslint/parser": "^8.3.0",
62
+ "@typescript-eslint/utils": "^8.3.0",
63
63
  "@xterm/addon-fit": "^0.10.0",
64
64
  "@xterm/addon-web-links": "^0.11.0",
65
65
  "@xterm/addon-webgl": "^0.18.0",
@@ -74,8 +74,8 @@
74
74
  "colors": "^1.4.0",
75
75
  "commander": "^12.1.0",
76
76
  "css-loader": "^7.1.2",
77
- "emoji-regex": "^10.3.0",
78
- "eslint": "^9.9.0",
77
+ "emoji-regex": "^10.4.0",
78
+ "eslint": "^9.9.1",
79
79
  "eslint-plugin-import": "^2.29.1",
80
80
  "eslint-plugin-react": "^7.35.0",
81
81
  "gulp-sort": "^2.0.0",
@@ -89,10 +89,10 @@
89
89
  "lodash": "^4.17.21",
90
90
  "map-stream": "^0.0.7",
91
91
  "mime-types": "^2.1.35",
92
- "ora": "^8.0.1",
92
+ "ora": "^8.1.0",
93
93
  "react": "^18.3.1",
94
94
  "react-i18next": "^15.0.1",
95
- "react-object-model": "^1.2.11",
95
+ "react-object-model": "^1.2.13",
96
96
  "resolve-path": "^1.4.0",
97
97
  "sass": "^1.77.8",
98
98
  "sass-loader": "^16.0.1",
@@ -100,33 +100,33 @@
100
100
  "strip-ansi": "^7.1.0",
101
101
  "style-loader": "^4.0.0",
102
102
  "through2": "^4.0.2",
103
- "tough-cookie": "^4.1.4",
103
+ "tough-cookie": "^5.0.0-rc.4",
104
104
  "ts-loader": "^9.5.1",
105
- "tslib": "^2.6.3",
105
+ "tslib": "^2.7.0",
106
106
  "typescript": "^5.5.4",
107
107
  "ua-parser-js": "^2.0.0-beta.3",
108
108
  "undici": "^6.19.8",
109
109
  "vinyl": "^3.0.0",
110
110
  "vinyl-fs": "^4.0.0",
111
- "webpack": "^5.93.0",
111
+ "webpack": "^5.94.0",
112
112
  "webpack-bundle-analyzer": "^4.10.2",
113
113
  "ws": "^8.18.0"
114
114
  },
115
115
  "devDependencies": {
116
- "@babel/types": "^7.25.2",
116
+ "@babel/types": "^7.25.4",
117
117
  "@types/ali-oss": "^6.16.11",
118
118
  "@types/archiver": "^6.0.2",
119
119
  "@types/babel__traverse": "^7.20.6",
120
120
  "@types/byte-size": "^8.1.2",
121
121
  "@types/chardet": "^0.8.3",
122
- "@types/eslint": "^9.6.0",
122
+ "@types/eslint": "^9.6.1",
123
123
  "@types/estree": "^1.0.5",
124
124
  "@types/gulp-sort": "^2.0.4",
125
125
  "@types/koa": "^2.15.0",
126
126
  "@types/koa-compress": "^4.0.6",
127
127
  "@types/lodash": "^4.17.7",
128
128
  "@types/mime-types": "^2.1.4",
129
- "@types/node": "^22.4.2",
129
+ "@types/node": "^22.5.0",
130
130
  "@types/react": "^18.3.4",
131
131
  "@types/through2": "^2.0.41",
132
132
  "@types/tough-cookie": "^4.0.5",
package/path.d.ts CHANGED
@@ -55,7 +55,7 @@ export declare function extname(path: string): string;
55
55
  /** `/` */
56
56
  export declare const sep = "/";
57
57
  /** The platform-specific file delimiter. ';' or ':'. */
58
- export declare const delimiter: ":" | ";";
58
+ export declare const delimiter: ";" | ":";
59
59
  /** Returns an object from a path string - the opposite of format().
60
60
  @param path path to evaluate.
61
61
  @throws {TypeError} if `path` is not a string. */
@@ -83,7 +83,7 @@ export declare let path: {
83
83
  basename: typeof basename;
84
84
  extname: typeof extname;
85
85
  sep: string;
86
- delimiter: ":" | ";";
86
+ delimiter: ";" | ":";
87
87
  parse: typeof parse;
88
88
  format: typeof format;
89
89
  toNamespacedPath: typeof toNamespacedPath;
@@ -1 +1 @@
1
- export {};
1
+ declare function define(proto: any, key: string, func: Function): void;
@@ -38,5 +38,4 @@ if (!Object.groupBy)
38
38
  return result;
39
39
  }, {});
40
40
  });
41
- export {};
42
41
  //# sourceMappingURL=polyfill.browser.js.map
package/process.d.ts CHANGED
@@ -99,7 +99,7 @@ export interface CallError {
99
99
  child output encoding. When set to binary, return stdout, stderr is of type Buffer; otherwise it is string
100
100
  - print?: `true` print 选项,支持设置细项 print option (with details)
101
101
  - stdio?: `'pipe'` 设置为 'ignore' 时忽略 stdio 处理 when 'ignore' then ignore stdio processing
102
- - input?: string, start 子进程之后写入到子进程 stdin 中的内容 After starting the sub-process, write to the content of the sub-process STDIN
102
+ - input?: string, 启动子进程之后写入到子进程 stdin 中的内容,写完后关闭子进程 stdin (pty 不关闭)
103
103
  - detached?: `false` 是否断开和 child 的关系 (ignore stdio, unref) whether to break the connection with child (ignore stdio, unref)
104
104
  - throw_code?: `true` code 不为 0 时是否抛出异常 whether to throw Error when code is not 0 */
105
105
  export declare function call(exe: string, args?: string[]): Promise<CallResult<string>>;
package/process.js CHANGED
@@ -122,7 +122,7 @@ export async function call(exe, args = [], options = {}) {
122
122
  print: false,
123
123
  });
124
124
  if (input)
125
- child.stdin.write(input);
125
+ child.stdin.end(input);
126
126
  // --- collect output
127
127
  let stdouts = [];
128
128
  let stderrs = [];
package/tsconfig.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  // --- module
4
- "module": "NodeNext", // none, CommonJS, amd, system, umd, es6, es2015, ESNext
5
- "moduleResolution": "NodeNext",
4
+ "module": "ESNext", // none, CommonJS, amd, system, umd, es6, es2015, ESNext
5
+ "moduleResolution": "Bundler",
6
6
  "allowSyntheticDefaultImports": true,
7
7
  "esModuleInterop": false,
8
8
  "resolveJsonModule": true,
@@ -22,6 +22,7 @@
22
22
 
23
23
 
24
24
  // --- emit
25
+ "noEmit": true,
25
26
  "declaration": true,
26
27
  "emitDeclarationOnly": false,
27
28
  "noEmitOnError": false,
@@ -38,6 +39,7 @@
38
39
  "removeComments": false,
39
40
  "preserveConstEnums": true,
40
41
  "forceConsistentCasingInFileNames": true,
42
+ "allowImportingTsExtensions": true,
41
43
 
42
44
 
43
45
  // --- type checking
@@ -68,7 +68,7 @@ export declare function encode(str: string): Uint8Array;
68
68
  在流式处理 (buffer 可能不完整) 时,应使用独立的 TextDecoder 实例调用 decode(buffer, { stream: true }) */
69
69
  export declare function decode(buffer: Uint8Array): string;
70
70
  /** 字符串字典序比较 */
71
- export declare function strcmp(l: string, r: string): 0 | 1 | -1;
71
+ export declare function strcmp(l: string, r: string): 1 | 0 | -1;
72
72
  /** 比较 1.10.02 这种版本号
73
73
  - l, r: 两个版本号字符串
74
74
  - loose?: 宽松模式,允许两个版本号格式(位数)不一致 */
package/utils.d.ts CHANGED
@@ -37,7 +37,7 @@ export declare function filter_values<TObj extends Record<string, any>>(obj: TOb
37
37
  /** 忽略对象中的 keys, 返回新对象 */
38
38
  export declare function omit<TObj>(obj: TObj, omit_keys: string[]): TObj;
39
39
  /** 字符串字典序比较 */
40
- export declare function strcmp(l: string, r: string): 0 | 1 | -1;
40
+ export declare function strcmp(l: string, r: string): 1 | 0 | -1;
41
41
  /** 比较 1.10.02 这种版本号
42
42
  - l, r: 两个版本号字符串
43
43
  - loose?: 宽松模式,允许两个版本号格式(位数)不一致 */