wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import type { Module } from "../types";
import { hmr } from "../hooks";
 
// 模块列表
const list: Module[] = hmr.getData("modules", []);
 
// 模块对象
const module = {
    list,
    get(name: string): Module {
        return this.list.find((e) => e.name == name)!;
    },
    config(name: string) {
        return this.get(name).options || {};
    },
    add(data: Module) {
        this.list.push(data);
    },
};
 
export { module };