@dan-uni/dan-any 1.3.8 → 1.4.0
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/browser/index.min.js +97 -12
- package/dist/browser/plugins/bili.min.js +1 -77
- package/dist/browser/plugins/index.min.js +1 -1
- package/dist/browser/plugins/stats.min.js +1 -1
- package/dist/browser/src/index.d.ts +5 -0
- package/dist/node/{rslib-runtime.js → 0~rslib-runtime.js} +1 -15
- package/dist/node/index.js +93 -7
- package/dist/node/plugins/bili.js +1 -77
- package/dist/node/plugins/index.js +1 -1
- package/dist/node/plugins/stats.js +1 -1
- package/dist/node/src/index.d.ts +5 -0
- package/dist/umd/index.umd.min.js +16777 -11984
- package/dist/umd/plugins/bili.umd.min.js +5628 -5492
- package/dist/umd/plugins/index.umd.min.js +428 -296
- package/dist/umd/src/index.d.ts +5 -0
- package/package.json +5 -5
- package/src/index.ts +8 -1
- package/src/plugins/bili/dedupe.ts +1 -1
- package/src/utils/dm-gen.ts +4 -1
- package/tsconfig.json +10 -8
- package/types/tsconfig.tsbuildinfo +1 -1
- /package/dist/browser/{rslib-runtime.min.js → 1~rslib-runtime.min.js} +0 -0
package/dist/umd/src/index.d.ts
CHANGED
|
@@ -237,6 +237,10 @@ export declare class UniPool {
|
|
|
237
237
|
* 当SOID非来源bili时,若此处指定则使用该值为cid,否则使用SOID
|
|
238
238
|
*/
|
|
239
239
|
cid?: bigint;
|
|
240
|
+
/**
|
|
241
|
+
* 跳过command类型的特殊弹幕
|
|
242
|
+
*/
|
|
243
|
+
skipBiliCommand?: boolean;
|
|
240
244
|
/**
|
|
241
245
|
* 当仅含有来自bili的弹幕时,启用将保持发送者标识不含`@`
|
|
242
246
|
* @description
|
|
@@ -275,3 +279,4 @@ export declare class UniPool {
|
|
|
275
279
|
toASS(canvasCtx: CanvasCtx, options?: AssGenOptions): string;
|
|
276
280
|
}
|
|
277
281
|
export { platform, UniDM, UniDMTools, UniIDTools, type DM_JSON_BiliCommandGrpc, };
|
|
282
|
+
export * as plugins from './plugins';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dan-uni/dan-any",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "A danmaku transformer lib, supporting danmaku from different platforms.",
|
|
6
6
|
"author": "rinne",
|
|
7
7
|
"license": "LGPL-3.0-or-later",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"base16384": "^1.0.0",
|
|
37
37
|
"class-transformer": "^0.5.1",
|
|
38
38
|
"class-validator": "^0.15.1",
|
|
39
|
-
"fast-xml-parser": "^5.5.
|
|
39
|
+
"fast-xml-parser": "^5.5.11",
|
|
40
40
|
"hh-mm-ss": "^1.2.0",
|
|
41
41
|
"json-bigint": "^1.0.0",
|
|
42
42
|
"jssha": "^3.3.1",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"reflect-metadata": "^0.2.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@bufbuild/buf": "^1.
|
|
47
|
+
"@bufbuild/buf": "^1.67.0",
|
|
48
48
|
"@bufbuild/protoc-gen-es": "^2.11.0",
|
|
49
49
|
"@types/hh-mm-ss": "^1.2.3",
|
|
50
50
|
"@types/json-bigint": "^1.0.4",
|
|
51
51
|
"@types/luxon": "^3.7.1",
|
|
52
|
-
"canvas": "^3.2.
|
|
53
|
-
"protobufjs": "^8.0.
|
|
52
|
+
"canvas": "^3.2.3",
|
|
53
|
+
"protobufjs": "^8.0.1"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -858,6 +858,10 @@ export class UniPool {
|
|
|
858
858
|
* 当SOID非来源bili时,若此处指定则使用该值为cid,否则使用SOID
|
|
859
859
|
*/
|
|
860
860
|
cid?: bigint
|
|
861
|
+
/**
|
|
862
|
+
* 跳过command类型的特殊弹幕
|
|
863
|
+
*/
|
|
864
|
+
skipBiliCommand?: boolean
|
|
861
865
|
/**
|
|
862
866
|
* 当仅含有来自bili的弹幕时,启用将保持发送者标识不含`@`
|
|
863
867
|
* @description
|
|
@@ -884,6 +888,8 @@ export class UniPool {
|
|
|
884
888
|
)
|
|
885
889
|
if (!ok) throw new Error('存在其他来源的senderID,请关闭该功能再试!')
|
|
886
890
|
}
|
|
891
|
+
let ds = this.dans.map((dan) => dan.toBiliXML(options))
|
|
892
|
+
if (options?.skipBiliCommand) ds = ds.filter((d) => d !== null)
|
|
887
893
|
const builder = new XMLBuilder({ ignoreAttributes: false })
|
|
888
894
|
return builder.build({
|
|
889
895
|
'?xml': {
|
|
@@ -900,7 +906,7 @@ export class UniPool {
|
|
|
900
906
|
real_name: 0,
|
|
901
907
|
source: 'k-v',
|
|
902
908
|
danuni: { ...DanUniConvertTipTemplate, data: this.getShared('SOID') },
|
|
903
|
-
d:
|
|
909
|
+
d: ds,
|
|
904
910
|
},
|
|
905
911
|
})
|
|
906
912
|
}
|
|
@@ -1120,3 +1126,4 @@ export {
|
|
|
1120
1126
|
// type UniDMType,
|
|
1121
1127
|
// type UniIDType,
|
|
1122
1128
|
}
|
|
1129
|
+
export * as plugins from './plugins'
|
|
@@ -10,7 +10,7 @@ function main(that: UniPool) {
|
|
|
10
10
|
that.dans.forEach((d) => {
|
|
11
11
|
if (d.platform !== PlatformVideoSource.Bilibili)
|
|
12
12
|
throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕')
|
|
13
|
-
if (!d.extra.bili?.dmid)
|
|
13
|
+
if (!d.extra.bili?.dmid && !d.extra.bili?.command?.id)
|
|
14
14
|
throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段')
|
|
15
15
|
})
|
|
16
16
|
const map = new Map<bigint, UniDM>()
|
package/src/utils/dm-gen.ts
CHANGED
|
@@ -241,7 +241,7 @@ interface ExtraBili {
|
|
|
241
241
|
pool?: number //原弹幕池
|
|
242
242
|
dmid?: bigint //原弹幕ID
|
|
243
243
|
attr?: number //原弹幕属性
|
|
244
|
-
mid?: bigint //发送者mid(
|
|
244
|
+
mid?: bigint //发送者mid(仅创作中心源、command弹幕)
|
|
245
245
|
adv?: string
|
|
246
246
|
code?: string
|
|
247
247
|
bas?: string
|
|
@@ -938,6 +938,9 @@ export class UniDM {
|
|
|
938
938
|
platform: PlatformVideoSource.Bilibili,
|
|
939
939
|
extra: {
|
|
940
940
|
bili: {
|
|
941
|
+
dmid: args.id,
|
|
942
|
+
attr: args.attr,
|
|
943
|
+
mid: args.mid,
|
|
941
944
|
command: args,
|
|
942
945
|
},
|
|
943
946
|
},
|
package/tsconfig.json
CHANGED
|
@@ -23,14 +23,7 @@
|
|
|
23
23
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
24
24
|
/* Modules */
|
|
25
25
|
"module": "ESNext" /* Skip type checking all .d.ts files. */,
|
|
26
|
-
"moduleResolution": "
|
|
27
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
28
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
29
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
30
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
31
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
32
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
33
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
26
|
+
"moduleResolution": "bundler",
|
|
34
27
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
35
28
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
36
29
|
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
@@ -38,6 +31,15 @@
|
|
|
38
31
|
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
39
32
|
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
40
33
|
"resolveJsonModule": true /* Enable importing .json files. */,
|
|
34
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
35
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
36
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
37
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
38
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
39
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
40
|
+
"types": [
|
|
41
|
+
"node"
|
|
42
|
+
] /* Specify type package names to be included without being referenced in a source file. */,
|
|
41
43
|
"allowImportingTsExtensions": true /* Ensure that casing is correct in imports. */,
|
|
42
44
|
/* Type Checking */
|
|
43
45
|
"strict": true /* Enable all strict type-checking options. */,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"6.0.2"}
|
|
File without changes
|