@vnejs/plugins.bridges.plugins.logics.text.inject.plugins.logics.vars.flags 0.0.0-stage → 0.2.10

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.
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { regPlugin } from "@vnejs/registry";
2
+ import { PLUGIN_NAME } from "@vnejs/contracts.bridges.plugins.logics.text.inject.plugins.logics.vars.flags";
3
+ import { BridgePluginTextInjectPluginVarsFlags } from "./modules/bridge_plugin_text_inject_plugin_vars_flags.js";
4
+ regPlugin(PLUGIN_NAME, {}, [BridgePluginTextInjectPluginVarsFlags]);
@@ -0,0 +1,8 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ import type { TextInjectHandler } from "@vnejs/contracts.logics.text.inject";
3
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
4
+ export declare class BridgePluginTextInjectPluginVarsFlags extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
5
+ name: string;
6
+ init: () => Promise<import("@vnejs/registry").EmitResults<"vne:text_inject:reg">> | undefined;
7
+ textInjectHandler: TextInjectHandler;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ export class BridgePluginTextInjectPluginVarsFlags extends ModuleCore {
3
+ name = "bridge_plugin_text_inject_plugin_vars_flags";
4
+ init = () => this.emit(this.EVENTS.TEXT_INJECT.REG, { module: this.CONST.VARS_FLAGS.EXEC_NAME, handler: this.textInjectHandler });
5
+ textInjectHandler = async ({ line = "", keywords = [], state } = {}) => String(await this.emitOne(this.EVENTS.VARS_FLAGS.EXEC_CHECK, { line, keywords, state }));
6
+ }
@@ -0,0 +1,7 @@
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
+ import type { PluginName as TextInjectPluginName, SubscribeEvents as TextInjectSubscribeEvents } from "@vnejs/contracts.logics.text.inject";
3
+ import type { PluginName as VarsFlagsPluginName, Constants as VarsFlagsConstants, SubscribeEvents as VarsFlagsSubscribeEvents } from "@vnejs/contracts.logics.vars.flags";
4
+ export type PluginEvents = ModuleCoreEvents & Record<TextInjectPluginName, TextInjectSubscribeEvents> & Record<VarsFlagsPluginName, VarsFlagsSubscribeEvents>;
5
+ export type PluginConstants = ModuleCoreConstants & Record<VarsFlagsPluginName, VarsFlagsConstants>;
6
+ export type PluginSettings = ModuleCoreSettings;
7
+ export type PluginParams = ModuleCoreParams;
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.bridges.plugins.logics.text.inject.plugins.logics.vars.flags",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.10",
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
+ ],
20
+ "scripts": {
21
+ "test": "npx @vnejs/monorepo test",
22
+ "build": "npx @vnejs/monorepo package",
23
+ "publish:major:plugin": "npm run publish:major",
24
+ "publish:minor:plugin": "npm run publish:minor",
25
+ "publish:patch:plugin": "npm run 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"
29
+ },
30
+ "author": "",
31
+ "license": "ISC",
32
+ "peerDependencies": {
33
+ "@vnejs/module.core": "~0.2.0",
34
+ "@vnejs/contracts.logics.text.inject": "~0.2.0",
35
+ "@vnejs/contracts.logics.vars.flags": "~0.2.0",
36
+ "@vnejs/registry": "~0.2.0",
37
+ "@vnejs/contracts.bridges.plugins.logics.text.inject.plugins.logics.vars.flags": "~0.2.0"
38
+ },
39
+ "devDependencies": {
40
+ "@vnejs/configs.ts-common": "~0.2.0",
41
+ "@vnejs/configs.vitest": "~0.2.0",
42
+ "@vnejs/test-utils": "~0.2.0",
43
+ "@vnejs/contracts.bridges.plugins.logics.text.inject.plugins.logics.vars.flags": "~0.2.0"
44
+ }
45
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { regPlugin } from "@vnejs/registry";
2
+
3
+ import { PLUGIN_NAME } from "@vnejs/contracts.bridges.plugins.logics.text.inject.plugins.logics.vars.flags";
4
+
5
+ import { BridgePluginTextInjectPluginVarsFlags } from "./modules/bridge_plugin_text_inject_plugin_vars_flags.js";
6
+
7
+ regPlugin(PLUGIN_NAME, {}, [BridgePluginTextInjectPluginVarsFlags]);
@@ -0,0 +1,14 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+
3
+ import type { TextInjectHandler } from "@vnejs/contracts.logics.text.inject";
4
+
5
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
6
+
7
+ export class BridgePluginTextInjectPluginVarsFlags extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
8
+ name = "bridge_plugin_text_inject_plugin_vars_flags";
9
+
10
+ init = () => this.emit(this.EVENTS.TEXT_INJECT.REG, { module: this.CONST.VARS_FLAGS.EXEC_NAME, handler: this.textInjectHandler });
11
+
12
+ textInjectHandler: TextInjectHandler = async ({ line = "", keywords = [], state } = {}) =>
13
+ String(await this.emitOne(this.EVENTS.VARS_FLAGS.EXEC_CHECK, { line, keywords, state }));
14
+ }
@@ -0,0 +1,17 @@
1
+ import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
2
+
3
+ import { SUBSCRIBE_EVENTS as TEXT_INJECT_EVENTS, PLUGIN_NAME as TEXT_INJECT } from "@vnejs/contracts.logics.text.inject";
4
+ import { CONSTANTS as VARS_FLAGS_CONST, PLUGIN_NAME as VARS_FLAGS, SUBSCRIBE_EVENTS as VARS_FLAGS_EVENTS } from "@vnejs/contracts.logics.vars.flags";
5
+
6
+ export const registerCompatibilityVne = () => {
7
+ registerCoreVne();
8
+ registerVnePlugin(TEXT_INJECT, { events: TEXT_INJECT_EVENTS });
9
+ registerVnePlugin(VARS_FLAGS, { constants: VARS_FLAGS_CONST, events: VARS_FLAGS_EVENTS });
10
+ };
11
+
12
+ export const createCompatibilityTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
13
+ ModuleClass: T,
14
+ options: Parameters<typeof baseCreateTestModule>[1] = {},
15
+ ) => baseCreateTestModule(ModuleClass, options);
16
+
17
+ export { TEXT_INJECT_EVENTS, VARS_FLAGS_CONST, VARS_FLAGS_EVENTS };
@@ -0,0 +1,35 @@
1
+ import { beforeEach, describe, expect, it } from "vitest";
2
+
3
+ import { spyEvent } from "@vnejs/test-utils";
4
+
5
+ import { BridgePluginTextInjectPluginVarsFlags } from "../modules/bridge_plugin_text_inject_plugin_vars_flags.js";
6
+
7
+ import { createCompatibilityTestModule, registerCompatibilityVne, VARS_FLAGS_CONST, VARS_FLAGS_EVENTS, TEXT_INJECT_EVENTS } from "./setup.js";
8
+
9
+ describe("BridgePluginTextInjectPluginVarsFlags", () => {
10
+ beforeEach(() => registerCompatibilityVne());
11
+
12
+ it("init registers text inject handler", async () => {
13
+ const { module, observer } = createCompatibilityTestModule(BridgePluginTextInjectPluginVarsFlags, { subscribe: false });
14
+ const reg = spyEvent(observer, TEXT_INJECT_EVENTS.REG);
15
+
16
+ await (module as BridgePluginTextInjectPluginVarsFlags).init();
17
+
18
+ expect(reg).toHaveBeenCalledOnce();
19
+ expect(reg.mock.calls[0]?.[0]).toMatchObject({ module: VARS_FLAGS_CONST.EXEC_NAME });
20
+ });
21
+
22
+ it("handler returns stringified downstream result", async () => {
23
+ const { module, observer } = createCompatibilityTestModule(BridgePluginTextInjectPluginVarsFlags, { subscribe: false });
24
+ const reg = spyEvent(observer, TEXT_INJECT_EVENTS.REG);
25
+
26
+ observer.subscribe(VARS_FLAGS_EVENTS.EXEC_CHECK, () => true);
27
+
28
+ await (module as BridgePluginTextInjectPluginVarsFlags).init();
29
+
30
+ const handler = reg.mock.calls[0]?.[0]?.handler as (payload: { line?: string; keywords?: string[] }) => Promise<string>;
31
+ const result = await handler({ line: "gold > 5", keywords: ["gold"] });
32
+
33
+ expect(result).toBe("true");
34
+ });
35
+ });
package/src/types.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
+
3
+ import type { PluginName as TextInjectPluginName, SubscribeEvents as TextInjectSubscribeEvents } from "@vnejs/contracts.logics.text.inject";
4
+ import type {
5
+ PluginName as VarsFlagsPluginName,
6
+ Constants as VarsFlagsConstants,
7
+ SubscribeEvents as VarsFlagsSubscribeEvents,
8
+ } from "@vnejs/contracts.logics.vars.flags";
9
+
10
+ export type PluginEvents = ModuleCoreEvents & Record<TextInjectPluginName, TextInjectSubscribeEvents> & Record<VarsFlagsPluginName, VarsFlagsSubscribeEvents>;
11
+
12
+ export type PluginConstants = ModuleCoreConstants & Record<VarsFlagsPluginName, VarsFlagsConstants>;
13
+
14
+ export type PluginSettings = ModuleCoreSettings;
15
+
16
+ export type PluginParams = ModuleCoreParams;
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["dist", "node_modules", "src/tests"]
9
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.