@dan-uni/dan-any 1.3.9 → 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.
@@ -1236,7 +1236,6 @@ __webpack_require__.add({
1236
1236
  if (y < x) return 1;
1237
1237
  return 0;
1238
1238
  }
1239
- var ONLY_ENUMERABLE = void 0;
1240
1239
  var kStrict = true;
1241
1240
  var kLoose = false;
1242
1241
  var kNoIterator = 0;
@@ -1286,8 +1285,8 @@ __webpack_require__.add({
1286
1285
  if (val1Tag !== val2Tag) return false;
1287
1286
  if (Array.isArray(val1)) {
1288
1287
  if (val1.length !== val2.length) return false;
1289
- var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
1290
- var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
1288
+ var keys1 = getOwnNonIndexProperties(val1);
1289
+ var keys2 = getOwnNonIndexProperties(val2);
1291
1290
  if (keys1.length !== keys2.length) return false;
1292
1291
  return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
1293
1292
  }
@@ -1304,8 +1303,8 @@ __webpack_require__.add({
1304
1303
  if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {
1305
1304
  if (!areSimilarFloatArrays(val1, val2)) return false;
1306
1305
  } else if (!areSimilarTypedArrays(val1, val2)) return false;
1307
- var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
1308
- var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
1306
+ var _keys = getOwnNonIndexProperties(val1);
1307
+ var _keys2 = getOwnNonIndexProperties(val2);
1309
1308
  if (_keys.length !== _keys2.length) return false;
1310
1309
  return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);
1311
1310
  } else if (isSet(val1)) {
@@ -11481,7 +11480,7 @@ __webpack_require__.d(platform_namespaceObject, {
11481
11480
  PlatformVideoSource: ()=>platform_PlatformVideoSource,
11482
11481
  PlatformVideoSources: ()=>PlatformVideoSources
11483
11482
  });
11484
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.9","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
11483
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.0","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
11485
11484
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
11486
11485
  const decimalToHex = (n)=>color_pad(n.toString(16));
11487
11486
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -12037,6 +12036,9 @@ class UniDM {
12037
12036
  platform: platform_PlatformVideoSource.Bilibili,
12038
12037
  extra: {
12039
12038
  bili: {
12039
+ dmid: args.id,
12040
+ attr: args.attr,
12041
+ mid: args.mid,
12040
12042
  command: args
12041
12043
  }
12042
12044
  }
@@ -12770,7 +12772,7 @@ function fileParser(file, mod) {
12770
12772
  function main(that) {
12771
12773
  that.dans.forEach((d)=>{
12772
12774
  if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
12773
- if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
12775
+ if (!d.extra.bili?.dmid && !d.extra.bili?.command?.id) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
12774
12776
  });
12775
12777
  const map = new Map();
12776
12778
  that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
@@ -13335,6 +13337,8 @@ class UniPool {
13335
13337
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform_PlatformVideoSource.Bilibili}`));
13336
13338
  if (!ok) throw new Error('存在其他来源的senderID,请关闭该功能再试!');
13337
13339
  }
13340
+ let ds = this.dans.map((dan)=>dan.toBiliXML(options));
13341
+ if (options?.skipBiliCommand) ds = ds.filter((d)=>null !== d);
13338
13342
  const builder = new XMLBuilder({
13339
13343
  ignoreAttributes: false
13340
13344
  });
@@ -13355,7 +13359,7 @@ class UniPool {
13355
13359
  ...DanUniConvertTipTemplate,
13356
13360
  data: this.getShared('SOID')
13357
13361
  },
13358
- d: this.dans.map((dan)=>dan.toBiliXML(options))
13362
+ d: ds
13359
13363
  }
13360
13364
  });
13361
13365
  }
@@ -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
@@ -59,7 +59,7 @@ __webpack_require__.d(platform_namespaceObject, {
59
59
  PlatformVideoSource: ()=>platform_PlatformVideoSource,
60
60
  PlatformVideoSources: ()=>PlatformVideoSources
61
61
  });
62
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.9","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
62
+ var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.4.0","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
63
63
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
64
64
  const decimalToHex = (n)=>color_pad(n.toString(16));
65
65
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -614,6 +614,9 @@ class UniDM {
614
614
  platform: platform_PlatformVideoSource.Bilibili,
615
615
  extra: {
616
616
  bili: {
617
+ dmid: args.id,
618
+ attr: args.attr,
619
+ mid: args.mid,
617
620
  command: args
618
621
  }
619
622
  }
@@ -1345,7 +1348,7 @@ function fileParser(file, mod) {
1345
1348
  function main(that) {
1346
1349
  that.dans.forEach((d)=>{
1347
1350
  if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
1348
- if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
1351
+ if (!d.extra.bili?.dmid && !d.extra.bili?.command?.id) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
1349
1352
  });
1350
1353
  const map = new Map();
1351
1354
  that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
@@ -1910,6 +1913,8 @@ class UniPool {
1910
1913
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform_PlatformVideoSource.Bilibili}`));
1911
1914
  if (!ok) throw new Error('存在其他来源的senderID,请关闭该功能再试!');
1912
1915
  }
1916
+ let ds = this.dans.map((dan)=>dan.toBiliXML(options));
1917
+ if (options?.skipBiliCommand) ds = ds.filter((d)=>null !== d);
1913
1918
  const builder = new XMLBuilder({
1914
1919
  ignoreAttributes: false
1915
1920
  });
@@ -1930,7 +1935,7 @@ class UniPool {
1930
1935
  ...DanUniConvertTipTemplate,
1931
1936
  data: this.getShared('SOID')
1932
1937
  },
1933
- d: this.dans.map((dan)=>dan.toBiliXML(options))
1938
+ d: ds
1934
1939
  }
1935
1940
  });
1936
1941
  }
@@ -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