xshell 1.2.21 → 1.2.23

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
@@ -90,6 +90,8 @@ export interface BundlerOptions {
90
90
  js: string;
91
91
  entry: string;
92
92
  };
93
+ plugins?: Webpack.Configuration['plugins'];
94
+ polyfill_node_sea?: boolean;
93
95
  }
94
96
  export declare class Bundler {
95
97
  name: string;
@@ -108,7 +110,9 @@ export declare class Bundler {
108
110
  single_js?: BundlerOptions['single_js'];
109
111
  globals?: BundlerOptions['globals'];
110
112
  exclude_modules?: BundlerOptions['exclude_modules'];
113
+ plugins?: BundlerOptions['plugins'];
111
114
  license?: boolean;
115
+ polyfill_node_sea?: boolean;
112
116
  lcompiler: Lock<Webpack.Compiler>;
113
117
  /** 通过 webpack 从入口文件打包所有依赖生成单个 index.{mjs,cjs} 文件
114
118
  - name: 项目名称
@@ -147,8 +151,10 @@ export declare class Bundler {
147
151
  - cache_version?: webpack cache version, 用于区分同一个 name 的不同版本
148
152
  - production?: `true` webpack mode 设置为 'production'
149
153
  - sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
150
- - license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
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);
154
+ - plugins?: 可选传入的额外的 webpack 插件
155
+ - license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt
156
+ - polyfill_node_sea?: 避免依赖 node:sea 模块以兼容旧版本 node.js */
157
+ 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, plugins, license, polyfill_node_sea }?: BundlerOptions);
152
158
  build(print?: boolean): Promise<void>;
153
159
  close(): Promise<void>;
154
160
  build_all(print?: boolean): Promise<void>;
package/builder.js CHANGED
@@ -140,7 +140,9 @@ export class Bundler {
140
140
  single_js;
141
141
  globals;
142
142
  exclude_modules;
143
+ plugins;
143
144
  license;
145
+ polyfill_node_sea;
144
146
  lcompiler;
145
147
  /** 通过 webpack 从入口文件打包所有依赖生成单个 index.{mjs,cjs} 文件
146
148
  - name: 项目名称
@@ -179,8 +181,10 @@ export class Bundler {
179
181
  - cache_version?: webpack cache version, 用于区分同一个 name 的不同版本
180
182
  - production?: `true` webpack mode 设置为 'production'
181
183
  - sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
182
- - license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
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, } = {}) {
184
+ - plugins?: 可选传入的额外的 webpack 插件
185
+ - license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt
186
+ - polyfill_node_sea?: 避免依赖 node:sea 模块以兼容旧版本 node.js */
187
+ 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, plugins, license, polyfill_node_sea = false } = {}) {
184
188
  this.name = name;
185
189
  this.analyzer = analyzer;
186
190
  this.production = production;
@@ -195,6 +199,7 @@ export class Bundler {
195
199
  this.single_js = single_js;
196
200
  this.globals = globals;
197
201
  this.exclude_modules = exclude_modules;
202
+ this.plugins = plugins;
198
203
  if (dependencies) {
199
204
  check(target === 'web');
200
205
  this.dependencies = dependencies;
@@ -203,6 +208,7 @@ export class Bundler {
203
208
  throw new Error('expose 和 commonjs2 不能同时启用');
204
209
  const output_module = !commonjs2 && !expose;
205
210
  this.license = license;
211
+ this.polyfill_node_sea = polyfill_node_sea;
206
212
  // let smp = new SpeedMeasurePlugin()
207
213
  // const config: Webpack.Configuration = smp.wrap({
208
214
  let resolve_cache = {};
@@ -472,6 +478,10 @@ export class Bundler {
472
478
  })
473
479
  ];
474
480
  })() : [],
481
+ ...this.polyfill_node_sea ? [
482
+ new Webpack.NormalModuleReplacementPlugin(/^node:sea$/, `${import.meta.dirname.fpd}node-sea.polyfill.js`)
483
+ ] : [],
484
+ ...this.plugins || [],
475
485
  ];
476
486
  this.lcompiler = new Lock(Webpack(this.config));
477
487
  }
@@ -0,0 +1,2 @@
1
+ export declare function isSea(): boolean;
2
+ export declare function getRawAsset(fp: string): void;
@@ -0,0 +1,7 @@
1
+ export function isSea() {
2
+ return false;
3
+ }
4
+ export function getRawAsset(fp) {
5
+ throw new Error('node:sea getRawAsset 未实现');
6
+ }
7
+ //# sourceMappingURL=node-sea.polyfill.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {