xshell 1.0.161 → 1.0.163

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,19 +1,19 @@
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';
6
5
  import { path } from './path.js';
7
6
  const monaco_files = [
8
7
  'loader.js',
8
+ 'nls.messages.zh-cn.js',
9
9
  'editor/editor.main.js',
10
10
  'editor/editor.main.css',
11
- 'editor/editor.main.nls.js',
12
- 'editor/editor.main.nls.zh-cn.js',
13
- 'base/common/worker/simpleWorker.nls.js',
14
11
  'base/worker/workerMain.js',
15
12
  'base/browser/ui/codicons/codicon/codicon.ttf',
16
13
  ...['python', 'javascript', 'typescript', 'css', 'html', 'cpp', 'sql', 'scss', 'shell'].map(language => `basic-languages/${language}/${language}.js`),
14
+ // 太大了,先不加
15
+ // 'language/typescript/tsMode.js',
16
+ // 'language/typescript/tsWorker.js',
17
17
  ];
18
18
  const dependencies = {
19
19
  react: {
@@ -84,8 +84,9 @@ const dependencies = {
84
84
  devs: monaco_files.map(fp => `monaco-editor/dev/vs/${fp}`)
85
85
  },
86
86
  maps: {
87
- productions: monaco_files.filter(fp => fp.endsWith('.js') && !fp.startsWith('basic-languages/') && !fp.startsWith('language/'))
88
- .map(fp => `monaco-editor/min-maps/vs/${fp}.map`),
87
+ productions: monaco_files.filter(fp => fp.endsWith('.js') &&
88
+ !fp.startsWith('basic-languages/') &&
89
+ !fp.startsWith('language/')).map(fp => `monaco-editor/min-maps/${fp.startsWith('nls.messages.') ? '' : 'vs/'}${fp}.map`),
89
90
  devs: [
90
91
  'monaco-editor/dev/vs/base/worker/workerMain.js.map',
91
92
  'monaco-editor/dev/vs/editor/editor.main.js.map',
@@ -112,6 +113,8 @@ export class Bundler {
112
113
  config;
113
114
  htmls;
114
115
  assets;
116
+ globals;
117
+ exclude_modules;
115
118
  license;
116
119
  lcompiler;
117
120
  /** 通过 webpack 从入口文件打包所有依赖生成单个 index.{mjs,cjs} 文件
@@ -154,6 +157,8 @@ export class Bundler {
154
157
  this.source_map = source_map;
155
158
  this.htmls = htmls;
156
159
  this.assets = assets;
160
+ this.globals = globals;
161
+ this.exclude_modules = exclude_modules;
157
162
  if (dependencies) {
158
163
  assert(target === 'web');
159
164
  this.dependencies = dependencies;
@@ -263,6 +268,8 @@ export class Bundler {
263
268
  module: 'ESNext',
264
269
  moduleResolution: 'Bundler',
265
270
  declaration: dts,
271
+ noEmit: false,
272
+ allowImportingTsExtensions: false,
266
273
  ...commonjs2 ? {
267
274
  // 编译为 commonjs 后 import 的依赖是通过 require 引入的,所以需要 interop 去生成 default
268
275
  // nodejs 默认的 import 会自动加上 default,所以不需要 interop
@@ -324,22 +331,6 @@ export class Bundler {
324
331
  }
325
332
  ]
326
333
  },
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
334
  optimization: {
344
335
  minimize: false
345
336
  },
@@ -387,42 +378,63 @@ export class Bundler {
387
378
  async build(print = true) {
388
379
  let timer = new Timer();
389
380
  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
- }
381
+ const { default: Webpack } = await import('webpack');
382
+ this.config.plugins = [
383
+ ...this.globals ? [
384
+ new Webpack.DefinePlugin({
385
+ ...this.globals
386
+ // process: { env: { }, argv: [] }
387
+ })
388
+ ] : [],
389
+ // 使用 IgnorePlugin 能够不打包,但是一旦导入就会报错
390
+ ...this.exclude_modules ? [
391
+ new Webpack.IgnorePlugin({
392
+ resourceRegExp: this.exclude_modules,
393
+ // checkResource: (resource, context) =>
394
+ // resource.startsWith('./vendors/') && !context.fp.startsWith(fpd_node_modules) ,
395
+ })
396
+ ] : [],
397
+ ...this.analyzer ? await (async () => {
398
+ const { BundleAnalyzerPlugin } = await import('webpack-bundle-analyzer');
399
+ return [
400
+ new BundleAnalyzerPlugin({
401
+ analyzerPort: 8880,
402
+ openAnalyzer: false,
403
+ })
404
+ ];
405
+ })() : [],
406
+ ...this.license ? await (async () => {
407
+ const { LicenseWebpackPlugin } = await import('license-webpack-plugin');
408
+ const ignores = new Set([
409
+ 'xshell',
410
+ 'react-object-model',
411
+ '@ant-design/icons-svg',
412
+ '@ant-design/pro-layout',
413
+ '@ant-design/pro-provider',
414
+ '@ant-design/pro-table',
415
+ '@ant-design/pro-utils',
416
+ '@ant-design/pro-form',
417
+ '@ant-design/pro-card',
418
+ '@ant-design/pro-field',
419
+ 'toggle-selection',
420
+ 'ahooks',
421
+ 'size-sensor',
422
+ 'client-only',
423
+ 'only',
424
+ 'koa-compose',
425
+ 'cache-content-type',
426
+ 'isarray',
427
+ ...this.license.ignores || []
428
+ ]);
429
+ return [
430
+ new LicenseWebpackPlugin({
431
+ perChunkOutput: false,
432
+ outputFilename: 'ThirdPartyNotice.txt',
433
+ excludedPackageTest: pkgname => ignores.has(pkgname),
434
+ })
435
+ ];
436
+ })() : [],
437
+ ];
426
438
  this.lcompiler = new Lock(Webpack(this.config));
427
439
  }
428
440
  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.161",
3
+ "version": "1.0.163",
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,34 +100,34 @@
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.1",
130
- "@types/react": "^18.3.3",
129
+ "@types/node": "^22.5.0",
130
+ "@types/react": "^18.3.4",
131
131
  "@types/through2": "^2.0.41",
132
132
  "@types/tough-cookie": "^4.0.5",
133
133
  "@types/ua-parser-js": "^0.7.39",
@@ -1 +1 @@
1
- export {};
1
+ declare function define(proto: any, key: string, func: Function): void;
@@ -29,5 +29,13 @@ if (!Array.prototype.at)
29
29
  define(Array.prototype, 'at', function at(index) {
30
30
  return index >= 0 ? this[index] : this[index + this.length];
31
31
  });
32
- export {};
32
+ if (!Object.groupBy)
33
+ define(Object, 'groupBy', function groupBy(array, callback) {
34
+ return array.reduce((result, element, index) => {
35
+ const key = callback(element, index);
36
+ result[key] ??= [];
37
+ result[key].push(element);
38
+ return result;
39
+ }, {});
40
+ });
33
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