@dan-uni/dan-any 1.1.1 → 1.2.2

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 (50) hide show
  1. package/dist/browser/157.min.js +20 -4
  2. package/dist/browser/17.min.js +13289 -0
  3. package/dist/browser/898.min.js +10 -0
  4. package/dist/browser/index.min.js +1 -13248
  5. package/dist/browser/plugins/bili-dedupe.min.js +1 -1
  6. package/dist/browser/plugins/index.min.js +1 -0
  7. package/dist/browser/plugins/stats.min.js +1 -0
  8. package/dist/browser/src/index.d.ts +4 -4
  9. package/dist/browser/src/plugins/bili-dedupe/index.d.ts +3 -5
  10. package/dist/browser/src/plugins/index.d.ts +2 -2
  11. package/dist/browser/src/plugins/stats/getLatestDan.d.ts +6 -0
  12. package/dist/browser/src/plugins/stats/index.d.ts +1 -0
  13. package/dist/browser/src/plugins/stats/index.test.d.ts +1 -0
  14. package/dist/node/157.js +20 -4
  15. package/dist/node/17.js +1864 -0
  16. package/dist/node/898.js +10 -0
  17. package/dist/node/index.js +1 -1823
  18. package/dist/node/plugins/bili-dedupe.js +1 -1
  19. package/dist/node/plugins/index.js +1 -0
  20. package/dist/node/plugins/stats.js +1 -0
  21. package/dist/node/src/index.d.ts +4 -4
  22. package/dist/node/src/plugins/bili-dedupe/index.d.ts +3 -5
  23. package/dist/node/src/plugins/index.d.ts +2 -2
  24. package/dist/node/src/plugins/stats/getLatestDan.d.ts +6 -0
  25. package/dist/node/src/plugins/stats/index.d.ts +1 -0
  26. package/dist/node/src/plugins/stats/index.test.d.ts +1 -0
  27. package/dist/umd/index.umd.min.js +65 -62
  28. package/dist/umd/plugins/bili-dedupe.umd.min.js +24997 -48
  29. package/dist/umd/plugins/bili-dedupe.umd.min.js.LICENSE.txt +34 -0
  30. package/dist/umd/plugins/index.umd.min.js +24971 -21
  31. package/dist/umd/plugins/index.umd.min.js.LICENSE.txt +34 -0
  32. package/dist/umd/plugins/stats.umd.min.js +39 -0
  33. package/dist/umd/src/index.d.ts +4 -4
  34. package/dist/umd/src/plugins/bili-dedupe/index.d.ts +3 -5
  35. package/dist/umd/src/plugins/index.d.ts +2 -2
  36. package/dist/umd/src/plugins/stats/getLatestDan.d.ts +6 -0
  37. package/dist/umd/src/plugins/stats/index.d.ts +1 -0
  38. package/dist/umd/src/plugins/stats/index.test.d.ts +1 -0
  39. package/package.json +1 -1
  40. package/rslib.config.ts +1 -0
  41. package/src/index.ts +8 -4
  42. package/src/plugins/bili-dedupe/index.test.ts +5 -2
  43. package/src/plugins/bili-dedupe/index.ts +13 -3
  44. package/src/plugins/index.ts +2 -3
  45. package/src/plugins/stats/getLatestDan.ts +13 -0
  46. package/src/plugins/stats/index.test.ts +39 -0
  47. package/src/plugins/stats/index.ts +1 -0
  48. package/dist/browser/42.min.js +0 -45
  49. package/dist/node/42.js +0 -45
  50. /package/dist/browser/{index.min.js.LICENSE.txt → 17.min.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- export { bili_dedupe as default } from "../157.min.js";
1
+ export { bili_dedupe_0 as bili_dedupe, to_bili_deduped } from "../157.min.js";
@@ -1 +1,2 @@
1
1
  export { bili_dedupe } from "../157.min.js";
2
+ export { stats } from "../898.min.js";
@@ -0,0 +1 @@
1
+ export { getLatestDan } from "../898.min.js";
@@ -120,8 +120,8 @@ export type DM_format = 'danuni.json' | 'danuni.pb.bin' | 'bili.xml' | 'bili.pb.
120
120
  type shareItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'senderID' | 'platform' | 'SOID' | 'pool' | 'mode' | 'color'>>;
121
121
  type statItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'mode' | 'fontsize' | 'color' | 'senderID' | 'content' | 'weight' | 'pool' | 'platform'>>;
122
122
  type Stats<T extends keyof statItems> = Map<statItems[T], number>;
123
- type UniPoolPipe = (that: UniPool) => Promise<UniPool>;
124
- type UniPoolPipeSync = (that: UniPool) => UniPool;
123
+ type UniPoolPipe = (that: UniPool) => Promise<any>;
124
+ type UniPoolPipeSync = (that: UniPool) => any;
125
125
  export interface Options {
126
126
  dedupe?: boolean;
127
127
  /**
@@ -145,8 +145,8 @@ export declare class UniPool {
145
145
  */
146
146
  fromConverted: boolean;
147
147
  });
148
- pipe(fn: UniPoolPipe): Promise<UniPool>;
149
- pipeSync(fn: UniPoolPipeSync): UniPool;
148
+ pipe<T extends (...args: any) => any = UniPoolPipe>(fn: T): Promise<ReturnType<T>>;
149
+ pipeSync<T extends (...args: any) => any = UniPoolPipeSync>(fn: T): ReturnType<T>;
150
150
  /**
151
151
  * @deprecated 使用 `getShared` 代替
152
152
  */
@@ -1,5 +1,3 @@
1
- import type { UniPool } from '../..';
2
- /**
3
- * 用于过滤直接从B站api获取到的弹幕中去除dmid重复的弹幕
4
- */
5
- export default function bili_dedupe(that: UniPool): UniPool;
1
+ import { UniPool } from '../..';
2
+ export declare function to_bili_deduped(that: UniPool): UniPool;
3
+ export declare function bili_dedupe(that: UniPool): void;
@@ -1,2 +1,2 @@
1
- import bili_dedupe from './bili-dedupe';
2
- export { bili_dedupe };
1
+ export * as bili_dedupe from './bili-dedupe';
2
+ export * as stats from './stats';
@@ -0,0 +1,6 @@
1
+ import type { UniDM, UniPool } from '../..';
2
+ /**
3
+ * 从弹幕池中查找出最新的一条弹幕
4
+ * 按照弹幕的创建时间(ctime)排序,返回最新的一条
5
+ */
6
+ export default function getLatestDan(that: UniPool): UniDM | null;
@@ -0,0 +1 @@
1
+ export { default as getLatestDan } from './getLatestDan';
@@ -0,0 +1 @@
1
+ export {};
package/dist/node/157.js CHANGED
@@ -1,14 +1,30 @@
1
- import { platform_PlatformVideoSource } from "./42.js";
2
- function bili_dedupe(that) {
1
+ import { __webpack_require__ } from "./rslib-runtime.js";
2
+ import { UniPool, platform_PlatformVideoSource } from "./17.js";
3
+ var bili_dedupe_namespaceObject = {};
4
+ __webpack_require__.r(bili_dedupe_namespaceObject);
5
+ __webpack_require__.d(bili_dedupe_namespaceObject, {
6
+ bili_dedupe: ()=>bili_dedupe,
7
+ to_bili_deduped: ()=>to_bili_deduped
8
+ });
9
+ function main(that) {
3
10
  that.dans.forEach((d)=>{
4
11
  if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
5
12
  if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
6
13
  });
7
14
  const map = new Map();
8
15
  that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
16
+ return map;
17
+ }
18
+ function to_bili_deduped(that) {
19
+ const map = main(that);
20
+ return new UniPool([
21
+ ...map.values()
22
+ ], that.options, that.info);
23
+ }
24
+ function bili_dedupe(that) {
25
+ const map = main(that);
9
26
  that.dans = [
10
27
  ...map.values()
11
28
  ];
12
- return that;
13
29
  }
14
- export { bili_dedupe };
30
+ export { bili_dedupe as bili_dedupe_0, bili_dedupe_namespaceObject as bili_dedupe, to_bili_deduped };