xshell 1.0.133 → 1.0.134

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/apps.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import type { Readable } from 'stream';
3
2
  import type OSS from 'ali-oss';
4
3
  import { type CallOptions } from './process.js';
package/builder.d.ts CHANGED
@@ -21,7 +21,7 @@ export interface Dependency {
21
21
  devs?: string[];
22
22
  };
23
23
  }
24
- type DependencyId = 'react' | 'react-dom' | 'lodash' | 'jquery' | 'xterm' | 'swiper' | 'dayjs' | 'antd' | 'antd-icons' | 'vscode-oniguruma' | 'antd-plots' | 'gridstack' | 'quill' | 'monaco';
24
+ type DependencyId = 'react' | 'react-dom' | 'lodash' | 'jquery' | 'xterm' | 'swiper' | 'dayjs' | 'antd' | 'antd-icons' | 'vscode-oniguruma' | 'antd-plots' | 'gridstack' | 'quill' | 'monaco' | 'echarts';
25
25
  export interface HtmlBuildOptions {
26
26
  title: string;
27
27
  device_viewport?: boolean;
@@ -36,9 +36,21 @@ export interface HtmlBuildOptions {
36
36
  /** 在 index.js 之后加载 */
37
37
  after?: string[];
38
38
  };
39
+ /** 额外需要加载的 module 脚本, 在 index.js 之前 */
40
+ mscripts?: string[];
39
41
  heads?: string[];
40
42
  notice?: boolean;
41
43
  }
44
+ interface AssetOption {
45
+ /** 相对 fpd_root 的路径 */
46
+ src: string;
47
+ /** 默认为 {fpd_out}/ 加上 srcs 中的路径 */
48
+ out?: string;
49
+ }
50
+ type Assets = {
51
+ productions?: (string | AssetOption)[];
52
+ devs?: (string | AssetOption)[];
53
+ };
42
54
  export interface BundlerOptions {
43
55
  dependencies?: DependencyId[];
44
56
  source_map?: boolean;
@@ -56,13 +68,10 @@ export interface BundlerOptions {
56
68
  cache_version?: string;
57
69
  single_chunk?: boolean;
58
70
  exclude_modules?: RegExp;
71
+ assets?: Assets;
59
72
  license?: {
60
73
  ignores?: string[];
61
74
  };
62
- assets?: {
63
- productions?: string[];
64
- devs?: string[];
65
- };
66
75
  htmls?: Record<string, HtmlBuildOptions>;
67
76
  }
68
77
  export declare class Bundler {
@@ -75,10 +84,7 @@ export declare class Bundler {
75
84
  analyzer: boolean;
76
85
  config: Webpack.Configuration;
77
86
  htmls?: Record<string, HtmlBuildOptions>;
78
- assets?: {
79
- productions?: string[];
80
- devs?: string[];
81
- };
87
+ assets?: Assets;
82
88
  license?: {
83
89
  ignores?: string[];
84
90
  };
@@ -97,7 +103,9 @@ export declare class Bundler {
97
103
  - externals?: 配置外部模块
98
104
  - htmls?: 配置要生成的 html, 比如 { 'index.html', { title: '文件', ... } }
99
105
  - assets?: 项目中需要直接复制到输出目录的资源,有 productions 但无 devs 时 (是同一套),
100
- 在 dev 模式下会用 productions 中的资源,如果不需要 productions 资源, devs 可以设置为 [ ]
106
+ 在 dev 模式下会用 productions 中的资源,如果不需要 productions 资源, devs 可以设置为 [ ],
107
+ 每一项是 string 或者 { src: '...', out: '...' },路径相对于 fpd_root 和 fpd_out
108
+ - local_loaders?: `true` true 时使用项目 node_modules/ 中的 loader; false 时使用 D:/0/ 下面的
101
109
  - commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
102
110
  - single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
103
111
  - dynamic_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
@@ -129,10 +137,7 @@ export declare class Bundler {
129
137
  copy_files({ dependencies, production, assets, fpd_root, fpd_out, print }?: {
130
138
  dependencies?: DependencyId[];
131
139
  production?: boolean;
132
- assets?: {
133
- productions?: string[];
134
- devs?: string[];
135
- };
140
+ assets?: Assets;
136
141
  fpd_root?: string;
137
142
  fpd_out?: string;
138
143
  print?: {
@@ -144,6 +149,6 @@ export declare class Bundler {
144
149
  resolve_config(config: {
145
150
  productions?: string[];
146
151
  devs?: string[];
147
- }, production: boolean): string[];
152
+ } | Assets | undefined, production: boolean): (string | AssetOption)[];
148
153
  }
149
154
  export {};
package/builder.js CHANGED
@@ -89,6 +89,9 @@ const dependencies = {
89
89
  devs: monaco_files.filter(fp => fp.endsWith('.js') && !fp.startsWith('basic-languages/') && !fp.startsWith('language/'))
90
90
  .map(fp => `monaco-editor/dev/vs/${fp}.map`),
91
91
  }
92
+ },
93
+ echarts: {
94
+ productions: ['echarts/dist/echarts.js']
92
95
  }
93
96
  };
94
97
  export class Bundler {
@@ -118,7 +121,9 @@ export class Bundler {
118
121
  - externals?: 配置外部模块
119
122
  - htmls?: 配置要生成的 html, 比如 { 'index.html', { title: '文件', ... } }
120
123
  - assets?: 项目中需要直接复制到输出目录的资源,有 productions 但无 devs 时 (是同一套),
121
- 在 dev 模式下会用 productions 中的资源,如果不需要 productions 资源, devs 可以设置为 [ ]
124
+ 在 dev 模式下会用 productions 中的资源,如果不需要 productions 资源, devs 可以设置为 [ ],
125
+ 每一项是 string 或者 { src: '...', out: '...' },路径相对于 fpd_root 和 fpd_out
126
+ - local_loaders?: `true` true 时使用项目 node_modules/ 中的 loader; false 时使用 D:/0/ 下面的
122
127
  - commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
123
128
  - single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
124
129
  - dynamic_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
@@ -440,7 +445,7 @@ export class Bundler {
440
445
  await this.close();
441
446
  }
442
447
  async build_htmls(print = { info: true, files: false }) {
443
- await Promise.all(Object.entries(this.htmls).map(async ([fp_html, { device_viewport: device_width = false, fp_icon, fp_manifest, dependencies: _dependencies = this.dependencies, title, scripts, notice = false, heads, }]) => {
448
+ await Promise.all(Object.entries(this.htmls).map(async ([fp_html, { device_viewport: device_width = false, fp_icon, fp_manifest, dependencies: _dependencies = this.dependencies, title, scripts, mscripts, notice = false, heads, }]) => {
444
449
  const html = '<!doctype html>\n' +
445
450
  '<html>\n' +
446
451
  ' <head>\n' +
@@ -450,8 +455,9 @@ export class Bundler {
450
455
  (device_width ? " <meta name='viewport' content='width=device-width, initial-scale=1.0' />\n" : '') +
451
456
  (fp_icon ? ` <link rel='icon' href='${fp_icon}' />\n` : '') +
452
457
  (fp_manifest ? ` <link rel='manifest' href='${fp_manifest}' />\n` : '') +
453
- this.resolve_dependency_files(_dependencies, false, { production: this.production }).map(fp => ` <script src='/vendors/${fp}' defer></script>`).join_lines() +
458
+ this.resolve_dependency_files(_dependencies, false, { production: this.production }).map(fp => ` <script src='./vendors/${fp}' defer></script>`).join_lines() +
454
459
  (scripts?.before ? scripts.before.map(fp => ` <script src='${fp}' defer></script>`).join_lines() : '') +
460
+ (mscripts ? mscripts.map(fp => ` <script src='${fp}' type='module'></script>`).join_lines() : '') +
455
461
  " <script src='./index.js' type='module'></script>\n" +
456
462
  (scripts?.after ? scripts.after.map(fp => ` <script src='${fp}' defer></script>`).join_lines() : '') +
457
463
  ' </head>\n' +
@@ -505,9 +511,21 @@ export class Bundler {
505
511
  ...this.resolve_dependency_files(dependencies, true, { production })
506
512
  .map(async (fp) => fcopy(`${fpd_root}node_modules/${fp}`, `${fpd_out}vendors/${fp}`, { print: print.files })),
507
513
  ...this.resolve_config(assets, production)
508
- .map(async (fp) => fcopy(`${fpd_root}${fp}`, `${fpd_out}${fp}`, { print: print.files })),
509
- ...this.htmls ? Object.entries(this.htmls).map(async ([fp_html, { fp_icon, fp_manifest, scripts }]) => Promise.all([fp_icon, fp_manifest, ...(scripts?.before || []), ...(scripts?.after || [])]
510
- .filter(not_empty)
514
+ .map(async (asset) => {
515
+ let src, out;
516
+ if (typeof asset === 'string')
517
+ src = out = asset;
518
+ else
519
+ ({ src, out } = asset);
520
+ fcopy(`${fpd_root}${src}`, `${fpd_out}${out}`, { print: print.files });
521
+ }),
522
+ ...this.htmls ? Object.entries(this.htmls).map(async ([fp_html, { fp_icon, fp_manifest, scripts, mscripts }]) => Promise.all([
523
+ fp_icon,
524
+ fp_manifest,
525
+ ...(scripts?.before || []),
526
+ ...(scripts?.after || []),
527
+ ...(mscripts || [])
528
+ ].filter(not_empty)
511
529
  .map(fp => fcopy(path.resolve(`${fpd_root}${fp_html}`.fdir, fp), path.resolve(`${fpd_out}${fp_html}`.fdir, fp), { print: print.files })))) : []
512
530
  ]);
513
531
  }
package/file.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
1
  import { promises as fsp, default as fs } from 'fs';
5
2
  type FileHandle = fsp.FileHandle & {
6
3
  fp: string;
@@ -1,9 +1,9 @@
1
1
  import { I18N } from './index.js';
2
2
  export declare let i18n: I18N;
3
3
  declare const t: (text: string, options?: {
4
- [key: string]: any;
5
4
  language?: import("./index.js").Language;
6
5
  context?: string;
7
6
  count?: number;
7
+ [key: string]: any;
8
8
  }) => string, language: import("./index.js").Language;
9
9
  export { t, language };
@@ -1,3 +1,4 @@
1
+ import { PluginItem } from '@babel/core';
1
2
  export declare let unmarkeds: any[];
2
3
  export declare function Checker({ filepath }: {
3
4
  filepath: any;
@@ -27,7 +27,7 @@ declare const DEFAULT_CONFIG: {
27
27
  context: boolean;
28
28
  contextFallback: boolean;
29
29
  contextSeparator: string;
30
- plural(language: string, ns: string, key: string, options: any /** Config */): boolean;
30
+ plural(language: string, ns: string, key: string, options: any /** Config */): language is "en";
31
31
  pluralFallback: boolean;
32
32
  pluralSeparator: string;
33
33
  interpolation: {
package/net.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  import { type Readable } from 'stream';
4
2
  import type { FormData } from 'undici';
5
3
  import type { WebSocket, CloseEvent, ErrorEvent } from 'ws';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.133",
3
+ "version": "1.0.134",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -102,7 +102,7 @@
102
102
  "tough-cookie": "^4.1.4",
103
103
  "ts-loader": "^9.5.1",
104
104
  "tslib": "^2.6.3",
105
- "typescript": "^5.4.5",
105
+ "typescript": "^5.5.2",
106
106
  "ua-parser-js": "^2.0.0-beta.3",
107
107
  "undici": "^6.19.2",
108
108
  "vinyl": "^3.0.0",
@@ -125,7 +125,7 @@
125
125
  "@types/koa-compress": "^4.0.6",
126
126
  "@types/lodash": "^4.17.5",
127
127
  "@types/mime-types": "^2.1.4",
128
- "@types/node": "^20.14.6",
128
+ "@types/node": "^20.14.7",
129
129
  "@types/react": "^18.3.3",
130
130
  "@types/through2": "^2.0.41",
131
131
  "@types/tough-cookie": "^4.0.5",
package/path.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import { default as npath, type FormatInputPathObject } from 'path';
3
2
  export declare function to_fp(str: string): string;
4
3
  /** Normalize a string path, reducing '..' and '.' parts.
package/process.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
1
  import { type ChildProcess } from 'child_process';
5
2
  import './prototype.js';
6
3
  import { Encoding } from './file.js';
package/prototype.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  declare global {
3
2
  var my_prototype_defined: boolean;
4
3
  interface String {
package/server.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
- /// <reference types="node" resolution-mode="require"/>
5
1
  import { type Server as HttpServer, type IncomingHttpHeaders, type IncomingMessage } from 'http';
6
2
  import { type Http2SecureServer, type IncomingHttpHeaders as IncomingHttp2Headers } from 'http2';
7
3
  import type { Duplex } from 'stream';
@@ -5,4 +5,4 @@ export declare let toaster: {
5
5
  toast(message: string): Promise<void>;
6
6
  show(): Promise<void>;
7
7
  };
8
- export declare const toast: (message: string) => Promise<void>;
8
+ export declare const toast: (typeof toaster)["toast"];
@@ -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): 1 | 0 | -1;
71
+ export declare function strcmp(l: string, r: string): 0 | 1 | -1;
72
72
  /** 比较 1.10.02 这种版本号 */
73
73
  export declare function vercmp(l: string, r: string): number;
74
74
  export declare function get<TReturn = any>(obj: any, keypath: string): TReturn;
package/utils.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
- /// <reference types="node" resolution-mode="require"/>
5
1
  import { Writable, Transform, type Readable, type Duplex, type TransformCallback } from 'stream';
6
2
  import util from 'util';
7
3
  import type { TimerOptions } from 'timers';
@@ -41,7 +37,7 @@ export declare function filter_values<TObj extends Record<string, any>>(obj: TOb
41
37
  /** 忽略对象中的 keys, 返回新对象 */
42
38
  export declare function omit<TObj>(obj: TObj, omit_keys: string[]): TObj;
43
39
  /** 字符串字典序比较 */
44
- export declare function strcmp(l: string, r: string): 1 | 0 | -1;
40
+ export declare function strcmp(l: string, r: string): 0 | 1 | -1;
45
41
  /** 比较 1.10.02 这种版本号 */
46
42
  export declare function vercmp(l: string, r: string): number;
47
43
  export declare function get<TReturn = any>(obj: any, keypath: string): TReturn;