mikrojs 0.0.0 → 0.0.8

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 (497) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/bin/mikrojs.js +3 -0
  4. package/dist/_exports/ble.d.ts +3 -0
  5. package/dist/_exports/ble.d.ts.map +1 -0
  6. package/dist/_exports/ble.js +2 -0
  7. package/dist/_exports/ble.js.map +1 -0
  8. package/dist/_exports/cbor.d.ts +3 -0
  9. package/dist/_exports/cbor.d.ts.map +1 -0
  10. package/dist/_exports/cbor.js +2 -0
  11. package/dist/_exports/cbor.js.map +1 -0
  12. package/dist/_exports/console.d.ts +2 -0
  13. package/dist/_exports/console.d.ts.map +1 -0
  14. package/dist/_exports/console.js +2 -0
  15. package/dist/_exports/console.js.map +1 -0
  16. package/dist/_exports/env.d.ts +2 -0
  17. package/dist/_exports/env.d.ts.map +1 -0
  18. package/dist/_exports/env.js +2 -0
  19. package/dist/_exports/env.js.map +1 -0
  20. package/dist/_exports/format.d.ts +2 -0
  21. package/dist/_exports/format.d.ts.map +1 -0
  22. package/dist/_exports/format.js +2 -0
  23. package/dist/_exports/format.js.map +1 -0
  24. package/dist/_exports/fs.d.ts +2 -0
  25. package/dist/_exports/fs.d.ts.map +1 -0
  26. package/dist/_exports/fs.js +2 -0
  27. package/dist/_exports/fs.js.map +1 -0
  28. package/dist/_exports/http/helpers.d.ts +3 -0
  29. package/dist/_exports/http/helpers.d.ts.map +1 -0
  30. package/dist/_exports/http/helpers.js +5 -0
  31. package/dist/_exports/http/helpers.js.map +1 -0
  32. package/dist/_exports/http/request.d.ts +4 -0
  33. package/dist/_exports/http/request.d.ts.map +1 -0
  34. package/dist/_exports/http/request.js +10 -0
  35. package/dist/_exports/http/request.js.map +1 -0
  36. package/dist/_exports/i2c.d.ts +2 -0
  37. package/dist/_exports/i2c.d.ts.map +1 -0
  38. package/dist/_exports/i2c.js +2 -0
  39. package/dist/_exports/i2c.js.map +1 -0
  40. package/dist/_exports/index.d.ts +61 -0
  41. package/dist/_exports/index.d.ts.map +1 -0
  42. package/dist/_exports/index.js +4 -0
  43. package/dist/_exports/index.js.map +1 -0
  44. package/dist/_exports/inspect.d.ts +2 -0
  45. package/dist/_exports/inspect.d.ts.map +1 -0
  46. package/dist/_exports/inspect.js +2 -0
  47. package/dist/_exports/inspect.js.map +1 -0
  48. package/dist/_exports/kv/nvs.d.ts +3 -0
  49. package/dist/_exports/kv/nvs.d.ts.map +1 -0
  50. package/dist/_exports/kv/nvs.js +2 -0
  51. package/dist/_exports/kv/nvs.js.map +1 -0
  52. package/dist/_exports/kv/rtc.d.ts +3 -0
  53. package/dist/_exports/kv/rtc.d.ts.map +1 -0
  54. package/dist/_exports/kv/rtc.js +2 -0
  55. package/dist/_exports/kv/rtc.js.map +1 -0
  56. package/dist/_exports/neopixel.d.ts +2 -0
  57. package/dist/_exports/neopixel.d.ts.map +1 -0
  58. package/dist/_exports/neopixel.js +2 -0
  59. package/dist/_exports/neopixel.js.map +1 -0
  60. package/dist/_exports/pin.d.ts +2 -0
  61. package/dist/_exports/pin.d.ts.map +1 -0
  62. package/dist/_exports/pin.js +2 -0
  63. package/dist/_exports/pin.js.map +1 -0
  64. package/dist/_exports/pwm.d.ts +2 -0
  65. package/dist/_exports/pwm.d.ts.map +1 -0
  66. package/dist/_exports/pwm.js +2 -0
  67. package/dist/_exports/pwm.js.map +1 -0
  68. package/dist/_exports/reader.d.ts +2 -0
  69. package/dist/_exports/reader.d.ts.map +1 -0
  70. package/dist/_exports/reader.js +2 -0
  71. package/dist/_exports/reader.js.map +1 -0
  72. package/dist/_exports/result.d.ts +2 -0
  73. package/dist/_exports/result.d.ts.map +1 -0
  74. package/dist/_exports/result.js +2 -0
  75. package/dist/_exports/result.js.map +1 -0
  76. package/dist/_exports/schema.d.ts +2 -0
  77. package/dist/_exports/schema.d.ts.map +1 -0
  78. package/dist/_exports/schema.js +2 -0
  79. package/dist/_exports/schema.js.map +1 -0
  80. package/dist/_exports/sim.d.ts +199 -0
  81. package/dist/_exports/sim.d.ts.map +1 -0
  82. package/dist/_exports/sim.js +8 -0
  83. package/dist/_exports/sim.js.map +1 -0
  84. package/dist/_exports/sleep.d.ts +2 -0
  85. package/dist/_exports/sleep.d.ts.map +1 -0
  86. package/dist/_exports/sleep.js +2 -0
  87. package/dist/_exports/sleep.js.map +1 -0
  88. package/dist/_exports/sntp.d.ts +3 -0
  89. package/dist/_exports/sntp.d.ts.map +1 -0
  90. package/dist/_exports/sntp.js +2 -0
  91. package/dist/_exports/sntp.js.map +1 -0
  92. package/dist/_exports/spi.d.ts +2 -0
  93. package/dist/_exports/spi.d.ts.map +1 -0
  94. package/dist/_exports/spi.js +2 -0
  95. package/dist/_exports/spi.js.map +1 -0
  96. package/dist/_exports/stdio.d.ts +2 -0
  97. package/dist/_exports/stdio.d.ts.map +1 -0
  98. package/dist/_exports/stdio.js +2 -0
  99. package/dist/_exports/stdio.js.map +1 -0
  100. package/dist/_exports/stream.d.ts +2 -0
  101. package/dist/_exports/stream.d.ts.map +1 -0
  102. package/dist/_exports/stream.js +2 -0
  103. package/dist/_exports/stream.js.map +1 -0
  104. package/dist/_exports/sys.d.ts +2 -0
  105. package/dist/_exports/sys.d.ts.map +1 -0
  106. package/dist/_exports/sys.js +2 -0
  107. package/dist/_exports/sys.js.map +1 -0
  108. package/dist/_exports/test.d.ts +2 -0
  109. package/dist/_exports/test.d.ts.map +1 -0
  110. package/dist/_exports/test.js +2 -0
  111. package/dist/_exports/test.js.map +1 -0
  112. package/dist/_exports/uart.d.ts +2 -0
  113. package/dist/_exports/uart.d.ts.map +1 -0
  114. package/dist/_exports/uart.js +2 -0
  115. package/dist/_exports/uart.js.map +1 -0
  116. package/dist/_exports/wifi.d.ts +3 -0
  117. package/dist/_exports/wifi.d.ts.map +1 -0
  118. package/dist/_exports/wifi.js +2 -0
  119. package/dist/_exports/wifi.js.map +1 -0
  120. package/dist/cli/cli.d.ts +3 -0
  121. package/dist/cli/cli.d.ts.map +1 -0
  122. package/dist/cli/cli.js +215 -0
  123. package/dist/cli/cli.js.map +1 -0
  124. package/dist/cli/cliWrapper.d.ts +3 -0
  125. package/dist/cli/cliWrapper.d.ts.map +1 -0
  126. package/dist/cli/cliWrapper.js +40 -0
  127. package/dist/cli/cliWrapper.js.map +1 -0
  128. package/dist/cli/commands/build-runtime.d.ts +14 -0
  129. package/dist/cli/commands/build-runtime.d.ts.map +1 -0
  130. package/dist/cli/commands/build-runtime.js +122 -0
  131. package/dist/cli/commands/build-runtime.js.map +1 -0
  132. package/dist/cli/commands/build.d.ts +31 -0
  133. package/dist/cli/commands/build.d.ts.map +1 -0
  134. package/dist/cli/commands/build.js +145 -0
  135. package/dist/cli/commands/build.js.map +1 -0
  136. package/dist/cli/commands/clean.d.ts +16 -0
  137. package/dist/cli/commands/clean.d.ts.map +1 -0
  138. package/dist/cli/commands/clean.js +148 -0
  139. package/dist/cli/commands/clean.js.map +1 -0
  140. package/dist/cli/commands/console.d.ts +19 -0
  141. package/dist/cli/commands/console.d.ts.map +1 -0
  142. package/dist/cli/commands/console.js +32 -0
  143. package/dist/cli/commands/console.js.map +1 -0
  144. package/dist/cli/commands/deploy.d.ts +63 -0
  145. package/dist/cli/commands/deploy.d.ts.map +1 -0
  146. package/dist/cli/commands/deploy.js +242 -0
  147. package/dist/cli/commands/deploy.js.map +1 -0
  148. package/dist/cli/commands/dev.d.ts +41 -0
  149. package/dist/cli/commands/dev.d.ts.map +1 -0
  150. package/dist/cli/commands/dev.js +170 -0
  151. package/dist/cli/commands/dev.js.map +1 -0
  152. package/dist/cli/commands/docs.d.ts +7 -0
  153. package/dist/cli/commands/docs.d.ts.map +1 -0
  154. package/dist/cli/commands/docs.js +20 -0
  155. package/dist/cli/commands/docs.js.map +1 -0
  156. package/dist/cli/commands/env.d.ts +59 -0
  157. package/dist/cli/commands/env.d.ts.map +1 -0
  158. package/dist/cli/commands/env.js +257 -0
  159. package/dist/cli/commands/env.js.map +1 -0
  160. package/dist/cli/commands/erase.d.ts +18 -0
  161. package/dist/cli/commands/erase.d.ts.map +1 -0
  162. package/dist/cli/commands/erase.js +90 -0
  163. package/dist/cli/commands/erase.js.map +1 -0
  164. package/dist/cli/commands/flash.d.ts +30 -0
  165. package/dist/cli/commands/flash.d.ts.map +1 -0
  166. package/dist/cli/commands/flash.js +243 -0
  167. package/dist/cli/commands/flash.js.map +1 -0
  168. package/dist/cli/commands/home.d.ts +7 -0
  169. package/dist/cli/commands/home.d.ts.map +1 -0
  170. package/dist/cli/commands/home.js +20 -0
  171. package/dist/cli/commands/home.js.map +1 -0
  172. package/dist/cli/commands/ls.d.ts +17 -0
  173. package/dist/cli/commands/ls.d.ts.map +1 -0
  174. package/dist/cli/commands/ls.js +62 -0
  175. package/dist/cli/commands/ls.js.map +1 -0
  176. package/dist/cli/commands/sim/clean.d.ts +7 -0
  177. package/dist/cli/commands/sim/clean.d.ts.map +1 -0
  178. package/dist/cli/commands/sim/clean.js +34 -0
  179. package/dist/cli/commands/sim/clean.js.map +1 -0
  180. package/dist/cli/commands/sim/deploy.d.ts +46 -0
  181. package/dist/cli/commands/sim/deploy.d.ts.map +1 -0
  182. package/dist/cli/commands/sim/deploy.js +127 -0
  183. package/dist/cli/commands/sim/deploy.js.map +1 -0
  184. package/dist/cli/commands/sim/dev.d.ts +52 -0
  185. package/dist/cli/commands/sim/dev.d.ts.map +1 -0
  186. package/dist/cli/commands/sim/dev.js +380 -0
  187. package/dist/cli/commands/sim/dev.js.map +1 -0
  188. package/dist/cli/commands/sim/env.d.ts +56 -0
  189. package/dist/cli/commands/sim/env.d.ts.map +1 -0
  190. package/dist/cli/commands/sim/env.js +204 -0
  191. package/dist/cli/commands/sim/env.js.map +1 -0
  192. package/dist/cli/commands/sim/profile.d.ts +67 -0
  193. package/dist/cli/commands/sim/profile.d.ts.map +1 -0
  194. package/dist/cli/commands/sim/profile.js +356 -0
  195. package/dist/cli/commands/sim/profile.js.map +1 -0
  196. package/dist/cli/commands/sim/repl.d.ts +16 -0
  197. package/dist/cli/commands/sim/repl.d.ts.map +1 -0
  198. package/dist/cli/commands/sim/repl.js +119 -0
  199. package/dist/cli/commands/sim/repl.js.map +1 -0
  200. package/dist/cli/commands/sim/reset.d.ts +11 -0
  201. package/dist/cli/commands/sim/reset.d.ts.map +1 -0
  202. package/dist/cli/commands/sim/reset.js +59 -0
  203. package/dist/cli/commands/sim/reset.js.map +1 -0
  204. package/dist/cli/commands/sim/scaffold.d.ts +11 -0
  205. package/dist/cli/commands/sim/scaffold.d.ts.map +1 -0
  206. package/dist/cli/commands/sim/scaffold.js +41 -0
  207. package/dist/cli/commands/sim/scaffold.js.map +1 -0
  208. package/dist/cli/commands/sim/test.d.ts +49 -0
  209. package/dist/cli/commands/sim/test.d.ts.map +1 -0
  210. package/dist/cli/commands/sim/test.js +364 -0
  211. package/dist/cli/commands/sim/test.js.map +1 -0
  212. package/dist/cli/commands/sim.d.ts +228 -0
  213. package/dist/cli/commands/sim.d.ts.map +1 -0
  214. package/dist/cli/commands/sim.js +69 -0
  215. package/dist/cli/commands/sim.js.map +1 -0
  216. package/dist/cli/commands/tail.d.ts +14 -0
  217. package/dist/cli/commands/tail.d.ts.map +1 -0
  218. package/dist/cli/commands/tail.js +50 -0
  219. package/dist/cli/commands/tail.js.map +1 -0
  220. package/dist/cli/commands/test.d.ts +39 -0
  221. package/dist/cli/commands/test.d.ts.map +1 -0
  222. package/dist/cli/commands/test.js +432 -0
  223. package/dist/cli/commands/test.js.map +1 -0
  224. package/dist/cli/components/DevicePicker.d.ts +9 -0
  225. package/dist/cli/components/DevicePicker.d.ts.map +1 -0
  226. package/dist/cli/components/DevicePicker.js +71 -0
  227. package/dist/cli/components/DevicePicker.js.map +1 -0
  228. package/dist/cli/components/EnvEditor.d.ts +12 -0
  229. package/dist/cli/components/EnvEditor.d.ts.map +1 -0
  230. package/dist/cli/components/EnvEditor.js +201 -0
  231. package/dist/cli/components/EnvEditor.js.map +1 -0
  232. package/dist/cli/components/TextInput.d.ts +28 -0
  233. package/dist/cli/components/TextInput.d.ts.map +1 -0
  234. package/dist/cli/components/TextInput.js +73 -0
  235. package/dist/cli/components/TextInput.js.map +1 -0
  236. package/dist/cli/components/TitledBox.d.ts +27 -0
  237. package/dist/cli/components/TitledBox.d.ts.map +1 -0
  238. package/dist/cli/components/TitledBox.js +111 -0
  239. package/dist/cli/components/TitledBox.js.map +1 -0
  240. package/dist/cli/hooks/useDevices.d.ts +23 -0
  241. package/dist/cli/hooks/useDevices.d.ts.map +1 -0
  242. package/dist/cli/hooks/useDevices.js +19 -0
  243. package/dist/cli/hooks/useDevices.js.map +1 -0
  244. package/dist/cli/lib/RenderAndExit.d.ts +6 -0
  245. package/dist/cli/lib/RenderAndExit.d.ts.map +1 -0
  246. package/dist/cli/lib/RenderAndExit.js +8 -0
  247. package/dist/cli/lib/RenderAndExit.js.map +1 -0
  248. package/dist/cli/lib/Spinner.d.ts +11 -0
  249. package/dist/cli/lib/Spinner.d.ts.map +1 -0
  250. package/dist/cli/lib/Spinner.js +22 -0
  251. package/dist/cli/lib/Spinner.js.map +1 -0
  252. package/dist/cli/lib/agent.d.ts +38 -0
  253. package/dist/cli/lib/agent.d.ts.map +1 -0
  254. package/dist/cli/lib/agent.js +87 -0
  255. package/dist/cli/lib/agent.js.map +1 -0
  256. package/dist/cli/lib/boards.d.ts +23 -0
  257. package/dist/cli/lib/boards.d.ts.map +1 -0
  258. package/dist/cli/lib/boards.js +67 -0
  259. package/dist/cli/lib/boards.js.map +1 -0
  260. package/dist/cli/lib/build.d.ts +47 -0
  261. package/dist/cli/lib/build.d.ts.map +1 -0
  262. package/dist/cli/lib/build.js +533 -0
  263. package/dist/cli/lib/build.js.map +1 -0
  264. package/dist/cli/lib/connectSim.d.ts +21 -0
  265. package/dist/cli/lib/connectSim.d.ts.map +1 -0
  266. package/dist/cli/lib/connectSim.js +20 -0
  267. package/dist/cli/lib/connectSim.js.map +1 -0
  268. package/dist/cli/lib/deploy.d.ts +42 -0
  269. package/dist/cli/lib/deploy.d.ts.map +1 -0
  270. package/dist/cli/lib/deploy.js +121 -0
  271. package/dist/cli/lib/deploy.js.map +1 -0
  272. package/dist/cli/lib/deployProgress.d.ts +8 -0
  273. package/dist/cli/lib/deployProgress.d.ts.map +1 -0
  274. package/dist/cli/lib/deployProgress.js +32 -0
  275. package/dist/cli/lib/deployProgress.js.map +1 -0
  276. package/dist/cli/lib/dotenv.d.ts +16 -0
  277. package/dist/cli/lib/dotenv.d.ts.map +1 -0
  278. package/dist/cli/lib/dotenv.js +33 -0
  279. package/dist/cli/lib/dotenv.js.map +1 -0
  280. package/dist/cli/lib/esbuild.d.ts +7 -0
  281. package/dist/cli/lib/esbuild.d.ts.map +1 -0
  282. package/dist/cli/lib/esbuild.js +15 -0
  283. package/dist/cli/lib/esbuild.js.map +1 -0
  284. package/dist/cli/lib/esptool.d.ts +41 -0
  285. package/dist/cli/lib/esptool.d.ts.map +1 -0
  286. package/dist/cli/lib/esptool.js +43 -0
  287. package/dist/cli/lib/esptool.js.map +1 -0
  288. package/dist/cli/lib/firmware.d.ts +24 -0
  289. package/dist/cli/lib/firmware.d.ts.map +1 -0
  290. package/dist/cli/lib/firmware.js +406 -0
  291. package/dist/cli/lib/firmware.js.map +1 -0
  292. package/dist/cli/lib/firmwareCompat.d.ts +19 -0
  293. package/dist/cli/lib/firmwareCompat.d.ts.map +1 -0
  294. package/dist/cli/lib/firmwareCompat.js +31 -0
  295. package/dist/cli/lib/firmwareCompat.js.map +1 -0
  296. package/dist/cli/lib/heapBaseline.d.ts +15 -0
  297. package/dist/cli/lib/heapBaseline.d.ts.map +1 -0
  298. package/dist/cli/lib/heapBaseline.js +39 -0
  299. package/dist/cli/lib/heapBaseline.js.map +1 -0
  300. package/dist/cli/lib/ink-table/index.d.ts +88 -0
  301. package/dist/cli/lib/ink-table/index.d.ts.map +1 -0
  302. package/dist/cli/lib/ink-table/index.js +217 -0
  303. package/dist/cli/lib/ink-table/index.js.map +1 -0
  304. package/dist/cli/lib/loadMikroConfig.d.ts +7 -0
  305. package/dist/cli/lib/loadMikroConfig.d.ts.map +1 -0
  306. package/dist/cli/lib/loadMikroConfig.js +26 -0
  307. package/dist/cli/lib/loadMikroConfig.js.map +1 -0
  308. package/dist/cli/lib/minify.d.ts +3 -0
  309. package/dist/cli/lib/minify.d.ts.map +1 -0
  310. package/dist/cli/lib/minify.js +89 -0
  311. package/dist/cli/lib/minify.js.map +1 -0
  312. package/dist/cli/lib/openSim.d.ts +29 -0
  313. package/dist/cli/lib/openSim.d.ts.map +1 -0
  314. package/dist/cli/lib/openSim.js +32 -0
  315. package/dist/cli/lib/openSim.js.map +1 -0
  316. package/dist/cli/lib/ospawn.d.ts +34 -0
  317. package/dist/cli/lib/ospawn.d.ts.map +1 -0
  318. package/dist/cli/lib/ospawn.js +90 -0
  319. package/dist/cli/lib/ospawn.js.map +1 -0
  320. package/dist/cli/lib/parseMinifier.d.ts +10 -0
  321. package/dist/cli/lib/parseMinifier.d.ts.map +1 -0
  322. package/dist/cli/lib/parseMinifier.js +49 -0
  323. package/dist/cli/lib/parseMinifier.js.map +1 -0
  324. package/dist/cli/lib/parseSize.d.ts +6 -0
  325. package/dist/cli/lib/parseSize.d.ts.map +1 -0
  326. package/dist/cli/lib/parseSize.js +25 -0
  327. package/dist/cli/lib/parseSize.js.map +1 -0
  328. package/dist/cli/lib/projectRoot.d.ts +11 -0
  329. package/dist/cli/lib/projectRoot.d.ts.map +1 -0
  330. package/dist/cli/lib/projectRoot.js +28 -0
  331. package/dist/cli/lib/projectRoot.js.map +1 -0
  332. package/dist/cli/lib/protocol.d.ts +144 -0
  333. package/dist/cli/lib/protocol.d.ts.map +1 -0
  334. package/dist/cli/lib/protocol.js +385 -0
  335. package/dist/cli/lib/protocol.js.map +1 -0
  336. package/dist/cli/lib/recover.d.ts +25 -0
  337. package/dist/cli/lib/recover.d.ts.map +1 -0
  338. package/dist/cli/lib/recover.js +144 -0
  339. package/dist/cli/lib/recover.js.map +1 -0
  340. package/dist/cli/lib/resolveEntry.d.ts +7 -0
  341. package/dist/cli/lib/resolveEntry.d.ts.map +1 -0
  342. package/dist/cli/lib/resolveEntry.js +30 -0
  343. package/dist/cli/lib/resolveEntry.js.map +1 -0
  344. package/dist/cli/lib/runHooks.d.ts +34 -0
  345. package/dist/cli/lib/runHooks.d.ts.map +1 -0
  346. package/dist/cli/lib/runHooks.js +90 -0
  347. package/dist/cli/lib/runHooks.js.map +1 -0
  348. package/dist/cli/lib/serial/InkReplConsole.d.ts +27 -0
  349. package/dist/cli/lib/serial/InkReplConsole.d.ts.map +1 -0
  350. package/dist/cli/lib/serial/InkReplConsole.js +24 -0
  351. package/dist/cli/lib/serial/InkReplConsole.js.map +1 -0
  352. package/dist/cli/lib/serial/InkReplMode.d.ts +38 -0
  353. package/dist/cli/lib/serial/InkReplMode.d.ts.map +1 -0
  354. package/dist/cli/lib/serial/InkReplMode.js +90 -0
  355. package/dist/cli/lib/serial/InkReplMode.js.map +1 -0
  356. package/dist/cli/lib/serial/ReplConsole.d.ts +21 -0
  357. package/dist/cli/lib/serial/ReplConsole.d.ts.map +1 -0
  358. package/dist/cli/lib/serial/ReplConsole.js +249 -0
  359. package/dist/cli/lib/serial/ReplConsole.js.map +1 -0
  360. package/dist/cli/lib/serial/devSession.d.ts +57 -0
  361. package/dist/cli/lib/serial/devSession.d.ts.map +1 -0
  362. package/dist/cli/lib/serial/devSession.js +160 -0
  363. package/dist/cli/lib/serial/devSession.js.map +1 -0
  364. package/dist/cli/lib/serial/dispatchReplCommand.d.ts +25 -0
  365. package/dist/cli/lib/serial/dispatchReplCommand.d.ts.map +1 -0
  366. package/dist/cli/lib/serial/dispatchReplCommand.js +27 -0
  367. package/dist/cli/lib/serial/dispatchReplCommand.js.map +1 -0
  368. package/dist/cli/lib/serial/openSession.d.ts +28 -0
  369. package/dist/cli/lib/serial/openSession.d.ts.map +1 -0
  370. package/dist/cli/lib/serial/openSession.js +48 -0
  371. package/dist/cli/lib/serial/openSession.js.map +1 -0
  372. package/dist/cli/lib/serial/replStateMachine.d.ts +169 -0
  373. package/dist/cli/lib/serial/replStateMachine.d.ts.map +1 -0
  374. package/dist/cli/lib/serial/replStateMachine.js +657 -0
  375. package/dist/cli/lib/serial/replStateMachine.js.map +1 -0
  376. package/dist/cli/lib/serial/runAgentRepl.d.ts +33 -0
  377. package/dist/cli/lib/serial/runAgentRepl.d.ts.map +1 -0
  378. package/dist/cli/lib/serial/runAgentRepl.js +80 -0
  379. package/dist/cli/lib/serial/runAgentRepl.js.map +1 -0
  380. package/dist/cli/lib/session.d.ts +163 -0
  381. package/dist/cli/lib/session.d.ts.map +1 -0
  382. package/dist/cli/lib/session.js +490 -0
  383. package/dist/cli/lib/session.js.map +1 -0
  384. package/dist/cli/lib/simConfig.d.ts +15 -0
  385. package/dist/cli/lib/simConfig.d.ts.map +1 -0
  386. package/dist/cli/lib/simConfig.js +25 -0
  387. package/dist/cli/lib/simConfig.js.map +1 -0
  388. package/dist/cli/lib/simPid.d.ts +30 -0
  389. package/dist/cli/lib/simPid.d.ts.map +1 -0
  390. package/dist/cli/lib/simPid.js +120 -0
  391. package/dist/cli/lib/simPid.js.map +1 -0
  392. package/dist/cli/lib/simTransport.d.ts +17 -0
  393. package/dist/cli/lib/simTransport.d.ts.map +1 -0
  394. package/dist/cli/lib/simTransport.js +80 -0
  395. package/dist/cli/lib/simTransport.js.map +1 -0
  396. package/dist/cli/lib/testRunner.d.ts +86 -0
  397. package/dist/cli/lib/testRunner.d.ts.map +1 -0
  398. package/dist/cli/lib/testRunner.js +469 -0
  399. package/dist/cli/lib/testRunner.js.map +1 -0
  400. package/dist/cli/lib/transport.d.ts +34 -0
  401. package/dist/cli/lib/transport.d.ts.map +1 -0
  402. package/dist/cli/lib/transport.js +117 -0
  403. package/dist/cli/lib/transport.js.map +1 -0
  404. package/dist/cli/lib/useObservable.d.ts +4 -0
  405. package/dist/cli/lib/useObservable.d.ts.map +1 -0
  406. package/dist/cli/lib/useObservable.js +22 -0
  407. package/dist/cli/lib/useObservable.js.map +1 -0
  408. package/dist/cli/lib/watcher.d.ts +10 -0
  409. package/dist/cli/lib/watcher.d.ts.map +1 -0
  410. package/dist/cli/lib/watcher.js +34 -0
  411. package/dist/cli/lib/watcher.js.map +1 -0
  412. package/dist/constants.d.ts +13 -0
  413. package/dist/constants.d.ts.map +1 -0
  414. package/dist/constants.js +27 -0
  415. package/dist/constants.js.map +1 -0
  416. package/dist/simulator/builtins/ble.d.ts +3 -0
  417. package/dist/simulator/builtins/ble.d.ts.map +1 -0
  418. package/dist/simulator/builtins/ble.js +46 -0
  419. package/dist/simulator/builtins/ble.js.map +1 -0
  420. package/dist/simulator/builtins/console.d.ts +8 -0
  421. package/dist/simulator/builtins/console.d.ts.map +1 -0
  422. package/dist/simulator/builtins/console.js +24 -0
  423. package/dist/simulator/builtins/console.js.map +1 -0
  424. package/dist/simulator/builtins/http.d.ts +3 -0
  425. package/dist/simulator/builtins/http.d.ts.map +1 -0
  426. package/dist/simulator/builtins/http.js +90 -0
  427. package/dist/simulator/builtins/http.js.map +1 -0
  428. package/dist/simulator/builtins/i2c.d.ts +3 -0
  429. package/dist/simulator/builtins/i2c.d.ts.map +1 -0
  430. package/dist/simulator/builtins/i2c.js +17 -0
  431. package/dist/simulator/builtins/i2c.js.map +1 -0
  432. package/dist/simulator/builtins/index.d.ts +7 -0
  433. package/dist/simulator/builtins/index.d.ts.map +1 -0
  434. package/dist/simulator/builtins/index.js +49 -0
  435. package/dist/simulator/builtins/index.js.map +1 -0
  436. package/dist/simulator/builtins/kv.d.ts +3 -0
  437. package/dist/simulator/builtins/kv.d.ts.map +1 -0
  438. package/dist/simulator/builtins/kv.js +39 -0
  439. package/dist/simulator/builtins/kv.js.map +1 -0
  440. package/dist/simulator/builtins/neopixel.d.ts +3 -0
  441. package/dist/simulator/builtins/neopixel.d.ts.map +1 -0
  442. package/dist/simulator/builtins/neopixel.js +15 -0
  443. package/dist/simulator/builtins/neopixel.js.map +1 -0
  444. package/dist/simulator/builtins/nvs-kv.d.ts +3 -0
  445. package/dist/simulator/builtins/nvs-kv.d.ts.map +1 -0
  446. package/dist/simulator/builtins/nvs-kv.js +69 -0
  447. package/dist/simulator/builtins/nvs-kv.js.map +1 -0
  448. package/dist/simulator/builtins/pin.d.ts +3 -0
  449. package/dist/simulator/builtins/pin.d.ts.map +1 -0
  450. package/dist/simulator/builtins/pin.js +32 -0
  451. package/dist/simulator/builtins/pin.js.map +1 -0
  452. package/dist/simulator/builtins/pwm.d.ts +3 -0
  453. package/dist/simulator/builtins/pwm.d.ts.map +1 -0
  454. package/dist/simulator/builtins/pwm.js +31 -0
  455. package/dist/simulator/builtins/pwm.js.map +1 -0
  456. package/dist/simulator/builtins/sleep.d.ts +3 -0
  457. package/dist/simulator/builtins/sleep.d.ts.map +1 -0
  458. package/dist/simulator/builtins/sleep.js +33 -0
  459. package/dist/simulator/builtins/sleep.js.map +1 -0
  460. package/dist/simulator/builtins/sntp.d.ts +3 -0
  461. package/dist/simulator/builtins/sntp.d.ts.map +1 -0
  462. package/dist/simulator/builtins/sntp.js +14 -0
  463. package/dist/simulator/builtins/sntp.js.map +1 -0
  464. package/dist/simulator/builtins/spi.d.ts +3 -0
  465. package/dist/simulator/builtins/spi.d.ts.map +1 -0
  466. package/dist/simulator/builtins/spi.js +16 -0
  467. package/dist/simulator/builtins/spi.js.map +1 -0
  468. package/dist/simulator/builtins/types.d.ts +24 -0
  469. package/dist/simulator/builtins/types.d.ts.map +1 -0
  470. package/dist/simulator/builtins/types.js +2 -0
  471. package/dist/simulator/builtins/types.js.map +1 -0
  472. package/dist/simulator/builtins/uart.d.ts +3 -0
  473. package/dist/simulator/builtins/uart.d.ts.map +1 -0
  474. package/dist/simulator/builtins/uart.js +22 -0
  475. package/dist/simulator/builtins/uart.js.map +1 -0
  476. package/dist/simulator/builtins/wifi.d.ts +3 -0
  477. package/dist/simulator/builtins/wifi.d.ts.map +1 -0
  478. package/dist/simulator/builtins/wifi.js +55 -0
  479. package/dist/simulator/builtins/wifi.js.map +1 -0
  480. package/dist/simulator/devRunner.d.ts +41 -0
  481. package/dist/simulator/devRunner.d.ts.map +1 -0
  482. package/dist/simulator/devRunner.js +201 -0
  483. package/dist/simulator/devRunner.js.map +1 -0
  484. package/dist/simulator/loadSimStubs.d.ts +15 -0
  485. package/dist/simulator/loadSimStubs.d.ts.map +1 -0
  486. package/dist/simulator/loadSimStubs.js +54 -0
  487. package/dist/simulator/loadSimStubs.js.map +1 -0
  488. package/dist/simulator/simProcess.d.ts +11 -0
  489. package/dist/simulator/simProcess.d.ts.map +1 -0
  490. package/dist/simulator/simProcess.js +957 -0
  491. package/dist/simulator/simProcess.js.map +1 -0
  492. package/dist/simulator/simTemplates.d.ts +6 -0
  493. package/dist/simulator/simTemplates.d.ts.map +1 -0
  494. package/dist/simulator/simTemplates.js +21 -0
  495. package/dist/simulator/simTemplates.js.map +1 -0
  496. package/package.json +123 -2
  497. package/runtime.d.ts +95 -0
@@ -0,0 +1,4 @@
1
+ import type { Observable } from 'rxjs';
2
+ export declare function useObservable<T, U>(observable: Observable<T>, initialValue: U): T | U;
3
+ export declare function useObservable<T>(observable: Observable<T>): T | undefined;
4
+ //# sourceMappingURL=useObservable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useObservable.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/useObservable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,MAAM,CAAA;AAGpC,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACtF,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { tap } from 'rxjs/operators';
3
+ export function useObservable(observable, initialValue) {
4
+ const [state, setState] = useState(initialValue);
5
+ useEffect(() => {
6
+ const sub = observable
7
+ .pipe(tap({
8
+ error: (err) => {
9
+ setState(() => {
10
+ throw err;
11
+ });
12
+ },
13
+ next: (v) => setState(v),
14
+ }))
15
+ .subscribe();
16
+ return () => {
17
+ sub.unsubscribe();
18
+ };
19
+ }, [observable]);
20
+ return state;
21
+ }
22
+ //# sourceMappingURL=useObservable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useObservable.js","sourceRoot":"","sources":["../../../src/cli/lib/useObservable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAA;AAIlC,MAAM,UAAU,aAAa,CAC3B,UAAyB,EACzB,YAAgB;IAEhB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAoB,YAAY,CAAC,CAAA;IACnE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,GAAG,GAAG,UAAU;aACnB,IAAI,CACH,GAAG,CAAC;YACF,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;gBACb,QAAQ,CAAC,GAAG,EAAE;oBACZ,MAAM,GAAG,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC;YACD,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;SACzB,CAAC,CACH;aACA,SAAS,EAAE,CAAA;QAEd,OAAO,GAAG,EAAE;YACV,GAAG,CAAC,WAAW,EAAE,CAAA;QACnB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;IAEhB,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Subject } from 'rxjs';
2
+ export interface WatchEvent {
3
+ type: 'change' | 'rename';
4
+ filename: string | null;
5
+ }
6
+ export declare function createWatcher(dir: string, debounceMs?: number): {
7
+ changes$: Subject<WatchEvent[]>;
8
+ close: () => void;
9
+ };
10
+ //# sourceMappingURL=watcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/watcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAA;AAE5B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,UAAU,SAAM,GACf;IACD,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB,CAiCA"}
@@ -0,0 +1,34 @@
1
+ import { watch } from 'node:fs';
2
+ import { Subject } from 'rxjs';
3
+ export function createWatcher(dir, debounceMs = 200) {
4
+ const changes$ = new Subject();
5
+ let pending = [];
6
+ let timer = null;
7
+ const watcher = watch(dir, { recursive: true }, (eventType, filename) => {
8
+ // Ignore hidden files (covers .mikro/, .git/, etc)
9
+ if (filename && filename.startsWith('.')) {
10
+ return;
11
+ }
12
+ // Ignore node_modules
13
+ if (filename && filename.includes('node_modules')) {
14
+ return;
15
+ }
16
+ pending.push({ type: eventType, filename });
17
+ if (timer)
18
+ clearTimeout(timer);
19
+ timer = setTimeout(() => {
20
+ const batch = pending;
21
+ pending = [];
22
+ timer = null;
23
+ changes$.next(batch);
24
+ }, debounceMs);
25
+ });
26
+ const close = () => {
27
+ if (timer)
28
+ clearTimeout(timer);
29
+ watcher.close();
30
+ changes$.complete();
31
+ };
32
+ return { changes$, close };
33
+ }
34
+ //# sourceMappingURL=watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcher.js","sourceRoot":"","sources":["../../../src/cli/lib/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAA;AAO5B,MAAM,UAAU,aAAa,CAC3B,GAAW,EACX,UAAU,GAAG,GAAG;IAKhB,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAgB,CAAA;IAC5C,IAAI,OAAO,GAAiB,EAAE,CAAA;IAC9B,IAAI,KAAK,GAAyC,IAAI,CAAA;IAEtD,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE;QACpE,mDAAmD;QACnD,IAAI,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzC,OAAM;QACR,CAAC;QACD,sBAAsB;QACtB,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YAClD,OAAM;QACR,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,SAAgC,EAAE,QAAQ,EAAC,CAAC,CAAA;QAEhE,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,OAAO,CAAA;YACrB,OAAO,GAAG,EAAE,CAAA;YACZ,KAAK,GAAG,IAAI,CAAA;YACZ,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC,EAAE,UAAU,CAAC,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAA;QAC9B,OAAO,CAAC,KAAK,EAAE,CAAA;QACf,QAAQ,CAAC,QAAQ,EAAE,CAAA;IACrB,CAAC,CAAA;IAED,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAA;AAC1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const BUILTINS: string[];
2
+ /** Module patterns that are always firmware builtins (not deployed or bundled with user code).
3
+ * Shared by the CLI build/deploy and esbuild config. The same patterns are used in
4
+ * bundle-runtime.js (CMake build context) and must be kept in sync manually there.
5
+ * Note: @mikrojs/* packages are NOT automatically builtins. Only packages with native
6
+ * code (those that export ./cmake) are firmware builtins. Pure JS @mikrojs/* packages
7
+ * are bundled and deployed with the user's app. */
8
+ export declare const BUILTIN_EXTERNALS: string[];
9
+ /** Check if a module specifier matches a firmware builtin pattern.
10
+ * Note: @mikrojs/* packages are only builtins if they have native code.
11
+ * The trace resolver handles this dynamically by checking for ./cmake exports. */
12
+ export declare function isBuiltinModule(id: string): boolean;
13
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,UAYpB,CAAA;AAED;;;;;mDAKmD;AACnD,eAAO,MAAM,iBAAiB,UAAyC,CAAA;AAEvE;;kFAEkF;AAClF,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEnD"}
@@ -0,0 +1,27 @@
1
+ export const BUILTINS = [
2
+ 'cbor',
3
+ 'fetch',
4
+ 'fs',
5
+ 'pin',
6
+ 'i2c',
7
+ 'kv',
8
+ 'result',
9
+ 'schema',
10
+ 'sleep',
11
+ 'sys',
12
+ 'wifi',
13
+ ];
14
+ /** Module patterns that are always firmware builtins (not deployed or bundled with user code).
15
+ * Shared by the CLI build/deploy and esbuild config. The same patterns are used in
16
+ * bundle-runtime.js (CMake build context) and must be kept in sync manually there.
17
+ * Note: @mikrojs/* packages are NOT automatically builtins. Only packages with native
18
+ * code (those that export ./cmake) are firmware builtins. Pure JS @mikrojs/* packages
19
+ * are bundled and deployed with the user's app. */
20
+ export const BUILTIN_EXTERNALS = ['mikrojs', 'mikrojs/*', '@mikrojs/*'];
21
+ /** Check if a module specifier matches a firmware builtin pattern.
22
+ * Note: @mikrojs/* packages are only builtins if they have native code.
23
+ * The trace resolver handles this dynamically by checking for ./cmake exports. */
24
+ export function isBuiltinModule(id) {
25
+ return BUILTINS.includes(id) || id === 'mikrojs' || id.startsWith('mikrojs/');
26
+ }
27
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,MAAM;IACN,OAAO;IACP,IAAI;IACJ,KAAK;IACL,KAAK;IACL,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,KAAK;IACL,MAAM;CACP,CAAA;AAED;;;;;mDAKmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AAEvE;;kFAEkF;AAClF,MAAM,UAAU,eAAe,CAAC,EAAU;IACxC,OAAO,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAC/E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ export declare const bleBuiltin: BuiltinDefinition;
3
+ //# sourceMappingURL=ble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ble.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/ble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAIjD,eAAO,MAAM,UAAU,EAAE,iBA0CxB,CAAA"}
@@ -0,0 +1,46 @@
1
+ // ble uses a raw source module (not RPC) to match the native class shape exactly
2
+ // and keep its synchronous getter/setter semantics.
3
+ export const bleBuiltin = {
4
+ source: `/* eslint-disable no-console */
5
+ // Simulator stub for ble
6
+ // Runs inside the mikrojs runtime (QuickJS), not Node.js. Node built-ins are not available.
7
+ import {err, ok} from 'mikrojs/result'
8
+
9
+ let currentName = 'mikrojs-sim'
10
+ let currentTxPower = 0
11
+ let advertising = false
12
+
13
+ export class Ble {
14
+ getName() { return currentName }
15
+ setName(name) { currentName = name; return ok() }
16
+ getAddress() { return ok('00:00:00:00:00:00') }
17
+ getTxPower() { return ok(currentTxPower) }
18
+ setTxPower(dbm) { currentTxPower = dbm; return ok() }
19
+ advertise(_options) {
20
+ if (advertising) {
21
+ return err({name: 'AlreadyAdvertising', message: 'already advertising'})
22
+ }
23
+ advertising = true
24
+ console.log('[sim] ble.advertise')
25
+ return ok()
26
+ }
27
+ stopAdvertising() {
28
+ advertising = false
29
+ return ok()
30
+ }
31
+ stop() {
32
+ advertising = false
33
+ return ok()
34
+ }
35
+ setValue(_serviceUuid, _characteristicUuid, _value) {
36
+ return ok()
37
+ }
38
+ notify(_serviceUuid, _characteristicUuid, _value) {
39
+ return ok()
40
+ }
41
+ on(_event, _listener) {}
42
+ off(_event, _listener) {}
43
+ }
44
+ `,
45
+ };
46
+ //# sourceMappingURL=ble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ble.js","sourceRoot":"","sources":["../../../src/simulator/builtins/ble.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,oDAAoD;AACpD,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCT;CACA,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ /**
3
+ * Console builtin uses a raw source string because it patches globalThis.console
4
+ * rather than exporting a native:* module. This is a special case — all other
5
+ * builtins use the methods/RPC pattern.
6
+ */
7
+ export declare const consoleBuiltin: BuiltinDefinition;
8
+ //# sourceMappingURL=console.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/console.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,iBAiB5B,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Console builtin uses a raw source string because it patches globalThis.console
3
+ * rather than exporting a native:* module. This is a special case — all other
4
+ * builtins use the methods/RPC pattern.
5
+ */
6
+ export const consoleBuiltin = {
7
+ source: `
8
+ import { send } from 'native:host'
9
+ import { inspect } from 'mikrojs/inspect'
10
+
11
+ function format(args) {
12
+ return JSON.stringify(args.map(a => typeof a === 'string' ? a : inspect(a)))
13
+ }
14
+
15
+ globalThis.console = {
16
+ log(...args) { send('console:log', format(args)) },
17
+ warn(...args) { send('console:warn', format(args)) },
18
+ error(...args) { send('console:error', format(args)) },
19
+ info(...args) { send('console:info', format(args)) },
20
+ debug(...args) { send('console:debug', format(args)) },
21
+ }
22
+ `,
23
+ };
24
+ //# sourceMappingURL=console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.js","sourceRoot":"","sources":["../../../src/simulator/builtins/console.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,MAAM,EAAE;;;;;;;;;;;;;;;CAeT;CACA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ export declare const httpBuiltin: BuiltinDefinition;
3
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAMjD,eAAO,MAAM,WAAW,EAAE,iBAoFzB,CAAA"}
@@ -0,0 +1,90 @@
1
+ // http delegates to Node's global fetch via the dev runner's RPC handler
2
+ // ('http.fetch'). The QuickJS-side stub keeps a per-request message queue so
3
+ // nextMessage() can deliver the body as one chunk followed by {kind: 'end'},
4
+ // matching the streaming contract that mikrojs/http expects from native:http.
5
+ export const httpBuiltin = {
6
+ source: `/* eslint-disable no-console */
7
+ // Simulator stub for http
8
+ // Runs inside the mikrojs runtime (QuickJS), not Node.js. Node built-ins are not available.
9
+ import {call} from 'native:host'
10
+ import {err, ok} from 'mikrojs/result'
11
+ import type {SimHttp} from 'mikrojs/sim'
12
+
13
+ let nextId = 0
14
+ const queues = new Map() // id -> message[]
15
+
16
+ function base64ToBytes(b64: string): Uint8Array {
17
+ const bin = atob(b64)
18
+ const out = new Uint8Array(bin.length)
19
+ for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i)
20
+ return out
21
+ }
22
+
23
+ function bytesToBase64(bytes: Uint8Array): string {
24
+ let bin = ''
25
+ for (let i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i]!)
26
+ return btoa(bin)
27
+ }
28
+
29
+ // request() returns a discriminated union (not a Result) on success, so the
30
+ // outer object is a plain literal. The inner \`headers\` Promise resolves to a
31
+ // Result, which must use ok()/err() so consumers can call .orPanic / .map etc.
32
+ export const request: SimHttp['request'] = (url, options) => {
33
+ console.log('[sim] http.request:', options?.method ?? 'GET', url)
34
+ const id = nextId++
35
+ const queue: any[] = []
36
+ queues.set(id, queue)
37
+
38
+ const args = JSON.stringify({
39
+ url,
40
+ method: options?.method,
41
+ headers: options?.headers,
42
+ body: options?.body ? bytesToBase64(options.body) : undefined,
43
+ })
44
+
45
+ const headers = call('http.fetch', args).then(
46
+ (json: string) => {
47
+ const r = JSON.parse(json) as {status: number; headers: [string, string][]; body: string}
48
+ const body = base64ToBytes(r.body)
49
+ if (body.length > 0) queue.push({kind: 'chunk', data: body})
50
+ queue.push({kind: 'end'})
51
+ return ok({status: r.status, headers: r.headers})
52
+ },
53
+ (e: unknown) => {
54
+ const message = e instanceof Error ? e.message : String(e)
55
+ queue.push({kind: 'error', cancelled: false, message})
56
+ return err({name: 'Network', message})
57
+ },
58
+ )
59
+
60
+ return {ok: true as const, id, headers}
61
+ }
62
+
63
+ // Polls the queue every microtask until a message is available. The queue is
64
+ // populated when the RPC promise settles, so the first poll is fast in
65
+ // practice; this avoids needing an explicit wakeup channel.
66
+ export const nextMessage: SimHttp['nextMessage'] = async (id) => {
67
+ for (;;) {
68
+ const queue = queues.get(id)
69
+ if (!queue) return {kind: 'end' as const}
70
+ if (queue.length > 0) {
71
+ const msg = queue.shift()
72
+ if (msg.kind === 'end' || msg.kind === 'error') queues.delete(id)
73
+ return msg
74
+ }
75
+ await new Promise((resolve) => setTimeout(resolve, 0))
76
+ }
77
+ }
78
+
79
+ export const cancel: SimHttp['cancel'] = (id) => {
80
+ const queue = queues.get(id)
81
+ if (queue) {
82
+ queue.length = 0
83
+ queue.push({kind: 'error', cancelled: true, message: 'cancelled'})
84
+ }
85
+ }
86
+
87
+ export const pendingCount: SimHttp['pendingCount'] = () => queues.size
88
+ `,
89
+ };
90
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/simulator/builtins/http.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFT;CACA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ export declare const i2cBuiltin: BuiltinDefinition;
3
+ //# sourceMappingURL=i2c.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i2c.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/i2c.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,UAAU,EAAE,iBAexB,CAAA"}
@@ -0,0 +1,17 @@
1
+ export const i2cBuiltin = {
2
+ source: `// Simulator stub for i2c
3
+ // Runs inside the mikrojs runtime (QuickJS), not Node.js. Node built-ins are not available.
4
+ import {ok} from 'mikrojs/result'
5
+ import type {SimI2c} from 'mikrojs/sim'
6
+
7
+ export class I2c implements SimI2c {
8
+ constructor(_busNo: number, _options?: Record<string, unknown>) {}
9
+ begin() { return ok() }
10
+ end() { return ok() }
11
+ scan() { return ok(new Uint8Array()) }
12
+ write(_address: number, _data: Uint8Array, _stop?: boolean) { return ok() }
13
+ read(_address: number, bytes: number) { return ok(new Uint8Array(bytes)) }
14
+ }
15
+ `,
16
+ };
17
+ //# sourceMappingURL=i2c.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i2c.js","sourceRoot":"","sources":["../../../src/simulator/builtins/i2c.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,MAAM,EAAE;;;;;;;;;;;;;CAaT;CACA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { BuiltinDefinition, BuiltinName } from './types.js';
2
+ export type { BuiltinDefinition, BuiltinName } from './types.js';
3
+ /** Module name mapping: builtin name → native:* module name */
4
+ export declare const builtinModuleNames: Record<BuiltinName, string>;
5
+ /** Default builtin implementations for the dev runner */
6
+ export declare const defaultBuiltins: Record<BuiltinName, BuiltinDefinition>;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/index.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,iBAAiB,EAAE,WAAW,EAAC,MAAM,YAAY,CAAA;AAI9D,YAAY,EAAC,iBAAiB,EAAE,WAAW,EAAC,MAAM,YAAY,CAAA;AAE9D,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAe1D,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,iBAAiB,CAelE,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { bleBuiltin } from './ble.js';
2
+ import { consoleBuiltin } from './console.js';
3
+ import { httpBuiltin } from './http.js';
4
+ import { i2cBuiltin } from './i2c.js';
5
+ import { kvBuiltin } from './kv.js';
6
+ import { neopixelBuiltin } from './neopixel.js';
7
+ import { nvsKvBuiltin } from './nvs-kv.js';
8
+ import { pinBuiltin } from './pin.js';
9
+ import { pwmBuiltin } from './pwm.js';
10
+ import { sleepBuiltin } from './sleep.js';
11
+ import { sntpBuiltin } from './sntp.js';
12
+ import { spiBuiltin } from './spi.js';
13
+ import { uartBuiltin } from './uart.js';
14
+ import { wifiBuiltin } from './wifi.js';
15
+ /** Module name mapping: builtin name → native:* module name */
16
+ export const builtinModuleNames = {
17
+ ble: 'native:ble',
18
+ pin: 'native:pin',
19
+ pwm: 'native:pwm',
20
+ neopixel: 'native:neopixel',
21
+ wifi: 'native:wifi',
22
+ i2c: 'native:i2c',
23
+ spi: 'native:spi',
24
+ uart: 'native:uart',
25
+ kv: 'native:rtc',
26
+ nvs_kv: 'native:nvs_kv',
27
+ sleep: 'native:sleep',
28
+ http: 'native:http',
29
+ sntp: 'native:sntp',
30
+ console: 'native:console',
31
+ };
32
+ /** Default builtin implementations for the dev runner */
33
+ export const defaultBuiltins = {
34
+ ble: bleBuiltin,
35
+ pin: pinBuiltin,
36
+ pwm: pwmBuiltin,
37
+ neopixel: neopixelBuiltin,
38
+ kv: kvBuiltin,
39
+ nvs_kv: nvsKvBuiltin,
40
+ sleep: sleepBuiltin,
41
+ wifi: wifiBuiltin,
42
+ i2c: i2cBuiltin,
43
+ spi: spiBuiltin,
44
+ uart: uartBuiltin,
45
+ http: httpBuiltin,
46
+ sntp: sntpBuiltin,
47
+ console: consoleBuiltin,
48
+ };
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simulator/builtins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAA;AACjC,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AACrC,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AAIrC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC7D,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,iBAAiB;IAC3B,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,aAAa;IACnB,EAAE,EAAE,YAAY;IAChB,MAAM,EAAE,eAAe;IACvB,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB;CAC1B,CAAA;AAED,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAA2C;IACrE,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,UAAU;IACf,QAAQ,EAAE,eAAe;IACzB,EAAE,EAAE,SAAS;IACb,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;CACxB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ export declare const kvBuiltin: BuiltinDefinition;
3
+ //# sourceMappingURL=kv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kv.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/kv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,SAAS,EAAE,iBAqCvB,CAAA"}
@@ -0,0 +1,39 @@
1
+ export const kvBuiltin = {
2
+ source: `
3
+ import {encode, decode} from 'native:cbor'
4
+ import {ok} from 'mikrojs/result'
5
+
6
+ const store = new Map()
7
+
8
+ export function set(key, value) {
9
+ const result = encode(value)
10
+ if (!result.ok) return result
11
+ store.set(key, result.value)
12
+ return ok()
13
+ }
14
+
15
+ export function get(key) {
16
+ const data = store.get(key)
17
+ if (data === undefined) return undefined
18
+ const result = decode(data)
19
+ return result.ok ? result.value : undefined
20
+ }
21
+
22
+ export function remove(key) {
23
+ return store.delete(key)
24
+ }
25
+
26
+ export function clear() {
27
+ store.clear()
28
+ }
29
+
30
+ export function info() {
31
+ let used = 0
32
+ for (const [k, v] of store) {
33
+ used += 1 + k.length + 2 + v.byteLength
34
+ }
35
+ return {used, total: 2036, entries: store.size}
36
+ }
37
+ `,
38
+ };
39
+ //# sourceMappingURL=kv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kv.js","sourceRoot":"","sources":["../../../src/simulator/builtins/kv.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAsB;IAC1C,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCT;CACA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ export declare const neopixelBuiltin: BuiltinDefinition;
3
+ //# sourceMappingURL=neopixel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neopixel.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/neopixel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,eAAe,EAAE,iBAa7B,CAAA"}
@@ -0,0 +1,15 @@
1
+ export const neopixelBuiltin = {
2
+ source: `
3
+ import {ok} from 'mikrojs/result'
4
+
5
+ export class NeoPixel {
6
+ constructor(_pin, _numLeds, _bytesPerLed) {}
7
+ setPixel() { return ok() }
8
+ fill() { return ok() }
9
+ show() { return ok() }
10
+ clear() { return ok() }
11
+ end() { return ok() }
12
+ }
13
+ `,
14
+ };
15
+ //# sourceMappingURL=neopixel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"neopixel.js","sourceRoot":"","sources":["../../../src/simulator/builtins/neopixel.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,MAAM,EAAE;;;;;;;;;;;CAWT;CACA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ export declare const nvsKvBuiltin: BuiltinDefinition;
3
+ //# sourceMappingURL=nvs-kv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nvs-kv.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/nvs-kv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAQjD,eAAO,MAAM,YAAY,EAAE,iBA6D1B,CAAA"}
@@ -0,0 +1,69 @@
1
+ // nvs_kv mirrors the firmware NVS contract: values must survive process
2
+ // restarts (firmware NVS survives power cycles). The QuickJS-side stub
3
+ // keeps an in-memory cache for fast reads, and rehydrates / persists via
4
+ // RPC to the Node side, which writes a JSON file alongside the env-config
5
+ // `nvs.json`. Values cross the boundary as base64(cbor) blobs so binary
6
+ // data round-trips losslessly.
7
+ export const nvsKvBuiltin = {
8
+ source: `
9
+ import {encode, decode} from 'native:cbor'
10
+ import {call} from 'native:host'
11
+ import {ok} from 'mikrojs/result'
12
+
13
+ function bytesToBase64(bytes) {
14
+ let bin = ''
15
+ for (let i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i])
16
+ return btoa(bin)
17
+ }
18
+
19
+ function base64ToBytes(b64) {
20
+ const bin = atob(b64)
21
+ const out = new Uint8Array(bin.length)
22
+ for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i)
23
+ return out
24
+ }
25
+
26
+ const store = new Map()
27
+
28
+ // Rehydrate from disk synchronously at module init. host.call on a sync
29
+ // Node-side handler returns a JSON string immediately (no Promise bridge).
30
+ const initial = call('nvs_kv.list', '{}')
31
+ if (typeof initial === 'string') {
32
+ const entries = JSON.parse(initial)
33
+ for (const key of Object.keys(entries)) {
34
+ store.set(key, base64ToBytes(entries[key]))
35
+ }
36
+ }
37
+
38
+ export function set(key, value) {
39
+ const result = encode(value)
40
+ if (!result.ok) return result
41
+ store.set(key, result.value)
42
+ call('nvs_kv.set', JSON.stringify({key, value: bytesToBase64(result.value)}))
43
+ return ok()
44
+ }
45
+
46
+ export function get(key) {
47
+ const data = store.get(key)
48
+ if (data === undefined) return undefined
49
+ const result = decode(data)
50
+ return result.ok ? result.value : undefined
51
+ }
52
+
53
+ export function remove(key) {
54
+ const existed = store.delete(key)
55
+ if (existed) call('nvs_kv.remove', JSON.stringify({key}))
56
+ return existed
57
+ }
58
+
59
+ export function clear() {
60
+ store.clear()
61
+ call('nvs_kv.clear', '{}')
62
+ }
63
+
64
+ export function info() {
65
+ return {entries: store.size, used: store.size, total: 512, free: 512 - store.size}
66
+ }
67
+ `,
68
+ };
69
+ //# sourceMappingURL=nvs-kv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nvs-kv.js","sourceRoot":"","sources":["../../../src/simulator/builtins/nvs-kv.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,uEAAuE;AACvE,yEAAyE;AACzE,0EAA0E;AAC1E,wEAAwE;AACxE,+BAA+B;AAC/B,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DT;CACA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltinDefinition } from './types.js';
2
+ export declare const pinBuiltin: BuiltinDefinition;
3
+ //# sourceMappingURL=pin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../../src/simulator/builtins/pin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,UAAU,EAAE,iBA8BxB,CAAA"}