floating-live 0.16.0-beta.0 → 0.16.0-beta.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/FloatingLive.d.ts +4 -4
- package/dist/FloatingLive.js +2 -2
- package/dist/app.d.ts +18 -14
- package/dist/app.js +10 -7
- package/dist/command/index.d.ts +1 -1
- package/dist/command/index.js +1 -1
- package/dist/command/manager.d.ts +3 -3
- package/dist/command/manager.js +3 -3
- package/dist/command/types.d.ts +1 -1
- package/dist/error/index.d.ts +2 -2
- package/dist/error/index.js +1 -1
- package/dist/event/index.d.ts +1 -1
- package/dist/event/index.js +1 -1
- package/dist/event/manager.d.ts +1 -1
- package/dist/hook/index.d.ts +1 -1
- package/dist/hook/index.js +1 -1
- package/dist/hook/manager.d.ts +3 -3
- package/dist/hook/manager.js +3 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/live/index.d.ts +4 -4
- package/dist/live/index.js +4 -4
- package/dist/live/message.d.ts +2 -2
- package/dist/live/messageInfo.d.ts +1 -1
- package/dist/live/room.d.ts +4 -4
- package/dist/live/room.js +1 -1
- package/dist/plugin/context/CommonPluginContext.d.ts +8 -8
- package/dist/plugin/context/CommonPluginContext.js +1 -1
- package/dist/plugin/context/CorePluginContext.d.ts +2 -2
- package/dist/plugin/context/CorePluginContext.js +1 -1
- package/dist/plugin/context/SafePluginContext.d.ts +6 -6
- package/dist/plugin/context/SafePluginContext.js +2 -2
- package/dist/plugin/index.d.ts +3 -3
- package/dist/plugin/index.js +1 -1
- package/dist/plugin/manager.d.ts +3 -3
- package/dist/plugin/manager.js +6 -6
- package/dist/plugin/types.d.ts +6 -6
- package/dist/plugins/room/index.d.ts +6 -6
- package/dist/plugins/room/index.js +5 -5
- package/dist/utils/index.d.ts +1 -1
- package/dist/value/index.d.ts +1 -1
- package/dist/value/index.js +1 -1
- package/dist/value/manager.d.ts +3 -3
- package/dist/value/manager.js +4 -6
- package/package.json +5 -4
package/dist/FloatingLive.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LiveRoom } from ".";
|
|
2
|
-
import { App } from "./app";
|
|
3
|
-
import { Room } from "./plugins/room";
|
|
1
|
+
import { LiveRoom } from "./index.js";
|
|
2
|
+
import { App } from "./app.js";
|
|
3
|
+
import { Room } from "./plugins/room/index.js";
|
|
4
4
|
export declare class FloatingLive extends App {
|
|
5
5
|
room: Room;
|
|
6
6
|
constructor();
|
|
@@ -12,7 +12,7 @@ export declare class FloatingLive extends App {
|
|
|
12
12
|
get(key: string): LiveRoom | undefined;
|
|
13
13
|
has(key: string): boolean;
|
|
14
14
|
/** 获取房间信息 */
|
|
15
|
-
data(key: string): import("./live").LiveRoomData | undefined;
|
|
15
|
+
data(key: string): import("./live/index.js").LiveRoomData | undefined;
|
|
16
16
|
/** 更新房间信息 */
|
|
17
17
|
update(key: string): void;
|
|
18
18
|
/** 打开房间连接 */
|
package/dist/FloatingLive.js
CHANGED
package/dist/app.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { CommandOptions, CommandCallOptions, AppCommandMap, CommandFunction } from "./command";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { CommandOptions, CommandCallOptions, AppCommandMap, CommandFunction } from "./command/index.js";
|
|
2
|
+
import { CommandManager } from "./command/manager.js";
|
|
3
|
+
import { AppError } from "./error/index.js";
|
|
4
|
+
import { AppEventDetailMap, AppEventEmitOptions, AppEventListener } from "./event/index.js";
|
|
5
|
+
import { AppHookMap, HookCallOptions, HookContext, HookFunction, HookUseOptions } from "./hook/index.js";
|
|
6
|
+
import { HookManager } from "./hook/manager.js";
|
|
7
|
+
import { AppPluginExposesMap, PluginConstructor, PluginContext, PluginInitOptions, PluginItem } from "./plugin/index.js";
|
|
8
|
+
import { PluginManager } from "./plugin/manager.js";
|
|
9
|
+
import { CustomEventEmitter } from "./utils/EventEmitter.js";
|
|
10
|
+
import { AppValueMap, ValueOptions } from "./value/index.js";
|
|
11
|
+
import { ValueManager } from "./value/manager.js";
|
|
8
12
|
export declare class App extends CustomEventEmitter implements PluginContext {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
protected hookManager: HookManager;
|
|
14
|
+
protected pluginManager: PluginManager;
|
|
15
|
+
protected commandManager: CommandManager;
|
|
16
|
+
protected valueManager: ValueManager;
|
|
17
|
+
protected abortController: AbortController;
|
|
14
18
|
constructor();
|
|
15
19
|
on<K extends keyof AppEventDetailMap>(type: K, listener: AppEventListener<AppEventDetailMap[K]>, signal?: AbortSignal): void;
|
|
16
20
|
once<K extends keyof AppEventDetailMap>(type: K, listener: AppEventListener<AppEventDetailMap[K]>, signal?: AbortSignal): void;
|
|
@@ -39,13 +43,13 @@ export declare class App extends CustomEventEmitter implements PluginContext {
|
|
|
39
43
|
unuseHook<T extends keyof AppHookMap>(name: T, func: HookFunction<AppHookMap[T]>): void;
|
|
40
44
|
callHook<T extends keyof AppHookMap>(name: T, ctx: AppHookMap[T], options?: HookCallOptions): Promise<HookContext<AppHookMap[T]>>;
|
|
41
45
|
callHookSync<T extends keyof AppHookMap>(name: T, ctx: AppHookMap[T], options?: HookCallOptions): HookContext<AppHookMap[T]>;
|
|
42
|
-
registerValue<K extends keyof AppValueMap>(name: K, options: ValueOptions<AppValueMap[K]>): import("./value").ValueContext<AppValueMap[K]>;
|
|
46
|
+
registerValue<K extends keyof AppValueMap>(name: K, options: ValueOptions<AppValueMap[K]>): import("./value/index.js").ValueContext<AppValueMap[K]>;
|
|
43
47
|
unregisterValue(name: string): void;
|
|
44
48
|
watch<K extends keyof AppValueMap>(name: K, watcher: (value: AppValueMap[K]) => void): void;
|
|
45
49
|
unwatch<K extends keyof AppValueMap>(name: K, watcher: (value: AppValueMap[K]) => void): void;
|
|
46
50
|
hasValue(name: string): boolean;
|
|
47
51
|
getValue<K extends keyof AppValueMap>(name: K): AppValueMap[K];
|
|
48
|
-
setValue(name: string, value: any):
|
|
52
|
+
setValue(name: string, value: any): boolean;
|
|
49
53
|
destroy(): void;
|
|
50
54
|
/** 拓展值 */
|
|
51
55
|
define(key: string, value: ((...args: any[]) => any) | PropertyDescriptor): void;
|
package/dist/app.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CommandManager } from "./command/manager";
|
|
2
|
-
import { AppError } from "./error";
|
|
3
|
-
import { HookManager } from "./hook/manager";
|
|
4
|
-
import { PluginManager } from "./plugin/manager";
|
|
5
|
-
import { CustomEventEmitter } from "./utils/EventEmitter";
|
|
6
|
-
import { ValueManager } from "./value/manager";
|
|
1
|
+
import { CommandManager } from "./command/manager.js";
|
|
2
|
+
import { AppError } from "./error/index.js";
|
|
3
|
+
import { HookManager } from "./hook/manager.js";
|
|
4
|
+
import { PluginManager } from "./plugin/manager.js";
|
|
5
|
+
import { CustomEventEmitter } from "./utils/EventEmitter.js";
|
|
6
|
+
import { ValueManager } from "./value/manager.js";
|
|
7
7
|
export class App extends CustomEventEmitter {
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
@@ -12,6 +12,9 @@ export class App extends CustomEventEmitter {
|
|
|
12
12
|
this.hookManager = new HookManager(this);
|
|
13
13
|
this.valueManager = new ValueManager(this);
|
|
14
14
|
this.pluginManager = new PluginManager(this);
|
|
15
|
+
// 初始化命令
|
|
16
|
+
this.registerCommand("get", (e, name) => this.getValue(name));
|
|
17
|
+
this.registerCommand("set", (e, name, value) => this.setValue(name, value));
|
|
15
18
|
}
|
|
16
19
|
on(type, listener, signal = this.signal) {
|
|
17
20
|
super.on(type, listener, signal);
|
|
@@ -129,7 +132,7 @@ export class App extends CustomEventEmitter {
|
|
|
129
132
|
return this.valueManager.get(name);
|
|
130
133
|
}
|
|
131
134
|
setValue(name, value) {
|
|
132
|
-
this.valueManager.set(name, value);
|
|
135
|
+
return this.valueManager.set(name, value);
|
|
133
136
|
}
|
|
134
137
|
destroy() {
|
|
135
138
|
this.abortController.abort();
|
package/dist/command/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
package/dist/command/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { App } from "../app";
|
|
2
|
-
import { CommandFunction, CommandCallOptions, CommandOptions } from "./types";
|
|
1
|
+
import { App } from "../app.js";
|
|
2
|
+
import { CommandFunction, CommandCallOptions, CommandOptions } from "./types.js";
|
|
3
3
|
export declare class CommandManager {
|
|
4
4
|
/** 功能列表 */
|
|
5
5
|
private readonly list;
|
|
@@ -16,7 +16,7 @@ export declare class CommandManager {
|
|
|
16
16
|
/** 检测命令是否存在 */
|
|
17
17
|
has(name: string): boolean;
|
|
18
18
|
/** 获取数据 */
|
|
19
|
-
|
|
19
|
+
toSnapshot(): {
|
|
20
20
|
name: string;
|
|
21
21
|
pluginName: string | undefined;
|
|
22
22
|
}[];
|
package/dist/command/manager.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AppError } from "../error";
|
|
1
|
+
import { AppError } from "../error/index.js";
|
|
2
2
|
export class CommandManager {
|
|
3
3
|
constructor(app) {
|
|
4
4
|
/** 功能列表 */
|
|
5
5
|
this.list = new Map();
|
|
6
6
|
this.app = app;
|
|
7
|
-
app.registerCommand("command.snapshot", () => this.
|
|
7
|
+
app.registerCommand("command.snapshot", () => this.toSnapshot());
|
|
8
8
|
}
|
|
9
9
|
/** 注册命令 */
|
|
10
10
|
register(name, call, options) {
|
|
@@ -39,7 +39,7 @@ export class CommandManager {
|
|
|
39
39
|
return this.list.has(name);
|
|
40
40
|
}
|
|
41
41
|
/** 获取数据 */
|
|
42
|
-
|
|
42
|
+
toSnapshot() {
|
|
43
43
|
return [...this.list].map(([name, { pluginName }]) => ({
|
|
44
44
|
name,
|
|
45
45
|
pluginName,
|
package/dist/command/types.d.ts
CHANGED
package/dist/error/index.d.ts
CHANGED
package/dist/error/index.js
CHANGED
package/dist/event/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
package/dist/event/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
package/dist/event/manager.d.ts
CHANGED
package/dist/hook/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
package/dist/hook/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
package/dist/hook/manager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { App } from "../app";
|
|
2
|
-
import { HookFunction, HookUseOptions } from "./types";
|
|
1
|
+
import { App } from "../app.js";
|
|
2
|
+
import { HookFunction, HookUseOptions } from "./types.js";
|
|
3
3
|
export declare class HookManager {
|
|
4
4
|
private list;
|
|
5
5
|
private pluginMap;
|
|
@@ -13,7 +13,7 @@ export declare class HookManager {
|
|
|
13
13
|
call(name: string, ctx: any): Promise<any>;
|
|
14
14
|
/** 同步调用钩子函数 */
|
|
15
15
|
callSync(name: string, ctx: any): any;
|
|
16
|
-
|
|
16
|
+
toSnapshot(): {
|
|
17
17
|
name: string;
|
|
18
18
|
list: {
|
|
19
19
|
pluginName?: string;
|
package/dist/hook/manager.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AppError } from "../error";
|
|
1
|
+
import { AppError } from "../error/index.js";
|
|
2
2
|
export class HookManager {
|
|
3
3
|
constructor(app) {
|
|
4
4
|
this.list = new Map();
|
|
5
5
|
this.pluginMap = new Map();
|
|
6
6
|
this.app = app;
|
|
7
|
-
app.registerCommand("hook.snapshot", () => this.
|
|
7
|
+
app.registerCommand("hook.snapshot", () => this.toSnapshot());
|
|
8
8
|
}
|
|
9
9
|
/** 挂载钩子函数 */
|
|
10
10
|
use(name, call, options) {
|
|
@@ -63,7 +63,7 @@ export class HookManager {
|
|
|
63
63
|
}
|
|
64
64
|
return ctx;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
toSnapshot() {
|
|
67
67
|
return [...this.list].map(([name, fnList]) => ({
|
|
68
68
|
name,
|
|
69
69
|
list: fnList.map(({ pluginName }) => ({ pluginName })),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from "./app";
|
|
2
|
-
export * from "./value";
|
|
3
|
-
export * from "./plugin";
|
|
4
|
-
export * from "./hook";
|
|
5
|
-
export * from "./event";
|
|
6
|
-
export * from "./error";
|
|
7
|
-
export * from "./command";
|
|
8
|
-
export * from "./live";
|
|
9
|
-
export * from "./plugins/room";
|
|
10
|
-
export * from "./FloatingLive";
|
|
1
|
+
export * from "./app.js";
|
|
2
|
+
export * from "./value/index.js";
|
|
3
|
+
export * from "./plugin/index.js";
|
|
4
|
+
export * from "./hook/index.js";
|
|
5
|
+
export * from "./event/index.js";
|
|
6
|
+
export * from "./error/index.js";
|
|
7
|
+
export * from "./command/index.js";
|
|
8
|
+
export * from "./live/index.js";
|
|
9
|
+
export * from "./plugins/room/index.js";
|
|
10
|
+
export * from "./FloatingLive.js";
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from "./app";
|
|
2
|
-
export * from "./value";
|
|
3
|
-
export * from "./plugin";
|
|
4
|
-
export * from "./hook";
|
|
5
|
-
export * from "./event";
|
|
6
|
-
export * from "./error";
|
|
7
|
-
export * from "./command";
|
|
8
|
-
export * from "./live";
|
|
9
|
-
export * from "./plugins/room";
|
|
10
|
-
export * from "./FloatingLive";
|
|
1
|
+
export * from "./app.js";
|
|
2
|
+
export * from "./value/index.js";
|
|
3
|
+
export * from "./plugin/index.js";
|
|
4
|
+
export * from "./hook/index.js";
|
|
5
|
+
export * from "./event/index.js";
|
|
6
|
+
export * from "./error/index.js";
|
|
7
|
+
export * from "./command/index.js";
|
|
8
|
+
export * from "./live/index.js";
|
|
9
|
+
export * from "./plugins/room/index.js";
|
|
10
|
+
export * from "./FloatingLive.js";
|
package/dist/live/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./message";
|
|
2
|
-
export * from "./messageInfo";
|
|
3
|
-
export * from "./platform";
|
|
4
|
-
export * from "./room";
|
|
1
|
+
export * from "./message.js";
|
|
2
|
+
export * from "./messageInfo.js";
|
|
3
|
+
export * from "./platform.js";
|
|
4
|
+
export * from "./room.js";
|
package/dist/live/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./message";
|
|
2
|
-
export * from "./messageInfo";
|
|
3
|
-
export * from "./platform";
|
|
4
|
-
export * from "./room";
|
|
1
|
+
export * from "./message.js";
|
|
2
|
+
export * from "./messageInfo.js";
|
|
3
|
+
export * from "./platform.js";
|
|
4
|
+
export * from "./room.js";
|
package/dist/live/message.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DanmakuMode, UserInfo, ImageInfo, GiftInfo, UserType } from "./messageInfo";
|
|
2
|
-
import { LiveRoomStatus, LiveRoomStatsInfo, LiveRoomDetailInfo } from "./room";
|
|
1
|
+
import { DanmakuMode, UserInfo, ImageInfo, GiftInfo, UserType } from "./messageInfo.js";
|
|
2
|
+
import { LiveRoomStatus, LiveRoomStatsInfo, LiveRoomDetailInfo } from "./room.js";
|
|
3
3
|
export declare namespace LiveMessage {
|
|
4
4
|
interface Base {
|
|
5
5
|
/** 平台名称 */
|
package/dist/live/room.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CustomEventEmitter } from "../utils/EventEmitter";
|
|
2
|
-
import { EnumValue } from "../utils/types";
|
|
3
|
-
import { LiveMessage } from "./message";
|
|
4
|
-
import { UserInfo } from "./messageInfo";
|
|
1
|
+
import { CustomEventEmitter } from "../utils/EventEmitter.js";
|
|
2
|
+
import { EnumValue } from "../utils/types.js";
|
|
3
|
+
import { LiveMessage } from "./message.js";
|
|
4
|
+
import { UserInfo } from "./messageInfo.js";
|
|
5
5
|
/** 直播间信息流监听类 */
|
|
6
6
|
export declare abstract class LiveRoom extends CustomEventEmitter implements LiveRoomData {
|
|
7
7
|
constructor();
|
package/dist/live/room.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { App } from "../../app";
|
|
2
|
-
import type { CommandOptions, CommandCallOptions, CommandFunction, AppCommandMap } from "../../command";
|
|
3
|
-
import { AppError, ErrorOptions } from "../../error";
|
|
4
|
-
import { AppEventListener, AppEventEmitOptions, AppEventDetailMap } from "../../event";
|
|
5
|
-
import { HookUseOptions, HookCallOptions, AppHookMap, HookFunction, HookContext } from "../../hook";
|
|
6
|
-
import { AppValueMap, ValueContext, ValueOptions } from "../../value";
|
|
7
|
-
import type { PluginContext, PluginConstructor, PluginInitOptions, AppPluginExposesMap, PluginItem } from "../types";
|
|
1
|
+
import { App } from "../../app.js";
|
|
2
|
+
import type { CommandOptions, CommandCallOptions, CommandFunction, AppCommandMap } from "../../command/index.js";
|
|
3
|
+
import { AppError, ErrorOptions } from "../../error/index.js";
|
|
4
|
+
import { AppEventListener, AppEventEmitOptions, AppEventDetailMap } from "../../event/index.js";
|
|
5
|
+
import { HookUseOptions, HookCallOptions, AppHookMap, HookFunction, HookContext } from "../../hook/index.js";
|
|
6
|
+
import { AppValueMap, ValueContext, ValueOptions } from "../../value/index.js";
|
|
7
|
+
import type { PluginContext, PluginConstructor, PluginInitOptions, AppPluginExposesMap, PluginItem } from "../types.js";
|
|
8
8
|
export declare class CommonPluginContext implements PluginContext {
|
|
9
9
|
#private;
|
|
10
10
|
get safe(): boolean;
|
|
@@ -42,7 +42,7 @@ export declare class CommonPluginContext implements PluginContext {
|
|
|
42
42
|
unwatch<K extends keyof AppValueMap>(name: K, watcher: (value: AppValueMap[K]) => void): void;
|
|
43
43
|
hasValue<K extends keyof AppValueMap>(name: K): boolean;
|
|
44
44
|
getValue<K extends keyof AppValueMap>(name: K): AppValueMap[K];
|
|
45
|
-
setValue<K extends keyof AppValueMap>(name: K, value: AppValueMap[K]):
|
|
45
|
+
setValue<K extends keyof AppValueMap>(name: K, value: AppValueMap[K]): boolean;
|
|
46
46
|
destroy(): void;
|
|
47
47
|
get signal(): AbortSignal;
|
|
48
48
|
}
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _CommonPluginContext_app, _CommonPluginContext_abortController, _CommonPluginContext_registered;
|
|
13
|
-
import { AppError } from "../../error";
|
|
13
|
+
import { AppError } from "../../error/index.js";
|
|
14
14
|
class ListMap extends Map {
|
|
15
15
|
addItem(key, value) {
|
|
16
16
|
const list = this.get(key);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { App } from "
|
|
2
|
-
import { CommonPluginContext } from "./CommonPluginContext";
|
|
1
|
+
import { App } from "../../index.js";
|
|
2
|
+
import { CommonPluginContext } from "./CommonPluginContext.js";
|
|
3
3
|
/** 核心插件,具有对程序的访问权限 */
|
|
4
4
|
export declare class CorePluginContext extends CommonPluginContext {
|
|
5
5
|
#private;
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _CorePluginContext_app;
|
|
13
|
-
import { CommonPluginContext } from "./CommonPluginContext";
|
|
13
|
+
import { CommonPluginContext } from "./CommonPluginContext.js";
|
|
14
14
|
/** 核心插件,具有对程序的访问权限 */
|
|
15
15
|
export class CorePluginContext extends CommonPluginContext {
|
|
16
16
|
constructor(app, pluginName) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { App } from "../../app";
|
|
2
|
-
import { AppCommandMap, CommandCallOptions, CommandFunction, CommandOptions } from "../../command";
|
|
3
|
-
import { AppEventDetailMap, AppEventEmitOptions } from "../../event";
|
|
4
|
-
import { AppHookMap, HookCallOptions, HookContext, HookFunction, HookUseOptions } from "../../hook";
|
|
5
|
-
import { PluginConstructor, PluginItem, PluginInitOptions } from "../types";
|
|
6
|
-
import { CommonPluginContext } from "./CommonPluginContext";
|
|
1
|
+
import { App } from "../../app.js";
|
|
2
|
+
import { AppCommandMap, CommandCallOptions, CommandFunction, CommandOptions } from "../../command/index.js";
|
|
3
|
+
import { AppEventDetailMap, AppEventEmitOptions } from "../../event/index.js";
|
|
4
|
+
import { AppHookMap, HookCallOptions, HookContext, HookFunction, HookUseOptions } from "../../hook/index.js";
|
|
5
|
+
import { PluginConstructor, PluginItem, PluginInitOptions } from "../types.js";
|
|
6
|
+
import { CommonPluginContext } from "./CommonPluginContext.js";
|
|
7
7
|
export interface PluginPermissions {
|
|
8
8
|
"plugin.register"?: boolean;
|
|
9
9
|
"event.emit"?: string[];
|
|
@@ -10,8 +10,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _SafePluginContext_permissions;
|
|
13
|
-
import { AppError } from "../../error";
|
|
14
|
-
import { CommonPluginContext } from "./CommonPluginContext";
|
|
13
|
+
import { AppError } from "../../error/index.js";
|
|
14
|
+
import { CommonPluginContext } from "./CommonPluginContext.js";
|
|
15
15
|
export class SafePluginContext extends CommonPluginContext {
|
|
16
16
|
get safe() {
|
|
17
17
|
return true;
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppError } from "../error";
|
|
2
|
-
import type { PluginItem, PluginContext } from "./types";
|
|
3
|
-
export type * from "./types";
|
|
1
|
+
import { AppError } from "../error/index.js";
|
|
2
|
+
import type { PluginItem, PluginContext } from "./types.js";
|
|
3
|
+
export type * from "./types.js";
|
|
4
4
|
export declare class BasePlugin implements PluginItem {
|
|
5
5
|
static pluginName: string;
|
|
6
6
|
pluginName: string;
|
package/dist/plugin/index.js
CHANGED
package/dist/plugin/manager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { App } from "../app";
|
|
2
|
-
import { PluginItem, PluginConstructor, PluginContext, PluginRegisterOptions } from "./types";
|
|
1
|
+
import type { App } from "../app.js";
|
|
2
|
+
import { PluginItem, PluginConstructor, PluginContext, PluginRegisterOptions } from "./types.js";
|
|
3
3
|
export interface PluginData<T> {
|
|
4
4
|
plugin: PluginItem;
|
|
5
5
|
context: PluginContext;
|
|
@@ -21,7 +21,7 @@ export declare class PluginManager {
|
|
|
21
21
|
has(pluginName: string): boolean;
|
|
22
22
|
getPlugin(pluginName: string): PluginItem | undefined;
|
|
23
23
|
getExposes(pluginName: string): any;
|
|
24
|
-
|
|
24
|
+
toSnapshot(): {
|
|
25
25
|
pluginName: string;
|
|
26
26
|
}[];
|
|
27
27
|
}
|
package/dist/plugin/manager.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CommonPluginContext } from "./context/CommonPluginContext";
|
|
2
|
-
import { AppError } from "../error";
|
|
3
|
-
import { CorePluginContext } from "./context/CorePluginContext";
|
|
4
|
-
import { bindCommand } from "../utils";
|
|
1
|
+
import { CommonPluginContext } from "./context/CommonPluginContext.js";
|
|
2
|
+
import { AppError } from "../error/index.js";
|
|
3
|
+
import { CorePluginContext } from "./context/CorePluginContext.js";
|
|
4
|
+
import { bindCommand } from "../utils/index.js";
|
|
5
5
|
export class PluginManager {
|
|
6
6
|
constructor(app) {
|
|
7
7
|
/** 插件列表 */
|
|
8
8
|
this.list = new Map();
|
|
9
9
|
this.app = app;
|
|
10
|
-
app.registerCommand("plugin.snapshot", bindCommand(this.
|
|
10
|
+
app.registerCommand("plugin.snapshot", bindCommand(this.toSnapshot, this));
|
|
11
11
|
}
|
|
12
12
|
registerSync(pluginConstructor, options = {}, { context, core } = {}) {
|
|
13
13
|
const pluginName = pluginConstructor.pluginName;
|
|
@@ -151,7 +151,7 @@ export class PluginManager {
|
|
|
151
151
|
getExposes(pluginName) {
|
|
152
152
|
return this.list.get(pluginName)?.exposes;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
toSnapshot() {
|
|
155
155
|
return [...this.list.keys()].map((n) => ({ pluginName: n }));
|
|
156
156
|
}
|
|
157
157
|
}
|
package/dist/plugin/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { App } from "../app";
|
|
2
|
-
import { CommandOptions, CommandCallOptions, AppCommandMap, CommandFunction } from "../command";
|
|
3
|
-
import { AppError, ErrorOptions } from "../error";
|
|
4
|
-
import { AppEventListener, AppEventEmitOptions, AppEventDetailMap } from "../event";
|
|
5
|
-
import { AppHookMap, HookCallOptions, HookContext, HookFunction, HookUseOptions } from "../hook";
|
|
6
|
-
import { AppValueMap, ValueContext, ValueOptions } from "../value";
|
|
1
|
+
import { App } from "../app.js";
|
|
2
|
+
import { CommandOptions, CommandCallOptions, AppCommandMap, CommandFunction } from "../command/index.js";
|
|
3
|
+
import { AppError, ErrorOptions } from "../error/index.js";
|
|
4
|
+
import { AppEventListener, AppEventEmitOptions, AppEventDetailMap } from "../event/index.js";
|
|
5
|
+
import { AppHookMap, HookCallOptions, HookContext, HookFunction, HookUseOptions } from "../hook/index.js";
|
|
6
|
+
import { AppValueMap, ValueContext, ValueOptions } from "../value/index.js";
|
|
7
7
|
/** 插件对象 */
|
|
8
8
|
export interface PluginItem {
|
|
9
9
|
pluginName: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LiveMessage } from "../../live/message";
|
|
2
|
-
import { LiveRoom, LiveRoomDetailInfo, LiveRoomData, LiveRoomStatsInfo, LiveRoomStatus } from "../../live/room";
|
|
3
|
-
import { BasePlugin } from "../../plugin";
|
|
4
|
-
import { PluginContext } from "../../plugin/types";
|
|
1
|
+
import { LiveMessage } from "../../live/message.js";
|
|
2
|
+
import { LiveRoom, LiveRoomDetailInfo, LiveRoomData, LiveRoomStatsInfo, LiveRoomStatus } from "../../live/room.js";
|
|
3
|
+
import { BasePlugin } from "../../plugin/index.js";
|
|
4
|
+
import { PluginContext } from "../../plugin/types.js";
|
|
5
5
|
interface PluginExposes {
|
|
6
6
|
add(platform: string, id: number, options?: boolean | Record<string, any>): void;
|
|
7
7
|
remove(key: string): void;
|
|
@@ -13,7 +13,7 @@ interface PluginExposes {
|
|
|
13
13
|
close(key: string): void;
|
|
14
14
|
getList(): LiveRoom[];
|
|
15
15
|
}
|
|
16
|
-
declare module "
|
|
16
|
+
declare module "../../index.js" {
|
|
17
17
|
interface AppCommandMap {
|
|
18
18
|
add: (platform: string, id: number, options?: boolean | Record<string, any>) => void;
|
|
19
19
|
remove: (key: string) => void;
|
|
@@ -131,6 +131,6 @@ export declare class Room extends BasePlugin {
|
|
|
131
131
|
/** 更改某个房间的顺序 */
|
|
132
132
|
move(key: string, position: number): void;
|
|
133
133
|
/** 获取快照 */
|
|
134
|
-
|
|
134
|
+
toSnapshot(): LiveRoomData[];
|
|
135
135
|
}
|
|
136
136
|
export default Room;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppError } from "../../error";
|
|
2
|
-
import { BasePlugin } from "../../plugin";
|
|
3
|
-
import { bindCommand } from "../../utils";
|
|
1
|
+
import { AppError } from "../../error/index.js";
|
|
2
|
+
import { BasePlugin } from "../../plugin/index.js";
|
|
3
|
+
import { bindCommand } from "../../utils/index.js";
|
|
4
4
|
export class Room extends BasePlugin {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
@@ -13,7 +13,7 @@ export class Room extends BasePlugin {
|
|
|
13
13
|
ctx.registerCommand("open", bindCommand(this.open, this));
|
|
14
14
|
ctx.registerCommand("close", bindCommand(this.close, this));
|
|
15
15
|
ctx.registerCommand("update", bindCommand(this.update, this));
|
|
16
|
-
ctx.registerCommand("room.snapshot", bindCommand(this.
|
|
16
|
+
ctx.registerCommand("room.snapshot", bindCommand(this.toSnapshot, this));
|
|
17
17
|
}
|
|
18
18
|
expose() {
|
|
19
19
|
return {
|
|
@@ -203,7 +203,7 @@ export class Room extends BasePlugin {
|
|
|
203
203
|
this.ctx.emit("room:move", { key, position });
|
|
204
204
|
}
|
|
205
205
|
/** 获取快照 */
|
|
206
|
-
|
|
206
|
+
toSnapshot() {
|
|
207
207
|
return this.getList().map((room) => room.toData());
|
|
208
208
|
}
|
|
209
209
|
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CommandContext } from "../command";
|
|
1
|
+
import { CommandContext } from "../command/index.js";
|
|
2
2
|
export declare function bindCommand<T extends (...args: any) => any>(command: T, thisArg: any): (e: CommandContext, ...args: Parameters<T>) => ReturnType<T>;
|
package/dist/value/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
package/dist/value/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./types";
|
|
1
|
+
export * from "./types.js";
|
package/dist/value/manager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { App } from "../app";
|
|
2
|
-
import { ValueAccessOptions, ValueContext, ValueOptions } from "./types";
|
|
1
|
+
import { App } from "../app.js";
|
|
2
|
+
import { ValueAccessOptions, ValueContext, ValueOptions } from "./types.js";
|
|
3
3
|
export declare class ValueManager {
|
|
4
4
|
private list;
|
|
5
5
|
protected readonly app: App;
|
|
@@ -20,7 +20,7 @@ export declare class ValueManager {
|
|
|
20
20
|
watch(name: string, listener: (value: any) => void): void;
|
|
21
21
|
unwatch(name: string, listener: (value: any) => void): void;
|
|
22
22
|
/** 获取注册的所有值 */
|
|
23
|
-
|
|
23
|
+
toSnapshot(): {
|
|
24
24
|
name: string;
|
|
25
25
|
value: string;
|
|
26
26
|
}[];
|
package/dist/value/manager.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { AppError } from "../error";
|
|
2
|
-
import { bindCommand } from "../utils";
|
|
1
|
+
import { AppError } from "../error/index.js";
|
|
2
|
+
import { bindCommand } from "../utils/index.js";
|
|
3
3
|
export class ValueManager {
|
|
4
4
|
constructor(app) {
|
|
5
5
|
this.list = new Map();
|
|
6
6
|
this.app = app;
|
|
7
|
-
app.registerCommand("
|
|
8
|
-
app.registerCommand("set", bindCommand(this.set, this));
|
|
9
|
-
app.registerCommand("value.snapshot", bindCommand(this.getSnapshot, this));
|
|
7
|
+
app.registerCommand("value.snapshot", bindCommand(this.toSnapshot, this));
|
|
10
8
|
}
|
|
11
9
|
/** 注册值 */
|
|
12
10
|
register(name, { get, set, pluginName }) {
|
|
@@ -62,7 +60,7 @@ export class ValueManager {
|
|
|
62
60
|
this.app.off(`change:${name}`, listener);
|
|
63
61
|
}
|
|
64
62
|
/** 获取注册的所有值 */
|
|
65
|
-
|
|
63
|
+
toSnapshot() {
|
|
66
64
|
return [...this.list].map(([name, config]) => ({
|
|
67
65
|
name,
|
|
68
66
|
value: config.get(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "floating-live",
|
|
3
|
-
"version": "0.16.0-beta.
|
|
3
|
+
"version": "0.16.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@types/node": "^22.8.2",
|
|
11
|
-
"typescript": "^5.6.3",
|
|
12
11
|
"rimraf": "^3.0.2",
|
|
13
|
-
"ts-node": "^10.9.1"
|
|
12
|
+
"ts-node": "^10.9.1",
|
|
13
|
+
"tsc-alias": "^1.8.16",
|
|
14
|
+
"typescript": "^5.6.3"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
17
|
"tsc": "tsc -b",
|
|
17
18
|
"clear": "rimraf dist",
|
|
18
|
-
"build": "npm run clear && tsc -b",
|
|
19
|
+
"build": "npm run clear && tsc -b && tsc-alias",
|
|
19
20
|
"prepack": "npm run build",
|
|
20
21
|
"postpack": "npm run clear"
|
|
21
22
|
}
|