@effectionx/worker 0.2.0 → 0.3.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.
Files changed (245) hide show
  1. package/{script/deps/jsr.io/@std/assert/1.0.14 → esm/deps/jsr.io/@std/assert/1.0.16}/almost_equals.d.ts.map +1 -1
  2. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/array_includes.d.ts.map +1 -1
  3. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/array_includes.js +1 -1
  4. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assert.d.ts.map +1 -1
  5. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.d.ts.map +1 -1
  6. package/esm/deps/jsr.io/@std/assert/1.0.16/equal.d.ts.map +1 -0
  7. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equal.js +5 -2
  8. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equals.d.ts.map +1 -1
  9. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equals.js +6 -5
  10. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/exists.d.ts.map +1 -1
  11. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/fail.d.ts.map +1 -1
  12. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/false.d.ts.map +1 -1
  13. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater.d.ts.map +1 -1
  14. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater.js +1 -1
  15. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater_or_equal.d.ts.map +1 -1
  16. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater_or_equal.js +1 -1
  17. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/instance_of.d.ts.map +1 -1
  18. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/is_error.d.ts.map +1 -1
  19. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/is_error.js +1 -1
  20. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less.d.ts.map +1 -1
  21. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less.js +1 -1
  22. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less_or_equal.d.ts.map +1 -1
  23. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less_or_equal.js +1 -1
  24. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/match.d.ts.map +1 -1
  25. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/mod.d.ts.map +1 -1
  26. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_equals.d.ts.map +1 -1
  27. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_equals.js +1 -1
  28. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_instance_of.d.ts.map +1 -1
  29. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_match.d.ts.map +1 -1
  30. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_strict_equals.d.ts.map +1 -1
  31. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_strict_equals.js +1 -1
  32. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/object_match.d.ts.map +1 -1
  33. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/rejects.d.ts.map +1 -1
  34. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/strict_equals.d.ts.map +1 -1
  35. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/strict_equals.js +7 -6
  36. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/string_includes.d.ts.map +1 -1
  37. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/throws.d.ts.map +1 -1
  38. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unimplemented.d.ts.map +1 -1
  39. package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unreachable.d.ts.map +1 -1
  40. package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/build_message.d.ts +3 -5
  41. package/esm/deps/jsr.io/@std/internal/1.0.12/build_message.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/build_message.js +13 -7
  43. package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff.d.ts.map +1 -1
  44. package/esm/deps/jsr.io/@std/internal/1.0.12/diff_str.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/format.d.ts.map +1 -1
  46. package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/styles.d.ts.map +1 -1
  47. package/esm/deps/jsr.io/@std/internal/1.0.12/types.d.ts +25 -0
  48. package/esm/deps/jsr.io/@std/internal/1.0.12/types.d.ts.map +1 -0
  49. package/esm/message-channel.d.ts +3 -0
  50. package/esm/message-channel.d.ts.map +1 -0
  51. package/esm/message-channel.js +13 -0
  52. package/esm/mod.d.ts +1 -0
  53. package/esm/mod.d.ts.map +1 -1
  54. package/esm/mod.js +1 -0
  55. package/esm/types.d.ts +33 -0
  56. package/esm/types.d.ts.map +1 -0
  57. package/esm/types.js +1 -0
  58. package/esm/worker-main.d.ts +84 -0
  59. package/esm/worker-main.d.ts.map +1 -0
  60. package/esm/worker-main.js +186 -0
  61. package/esm/worker.d.ts +2 -74
  62. package/esm/worker.d.ts.map +1 -1
  63. package/esm/worker.js +4 -120
  64. package/package.json +3 -2
  65. package/{esm/deps/jsr.io/@std/assert/1.0.14 → script/deps/jsr.io/@std/assert/1.0.16}/almost_equals.d.ts.map +1 -1
  66. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/array_includes.d.ts.map +1 -1
  67. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/array_includes.js +1 -1
  68. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assert.d.ts.map +1 -1
  69. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.d.ts.map +1 -1
  70. package/script/deps/jsr.io/@std/assert/1.0.16/equal.d.ts.map +1 -0
  71. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equal.js +5 -2
  72. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equals.d.ts.map +1 -1
  73. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equals.js +6 -5
  74. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/exists.d.ts.map +1 -1
  75. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/fail.d.ts.map +1 -1
  76. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/false.d.ts.map +1 -1
  77. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater.d.ts.map +1 -1
  78. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater.js +1 -1
  79. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater_or_equal.d.ts.map +1 -1
  80. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater_or_equal.js +1 -1
  81. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/instance_of.d.ts.map +1 -1
  82. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/is_error.d.ts.map +1 -1
  83. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/is_error.js +1 -1
  84. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less.d.ts.map +1 -1
  85. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less.js +1 -1
  86. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less_or_equal.d.ts.map +1 -1
  87. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less_or_equal.js +1 -1
  88. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/match.d.ts.map +1 -1
  89. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/mod.d.ts.map +1 -1
  90. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_equals.d.ts.map +1 -1
  91. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_equals.js +1 -1
  92. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_instance_of.d.ts.map +1 -1
  93. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_match.d.ts.map +1 -1
  94. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_strict_equals.d.ts.map +1 -1
  95. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_strict_equals.js +1 -1
  96. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/object_match.d.ts.map +1 -1
  97. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/rejects.d.ts.map +1 -1
  98. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/strict_equals.d.ts.map +1 -1
  99. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/strict_equals.js +7 -6
  100. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/string_includes.d.ts.map +1 -1
  101. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/throws.d.ts.map +1 -1
  102. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unimplemented.d.ts.map +1 -1
  103. package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unreachable.d.ts.map +1 -1
  104. package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/build_message.d.ts +3 -5
  105. package/script/deps/jsr.io/@std/internal/1.0.12/build_message.d.ts.map +1 -0
  106. package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/build_message.js +13 -7
  107. package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff.d.ts.map +1 -1
  108. package/script/deps/jsr.io/@std/internal/1.0.12/diff_str.d.ts.map +1 -0
  109. package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/format.d.ts.map +1 -1
  110. package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/styles.d.ts.map +1 -1
  111. package/script/deps/jsr.io/@std/internal/1.0.12/types.d.ts +25 -0
  112. package/script/deps/jsr.io/@std/internal/1.0.12/types.d.ts.map +1 -0
  113. package/script/message-channel.d.ts +3 -0
  114. package/script/message-channel.d.ts.map +1 -0
  115. package/script/message-channel.js +16 -0
  116. package/script/mod.d.ts +1 -0
  117. package/script/mod.d.ts.map +1 -1
  118. package/script/mod.js +1 -0
  119. package/script/types.d.ts +33 -0
  120. package/script/types.d.ts.map +1 -0
  121. package/script/types.js +2 -0
  122. package/script/worker-main.d.ts +84 -0
  123. package/script/worker-main.d.ts.map +1 -0
  124. package/script/worker-main.js +190 -0
  125. package/script/worker.d.ts +2 -74
  126. package/script/worker.d.ts.map +1 -1
  127. package/script/worker.js +4 -121
  128. package/esm/deps/jsr.io/@std/assert/1.0.14/equal.d.ts.map +0 -1
  129. package/esm/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +0 -1
  130. package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +0 -1
  131. package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts +0 -16
  132. package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +0 -1
  133. package/script/deps/jsr.io/@std/assert/1.0.14/equal.d.ts.map +0 -1
  134. package/script/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +0 -1
  135. package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +0 -1
  136. package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts +0 -16
  137. package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +0 -1
  138. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/almost_equals.d.ts +0 -0
  139. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/almost_equals.js +0 -0
  140. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/array_includes.d.ts +0 -0
  141. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assert.d.ts +0 -0
  142. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assert.js +0 -0
  143. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.d.ts +0 -0
  144. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.js +0 -0
  145. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equal.d.ts +0 -0
  146. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equals.d.ts +0 -0
  147. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/exists.d.ts +0 -0
  148. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/exists.js +0 -0
  149. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/fail.d.ts +0 -0
  150. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/fail.js +0 -0
  151. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/false.d.ts +0 -0
  152. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/false.js +0 -0
  153. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater.d.ts +0 -0
  154. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater_or_equal.d.ts +0 -0
  155. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/instance_of.d.ts +0 -0
  156. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/instance_of.js +0 -0
  157. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/is_error.d.ts +0 -0
  158. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less.d.ts +0 -0
  159. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less_or_equal.d.ts +0 -0
  160. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/match.d.ts +0 -0
  161. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/match.js +0 -0
  162. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/mod.d.ts +0 -0
  163. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/mod.js +0 -0
  164. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_equals.d.ts +0 -0
  165. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_instance_of.d.ts +0 -0
  166. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_instance_of.js +0 -0
  167. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_match.d.ts +0 -0
  168. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_match.js +0 -0
  169. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_strict_equals.d.ts +0 -0
  170. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/object_match.d.ts +0 -0
  171. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/object_match.js +0 -0
  172. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/rejects.d.ts +0 -0
  173. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/rejects.js +0 -0
  174. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/strict_equals.d.ts +0 -0
  175. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/string_includes.d.ts +0 -0
  176. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/string_includes.js +0 -0
  177. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/throws.d.ts +0 -0
  178. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/throws.js +0 -0
  179. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unimplemented.d.ts +0 -0
  180. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unimplemented.js +0 -0
  181. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unreachable.d.ts +0 -0
  182. /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unreachable.js +0 -0
  183. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff.d.ts +0 -0
  184. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff.js +0 -0
  185. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff_str.d.ts +0 -0
  186. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff_str.js +0 -0
  187. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/format.d.ts +0 -0
  188. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/format.js +0 -0
  189. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/styles.d.ts +0 -0
  190. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/styles.js +0 -0
  191. /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/types.js +0 -0
  192. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/almost_equals.d.ts +0 -0
  193. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/almost_equals.js +0 -0
  194. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/array_includes.d.ts +0 -0
  195. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assert.d.ts +0 -0
  196. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assert.js +0 -0
  197. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.d.ts +0 -0
  198. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.js +0 -0
  199. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equal.d.ts +0 -0
  200. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/equals.d.ts +0 -0
  201. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/exists.d.ts +0 -0
  202. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/exists.js +0 -0
  203. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/fail.d.ts +0 -0
  204. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/fail.js +0 -0
  205. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/false.d.ts +0 -0
  206. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/false.js +0 -0
  207. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater.d.ts +0 -0
  208. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/greater_or_equal.d.ts +0 -0
  209. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/instance_of.d.ts +0 -0
  210. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/instance_of.js +0 -0
  211. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/is_error.d.ts +0 -0
  212. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less.d.ts +0 -0
  213. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/less_or_equal.d.ts +0 -0
  214. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/match.d.ts +0 -0
  215. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/match.js +0 -0
  216. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/mod.d.ts +0 -0
  217. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/mod.js +0 -0
  218. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_equals.d.ts +0 -0
  219. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_instance_of.d.ts +0 -0
  220. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_instance_of.js +0 -0
  221. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_match.d.ts +0 -0
  222. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_match.js +0 -0
  223. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/not_strict_equals.d.ts +0 -0
  224. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/object_match.d.ts +0 -0
  225. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/object_match.js +0 -0
  226. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/rejects.d.ts +0 -0
  227. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/rejects.js +0 -0
  228. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/strict_equals.d.ts +0 -0
  229. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/string_includes.d.ts +0 -0
  230. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/string_includes.js +0 -0
  231. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/throws.d.ts +0 -0
  232. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/throws.js +0 -0
  233. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unimplemented.d.ts +0 -0
  234. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unimplemented.js +0 -0
  235. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unreachable.d.ts +0 -0
  236. /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/unreachable.js +0 -0
  237. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff.d.ts +0 -0
  238. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff.js +0 -0
  239. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff_str.d.ts +0 -0
  240. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/diff_str.js +0 -0
  241. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/format.d.ts +0 -0
  242. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/format.js +0 -0
  243. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/styles.d.ts +0 -0
  244. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/styles.js +0 -0
  245. /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/types.js +0 -0
@@ -0,0 +1,84 @@
1
+ import type { ValueSignal } from "@effectionx/signals";
2
+ import { type Operation, type Task } from "effection";
3
+ import type { WorkerMainOptions } from "./types.js";
4
+ /**
5
+ * Entrypoint used in the worker that estaliblishes communication
6
+ * with the main thread. It can be used to return a value,
7
+ * respond to messages or both.
8
+ *
9
+ * @example Returning a value
10
+ * ```ts
11
+ * import { workerMain } from "../worker.ts";
12
+ *
13
+ * await workerMain(function* ({ data }) {
14
+ * return data;
15
+ * });
16
+ * ```
17
+ *
18
+ * @example Responding to messages
19
+ * ```ts
20
+ * import { workerMain } from "../worker.ts";
21
+ *
22
+ * await workerMain(function* ({ messages }) {
23
+ * yield* messages.forEach(function* (message) {
24
+ * return message;
25
+ * });
26
+ * });
27
+ * ```
28
+ *
29
+ * @example Responding to messages and return a value
30
+ * ```ts
31
+ * import { workerMain } from "../worker.ts";
32
+ *
33
+ * await workerMain<number, number, number, number>(
34
+ * function* ({ messages, data: initial }) {
35
+ * let counter = initial;
36
+ *
37
+ * yield* messages.forEach(function* (message) {
38
+ * counter += message;
39
+ * return counter; // returns a value after each message
40
+ * });
41
+ *
42
+ * return counter; // returns the final value
43
+ * },
44
+ * );
45
+ * ```
46
+ *
47
+ * @template TSend - value main thread will send to the worker
48
+ * @template TRecv - value main thread will receive from the worker
49
+ * @template TReturn - worker operation return value
50
+ * @template TData - data passed from the main thread to the worker during initialization
51
+ * @param {(options: WorkerMainOptions<TSend, TRecv, TData>) => Operation<TReturn>} body
52
+ * @returns {Promise<void>}
53
+ */
54
+ export declare function workerMain<TSend, TRecv, TReturn, TData>(body: (options: WorkerMainOptions<TSend, TRecv, TData>) => Operation<TReturn>): Promise<void>;
55
+ type New = {
56
+ type: "new";
57
+ };
58
+ type Running = {
59
+ type: "running";
60
+ task: Task<void>;
61
+ };
62
+ type Complete = {
63
+ type: "complete";
64
+ value: unknown;
65
+ };
66
+ type Errored = {
67
+ type: "error";
68
+ error: Error;
69
+ };
70
+ type Interrupted = {
71
+ type: "interrupted";
72
+ error: Error;
73
+ };
74
+ type WorkerState = New | Running | Complete | Errored | Interrupted;
75
+ interface WorkerStateSignal extends ValueSignal<WorkerState> {
76
+ state: WorkerState["type"];
77
+ start(task: Task<void>): Running | Complete;
78
+ complete(value: unknown): Complete;
79
+ crash(error: Error): Errored;
80
+ interrupt(): Interrupted;
81
+ }
82
+ export declare function createWorkerStatesSignal(): Operation<WorkerStateSignal>;
83
+ export {};
84
+ //# sourceMappingURL=worker-main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-main.d.ts","sourceRoot":"","sources":["../src/worker-main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAOL,KAAK,SAAS,EAGd,KAAK,IAAI,EACV,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAC3D,IAAI,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,SAAS,CAAC,OAAO,CAAC,GAC5E,OAAO,CAAC,IAAI,CAAC,CAqEf;AAED,KAAK,GAAG,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAC3B,KAAK,OAAO,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC;AACrD,KAAK,QAAQ,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AACrD,KAAK,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAC/C,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEzD,KAAK,WAAW,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;AAEpE,UAAU,iBAAkB,SAAQ,WAAW,CAAC,WAAW,CAAC;IAC1D,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IACnC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;IAC7B,SAAS,IAAI,WAAW,CAAC;CAC1B;AAED,wBAAgB,wBAAwB,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAkEvE"}
@@ -0,0 +1,186 @@
1
+ import { createSignal, each, Err, main, Ok, on, resource, spawn, } from "effection";
2
+ /**
3
+ * Entrypoint used in the worker that estaliblishes communication
4
+ * with the main thread. It can be used to return a value,
5
+ * respond to messages or both.
6
+ *
7
+ * @example Returning a value
8
+ * ```ts
9
+ * import { workerMain } from "../worker.ts";
10
+ *
11
+ * await workerMain(function* ({ data }) {
12
+ * return data;
13
+ * });
14
+ * ```
15
+ *
16
+ * @example Responding to messages
17
+ * ```ts
18
+ * import { workerMain } from "../worker.ts";
19
+ *
20
+ * await workerMain(function* ({ messages }) {
21
+ * yield* messages.forEach(function* (message) {
22
+ * return message;
23
+ * });
24
+ * });
25
+ * ```
26
+ *
27
+ * @example Responding to messages and return a value
28
+ * ```ts
29
+ * import { workerMain } from "../worker.ts";
30
+ *
31
+ * await workerMain<number, number, number, number>(
32
+ * function* ({ messages, data: initial }) {
33
+ * let counter = initial;
34
+ *
35
+ * yield* messages.forEach(function* (message) {
36
+ * counter += message;
37
+ * return counter; // returns a value after each message
38
+ * });
39
+ *
40
+ * return counter; // returns the final value
41
+ * },
42
+ * );
43
+ * ```
44
+ *
45
+ * @template TSend - value main thread will send to the worker
46
+ * @template TRecv - value main thread will receive from the worker
47
+ * @template TReturn - worker operation return value
48
+ * @template TData - data passed from the main thread to the worker during initialization
49
+ * @param {(options: WorkerMainOptions<TSend, TRecv, TData>) => Operation<TReturn>} body
50
+ * @returns {Promise<void>}
51
+ */
52
+ export async function workerMain(body) {
53
+ await main(function* () {
54
+ let sent = createSignal();
55
+ let worker = yield* createWorkerStatesSignal();
56
+ yield* spawn(function* () {
57
+ for (const message of yield* each(on(self, "message"))) {
58
+ const control = message.data;
59
+ switch (control.type) {
60
+ case "init": {
61
+ worker.start(yield* spawn(function* () {
62
+ try {
63
+ let value = yield* body({
64
+ data: control.data,
65
+ messages: {
66
+ *forEach(fn) {
67
+ for (let { value, response } of yield* each(sent)) {
68
+ yield* spawn(function* () {
69
+ try {
70
+ let result = yield* fn(value);
71
+ response.postMessage(Ok(result));
72
+ }
73
+ catch (error) {
74
+ response.postMessage(Err(error));
75
+ }
76
+ });
77
+ yield* each.next();
78
+ }
79
+ },
80
+ },
81
+ });
82
+ worker.complete(value);
83
+ }
84
+ catch (error) {
85
+ worker.crash(error);
86
+ }
87
+ }));
88
+ break;
89
+ }
90
+ case "send": {
91
+ let { value, response } = control;
92
+ sent.send({ value, response });
93
+ break;
94
+ }
95
+ case "close": {
96
+ const current = worker.valueOf();
97
+ if (current.type === "running") {
98
+ yield* current.task.halt();
99
+ worker.interrupt();
100
+ }
101
+ }
102
+ }
103
+ yield* each.next();
104
+ }
105
+ });
106
+ for (const state of yield* each(worker)) {
107
+ if (state.type === "new") {
108
+ postMessage({ type: "open" });
109
+ }
110
+ else if (state.type === "interrupted" || state.type === "error") {
111
+ postMessage({ type: "close", result: Err(state.error) });
112
+ }
113
+ else if (state.type === "complete") {
114
+ postMessage({ type: "close", result: Ok(state.value) });
115
+ }
116
+ yield* each.next();
117
+ }
118
+ });
119
+ }
120
+ export function createWorkerStatesSignal() {
121
+ return resource(function* (provide) {
122
+ let ref = {
123
+ current: { type: "new" },
124
+ };
125
+ const signal = createSignal();
126
+ const set = (value) => {
127
+ signal.send(ref.current = value);
128
+ return value;
129
+ };
130
+ const update = (updater) => set(updater(ref.current));
131
+ const interrupt = () => {
132
+ let next = {
133
+ type: "interrupted",
134
+ error: new Error(`worker terminated`),
135
+ };
136
+ set(next);
137
+ return next;
138
+ };
139
+ try {
140
+ yield* provide({
141
+ *[Symbol.iterator]() {
142
+ let subscription = yield* signal;
143
+ signal.send(ref.current);
144
+ return subscription;
145
+ },
146
+ get state() {
147
+ return ref.current.type;
148
+ },
149
+ set,
150
+ update,
151
+ valueOf() {
152
+ return ref.current;
153
+ },
154
+ start(task) {
155
+ if (ref.current.type === "complete") {
156
+ return ref.current;
157
+ }
158
+ else {
159
+ const next = { type: "running", task };
160
+ set(next);
161
+ return next;
162
+ }
163
+ },
164
+ complete(value) {
165
+ let next = { type: "complete", value };
166
+ set(next);
167
+ return next;
168
+ },
169
+ crash(error) {
170
+ let next = { type: "error", error };
171
+ set(next);
172
+ return next;
173
+ },
174
+ interrupt: interrupt,
175
+ });
176
+ }
177
+ finally {
178
+ if (ref.current.type === "running") {
179
+ interrupt();
180
+ }
181
+ }
182
+ });
183
+ }
184
+ function postMessage(message) {
185
+ self.postMessage(message);
186
+ }
package/esm/worker.d.ts CHANGED
@@ -1,18 +1,4 @@
1
1
  import { type Operation } from "effection";
2
- export interface WorkerResource<TSend, TRecv, TReturn> extends Operation<TReturn> {
3
- send(data: TSend): Operation<TRecv>;
4
- }
5
- /**
6
- * Object that represents messages the main thread
7
- * sends to the worker. It provides function for
8
- * handling messages.
9
- *
10
- * @template TSend - value main thread will send to the worker
11
- * @template TRecv - value main thread will receive from the worker
12
- */
13
- export interface WorkerMessages<TSend, TRecv> {
14
- forEach(fn: (message: TSend) => Operation<TRecv>): Operation<void>;
15
- }
16
2
  /**
17
3
  * Argument received by workerMain function
18
4
  *
@@ -20,67 +6,9 @@ export interface WorkerMessages<TSend, TRecv> {
20
6
  * @template TRecv - value main thread will receive from the worker
21
7
  * @template TData - data passed from the main thread to the worker during initialization
22
8
  */
23
- export interface WorkerMainOptions<TSend, TRecv, TData> {
24
- /**
25
- * Namespace that provides APIs for working with incoming messages
26
- */
27
- messages: WorkerMessages<TSend, TRecv>;
28
- /**
29
- * Initial data received by the worker from the main thread used for initialization.
30
- */
31
- data: TData;
9
+ export interface WorkerResource<TSend, TRecv, TReturn> extends Operation<TReturn> {
10
+ send(data: TSend): Operation<TRecv>;
32
11
  }
33
- /**
34
- * Entrypoint used in the worker that estaliblishes communication
35
- * with the main thread. It can be used to return a value,
36
- * respond to messages or both.
37
- *
38
- * @example Returning a value
39
- * ```ts
40
- * import { workerMain } from "../worker.ts";
41
- *
42
- * await workerMain(function* ({ data }) {
43
- * return data;
44
- * });
45
- * ```
46
- *
47
- * @example Responding to messages
48
- * ```ts
49
- * import { workerMain } from "../worker.ts";
50
- *
51
- * await workerMain(function* ({ messages }) {
52
- * yield* messages.forEach(function* (message) {
53
- * return message;
54
- * });
55
- * });
56
- * ```
57
- *
58
- * @example Responding to messages and return a value
59
- * ```ts
60
- * import { workerMain } from "../worker.ts";
61
- *
62
- * await workerMain<number, number, number, number>(
63
- * function* ({ messages, data: initial }) {
64
- * let counter = initial;
65
- *
66
- * yield* messages.forEach(function* (message) {
67
- * counter += message;
68
- * return counter; // returns a value after each message
69
- * });
70
- *
71
- * return counter; // returns the final value
72
- * },
73
- * );
74
- * ```
75
- *
76
- * @template TSend - value main thread will send to the worker
77
- * @template TRecv - value main thread will receive from the worker
78
- * @template TReturn - worker operation return value
79
- * @template TData - data passed from the main thread to the worker during initialization
80
- * @param {(options: WorkerMainOptions<TSend, TRecv, TData>) => Operation<TReturn>} body
81
- * @returns {Promise<void>}
82
- */
83
- export declare function workerMain<TSend, TRecv, TReturn, TData>(body: (options: WorkerMainOptions<TSend, TRecv, TData>) => Operation<TReturn>): Promise<void>;
84
12
  /**
85
13
  * Use on the main thread to create and exeecute a well behaved web worker.
86
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,SAAS,EAMf,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CACnD,SAAQ,SAAS,CAAC,OAAO,CAAC;IAC1B,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc,CAAC,KAAK,EAAE,KAAK;IAC1C,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;CACpE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK;IACpD;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAC3D,IAAI,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,SAAS,CAAC,OAAO,CAAC,GAC5E,OAAO,CAAC,IAAI,CAAC,CAsDf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EACpD,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,OAAO,CAAC,EAAE,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GACzC,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAgElD"}
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,SAAS,EAKf,MAAM,WAAW,CAAC;AAInB;;;;;;GAMG;AACH,MAAM,WAAW,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CACnD,SAAQ,SAAS,CAAC,OAAO,CAAC;IAC1B,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EACpD,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,OAAO,CAAC,EAAE,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GACzC,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAgElD"}
package/esm/worker.js CHANGED
@@ -1,110 +1,6 @@
1
- import { assert } from "./deps/jsr.io/@std/assert/1.0.14/mod.js";
2
- import { createSignal, each, Err, main, Ok, on, once, resource, scoped, spawn, withResolvers, } from "effection";
3
- /**
4
- * Entrypoint used in the worker that estaliblishes communication
5
- * with the main thread. It can be used to return a value,
6
- * respond to messages or both.
7
- *
8
- * @example Returning a value
9
- * ```ts
10
- * import { workerMain } from "../worker.ts";
11
- *
12
- * await workerMain(function* ({ data }) {
13
- * return data;
14
- * });
15
- * ```
16
- *
17
- * @example Responding to messages
18
- * ```ts
19
- * import { workerMain } from "../worker.ts";
20
- *
21
- * await workerMain(function* ({ messages }) {
22
- * yield* messages.forEach(function* (message) {
23
- * return message;
24
- * });
25
- * });
26
- * ```
27
- *
28
- * @example Responding to messages and return a value
29
- * ```ts
30
- * import { workerMain } from "../worker.ts";
31
- *
32
- * await workerMain<number, number, number, number>(
33
- * function* ({ messages, data: initial }) {
34
- * let counter = initial;
35
- *
36
- * yield* messages.forEach(function* (message) {
37
- * counter += message;
38
- * return counter; // returns a value after each message
39
- * });
40
- *
41
- * return counter; // returns the final value
42
- * },
43
- * );
44
- * ```
45
- *
46
- * @template TSend - value main thread will send to the worker
47
- * @template TRecv - value main thread will receive from the worker
48
- * @template TReturn - worker operation return value
49
- * @template TData - data passed from the main thread to the worker during initialization
50
- * @param {(options: WorkerMainOptions<TSend, TRecv, TData>) => Operation<TReturn>} body
51
- * @returns {Promise<void>}
52
- */
53
- export async function workerMain(body) {
54
- await main(function* () {
55
- let sent = createSignal();
56
- let controls = yield* on(self, "message");
57
- let outcome = withResolvers();
58
- self.postMessage({ type: "open" });
59
- let result = yield* scoped(function* () {
60
- yield* spawn(function* () {
61
- let next = yield* controls.next();
62
- while (true) {
63
- let control = next.value.data;
64
- if (control.type === "init") {
65
- yield* spawn(function* () {
66
- try {
67
- let value = yield* body({
68
- data: control.data,
69
- messages: {
70
- *forEach(fn) {
71
- for (let { value, response } of yield* each(sent)) {
72
- yield* spawn(function* () {
73
- try {
74
- let result = yield* fn(value);
75
- response.postMessage(Ok(result));
76
- }
77
- catch (error) {
78
- response.postMessage(Err(error));
79
- }
80
- });
81
- yield* each.next();
82
- }
83
- },
84
- },
85
- });
86
- outcome.resolve(Ok(value));
87
- }
88
- catch (error) {
89
- outcome.resolve(Err(error));
90
- }
91
- });
92
- }
93
- else if (control.type === "send") {
94
- let { value, response } = control;
95
- sent.send({ value, response });
96
- }
97
- else if (control.type === "close") {
98
- outcome.resolve(Err(new Error(`worker terminated`)));
99
- }
100
- next = yield* controls.next();
101
- }
102
- });
103
- return yield* outcome.operation;
104
- });
105
- self.postMessage({ type: "close", result });
106
- });
107
- }
1
+ import { assert } from "./deps/jsr.io/@std/assert/1.0.16/mod.js";
2
+ import { Err, Ok, on, once, resource, spawn, withResolvers, } from "effection";
3
+ import { useMessageChannel } from "./message-channel.js";
108
4
  /**
109
5
  * Use on the main thread to create and exeecute a well behaved web worker.
110
6
  *
@@ -210,24 +106,12 @@ export function useWorker(url, options) {
210
106
  }
211
107
  });
212
108
  }
213
- function useMessageChannel() {
214
- return resource(function* (provide) {
215
- let channel = new MessageChannel();
216
- try {
217
- yield* provide(channel);
218
- }
219
- finally {
220
- channel.port1.close();
221
- channel.port2.close();
222
- }
223
- });
224
- }
225
109
  function settled(operation) {
226
110
  return {
227
111
  *[Symbol.iterator]() {
228
112
  try {
229
113
  yield* operation;
230
- return Ok();
114
+ return Ok(void 0);
231
115
  }
232
116
  catch (error) {
233
117
  return Err(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectionx/worker",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "author": "engineering@frontside.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,8 @@
24
24
  },
25
25
  "sideEffects": false,
26
26
  "dependencies": {
27
- "effection": "4.0.0-beta.2"
27
+ "@effectionx/signals": "^0.4.0",
28
+ "effection": "^3 || ^4.0.0-0"
28
29
  },
29
30
  "_generatedBy": "dnt@dev"
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"almost_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/almost_equals.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,QAmBb"}
1
+ {"version":3,"file":"almost_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/almost_equals.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,QAmBb"}
@@ -1 +1 @@
1
- {"version":3,"file":"array_includes.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/array_includes.ts"],"names":[],"mappings":"AAMA,0FAA0F;AAC1F,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EACzB,GAAG,CAAC,EAAE,MAAM,QAwBb"}
1
+ {"version":3,"file":"array_includes.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/array_includes.ts"],"names":[],"mappings":"AAMA,0FAA0F;AAC1F,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EACzB,GAAG,CAAC,EAAE,MAAM,QAwBb"}
@@ -4,7 +4,7 @@ exports.assertArrayIncludes = assertArrayIncludes;
4
4
  // Copyright 2018-2025 the Deno authors. MIT license.
5
5
  // This module is browser compatible.
6
6
  const equal_js_1 = require("./equal.js");
7
- const format_js_1 = require("../../internal/1.0.10/format.js");
7
+ const format_js_1 = require("../../internal/1.0.12/format.js");
8
8
  const assertion_error_js_1 = require("./assertion_error.js");
9
9
  /**
10
10
  * Make an assertion that `actual` includes the `expected` values. If not then
@@ -1 +1 @@
1
- {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/assert.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,SAAK,GAAG,OAAO,CAAC,IAAI,CAI5D"}
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/assert.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,SAAK,GAAG,OAAO,CAAC,IAAI,CAI5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"assertion_error.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/assertion_error.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD"}
1
+ {"version":3,"file":"assertion_error.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/assertion_error.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equal.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/equal.ts"],"names":[],"mappings":"AA0FA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAgHrD"}
@@ -70,8 +70,7 @@ function getKeysDeep(obj) {
70
70
  return keys;
71
71
  }
72
72
  // deno-lint-ignore no-explicit-any
73
- const Temporal = dntShim.dntGlobalThis.Temporal ??
74
- new Proxy({}, { get: () => { } });
73
+ const Temporal = dntShim.dntGlobalThis.Temporal ?? Object.create(null);
75
74
  /** A non-exhaustive list of prototypes that can be accurately fast-path compared with `String(instance)` */
76
75
  const stringComparablePrototypes = new Set([
77
76
  Intl.Locale,
@@ -141,6 +140,10 @@ function equal(a, b) {
141
140
  if (a instanceof TypedArray) {
142
141
  return compareTypedArrays(a, b);
143
142
  }
143
+ if (a instanceof ArrayBuffer ||
144
+ (globalThis.SharedArrayBuffer && a instanceof SharedArrayBuffer)) {
145
+ return compareTypedArrays(new Uint8Array(a), new Uint8Array(b));
146
+ }
144
147
  if (a instanceof WeakMap) {
145
148
  throw new TypeError("Cannot compare WeakMap instances");
146
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"equals.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/equals.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE,CAAC,EACX,GAAG,CAAC,EAAE,MAAM,QAkBb"}
1
+ {"version":3,"file":"equals.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/equals.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE,CAAC,EACX,GAAG,CAAC,EAAE,MAAM,QAmBb"}
@@ -4,10 +4,10 @@ exports.assertEquals = assertEquals;
4
4
  // Copyright 2018-2025 the Deno authors. MIT license.
5
5
  // This module is browser compatible.
6
6
  const equal_js_1 = require("./equal.js");
7
- const build_message_js_1 = require("../../internal/1.0.10/build_message.js");
8
- const diff_js_1 = require("../../internal/1.0.10/diff.js");
9
- const diff_str_js_1 = require("../../internal/1.0.10/diff_str.js");
10
- const format_js_1 = require("../../internal/1.0.10/format.js");
7
+ const build_message_js_1 = require("../../internal/1.0.12/build_message.js");
8
+ const diff_js_1 = require("../../internal/1.0.12/diff.js");
9
+ const diff_str_js_1 = require("../../internal/1.0.12/diff_str.js");
10
+ const format_js_1 = require("../../internal/1.0.12/format.js");
11
11
  const assertion_error_js_1 = require("./assertion_error.js");
12
12
  /**
13
13
  * Make an assertion that `actual` and `expected` are equal, deeply. If not
@@ -55,7 +55,8 @@ function assertEquals(actual, expected, msg) {
55
55
  const diffResult = stringDiff
56
56
  ? (0, diff_str_js_1.diffStr)(actual, expected)
57
57
  : (0, diff_js_1.diff)(actualString.split("\n"), expectedString.split("\n"));
58
- const diffMsg = (0, build_message_js_1.buildMessage)(diffResult, { stringDiff }).join("\n");
58
+ const diffMsg = (0, build_message_js_1.buildMessage)(diffResult, { stringDiff }, arguments[3])
59
+ .join("\n");
59
60
  message = `${message}\n${diffMsg}`;
60
61
  throw new assertion_error_js_1.AssertionError(message);
61
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"exists.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/exists.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,EACT,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,CAOlC"}
1
+ {"version":3,"file":"exists.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/exists.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,EACT,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,CAOlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fail.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/fail.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAGxC"}
1
+ {"version":3,"file":"fail.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/fail.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAGxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"false.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/false.ts"],"names":[],"mappings":"AAIA,uDAAuD;AACvD,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,SAAK,GAAG,OAAO,CAAC,IAAI,IAAI,KAAK,CAI1E"}
1
+ {"version":3,"file":"false.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/false.ts"],"names":[],"mappings":"AAIA,uDAAuD;AACvD,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,SAAK,GAAG,OAAO,CAAC,IAAI,IAAI,KAAK,CAI1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"greater.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/greater.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,QAMpE"}
1
+ {"version":3,"file":"greater.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/greater.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,QAMpE"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertGreater = assertGreater;
4
4
  // Copyright 2018-2025 the Deno authors. MIT license.
5
5
  // This module is browser compatible.
6
- const format_js_1 = require("../../internal/1.0.10/format.js");
6
+ const format_js_1 = require("../../internal/1.0.12/format.js");
7
7
  const assertion_error_js_1 = require("./assertion_error.js");
8
8
  /**
9
9
  * Make an assertion that `actual` is greater than `expected`.
@@ -1 +1 @@
1
- {"version":3,"file":"greater_or_equal.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/greater_or_equal.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE,CAAC,EACX,GAAG,CAAC,EAAE,MAAM,QASb"}
1
+ {"version":3,"file":"greater_or_equal.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/greater_or_equal.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE,CAAC,EACX,GAAG,CAAC,EAAE,MAAM,QASb"}