xshell 1.2.23 → 1.2.25

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.js CHANGED
@@ -478,9 +478,27 @@ export class Bundler {
478
478
  })
479
479
  ];
480
480
  })() : [],
481
- ...this.polyfill_node_sea ? [
482
- new Webpack.NormalModuleReplacementPlugin(/^node:sea$/, `${import.meta.dirname.fpd}node-sea.polyfill.js`)
483
- ] : [],
481
+ ...this.polyfill_node_sea ? [{
482
+ apply(compiler) {
483
+ const external_polyfill_plugin_name = 'MyNodejsBuiltinModuleReplacementPlugin';
484
+ const builtin_module = 'node:sea';
485
+ const fp_polyfill = `${import.meta.dirname.fpd}node-sea.polyfill.js`;
486
+ compiler.hooks.normalModuleFactory.tap(external_polyfill_plugin_name, factory => {
487
+ factory.hooks.beforeResolve.tap(external_polyfill_plugin_name, data => {
488
+ if (data.request === builtin_module) {
489
+ data.request = fp_polyfill;
490
+ // 一定要改 dependencies,否则会创建 ExternalModule,不走 NormalModule 的 resolve 过程
491
+ data.dependencies.forEach(dep => {
492
+ if (dep.request === builtin_module) {
493
+ dep.request = fp_polyfill;
494
+ dep.userRequest = fp_polyfill;
495
+ }
496
+ });
497
+ }
498
+ });
499
+ });
500
+ }
501
+ }] : [],
484
502
  ...this.plugins || [],
485
503
  ];
486
504
  this.lcompiler = new Lock(Webpack(this.config));
@@ -1,2 +1,7 @@
1
1
  export declare function isSea(): boolean;
2
2
  export declare function getRawAsset(fp: string): void;
3
+ declare const _default: {
4
+ isSea: typeof isSea;
5
+ getRawAsset: typeof getRawAsset;
6
+ };
7
+ export default _default;
@@ -4,4 +4,8 @@ export function isSea() {
4
4
  export function getRawAsset(fp) {
5
5
  throw new Error('node:sea getRawAsset 未实现');
6
6
  }
7
+ export default {
8
+ isSea,
9
+ getRawAsset
10
+ };
7
11
  //# sourceMappingURL=node-sea.polyfill.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.23",
3
+ "version": "1.2.25",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {