template-replacement 3.3.2 → 3.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.
Files changed (56) hide show
  1. package/.editorconfig +8 -0
  2. package/.oxfmtrc.jsonc +7 -0
  3. package/.oxlintrc.json +3 -0
  4. package/README.md +39 -9
  5. package/core/base.ts +54 -55
  6. package/core/general.ts +37 -9
  7. package/core/sign.ts +43 -8
  8. package/dispatcher/general.ts +2 -1
  9. package/dispatcher/sign.ts +2 -1
  10. package/dispatcher/workerGeneral.ts +1 -1
  11. package/dispatcher/workerSign.ts +1 -1
  12. package/dist/base-DQz39fXI.js +249 -0
  13. package/dist/index-oILo_kXG.js +46 -0
  14. package/dist/main/general.js +1373 -1401
  15. package/dist/main/sign.js +1559 -1573
  16. package/dist/replace/general.js +281 -306
  17. package/dist/replace/sign.js +304 -315
  18. package/download/index.ts +13 -13
  19. package/download/stream.ts +29 -28
  20. package/eslint.config.ts +28 -0
  21. package/fileSystem/db/index.ts +25 -25
  22. package/fileSystem/db/indexedDBCache.ts +142 -124
  23. package/fileSystem/index.ts +5 -8
  24. package/fileSystem/interface.ts +4 -5
  25. package/fileSystem/opfs/index.ts +40 -36
  26. package/helper/index.ts +144 -116
  27. package/index.ts +9 -17
  28. package/office/zip.ts +106 -97
  29. package/package.json +17 -11
  30. package/replace/base.ts +203 -214
  31. package/replace/general.ts +44 -19
  32. package/replace/image.ts +88 -86
  33. package/replace/interface.ts +29 -24
  34. package/replace/paramsData.ts +108 -96
  35. package/replace/sign.ts +79 -43
  36. package/task/urlDownloadTask.ts +54 -63
  37. package/temp/index.ts +139 -131
  38. package/temp/interface.ts +8 -8
  39. package/tsconfig.json +1 -1
  40. package/vite.config.ts +11 -14
  41. package/worker/child/agency.ts +49 -41
  42. package/worker/child/base.ts +125 -89
  43. package/worker/child/general.ts +2 -3
  44. package/worker/child/sign.ts +4 -4
  45. package/worker/index.ts +52 -51
  46. package/worker/interface.ts +9 -6
  47. package/worker/main/general.ts +5 -5
  48. package/worker/main/index.ts +191 -66
  49. package/worker/main/sign.ts +5 -5
  50. package/worker/type.ts +16 -15
  51. package/dist/assets/template_replacement_core_wasm_bg.wasm +0 -0
  52. package/dist/assets/template_replacement_sign_core_wasm_bg.wasm +0 -0
  53. package/dist/base-BuKBOMgk.js +0 -269
  54. package/dist/general.d.ts +0 -1
  55. package/dist/index-tFDVIkZX.js +0 -46
  56. package/dist/sign.d.ts +0 -1
@@ -0,0 +1,46 @@
1
+ class h {
2
+ #s;
3
+ #t = 0;
4
+ #e = [];
5
+ #r = [];
6
+ constructor(r, s) {
7
+ if (this.#s = Number(s), this.#s < 1)
8
+ try {
9
+ this.#s = navigator.hardwareConcurrency < 8 ? navigator.hardwareConcurrency : 8;
10
+ } catch {
11
+ }
12
+ this.#s < 1 && (this.#s = 1);
13
+ for (let t = 0; t < this.#s; t++)
14
+ this.#i(r);
15
+ }
16
+ #i(r) {
17
+ const s = new r();
18
+ s.onmessage = async (t) => {
19
+ const i = [];
20
+ for (const e of this.#r)
21
+ i.push(e(t));
22
+ const o = await Promise.all(i);
23
+ for (const e of o)
24
+ e && s.postMessage(e);
25
+ }, this.#e.push(s);
26
+ }
27
+ concurrency() {
28
+ return this.#s;
29
+ }
30
+ postMessage(r, s) {
31
+ this.#e[++this.#t] || (this.#t = 0), this.#e[this.#t].postMessage(r, s);
32
+ }
33
+ addListener(r) {
34
+ this.#r.push(r);
35
+ }
36
+ removeListener(r) {
37
+ for (const s in this.#r)
38
+ if (this.#r[s] == r) {
39
+ this.#r.splice(s, 1);
40
+ return;
41
+ }
42
+ }
43
+ }
44
+ export {
45
+ h as w
46
+ };