@4399ywkf/core 4.0.61
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/README.md +3 -0
- package/compiled/dotenv/LICENSE +23 -0
- package/compiled/dotenv/index.js +1 -0
- package/compiled/dotenv/lib/main.d.ts +73 -0
- package/compiled/dotenv/package.json +1 -0
- package/compiled/dotenv/types/index.d.ts +59 -0
- package/compiled/dotenv-expand/LICENSE +24 -0
- package/compiled/dotenv-expand/index.js +1 -0
- package/compiled/dotenv-expand/lib/main.d.ts +29 -0
- package/compiled/dotenv-expand/package.json +1 -0
- package/compiled/just-diff/LICENSE +21 -0
- package/compiled/just-diff/index.d.ts +20 -0
- package/compiled/just-diff/index.js +1 -0
- package/compiled/just-diff/package.json +1 -0
- package/dist/config/config.d.ts +62 -0
- package/dist/config/config.js +240 -0
- package/dist/config/utils.d.ts +8 -0
- package/dist/config/utils.js +40 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +45 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +51 -0
- package/dist/route/defineRoutes.d.ts +1 -0
- package/dist/route/defineRoutes.js +61 -0
- package/dist/route/route.d.ts +3 -0
- package/dist/route/route.js +27 -0
- package/dist/route/routeUtils.d.ts +8 -0
- package/dist/route/routeUtils.js +46 -0
- package/dist/route/routesConfig.d.ts +6 -0
- package/dist/route/routesConfig.js +125 -0
- package/dist/route/routesConvention.d.ts +5 -0
- package/dist/route/routesConvention.js +88 -0
- package/dist/route/utils.d.ts +8 -0
- package/dist/route/utils.js +59 -0
- package/dist/service/command.d.ts +30 -0
- package/dist/service/command.js +46 -0
- package/dist/service/env.d.ts +4 -0
- package/dist/service/env.js +46 -0
- package/dist/service/generatePlugin.d.ts +4 -0
- package/dist/service/generatePlugin.js +102 -0
- package/dist/service/generator.d.ts +71 -0
- package/dist/service/generator.js +40 -0
- package/dist/service/hook.d.ts +16 -0
- package/dist/service/hook.js +57 -0
- package/dist/service/path.d.ts +15 -0
- package/dist/service/path.js +55 -0
- package/dist/service/plugin.d.ts +61 -0
- package/dist/service/plugin.js +177 -0
- package/dist/service/pluginAPI.d.ts +49 -0
- package/dist/service/pluginAPI.js +237 -0
- package/dist/service/service.d.ts +147 -0
- package/dist/service/service.js +538 -0
- package/dist/service/servicePlugin.d.ts +3 -0
- package/dist/service/servicePlugin.js +37 -0
- package/dist/service/telemetry.d.ts +32 -0
- package/dist/service/telemetry.js +127 -0
- package/dist/service/utils.d.ts +2 -0
- package/dist/service/utils.js +36 -0
- package/dist/types.d.ts +116 -0
- package/dist/types.js +77 -0
- package/package.json +49 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { logger } from '@4399ywkf/utils';
|
|
2
|
+
import { EnableBy, Env, IPluginConfig } from '../types';
|
|
3
|
+
import { IOpts as ICommandOpts } from './command';
|
|
4
|
+
import { Generator } from './generator';
|
|
5
|
+
import { IOpts as IHookOpts } from './hook';
|
|
6
|
+
import { Plugin } from './plugin';
|
|
7
|
+
import { Service } from './service';
|
|
8
|
+
import type { IMetry } from './telemetry';
|
|
9
|
+
declare type Logger = typeof logger;
|
|
10
|
+
declare const resolveConfigModes: readonly ["strict", "loose"];
|
|
11
|
+
export declare type ResolveConfigMode = (typeof resolveConfigModes)[number];
|
|
12
|
+
declare type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|
|
13
|
+
export declare class PluginAPI {
|
|
14
|
+
service: Service;
|
|
15
|
+
plugin: Plugin;
|
|
16
|
+
logger: Logger;
|
|
17
|
+
telemetry: IMetry;
|
|
18
|
+
constructor(opts: {
|
|
19
|
+
service: Service;
|
|
20
|
+
plugin: Plugin;
|
|
21
|
+
});
|
|
22
|
+
describe(opts: {
|
|
23
|
+
key?: string;
|
|
24
|
+
config?: IPluginConfig;
|
|
25
|
+
enableBy?: EnableBy | ((enableByOpts: {
|
|
26
|
+
userConfig: any;
|
|
27
|
+
env: Env;
|
|
28
|
+
}) => boolean);
|
|
29
|
+
}): void;
|
|
30
|
+
registerCommand(opts: Omit<ICommandOpts, 'plugin'> & {
|
|
31
|
+
alias?: string | string[];
|
|
32
|
+
}): void;
|
|
33
|
+
registerGenerator(opts: DistributiveOmit<Generator, 'plugin'>): void;
|
|
34
|
+
register(opts: Omit<IHookOpts, 'plugin'>): void;
|
|
35
|
+
registerMethod(opts: {
|
|
36
|
+
name: string;
|
|
37
|
+
fn?: Function;
|
|
38
|
+
}): void;
|
|
39
|
+
registerPresets(source: Plugin[], presets: any[]): void;
|
|
40
|
+
registerPlugins(source: Plugin[], plugins: any[]): void;
|
|
41
|
+
skipPlugins(keys: string[]): void;
|
|
42
|
+
static proxyPluginAPI(opts: {
|
|
43
|
+
pluginAPI: PluginAPI;
|
|
44
|
+
service: Service;
|
|
45
|
+
serviceProps: string[];
|
|
46
|
+
staticProps: Record<string, any>;
|
|
47
|
+
}): PluginAPI;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
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
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/service/pluginAPI.ts
|
|
30
|
+
var pluginAPI_exports = {};
|
|
31
|
+
__export(pluginAPI_exports, {
|
|
32
|
+
PluginAPI: () => PluginAPI
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(pluginAPI_exports);
|
|
35
|
+
var import_utils = require("@4399ywkf/utils");
|
|
36
|
+
var import_assert = __toESM(require("assert"));
|
|
37
|
+
var import_types = require("../types");
|
|
38
|
+
var import_command = require("./command");
|
|
39
|
+
var import_generator = require("./generator");
|
|
40
|
+
var import_hook = require("./hook");
|
|
41
|
+
var import_plugin = require("./plugin");
|
|
42
|
+
var import_utils2 = require("./utils");
|
|
43
|
+
var resolveConfigModes = ["strict", "loose"];
|
|
44
|
+
var PluginAPI = class {
|
|
45
|
+
service;
|
|
46
|
+
plugin;
|
|
47
|
+
logger;
|
|
48
|
+
telemetry;
|
|
49
|
+
constructor(opts) {
|
|
50
|
+
this.service = opts.service;
|
|
51
|
+
this.plugin = opts.plugin;
|
|
52
|
+
this.telemetry = opts.service.telemetry.prefixWith(this.plugin.key);
|
|
53
|
+
const loggerKeys = [
|
|
54
|
+
"wait",
|
|
55
|
+
"error",
|
|
56
|
+
"warn",
|
|
57
|
+
"ready",
|
|
58
|
+
"info",
|
|
59
|
+
"event",
|
|
60
|
+
"debug",
|
|
61
|
+
"fatal",
|
|
62
|
+
"profile"
|
|
63
|
+
];
|
|
64
|
+
this.logger = loggerKeys.reduce((memo, key) => {
|
|
65
|
+
memo[key] = (...message) => {
|
|
66
|
+
const func = import_utils.logger[key];
|
|
67
|
+
if (typeof func !== "function") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (key === "profile") {
|
|
71
|
+
func(...message);
|
|
72
|
+
} else {
|
|
73
|
+
func(import_utils.chalk.green(`[plugin: ${this.plugin.id}]`), ...message);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return memo;
|
|
77
|
+
}, {});
|
|
78
|
+
}
|
|
79
|
+
describe(opts) {
|
|
80
|
+
var _a;
|
|
81
|
+
if (opts.enableBy === import_types.EnableBy.config && ((_a = opts.config) == null ? void 0 : _a.default)) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
`[plugin: ${this.plugin.id}] The config.default is not allowed when enableBy is EnableBy.config.`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
this.plugin.merge(opts);
|
|
87
|
+
}
|
|
88
|
+
registerCommand(opts) {
|
|
89
|
+
const { alias } = opts;
|
|
90
|
+
delete opts.alias;
|
|
91
|
+
const registerCommand = (commandOpts) => {
|
|
92
|
+
var _a;
|
|
93
|
+
const { name, configResolveMode } = commandOpts;
|
|
94
|
+
(0, import_assert.default)(
|
|
95
|
+
!configResolveMode || resolveConfigModes.indexOf(configResolveMode) >= 0,
|
|
96
|
+
`configResolveMode must be one of ${resolveConfigModes.join(
|
|
97
|
+
","
|
|
98
|
+
)}, but got ${configResolveMode}`
|
|
99
|
+
);
|
|
100
|
+
(0, import_assert.default)(
|
|
101
|
+
!this.service.commands[name],
|
|
102
|
+
`api.registerCommand() failed, the command ${name} is exists from ${(_a = this.service.commands[name]) == null ? void 0 : _a.plugin.id}.`
|
|
103
|
+
);
|
|
104
|
+
this.service.commands[name] = new import_command.Command({
|
|
105
|
+
...commandOpts,
|
|
106
|
+
plugin: this.plugin
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
registerCommand(opts);
|
|
110
|
+
if (alias) {
|
|
111
|
+
const aliases = (0, import_utils2.makeArray)(alias);
|
|
112
|
+
aliases.forEach((alias2) => {
|
|
113
|
+
registerCommand({ ...opts, name: alias2 });
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
registerGenerator(opts) {
|
|
118
|
+
var _a;
|
|
119
|
+
const { key } = opts;
|
|
120
|
+
(0, import_assert.default)(
|
|
121
|
+
!this.service.generators[key],
|
|
122
|
+
`api.registerGenerator() failed, the generator ${key} is exists from ${(_a = this.service.generators[key]) == null ? void 0 : _a.plugin.id}.`
|
|
123
|
+
);
|
|
124
|
+
this.service.generators[key] = (0, import_generator.makeGenerator)({
|
|
125
|
+
...opts,
|
|
126
|
+
plugin: this.plugin
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
register(opts) {
|
|
130
|
+
var _a, _b;
|
|
131
|
+
(0, import_assert.default)(
|
|
132
|
+
this.service.stage <= import_types.ServiceStage.initPlugins,
|
|
133
|
+
"api.register() should not be called after plugin register stage."
|
|
134
|
+
);
|
|
135
|
+
(_a = this.service.hooks)[_b = opts.key] || (_a[_b] = []);
|
|
136
|
+
this.service.hooks[opts.key].push(
|
|
137
|
+
new import_hook.Hook({ ...opts, plugin: this.plugin })
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
registerMethod(opts) {
|
|
141
|
+
(0, import_assert.default)(
|
|
142
|
+
!this.service.pluginMethods[opts.name],
|
|
143
|
+
`api.registerMethod() failed, method ${opts.name} is already exist.`
|
|
144
|
+
);
|
|
145
|
+
this.service.pluginMethods[opts.name] = {
|
|
146
|
+
plugin: this.plugin,
|
|
147
|
+
fn: opts.fn || // 这里不能用 arrow function,this 需指向执行此方法的 PluginAPI
|
|
148
|
+
// 否则 pluginId 会不会,导致不能正确 skip plugin
|
|
149
|
+
function(fn) {
|
|
150
|
+
this.register({
|
|
151
|
+
key: opts.name,
|
|
152
|
+
...import_utils.lodash.isPlainObject(fn) ? fn : { fn }
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
registerPresets(source, presets) {
|
|
158
|
+
(0, import_assert.default)(
|
|
159
|
+
this.service.stage === import_types.ServiceStage.initPresets,
|
|
160
|
+
`api.registerPresets() failed, it should only used in presets.`
|
|
161
|
+
);
|
|
162
|
+
source.splice(
|
|
163
|
+
0,
|
|
164
|
+
0,
|
|
165
|
+
...presets.map((preset) => {
|
|
166
|
+
return new import_plugin.Plugin({
|
|
167
|
+
path: preset,
|
|
168
|
+
cwd: this.service.cwd,
|
|
169
|
+
type: import_types.PluginType.preset
|
|
170
|
+
});
|
|
171
|
+
})
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
registerPlugins(source, plugins) {
|
|
175
|
+
(0, import_assert.default)(
|
|
176
|
+
this.service.stage === import_types.ServiceStage.initPresets || this.service.stage === import_types.ServiceStage.initPlugins,
|
|
177
|
+
`api.registerPlugins() failed, it should only be used in registering stage.`
|
|
178
|
+
);
|
|
179
|
+
const mappedPlugins = plugins.map((plugin) => {
|
|
180
|
+
if (import_utils.lodash.isPlainObject(plugin)) {
|
|
181
|
+
(0, import_assert.default)(
|
|
182
|
+
plugin.id && plugin.key,
|
|
183
|
+
`Invalid plugin object, id and key must supplied.`
|
|
184
|
+
);
|
|
185
|
+
plugin.type = import_types.PluginType.plugin;
|
|
186
|
+
plugin.enableBy = plugin.enableBy || import_types.EnableBy.register;
|
|
187
|
+
plugin.apply = plugin.apply || (() => () => {
|
|
188
|
+
});
|
|
189
|
+
plugin.config = plugin.config || {};
|
|
190
|
+
plugin.time = { hooks: {} };
|
|
191
|
+
return plugin;
|
|
192
|
+
} else {
|
|
193
|
+
return new import_plugin.Plugin({
|
|
194
|
+
path: plugin,
|
|
195
|
+
cwd: this.service.cwd,
|
|
196
|
+
type: import_types.PluginType.plugin
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
if (this.service.stage === import_types.ServiceStage.initPresets) {
|
|
201
|
+
source.push(...mappedPlugins);
|
|
202
|
+
} else {
|
|
203
|
+
source.splice(0, 0, ...mappedPlugins);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
skipPlugins(keys) {
|
|
207
|
+
keys.forEach((key) => {
|
|
208
|
+
(0, import_assert.default)(!(this.plugin.key === key), `plugin ${key} can't skip itself!`);
|
|
209
|
+
(0, import_assert.default)(
|
|
210
|
+
this.service.keyToPluginMap[key],
|
|
211
|
+
`key: ${key} is not be registered by any plugin. You can't skip it!`
|
|
212
|
+
);
|
|
213
|
+
this.service.skipPluginIds.add(this.service.keyToPluginMap[key].id);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
static proxyPluginAPI(opts) {
|
|
217
|
+
return new Proxy(opts.pluginAPI, {
|
|
218
|
+
get: (target, prop) => {
|
|
219
|
+
if (opts.service.pluginMethods[prop]) {
|
|
220
|
+
return opts.service.pluginMethods[prop].fn;
|
|
221
|
+
}
|
|
222
|
+
if (opts.serviceProps.includes(prop)) {
|
|
223
|
+
const serviceProp = opts.service[prop];
|
|
224
|
+
return typeof serviceProp === "function" ? serviceProp.bind(opts.service) : serviceProp;
|
|
225
|
+
}
|
|
226
|
+
if (prop in opts.staticProps) {
|
|
227
|
+
return opts.staticProps[prop];
|
|
228
|
+
}
|
|
229
|
+
return target[prop];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
235
|
+
0 && (module.exports = {
|
|
236
|
+
PluginAPI
|
|
237
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { BuildResult } from '@4399ywkf/bundler-utils/compiled/esbuild';
|
|
2
|
+
import { yParser } from '@4399ywkf/utils';
|
|
3
|
+
import { Config } from '../config/config';
|
|
4
|
+
import { ApplyPluginsType, ConfigChangeType, EnableBy, Env, IEvent, IFrameworkType, IModify, ServiceStage } from '../types';
|
|
5
|
+
import { Command } from './command';
|
|
6
|
+
import { Generator } from './generator';
|
|
7
|
+
import { Hook } from './hook';
|
|
8
|
+
import { Plugin } from './plugin';
|
|
9
|
+
import { Telemetry } from './telemetry';
|
|
10
|
+
interface IOpts {
|
|
11
|
+
cwd: string;
|
|
12
|
+
env: Env;
|
|
13
|
+
plugins?: string[];
|
|
14
|
+
presets?: string[];
|
|
15
|
+
frameworkName?: string;
|
|
16
|
+
defaultConfigFiles?: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare class Service {
|
|
19
|
+
private opts;
|
|
20
|
+
appData: {
|
|
21
|
+
deps?: Record<string, {
|
|
22
|
+
version: string;
|
|
23
|
+
matches: string[];
|
|
24
|
+
subpaths: string[];
|
|
25
|
+
external?: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
framework?: IFrameworkType;
|
|
28
|
+
prepare?: {
|
|
29
|
+
buildResult: BuildResult;
|
|
30
|
+
};
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
args: yParser.Arguments;
|
|
34
|
+
commands: Record<string, Command>;
|
|
35
|
+
generators: Record<string, Generator>;
|
|
36
|
+
config: Record<string, any>;
|
|
37
|
+
configSchemas: Record<string, any>;
|
|
38
|
+
configDefaults: Record<string, any>;
|
|
39
|
+
configOnChanges: Record<string, any>;
|
|
40
|
+
cwd: string;
|
|
41
|
+
env: Env;
|
|
42
|
+
hooks: Record<string, Hook[]>;
|
|
43
|
+
name: string;
|
|
44
|
+
paths: {
|
|
45
|
+
cwd?: string;
|
|
46
|
+
absSrcPath?: string;
|
|
47
|
+
absPagesPath?: string;
|
|
48
|
+
absApiRoutesPath?: string;
|
|
49
|
+
absTmpPath?: string;
|
|
50
|
+
absNodeModulesPath?: string;
|
|
51
|
+
absOutputPath?: string;
|
|
52
|
+
};
|
|
53
|
+
plugins: Record<string, Plugin>;
|
|
54
|
+
keyToPluginMap: Record<string, Plugin>;
|
|
55
|
+
pluginMethods: Record<string, {
|
|
56
|
+
plugin: Plugin;
|
|
57
|
+
fn: Function;
|
|
58
|
+
}>;
|
|
59
|
+
skipPluginIds: Set<string>;
|
|
60
|
+
stage: ServiceStage;
|
|
61
|
+
userConfig: Record<string, any>;
|
|
62
|
+
configManager: Config | null;
|
|
63
|
+
pkg: {
|
|
64
|
+
name?: string;
|
|
65
|
+
version?: string;
|
|
66
|
+
dependencies?: Record<string, string>;
|
|
67
|
+
devDependencies?: Record<string, string>;
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
};
|
|
70
|
+
pkgPath: string;
|
|
71
|
+
telemetry: Telemetry;
|
|
72
|
+
constructor(opts: IOpts);
|
|
73
|
+
applyPlugins<T>(opts: {
|
|
74
|
+
key: string;
|
|
75
|
+
type?: ApplyPluginsType.event;
|
|
76
|
+
initialValue?: any;
|
|
77
|
+
args?: any;
|
|
78
|
+
sync: true;
|
|
79
|
+
}): typeof opts.initialValue | T;
|
|
80
|
+
applyPlugins<T>(opts: {
|
|
81
|
+
key: string;
|
|
82
|
+
type?: ApplyPluginsType;
|
|
83
|
+
initialValue?: any;
|
|
84
|
+
args?: any;
|
|
85
|
+
}): Promise<typeof opts.initialValue | T>;
|
|
86
|
+
run(opts: {
|
|
87
|
+
name: string;
|
|
88
|
+
args?: any;
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
getPaths(): Promise<{
|
|
91
|
+
cwd: string;
|
|
92
|
+
absSrcPath: string;
|
|
93
|
+
absPagesPath: string;
|
|
94
|
+
absApiRoutesPath: string;
|
|
95
|
+
absTmpPath: string;
|
|
96
|
+
absNodeModulesPath: string;
|
|
97
|
+
absOutputPath: string;
|
|
98
|
+
}>;
|
|
99
|
+
resolveConfig(): Promise<{
|
|
100
|
+
config: any;
|
|
101
|
+
defaultConfig: any;
|
|
102
|
+
}>;
|
|
103
|
+
_profilePlugins(): void;
|
|
104
|
+
initPreset(opts: {
|
|
105
|
+
preset: Plugin;
|
|
106
|
+
presets: Plugin[];
|
|
107
|
+
plugins: Plugin[];
|
|
108
|
+
}): Promise<void>;
|
|
109
|
+
initPlugin(opts: {
|
|
110
|
+
plugin: Plugin;
|
|
111
|
+
presets?: Plugin[];
|
|
112
|
+
plugins: Plugin[];
|
|
113
|
+
}): Promise<any>;
|
|
114
|
+
isPluginEnable(hook: Hook | string): boolean;
|
|
115
|
+
commandGuessHelper(commands: string[], currentCmd: string): void;
|
|
116
|
+
}
|
|
117
|
+
export interface IServicePluginAPI {
|
|
118
|
+
appData: typeof Service.prototype.appData;
|
|
119
|
+
applyPlugins: typeof Service.prototype.applyPlugins;
|
|
120
|
+
args: typeof Service.prototype.args;
|
|
121
|
+
config: typeof Service.prototype.config;
|
|
122
|
+
cwd: typeof Service.prototype.cwd;
|
|
123
|
+
generators: typeof Service.prototype.generators;
|
|
124
|
+
pkg: typeof Service.prototype.pkg;
|
|
125
|
+
pkgPath: typeof Service.prototype.pkgPath;
|
|
126
|
+
name: typeof Service.prototype.name;
|
|
127
|
+
paths: Required<typeof Service.prototype.paths>;
|
|
128
|
+
userConfig: typeof Service.prototype.userConfig;
|
|
129
|
+
env: typeof Service.prototype.env;
|
|
130
|
+
isPluginEnable: typeof Service.prototype.isPluginEnable;
|
|
131
|
+
onCheck: IEvent<null>;
|
|
132
|
+
onStart: IEvent<null>;
|
|
133
|
+
modifyAppData: IModify<typeof Service.prototype.appData, null>;
|
|
134
|
+
modifyConfig: IModify<typeof Service.prototype.config, {
|
|
135
|
+
paths: Record<string, string>;
|
|
136
|
+
}>;
|
|
137
|
+
modifyDefaultConfig: IModify<typeof Service.prototype.config, null>;
|
|
138
|
+
modifyPaths: IModify<typeof Service.prototype.paths, null>;
|
|
139
|
+
modifyTelemetryStorage: IModify<typeof Service.prototype.telemetry, null>;
|
|
140
|
+
ApplyPluginsType: typeof ApplyPluginsType;
|
|
141
|
+
ConfigChangeType: typeof ConfigChangeType;
|
|
142
|
+
EnableBy: typeof EnableBy;
|
|
143
|
+
ServiceStage: typeof ServiceStage;
|
|
144
|
+
registerPresets: (presets: any[]) => void;
|
|
145
|
+
registerPlugins: (plugins: (Plugin | {})[]) => void;
|
|
146
|
+
}
|
|
147
|
+
export {};
|