@dan-uni/dan-any-plugin-detaolu 0.9.5 → 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.
- package/dist/index.js +22 -11
- package/dist/index.js.LICENSE.txt +3 -0
- package/dist/index.umd.min.js +1124 -1598
- package/dist/index.umd.min.js.LICENSE.txt +3 -0
- package/dist/pakku.js/index.d.ts +32 -9
- package/package.json +10 -10
- package/src/pakku.js/index.ts +53 -22
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ var Module = function(moduleArg = {}) {
|
|
|
50
50
|
return 'FS_createPath' === a || 'FS_createDataFile' === a || 'FS_createPreloadedFile' === a || 'FS_unlink' === a || 'addRunDependency' === a || 'FS_createLazyFile' === a || 'FS_createDevice' === a || 'removeRunDependency' === a;
|
|
51
51
|
}
|
|
52
52
|
function L(a, b) {
|
|
53
|
-
|
|
53
|
+
"u" < typeof globalThis || Object.getOwnPropertyDescriptor(globalThis, a) || Object.defineProperty(globalThis, a, {
|
|
54
54
|
configurable: !0,
|
|
55
55
|
get () {
|
|
56
56
|
b();
|
|
@@ -77,7 +77,7 @@ var Module = function(moduleArg = {}) {
|
|
|
77
77
|
var N = (a)=>{
|
|
78
78
|
N.g || (N.g = {});
|
|
79
79
|
N.g[a] || (N.g[a] = 1, t(a));
|
|
80
|
-
}, P =
|
|
80
|
+
}, P = "u" > typeof TextDecoder ? new TextDecoder() : void 0, R = [
|
|
81
81
|
null,
|
|
82
82
|
[],
|
|
83
83
|
[]
|
|
@@ -352,6 +352,9 @@ class Queue {
|
|
|
352
352
|
/**
|
|
353
353
|
* @author: xmcp(代码主要逻辑来源)
|
|
354
354
|
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/core/combine_worker.ts
|
|
355
|
+
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/background/config.ts
|
|
356
|
+
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/page/options.html
|
|
357
|
+
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/page/options.ts
|
|
355
358
|
* @license: GPL-3.0
|
|
356
359
|
* 本文件内代码来源见上,经部分修改,并整合config注释
|
|
357
360
|
*/ const DEFAULT_CONFIG = {
|
|
@@ -372,6 +375,8 @@ class Queue {
|
|
|
372
375
|
'66666'
|
|
373
376
|
]
|
|
374
377
|
],
|
|
378
|
+
FORCELIST_CONTINUE_ON_MATCH: true,
|
|
379
|
+
FORCELIST_APPLY_SINGULAR: false,
|
|
375
380
|
WHITELIST: [],
|
|
376
381
|
BLACKLIST: [],
|
|
377
382
|
CROSS_MODE: true,
|
|
@@ -482,9 +487,10 @@ const detaolu = (inp, config)=>{
|
|
|
482
487
|
const TRIM_SPACE = config.TRIM_SPACE;
|
|
483
488
|
const TRIM_WIDTH = config.TRIM_WIDTH;
|
|
484
489
|
const FORCELIST = (config?.FORCELIST ?? DEFAULT_CONFIG.FORCELIST).map(([pattern, repl])=>[
|
|
485
|
-
new RegExp(pattern, '
|
|
490
|
+
new RegExp(pattern, 'giu'),
|
|
486
491
|
repl
|
|
487
492
|
]);
|
|
493
|
+
const FORCELIST_BREAK_ON_MATCH = !config.FORCELIST_CONTINUE_ON_MATCH;
|
|
488
494
|
let len = inp.length;
|
|
489
495
|
let text = '';
|
|
490
496
|
if (TRIM_ENDING) {
|
|
@@ -497,20 +503,19 @@ const detaolu = (inp, config)=>{
|
|
|
497
503
|
}
|
|
498
504
|
else text = inp.slice(0, len);
|
|
499
505
|
if (TRIM_SPACE) text = text.replaceAll(/[ \u3000]+/g, ' ').replaceAll(/([\u3000-\u9FFF\uFF00-\uFFEF]) (?=[\u3000-\u9FFF\uFF00-\uFFEF])/g, '$1');
|
|
506
|
+
let taolu_matched = false;
|
|
500
507
|
for (const taolu of FORCELIST)if (taolu[0].test(text)) {
|
|
501
508
|
text = text.replace(taolu[0], taolu[1]);
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
text
|
|
505
|
-
];
|
|
509
|
+
taolu_matched = true;
|
|
510
|
+
if (FORCELIST_BREAK_ON_MATCH) break;
|
|
506
511
|
}
|
|
507
512
|
return [
|
|
508
|
-
|
|
513
|
+
taolu_matched,
|
|
509
514
|
text
|
|
510
515
|
];
|
|
511
516
|
};
|
|
512
517
|
const whitelisted = (text, config)=>{
|
|
513
|
-
const WHITELIST = (config?.WHITELIST ?? DEFAULT_CONFIG.WHITELIST).map((x)=>new RegExp(x[0], '
|
|
518
|
+
const WHITELIST = (config?.WHITELIST ?? DEFAULT_CONFIG.WHITELIST).map((x)=>new RegExp(x[0], 'iu'));
|
|
514
519
|
if (0 === WHITELIST.length) return false;
|
|
515
520
|
return WHITELIST.some((re)=>re.test(text));
|
|
516
521
|
};
|
|
@@ -662,7 +667,13 @@ async function merge(chunk, config = DEFAULT_CONFIG) {
|
|
|
662
667
|
return null;
|
|
663
668
|
}
|
|
664
669
|
const [matched_taolu, detaolued] = detaolu(disp_str, config);
|
|
665
|
-
if (matched_taolu
|
|
670
|
+
if (matched_taolu) {
|
|
671
|
+
if (s) s.num_taolu_matched++;
|
|
672
|
+
if (config.FORCELIST_APPLY_SINGULAR) obj = {
|
|
673
|
+
...obj,
|
|
674
|
+
content: detaolued
|
|
675
|
+
};
|
|
676
|
+
}
|
|
666
677
|
return {
|
|
667
678
|
obj,
|
|
668
679
|
str: detaolued,
|
|
@@ -749,4 +760,4 @@ function detaolu_constructor(config) {
|
|
|
749
760
|
return (that)=>src_detaolu(that, config);
|
|
750
761
|
}
|
|
751
762
|
const src = detaolu_constructor;
|
|
752
|
-
export
|
|
763
|
+
export default src;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @author: xmcp(代码主要逻辑来源)
|
|
3
3
|
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/core/combine_worker.ts
|
|
4
|
+
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/background/config.ts
|
|
5
|
+
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/page/options.html
|
|
6
|
+
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/page/options.ts
|
|
4
7
|
* @license: GPL-3.0
|
|
5
8
|
* 本文件内代码来源见上,经部分修改,并整合config注释
|
|
6
9
|
*/
|