xshell 1.0.123 → 1.0.124

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.
Files changed (3) hide show
  1. package/builder.d.ts +5 -3
  2. package/builder.js +15 -10
  3. package/package.json +1 -1
package/builder.d.ts CHANGED
@@ -5,7 +5,7 @@ export interface BundlerOptions {
5
5
  production?: boolean;
6
6
  externals?: Record<string, string>;
7
7
  sass?: typeof import('sass');
8
- module_import?: boolean;
8
+ dynamic_import?: boolean;
9
9
  commonjs2?: boolean;
10
10
  assets_stats?: boolean;
11
11
  globals?: Record<string, string>;
@@ -13,6 +13,7 @@ export interface BundlerOptions {
13
13
  dts?: boolean;
14
14
  cache_version?: string;
15
15
  single_chunk?: boolean;
16
+ exclude_modules?: RegExp;
16
17
  }
17
18
  export declare class Bundler {
18
19
  name: string;
@@ -33,14 +34,15 @@ export declare class Bundler {
33
34
  - externals?: 配置外部模块
34
35
  - commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
35
36
  - single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
36
- - module_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
37
+ - dynamic_import: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
37
38
  - assets_stats?: `true` 打印输出的文件信息
38
39
  - analyzer?: `false` 启用 WebpackBundleAnalyzer 插件分析构建产物大小
39
40
  - dts?: `false` 生成 .d.ts 文件
41
+ - exclude_modules?: 传入正则表达式 ,匹配时使用 IgnorePlugin 强制不打包这个模块,但是一旦导入就会报错
40
42
  - cache_version?: webpack cache version, 用于区分同一个 name 的不同版本
41
43
  - production?: `true` webpack mode 设置为 'production'
42
44
  - sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本 */
43
- constructor(name: string, target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, fpdt_cache: string, entry: Record<string, string>, { source_map, globals, externals, commonjs2, single_chunk, module_import, assets_stats, analyzer, dts, cache_version, production, sass, }?: BundlerOptions);
45
+ constructor(name: string, target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, fpdt_cache: string, entry: Record<string, string>, { source_map, globals, externals, commonjs2, single_chunk, dynamic_import, assets_stats, analyzer, dts, exclude_modules, cache_version, production, sass, }?: BundlerOptions);
44
46
  build(print?: boolean): Promise<void>;
45
47
  close(): Promise<void>;
46
48
  }
package/builder.js CHANGED
@@ -19,14 +19,15 @@ export class Bundler {
19
19
  - externals?: 配置外部模块
20
20
  - commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
21
21
  - single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
22
- - module_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
22
+ - dynamic_import: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
23
23
  - assets_stats?: `true` 打印输出的文件信息
24
24
  - analyzer?: `false` 启用 WebpackBundleAnalyzer 插件分析构建产物大小
25
25
  - dts?: `false` 生成 .d.ts 文件
26
+ - exclude_modules?: 传入正则表达式 ,匹配时使用 IgnorePlugin 强制不打包这个模块,但是一旦导入就会报错
26
27
  - cache_version?: webpack cache version, 用于区分同一个 name 的不同版本
27
28
  - production?: `true` webpack mode 设置为 'production'
28
29
  - sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本 */
29
- constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, externals, commonjs2 = false, single_chunk = true, module_import = true, assets_stats = true, analyzer = false, dts = false, cache_version, production = true, sass, } = {}) {
30
+ constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, externals, commonjs2 = false, single_chunk = true, dynamic_import = true, assets_stats = true, analyzer = false, dts = false, exclude_modules, cache_version, production = true, sass, } = {}) {
30
31
  this.name = name;
31
32
  this.analyzer = analyzer;
32
33
  // let smp = new SpeedMeasurePlugin()
@@ -98,7 +99,7 @@ export class Bundler {
98
99
  loader: { sass }
99
100
  } : {},
100
101
  module: {
101
- ...module_import === false ? {
102
+ ...dynamic_import === false ? {
102
103
  parser: {
103
104
  javascript: {
104
105
  // 保留 await import() 这样的引用
@@ -197,12 +198,15 @@ export class Bundler {
197
198
  ...globals
198
199
  // process: { env: { }, argv: [] }
199
200
  })
200
- ] : []
201
+ ] : [],
201
202
  // 使用 IgnorePlugin 能够不打包,但是一旦导入就会报错
202
- // new Webpack.IgnorePlugin({
203
- // checkResource: (resource, context) =>
204
- // resource.startsWith('./vendors/') && !context.fp.startsWith(fpd_node_modules) ,
205
- // }),
203
+ ...exclude_modules ? [
204
+ new Webpack.IgnorePlugin({
205
+ resourceRegExp: exclude_modules,
206
+ // checkResource: (resource, context) =>
207
+ // resource.startsWith('./vendors/') && !context.fp.startsWith(fpd_node_modules) ,
208
+ })
209
+ ] : [],
206
210
  ],
207
211
  optimization: {
208
212
  minimize: false
@@ -220,8 +224,9 @@ export class Bundler {
220
224
  ...target === 'nodejs' ? [
221
225
  /Can't resolve '(bufferutil|utf-8-validate)'/
222
226
  ] : [],
223
- // warning =>
224
- // warning.message.includes('the request of a dependency is an expression') && warning.module?.context?.endsWith('any-promise')
227
+ // 打包 ali-oss 时可能的报错
228
+ warning => warning.message.includes('the request of a dependency is an expression') &&
229
+ warning.module?.context?.endsWith('any-promise')
225
230
  ],
226
231
  performance: {
227
232
  hints: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.123",
3
+ "version": "1.0.124",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {