xshell 1.2.19 → 1.2.20

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
@@ -172,7 +172,7 @@ export declare class Bundler {
172
172
  production?: boolean;
173
173
  source_map?: BundlerOptions['source_map'];
174
174
  }): (string | AssetOption)[];
175
- copy_files({ dependencies, production, assets, fpd_root, fpd_out, print }?: {
175
+ copy_files({ dependencies: _dependencies, production, assets, fpd_root, fpd_out, print }?: {
176
176
  dependencies?: DependencyId[];
177
177
  production?: boolean;
178
178
  assets?: Assets;
package/builder.js CHANGED
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'url';
2
2
  import { not_empty } from "./prototype.js";
3
3
  import { noprint } from "./process.js";
4
4
  import { Lock, check, filter_values } from "./utils.js";
5
- import { fcopy, fmkdir, fwrite } from "./file.js";
5
+ import { fcopy, fmkdir, fwrite, fread } from "./file.js";
6
6
  import { path } from "./path.js";
7
7
  const monaco_files = [
8
8
  'loader.js',
@@ -602,10 +602,10 @@ export class Bundler {
602
602
  ];
603
603
  }).flat();
604
604
  }
605
- async copy_files({ dependencies = this.dependencies, production = this.production, assets = this.assets, fpd_root = this.fpd_root, fpd_out = this.fpd_out, print = { info: true, files: false } } = {}) {
605
+ async copy_files({ dependencies: _dependencies = this.dependencies, production = this.production, assets = this.assets, fpd_root = this.fpd_root, fpd_out = this.fpd_out, print = { info: true, files: false } } = {}) {
606
606
  if (print.files)
607
607
  console.log(`复制 ${this.name} 的依赖文件到 ${this.fpd_out}`);
608
- if (dependencies.length)
608
+ if (_dependencies.length)
609
609
  await fmkdir(`${fpd_out}vendors/`, noprint);
610
610
  // 输出路径 -> 原路径,用来保证只复制一次且是同样的映射
611
611
  let records = new Map();
@@ -633,7 +633,7 @@ export class Bundler {
633
633
  }
634
634
  }
635
635
  await Promise.all([
636
- ...this.resolve_dependency_assets(dependencies, true, { production })
636
+ ...this.resolve_dependency_assets(_dependencies, true, { production })
637
637
  .map(async (asset) => typeof asset === 'string'
638
638
  ? fcopy_record(`${fpd_root}node_modules/${asset}`, `${fpd_out}vendors/${asset}`)
639
639
  : fcopy_record(path.resolve_with_slash(fpd_root, asset.src), path.resolve_with_slash(fpd_out, asset.out || asset.src))),
@@ -649,6 +649,12 @@ export class Bundler {
649
649
  ].filter(not_empty)
650
650
  .map(fcopy_asset))) : []
651
651
  ]);
652
+ // antd 需要修复 this, 才能在 module 下正常加载
653
+ if (this.single_js && (_dependencies.includes('antd') || _dependencies.includes('antd-icons'))) {
654
+ const fp_out = `${fpd_out}vendors/${dependencies.antd[production ? 'productions' : 'devs'][0]}`;
655
+ await fwrite(fp_out, (await fread(fp_out, noprint))
656
+ .replace(')(this,', ')(globalThis,'), noprint);
657
+ }
652
658
  }
653
659
  /** 为空时返回空数组 */
654
660
  resolve_config(config, production) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.19",
3
+ "version": "1.2.20",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -57,9 +57,9 @@
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.9",
59
59
  "@types/ws": "^8.5.14",
60
- "@typescript-eslint/eslint-plugin": "^8.24.1",
61
- "@typescript-eslint/parser": "^8.24.1",
62
- "@typescript-eslint/utils": "^8.24.1",
60
+ "@typescript-eslint/eslint-plugin": "^8.25.0",
61
+ "@typescript-eslint/parser": "^8.25.0",
62
+ "@typescript-eslint/utils": "^8.25.0",
63
63
  "archiver": "^7.0.1",
64
64
  "chalk": "^5.4.1",
65
65
  "cli-table3": "^0.6.5",
@@ -84,7 +84,7 @@
84
84
  "react-i18next": "^15.4.1",
85
85
  "react-object-model": "^1.2.23",
86
86
  "resolve-path": "^1.4.0",
87
- "sass": "^1.85.0",
87
+ "sass": "^1.85.1",
88
88
  "sass-loader": "^16.0.5",
89
89
  "source-map-loader": "^5.0.0",
90
90
  "strip-ansi": "^7.1.0",