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 +21 -3
- package/node-sea.polyfill.d.ts +5 -0
- package/node-sea.polyfill.js +4 -0
- package/package.json +1 -1
package/builder.js
CHANGED
|
@@ -478,9 +478,27 @@ export class Bundler {
|
|
|
478
478
|
})
|
|
479
479
|
];
|
|
480
480
|
})() : [],
|
|
481
|
-
...this.polyfill_node_sea ? [
|
|
482
|
-
|
|
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));
|
package/node-sea.polyfill.d.ts
CHANGED
package/node-sea.polyfill.js
CHANGED