@davidsouther/jiffies 1.1.0 → 2.0.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 (379) hide show
  1. package/{build → lib/cjs}/assert.d.ts +23 -23
  2. package/lib/cjs/assert.js +40 -0
  3. package/{build → lib/cjs}/case.d.ts +1 -1
  4. package/lib/cjs/case.js +9 -0
  5. package/{build → lib/cjs}/components/button_bar.d.ts +8 -8
  6. package/lib/cjs/components/button_bar.js +29 -0
  7. package/{build → lib/cjs}/components/inline_edit.d.ts +12 -12
  8. package/lib/cjs/components/inline_edit.js +51 -0
  9. package/{build → lib/cjs}/components/logger.d.ts +6 -6
  10. package/lib/cjs/components/logger.js +27 -0
  11. package/lib/cjs/components/select.d.ts +10 -0
  12. package/lib/cjs/components/select.js +6 -0
  13. package/lib/cjs/components/test.d.ts +1 -0
  14. package/lib/cjs/components/test.js +7 -0
  15. package/{build → lib/cjs}/components/virtual_scroll.d.ts +40 -40
  16. package/lib/cjs/components/virtual_scroll.js +102 -0
  17. package/{build → lib/cjs}/components/virtual_scroll.test.d.ts +1 -1
  18. package/lib/cjs/components/virtual_scroll.test.js +22 -0
  19. package/{build → lib/cjs}/context.d.ts +15 -15
  20. package/lib/cjs/context.js +48 -0
  21. package/{build → lib/cjs}/context.test.d.ts +1 -1
  22. package/lib/cjs/context.test.js +48 -0
  23. package/{build → lib/cjs}/debounce.d.ts +1 -1
  24. package/lib/cjs/debounce.js +11 -0
  25. package/lib/cjs/diff.d.ts +15 -0
  26. package/lib/cjs/diff.js +58 -0
  27. package/{build/components/test.d.ts → lib/cjs/diff.test.d.ts} +1 -1
  28. package/lib/cjs/diff.test.js +41 -0
  29. package/{build → lib/cjs}/display.d.ts +5 -5
  30. package/lib/cjs/display.js +16 -0
  31. package/{build → lib/cjs}/dom/css/border.d.ts +11 -11
  32. package/lib/cjs/dom/css/border.js +33 -0
  33. package/{build → lib/cjs}/dom/css/constants.d.ts +31 -31
  34. package/lib/cjs/dom/css/constants.js +31 -0
  35. package/{build → lib/cjs}/dom/css/core.d.ts +5 -5
  36. package/lib/cjs/dom/css/core.js +31 -0
  37. package/{build → lib/cjs}/dom/css/fstyle.d.ts +5 -5
  38. package/lib/cjs/dom/css/fstyle.js +36 -0
  39. package/{build → lib/cjs}/dom/css/sizing.d.ts +5 -5
  40. package/lib/cjs/dom/css/sizing.js +14 -0
  41. package/{build → lib/cjs}/dom/dom.d.ts +27 -26
  42. package/lib/cjs/dom/dom.js +110 -0
  43. package/{build → lib/cjs}/dom/fc.d.ts +14 -14
  44. package/lib/cjs/dom/fc.js +39 -0
  45. package/{build → lib/cjs}/dom/fc.test.d.ts +1 -1
  46. package/lib/cjs/dom/fc.test.js +23 -0
  47. package/{build → lib/cjs}/dom/form/form.app.d.ts +1 -1
  48. package/lib/cjs/dom/form/form.app.js +27 -0
  49. package/{build → lib/cjs}/dom/form/form.d.ts +26 -26
  50. package/lib/cjs/dom/form/form.js +49 -0
  51. package/{build → lib/cjs}/dom/form/form.test.d.ts +0 -0
  52. package/{build → lib/cjs}/dom/form/form.test.js +1 -1
  53. package/{build → lib/cjs}/dom/html.d.ts +113 -113
  54. package/lib/cjs/dom/html.js +119 -0
  55. package/{build → lib/cjs}/dom/html.test.d.ts +1 -1
  56. package/lib/cjs/dom/html.test.js +60 -0
  57. package/lib/cjs/dom/observable.d.ts +2 -0
  58. package/lib/cjs/dom/observable.js +10 -0
  59. package/{build/observable → lib/cjs/dom}/observable.test.d.ts +1 -1
  60. package/lib/cjs/dom/observable.test.js +35 -0
  61. package/{build → lib/cjs}/dom/provide.d.ts +3 -3
  62. package/lib/cjs/dom/provide.js +12 -0
  63. package/{build → lib/cjs}/dom/router/link.d.ts +6 -6
  64. package/lib/cjs/dom/router/link.js +7 -0
  65. package/{build → lib/cjs}/dom/router/router.d.ts +12 -12
  66. package/lib/cjs/dom/router/router.js +52 -0
  67. package/{build → lib/cjs}/dom/svg.d.ts +64 -64
  68. package/lib/cjs/dom/svg.js +69 -0
  69. package/lib/cjs/dom/test.d.ts +1 -0
  70. package/lib/cjs/dom/test.js +13 -0
  71. package/{build → lib/cjs}/dom/types/css.d.ts +6612 -6612
  72. package/lib/cjs/dom/types/css.js +24 -0
  73. package/{build → lib/cjs}/dom/types/dom.d.ts +0 -0
  74. package/{build → lib/cjs}/dom/types/dom.js +1 -1
  75. package/{build → lib/cjs}/dom/types/html.d.ts +616 -616
  76. package/lib/cjs/dom/types/html.js +2 -0
  77. package/{build → lib/cjs}/dom/xml.d.ts +1 -1
  78. package/lib/cjs/dom/xml.js +8 -0
  79. package/{build → lib/cjs}/equal.d.ts +5 -5
  80. package/lib/cjs/equal.js +43 -0
  81. package/{build → lib/cjs}/equal.test.d.ts +1 -1
  82. package/lib/cjs/equal.test.js +22 -0
  83. package/{build → lib/cjs}/flags.d.ts +7 -7
  84. package/lib/cjs/flags.js +52 -0
  85. package/{build → lib/cjs}/flags.test.d.ts +1 -1
  86. package/lib/cjs/flags.test.js +37 -0
  87. package/{build → lib/cjs}/fs.d.ts +48 -48
  88. package/lib/cjs/fs.js +151 -0
  89. package/{build → lib/cjs}/fs.test.d.ts +1 -1
  90. package/lib/cjs/fs.test.js +45 -0
  91. package/{build → lib/cjs}/generator.d.ts +1 -1
  92. package/lib/cjs/generator.js +14 -0
  93. package/{build → lib/cjs}/generator.test.d.ts +1 -1
  94. package/lib/cjs/generator.test.js +26 -0
  95. package/{build → lib/cjs}/is_browser.d.ts +1 -1
  96. package/lib/cjs/is_browser.js +4 -0
  97. package/{build → lib/cjs}/loader.d.mts +22 -22
  98. package/lib/cjs/loader.mjs +40 -0
  99. package/{build → lib/cjs}/lock.d.ts +1 -1
  100. package/lib/cjs/lock.js +27 -0
  101. package/{build → lib/cjs}/lock.test.d.ts +1 -1
  102. package/lib/cjs/lock.test.js +18 -0
  103. package/{build → lib/cjs}/log.d.ts +26 -26
  104. package/lib/cjs/log.js +54 -0
  105. package/lib/cjs/observable/event.d.ts +35 -0
  106. package/lib/cjs/observable/event.js +61 -0
  107. package/lib/cjs/observable/observable.d.ts +132 -0
  108. package/lib/cjs/observable/observable.js +363 -0
  109. package/lib/cjs/observable/observable.test.d.ts +1 -0
  110. package/lib/cjs/observable/observable.test.js +65 -0
  111. package/{build → lib/cjs}/range.d.ts +1 -1
  112. package/lib/cjs/range.js +11 -0
  113. package/{build → lib/cjs}/result.d.ts +31 -31
  114. package/lib/cjs/result.js +80 -0
  115. package/{build → lib/cjs}/result.test.d.ts +1 -1
  116. package/lib/cjs/result.test.js +73 -0
  117. package/{build → lib/cjs}/safe.d.ts +1 -1
  118. package/lib/cjs/safe.js +14 -0
  119. package/{build → lib/cjs}/scope/describe.d.ts +18 -18
  120. package/lib/cjs/scope/describe.js +73 -0
  121. package/{build → lib/cjs}/scope/display/console.d.ts +2 -2
  122. package/lib/cjs/scope/display/console.js +25 -0
  123. package/{build → lib/cjs}/scope/display/dom.d.ts +3 -3
  124. package/lib/cjs/scope/display/dom.js +30 -0
  125. package/{build → lib/cjs}/scope/display/junit.d.ts +2 -2
  126. package/lib/cjs/scope/display/junit.js +21 -0
  127. package/{build → lib/cjs}/scope/execute.d.ts +12 -12
  128. package/lib/cjs/scope/execute.js +91 -0
  129. package/{build → lib/cjs}/scope/expect.d.ts +23 -23
  130. package/lib/cjs/scope/expect.js +114 -0
  131. package/{build → lib/cjs}/scope/fix.d.ts +4 -4
  132. package/lib/cjs/scope/fix.js +26 -0
  133. package/{build → lib/cjs}/scope/index.d.ts +3 -3
  134. package/lib/cjs/scope/index.js +15 -0
  135. package/{build → lib/cjs}/scope/scope.d.ts +17 -17
  136. package/lib/cjs/scope/scope.js +2 -0
  137. package/lib/cjs/scope/state.d.ts +1 -0
  138. package/lib/cjs/scope/state.js +11 -0
  139. package/{build → lib/cjs}/server/http/apps.d.ts +5 -5
  140. package/lib/cjs/server/http/apps.js +27 -0
  141. package/{build → lib/cjs}/server/http/css.d.ts +5 -5
  142. package/lib/cjs/server/http/css.js +54 -0
  143. package/{build → lib/cjs}/server/http/index.d.ts +21 -21
  144. package/lib/cjs/server/http/index.js +77 -0
  145. package/{build → lib/cjs}/server/http/response.d.ts +4 -4
  146. package/lib/cjs/server/http/response.js +45 -0
  147. package/{build → lib/cjs}/server/http/sitemap.d.ts +2 -2
  148. package/lib/cjs/server/http/sitemap.js +46 -0
  149. package/{build → lib/cjs}/server/http/static.d.ts +2 -2
  150. package/lib/cjs/server/http/static.js +25 -0
  151. package/{build → lib/cjs}/server/http/typescript.d.ts +5 -5
  152. package/lib/cjs/server/http/typescript.js +44 -0
  153. package/{build → lib/cjs}/server/main.d.ts +2 -2
  154. package/lib/cjs/server/main.js +14 -0
  155. package/{build → lib/cjs}/test.d.mts +2 -2
  156. package/lib/cjs/test.mjs +28 -0
  157. package/{build → lib/cjs}/test_all.d.ts +9 -7
  158. package/lib/cjs/test_all.js +30 -0
  159. package/{build → lib/cjs}/transpile.d.mts +3 -3
  160. package/lib/cjs/transpile.mjs +22 -0
  161. package/lib/cjs/tsconfig.tsbuildinfo +1 -0
  162. package/lib/esm/assert.d.ts +23 -0
  163. package/{build → lib/esm}/assert.js +33 -33
  164. package/lib/esm/case.d.ts +1 -0
  165. package/{build → lib/esm}/case.js +5 -5
  166. package/lib/esm/components/button_bar.d.ts +8 -0
  167. package/{build → lib/esm}/components/button_bar.js +27 -27
  168. package/lib/esm/components/inline_edit.d.ts +12 -0
  169. package/{build → lib/esm}/components/inline_edit.js +48 -48
  170. package/lib/esm/components/logger.d.ts +6 -0
  171. package/{build → lib/esm}/components/logger.js +22 -22
  172. package/lib/esm/components/select.d.ts +10 -0
  173. package/{build → lib/esm}/components/select.js +3 -3
  174. package/lib/esm/components/test.d.ts +1 -0
  175. package/lib/esm/components/test.js +3 -0
  176. package/lib/esm/components/virtual_scroll.d.ts +40 -0
  177. package/{build → lib/esm}/components/virtual_scroll.js +94 -94
  178. package/lib/esm/components/virtual_scroll.test.d.ts +1 -0
  179. package/{build → lib/esm}/components/virtual_scroll.test.js +20 -21
  180. package/lib/esm/context.d.ts +15 -0
  181. package/{build → lib/esm}/context.js +43 -43
  182. package/lib/esm/context.test.d.ts +1 -0
  183. package/{build → lib/esm}/context.test.js +46 -46
  184. package/lib/esm/debounce.d.ts +1 -0
  185. package/{build → lib/esm}/debounce.js +7 -7
  186. package/lib/esm/diff.d.ts +15 -0
  187. package/lib/esm/diff.js +54 -0
  188. package/lib/esm/diff.test.d.ts +1 -0
  189. package/lib/esm/diff.test.js +39 -0
  190. package/lib/esm/display.d.ts +5 -0
  191. package/{build → lib/esm}/display.js +11 -11
  192. package/lib/esm/dom/css/border.d.ts +11 -0
  193. package/{build → lib/esm}/dom/css/border.js +27 -27
  194. package/lib/esm/dom/css/constants.d.ts +31 -0
  195. package/{build → lib/esm}/dom/css/constants.js +28 -28
  196. package/lib/esm/dom/css/core.d.ts +5 -0
  197. package/{build → lib/esm}/dom/css/core.js +24 -24
  198. package/lib/esm/dom/css/fstyle.d.ts +5 -0
  199. package/{build → lib/esm}/dom/css/fstyle.js +32 -32
  200. package/lib/esm/dom/css/sizing.d.ts +5 -0
  201. package/{build → lib/esm}/dom/css/sizing.js +10 -10
  202. package/lib/esm/dom/dom.d.ts +27 -0
  203. package/{build → lib/esm}/dom/dom.js +104 -95
  204. package/lib/esm/dom/fc.d.ts +14 -0
  205. package/{build → lib/esm}/dom/fc.js +35 -36
  206. package/lib/esm/dom/fc.test.d.ts +1 -0
  207. package/{build → lib/esm}/dom/fc.test.js +21 -21
  208. package/lib/esm/dom/form/form.app.d.ts +1 -0
  209. package/{build → lib/esm}/dom/form/form.app.js +23 -23
  210. package/lib/esm/dom/form/form.d.ts +26 -0
  211. package/{build → lib/esm}/dom/form/form.js +34 -34
  212. package/lib/esm/dom/form/form.test.d.ts +0 -0
  213. package/lib/esm/dom/form/form.test.js +1 -0
  214. package/lib/esm/dom/html.d.ts +113 -0
  215. package/{build → lib/esm}/dom/html.js +114 -114
  216. package/lib/esm/dom/html.test.d.ts +1 -0
  217. package/{build → lib/esm}/dom/html.test.js +58 -58
  218. package/lib/esm/dom/observable.d.ts +2 -0
  219. package/lib/esm/dom/observable.js +6 -0
  220. package/lib/esm/dom/observable.test.d.ts +1 -0
  221. package/lib/esm/dom/observable.test.js +33 -0
  222. package/lib/esm/dom/provide.d.ts +3 -0
  223. package/{build → lib/esm}/dom/provide.js +7 -7
  224. package/lib/esm/dom/router/link.d.ts +6 -0
  225. package/{build → lib/esm}/dom/router/link.js +3 -3
  226. package/lib/esm/dom/router/router.d.ts +12 -0
  227. package/{build → lib/esm}/dom/router/router.js +49 -49
  228. package/lib/esm/dom/svg.d.ts +64 -0
  229. package/{build → lib/esm}/dom/svg.js +65 -65
  230. package/lib/esm/dom/test.d.ts +1 -0
  231. package/lib/esm/dom/test.js +9 -0
  232. package/lib/esm/dom/types/css.d.ts +6612 -0
  233. package/{build → lib/esm}/dom/types/css.js +23 -23
  234. package/lib/esm/dom/types/dom.d.ts +0 -0
  235. package/lib/esm/dom/types/dom.js +1 -0
  236. package/lib/esm/dom/types/html.d.ts +616 -0
  237. package/{build → lib/esm}/dom/types/html.js +1 -1
  238. package/lib/esm/dom/xml.d.ts +1 -0
  239. package/{build → lib/esm}/dom/xml.js +4 -4
  240. package/lib/esm/equal.d.ts +5 -0
  241. package/{build → lib/esm}/equal.js +37 -37
  242. package/lib/esm/equal.test.d.ts +1 -0
  243. package/{build → lib/esm}/equal.test.js +20 -20
  244. package/lib/esm/flags.d.ts +7 -0
  245. package/{build → lib/esm}/flags.js +48 -48
  246. package/lib/esm/flags.test.d.ts +1 -0
  247. package/{build → lib/esm}/flags.test.js +35 -35
  248. package/lib/esm/fs.d.ts +48 -0
  249. package/{build → lib/esm}/fs.js +144 -144
  250. package/lib/esm/fs.test.d.ts +1 -0
  251. package/{build → lib/esm}/fs.test.js +43 -43
  252. package/lib/esm/generator.d.ts +1 -0
  253. package/{build → lib/esm}/generator.js +10 -10
  254. package/lib/esm/generator.test.d.ts +1 -0
  255. package/{build → lib/esm}/generator.test.js +24 -24
  256. package/lib/esm/is_browser.d.ts +1 -0
  257. package/{build → lib/esm}/is_browser.js +1 -1
  258. package/lib/esm/loader.d.mts +22 -0
  259. package/{build → lib/esm}/loader.mjs +35 -35
  260. package/lib/esm/lock.d.ts +1 -0
  261. package/{build → lib/esm}/lock.js +23 -23
  262. package/lib/esm/lock.test.d.ts +1 -0
  263. package/{build → lib/esm}/lock.test.js +16 -16
  264. package/lib/esm/log.d.ts +26 -0
  265. package/{build → lib/esm}/log.js +46 -46
  266. package/lib/esm/observable/event.d.ts +35 -0
  267. package/lib/esm/observable/event.js +46 -0
  268. package/lib/esm/observable/observable.d.ts +132 -0
  269. package/lib/esm/observable/observable.js +343 -0
  270. package/lib/esm/observable/observable.test.d.ts +1 -0
  271. package/lib/esm/observable/observable.test.js +63 -0
  272. package/lib/esm/range.d.ts +1 -0
  273. package/{build → lib/esm}/range.js +7 -7
  274. package/lib/esm/result.d.ts +31 -0
  275. package/{build → lib/esm}/result.js +65 -65
  276. package/lib/esm/result.test.d.ts +1 -0
  277. package/{build → lib/esm}/result.test.js +71 -71
  278. package/lib/esm/safe.d.ts +1 -0
  279. package/{build → lib/esm}/safe.js +10 -10
  280. package/lib/esm/scope/describe.d.ts +18 -0
  281. package/{build → lib/esm}/scope/describe.js +60 -61
  282. package/lib/esm/scope/display/console.d.ts +2 -0
  283. package/{build → lib/esm}/scope/display/console.js +21 -21
  284. package/lib/esm/scope/display/dom.d.ts +3 -0
  285. package/{build → lib/esm}/scope/display/dom.js +26 -26
  286. package/lib/esm/scope/display/junit.d.ts +2 -0
  287. package/{build → lib/esm}/scope/display/junit.js +17 -17
  288. package/lib/esm/scope/execute.d.ts +12 -0
  289. package/{build → lib/esm}/scope/execute.js +85 -85
  290. package/lib/esm/scope/expect.d.ts +23 -0
  291. package/{build → lib/esm}/scope/expect.js +108 -108
  292. package/lib/esm/scope/fix.d.ts +4 -0
  293. package/{build → lib/esm}/scope/fix.js +22 -22
  294. package/lib/esm/scope/index.d.ts +3 -0
  295. package/{build → lib/esm}/scope/index.js +3 -3
  296. package/lib/esm/scope/scope.d.ts +17 -0
  297. package/{build → lib/esm}/scope/scope.js +1 -1
  298. package/lib/esm/scope/state.d.ts +1 -0
  299. package/lib/esm/scope/state.js +7 -0
  300. package/lib/esm/server/http/apps.d.ts +5 -0
  301. package/{build → lib/esm}/server/http/apps.js +23 -23
  302. package/lib/esm/server/http/css.d.ts +5 -0
  303. package/{build → lib/esm}/server/http/css.js +50 -50
  304. package/lib/esm/server/http/index.d.ts +21 -0
  305. package/{build → lib/esm}/server/http/index.js +73 -73
  306. package/lib/esm/server/http/response.d.ts +4 -0
  307. package/{build → lib/esm}/server/http/response.js +40 -40
  308. package/lib/esm/server/http/sitemap.d.ts +2 -0
  309. package/{build → lib/esm}/server/http/sitemap.js +42 -42
  310. package/lib/esm/server/http/static.d.ts +2 -0
  311. package/{build → lib/esm}/server/http/static.js +21 -21
  312. package/lib/esm/server/http/typescript.d.ts +5 -0
  313. package/{build → lib/esm}/server/http/typescript.js +40 -40
  314. package/lib/esm/server/main.d.ts +2 -0
  315. package/{build → lib/esm}/server/main.js +12 -9
  316. package/lib/esm/test.d.mts +2 -0
  317. package/lib/esm/test.mjs +26 -0
  318. package/lib/esm/test_all.d.ts +9 -0
  319. package/{build → lib/esm}/test_all.js +28 -18
  320. package/lib/esm/transpile.d.mts +3 -0
  321. package/{build → lib/esm}/transpile.mjs +18 -18
  322. package/lib/esm/tsconfig.tsbuildinfo +1 -0
  323. package/package.json +13 -14
  324. package/src/assert.ts +1 -1
  325. package/src/components/button_bar.ts +3 -3
  326. package/src/components/inline_edit.ts +3 -3
  327. package/src/components/logger.ts +3 -3
  328. package/src/components/select.ts +3 -3
  329. package/src/components/test.js +3 -2
  330. package/src/context.ts +3 -3
  331. package/src/diff.ts +2 -2
  332. package/src/dom/css/border.ts +3 -3
  333. package/src/dom/css/core.ts +1 -1
  334. package/src/dom/css/fstyle.ts +2 -2
  335. package/src/dom/css/sizing.ts +1 -1
  336. package/src/dom/dom.ts +1 -1
  337. package/src/dom/fc.test.ts +3 -3
  338. package/src/dom/fc.ts +1 -1
  339. package/src/dom/form/form.app.ts +2 -2
  340. package/src/dom/form/form.ts +3 -3
  341. package/src/dom/html.test.ts +3 -3
  342. package/src/dom/html.ts +1 -1
  343. package/src/dom/observable.test.ts +6 -6
  344. package/src/dom/observable.ts +1 -1
  345. package/src/dom/provide.ts +1 -1
  346. package/src/dom/router/link.ts +2 -2
  347. package/src/dom/router/router.ts +2 -2
  348. package/src/dom/svg.ts +1 -1
  349. package/src/dom/test.ts +8 -6
  350. package/src/dom/types/html.ts +1 -1
  351. package/src/equal.ts +1 -1
  352. package/src/flags.ts +1 -1
  353. package/src/fs.ts +4 -4
  354. package/src/index.html +6 -6
  355. package/src/observable/event.ts +2 -2
  356. package/src/observable/observable.test.ts +2 -2
  357. package/src/observable/observable.ts +72 -12
  358. package/src/pico/_variables.scss +1 -1
  359. package/src/pico/layout/_sectioning.scss +2 -0
  360. package/src/result.ts +1 -1
  361. package/src/scope/describe.ts +2 -5
  362. package/src/scope/display/console.ts +4 -4
  363. package/src/scope/display/dom.ts +6 -6
  364. package/src/scope/display/junit.ts +3 -3
  365. package/src/scope/execute.ts +2 -2
  366. package/src/scope/expect.ts +3 -3
  367. package/src/scope/state.ts +10 -0
  368. package/src/server/http/sitemap.ts +1 -1
  369. package/src/server/main.ts +9 -2
  370. package/src/test.mjs +22 -18
  371. package/src/test_all.ts +10 -0
  372. package/build/components/select.d.ts +0 -13
  373. package/build/components/test.js +0 -2
  374. package/build/dom/test.d.ts +0 -1
  375. package/build/dom/test.js +0 -2
  376. package/build/observable/observable.d.ts +0 -83
  377. package/build/observable/observable.js +0 -148
  378. package/build/observable/observable.test.js +0 -21
  379. package/build/test.mjs +0 -23
@@ -1,43 +1,43 @@
1
- import { FileSystem, ObjectFileSystemAdapter } from "./fs.js";
2
- import { describe, it, expect } from "./scope/index.js";
3
- describe("FileSystem", () => {
4
- describe("Writing", () => {
5
- it("Writes files", async () => {
6
- const fsObj = {};
7
- const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
8
- await fs.writeFile("hello", "world");
9
- expect(fsObj).toEqual({ "/hello": "world" });
10
- });
11
- it("Writes deep files", async () => {
12
- const fsObj = {};
13
- const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
14
- await fs.writeFile("deep/hello", "world");
15
- expect(fsObj).toEqual({ "/deep/hello": "world" });
16
- });
17
- it("Writes deep files from root", async () => {
18
- const fsObj = {};
19
- const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
20
- await fs.writeFile("/root/deep/hello", "world");
21
- expect(fsObj).toEqual({ "/root/deep/hello": "world" });
22
- });
23
- it("Writes files after cd", async () => {
24
- const fsObj = {};
25
- const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
26
- await fs.cd("deep");
27
- await fs.writeFile("hello", "world");
28
- expect(fsObj).toEqual({ "/deep/hello": "world" });
29
- });
30
- });
31
- describe("directory", () => {
32
- it("returns directory listing", async () => {
33
- const fsObj = {
34
- "/deep/hello": "world",
35
- "/deep/bonjour": "monde",
36
- "/other/file": "text",
37
- };
38
- const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
39
- const dir = await fs.readdir("deep");
40
- expect(dir.sort()).toEqual(["bonjour", "hello"]);
41
- });
42
- });
43
- });
1
+ import { FileSystem, ObjectFileSystemAdapter } from "./fs.js";
2
+ import { describe, it, expect } from "./scope/index.js";
3
+ describe("FileSystem", () => {
4
+ describe("Writing", () => {
5
+ it("Writes files", async () => {
6
+ const fsObj = {};
7
+ const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
8
+ await fs.writeFile("hello", "world");
9
+ expect(fsObj).toEqual({ "/hello": "world" });
10
+ });
11
+ it("Writes deep files", async () => {
12
+ const fsObj = {};
13
+ const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
14
+ await fs.writeFile("deep/hello", "world");
15
+ expect(fsObj).toEqual({ "/deep/hello": "world" });
16
+ });
17
+ it("Writes deep files from root", async () => {
18
+ const fsObj = {};
19
+ const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
20
+ await fs.writeFile("/root/deep/hello", "world");
21
+ expect(fsObj).toEqual({ "/root/deep/hello": "world" });
22
+ });
23
+ it("Writes files after cd", async () => {
24
+ const fsObj = {};
25
+ const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
26
+ await fs.cd("deep");
27
+ await fs.writeFile("hello", "world");
28
+ expect(fsObj).toEqual({ "/deep/hello": "world" });
29
+ });
30
+ });
31
+ describe("directory", () => {
32
+ it("returns directory listing", async () => {
33
+ const fsObj = {
34
+ "/deep/hello": "world",
35
+ "/deep/bonjour": "monde",
36
+ "/other/file": "text",
37
+ };
38
+ const fs = new FileSystem(new ObjectFileSystemAdapter(fsObj));
39
+ const dir = await fs.readdir("deep");
40
+ expect(dir.sort()).toEqual(["bonjour", "hello"]);
41
+ });
42
+ });
43
+ });
@@ -0,0 +1 @@
1
+ export declare function takeWhile<T>(predicate: (t: T) => boolean, iterator: Iterable<T>): Generator<T, void, unknown>;
@@ -1,10 +1,10 @@
1
- export function* takeWhile(predicate, iterator) {
2
- for (const x of iterator) {
3
- if (predicate(x)) {
4
- yield x;
5
- }
6
- else {
7
- return;
8
- }
9
- }
10
- }
1
+ export function* takeWhile(predicate, iterator) {
2
+ for (const x of iterator) {
3
+ if (predicate(x)) {
4
+ yield x;
5
+ }
6
+ else {
7
+ return;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,24 +1,24 @@
1
- import { takeWhile } from "./generator.js";
2
- import { describe, it, expect } from "./scope/index.js";
3
- describe("Generator", () => {
4
- it("takes from a generator until a predicate", () => {
5
- const generator = function* () {
6
- let i = 1;
7
- while (true) {
8
- yield (i = i * 2);
9
- }
10
- };
11
- const filter = () => {
12
- let previousValue = 0;
13
- return (n) => {
14
- if (previousValue < 100) {
15
- previousValue = n;
16
- return true;
17
- }
18
- return false;
19
- };
20
- };
21
- const values = [...takeWhile(filter(), generator())];
22
- expect(values).toEqual([2, 4, 8, 16, 32, 64, 128]);
23
- });
24
- });
1
+ import { takeWhile } from "./generator.js";
2
+ import { describe, it, expect } from "./scope/index.js";
3
+ describe("Generator", () => {
4
+ it("takes from a generator until a predicate", () => {
5
+ const generator = function* () {
6
+ let i = 1;
7
+ while (true) {
8
+ yield (i = i * 2);
9
+ }
10
+ };
11
+ const filter = () => {
12
+ let previousValue = 0;
13
+ return (n) => {
14
+ if (previousValue < 100) {
15
+ previousValue = n;
16
+ return true;
17
+ }
18
+ return false;
19
+ };
20
+ };
21
+ const values = [...takeWhile(filter(), generator())];
22
+ expect(values).toEqual([2, 4, 8, 16, 32, 64, 128]);
23
+ });
24
+ });
@@ -0,0 +1 @@
1
+ export const IsBrowser: boolean;
@@ -1 +1 @@
1
- export const IsBrowser = typeof window !== "undefined";
1
+ export const IsBrowser = typeof window !== "undefined";
@@ -0,0 +1,22 @@
1
+ /** @returns {Promise<{url: string}>} */
2
+ export function resolve(specifier: string, context: {
3
+ parentURL?: string;
4
+ }, defaultResolve: (specifier: string, context: {
5
+ parentURL?: string;
6
+ }, defaultResolve: Function) => Promise<{
7
+ url: string;
8
+ }>): Promise<{
9
+ url: string;
10
+ }>;
11
+ /** @returns {Promise<{format: string, source: string}>} */
12
+ export function load(url: string, context: {
13
+ format?: string;
14
+ }, defaultLoad: (url: string, context: {
15
+ format?: string;
16
+ }, defaultLoad?: Function) => Promise<{
17
+ format: string;
18
+ source: string;
19
+ }>): Promise<{
20
+ format: string;
21
+ source: string;
22
+ }>;
@@ -1,35 +1,35 @@
1
- import { stat } from "node:fs/promises";
2
- import { cwd } from "node:process";
3
- import { fileURLToPath, pathToFileURL } from "node:url";
4
- import { transpile } from "./transpile.mjs";
5
- const baseURL = pathToFileURL(`${cwd()}/`).href;
6
- /** @returns {Promise<{url: string}>} */
7
- export async function resolve(
8
- /** @type string */ specifier,
9
- /** @type {{parentURL?: string}} */ context,
10
- /** @type {(specifier: string, context: {parentURL?: string}, defaultResolve: Function) => Promise<{url: string}>} */ defaultResolve) {
11
- const tsURL = new URL(specifier.replace(/js$/, "ts"), context.parentURL ?? baseURL);
12
- const tsSpecifier = tsURL.href;
13
- try {
14
- const stats = await stat(fileURLToPath(tsURL));
15
- if (stats.isFile()) {
16
- return { url: tsSpecifier };
17
- }
18
- }
19
- catch (e) {
20
- // Do nothing
21
- }
22
- return defaultResolve(specifier, context, defaultResolve);
23
- }
24
- /** @returns {Promise<{format: string, source: string}>} */
25
- export async function load(
26
- /** @type string */ url,
27
- /** @type {{format?: string}} */ context,
28
- /** @type {(url: string, context: {format?: string}, defaultLoad?: Function) => Promise<{format: string, source: string}>} */ defaultLoad) {
29
- return url.endsWith("ts")
30
- ? {
31
- format: "module",
32
- source: await transpile(url, async () => (await defaultLoad(url, { format: "module" })).source),
33
- }
34
- : defaultLoad(url, context, defaultLoad);
35
- }
1
+ import { stat } from "node:fs/promises";
2
+ import { cwd } from "node:process";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import { transpile } from "./transpile.mjs";
5
+ const baseURL = pathToFileURL(`${cwd()}/`).href;
6
+ /** @returns {Promise<{url: string}>} */
7
+ export async function resolve(
8
+ /** @type string */ specifier,
9
+ /** @type {{parentURL?: string}} */ context,
10
+ /** @type {(specifier: string, context: {parentURL?: string}, defaultResolve: Function) => Promise<{url: string}>} */ defaultResolve) {
11
+ const tsURL = new URL(specifier.replace(/js$/, "ts"), context.parentURL ?? baseURL);
12
+ const tsSpecifier = tsURL.href;
13
+ try {
14
+ const stats = await stat(fileURLToPath(tsURL));
15
+ if (stats.isFile()) {
16
+ return { url: tsSpecifier };
17
+ }
18
+ }
19
+ catch (e) {
20
+ // Do nothing
21
+ }
22
+ return defaultResolve(specifier, context, defaultResolve);
23
+ }
24
+ /** @returns {Promise<{format: string, source: string}>} */
25
+ export async function load(
26
+ /** @type string */ url,
27
+ /** @type {{format?: string}} */ context,
28
+ /** @type {(url: string, context: {format?: string}, defaultLoad?: Function) => Promise<{format: string, source: string}>} */ defaultLoad) {
29
+ return url.endsWith("ts")
30
+ ? {
31
+ format: "module",
32
+ source: await transpile(url, async () => (await defaultLoad(url, { format: "module" })).source),
33
+ }
34
+ : defaultLoad(url, context, defaultLoad);
35
+ }
@@ -0,0 +1 @@
1
+ export declare function lock(fn: Function): Function;
@@ -1,23 +1,23 @@
1
- const locks = new WeakSet();
2
- export function lock(fn) {
3
- return function (...args) {
4
- let ret = null;
5
- let ex = null;
6
- if (!locks.has(fn)) {
7
- locks.add(fn);
8
- try {
9
- ret = fn(...args);
10
- }
11
- catch (e) {
12
- ex = e;
13
- }
14
- }
15
- locks.delete(fn);
16
- if (ex !== null) {
17
- throw ex;
18
- }
19
- else {
20
- return ret;
21
- }
22
- };
23
- }
1
+ const locks = new WeakSet();
2
+ export function lock(fn) {
3
+ return function (...args) {
4
+ let ret = null;
5
+ let ex = null;
6
+ if (!locks.has(fn)) {
7
+ locks.add(fn);
8
+ try {
9
+ ret = fn(...args);
10
+ }
11
+ catch (e) {
12
+ ex = e;
13
+ }
14
+ }
15
+ locks.delete(fn);
16
+ if (ex !== null) {
17
+ throw ex;
18
+ }
19
+ else {
20
+ return ret;
21
+ }
22
+ };
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,16 @@
1
- import { describe, it, expect } from "./scope/index.js";
2
- import { lock } from "./lock.js";
3
- describe("Lock", () => {
4
- it("prevents reentry", function () {
5
- let count = 0;
6
- const inc = lock(function () {
7
- if (count > 4) {
8
- return;
9
- }
10
- inc();
11
- count++;
12
- });
13
- inc();
14
- expect(count).toBe(1);
15
- });
16
- });
1
+ import { describe, it, expect } from "./scope/index.js";
2
+ import { lock } from "./lock.js";
3
+ describe("Lock", () => {
4
+ it("prevents reentry", function () {
5
+ let count = 0;
6
+ const inc = lock(function () {
7
+ if (count > 4) {
8
+ return;
9
+ }
10
+ inc();
11
+ count++;
12
+ });
13
+ inc();
14
+ expect(count).toBe(1);
15
+ });
16
+ });
@@ -0,0 +1,26 @@
1
+ import { Display } from "./display.js";
2
+ export interface Log {
3
+ (message: Display, data?: {}): void;
4
+ }
5
+ export interface Logger {
6
+ level: Number;
7
+ debug: Log;
8
+ info: Log;
9
+ warn: Log;
10
+ error: Log;
11
+ }
12
+ export declare const LEVEL: {
13
+ UNKNOWN: number;
14
+ SILENT: number;
15
+ DEBUG: number;
16
+ VERBOSE: number;
17
+ INFO: number;
18
+ WARN: number;
19
+ ERROR: number;
20
+ };
21
+ export declare function getLogger(name: string): Logger;
22
+ export declare const DEFAULT_LOGGER: Logger;
23
+ export declare function debug(message: Display, data?: {}): void;
24
+ export declare function info(message: Display, data?: {}): void;
25
+ export declare function warn(message: Display, data?: {}): void;
26
+ export declare function error(message: Display, data?: {}): void;
@@ -1,46 +1,46 @@
1
- import { display } from "./display.js";
2
- export const LEVEL = {
3
- UNKNOWN: 0,
4
- SILENT: 0,
5
- DEBUG: 1,
6
- VERBOSE: 1,
7
- INFO: 2,
8
- WARN: 3,
9
- ERROR: 4,
10
- };
11
- export function getLogger(name) {
12
- const logger = { level: LEVEL.INFO };
13
- const logAt = (level, fn) => (message, data) => level >= (logger.level ?? LEVEL.SILENT)
14
- ? fn(display(message), data)
15
- : undefined;
16
- logger.debug = logAt(LEVEL.VERBOSE, console.debug.bind(console));
17
- logger.info = logAt(LEVEL.INFO, console.info.bind(console));
18
- logger.warn = logAt(LEVEL.WARN, console.warn.bind(console));
19
- logger.error = logAt(LEVEL.ERROR, console.error.bind(console));
20
- return logger;
21
- }
22
- export const DEFAULT_LOGGER = getLogger("default");
23
- export function debug(message, data) {
24
- if (data)
25
- DEFAULT_LOGGER.debug(message, data);
26
- else
27
- DEFAULT_LOGGER.debug(message);
28
- }
29
- export function info(message, data) {
30
- if (data)
31
- DEFAULT_LOGGER.info(message, data);
32
- else
33
- DEFAULT_LOGGER.info(message);
34
- }
35
- export function warn(message, data) {
36
- if (data)
37
- DEFAULT_LOGGER.warn(message, data);
38
- else
39
- DEFAULT_LOGGER.warn(message);
40
- }
41
- export function error(message, data) {
42
- if (data)
43
- DEFAULT_LOGGER.error(message, data);
44
- else
45
- DEFAULT_LOGGER.error(message);
46
- }
1
+ import { display } from "./display.js";
2
+ export const LEVEL = {
3
+ UNKNOWN: 0,
4
+ SILENT: 0,
5
+ DEBUG: 1,
6
+ VERBOSE: 1,
7
+ INFO: 2,
8
+ WARN: 3,
9
+ ERROR: 4,
10
+ };
11
+ export function getLogger(name) {
12
+ const logger = { level: LEVEL.INFO };
13
+ const logAt = (level, fn) => (message, data) => level >= (logger.level ?? LEVEL.SILENT)
14
+ ? fn(display(message), data)
15
+ : undefined;
16
+ logger.debug = logAt(LEVEL.VERBOSE, console.debug.bind(console));
17
+ logger.info = logAt(LEVEL.INFO, console.info.bind(console));
18
+ logger.warn = logAt(LEVEL.WARN, console.warn.bind(console));
19
+ logger.error = logAt(LEVEL.ERROR, console.error.bind(console));
20
+ return logger;
21
+ }
22
+ export const DEFAULT_LOGGER = getLogger("default");
23
+ export function debug(message, data) {
24
+ if (data)
25
+ DEFAULT_LOGGER.debug(message, data);
26
+ else
27
+ DEFAULT_LOGGER.debug(message);
28
+ }
29
+ export function info(message, data) {
30
+ if (data)
31
+ DEFAULT_LOGGER.info(message, data);
32
+ else
33
+ DEFAULT_LOGGER.info(message);
34
+ }
35
+ export function warn(message, data) {
36
+ if (data)
37
+ DEFAULT_LOGGER.warn(message, data);
38
+ else
39
+ DEFAULT_LOGGER.warn(message);
40
+ }
41
+ export function error(message, data) {
42
+ if (data)
43
+ DEFAULT_LOGGER.error(message, data);
44
+ else
45
+ DEFAULT_LOGGER.error(message);
46
+ }
@@ -0,0 +1,35 @@
1
+ import { Observable } from "./observable.js";
2
+ export interface Next<T> {
3
+ value: T;
4
+ completed: false;
5
+ failed: false;
6
+ }
7
+ export interface Error<E> {
8
+ error: E;
9
+ completed: false;
10
+ failed: true;
11
+ }
12
+ export interface Completed {
13
+ completed: true;
14
+ failed: false;
15
+ }
16
+ export interface Failed {
17
+ completed: true;
18
+ failed: true;
19
+ }
20
+ export declare type Event<T, E> = Next<T> | Error<E> | Completed | Failed;
21
+ export interface EventSubscriber<T, E> {
22
+ next(e: Event<T, E>): void;
23
+ }
24
+ export declare const next: <T>(value: T) => Next<T>;
25
+ export declare const error: <E>(e: E) => Error<E>;
26
+ export declare const completed: () => Completed;
27
+ export declare const failed: () => Failed;
28
+ export declare const isNext: <T>(event: Event<T, unknown>) => event is Next<T>;
29
+ export declare const isError: <E>(event: Event<unknown, E>) => event is Error<E>;
30
+ export declare const isCompleted: (event: Event<unknown, unknown>) => event is Completed;
31
+ export declare const isFailed: (event: Event<unknown, unknown>) => event is Failed;
32
+ export declare const isEvent: <T, E>(t: T | Event<T, E>) => t is Event<T, E>;
33
+ export declare const asEvents: <T, E>(a: (T | Event<T, E>)[]) => Event<T, E>[];
34
+ export declare const marbles: <T, E>(events: Event<T, E>[]) => string;
35
+ export declare const collect: <T, E>(input$: Observable<T, E>) => Event<T, E>[];
@@ -0,0 +1,46 @@
1
+ import { display } from "../display.js";
2
+ export const next = (value) => ({
3
+ value,
4
+ completed: false,
5
+ failed: false,
6
+ });
7
+ export const error = (e) => ({
8
+ error: e,
9
+ completed: false,
10
+ failed: true,
11
+ });
12
+ export const completed = () => ({ completed: true, failed: false });
13
+ export const failed = () => ({ completed: true, failed: true });
14
+ export const isNext = (event) => !event.completed && !event.failed && event.value !== undefined;
15
+ export const isError = (event) => event.failed && !event.completed;
16
+ export const isCompleted = (event) => event.completed && !event.failed;
17
+ export const isFailed = (event) => event.completed && event.failed;
18
+ export const isEvent = (t) => {
19
+ const b = t;
20
+ return isNext(b) || isError(b) || isCompleted(b);
21
+ };
22
+ export const asEvents = (a) => a.map((e) => (isEvent(e) ? e : next(e)));
23
+ const marble = (event) => isError(event)
24
+ ? "X"
25
+ : isFailed(event)
26
+ ? "!"
27
+ : isCompleted(event)
28
+ ? "|"
29
+ : `(${display(event.value)})`;
30
+ export const marbles = (events) => `:${events.map(marble).join("-")}`;
31
+ export const collect = (input$) => {
32
+ const collected = [];
33
+ const subscription = input$.subscribe({
34
+ next: (x) => {
35
+ collected.push(next(x));
36
+ },
37
+ error: (e) => {
38
+ collected.push(error(e));
39
+ },
40
+ complete: () => {
41
+ collected.push(completed());
42
+ },
43
+ });
44
+ subscription.unsubscribe();
45
+ return collected;
46
+ };