1 | import { Command } from './command';
|
2 | import { Hooks } from './hooks';
|
3 | import { Manifest } from './manifest';
|
4 | import { PJSON } from './pjson';
|
5 | import { Topic } from './topic';
|
6 | export interface Options {
|
7 | root: string;
|
8 | name?: string;
|
9 | type?: string;
|
10 | tag?: string;
|
11 | ignoreManifest?: boolean;
|
12 | }
|
13 | export interface IPlugin {
|
14 | |
15 |
|
16 |
|
17 | _base: string;
|
18 | |
19 |
|
20 |
|
21 | name: string;
|
22 | |
23 |
|
24 |
|
25 |
|
26 |
|
27 | version: string;
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 | pjson: PJSON.Plugin | PJSON.CLI;
|
34 | |
35 |
|
36 |
|
37 |
|
38 | type: string;
|
39 | |
40 |
|
41 |
|
42 | root: string;
|
43 | |
44 |
|
45 |
|
46 |
|
47 | tag?: string;
|
48 | |
49 |
|
50 |
|
51 | plugins: IPlugin[];
|
52 | |
53 |
|
54 |
|
55 | valid: boolean;
|
56 | readonly commands: Command.Plugin[];
|
57 | readonly commandIDs: string[];
|
58 | readonly topics: Topic[];
|
59 | findCommand(id: string, opts: {
|
60 | must: true;
|
61 | }): Command.Plugin;
|
62 | findCommand(id: string, opts?: {
|
63 | must: boolean;
|
64 | }): Command.Plugin | undefined;
|
65 | findTopic(id: string, opts: {
|
66 | must: true;
|
67 | }): Topic;
|
68 | findTopic(id: string, opts?: {
|
69 | must: boolean;
|
70 | }): Topic | undefined;
|
71 | runHook<T extends Hooks, K extends keyof T>(event: K, opts: T[K]): Promise<void>;
|
72 | }
|
73 | export declare class Plugin implements IPlugin {
|
74 | static loadedPlugins: {
|
75 | [name: string]: Plugin;
|
76 | };
|
77 | _base: string;
|
78 | name: string;
|
79 | version: string;
|
80 | pjson: PJSON.Plugin;
|
81 | type: string;
|
82 | root: string;
|
83 | tag?: string;
|
84 | manifest: Manifest;
|
85 | _topics: Topic[];
|
86 | plugins: IPlugin[];
|
87 | hooks: {
|
88 | [k: string]: string[];
|
89 | };
|
90 | valid: boolean;
|
91 | ignoreManifest: boolean;
|
92 | alreadyLoaded: boolean;
|
93 | constructor(opts: Options);
|
94 | readonly commandsDir: string | undefined;
|
95 | readonly topics: Topic[];
|
96 | readonly commands: {
|
97 | load: () => Command.Class;
|
98 | id: string;
|
99 | hidden: boolean;
|
100 | aliases: string[];
|
101 | description?: string | undefined;
|
102 | title?: string | undefined;
|
103 | usage?: string | string[] | undefined;
|
104 | examples?: string[] | undefined;
|
105 | type?: string | undefined;
|
106 | flags: {
|
107 | [name: string]: Command.Flag;
|
108 | };
|
109 | args: {
|
110 | name: string;
|
111 | description?: string | undefined;
|
112 | required?: boolean | undefined;
|
113 | hidden?: boolean | undefined;
|
114 | default?: string | undefined;
|
115 | options?: string[] | undefined;
|
116 | }[];
|
117 | }[];
|
118 | readonly commandIDs: string[];
|
119 | findCommand(id: string, opts: {
|
120 | must: true;
|
121 | }): Command.Plugin;
|
122 | findCommand(id: string, opts?: {
|
123 | must: boolean;
|
124 | }): Command.Plugin | undefined;
|
125 | _findCommand(id: string): Command.Class;
|
126 | findTopic(id: string, opts: {
|
127 | must: true;
|
128 | }): Topic;
|
129 | findTopic(id: string, opts?: {
|
130 | must: boolean;
|
131 | }): Topic | undefined;
|
132 | runHook<T extends Hooks, K extends keyof T>(event: K, opts: T[K]): Promise<void>;
|
133 | protected _manifest(): Manifest;
|
134 | protected loadPlugins(root: string, plugins: (string | PJSON.Plugin)[]): (string | PJSON.Plugin)[] | undefined;
|
135 | }
|