mikrojs 0.0.0 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/bin/mikrojs.js +3 -0
- package/dist/_exports/ble.d.ts +3 -0
- package/dist/_exports/ble.d.ts.map +1 -0
- package/dist/_exports/ble.js +2 -0
- package/dist/_exports/ble.js.map +1 -0
- package/dist/_exports/cbor.d.ts +3 -0
- package/dist/_exports/cbor.d.ts.map +1 -0
- package/dist/_exports/cbor.js +2 -0
- package/dist/_exports/cbor.js.map +1 -0
- package/dist/_exports/console.d.ts +2 -0
- package/dist/_exports/console.d.ts.map +1 -0
- package/dist/_exports/console.js +2 -0
- package/dist/_exports/console.js.map +1 -0
- package/dist/_exports/env.d.ts +2 -0
- package/dist/_exports/env.d.ts.map +1 -0
- package/dist/_exports/env.js +2 -0
- package/dist/_exports/env.js.map +1 -0
- package/dist/_exports/format.d.ts +2 -0
- package/dist/_exports/format.d.ts.map +1 -0
- package/dist/_exports/format.js +2 -0
- package/dist/_exports/format.js.map +1 -0
- package/dist/_exports/fs.d.ts +2 -0
- package/dist/_exports/fs.d.ts.map +1 -0
- package/dist/_exports/fs.js +2 -0
- package/dist/_exports/fs.js.map +1 -0
- package/dist/_exports/http/helpers.d.ts +3 -0
- package/dist/_exports/http/helpers.d.ts.map +1 -0
- package/dist/_exports/http/helpers.js +5 -0
- package/dist/_exports/http/helpers.js.map +1 -0
- package/dist/_exports/http/request.d.ts +4 -0
- package/dist/_exports/http/request.d.ts.map +1 -0
- package/dist/_exports/http/request.js +10 -0
- package/dist/_exports/http/request.js.map +1 -0
- package/dist/_exports/i2c.d.ts +2 -0
- package/dist/_exports/i2c.d.ts.map +1 -0
- package/dist/_exports/i2c.js +2 -0
- package/dist/_exports/i2c.js.map +1 -0
- package/dist/_exports/index.d.ts +61 -0
- package/dist/_exports/index.d.ts.map +1 -0
- package/dist/_exports/index.js +4 -0
- package/dist/_exports/index.js.map +1 -0
- package/dist/_exports/inspect.d.ts +2 -0
- package/dist/_exports/inspect.d.ts.map +1 -0
- package/dist/_exports/inspect.js +2 -0
- package/dist/_exports/inspect.js.map +1 -0
- package/dist/_exports/kv/nvs.d.ts +3 -0
- package/dist/_exports/kv/nvs.d.ts.map +1 -0
- package/dist/_exports/kv/nvs.js +2 -0
- package/dist/_exports/kv/nvs.js.map +1 -0
- package/dist/_exports/kv/rtc.d.ts +3 -0
- package/dist/_exports/kv/rtc.d.ts.map +1 -0
- package/dist/_exports/kv/rtc.js +2 -0
- package/dist/_exports/kv/rtc.js.map +1 -0
- package/dist/_exports/neopixel.d.ts +2 -0
- package/dist/_exports/neopixel.d.ts.map +1 -0
- package/dist/_exports/neopixel.js +2 -0
- package/dist/_exports/neopixel.js.map +1 -0
- package/dist/_exports/pin.d.ts +2 -0
- package/dist/_exports/pin.d.ts.map +1 -0
- package/dist/_exports/pin.js +2 -0
- package/dist/_exports/pin.js.map +1 -0
- package/dist/_exports/pwm.d.ts +2 -0
- package/dist/_exports/pwm.d.ts.map +1 -0
- package/dist/_exports/pwm.js +2 -0
- package/dist/_exports/pwm.js.map +1 -0
- package/dist/_exports/reader.d.ts +2 -0
- package/dist/_exports/reader.d.ts.map +1 -0
- package/dist/_exports/reader.js +2 -0
- package/dist/_exports/reader.js.map +1 -0
- package/dist/_exports/result.d.ts +2 -0
- package/dist/_exports/result.d.ts.map +1 -0
- package/dist/_exports/result.js +2 -0
- package/dist/_exports/result.js.map +1 -0
- package/dist/_exports/schema.d.ts +2 -0
- package/dist/_exports/schema.d.ts.map +1 -0
- package/dist/_exports/schema.js +2 -0
- package/dist/_exports/schema.js.map +1 -0
- package/dist/_exports/sim.d.ts +199 -0
- package/dist/_exports/sim.d.ts.map +1 -0
- package/dist/_exports/sim.js +8 -0
- package/dist/_exports/sim.js.map +1 -0
- package/dist/_exports/sleep.d.ts +2 -0
- package/dist/_exports/sleep.d.ts.map +1 -0
- package/dist/_exports/sleep.js +2 -0
- package/dist/_exports/sleep.js.map +1 -0
- package/dist/_exports/sntp.d.ts +3 -0
- package/dist/_exports/sntp.d.ts.map +1 -0
- package/dist/_exports/sntp.js +2 -0
- package/dist/_exports/sntp.js.map +1 -0
- package/dist/_exports/spi.d.ts +2 -0
- package/dist/_exports/spi.d.ts.map +1 -0
- package/dist/_exports/spi.js +2 -0
- package/dist/_exports/spi.js.map +1 -0
- package/dist/_exports/stdio.d.ts +2 -0
- package/dist/_exports/stdio.d.ts.map +1 -0
- package/dist/_exports/stdio.js +2 -0
- package/dist/_exports/stdio.js.map +1 -0
- package/dist/_exports/stream.d.ts +2 -0
- package/dist/_exports/stream.d.ts.map +1 -0
- package/dist/_exports/stream.js +2 -0
- package/dist/_exports/stream.js.map +1 -0
- package/dist/_exports/sys.d.ts +2 -0
- package/dist/_exports/sys.d.ts.map +1 -0
- package/dist/_exports/sys.js +2 -0
- package/dist/_exports/sys.js.map +1 -0
- package/dist/_exports/test.d.ts +2 -0
- package/dist/_exports/test.d.ts.map +1 -0
- package/dist/_exports/test.js +2 -0
- package/dist/_exports/test.js.map +1 -0
- package/dist/_exports/uart.d.ts +2 -0
- package/dist/_exports/uart.d.ts.map +1 -0
- package/dist/_exports/uart.js +2 -0
- package/dist/_exports/uart.js.map +1 -0
- package/dist/_exports/wifi.d.ts +3 -0
- package/dist/_exports/wifi.d.ts.map +1 -0
- package/dist/_exports/wifi.js +2 -0
- package/dist/_exports/wifi.js.map +1 -0
- package/dist/cli/cli.d.ts +3 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +215 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/cliWrapper.d.ts +3 -0
- package/dist/cli/cliWrapper.d.ts.map +1 -0
- package/dist/cli/cliWrapper.js +27 -0
- package/dist/cli/cliWrapper.js.map +1 -0
- package/dist/cli/commands/build-runtime.d.ts +14 -0
- package/dist/cli/commands/build-runtime.d.ts.map +1 -0
- package/dist/cli/commands/build-runtime.js +122 -0
- package/dist/cli/commands/build-runtime.js.map +1 -0
- package/dist/cli/commands/build.d.ts +31 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +145 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/clean.d.ts +16 -0
- package/dist/cli/commands/clean.d.ts.map +1 -0
- package/dist/cli/commands/clean.js +148 -0
- package/dist/cli/commands/clean.js.map +1 -0
- package/dist/cli/commands/console.d.ts +19 -0
- package/dist/cli/commands/console.d.ts.map +1 -0
- package/dist/cli/commands/console.js +32 -0
- package/dist/cli/commands/console.js.map +1 -0
- package/dist/cli/commands/deploy.d.ts +63 -0
- package/dist/cli/commands/deploy.d.ts.map +1 -0
- package/dist/cli/commands/deploy.js +242 -0
- package/dist/cli/commands/deploy.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +41 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +170 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/docs.d.ts +7 -0
- package/dist/cli/commands/docs.d.ts.map +1 -0
- package/dist/cli/commands/docs.js +20 -0
- package/dist/cli/commands/docs.js.map +1 -0
- package/dist/cli/commands/env.d.ts +59 -0
- package/dist/cli/commands/env.d.ts.map +1 -0
- package/dist/cli/commands/env.js +257 -0
- package/dist/cli/commands/env.js.map +1 -0
- package/dist/cli/commands/erase.d.ts +18 -0
- package/dist/cli/commands/erase.d.ts.map +1 -0
- package/dist/cli/commands/erase.js +90 -0
- package/dist/cli/commands/erase.js.map +1 -0
- package/dist/cli/commands/flash.d.ts +30 -0
- package/dist/cli/commands/flash.d.ts.map +1 -0
- package/dist/cli/commands/flash.js +243 -0
- package/dist/cli/commands/flash.js.map +1 -0
- package/dist/cli/commands/home.d.ts +7 -0
- package/dist/cli/commands/home.d.ts.map +1 -0
- package/dist/cli/commands/home.js +20 -0
- package/dist/cli/commands/home.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +17 -0
- package/dist/cli/commands/ls.d.ts.map +1 -0
- package/dist/cli/commands/ls.js +62 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/sim/clean.d.ts +7 -0
- package/dist/cli/commands/sim/clean.d.ts.map +1 -0
- package/dist/cli/commands/sim/clean.js +34 -0
- package/dist/cli/commands/sim/clean.js.map +1 -0
- package/dist/cli/commands/sim/deploy.d.ts +46 -0
- package/dist/cli/commands/sim/deploy.d.ts.map +1 -0
- package/dist/cli/commands/sim/deploy.js +127 -0
- package/dist/cli/commands/sim/deploy.js.map +1 -0
- package/dist/cli/commands/sim/dev.d.ts +40 -0
- package/dist/cli/commands/sim/dev.d.ts.map +1 -0
- package/dist/cli/commands/sim/dev.js +254 -0
- package/dist/cli/commands/sim/dev.js.map +1 -0
- package/dist/cli/commands/sim/env.d.ts +56 -0
- package/dist/cli/commands/sim/env.d.ts.map +1 -0
- package/dist/cli/commands/sim/env.js +204 -0
- package/dist/cli/commands/sim/env.js.map +1 -0
- package/dist/cli/commands/sim/profile.d.ts +67 -0
- package/dist/cli/commands/sim/profile.d.ts.map +1 -0
- package/dist/cli/commands/sim/profile.js +354 -0
- package/dist/cli/commands/sim/profile.js.map +1 -0
- package/dist/cli/commands/sim/repl.d.ts +16 -0
- package/dist/cli/commands/sim/repl.d.ts.map +1 -0
- package/dist/cli/commands/sim/repl.js +119 -0
- package/dist/cli/commands/sim/repl.js.map +1 -0
- package/dist/cli/commands/sim/reset.d.ts +11 -0
- package/dist/cli/commands/sim/reset.d.ts.map +1 -0
- package/dist/cli/commands/sim/reset.js +59 -0
- package/dist/cli/commands/sim/reset.js.map +1 -0
- package/dist/cli/commands/sim/scaffold.d.ts +11 -0
- package/dist/cli/commands/sim/scaffold.d.ts.map +1 -0
- package/dist/cli/commands/sim/scaffold.js +41 -0
- package/dist/cli/commands/sim/scaffold.js.map +1 -0
- package/dist/cli/commands/sim/test.d.ts +49 -0
- package/dist/cli/commands/sim/test.d.ts.map +1 -0
- package/dist/cli/commands/sim/test.js +364 -0
- package/dist/cli/commands/sim/test.js.map +1 -0
- package/dist/cli/commands/sim.d.ts +220 -0
- package/dist/cli/commands/sim.d.ts.map +1 -0
- package/dist/cli/commands/sim.js +69 -0
- package/dist/cli/commands/sim.js.map +1 -0
- package/dist/cli/commands/tail.d.ts +14 -0
- package/dist/cli/commands/tail.d.ts.map +1 -0
- package/dist/cli/commands/tail.js +50 -0
- package/dist/cli/commands/tail.js.map +1 -0
- package/dist/cli/commands/test.d.ts +39 -0
- package/dist/cli/commands/test.d.ts.map +1 -0
- package/dist/cli/commands/test.js +432 -0
- package/dist/cli/commands/test.js.map +1 -0
- package/dist/cli/components/DevicePicker.d.ts +9 -0
- package/dist/cli/components/DevicePicker.d.ts.map +1 -0
- package/dist/cli/components/DevicePicker.js +71 -0
- package/dist/cli/components/DevicePicker.js.map +1 -0
- package/dist/cli/components/EnvEditor.d.ts +12 -0
- package/dist/cli/components/EnvEditor.d.ts.map +1 -0
- package/dist/cli/components/EnvEditor.js +201 -0
- package/dist/cli/components/EnvEditor.js.map +1 -0
- package/dist/cli/components/TextInput.d.ts +28 -0
- package/dist/cli/components/TextInput.d.ts.map +1 -0
- package/dist/cli/components/TextInput.js +73 -0
- package/dist/cli/components/TextInput.js.map +1 -0
- package/dist/cli/components/TitledBox.d.ts +27 -0
- package/dist/cli/components/TitledBox.d.ts.map +1 -0
- package/dist/cli/components/TitledBox.js +111 -0
- package/dist/cli/components/TitledBox.js.map +1 -0
- package/dist/cli/hooks/useDevices.d.ts +23 -0
- package/dist/cli/hooks/useDevices.d.ts.map +1 -0
- package/dist/cli/hooks/useDevices.js +19 -0
- package/dist/cli/hooks/useDevices.js.map +1 -0
- package/dist/cli/lib/RenderAndExit.d.ts +6 -0
- package/dist/cli/lib/RenderAndExit.d.ts.map +1 -0
- package/dist/cli/lib/RenderAndExit.js +8 -0
- package/dist/cli/lib/RenderAndExit.js.map +1 -0
- package/dist/cli/lib/Spinner.d.ts +11 -0
- package/dist/cli/lib/Spinner.d.ts.map +1 -0
- package/dist/cli/lib/Spinner.js +22 -0
- package/dist/cli/lib/Spinner.js.map +1 -0
- package/dist/cli/lib/agent.d.ts +38 -0
- package/dist/cli/lib/agent.d.ts.map +1 -0
- package/dist/cli/lib/agent.js +87 -0
- package/dist/cli/lib/agent.js.map +1 -0
- package/dist/cli/lib/boards.d.ts +23 -0
- package/dist/cli/lib/boards.d.ts.map +1 -0
- package/dist/cli/lib/boards.js +67 -0
- package/dist/cli/lib/boards.js.map +1 -0
- package/dist/cli/lib/build.d.ts +47 -0
- package/dist/cli/lib/build.d.ts.map +1 -0
- package/dist/cli/lib/build.js +533 -0
- package/dist/cli/lib/build.js.map +1 -0
- package/dist/cli/lib/connectSim.d.ts +21 -0
- package/dist/cli/lib/connectSim.d.ts.map +1 -0
- package/dist/cli/lib/connectSim.js +20 -0
- package/dist/cli/lib/connectSim.js.map +1 -0
- package/dist/cli/lib/deploy.d.ts +42 -0
- package/dist/cli/lib/deploy.d.ts.map +1 -0
- package/dist/cli/lib/deploy.js +121 -0
- package/dist/cli/lib/deploy.js.map +1 -0
- package/dist/cli/lib/deployProgress.d.ts +8 -0
- package/dist/cli/lib/deployProgress.d.ts.map +1 -0
- package/dist/cli/lib/deployProgress.js +32 -0
- package/dist/cli/lib/deployProgress.js.map +1 -0
- package/dist/cli/lib/dotenv.d.ts +16 -0
- package/dist/cli/lib/dotenv.d.ts.map +1 -0
- package/dist/cli/lib/dotenv.js +33 -0
- package/dist/cli/lib/dotenv.js.map +1 -0
- package/dist/cli/lib/esbuild.d.ts +7 -0
- package/dist/cli/lib/esbuild.d.ts.map +1 -0
- package/dist/cli/lib/esbuild.js +15 -0
- package/dist/cli/lib/esbuild.js.map +1 -0
- package/dist/cli/lib/esptool.d.ts +41 -0
- package/dist/cli/lib/esptool.d.ts.map +1 -0
- package/dist/cli/lib/esptool.js +43 -0
- package/dist/cli/lib/esptool.js.map +1 -0
- package/dist/cli/lib/firmware.d.ts +24 -0
- package/dist/cli/lib/firmware.d.ts.map +1 -0
- package/dist/cli/lib/firmware.js +379 -0
- package/dist/cli/lib/firmware.js.map +1 -0
- package/dist/cli/lib/firmwareCompat.d.ts +19 -0
- package/dist/cli/lib/firmwareCompat.d.ts.map +1 -0
- package/dist/cli/lib/firmwareCompat.js +31 -0
- package/dist/cli/lib/firmwareCompat.js.map +1 -0
- package/dist/cli/lib/heapBaseline.d.ts +15 -0
- package/dist/cli/lib/heapBaseline.d.ts.map +1 -0
- package/dist/cli/lib/heapBaseline.js +39 -0
- package/dist/cli/lib/heapBaseline.js.map +1 -0
- package/dist/cli/lib/ink-table/index.d.ts +88 -0
- package/dist/cli/lib/ink-table/index.d.ts.map +1 -0
- package/dist/cli/lib/ink-table/index.js +217 -0
- package/dist/cli/lib/ink-table/index.js.map +1 -0
- package/dist/cli/lib/loadMikroConfig.d.ts +7 -0
- package/dist/cli/lib/loadMikroConfig.d.ts.map +1 -0
- package/dist/cli/lib/loadMikroConfig.js +26 -0
- package/dist/cli/lib/loadMikroConfig.js.map +1 -0
- package/dist/cli/lib/minify.d.ts +3 -0
- package/dist/cli/lib/minify.d.ts.map +1 -0
- package/dist/cli/lib/minify.js +89 -0
- package/dist/cli/lib/minify.js.map +1 -0
- package/dist/cli/lib/openSim.d.ts +29 -0
- package/dist/cli/lib/openSim.d.ts.map +1 -0
- package/dist/cli/lib/openSim.js +32 -0
- package/dist/cli/lib/openSim.js.map +1 -0
- package/dist/cli/lib/ospawn.d.ts +34 -0
- package/dist/cli/lib/ospawn.d.ts.map +1 -0
- package/dist/cli/lib/ospawn.js +90 -0
- package/dist/cli/lib/ospawn.js.map +1 -0
- package/dist/cli/lib/parseMinifier.d.ts +10 -0
- package/dist/cli/lib/parseMinifier.d.ts.map +1 -0
- package/dist/cli/lib/parseMinifier.js +49 -0
- package/dist/cli/lib/parseMinifier.js.map +1 -0
- package/dist/cli/lib/parseSize.d.ts +6 -0
- package/dist/cli/lib/parseSize.d.ts.map +1 -0
- package/dist/cli/lib/parseSize.js +25 -0
- package/dist/cli/lib/parseSize.js.map +1 -0
- package/dist/cli/lib/projectRoot.d.ts +11 -0
- package/dist/cli/lib/projectRoot.d.ts.map +1 -0
- package/dist/cli/lib/projectRoot.js +28 -0
- package/dist/cli/lib/projectRoot.js.map +1 -0
- package/dist/cli/lib/protocol.d.ts +144 -0
- package/dist/cli/lib/protocol.d.ts.map +1 -0
- package/dist/cli/lib/protocol.js +385 -0
- package/dist/cli/lib/protocol.js.map +1 -0
- package/dist/cli/lib/recover.d.ts +25 -0
- package/dist/cli/lib/recover.d.ts.map +1 -0
- package/dist/cli/lib/recover.js +144 -0
- package/dist/cli/lib/recover.js.map +1 -0
- package/dist/cli/lib/resolveEntry.d.ts +7 -0
- package/dist/cli/lib/resolveEntry.d.ts.map +1 -0
- package/dist/cli/lib/resolveEntry.js +30 -0
- package/dist/cli/lib/resolveEntry.js.map +1 -0
- package/dist/cli/lib/runHooks.d.ts +34 -0
- package/dist/cli/lib/runHooks.d.ts.map +1 -0
- package/dist/cli/lib/runHooks.js +90 -0
- package/dist/cli/lib/runHooks.js.map +1 -0
- package/dist/cli/lib/serial/InkReplConsole.d.ts +27 -0
- package/dist/cli/lib/serial/InkReplConsole.d.ts.map +1 -0
- package/dist/cli/lib/serial/InkReplConsole.js +24 -0
- package/dist/cli/lib/serial/InkReplConsole.js.map +1 -0
- package/dist/cli/lib/serial/InkReplMode.d.ts +38 -0
- package/dist/cli/lib/serial/InkReplMode.d.ts.map +1 -0
- package/dist/cli/lib/serial/InkReplMode.js +90 -0
- package/dist/cli/lib/serial/InkReplMode.js.map +1 -0
- package/dist/cli/lib/serial/ReplConsole.d.ts +21 -0
- package/dist/cli/lib/serial/ReplConsole.d.ts.map +1 -0
- package/dist/cli/lib/serial/ReplConsole.js +249 -0
- package/dist/cli/lib/serial/ReplConsole.js.map +1 -0
- package/dist/cli/lib/serial/devSession.d.ts +53 -0
- package/dist/cli/lib/serial/devSession.d.ts.map +1 -0
- package/dist/cli/lib/serial/devSession.js +160 -0
- package/dist/cli/lib/serial/devSession.js.map +1 -0
- package/dist/cli/lib/serial/dispatchReplCommand.d.ts +25 -0
- package/dist/cli/lib/serial/dispatchReplCommand.d.ts.map +1 -0
- package/dist/cli/lib/serial/dispatchReplCommand.js +27 -0
- package/dist/cli/lib/serial/dispatchReplCommand.js.map +1 -0
- package/dist/cli/lib/serial/openSession.d.ts +28 -0
- package/dist/cli/lib/serial/openSession.d.ts.map +1 -0
- package/dist/cli/lib/serial/openSession.js +48 -0
- package/dist/cli/lib/serial/openSession.js.map +1 -0
- package/dist/cli/lib/serial/replStateMachine.d.ts +169 -0
- package/dist/cli/lib/serial/replStateMachine.d.ts.map +1 -0
- package/dist/cli/lib/serial/replStateMachine.js +650 -0
- package/dist/cli/lib/serial/replStateMachine.js.map +1 -0
- package/dist/cli/lib/serial/runAgentRepl.d.ts +33 -0
- package/dist/cli/lib/serial/runAgentRepl.d.ts.map +1 -0
- package/dist/cli/lib/serial/runAgentRepl.js +80 -0
- package/dist/cli/lib/serial/runAgentRepl.js.map +1 -0
- package/dist/cli/lib/session.d.ts +163 -0
- package/dist/cli/lib/session.d.ts.map +1 -0
- package/dist/cli/lib/session.js +490 -0
- package/dist/cli/lib/session.js.map +1 -0
- package/dist/cli/lib/simConfig.d.ts +15 -0
- package/dist/cli/lib/simConfig.d.ts.map +1 -0
- package/dist/cli/lib/simConfig.js +25 -0
- package/dist/cli/lib/simConfig.js.map +1 -0
- package/dist/cli/lib/simPid.d.ts +30 -0
- package/dist/cli/lib/simPid.d.ts.map +1 -0
- package/dist/cli/lib/simPid.js +112 -0
- package/dist/cli/lib/simPid.js.map +1 -0
- package/dist/cli/lib/simTransport.d.ts +17 -0
- package/dist/cli/lib/simTransport.d.ts.map +1 -0
- package/dist/cli/lib/simTransport.js +80 -0
- package/dist/cli/lib/simTransport.js.map +1 -0
- package/dist/cli/lib/testRunner.d.ts +86 -0
- package/dist/cli/lib/testRunner.d.ts.map +1 -0
- package/dist/cli/lib/testRunner.js +469 -0
- package/dist/cli/lib/testRunner.js.map +1 -0
- package/dist/cli/lib/transport.d.ts +34 -0
- package/dist/cli/lib/transport.d.ts.map +1 -0
- package/dist/cli/lib/transport.js +117 -0
- package/dist/cli/lib/transport.js.map +1 -0
- package/dist/cli/lib/useObservable.d.ts +4 -0
- package/dist/cli/lib/useObservable.d.ts.map +1 -0
- package/dist/cli/lib/useObservable.js +22 -0
- package/dist/cli/lib/useObservable.js.map +1 -0
- package/dist/cli/lib/watcher.d.ts +10 -0
- package/dist/cli/lib/watcher.d.ts.map +1 -0
- package/dist/cli/lib/watcher.js +34 -0
- package/dist/cli/lib/watcher.js.map +1 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +27 -0
- package/dist/constants.js.map +1 -0
- package/dist/simulator/builtins/ble.d.ts +3 -0
- package/dist/simulator/builtins/ble.d.ts.map +1 -0
- package/dist/simulator/builtins/ble.js +45 -0
- package/dist/simulator/builtins/ble.js.map +1 -0
- package/dist/simulator/builtins/console.d.ts +8 -0
- package/dist/simulator/builtins/console.d.ts.map +1 -0
- package/dist/simulator/builtins/console.js +24 -0
- package/dist/simulator/builtins/console.js.map +1 -0
- package/dist/simulator/builtins/http.d.ts +3 -0
- package/dist/simulator/builtins/http.d.ts.map +1 -0
- package/dist/simulator/builtins/http.js +32 -0
- package/dist/simulator/builtins/http.js.map +1 -0
- package/dist/simulator/builtins/i2c.d.ts +3 -0
- package/dist/simulator/builtins/i2c.d.ts.map +1 -0
- package/dist/simulator/builtins/i2c.js +16 -0
- package/dist/simulator/builtins/i2c.js.map +1 -0
- package/dist/simulator/builtins/index.d.ts +7 -0
- package/dist/simulator/builtins/index.d.ts.map +1 -0
- package/dist/simulator/builtins/index.js +49 -0
- package/dist/simulator/builtins/index.js.map +1 -0
- package/dist/simulator/builtins/kv.d.ts +3 -0
- package/dist/simulator/builtins/kv.d.ts.map +1 -0
- package/dist/simulator/builtins/kv.js +38 -0
- package/dist/simulator/builtins/kv.js.map +1 -0
- package/dist/simulator/builtins/neopixel.d.ts +3 -0
- package/dist/simulator/builtins/neopixel.d.ts.map +1 -0
- package/dist/simulator/builtins/neopixel.js +13 -0
- package/dist/simulator/builtins/neopixel.js.map +1 -0
- package/dist/simulator/builtins/nvs-kv.d.ts +3 -0
- package/dist/simulator/builtins/nvs-kv.d.ts.map +1 -0
- package/dist/simulator/builtins/nvs-kv.js +34 -0
- package/dist/simulator/builtins/nvs-kv.js.map +1 -0
- package/dist/simulator/builtins/pin.d.ts +3 -0
- package/dist/simulator/builtins/pin.d.ts.map +1 -0
- package/dist/simulator/builtins/pin.js +31 -0
- package/dist/simulator/builtins/pin.js.map +1 -0
- package/dist/simulator/builtins/pwm.d.ts +3 -0
- package/dist/simulator/builtins/pwm.d.ts.map +1 -0
- package/dist/simulator/builtins/pwm.js +29 -0
- package/dist/simulator/builtins/pwm.js.map +1 -0
- package/dist/simulator/builtins/sleep.d.ts +3 -0
- package/dist/simulator/builtins/sleep.d.ts.map +1 -0
- package/dist/simulator/builtins/sleep.js +32 -0
- package/dist/simulator/builtins/sleep.js.map +1 -0
- package/dist/simulator/builtins/sntp.d.ts +3 -0
- package/dist/simulator/builtins/sntp.d.ts.map +1 -0
- package/dist/simulator/builtins/sntp.js +12 -0
- package/dist/simulator/builtins/sntp.js.map +1 -0
- package/dist/simulator/builtins/spi.d.ts +3 -0
- package/dist/simulator/builtins/spi.d.ts.map +1 -0
- package/dist/simulator/builtins/spi.js +15 -0
- package/dist/simulator/builtins/spi.js.map +1 -0
- package/dist/simulator/builtins/types.d.ts +24 -0
- package/dist/simulator/builtins/types.d.ts.map +1 -0
- package/dist/simulator/builtins/types.js +2 -0
- package/dist/simulator/builtins/types.js.map +1 -0
- package/dist/simulator/builtins/uart.d.ts +3 -0
- package/dist/simulator/builtins/uart.d.ts.map +1 -0
- package/dist/simulator/builtins/uart.js +20 -0
- package/dist/simulator/builtins/uart.js.map +1 -0
- package/dist/simulator/builtins/wifi.d.ts +3 -0
- package/dist/simulator/builtins/wifi.d.ts.map +1 -0
- package/dist/simulator/builtins/wifi.js +54 -0
- package/dist/simulator/builtins/wifi.js.map +1 -0
- package/dist/simulator/devRunner.d.ts +41 -0
- package/dist/simulator/devRunner.d.ts.map +1 -0
- package/dist/simulator/devRunner.js +140 -0
- package/dist/simulator/devRunner.js.map +1 -0
- package/dist/simulator/loadSimStubs.d.ts +15 -0
- package/dist/simulator/loadSimStubs.d.ts.map +1 -0
- package/dist/simulator/loadSimStubs.js +54 -0
- package/dist/simulator/loadSimStubs.js.map +1 -0
- package/dist/simulator/simProcess.d.ts +11 -0
- package/dist/simulator/simProcess.d.ts.map +1 -0
- package/dist/simulator/simProcess.js +963 -0
- package/dist/simulator/simProcess.js.map +1 -0
- package/dist/simulator/simTemplates.d.ts +6 -0
- package/dist/simulator/simTemplates.d.ts.map +1 -0
- package/dist/simulator/simTemplates.js +21 -0
- package/dist/simulator/simTemplates.js.map +1 -0
- package/package.json +123 -2
- package/runtime.d.ts +95 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pid file management for the simulator.
|
|
3
|
+
*
|
|
4
|
+
* One sim process at a time per project. Long-lived commands (`mikro sim dev`,
|
|
5
|
+
* `mikro sim repl`) claim the pid file and kill any predecessor. Short-lived
|
|
6
|
+
* commands (`mikro sim deploy`, `mikro sim test`, etc.) check the pid file
|
|
7
|
+
* and refuse to run if a sim is already alive — they would race on sim-fs
|
|
8
|
+
* writes or yank files out from under the running process.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import * as pathlib from 'node:path';
|
|
12
|
+
const PID_FILE = 'sim.pid';
|
|
13
|
+
function pidPath(mikroDir) {
|
|
14
|
+
return pathlib.join(mikroDir, PID_FILE);
|
|
15
|
+
}
|
|
16
|
+
export function isAlive(pid) {
|
|
17
|
+
try {
|
|
18
|
+
process.kill(pid, 0);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
if (err.code === 'EPERM')
|
|
23
|
+
return true;
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function readPid(mikroDir) {
|
|
28
|
+
const file = pidPath(mikroDir);
|
|
29
|
+
if (!existsSync(file))
|
|
30
|
+
return null;
|
|
31
|
+
try {
|
|
32
|
+
const raw = readFileSync(file, 'utf-8').trim();
|
|
33
|
+
const pid = parseInt(raw, 10);
|
|
34
|
+
if (!Number.isFinite(pid) || pid <= 0)
|
|
35
|
+
return null;
|
|
36
|
+
if (!isAlive(pid)) {
|
|
37
|
+
try {
|
|
38
|
+
unlinkSync(file);
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return pid;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function clearPid(mikroDir) {
|
|
50
|
+
const file = pidPath(mikroDir);
|
|
51
|
+
try {
|
|
52
|
+
unlinkSync(file);
|
|
53
|
+
}
|
|
54
|
+
catch { }
|
|
55
|
+
}
|
|
56
|
+
export class SimAlreadyRunningError extends Error {
|
|
57
|
+
pid;
|
|
58
|
+
constructor(pid) {
|
|
59
|
+
super(`a sim is already running (pid ${pid}). Stop it with Ctrl-C in that terminal, then try again.`);
|
|
60
|
+
this.name = 'SimAlreadyRunningError';
|
|
61
|
+
this.pid = pid;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Refuse to proceed if a sim is already running. Used by short-lived commands
|
|
66
|
+
* (deploy, test, env, profile, clean, reset).
|
|
67
|
+
*/
|
|
68
|
+
export function checkPid(mikroDir) {
|
|
69
|
+
const pid = readPid(mikroDir);
|
|
70
|
+
if (pid !== null)
|
|
71
|
+
throw new SimAlreadyRunningError(pid);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Claim the pid file for this process. If a predecessor is alive, kill it
|
|
75
|
+
* first (SIGTERM, then SIGKILL after a short grace period). Registers exit
|
|
76
|
+
* cleanup to remove the file on normal termination.
|
|
77
|
+
*
|
|
78
|
+
* Used by long-lived commands (dev, repl).
|
|
79
|
+
*/
|
|
80
|
+
export async function claimPid(mikroDir) {
|
|
81
|
+
const file = pidPath(mikroDir);
|
|
82
|
+
const existing = readPid(mikroDir);
|
|
83
|
+
if (existing !== null) {
|
|
84
|
+
try {
|
|
85
|
+
process.kill(existing, 'SIGTERM');
|
|
86
|
+
}
|
|
87
|
+
catch { }
|
|
88
|
+
const deadline = Date.now() + 2000;
|
|
89
|
+
while (Date.now() < deadline && isAlive(existing)) {
|
|
90
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
91
|
+
}
|
|
92
|
+
if (isAlive(existing)) {
|
|
93
|
+
try {
|
|
94
|
+
process.kill(existing, 'SIGKILL');
|
|
95
|
+
}
|
|
96
|
+
catch { }
|
|
97
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
writeFileSync(file, String(process.pid));
|
|
101
|
+
const cleanup = () => clearPid(mikroDir);
|
|
102
|
+
process.once('exit', cleanup);
|
|
103
|
+
process.once('SIGINT', () => {
|
|
104
|
+
cleanup();
|
|
105
|
+
process.exit(130);
|
|
106
|
+
});
|
|
107
|
+
process.once('SIGTERM', () => {
|
|
108
|
+
cleanup();
|
|
109
|
+
process.exit(143);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=simPid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simPid.js","sourceRoot":"","sources":["../../../src/cli/lib/simPid.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;AA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OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;YACnC,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;YACV,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;IACD,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IAExC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;QAC1B,OAAO,EAAE,CAAA;QACT,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;QAC3B,OAAO,EAAE,CAAA;QACT,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPC transport for the simulator subprocess.
|
|
3
|
+
*
|
|
4
|
+
* Spawns simProcess.js as a child process and wraps its stdin/stdout
|
|
5
|
+
* as a Transport, identical to createSerialTransport but over stdio pipes.
|
|
6
|
+
*/
|
|
7
|
+
import type { Transport } from './transport.js';
|
|
8
|
+
export interface SimTransportOptions {
|
|
9
|
+
fsRoot: string;
|
|
10
|
+
memLimit?: number;
|
|
11
|
+
fsLimit?: number;
|
|
12
|
+
fsReadMax?: number;
|
|
13
|
+
/** Path to project directory for sim/ stubs */
|
|
14
|
+
simDir?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function createSimTransport(options: SimTransportOptions): Transport;
|
|
17
|
+
//# sourceMappingURL=simTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simTransport.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/simTransport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AAE7C,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CA8E1E"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPC transport for the simulator subprocess.
|
|
3
|
+
*
|
|
4
|
+
* Spawns simProcess.js as a child process and wraps its stdin/stdout
|
|
5
|
+
* as a Transport, identical to createSerialTransport but over stdio pipes.
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from 'node:child_process';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Observable } from 'rxjs';
|
|
10
|
+
export function createSimTransport(options) {
|
|
11
|
+
const entryPath = fileURLToPath(new URL('../../simulator/simProcess.js', import.meta.url));
|
|
12
|
+
const args = ['--fs-root', options.fsRoot];
|
|
13
|
+
if (options.memLimit)
|
|
14
|
+
args.push('--mem-limit', String(options.memLimit));
|
|
15
|
+
if (options.fsLimit)
|
|
16
|
+
args.push('--fs-limit', String(options.fsLimit));
|
|
17
|
+
if (options.fsReadMax)
|
|
18
|
+
args.push('--fs-read-max', String(options.fsReadMax));
|
|
19
|
+
if (options.simDir)
|
|
20
|
+
args.push('--sim-dir', options.simDir);
|
|
21
|
+
// Inherit stderr so fatal errors and warnings from simProcess surface in the
|
|
22
|
+
// user's terminal. Previously this was 'ignore', which meant a crashing
|
|
23
|
+
// subprocess would manifest only as a cryptic EPIPE on the parent when the
|
|
24
|
+
// next TLV frame was written. simProcess only writes to stderr on real
|
|
25
|
+
// problems, so inheriting it doesn't pollute normal runs.
|
|
26
|
+
const child = spawn(process.execPath, [entryPath, ...args], {
|
|
27
|
+
stdio: ['pipe', 'pipe', 'inherit'],
|
|
28
|
+
});
|
|
29
|
+
// Track child exit so we can synthesize a clear error for writes that
|
|
30
|
+
// race with a dead subprocess (otherwise EPIPE becomes an unhandled 'error'
|
|
31
|
+
// event and crashes the parent).
|
|
32
|
+
let exitInfo = null;
|
|
33
|
+
child.on('exit', (code, signal) => {
|
|
34
|
+
exitInfo = { code, signal };
|
|
35
|
+
});
|
|
36
|
+
// Install an error listener on stdin so EPIPE from writes doesn't crash the
|
|
37
|
+
// parent. We surface it via the data observable instead.
|
|
38
|
+
child.stdin?.on('error', () => {
|
|
39
|
+
/* swallowed here; write() below re-reports as a transport error */
|
|
40
|
+
});
|
|
41
|
+
const data = new Observable((subscriber) => {
|
|
42
|
+
const onData = (chunk) => subscriber.next(new Uint8Array(chunk));
|
|
43
|
+
const onEnd = () => subscriber.complete();
|
|
44
|
+
const onError = (err) => subscriber.error(err);
|
|
45
|
+
const onExit = () => {
|
|
46
|
+
if (exitInfo && exitInfo.code !== 0) {
|
|
47
|
+
subscriber.error(new Error(`simProcess exited unexpectedly (code=${exitInfo.code} signal=${exitInfo.signal ?? 'none'})`));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
subscriber.complete();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
child.stdout.on('data', onData);
|
|
54
|
+
child.stdout.on('end', onEnd);
|
|
55
|
+
child.stdout.on('error', onError);
|
|
56
|
+
child.on('exit', onExit);
|
|
57
|
+
return () => {
|
|
58
|
+
child.stdout.off('data', onData);
|
|
59
|
+
child.stdout.off('end', onEnd);
|
|
60
|
+
child.stdout.off('error', onError);
|
|
61
|
+
child.off('exit', onExit);
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
write(chunk) {
|
|
66
|
+
if (exitInfo !== null) {
|
|
67
|
+
return Promise.reject(new Error(`cannot write to simProcess: subprocess has exited (code=${exitInfo.code} signal=${exitInfo.signal ?? 'none'})`));
|
|
68
|
+
}
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
child.stdin.write(Buffer.from(chunk), (err) => (err ? reject(err) : resolve()));
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
data,
|
|
74
|
+
close() {
|
|
75
|
+
child.stdin.end();
|
|
76
|
+
child.kill();
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=simTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simTransport.js","sourceRoot":"","sources":["../../../src/cli/lib/simTransport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoB,KAAK,EAAC,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAEtC,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAA;AAa/B,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC7D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,+BAA+B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1F,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,OAAO,CAAC,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;IACxE,IAAI,OAAO,CAAC,OAAO;QAAE,IAAI,CAAC,IAAI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C;YACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC3C,KAAK,CAAC,KAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YAClF,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,IAAI;QACJ,KAAK;YACH,KAAK,CAAC,KAAM,CAAC,GAAG,EAAE,CAAA;YAClB,KAAK,CAAC,IAAI,EAAE,CAAA;QACd,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Minifier, MinifyLevel } from '../../_exports/index.js';
|
|
2
|
+
import { type EnvVar } from './deploy.js';
|
|
3
|
+
import type { DeployEvent, ReplSession, TestEvent } from './session.js';
|
|
4
|
+
export type HeapBaselineAction = 'created' | 'ok' | 'exceeded' | 'updated' | 'stale';
|
|
5
|
+
export interface TestFileResult {
|
|
6
|
+
file: string;
|
|
7
|
+
passed: number;
|
|
8
|
+
failed: number;
|
|
9
|
+
skipped: number;
|
|
10
|
+
todo: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
events: TestEvent[];
|
|
13
|
+
error?: string;
|
|
14
|
+
/** heapUsed delta (bytes) between run start and end, after gc on both sides */
|
|
15
|
+
heapDelta?: number;
|
|
16
|
+
/** Net timer count change between run start and end (should be 0) */
|
|
17
|
+
timerDelta?: number;
|
|
18
|
+
/** Net in-flight HTTP request count change (should be 0). Detects fetches
|
|
19
|
+
* that were initiated but not cancelled or awaited before teardown. */
|
|
20
|
+
pendingDelta?: number;
|
|
21
|
+
/** Chip reported by the device (e.g. "esp32c6", "host"). Used as baseline key. */
|
|
22
|
+
chip?: string;
|
|
23
|
+
/** Stored baseline value for this chip (if a baseline file existed) */
|
|
24
|
+
heapBaselineStored?: number;
|
|
25
|
+
/** What happened to the heap-baseline file this run */
|
|
26
|
+
heapBaselineAction?: HeapBaselineAction;
|
|
27
|
+
}
|
|
28
|
+
export interface TestRunOptions {
|
|
29
|
+
minify: boolean;
|
|
30
|
+
bytecode: boolean;
|
|
31
|
+
minifier?: Minifier;
|
|
32
|
+
minifyLevel?: MinifyLevel;
|
|
33
|
+
envVars: EnvVar[];
|
|
34
|
+
timeout: number;
|
|
35
|
+
buildDir: string;
|
|
36
|
+
/** Value of MIKRO_ENV to set during the test run (e.g. 'test', 'simulator'). */
|
|
37
|
+
mikroEnv: string;
|
|
38
|
+
/** If true, write the current heapDelta as the new baseline for the current chip. */
|
|
39
|
+
updateHeapBaselines?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve test files from a list of patterns. Each pattern may be:
|
|
43
|
+
* - an explicit path to an existing file (included directly)
|
|
44
|
+
* - a glob pattern (expanded against cwd, excluding node_modules/build)
|
|
45
|
+
*
|
|
46
|
+
* With no patterns, falls back to the default `**\/*.test.ts` glob. Patterns
|
|
47
|
+
* that match nothing throw — a typo in a path shouldn't silently run zero
|
|
48
|
+
* tests.
|
|
49
|
+
*/
|
|
50
|
+
export declare function discoverTestFiles(cwd: string, patterns?: readonly string[]): Promise<string[]>;
|
|
51
|
+
export interface TestManifestCallbacks {
|
|
52
|
+
/** Called with the test file about to start (based on deploy manifest order). */
|
|
53
|
+
onFileStart?: (file: string, index: number, total: number) => void;
|
|
54
|
+
/** Called when a file's run_done event arrives, closing out its result. */
|
|
55
|
+
onFileDone?: (result: TestFileResult, index: number, total: number) => void;
|
|
56
|
+
/** Per-event hook (suite/test events). */
|
|
57
|
+
onEvent?: (event: TestEvent, file: string) => void;
|
|
58
|
+
/** Console output forwarding. */
|
|
59
|
+
onLog?: (level: string, text: string, file: string) => void;
|
|
60
|
+
/** Deploy-phase progress. Fired for each DeployEvent before tests start. */
|
|
61
|
+
onDeployEvent?: (event: DeployEvent) => void;
|
|
62
|
+
/** Generic progress messages. */
|
|
63
|
+
log?: (msg: string) => void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build the test manifest, deploy once, and observe the device supervisor
|
|
67
|
+
* stream as each test file runs in its own fresh runtime. Returns one
|
|
68
|
+
* TestFileResult per input, with heap-baseline bookkeeping applied.
|
|
69
|
+
*/
|
|
70
|
+
export declare function runTestManifest(session: ReplSession, testFiles: string[], options: TestRunOptions, cb?: TestManifestCallbacks): Promise<TestFileResult[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Demultiplex the device event stream per file. Each run_done (e:6) closes
|
|
73
|
+
* the current file and advances the index; manifest_done ends the run.
|
|
74
|
+
*
|
|
75
|
+
* Readiness handling: the initial deploy restarts the device once, so a
|
|
76
|
+
* single ready event is expected before test 1. Any subsequent ready event
|
|
77
|
+
* (after test 1's first event) indicates an unexpected reboot — treat as a
|
|
78
|
+
* crash and bail, returning partial results.
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Observe the device event stream and produce one TestFileResult per test
|
|
82
|
+
* file. Exported so the reducer's contract with the firmware supervisor
|
|
83
|
+
* can be unit-tested without going through the real build+deploy path.
|
|
84
|
+
*/
|
|
85
|
+
export declare function collectManifestEvents(session: ReplSession, testFiles: string[], timeoutMs: number, cb: TestManifestCallbacks): Promise<TestFileResult[]>;
|
|
86
|
+
//# sourceMappingURL=testRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testRunner.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/testRunner.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,yBAAyB,CAAA;AAElE,OAAO,EAAe,KAAK,MAAM,EAAC,MAAM,aAAa,CAAA;AAErD,OAAO,KAAK,EAAC,WAAW,EAAa,WAAW,EAAE,SAAS,EAAC,MAAM,cAAc,CAAA;AA8BhF,MAAM,MAAM,kBA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