mm_machine 2.5.9 → 2.6.1

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/drive.js +11 -0
  2. package/index.js +14 -0
  3. package/package.json +1 -1
package/drive.js CHANGED
@@ -712,6 +712,17 @@ Drive.prototype.offEvent = function (event) {
712
712
  this.getEventer()?.off(event);
713
713
  };
714
714
 
715
+ /**
716
+ * 删除项目
717
+ */
718
+ Drive.prototype.remove = function () {
719
+ let dir = this._getDir();
720
+ if (dir) {
721
+ dir.delDir();
722
+ }
723
+ return dir;
724
+ };
725
+
715
726
  /**
716
727
  * @module 导出Drive类
717
728
  */
package/index.js CHANGED
@@ -962,6 +962,20 @@ Manager.prototype.create = function (config, file = '') {
962
962
  return mod;
963
963
  };
964
964
 
965
+ /**
966
+ * 删除模块
967
+ * @param {string} name 模块名称
968
+ * @returns {object} 删除的模块实例
969
+ */
970
+ Manager.prototype.remove = async function (name) {
971
+ let mod = this.getMod(name);
972
+ if (mod) {
973
+ await mod.remove();
974
+ }
975
+ this.unregisterMod(name);
976
+ return mod;
977
+ };
978
+
965
979
  module.exports = {
966
980
  Manager,
967
981
  Drive,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_machine",
3
- "version": "2.5.9",
3
+ "version": "2.6.1",
4
4
  "description": "A flexible Node.js plugin mechanism system for dynamic loading, management and execution of modules. Supports hot reload, lifecycle management, and modern JavaScript features.",
5
5
  "main": "index.js",
6
6
  "scripts": {