@nocobase/server 0.13.0-alpha.9 → 0.14.0-alpha.2
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/lib/app-supervisor.js +3 -1
- package/lib/application.d.ts +3 -1
- package/lib/application.js +16 -2
- package/lib/commands/pm.js +28 -2
- package/lib/gateway/index.d.ts +1 -0
- package/lib/gateway/index.js +33 -10
- package/lib/helper.d.ts +1 -0
- package/lib/helper.js +11 -2
- package/lib/migrations/20230912193824-package-name-unique.d.ts +4 -0
- package/lib/migrations/20230912193824-package-name-unique.js +66 -0
- package/lib/plugin-manager/clientStaticUtils.d.ts +23 -0
- package/lib/plugin-manager/clientStaticUtils.js +119 -0
- package/lib/plugin-manager/constants.d.ts +7 -0
- package/lib/plugin-manager/constants.js +126 -0
- package/lib/plugin-manager/deps.d.ts +2 -0
- package/lib/plugin-manager/deps.js +74 -0
- package/lib/plugin-manager/index.d.ts +1 -1
- package/lib/plugin-manager/index.js +2 -2
- package/lib/plugin-manager/middleware.d.ts +2 -0
- package/lib/plugin-manager/{clientStaticMiddleware.js → middleware.js} +14 -9
- package/lib/plugin-manager/options/collection.js +1 -0
- package/lib/plugin-manager/options/resource.d.ts +5 -1
- package/lib/plugin-manager/options/resource.js +116 -10
- package/lib/plugin-manager/plugin-manager-repository.d.ts +2 -0
- package/lib/plugin-manager/plugin-manager-repository.js +9 -0
- package/lib/plugin-manager/plugin-manager.d.ts +33 -3
- package/lib/plugin-manager/plugin-manager.js +226 -40
- package/lib/plugin-manager/types.d.ts +15 -0
- package/lib/plugin-manager/types.js +15 -0
- package/lib/plugin-manager/utils.d.ts +102 -0
- package/lib/plugin-manager/utils.js +523 -0
- package/lib/plugin.d.ts +1 -0
- package/lib/plugin.js +37 -0
- package/package.json +17 -12
- package/lib/gateway/handle-plugin-static-file.d.ts +0 -3
- package/lib/gateway/handle-plugin-static-file.js +0 -85
- package/lib/plugin-manager/clientStaticMiddleware.d.ts +0 -8
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var deps_exports = {};
|
|
19
|
+
__export(deps_exports, {
|
|
20
|
+
default: () => deps_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(deps_exports);
|
|
23
|
+
var import_package = require("../../package.json");
|
|
24
|
+
const deps = {
|
|
25
|
+
"@nocobase": `${import_package.version.split(".").slice(0, 2).join(".")}.x`,
|
|
26
|
+
// 0.12.x
|
|
27
|
+
"@formily": "2.x",
|
|
28
|
+
"@formily/antd-v5": "1.x",
|
|
29
|
+
jsonwebtoken: "8.x",
|
|
30
|
+
"cache-manager": "4.x",
|
|
31
|
+
sequelize: "6.x",
|
|
32
|
+
umzug: "3.x",
|
|
33
|
+
"async-mutex": "0.3.x",
|
|
34
|
+
"@formulajs/formulajs": "4.x",
|
|
35
|
+
mathjs: "10.x",
|
|
36
|
+
winston: "3.x",
|
|
37
|
+
"winston-daily-rotate-file": "4.x",
|
|
38
|
+
koa: "2.x",
|
|
39
|
+
"@koa/cors": "3.x",
|
|
40
|
+
"@koa/router": "9.x",
|
|
41
|
+
multer: "1.x",
|
|
42
|
+
"@koa/multer": "3.x",
|
|
43
|
+
"koa-bodyparser": "4.x",
|
|
44
|
+
"koa-static": "5.x",
|
|
45
|
+
"koa-send": "5.x",
|
|
46
|
+
react: "18.x",
|
|
47
|
+
"react-dom": "18.x",
|
|
48
|
+
"react-router": "6.x",
|
|
49
|
+
"react-router-dom": "6.x",
|
|
50
|
+
antd: "5.x",
|
|
51
|
+
"antd-style": "3.x",
|
|
52
|
+
"@ant-design/icons": "5.x",
|
|
53
|
+
"@ant-design/cssinjs": "1.x",
|
|
54
|
+
i18next: "22.x",
|
|
55
|
+
"react-i18next": "11.x",
|
|
56
|
+
"@dnd-kit/accessibility": "3.x",
|
|
57
|
+
"@dnd-kit/core": "5.x",
|
|
58
|
+
"@dnd-kit/modifiers": "6.x",
|
|
59
|
+
"@dnd-kit/sortable": "6.x",
|
|
60
|
+
"@dnd-kit/utilities": "3.x",
|
|
61
|
+
dayjs: "1.x",
|
|
62
|
+
mysql2: "2.x",
|
|
63
|
+
pg: "8.x",
|
|
64
|
+
"pg-hstore": "2.x",
|
|
65
|
+
sqlite3: "5.x",
|
|
66
|
+
supertest: "6.x",
|
|
67
|
+
axios: "0.26.x",
|
|
68
|
+
"@emotion/css": "11.x",
|
|
69
|
+
ahooks: "3.x",
|
|
70
|
+
lodash: "4.x",
|
|
71
|
+
"china-division": "2.x",
|
|
72
|
+
cronstrue: "2.x"
|
|
73
|
+
};
|
|
74
|
+
var deps_default = deps;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './clientStaticUtils';
|
|
2
2
|
export * from './plugin-manager';
|
|
@@ -14,10 +14,10 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
14
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
15
|
var plugin_manager_exports = {};
|
|
16
16
|
module.exports = __toCommonJS(plugin_manager_exports);
|
|
17
|
-
__reExport(plugin_manager_exports, require("./
|
|
17
|
+
__reExport(plugin_manager_exports, require("./clientStaticUtils"), module.exports);
|
|
18
18
|
__reExport(plugin_manager_exports, require("./plugin-manager"), module.exports);
|
|
19
19
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20
20
|
0 && (module.exports = {
|
|
21
|
-
...require("./
|
|
21
|
+
...require("./clientStaticUtils"),
|
|
22
22
|
...require("./plugin-manager")
|
|
23
23
|
});
|
|
@@ -16,16 +16,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var middleware_exports = {};
|
|
20
|
+
__export(middleware_exports, {
|
|
21
|
+
uploadMiddleware: () => uploadMiddleware
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
module.exports = __toCommonJS(middleware_exports);
|
|
24
|
+
var import_utils = require("@nocobase/utils");
|
|
25
|
+
async function uploadMiddleware(ctx, next) {
|
|
26
|
+
if (ctx.action.resourceName === "pm" && ["add", "update"].includes(ctx.action.actionName)) {
|
|
27
|
+
const upload = (0, import_utils.koaMulter)().single("file");
|
|
28
|
+
return upload(ctx, next);
|
|
29
|
+
}
|
|
30
|
+
return next();
|
|
31
|
+
}
|
|
32
|
+
__name(uploadMiddleware, "uploadMiddleware");
|
|
28
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
34
|
0 && (module.exports = {
|
|
30
|
-
|
|
35
|
+
uploadMiddleware
|
|
31
36
|
});
|
|
@@ -28,6 +28,7 @@ var collection_default = (0, import_database.defineCollection)({
|
|
|
28
28
|
repository: "PluginManagerRepository",
|
|
29
29
|
fields: [
|
|
30
30
|
{ type: "string", name: "name", unique: true },
|
|
31
|
+
{ type: "string", name: "packageName", unique: true },
|
|
31
32
|
{ type: "string", name: "version" },
|
|
32
33
|
{ type: "boolean", name: "enabled" },
|
|
33
34
|
{ type: "boolean", name: "installed" },
|
|
@@ -2,10 +2,14 @@ declare const _default: {
|
|
|
2
2
|
name: string;
|
|
3
3
|
actions: {
|
|
4
4
|
add(ctx: any, next: any): Promise<void>;
|
|
5
|
+
update(ctx: any, next: any): Promise<void>;
|
|
6
|
+
npmVersionList(ctx: any, next: any): Promise<void>;
|
|
5
7
|
enable(ctx: any, next: any): Promise<void>;
|
|
6
8
|
disable(ctx: any, next: any): Promise<void>;
|
|
7
|
-
upgrade(ctx: any, next: any): Promise<void>;
|
|
8
9
|
remove(ctx: any, next: any): Promise<void>;
|
|
10
|
+
list(ctx: any, next: any): Promise<void>;
|
|
11
|
+
listEnabled(ctx: any, next: any): Promise<void>;
|
|
12
|
+
get(ctx: any, next: any): Promise<void>;
|
|
9
13
|
};
|
|
10
14
|
};
|
|
11
15
|
export default _default;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,27 +16,99 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
var resource_exports = {};
|
|
19
29
|
__export(resource_exports, {
|
|
20
30
|
default: () => resource_default
|
|
21
31
|
});
|
|
22
32
|
module.exports = __toCommonJS(resource_exports);
|
|
33
|
+
var import_utils = require("@nocobase/utils");
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_clientStaticUtils = require("../clientStaticUtils");
|
|
37
|
+
var import_plugin_manager = __toESM(require("../plugin-manager"));
|
|
23
38
|
var resource_default = {
|
|
24
39
|
name: "pm",
|
|
25
40
|
actions: {
|
|
26
41
|
async add(ctx, next) {
|
|
27
|
-
const
|
|
42
|
+
const app = ctx.app;
|
|
43
|
+
const { values = {} } = ctx.action.params;
|
|
44
|
+
if (values == null ? void 0 : values.packageName) {
|
|
45
|
+
const args = [];
|
|
46
|
+
if (values.registry) {
|
|
47
|
+
args.push("--registry=" + values.registry);
|
|
48
|
+
}
|
|
49
|
+
if (values.version) {
|
|
50
|
+
args.push("--version=" + values.version);
|
|
51
|
+
}
|
|
52
|
+
if (values.authToken) {
|
|
53
|
+
args.push("--auth-token=" + values.authToken);
|
|
54
|
+
}
|
|
55
|
+
app.runAsCLI(["pm", "add", values.packageName, ...args], { from: "user" });
|
|
56
|
+
} else if (ctx.file) {
|
|
57
|
+
const tmpDir = import_path.default.resolve(process.cwd(), "storage", "tmp");
|
|
58
|
+
try {
|
|
59
|
+
await import_fs.default.promises.mkdir(tmpDir, { recursive: true });
|
|
60
|
+
} catch (error) {
|
|
61
|
+
}
|
|
62
|
+
const tempFile = import_path.default.join(process.cwd(), "storage/tmp", (0, import_utils.uid)() + import_path.default.extname(ctx.file.originalname));
|
|
63
|
+
await import_fs.default.promises.writeFile(tempFile, ctx.file.buffer, "binary");
|
|
64
|
+
app.runAsCLI(["pm", "add", tempFile], { from: "user" });
|
|
65
|
+
} else if (values.compressedFileUrl) {
|
|
66
|
+
app.runAsCLI(["pm", "add", values.compressedFileUrl], { from: "user" });
|
|
67
|
+
}
|
|
68
|
+
ctx.body = "ok";
|
|
69
|
+
await next();
|
|
70
|
+
},
|
|
71
|
+
async update(ctx, next) {
|
|
72
|
+
const app = ctx.app;
|
|
73
|
+
const values = ctx.action.params.values || {};
|
|
74
|
+
const args = [];
|
|
75
|
+
if (values.registry) {
|
|
76
|
+
args.push("--registry=" + values.registry);
|
|
77
|
+
}
|
|
78
|
+
if (values.version) {
|
|
79
|
+
args.push("--version=" + values.version);
|
|
80
|
+
}
|
|
81
|
+
if (values.authToken) {
|
|
82
|
+
args.push("--auth-token=" + values.authToken);
|
|
83
|
+
}
|
|
84
|
+
if (values.compressedFileUrl) {
|
|
85
|
+
args.push("--url=" + values.compressedFileUrl);
|
|
86
|
+
}
|
|
87
|
+
if (ctx.file) {
|
|
88
|
+
values.packageName = ctx.request.body.packageName;
|
|
89
|
+
const tmpDir = import_path.default.resolve(process.cwd(), "storage", "tmp");
|
|
90
|
+
try {
|
|
91
|
+
await import_fs.default.promises.mkdir(tmpDir, { recursive: true });
|
|
92
|
+
} catch (error) {
|
|
93
|
+
}
|
|
94
|
+
const tempFile = import_path.default.join(process.cwd(), "storage/tmp", (0, import_utils.uid)() + import_path.default.extname(ctx.file.originalname));
|
|
95
|
+
await import_fs.default.promises.writeFile(tempFile, ctx.file.buffer, "binary");
|
|
96
|
+
args.push(`--url=${tempFile}`);
|
|
97
|
+
}
|
|
98
|
+
app.runAsCLI(["pm", "update", values.packageName, ...args], { from: "user" });
|
|
99
|
+
ctx.body = "ok";
|
|
100
|
+
await next();
|
|
101
|
+
},
|
|
102
|
+
async npmVersionList(ctx, next) {
|
|
28
103
|
const { filterByTk } = ctx.action.params;
|
|
29
104
|
if (!filterByTk) {
|
|
30
105
|
ctx.throw(400, "plugin name invalid");
|
|
31
106
|
}
|
|
32
|
-
|
|
33
|
-
ctx.body = filterByTk;
|
|
107
|
+
const pm = ctx.app.pm;
|
|
108
|
+
ctx.body = await pm.getNpmVersionList(filterByTk);
|
|
34
109
|
await next();
|
|
35
110
|
},
|
|
36
111
|
async enable(ctx, next) {
|
|
37
|
-
const pm = ctx.app.pm;
|
|
38
112
|
const { filterByTk } = ctx.action.params;
|
|
39
113
|
const app = ctx.app;
|
|
40
114
|
if (!filterByTk) {
|
|
@@ -45,7 +119,6 @@ var resource_default = {
|
|
|
45
119
|
await next();
|
|
46
120
|
},
|
|
47
121
|
async disable(ctx, next) {
|
|
48
|
-
const pm = ctx.app.pm;
|
|
49
122
|
const { filterByTk } = ctx.action.params;
|
|
50
123
|
if (!filterByTk) {
|
|
51
124
|
ctx.throw(400, "plugin name invalid");
|
|
@@ -55,12 +128,7 @@ var resource_default = {
|
|
|
55
128
|
ctx.body = filterByTk;
|
|
56
129
|
await next();
|
|
57
130
|
},
|
|
58
|
-
async upgrade(ctx, next) {
|
|
59
|
-
ctx.body = "ok";
|
|
60
|
-
await next();
|
|
61
|
-
},
|
|
62
131
|
async remove(ctx, next) {
|
|
63
|
-
const pm = ctx.app.pm;
|
|
64
132
|
const { filterByTk } = ctx.action.params;
|
|
65
133
|
if (!filterByTk) {
|
|
66
134
|
ctx.throw(400, "plugin name invalid");
|
|
@@ -69,6 +137,44 @@ var resource_default = {
|
|
|
69
137
|
app.runAsCLI(["pm", "remove", filterByTk], { from: "user" });
|
|
70
138
|
ctx.body = filterByTk;
|
|
71
139
|
await next();
|
|
140
|
+
},
|
|
141
|
+
async list(ctx, next) {
|
|
142
|
+
const locale = ctx.getCurrentLocale();
|
|
143
|
+
const pm = ctx.app.pm;
|
|
144
|
+
ctx.body = await pm.list({ locale, isPreset: false });
|
|
145
|
+
await next();
|
|
146
|
+
},
|
|
147
|
+
async listEnabled(ctx, next) {
|
|
148
|
+
const pm = ctx.db.getRepository("applicationPlugins");
|
|
149
|
+
const PLUGIN_CLIENT_ENTRY_FILE = "dist/client/index.js";
|
|
150
|
+
const items = await pm.find({
|
|
151
|
+
filter: {
|
|
152
|
+
enabled: true
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
ctx.body = items.map((item) => {
|
|
156
|
+
try {
|
|
157
|
+
const packageName = import_plugin_manager.default.getPackageName(item.name);
|
|
158
|
+
return {
|
|
159
|
+
...item.toJSON(),
|
|
160
|
+
packageName,
|
|
161
|
+
url: (0, import_clientStaticUtils.getExposeUrl)(packageName, PLUGIN_CLIENT_ENTRY_FILE)
|
|
162
|
+
};
|
|
163
|
+
} catch {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}).filter(Boolean);
|
|
167
|
+
await next();
|
|
168
|
+
},
|
|
169
|
+
async get(ctx, next) {
|
|
170
|
+
const locale = ctx.getCurrentLocale();
|
|
171
|
+
const pm = ctx.app.pm;
|
|
172
|
+
const { filterByTk } = ctx.action.params;
|
|
173
|
+
if (!filterByTk) {
|
|
174
|
+
ctx.throw(400, "plugin name invalid");
|
|
175
|
+
}
|
|
176
|
+
ctx.body = await pm.get(filterByTk).toJSON({ locale });
|
|
177
|
+
await next();
|
|
72
178
|
}
|
|
73
179
|
}
|
|
74
180
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Repository } from '@nocobase/database';
|
|
2
2
|
import { PluginManager } from './plugin-manager';
|
|
3
|
+
import { PluginData } from './types';
|
|
3
4
|
export declare class PluginManagerRepository extends Repository {
|
|
4
5
|
pm: PluginManager;
|
|
5
6
|
setPluginManager(pm: PluginManager): void;
|
|
6
7
|
remove(name: string | string[]): Promise<void>;
|
|
7
8
|
enable(name: string | string[]): Promise<string[]>;
|
|
9
|
+
upgrade(name: string, data: PluginData): Promise<any>;
|
|
8
10
|
disable(name: string | string[]): Promise<string[]>;
|
|
9
11
|
getItems(): Promise<any>;
|
|
10
12
|
init(): Promise<void>;
|
|
@@ -71,6 +71,14 @@ const _PluginManagerRepository = class _PluginManagerRepository extends import_d
|
|
|
71
71
|
});
|
|
72
72
|
return pluginNames;
|
|
73
73
|
}
|
|
74
|
+
async upgrade(name, data) {
|
|
75
|
+
return this.update({
|
|
76
|
+
filter: {
|
|
77
|
+
name
|
|
78
|
+
},
|
|
79
|
+
values: data
|
|
80
|
+
});
|
|
81
|
+
}
|
|
74
82
|
async disable(name) {
|
|
75
83
|
name = import_lodash.default.cloneDeep(name);
|
|
76
84
|
const pluginNames = import_lodash.default.castArray(name);
|
|
@@ -94,6 +102,7 @@ const _PluginManagerRepository = class _PluginManagerRepository extends import_d
|
|
|
94
102
|
sort: "id"
|
|
95
103
|
});
|
|
96
104
|
} catch (error) {
|
|
105
|
+
await this.database.migrator.up();
|
|
97
106
|
await this.collection.sync({
|
|
98
107
|
alter: {
|
|
99
108
|
drop: false
|
|
@@ -4,6 +4,7 @@ import net from 'net';
|
|
|
4
4
|
import Application from '../application';
|
|
5
5
|
import { Plugin } from '../plugin';
|
|
6
6
|
import { PluginManagerRepository } from './plugin-manager-repository';
|
|
7
|
+
import { PluginData } from './types';
|
|
7
8
|
export interface PluginManagerOptions {
|
|
8
9
|
app: Application;
|
|
9
10
|
plugins?: any[];
|
|
@@ -29,15 +30,16 @@ export declare class PluginManager {
|
|
|
29
30
|
static getPackageName(name: string): string;
|
|
30
31
|
static getPluginPkgPrefix(): string[];
|
|
31
32
|
static findPackage(name: string): Promise<string>;
|
|
32
|
-
static
|
|
33
|
+
static clearCache(packageName: string): void;
|
|
34
|
+
static resolvePlugin(pluginName: string | typeof Plugin, isUpgrade?: boolean, isPkg?: boolean): any;
|
|
33
35
|
addPreset(plugin: string | typeof Plugin, options?: any): void;
|
|
34
36
|
getPlugins(): Map<typeof Plugin, Plugin<any>>;
|
|
35
37
|
getAliases(): IterableIterator<string>;
|
|
36
38
|
get(name: string | typeof Plugin): Plugin<any>;
|
|
37
39
|
has(name: string | typeof Plugin): boolean;
|
|
38
40
|
del(name: string | typeof Plugin): void;
|
|
39
|
-
create(
|
|
40
|
-
add(plugin?: any, options?: any, insert?: boolean): Promise<void>;
|
|
41
|
+
create(pluginName: string): Promise<void>;
|
|
42
|
+
add(plugin?: any, options?: any, insert?: boolean, isUpgrade?: boolean): Promise<void>;
|
|
41
43
|
initPlugins(): Promise<void>;
|
|
42
44
|
load(options?: any): Promise<void>;
|
|
43
45
|
install(options?: InstallOptions): Promise<void>;
|
|
@@ -45,5 +47,33 @@ export declare class PluginManager {
|
|
|
45
47
|
disable(name: string | string[]): Promise<void>;
|
|
46
48
|
remove(name: string | string[]): Promise<void>;
|
|
47
49
|
protected initPresetPlugins(): Promise<void>;
|
|
50
|
+
loadOne(plugin: Plugin): Promise<void>;
|
|
51
|
+
addViaCLI(urlOrName: string, options?: PluginData): Promise<void>;
|
|
52
|
+
addByNpm(options: {
|
|
53
|
+
packageName: string;
|
|
54
|
+
name?: string;
|
|
55
|
+
registry: string;
|
|
56
|
+
authToken?: string;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
addByFile(options: {
|
|
59
|
+
file: string;
|
|
60
|
+
registry?: string;
|
|
61
|
+
authToken?: string;
|
|
62
|
+
type?: string;
|
|
63
|
+
name?: string;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
addByCompressedFileUrl(options: {
|
|
66
|
+
compressedFileUrl: string;
|
|
67
|
+
registry?: string;
|
|
68
|
+
authToken?: string;
|
|
69
|
+
type?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
}): Promise<void>;
|
|
72
|
+
update(options: PluginData): Promise<void>;
|
|
73
|
+
upgradeByNpm(values: PluginData): Promise<void>;
|
|
74
|
+
upgradeByCompressedFileUrl(options: PluginData): Promise<void>;
|
|
75
|
+
getNameByPackageName(packageName: string): string;
|
|
76
|
+
list(options?: any): Promise<any[]>;
|
|
77
|
+
getNpmVersionList(name: string): Promise<string[]>;
|
|
48
78
|
}
|
|
49
79
|
export default PluginManager;
|