@dan-uni/dan-any 1.3.7 → 1.3.9

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.
@@ -14336,9 +14336,10 @@
14336
14336
  options = Object.assign({}, consider, options);
14337
14337
  if (!str || "string" != typeof str) return str;
14338
14338
  let trimmedStr = str.trim();
14339
- if (void 0 !== options.skipLike && options.skipLike.test(trimmedStr)) return str;
14339
+ if (0 === trimmedStr.length) return str;
14340
14340
  {
14341
- if ("0" === str) return 0;
14341
+ if (void 0 !== options.skipLike && options.skipLike.test(trimmedStr)) return str;
14342
+ if ("0" === trimmedStr) return 0;
14342
14343
  if (options.hex && hexRegex.test(trimmedStr)) return parse_int(trimmedStr, 16);
14343
14344
  if (!isFinite(trimmedStr)) return handleInfinity(str, Number(trimmedStr), options);
14344
14345
  if (trimmedStr.includes('e') || trimmedStr.includes('E')) return resolveEnotation(str, trimmedStr, options);
@@ -21060,7 +21061,7 @@
21060
21061
  function timestamp_timestampMs(timestamp) {
21061
21062
  return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
21062
21063
  }
21063
- var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
21064
+ 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"}');
21064
21065
  const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
21065
21066
  const decimalToHex = (n)=>color_pad(n.toString(16));
21066
21067
  const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
@@ -24505,6 +24506,7 @@
24505
24506
  throw new Error(`Unsupported mod "${mod}"`);
24506
24507
  }
24507
24508
  }
24509
+ __webpack_require__("./src/plugins/index.ts");
24508
24510
  const src_JSON = json_bigint_default()({
24509
24511
  useNativeBigInt: true
24510
24512
  });
@@ -24984,12 +24986,15 @@
24984
24986
  }
24985
24987
  toBiliXML(options) {
24986
24988
  const genCID = (id)=>{
24987
- const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
24988
- if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
24989
- const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
24990
- if (cid) return cid;
24989
+ if (!id) return options?.cid || id_gen_UniID.fromNull().toString();
24990
+ {
24991
+ const UniID = id_gen_UniID.fromString(id);
24992
+ if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
24993
+ const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
24994
+ if (cid) return cid;
24995
+ }
24996
+ return options?.cid || id;
24991
24997
  }
24992
- return !options?.cid || id;
24993
24998
  };
24994
24999
  if (options?.avoidSenderIDWithAt) {
24995
25000
  const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform.PlatformVideoSource.Bilibili}`));
@@ -29801,6 +29806,16 @@
29801
29806
  return (that)=>history_danmaku_fast_forward_main(that, query_history_date);
29802
29807
  }
29803
29808
  },
29809
+ "./src/plugins/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
29810
+ "use strict";
29811
+ __webpack_require__.r(__webpack_exports__);
29812
+ __webpack_require__.d(__webpack_exports__, {
29813
+ bili: ()=>_bili__rspack_import_0,
29814
+ stats: ()=>_stats__rspack_import_1
29815
+ });
29816
+ var _bili__rspack_import_0 = __webpack_require__("./src/plugins/bili/index.ts");
29817
+ var _stats__rspack_import_1 = __webpack_require__("./src/plugins/stats/index.ts");
29818
+ },
29804
29819
  "./src/plugins/stats/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
29805
29820
  "use strict";
29806
29821
  __webpack_require__.r(__webpack_exports__);
@@ -30492,16 +30507,6 @@ and limitations under the License.
30492
30507
  });
30493
30508
  };
30494
30509
  })();
30495
- var __webpack_exports__ = {};
30496
- (()=>{
30497
- "use strict";
30498
- __webpack_require__.r(__webpack_exports__);
30499
- __webpack_require__.d(__webpack_exports__, {
30500
- bili: ()=>_bili__rspack_import_0,
30501
- stats: ()=>_stats__rspack_import_1
30502
- });
30503
- var _bili__rspack_import_0 = __webpack_require__("./src/plugins/bili/index.ts");
30504
- var _stats__rspack_import_1 = __webpack_require__("./src/plugins/stats/index.ts");
30505
- })();
30510
+ var __webpack_exports__ = __webpack_require__("./src/plugins/index.ts");
30506
30511
  return __webpack_exports__;
30507
30512
  })());
@@ -275,3 +275,4 @@ export declare class UniPool {
275
275
  toASS(canvasCtx: CanvasCtx, options?: AssGenOptions): string;
276
276
  }
277
277
  export { platform, UniDM, UniDMTools, UniIDTools, type DM_JSON_BiliCommandGrpc, };
278
+ 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.3.7",
4
+ "version": "1.3.9",
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.8",
39
+ "fast-xml-parser": "^5.5.9",
40
40
  "hh-mm-ss": "^1.2.0",
41
41
  "json-bigint": "^1.0.0",
42
42
  "jssha": "^3.3.1",
package/src/index.ts CHANGED
@@ -866,16 +866,17 @@ export class UniPool {
866
866
  avoidSenderIDWithAt?: boolean
867
867
  }): string {
868
868
  const genCID = (id?: string) => {
869
- const UniID = id ? ID.fromString(id) : ID.fromNull()
870
- if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
871
- const cid = UniID.id.replaceAll(
872
- `def_${platform.PlatformVideoSource.Bilibili}+`,
873
- '',
874
- )
875
-
876
- if (cid) return cid
877
- }
878
- return !options?.cid || id
869
+ if (id) {
870
+ const UniID = ID.fromString(id)
871
+ if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
872
+ const cid = UniID.id.replaceAll(
873
+ `def_${platform.PlatformVideoSource.Bilibili}+`,
874
+ '',
875
+ )
876
+ if (cid) return cid
877
+ }
878
+ return options?.cid || id
879
+ } else return options?.cid || ID.fromNull().toString()
879
880
  }
880
881
  if (options?.avoidSenderIDWithAt) {
881
882
  const ok = this.dans.every((d) =>
@@ -1119,3 +1120,4 @@ export {
1119
1120
  // type UniDMType,
1120
1121
  // type UniIDType,
1121
1122
  }
1123
+ export * as plugins from './plugins'