@dan-uni/dan-any 0.9.9 → 1.0.1

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,37 @@
1
+ var __webpack_module_cache__ = {};
2
+ function __webpack_require__(moduleId) {
3
+ var cachedModule = __webpack_module_cache__[moduleId];
4
+ if (void 0 !== cachedModule) return cachedModule.exports;
5
+ var module = __webpack_module_cache__[moduleId] = {
6
+ exports: {}
7
+ };
8
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
9
+ return module.exports;
10
+ }
11
+ (()=>{
12
+ __webpack_require__.add = function(modules) {
13
+ Object.assign(__webpack_require__.m, modules);
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.d = (exports, definition)=>{
18
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
19
+ enumerable: true,
20
+ get: definition[key]
21
+ });
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.r = (exports)=>{
29
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
30
+ value: 'Module'
31
+ });
32
+ Object.defineProperty(exports, '__esModule', {
33
+ value: true
34
+ });
35
+ };
36
+ })();
37
+ export { __webpack_require__ };
@@ -0,0 +1,49 @@
1
+ var __webpack_modules__ = {};
2
+ var __webpack_module_cache__ = {};
3
+ function __webpack_require__(moduleId) {
4
+ var cachedModule = __webpack_module_cache__[moduleId];
5
+ if (void 0 !== cachedModule) return cachedModule.exports;
6
+ var module = __webpack_module_cache__[moduleId] = {
7
+ exports: {}
8
+ };
9
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10
+ return module.exports;
11
+ }
12
+ __webpack_require__.m = __webpack_modules__;
13
+ (()=>{
14
+ __webpack_require__.add = function(modules) {
15
+ Object.assign(__webpack_require__.m, modules);
16
+ };
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.d = (exports, definition)=>{
20
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
21
+ enumerable: true,
22
+ get: definition[key]
23
+ });
24
+ };
25
+ })();
26
+ (()=>{
27
+ __webpack_require__.g = (()=>{
28
+ if ('object' == typeof globalThis) return globalThis;
29
+ try {
30
+ return this || new Function('return this')();
31
+ } catch (e) {
32
+ if ('object' == typeof window) return window;
33
+ }
34
+ })();
35
+ })();
36
+ (()=>{
37
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
38
+ })();
39
+ (()=>{
40
+ __webpack_require__.r = (exports)=>{
41
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
42
+ value: 'Module'
43
+ });
44
+ Object.defineProperty(exports, '__esModule', {
45
+ value: true
46
+ });
47
+ };
48
+ })();
49
+ export { __webpack_require__ };
@@ -1,4 +1,4 @@
1
1
  export { decimalColorToRGB, formatColor, getDecoratingColor, hexColorToRGB, isWhite, } from './color';
2
- export { layoutDanmaku } from './layout';
3
- export { arrayOfLength, assign, uniqueArray } from './lang';
4
2
  export { DanmakuList2UniPool, UniPool2DanmakuLists } from './danconvert';
3
+ export { arrayOfLength, assign, uniqueArray } from './lang';
4
+ export { layoutDanmaku } from './layout';
@@ -13,7 +13,7 @@ interface DanUniConvertTip {
13
13
  export interface DM_XML_Bili {
14
14
  i: {
15
15
  chatserver: string;
16
- chatid: number;
16
+ chatid: bigint;
17
17
  mission: number;
18
18
  maxlimit: number;
19
19
  state: number;
@@ -44,15 +44,15 @@ export interface DM_JSON_BiliUp {
44
44
  };
45
45
  result: {
46
46
  /** 弹幕 ID,int64 */
47
- id: number;
47
+ id: bigint;
48
48
  /** 弹幕 ID 字符串形式 */
49
49
  id_str: string;
50
50
  /** 弹幕类型:1 表示视频弹幕(当前接口恒为 1) */
51
51
  type: number;
52
- aid: number;
52
+ aid: bigint;
53
53
  bvid: string;
54
- oid: number;
55
- mid: number;
54
+ oid: bigint;
55
+ mid: bigint;
56
56
  /** 发送者 mid 的 CRC 哈希(正常接口里用的是这个,保护隐私) */
57
57
  mid_hash: string;
58
58
  /** 弹幕池 */
@@ -111,7 +111,7 @@ export interface DM_JSON_Artplayer {
111
111
  export interface DM_JSON_DDPlay {
112
112
  count: number | string;
113
113
  comments: {
114
- cid: number;
114
+ cid: bigint;
115
115
  p: string;
116
116
  m: string;
117
117
  }[];
@@ -119,14 +119,15 @@ export interface DM_JSON_DDPlay {
119
119
  export type DM_format = 'danuni.json' | 'danuni.pb.bin' | 'bili.xml' | 'bili.pb.bin' | 'bili.cmd.pb.bin' | 'bili.up.json' | 'dplayer.json' | 'artplayer.json' | 'ddplay.json' | 'common.ass';
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
- interface Stat {
123
- val: statItems[keyof statItems];
124
- count: number;
125
- }
122
+ type Stats<T extends keyof statItems> = Map<statItems[T], number>;
126
123
  type UniPoolPipe = (that: UniPool) => Promise<UniPool>;
127
124
  type UniPoolPipeSync = (that: UniPool) => UniPool;
128
125
  export interface Options {
129
126
  dedupe?: boolean;
127
+ /**
128
+ * @description
129
+ * 当为`false`时,关闭DMID生成; 当为正整数时,表示生成DMID的截取位数; 或可传入一个DMID生成器实例
130
+ */
130
131
  dmid?: boolean | number | UniIDTools.DMIDGenerator;
131
132
  }
132
133
  export declare class UniPool {
@@ -146,10 +147,19 @@ export declare class UniPool {
146
147
  });
147
148
  pipe(fn: UniPoolPipe): Promise<UniPool>;
148
149
  pipeSync(fn: UniPoolPipeSync): UniPool;
150
+ /**
151
+ * @deprecated 使用 `getShared` 代替
152
+ */
149
153
  get shared(): shareItems;
150
- getShared(key: keyof shareItems): shareItems[keyof shareItems];
151
- getStat(key: keyof statItems): Stat[];
152
- getMost(key: keyof statItems): Stat;
154
+ getShared<K extends keyof shareItems>(key: K): shareItems[K];
155
+ getStat<K extends keyof statItems>(key: K): Stats<K>;
156
+ getMost<K extends keyof statItems>(key: K): {
157
+ val: Partial<Pick<UniDMTools.UniDMObj, "SOID" | "mode" | "fontsize" | "color" | "senderID" | "content" | "weight" | "pool" | "platform">>[K] | undefined;
158
+ count: number;
159
+ };
160
+ /**
161
+ * @deprecated 使用 `getMost` 代替
162
+ */
153
163
  get most(): {
154
164
  mode: UniDMTools.Modes;
155
165
  fontsize: number;
@@ -76,9 +76,9 @@ export type Danmaku = Message<"danuni.danmaku.v1.Danmaku"> & {
76
76
  */
77
77
  attr: string[];
78
78
  /**
79
- * @generated from field: string platform = 13;
79
+ * @generated from field: optional string platform = 13;
80
80
  */
81
- platform: string;
81
+ platform?: string;
82
82
  /**
83
83
  * @generated from field: optional string extra = 14;
84
84
  */
@@ -18,7 +18,7 @@ interface DMBili {
18
18
  mode: number;
19
19
  fontsize: number;
20
20
  color: number;
21
- mid?: number;
21
+ mid?: bigint;
22
22
  midHash: string;
23
23
  /**
24
24
  * 特殊类型解析:
@@ -63,7 +63,7 @@ interface DMArtplayer {
63
63
  style?: object;
64
64
  }
65
65
  interface DMDDplay {
66
- cid: number;
66
+ cid: bigint;
67
67
  /**
68
68
  * content
69
69
  */
@@ -99,7 +99,7 @@ interface ExtraBili {
99
99
  pool?: number;
100
100
  dmid?: bigint;
101
101
  attr?: number;
102
- mid?: number;
102
+ mid?: bigint;
103
103
  adv?: string;
104
104
  code?: string;
105
105
  bas?: string;
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@dan-uni/dan-any",
3
- "version": "0.9.9",
4
- "description": "A danmaku transformer lib, supporting danmaku from different platforms.",
5
3
  "type": "module",
6
- "keywords": [
7
- "bangumi",
8
- "danmaku"
9
- ],
4
+ "version": "1.0.1",
5
+ "description": "A danmaku transformer lib, supporting danmaku from different platforms.",
6
+ "author": "rinne",
10
7
  "license": "LGPL-3.0-or-later",
11
8
  "homepage": "https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme",
12
- "bugs": {
13
- "url": "https://github.com/ani-uni/danuni/issues"
14
- },
15
9
  "repository": {
16
10
  "type": "git",
17
11
  "url": "git+https://github.com/ani-uni/danuni.git"
18
12
  },
19
- "author": "rinne",
13
+ "bugs": {
14
+ "url": "https://github.com/ani-uni/danuni/issues"
15
+ },
16
+ "keywords": [
17
+ "bangumi",
18
+ "danmaku"
19
+ ],
20
20
  "main": "dist/index.js",
21
21
  "module": "dist/index.js",
22
22
  "types": "dist/src/index.d.ts",
@@ -32,24 +32,24 @@
32
32
  "buf": "buf generate"
33
33
  },
34
34
  "dependencies": {
35
- "@bufbuild/protobuf": "^2.9.0",
35
+ "@bufbuild/protobuf": "^2.10.2",
36
36
  "base16384": "^1.0.0",
37
37
  "class-transformer": "^0.5.1",
38
- "class-validator": "^0.14.2",
39
- "fast-xml-parser": "^5.3.0",
40
- "fs-extra": "^11.3.2",
38
+ "class-validator": "^0.14.3",
39
+ "fast-xml-parser": "^5.3.3",
40
+ "fs-extra": "^11.3.3",
41
41
  "hh-mm-ss": "^1.2.0",
42
42
  "json-bigint": "^1.0.0",
43
43
  "jssha": "^3.3.1",
44
44
  "reflect-metadata": "^0.2.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@bufbuild/buf": "^1.58.0",
48
- "@bufbuild/protoc-gen-es": "^2.9.0",
47
+ "@bufbuild/buf": "^1.63.0",
48
+ "@bufbuild/protoc-gen-es": "^2.10.2",
49
49
  "@types/fs-extra": "^11.0.4",
50
50
  "@types/hh-mm-ss": "^1.2.3",
51
51
  "@types/json-bigint": "^1.0.4",
52
- "canvas": "^3.2.0",
53
- "protobufjs": "^7.5.4"
52
+ "canvas": "^3.2.1",
53
+ "protobufjs": "^8.0.0"
54
54
  }
55
55
  }
package/rslib.config.ts CHANGED
@@ -8,7 +8,7 @@ export default defineConfig({
8
8
  {
9
9
  format: 'esm',
10
10
  output: {
11
- filename: { js: 'index.js' },
11
+ filename: { js: '[name].js' },
12
12
  target: 'node',
13
13
  },
14
14
  dts: true,
@@ -16,7 +16,7 @@ export default defineConfig({
16
16
  {
17
17
  format: 'esm',
18
18
  output: {
19
- filename: { js: 'index.min.js' },
19
+ filename: { js: '[name].min.js' },
20
20
  target: 'web',
21
21
  },
22
22
  dts: true,
@@ -25,7 +25,7 @@ export default defineConfig({
25
25
  {
26
26
  format: 'umd',
27
27
  output: {
28
- filename: { js: 'index.umd.min.js' },
28
+ filename: { js: '[name].umd.min.js' },
29
29
  target: 'web',
30
30
  },
31
31
  dts: true,
@@ -34,11 +34,11 @@ const scrollCommand = ({
34
34
  start: number
35
35
  end: number
36
36
  top: number
37
- }) => `\\move(${start},${top},${end},${top})`
37
+ }) => String.raw`\move(${start},${top},${end},${top})`
38
38
  const fixCommand = ({ top, left }: { top: number; left: number }) =>
39
- `\\an8\\pos(${left},${top})`
40
- const colorCommand = (color: RGB) => `\\c${formatColor(color)}`
41
- const borderColorCommand = (color: RGB) => `\\3c${formatColor(color)}`
39
+ String.raw`\an8\pos(${left},${top})`
40
+ const colorCommand = (color: RGB) => String.raw`\c${formatColor(color)}`
41
+ const borderColorCommand = (color: RGB) => String.raw`\3c${formatColor(color)}`
42
42
 
43
43
  export const dialogue = (
44
44
  danmaku: {
@@ -5,6 +5,6 @@ export {
5
5
  hexColorToRGB,
6
6
  isWhite,
7
7
  } from './color'
8
- export { layoutDanmaku } from './layout'
9
- export { arrayOfLength, assign, uniqueArray } from './lang'
10
8
  export { DanmakuList2UniPool, UniPool2DanmakuLists } from './danconvert'
9
+ export { arrayOfLength, assign, uniqueArray } from './lang'
10
+ export { layoutDanmaku } from './layout'