xshell 1.2.16 → 1.2.18
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 +17 -1
- package/builder.js +22 -3
- package/net.d.ts +1 -1
- package/package.json +4 -4
- package/process.d.ts +1 -2
- package/process.js +1 -2
package/builder.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export interface HtmlOptions {
|
|
|
48
48
|
heads?: string[];
|
|
49
49
|
notice?: boolean;
|
|
50
50
|
}
|
|
51
|
+
export interface SingleJsConfig {
|
|
52
|
+
js: string;
|
|
53
|
+
entry: string;
|
|
54
|
+
}
|
|
51
55
|
interface AssetOption {
|
|
52
56
|
/** 相对 fpd_root 的路径,或者绝对路径 */
|
|
53
57
|
src: string;
|
|
@@ -82,6 +86,10 @@ export interface BundlerOptions {
|
|
|
82
86
|
template?: boolean;
|
|
83
87
|
license?: boolean;
|
|
84
88
|
htmls?: Record<string, HtmlOptions>;
|
|
89
|
+
single_js?: {
|
|
90
|
+
js: string;
|
|
91
|
+
entry: string;
|
|
92
|
+
};
|
|
85
93
|
}
|
|
86
94
|
export declare class Bundler {
|
|
87
95
|
name: string;
|
|
@@ -97,6 +105,7 @@ export declare class Bundler {
|
|
|
97
105
|
assets?: Assets;
|
|
98
106
|
assets_root: string;
|
|
99
107
|
template: boolean;
|
|
108
|
+
single_js?: BundlerOptions['single_js'];
|
|
100
109
|
globals?: BundlerOptions['globals'];
|
|
101
110
|
exclude_modules?: BundlerOptions['exclude_modules'];
|
|
102
111
|
license?: boolean;
|
|
@@ -121,6 +130,9 @@ export declare class Bundler {
|
|
|
121
130
|
启用后 assets, html 中的 icon, scripts 路径直接在前面添加 assets_root 来生成最终 html href
|
|
122
131
|
未启用时使用相对 html 路径来生成最终 html href
|
|
123
132
|
- template?: `false` 除了生成对应的 html 之外,还生成所有路径为 `{root}/...` 的模板 html 文件, 方便后续 server 替换渲染
|
|
133
|
+
- single_js?: 设置生成的单个 js 入口文件,无其他依赖,通过 script module 作为入口加载,含有 import 加载其他 externals 和某个 entry,类似 htmls 配置要生成的 html
|
|
134
|
+
- js: js 入口文件名
|
|
135
|
+
- entry: 使用的 entry
|
|
124
136
|
- local_loaders?: `true` true 时使用项目 node_modules/ 中的 loader; false 时使用 D:/0/ 下面的
|
|
125
137
|
- commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
|
|
126
138
|
- expose?: `false` 入口模块所有导出的属性赋值到全局对象 globalThis 上
|
|
@@ -136,7 +148,7 @@ export declare class Bundler {
|
|
|
136
148
|
- production?: `true` webpack mode 设置为 'production'
|
|
137
149
|
- sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
|
|
138
150
|
- license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
|
|
139
|
-
constructor(name: string, target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, fpdt_cache: string, entry: Record<string, string>, { source_map, globals, external_dayjs, externals, htmls, assets, assets_root, template, commonjs2, expose, single_chunk, dynamic_import, resolve_alias, resolve_fallback, assets_stats, analyzer, dts, exclude_modules, cache_version, production, sass, dependencies, license, }?: BundlerOptions);
|
|
151
|
+
constructor(name: string, target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, fpdt_cache: string, entry: Record<string, string>, { source_map, globals, external_dayjs, externals, htmls, assets, assets_root, template, single_js, commonjs2, expose, single_chunk, dynamic_import, resolve_alias, resolve_fallback, assets_stats, analyzer, dts, exclude_modules, cache_version, production, sass, dependencies, license, }?: BundlerOptions);
|
|
140
152
|
build(print?: boolean): Promise<void>;
|
|
141
153
|
close(): Promise<void>;
|
|
142
154
|
build_all(print?: boolean): Promise<void>;
|
|
@@ -148,6 +160,10 @@ export declare class Bundler {
|
|
|
148
160
|
info: boolean;
|
|
149
161
|
files: boolean;
|
|
150
162
|
}): Promise<void>;
|
|
163
|
+
build_single_js(print?: {
|
|
164
|
+
info: boolean;
|
|
165
|
+
files: boolean;
|
|
166
|
+
}): Promise<void>;
|
|
151
167
|
resolve_dependencies(dependency_ids: DependencyId[], resolveds?: Set<DependencyId>): Set<DependencyId>;
|
|
152
168
|
/** 解析依赖的文件
|
|
153
169
|
- dependencies: 依赖 id
|
package/builder.js
CHANGED
|
@@ -137,6 +137,7 @@ export class Bundler {
|
|
|
137
137
|
assets;
|
|
138
138
|
assets_root;
|
|
139
139
|
template;
|
|
140
|
+
single_js;
|
|
140
141
|
globals;
|
|
141
142
|
exclude_modules;
|
|
142
143
|
license;
|
|
@@ -161,6 +162,9 @@ export class Bundler {
|
|
|
161
162
|
启用后 assets, html 中的 icon, scripts 路径直接在前面添加 assets_root 来生成最终 html href
|
|
162
163
|
未启用时使用相对 html 路径来生成最终 html href
|
|
163
164
|
- template?: `false` 除了生成对应的 html 之外,还生成所有路径为 `{root}/...` 的模板 html 文件, 方便后续 server 替换渲染
|
|
165
|
+
- single_js?: 设置生成的单个 js 入口文件,无其他依赖,通过 script module 作为入口加载,含有 import 加载其他 externals 和某个 entry,类似 htmls 配置要生成的 html
|
|
166
|
+
- js: js 入口文件名
|
|
167
|
+
- entry: 使用的 entry
|
|
164
168
|
- local_loaders?: `true` true 时使用项目 node_modules/ 中的 loader; false 时使用 D:/0/ 下面的
|
|
165
169
|
- commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
|
|
166
170
|
- expose?: `false` 入口模块所有导出的属性赋值到全局对象 globalThis 上
|
|
@@ -176,7 +180,7 @@ export class Bundler {
|
|
|
176
180
|
- production?: `true` webpack mode 设置为 'production'
|
|
177
181
|
- sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
|
|
178
182
|
- license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
|
|
179
|
-
constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, external_dayjs = false, externals, htmls, assets, assets_root = '/', template = false, commonjs2 = false, expose = false, single_chunk = true, dynamic_import = true, resolve_alias, resolve_fallback, assets_stats = true, analyzer = false, dts = false, exclude_modules, cache_version, production = true, sass, dependencies, license, } = {}) {
|
|
183
|
+
constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, external_dayjs = false, externals, htmls, assets, assets_root = '/', template = false, single_js, commonjs2 = false, expose = false, single_chunk = true, dynamic_import = true, resolve_alias, resolve_fallback, assets_stats = true, analyzer = false, dts = false, exclude_modules, cache_version, production = true, sass, dependencies, license, } = {}) {
|
|
180
184
|
this.name = name;
|
|
181
185
|
this.analyzer = analyzer;
|
|
182
186
|
this.production = production;
|
|
@@ -188,6 +192,7 @@ export class Bundler {
|
|
|
188
192
|
this.assets = assets;
|
|
189
193
|
this.assets_root = assets_root;
|
|
190
194
|
this.template = template;
|
|
195
|
+
this.single_js = single_js;
|
|
191
196
|
this.globals = globals;
|
|
192
197
|
this.exclude_modules = exclude_modules;
|
|
193
198
|
if (dependencies) {
|
|
@@ -499,7 +504,8 @@ export class Bundler {
|
|
|
499
504
|
await Promise.all([
|
|
500
505
|
this.build(print),
|
|
501
506
|
this.copy_files({ print: { info: print, files: false } }),
|
|
502
|
-
this.target === 'web' && this.htmls && this.build_htmls({ info: print, files: false })
|
|
507
|
+
this.target === 'web' && this.htmls && this.build_htmls({ info: print, files: false }),
|
|
508
|
+
this.target === 'web' && this.single_js && this.build_single_js({ info: print, files: false })
|
|
503
509
|
]);
|
|
504
510
|
}
|
|
505
511
|
/** 打包构建 js, 构建 html, 复制依赖文件 */
|
|
@@ -507,7 +513,8 @@ export class Bundler {
|
|
|
507
513
|
await Promise.all([
|
|
508
514
|
this.build_and_close(print),
|
|
509
515
|
this.copy_files({ print: { info: print, files: false } }),
|
|
510
|
-
this.target === 'web' && this.htmls && this.build_htmls({ info: print, files: false })
|
|
516
|
+
this.target === 'web' && this.htmls && this.build_htmls({ info: print, files: false }),
|
|
517
|
+
this.target === 'web' && this.single_js && this.build_single_js({ info: print, files: false })
|
|
511
518
|
]);
|
|
512
519
|
}
|
|
513
520
|
/** 仅打包构建 js, 不复制依赖 */
|
|
@@ -558,6 +565,18 @@ export class Bundler {
|
|
|
558
565
|
if (print.files)
|
|
559
566
|
console.log(`${this.name} 的所有 html 页面构建完成`);
|
|
560
567
|
}
|
|
568
|
+
async build_single_js(print = { info: true, files: false }) {
|
|
569
|
+
const { js, entry } = this.single_js;
|
|
570
|
+
await fwrite(`${this.fpd_out}${js}`, [
|
|
571
|
+
...this.resolve_dependency_assets(this.dependencies, false, { production: this.production })
|
|
572
|
+
.map(asset => get_vendor_asset_out(asset)),
|
|
573
|
+
entry
|
|
574
|
+
]
|
|
575
|
+
.map(script => `import from '${this.assets_root}${script}'`)
|
|
576
|
+
.join_lines(), noprint);
|
|
577
|
+
if (print.files)
|
|
578
|
+
console.log(`${this.name} 的入口 ${js} 构建完成`);
|
|
579
|
+
}
|
|
561
580
|
resolve_dependencies(dependency_ids, resolveds = new Set()) {
|
|
562
581
|
dependency_ids.forEach(id => {
|
|
563
582
|
if (!resolveds.has(id)) {
|
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, typeof import("util").inspect.custom | "
|
|
288
|
+
} & Omit<this, "websocket" | typeof import("util").inspect.custom | "call" | "remote" | "send">;
|
|
289
289
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xshell",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"commander": "^13.1.0",
|
|
68
68
|
"css-loader": "^7.1.2",
|
|
69
69
|
"emoji-regex": "^10.4.0",
|
|
70
|
-
"eslint": "^9.
|
|
70
|
+
"eslint": "^9.21.0",
|
|
71
71
|
"eslint-plugin-import": "^2.31.0",
|
|
72
72
|
"eslint-plugin-react": "^7.37.4",
|
|
73
73
|
"gulp-sort": "^2.0.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"vinyl-fs": "^4.0.0",
|
|
101
101
|
"webpack": "^5.98.0",
|
|
102
102
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
103
|
-
"ws": "^8.18.
|
|
103
|
+
"ws": "^8.18.1"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@babel/types": "^7.26.9",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@types/koa": "^2.15.0",
|
|
113
113
|
"@types/koa-compress": "^4.0.6",
|
|
114
114
|
"@types/mime-types": "^2.1.4",
|
|
115
|
-
"@types/node": "^22.13.
|
|
115
|
+
"@types/node": "^22.13.5",
|
|
116
116
|
"@types/react": "^19.0.10",
|
|
117
117
|
"@types/through2": "^2.0.41",
|
|
118
118
|
"@types/tough-cookie": "^4.0.5",
|
package/process.d.ts
CHANGED
|
@@ -136,12 +136,11 @@ export interface CallError<TOutput extends string | Buffer = string> extends Err
|
|
|
136
136
|
code: number;
|
|
137
137
|
signal: NodeJS.Signals;
|
|
138
138
|
command: string;
|
|
139
|
-
child: SubProcess<TOutput>;
|
|
140
139
|
print: FullPrintOptions;
|
|
141
140
|
}
|
|
142
141
|
export declare class CallError<TOutput extends string | Buffer = string> extends Error {
|
|
143
142
|
name: "CallError";
|
|
144
|
-
constructor({ message, pid, stdout, stderr, code, signal, command,
|
|
143
|
+
constructor({ message, pid, stdout, stderr, code, signal, command, print }: CallResult<TOutput>);
|
|
145
144
|
[inspect.custom](depth: number, options: InspectOptions, inspect: Function): string;
|
|
146
145
|
}
|
|
147
146
|
/** 调用 exe 启动子进程,等待并获取返回结果,错误时抛出 CallError
|
package/process.js
CHANGED
|
@@ -167,7 +167,7 @@ export async function start(exe, args = [], options = {}) {
|
|
|
167
167
|
}
|
|
168
168
|
export class CallError extends Error {
|
|
169
169
|
name = 'CallError';
|
|
170
|
-
constructor({ message, pid, stdout, stderr, code, signal, command,
|
|
170
|
+
constructor({ message, pid, stdout, stderr, code, signal, command, print }) {
|
|
171
171
|
super(message);
|
|
172
172
|
// defineProperty 默认 enumerable: false,不会在 inspect 中显示
|
|
173
173
|
Object.defineProperties(this, {
|
|
@@ -177,7 +177,6 @@ export class CallError extends Error {
|
|
|
177
177
|
code: { value: code },
|
|
178
178
|
signal: { value: signal },
|
|
179
179
|
command: { value: command },
|
|
180
|
-
child: { value: child },
|
|
181
180
|
print: { value: print }
|
|
182
181
|
});
|
|
183
182
|
}
|