@vnejs/plugins.compatibility.text.inject-flags 0.1.2 → 0.1.3
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.ts +14 -0
- package/dist/index.js +8 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +1 -0
- package/package.json +30 -6
- package/src/index.ts +23 -0
- package/src/types.ts +13 -0
- package/tsconfig.json +6 -0
- package/index.js +0 -12
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ModuleGlobalStateRegistry } from "@vnejs/module";
|
|
2
|
+
import { Module } from "@vnejs/module";
|
|
3
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
|
|
4
|
+
type TextInjectHandler = (payload: {
|
|
5
|
+
line?: string;
|
|
6
|
+
keywords?: string[];
|
|
7
|
+
state?: ModuleGlobalStateRegistry;
|
|
8
|
+
}) => string | Promise<string>;
|
|
9
|
+
export declare class CompatibilityTextInjectFlags extends Module<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
10
|
+
name: string;
|
|
11
|
+
init: () => Promise<unknown[]> | undefined;
|
|
12
|
+
textInjectHandler: TextInjectHandler;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Module } from "@vnejs/module";
|
|
2
|
+
import { regModule } from "@vnejs/shared";
|
|
3
|
+
export class CompatibilityTextInjectFlags extends Module {
|
|
4
|
+
name = "compatibility.text.inject_flags";
|
|
5
|
+
init = () => this.emit(this.EVENTS.TEXT_INJECT.REG, { module: this.CONST.VARS_FLAGS.EXEC_NAME, handler: this.textInjectHandler });
|
|
6
|
+
textInjectHandler = async ({ line = "", keywords = [], state = {} } = {}) => String(await this.emitOne(this.EVENTS.VARS_FLAGS.EXEC_CHECK, { line, keywords, state }));
|
|
7
|
+
}
|
|
8
|
+
regModule(CompatibilityTextInjectFlags);
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
2
|
+
import type { PluginName as TextInjectPluginName, SubscribeEvents as TextInjectSubscribeEvents } from "@vnejs/plugins.text.inject.contract";
|
|
3
|
+
import type { PluginName as VarsFlagsPluginName, Constants as VarsFlagsConstants, SubscribeEvents as VarsFlagsSubscribeEvents } from "@vnejs/plugins.vars.flags.contract";
|
|
4
|
+
export type PluginEvents = VnePluginEventsMapRegistry & Record<TextInjectPluginName, TextInjectSubscribeEvents> & Record<VarsFlagsPluginName, VarsFlagsSubscribeEvents>;
|
|
5
|
+
export type PluginConstants = VnePluginConstantsMapRegistry & Record<VarsFlagsPluginName, VarsFlagsConstants>;
|
|
6
|
+
export type PluginSettings = VnePluginSettingsMapRegistry;
|
|
7
|
+
export type PluginParams = VnePluginParamsMapRegistry;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.compatibility.text.inject-flags",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src",
|
|
18
|
+
"tsconfig.json"
|
|
19
|
+
],
|
|
5
20
|
"scripts": {
|
|
6
21
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
22
|
+
"build": "npx @vnejs/monorepo package",
|
|
7
23
|
"publish:major:plugin": "npm run publish:major",
|
|
8
24
|
"publish:minor:plugin": "npm run publish:minor",
|
|
9
25
|
"publish:patch:plugin": "npm run publish:patch",
|
|
10
|
-
"publish:major": "
|
|
11
|
-
"publish:minor": "
|
|
12
|
-
"publish:patch": "
|
|
26
|
+
"publish:major": "npx @vnejs/monorepo publish major --access public",
|
|
27
|
+
"publish:minor": "npx @vnejs/monorepo publish minor --access public",
|
|
28
|
+
"publish:patch": "npx @vnejs/monorepo publish patch --access public"
|
|
13
29
|
},
|
|
14
30
|
"author": "",
|
|
15
31
|
"license": "ISC",
|
|
16
|
-
"
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@vnejs/module": "~0.0.1",
|
|
34
|
+
"@vnejs/plugins.text.inject.contract": "~0.0.1",
|
|
35
|
+
"@vnejs/plugins.vars.flags.contract": "~0.0.1",
|
|
36
|
+
"@vnejs/shared": "~0.0.9"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@vnejs/configs.ts-common": "~0.0.1"
|
|
40
|
+
}
|
|
17
41
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ModuleGlobalStateRegistry } from "@vnejs/module";
|
|
2
|
+
import { Module } from "@vnejs/module";
|
|
3
|
+
import { regModule } from "@vnejs/shared";
|
|
4
|
+
|
|
5
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
|
|
6
|
+
|
|
7
|
+
type TextInjectHandler = (payload: { line?: string; keywords?: string[]; state?: ModuleGlobalStateRegistry }) => string | Promise<string>;
|
|
8
|
+
|
|
9
|
+
type TextInjectRegPayload = {
|
|
10
|
+
module?: string;
|
|
11
|
+
handler?: TextInjectHandler;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export class CompatibilityTextInjectFlags extends Module<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
15
|
+
name = "compatibility.text.inject_flags";
|
|
16
|
+
|
|
17
|
+
init = () => this.emit(this.EVENTS.TEXT_INJECT.REG, { module: this.CONST.VARS_FLAGS.EXEC_NAME, handler: this.textInjectHandler } satisfies TextInjectRegPayload);
|
|
18
|
+
|
|
19
|
+
textInjectHandler: TextInjectHandler = async ({ line = "", keywords = [], state = {} } = {}) =>
|
|
20
|
+
String(await this.emitOne(this.EVENTS.VARS_FLAGS.EXEC_CHECK, { line, keywords, state }));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
regModule(CompatibilityTextInjectFlags);
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
2
|
+
import type { PluginName as TextInjectPluginName, SubscribeEvents as TextInjectSubscribeEvents } from "@vnejs/plugins.text.inject.contract";
|
|
3
|
+
import type { PluginName as VarsFlagsPluginName, Constants as VarsFlagsConstants, SubscribeEvents as VarsFlagsSubscribeEvents } from "@vnejs/plugins.vars.flags.contract";
|
|
4
|
+
|
|
5
|
+
export type PluginEvents = VnePluginEventsMapRegistry &
|
|
6
|
+
Record<TextInjectPluginName, TextInjectSubscribeEvents> &
|
|
7
|
+
Record<VarsFlagsPluginName, VarsFlagsSubscribeEvents>;
|
|
8
|
+
|
|
9
|
+
export type PluginConstants = VnePluginConstantsMapRegistry & Record<VarsFlagsPluginName, VarsFlagsConstants>;
|
|
10
|
+
|
|
11
|
+
export type PluginSettings = VnePluginSettingsMapRegistry;
|
|
12
|
+
|
|
13
|
+
export type PluginParams = VnePluginParamsMapRegistry;
|
package/tsconfig.json
ADDED
package/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Module } from "@vnejs/module";
|
|
2
|
-
import { regModule } from "@vnejs/shared";
|
|
3
|
-
|
|
4
|
-
export class CompatibilityTextInjectFlags extends Module {
|
|
5
|
-
name = "compatibility.text.inject_flags";
|
|
6
|
-
|
|
7
|
-
init = () => this.emit(this.EVENTS.TEXT_INJECT.REG, { module: this.CONST.VARS_FLAGS.EXEC_NAME, handler: this.textInjectHandler });
|
|
8
|
-
|
|
9
|
-
textInjectHandler = ({ line = "", keywords = [], state = {} } = {}) => this.emitOne(this.EVENTS.VARS_FLAGS.EXEC_CHECK, { line, keywords, state });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
regModule(CompatibilityTextInjectFlags);
|