floating-live 0.16.0-beta.2 → 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.
Files changed (45) hide show
  1. package/dist/FloatingLive.d.ts +4 -4
  2. package/dist/FloatingLive.js +2 -2
  3. package/dist/app.d.ts +12 -12
  4. package/dist/app.js +6 -6
  5. package/dist/command/index.d.ts +1 -1
  6. package/dist/command/index.js +1 -1
  7. package/dist/command/manager.d.ts +3 -3
  8. package/dist/command/manager.js +3 -3
  9. package/dist/command/types.d.ts +1 -1
  10. package/dist/error/index.d.ts +2 -2
  11. package/dist/error/index.js +1 -1
  12. package/dist/event/index.d.ts +1 -1
  13. package/dist/event/index.js +1 -1
  14. package/dist/event/manager.d.ts +1 -1
  15. package/dist/hook/index.d.ts +1 -1
  16. package/dist/hook/index.js +1 -1
  17. package/dist/hook/manager.d.ts +3 -3
  18. package/dist/hook/manager.js +3 -3
  19. package/dist/index.d.ts +10 -10
  20. package/dist/index.js +10 -10
  21. package/dist/live/index.d.ts +4 -4
  22. package/dist/live/index.js +4 -4
  23. package/dist/live/message.d.ts +2 -2
  24. package/dist/live/messageInfo.d.ts +1 -1
  25. package/dist/live/room.d.ts +4 -4
  26. package/dist/live/room.js +1 -1
  27. package/dist/plugin/context/CommonPluginContext.d.ts +7 -7
  28. package/dist/plugin/context/CommonPluginContext.js +1 -1
  29. package/dist/plugin/context/CorePluginContext.d.ts +2 -2
  30. package/dist/plugin/context/CorePluginContext.js +1 -1
  31. package/dist/plugin/context/SafePluginContext.d.ts +6 -6
  32. package/dist/plugin/context/SafePluginContext.js +2 -2
  33. package/dist/plugin/index.d.ts +3 -3
  34. package/dist/plugin/index.js +1 -1
  35. package/dist/plugin/manager.d.ts +3 -3
  36. package/dist/plugin/manager.js +6 -6
  37. package/dist/plugin/types.d.ts +6 -6
  38. package/dist/plugins/room/index.d.ts +6 -6
  39. package/dist/plugins/room/index.js +5 -5
  40. package/dist/utils/index.d.ts +1 -1
  41. package/dist/value/index.d.ts +1 -1
  42. package/dist/value/index.js +1 -1
  43. package/dist/value/manager.d.ts +3 -3
  44. package/dist/value/manager.js +4 -4
  45. package/package.json +5 -4
@@ -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
  /** 打开房间连接 */
@@ -1,5 +1,5 @@
1
- import { App } from "./app";
2
- import { Room } from "./plugins/room";
1
+ import { App } from "./app.js";
2
+ import { Room } from "./plugins/room/index.js";
3
3
  export class FloatingLive extends App {
4
4
  constructor() {
5
5
  super();
package/dist/app.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { CommandOptions, CommandCallOptions, AppCommandMap, CommandFunction } from "./command";
2
- import { CommandManager } from "./command/manager";
3
- import { AppError } from "./error";
4
- import { AppEventDetailMap, AppEventEmitOptions, AppEventListener } from "./event";
5
- import { AppHookMap, HookCallOptions, HookContext, HookFunction, HookUseOptions } from "./hook";
6
- import { HookManager } from "./hook/manager";
7
- import { AppPluginExposesMap, PluginConstructor, PluginContext, PluginInitOptions, PluginItem } from "./plugin";
8
- import { PluginManager } from "./plugin/manager";
9
- import { CustomEventEmitter } from "./utils/EventEmitter";
10
- import { AppValueMap, ValueOptions } from "./value";
11
- import { ValueManager } from "./value/manager";
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";
12
12
  export declare class App extends CustomEventEmitter implements PluginContext {
13
13
  protected hookManager: HookManager;
14
14
  protected pluginManager: PluginManager;
@@ -43,7 +43,7 @@ export declare class App extends CustomEventEmitter implements PluginContext {
43
43
  unuseHook<T extends keyof AppHookMap>(name: T, func: HookFunction<AppHookMap[T]>): void;
44
44
  callHook<T extends keyof AppHookMap>(name: T, ctx: AppHookMap[T], options?: HookCallOptions): Promise<HookContext<AppHookMap[T]>>;
45
45
  callHookSync<T extends keyof AppHookMap>(name: T, ctx: AppHookMap[T], options?: HookCallOptions): HookContext<AppHookMap[T]>;
46
- 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]>;
47
47
  unregisterValue(name: string): void;
48
48
  watch<K extends keyof AppValueMap>(name: K, watcher: (value: AppValueMap[K]) => void): void;
49
49
  unwatch<K extends keyof AppValueMap>(name: K, watcher: (value: AppValueMap[K]) => void): 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();
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.js";
@@ -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
- getSnapshot(): {
19
+ toSnapshot(): {
20
20
  name: string;
21
21
  pluginName: string | undefined;
22
22
  }[];
@@ -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.getSnapshot());
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
- getSnapshot() {
42
+ toSnapshot() {
43
43
  return [...this.list].map(([name, { pluginName }]) => ({
44
44
  name,
45
45
  pluginName,
@@ -1,4 +1,4 @@
1
- import { AppValueMap } from "../value";
1
+ import { AppValueMap } from "../value/index.js";
2
2
  export interface CommandOptions {
3
3
  pluginName?: string;
4
4
  }
@@ -1,5 +1,5 @@
1
- import { ErrorOptions } from "./types";
2
- export * from "./types";
1
+ import { ErrorOptions } from "./types.js";
2
+ export * from "./types.js";
3
3
  export declare class AppError extends Error {
4
4
  /** 错误id */
5
5
  id: string;
@@ -1,4 +1,4 @@
1
- export * from "./types";
1
+ export * from "./types.js";
2
2
  export class AppError extends Error {
3
3
  constructor(id, options) {
4
4
  super(options.message);
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.js";
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.js";
@@ -1,4 +1,4 @@
1
- import { App } from "../app";
1
+ import { App } from "../app.js";
2
2
  export declare class EventManager {
3
3
  constructor(app: App);
4
4
  private registerMap;
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.js";
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.js";
@@ -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
- getSnapshot(): {
16
+ toSnapshot(): {
17
17
  name: string;
18
18
  list: {
19
19
  pluginName?: string;
@@ -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.getSnapshot());
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
- getSnapshot() {
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";
@@ -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";
@@ -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";
@@ -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
  /** 平台名称 */
@@ -1,4 +1,4 @@
1
- import { EnumValue } from "../utils/types";
1
+ import { EnumValue } from "../utils/types.js";
2
2
  /** 用户信息 */
3
3
  export interface UserInfo {
4
4
  /** 用户名 */
@@ -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,4 +1,4 @@
1
- import { CustomEventEmitter } from "../utils/EventEmitter";
1
+ import { CustomEventEmitter } from "../utils/EventEmitter.js";
2
2
  /** 直播间信息流监听类 */
3
3
  export class LiveRoom extends CustomEventEmitter {
4
4
  constructor() {
@@ -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;
@@ -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;
@@ -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;
@@ -1,4 +1,4 @@
1
- import { AppError } from "../error";
1
+ import { AppError } from "../error/index.js";
2
2
  export class BasePlugin {
3
3
  constructor(ctx, options) {
4
4
  this.Error = AppError;
@@ -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
- getSnapshot(): {
24
+ toSnapshot(): {
25
25
  pluginName: string;
26
26
  }[];
27
27
  }
@@ -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.getSnapshot, 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
- getSnapshot() {
154
+ toSnapshot() {
155
155
  return [...this.list.keys()].map((n) => ({ pluginName: n }));
156
156
  }
157
157
  }
@@ -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
- getSnapshot(): LiveRoomData[];
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.getSnapshot, 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
- getSnapshot() {
206
+ toSnapshot() {
207
207
  return this.getList().map((room) => room.toData());
208
208
  }
209
209
  }
@@ -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>;
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.js";
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.js";
@@ -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
- getSnapshot(): {
23
+ toSnapshot(): {
24
24
  name: string;
25
25
  value: string;
26
26
  }[];
@@ -1,10 +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("value.snapshot", bindCommand(this.getSnapshot, this));
7
+ app.registerCommand("value.snapshot", bindCommand(this.toSnapshot, this));
8
8
  }
9
9
  /** 注册值 */
10
10
  register(name, { get, set, pluginName }) {
@@ -60,7 +60,7 @@ export class ValueManager {
60
60
  this.app.off(`change:${name}`, listener);
61
61
  }
62
62
  /** 获取注册的所有值 */
63
- getSnapshot() {
63
+ toSnapshot() {
64
64
  return [...this.list].map(([name, config]) => ({
65
65
  name,
66
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.2",
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
  }