@initx-plugin/core 0.0.20 → 0.0.21
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/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -29,7 +29,7 @@ interface BaseMatchers {
|
|
|
29
29
|
}
|
|
30
30
|
type TypeMatchers = Record<string, BaseMatchers>;
|
|
31
31
|
type Matchers = MaybeArray<BaseMatchers> | TypeMatchers;
|
|
32
|
-
type
|
|
32
|
+
type PluginStore = Record<string, any>;
|
|
33
33
|
interface HandlerInfo {
|
|
34
34
|
handler: () => MaybePromise<void>;
|
|
35
35
|
description: string;
|
|
@@ -55,23 +55,23 @@ interface InitxBaseContext {
|
|
|
55
55
|
*/
|
|
56
56
|
optionsList: string[];
|
|
57
57
|
}
|
|
58
|
-
interface InitxContext<
|
|
58
|
+
interface InitxContext<TStore extends PluginStore = PluginStore> extends InitxBaseContext {
|
|
59
59
|
/**
|
|
60
60
|
* Store
|
|
61
61
|
*
|
|
62
62
|
* Store data in memory, and write to disk when the program exits
|
|
63
63
|
*/
|
|
64
|
-
store:
|
|
64
|
+
store: TStore;
|
|
65
65
|
/**
|
|
66
66
|
* Package info
|
|
67
67
|
*/
|
|
68
68
|
packageInfo: PackageInfo;
|
|
69
69
|
}
|
|
70
|
-
declare abstract class InitxPlugin<
|
|
70
|
+
declare abstract class InitxPlugin<TStore extends PluginStore = PluginStore> {
|
|
71
71
|
abstract matchers: Matchers;
|
|
72
|
-
abstract handle(options: InitxContext<
|
|
73
|
-
|
|
74
|
-
run(context: InitxContext<
|
|
72
|
+
abstract handle(options: InitxContext<TStore>, ...others: string[]): MaybePromise<void>;
|
|
73
|
+
defaultStore?: TStore;
|
|
74
|
+
run(context: InitxContext<TStore>, ...others: string[]): HandlerInfo[];
|
|
75
75
|
private matchBaseMatchers;
|
|
76
76
|
private matchArrayBaseMatchers;
|
|
77
77
|
private matchTypeMatchers;
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ interface BaseMatchers {
|
|
|
29
29
|
}
|
|
30
30
|
type TypeMatchers = Record<string, BaseMatchers>;
|
|
31
31
|
type Matchers = MaybeArray<BaseMatchers> | TypeMatchers;
|
|
32
|
-
type
|
|
32
|
+
type PluginStore = Record<string, any>;
|
|
33
33
|
interface HandlerInfo {
|
|
34
34
|
handler: () => MaybePromise<void>;
|
|
35
35
|
description: string;
|
|
@@ -55,23 +55,23 @@ interface InitxBaseContext {
|
|
|
55
55
|
*/
|
|
56
56
|
optionsList: string[];
|
|
57
57
|
}
|
|
58
|
-
interface InitxContext<
|
|
58
|
+
interface InitxContext<TStore extends PluginStore = PluginStore> extends InitxBaseContext {
|
|
59
59
|
/**
|
|
60
60
|
* Store
|
|
61
61
|
*
|
|
62
62
|
* Store data in memory, and write to disk when the program exits
|
|
63
63
|
*/
|
|
64
|
-
store:
|
|
64
|
+
store: TStore;
|
|
65
65
|
/**
|
|
66
66
|
* Package info
|
|
67
67
|
*/
|
|
68
68
|
packageInfo: PackageInfo;
|
|
69
69
|
}
|
|
70
|
-
declare abstract class InitxPlugin<
|
|
70
|
+
declare abstract class InitxPlugin<TStore extends PluginStore = PluginStore> {
|
|
71
71
|
abstract matchers: Matchers;
|
|
72
|
-
abstract handle(options: InitxContext<
|
|
73
|
-
|
|
74
|
-
run(context: InitxContext<
|
|
72
|
+
abstract handle(options: InitxContext<TStore>, ...others: string[]): MaybePromise<void>;
|
|
73
|
+
defaultStore?: TStore;
|
|
74
|
+
run(context: InitxContext<TStore>, ...others: string[]): HandlerInfo[];
|
|
75
75
|
private matchBaseMatchers;
|
|
76
76
|
private matchArrayBaseMatchers;
|
|
77
77
|
private matchTypeMatchers;
|
package/dist/index.mjs
CHANGED
|
@@ -73,7 +73,7 @@ var __publicField = (obj, key, value) => {
|
|
|
73
73
|
};
|
|
74
74
|
class InitxPlugin {
|
|
75
75
|
constructor() {
|
|
76
|
-
__publicField(this, "
|
|
76
|
+
__publicField(this, "defaultStore");
|
|
77
77
|
}
|
|
78
78
|
run(context, ...others) {
|
|
79
79
|
if (this.isBaseMatchers(this.matchers)) {
|
|
@@ -192,7 +192,7 @@ function matchPlugins(plugins, { key, cliOptions }, ...others) {
|
|
|
192
192
|
const matchedHandlers = [];
|
|
193
193
|
for (const plugin of plugins) {
|
|
194
194
|
const { instance, packageInfo } = plugin;
|
|
195
|
-
const store = createStore(packageInfo, instance.
|
|
195
|
+
const store = createStore(packageInfo, instance.defaultStore);
|
|
196
196
|
const matched = instance.run({
|
|
197
197
|
key,
|
|
198
198
|
store,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@initx-plugin/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"description": "core module for initx plugins",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/initx-collective/initx#readme",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"defu": "^6.1.4",
|
|
26
26
|
"fs-extra": "^11.2.0",
|
|
27
27
|
"importx": "^0.5.0",
|
|
28
|
-
"@initx-plugin/utils": "0.0.
|
|
28
|
+
"@initx-plugin/utils": "0.0.21"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/fs-extra": "^11.0.4"
|