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.
- 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 +40 -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 +52 -0
- package/dist/cli/commands/sim/dev.d.ts.map +1 -0
- package/dist/cli/commands/sim/dev.js +380 -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 +356 -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 +228 -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 +406 -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 +57 -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 +657 -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 +120 -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 +46 -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 +90 -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 +17 -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 +39 -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 +15 -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 +69 -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 +32 -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 +31 -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 +33 -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 +14 -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 +16 -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 +22 -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 +55 -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 +201 -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 +957 -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,69 @@
|
|
|
1
|
+
import { command, constant } from '@optique/core';
|
|
2
|
+
import { object as objectConstruct, or as orConstruct } from '@optique/core/constructs';
|
|
3
|
+
import { createElement } from 'react';
|
|
4
|
+
import * as cleanSub from './sim/clean.js';
|
|
5
|
+
import * as deploySub from './sim/deploy.js';
|
|
6
|
+
import * as devSub from './sim/dev.js';
|
|
7
|
+
import * as envSub from './sim/env.js';
|
|
8
|
+
import * as profileSub from './sim/profile.js';
|
|
9
|
+
import * as replSub from './sim/repl.js';
|
|
10
|
+
import * as resetSub from './sim/reset.js';
|
|
11
|
+
import * as scaffoldSub from './sim/scaffold.js';
|
|
12
|
+
import * as testSub from './sim/test.js';
|
|
13
|
+
export const args = command('sim', objectConstruct({
|
|
14
|
+
action: constant('sim'),
|
|
15
|
+
sub: orConstruct(devSub.args, deploySub.args, replSub.args, testSub.args, envSub.args, cleanSub.args, resetSub.args, profileSub.args, scaffoldSub.args),
|
|
16
|
+
}));
|
|
17
|
+
export async function run(config) {
|
|
18
|
+
const sub = config.sub;
|
|
19
|
+
switch (sub.subcommand) {
|
|
20
|
+
case 'dev':
|
|
21
|
+
await devSub.run(sub);
|
|
22
|
+
break;
|
|
23
|
+
case 'deploy':
|
|
24
|
+
await deploySub.run(sub);
|
|
25
|
+
break;
|
|
26
|
+
case 'repl':
|
|
27
|
+
await replSub.run(sub);
|
|
28
|
+
break;
|
|
29
|
+
case 'test':
|
|
30
|
+
await testSub.run(sub);
|
|
31
|
+
break;
|
|
32
|
+
case 'env':
|
|
33
|
+
await envSub.run(sub);
|
|
34
|
+
break;
|
|
35
|
+
case 'clean':
|
|
36
|
+
cleanSub.run();
|
|
37
|
+
break;
|
|
38
|
+
case 'reset':
|
|
39
|
+
await resetSub.run(sub);
|
|
40
|
+
break;
|
|
41
|
+
case 'profile':
|
|
42
|
+
await profileSub.run(sub);
|
|
43
|
+
break;
|
|
44
|
+
case 'scaffold':
|
|
45
|
+
scaffoldSub.run(sub);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Map subcommand → React component for the dispatcher in cli.ts.
|
|
51
|
+
* Subcommands without an Ink component (one-shots) return null.
|
|
52
|
+
*/
|
|
53
|
+
export function getInkComponent(sub) {
|
|
54
|
+
switch (sub.subcommand) {
|
|
55
|
+
case 'dev':
|
|
56
|
+
return { Component: devSub.default, props: { args: sub } };
|
|
57
|
+
case 'repl':
|
|
58
|
+
return { Component: replSub.default, props: { args: sub } };
|
|
59
|
+
default:
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export default function SimComponent(props) {
|
|
64
|
+
const inkUi = getInkComponent(props.args.sub);
|
|
65
|
+
if (!inkUi)
|
|
66
|
+
return null;
|
|
67
|
+
return createElement(inkUi.Component, inkUi.props);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=sim.js.map
|
|
@@ -0,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A;IAC7C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,OAAO,aAAa,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InferValue } from '@optique/core/parser';
|
|
2
|
+
export declare const args: import("@optique/core").Parser<"sync", {
|
|
3
|
+
readonly action: "tail";
|
|
4
|
+
readonly port: string | undefined;
|
|
5
|
+
readonly restart: true | undefined;
|
|
6
|
+
readonly logLevel: string | undefined;
|
|
7
|
+
}, ["matched", string] | ["parsing", {
|
|
8
|
+
readonly action: "tail";
|
|
9
|
+
readonly port: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
10
|
+
readonly restart: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
11
|
+
readonly logLevel: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
12
|
+
}] | undefined>;
|
|
13
|
+
export declare function run(config: InferValue<typeof args>): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=tail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/tail.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAA;AASpD,eAAO,MAAM,IAAI;;;;;;;;;;eAgBhB,CAAA;AAmBD,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,iBAoBxD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { command, constant, message, optional } from '@optique/core';
|
|
2
|
+
import { object } from '@optique/core/constructs';
|
|
3
|
+
import { flag, option } from '@optique/core/primitives';
|
|
4
|
+
import { string } from '@optique/core/valueparser';
|
|
5
|
+
import { logLevelAllows, parseLogLevel } from '../lib/parseMinifier.js';
|
|
6
|
+
import { openSession } from '../lib/serial/openSession.js';
|
|
7
|
+
export const args = command('tail', object({
|
|
8
|
+
action: constant('tail'),
|
|
9
|
+
port: optional(option('-p', '--port', string({ metavar: 'PORT' }), {
|
|
10
|
+
description: message `Serial port to connect to, example: /dev/cu.usbmodem101`,
|
|
11
|
+
})),
|
|
12
|
+
restart: optional(flag('-r', '--restart', { description: message `Restart the device first` })),
|
|
13
|
+
logLevel: optional(option('--loglevel', string({ metavar: 'LEVEL' }), {
|
|
14
|
+
description: message `Drop device output below this level: none, error, warn, info, debug (default: debug)`,
|
|
15
|
+
})),
|
|
16
|
+
}));
|
|
17
|
+
function formatEvent(event, logLevel) {
|
|
18
|
+
switch (event.type) {
|
|
19
|
+
case 'log':
|
|
20
|
+
case 'warn':
|
|
21
|
+
case 'error':
|
|
22
|
+
case 'info':
|
|
23
|
+
case 'debug':
|
|
24
|
+
return logLevelAllows(logLevel, event.type) ? event.text : null;
|
|
25
|
+
case 'eval_error':
|
|
26
|
+
return event.text;
|
|
27
|
+
case 'raw':
|
|
28
|
+
return event.text.trim().length > 0 ? event.text : null;
|
|
29
|
+
default:
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export async function run(config) {
|
|
34
|
+
const logLevel = parseLogLevel(config.logLevel) ?? 'debug';
|
|
35
|
+
const handles = await openSession({ port: config.port });
|
|
36
|
+
if (config.restart) {
|
|
37
|
+
handles.session.restart();
|
|
38
|
+
}
|
|
39
|
+
handles.session.messages$.subscribe((event) => {
|
|
40
|
+
const line = formatEvent(event, logLevel);
|
|
41
|
+
if (line !== null) {
|
|
42
|
+
process.stdout.write(line + '\n');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
process.on('exit', () => handles.close());
|
|
46
|
+
process.on('SIGINT', () => process.exit(0));
|
|
47
|
+
process.on('SIGTERM', () => process.exit(0));
|
|
48
|
+
await new Promise(() => { });
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=tail.js.map
|
|
@@ -0,0 +1 @@
|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CAAA;IAC3C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAE5C,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { InferValue } from '@optique/core/parser';
|
|
2
|
+
export declare const args: import("@optique/core").Parser<"sync", {
|
|
3
|
+
readonly action: "test";
|
|
4
|
+
readonly filters: readonly string[];
|
|
5
|
+
readonly port: string | undefined;
|
|
6
|
+
readonly env: string | undefined;
|
|
7
|
+
readonly secrets: string | undefined;
|
|
8
|
+
readonly noEnvFile: true | undefined;
|
|
9
|
+
readonly noMinify: true | undefined;
|
|
10
|
+
readonly minifier: string | undefined;
|
|
11
|
+
readonly minifyLevel: string | undefined;
|
|
12
|
+
readonly noBytecode: true | undefined;
|
|
13
|
+
readonly timeout: string | undefined;
|
|
14
|
+
readonly updateHeapBaselines: true | undefined;
|
|
15
|
+
readonly yes: true | undefined;
|
|
16
|
+
readonly diagnostics: true | undefined;
|
|
17
|
+
readonly json: true | undefined;
|
|
18
|
+
readonly agent: true | undefined;
|
|
19
|
+
}, ["matched", string] | ["parsing", {
|
|
20
|
+
readonly action: "test";
|
|
21
|
+
readonly filters: readonly (import("@optique/core").ValueParserResult<string> | undefined)[];
|
|
22
|
+
readonly port: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
23
|
+
readonly env: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
24
|
+
readonly secrets: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
25
|
+
readonly noEnvFile: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
26
|
+
readonly noMinify: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
27
|
+
readonly minifier: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
28
|
+
readonly minifyLevel: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
29
|
+
readonly noBytecode: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
30
|
+
readonly timeout: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
31
|
+
readonly updateHeapBaselines: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
32
|
+
readonly yes: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
33
|
+
readonly diagnostics: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
34
|
+
readonly json: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
35
|
+
readonly agent: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
36
|
+
}] | undefined>;
|
|
37
|
+
export declare function run(config: InferValue<typeof args>): Promise<void>;
|
|
38
|
+
export default function _Test(): null;
|
|
39
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/test.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAA;AAkBpD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4DhB,CAAA;AAaD,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAuMxE;AAkMD,MAAM,CAAC,OAAO,UAAU,KAAK,SAE5B"}
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import * as pathlib from 'node:path';
|
|
2
|
+
import { command, constant, message, multiple, optional } from '@optique/core';
|
|
3
|
+
import { object } from '@optique/core/constructs';
|
|
4
|
+
import { argument, flag, option } from '@optique/core/primitives';
|
|
5
|
+
import { string } from '@optique/core/valueparser';
|
|
6
|
+
import { agentEmit, agentResult, isAgentMode } from '../lib/agent.js';
|
|
7
|
+
import { loadEnvFiles, validateNvsKeys } from '../lib/deploy.js';
|
|
8
|
+
import { formatDeployEvent } from '../lib/deployProgress.js';
|
|
9
|
+
import { parseMinifier, parseMinifyLevel } from '../lib/parseMinifier.js';
|
|
10
|
+
import { getMikroDir, resolveProjectRoot } from '../lib/projectRoot.js';
|
|
11
|
+
import { openSession } from '../lib/serial/openSession.js';
|
|
12
|
+
import { discoverTestFiles, runTestManifest, } from '../lib/testRunner.js';
|
|
13
|
+
export const args = command('test', object({
|
|
14
|
+
action: constant('test'),
|
|
15
|
+
filters: multiple(argument(string({ metavar: 'PATH_OR_PATTERN' }), {
|
|
16
|
+
description: message `Test file paths and/or glob patterns. Pass one or more. Default: **/*.test.ts`,
|
|
17
|
+
})),
|
|
18
|
+
port: optional(option('-p', '--port', string({ metavar: 'PORT' }), {
|
|
19
|
+
description: message `Serial port of device`,
|
|
20
|
+
})),
|
|
21
|
+
env: optional(option('--env', string({ metavar: 'FILE' }), {
|
|
22
|
+
description: message `Path to .env file`,
|
|
23
|
+
})),
|
|
24
|
+
secrets: optional(option('--secrets', string({ metavar: 'FILE' }), {
|
|
25
|
+
description: message `Path to .env.secrets file`,
|
|
26
|
+
})),
|
|
27
|
+
noEnvFile: optional(flag('--no-env-file', {
|
|
28
|
+
description: message `Skip auto-loading of .env and .env.test from the project root`,
|
|
29
|
+
})),
|
|
30
|
+
noMinify: optional(flag('--no-minify', { description: message `Skip minification` })),
|
|
31
|
+
minifier: optional(option('--minifier', string({ metavar: 'NAME' }), {
|
|
32
|
+
description: message `Minifier: esbuild, terser, or swc (default: esbuild)`,
|
|
33
|
+
})),
|
|
34
|
+
minifyLevel: optional(option('--minify-level', string({ metavar: 'LEVEL' }), {
|
|
35
|
+
description: message `Minify level: default or max`,
|
|
36
|
+
})),
|
|
37
|
+
noBytecode: optional(flag('--no-bytecode', { description: message `Skip bytecode compilation` })),
|
|
38
|
+
timeout: optional(option('-t', '--timeout', string({ metavar: 'MS' }), {
|
|
39
|
+
description: message `Per-file timeout in ms (default: 60000)`,
|
|
40
|
+
})),
|
|
41
|
+
updateHeapBaselines: optional(flag('--update-heap-baselines', {
|
|
42
|
+
description: message `Overwrite per-file heap-baseline snapshots (<name>.test.heap-baseline.json) with the current run's heapDelta, keyed by the current chip.`,
|
|
43
|
+
})),
|
|
44
|
+
yes: optional(flag('-y', '--yes', { description: message `Skip confirmation prompt` })),
|
|
45
|
+
diagnostics: optional(flag('--diagnostics', {
|
|
46
|
+
description: message `Show per-test heap progress and other runtime diagnostics`,
|
|
47
|
+
})),
|
|
48
|
+
json: optional(flag('--json', { description: message `Output as JSON` })),
|
|
49
|
+
agent: optional(flag('--agent', { description: message `NDJSON agent mode` })),
|
|
50
|
+
}));
|
|
51
|
+
// ── Colors ──────────────────────────────────────────────────────────
|
|
52
|
+
const green = (s) => `\x1b[32m${s}\x1b[0m`;
|
|
53
|
+
const red = (s) => `\x1b[31m${s}\x1b[0m`;
|
|
54
|
+
const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
|
|
55
|
+
const blue = (s) => `\x1b[34m${s}\x1b[0m`;
|
|
56
|
+
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
57
|
+
const bold = (s) => `\x1b[1m${s}\x1b[0m`;
|
|
58
|
+
// ── Run ─────────────────────────────────────────────────────────────
|
|
59
|
+
export async function run(config) {
|
|
60
|
+
const jsonOutput = config.json === true || isAgentMode(config.agent);
|
|
61
|
+
// eslint-disable-next-line no-console
|
|
62
|
+
const log = jsonOutput ? () => { } : (msg) => console.error(msg);
|
|
63
|
+
const cwd = process.cwd();
|
|
64
|
+
let testFiles = [];
|
|
65
|
+
try {
|
|
66
|
+
testFiles = await discoverTestFiles(cwd, config.filters);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
70
|
+
if (jsonOutput)
|
|
71
|
+
agentResult('test', { error: msg });
|
|
72
|
+
else
|
|
73
|
+
log(msg);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
if (testFiles.length === 0) {
|
|
77
|
+
if (jsonOutput) {
|
|
78
|
+
agentResult('test', { error: 'No test files found' });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
log('No *.test.ts files found');
|
|
82
|
+
}
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
log(`Found ${testFiles.length} test file(s)`);
|
|
86
|
+
// Confirm before overwriting device app
|
|
87
|
+
if (!config.yes && !jsonOutput && process.stdin.isTTY) {
|
|
88
|
+
const { createInterface } = await import('node:readline');
|
|
89
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
90
|
+
const answer = await new Promise((resolve) => {
|
|
91
|
+
rl.question('This will overwrite the app on the device. Continue? (y/N) ', resolve);
|
|
92
|
+
});
|
|
93
|
+
rl.close();
|
|
94
|
+
if (answer.toLowerCase() !== 'y') {
|
|
95
|
+
process.exit(0);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Connect to device
|
|
99
|
+
const handles = await openSession({
|
|
100
|
+
port: config.port,
|
|
101
|
+
onConnecting: (path) => log(`Connecting to ${path}`),
|
|
102
|
+
});
|
|
103
|
+
const { session } = handles;
|
|
104
|
+
// Forward any non-TLV bytes from the device (boot banner, panic traces)
|
|
105
|
+
// straight to stderr so a crash-looping or otherwise misbehaving device
|
|
106
|
+
// is visible to the user instead of silently timing out the test run.
|
|
107
|
+
// This also activates the shared messages$ pipeline; collectManifestEvents
|
|
108
|
+
// piggybacks on the same hot observable.
|
|
109
|
+
const sub = session.messages$.subscribe((event) => {
|
|
110
|
+
if (event.type === 'raw' && !jsonOutput) {
|
|
111
|
+
log(dim(event.text));
|
|
112
|
+
}
|
|
113
|
+
else if (event.type === 'raw' && jsonOutput) {
|
|
114
|
+
agentEmit({ type: 'log', level: 'raw', text: event.text });
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const envVars = await loadEnvFiles({
|
|
118
|
+
cwd: resolveProjectRoot(),
|
|
119
|
+
mode: 'test',
|
|
120
|
+
envFile: config.env,
|
|
121
|
+
secretsFile: config.secrets,
|
|
122
|
+
noEnvFile: config.noEnvFile === true,
|
|
123
|
+
});
|
|
124
|
+
validateNvsKeys(envVars);
|
|
125
|
+
if (envVars.length > 0) {
|
|
126
|
+
log(`Loaded ${envVars.length} env var(s) from file`);
|
|
127
|
+
}
|
|
128
|
+
const timeoutMs = config.timeout ? parseInt(config.timeout, 10) : 60_000;
|
|
129
|
+
const options = {
|
|
130
|
+
minify: !config.noMinify,
|
|
131
|
+
bytecode: !config.noBytecode,
|
|
132
|
+
minifier: parseMinifier(config.minifier),
|
|
133
|
+
minifyLevel: parseMinifyLevel(config.minifyLevel),
|
|
134
|
+
envVars,
|
|
135
|
+
timeout: timeoutMs,
|
|
136
|
+
buildDir: pathlib.join(getMikroDir(), 'build'),
|
|
137
|
+
mikroEnv: 'test',
|
|
138
|
+
updateHeapBaselines: config.updateHeapBaselines === true,
|
|
139
|
+
};
|
|
140
|
+
const startTime = Date.now();
|
|
141
|
+
let results;
|
|
142
|
+
try {
|
|
143
|
+
results = await runTestManifest(session, testFiles, options, {
|
|
144
|
+
onFileStart: (file, i, total) => {
|
|
145
|
+
const relPath = pathlib.relative(cwd, file);
|
|
146
|
+
if (jsonOutput) {
|
|
147
|
+
agentEmit({ type: 'file_start', file: relPath, index: i, total });
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
log(`\n${bold(`[${i + 1}/${total}]`)} ${relPath}`);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
onFileDone: (result) => {
|
|
154
|
+
const relPath = pathlib.relative(cwd, result.file);
|
|
155
|
+
if (jsonOutput) {
|
|
156
|
+
agentEmit({
|
|
157
|
+
type: 'file_done',
|
|
158
|
+
file: relPath,
|
|
159
|
+
passed: result.passed,
|
|
160
|
+
failed: result.failed,
|
|
161
|
+
skipped: result.skipped,
|
|
162
|
+
todo: result.todo,
|
|
163
|
+
duration: result.duration,
|
|
164
|
+
...(typeof result.heapDelta === 'number' ? { heapDelta: result.heapDelta } : {}),
|
|
165
|
+
...(typeof result.timerDelta === 'number' ? { timerDelta: result.timerDelta } : {}),
|
|
166
|
+
...(typeof result.pendingDelta === 'number' ? { pendingDelta: result.pendingDelta } : {}),
|
|
167
|
+
...(result.chip ? { chip: result.chip } : {}),
|
|
168
|
+
...(result.heapBaselineAction ? { heapBaselineAction: result.heapBaselineAction } : {}),
|
|
169
|
+
...(typeof result.heapBaselineStored === 'number'
|
|
170
|
+
? { heapBaselineStored: result.heapBaselineStored }
|
|
171
|
+
: {}),
|
|
172
|
+
...(result.error ? { error: result.error } : {}),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
renderFileSummary(result, relPath);
|
|
177
|
+
renderLeakReport(result);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
onEvent: (event) => {
|
|
181
|
+
if (!jsonOutput)
|
|
182
|
+
renderTestEvent(event, config.diagnostics === true);
|
|
183
|
+
},
|
|
184
|
+
onDeployEvent: (event) => {
|
|
185
|
+
if (jsonOutput) {
|
|
186
|
+
if (event.type === 'uploading' || event.type === 'checking') {
|
|
187
|
+
agentEmit({
|
|
188
|
+
type: `deploy_${event.type}`,
|
|
189
|
+
file: event.file,
|
|
190
|
+
index: event.index,
|
|
191
|
+
total: event.total,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const msg = formatDeployEvent(event);
|
|
197
|
+
if (msg !== null)
|
|
198
|
+
log(dim(` ${msg}`));
|
|
199
|
+
},
|
|
200
|
+
onLog: (level, text, file) => {
|
|
201
|
+
const relPath = pathlib.relative(cwd, file);
|
|
202
|
+
if (jsonOutput) {
|
|
203
|
+
agentEmit({ type: 'log', file: relPath, level, text });
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
// Supervisor announcements and other 'debug'-level events are
|
|
207
|
+
// internal plumbing noise by default; only surface them when the
|
|
208
|
+
// user asked for diagnostics.
|
|
209
|
+
if (level === 'debug' && config.diagnostics !== true)
|
|
210
|
+
return;
|
|
211
|
+
const color = level === 'error' ? red : level === 'warn' ? yellow : dim;
|
|
212
|
+
log(` ${color(text)}`);
|
|
213
|
+
},
|
|
214
|
+
log: jsonOutput ? undefined : (msg) => log(dim(msg)),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
sub.unsubscribe();
|
|
219
|
+
handles.close();
|
|
220
|
+
}
|
|
221
|
+
// Aggregate
|
|
222
|
+
const totals = results.reduce((acc, r) => ({
|
|
223
|
+
passed: acc.passed + r.passed,
|
|
224
|
+
failed: acc.failed + r.failed,
|
|
225
|
+
skipped: acc.skipped + r.skipped,
|
|
226
|
+
todo: acc.todo + r.todo,
|
|
227
|
+
}), { passed: 0, failed: 0, skipped: 0, todo: 0 });
|
|
228
|
+
if (jsonOutput) {
|
|
229
|
+
agentResult('test', {
|
|
230
|
+
...totals,
|
|
231
|
+
total: totals.passed + totals.failed + totals.skipped + totals.todo,
|
|
232
|
+
files: results.map((r) => ({
|
|
233
|
+
file: pathlib.relative(cwd, r.file),
|
|
234
|
+
passed: r.passed,
|
|
235
|
+
failed: r.failed,
|
|
236
|
+
skipped: r.skipped,
|
|
237
|
+
todo: r.todo,
|
|
238
|
+
duration: r.duration,
|
|
239
|
+
error: r.error,
|
|
240
|
+
heapDelta: r.heapDelta,
|
|
241
|
+
timerDelta: r.timerDelta,
|
|
242
|
+
pendingDelta: r.pendingDelta,
|
|
243
|
+
chip: r.chip,
|
|
244
|
+
heapBaselineAction: r.heapBaselineAction,
|
|
245
|
+
heapBaselineStored: r.heapBaselineStored,
|
|
246
|
+
})),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
renderAlertSummary(results, cwd);
|
|
251
|
+
renderAggregate(totals, results.length, Date.now() - startTime);
|
|
252
|
+
}
|
|
253
|
+
process.exit(totals.failed > 0 ? 1 : 0);
|
|
254
|
+
}
|
|
255
|
+
// ── Rendering ───────────────────────────────────────────────────────
|
|
256
|
+
function renderTestEvent(event, diagnostics) {
|
|
257
|
+
const d = event.data;
|
|
258
|
+
switch (d.e) {
|
|
259
|
+
case 1: // suite_start
|
|
260
|
+
// eslint-disable-next-line no-console
|
|
261
|
+
console.error(` ${d.s}`);
|
|
262
|
+
break;
|
|
263
|
+
case 2: // test_pass
|
|
264
|
+
// eslint-disable-next-line no-console
|
|
265
|
+
console.error(` ${green('✓')} ${dim(String(d.t))} ${dim(`(${d.d}ms)`)}`);
|
|
266
|
+
break;
|
|
267
|
+
case 3: // test_fail
|
|
268
|
+
// eslint-disable-next-line no-console
|
|
269
|
+
console.error(` ${red('✗')} ${String(d.t)} ${dim(`(${d.d}ms)`)}`);
|
|
270
|
+
// eslint-disable-next-line no-console
|
|
271
|
+
console.error(` ${red(String(d.m))}`);
|
|
272
|
+
break;
|
|
273
|
+
case 4: // test_skip
|
|
274
|
+
// eslint-disable-next-line no-console
|
|
275
|
+
console.error(` ${yellow('-')} ${dim(String(d.t))}`);
|
|
276
|
+
break;
|
|
277
|
+
case 9: // test_todo
|
|
278
|
+
// eslint-disable-next-line no-console
|
|
279
|
+
console.error(` ${blue('□')} ${dim(String(d.t))}`);
|
|
280
|
+
break;
|
|
281
|
+
case 8: {
|
|
282
|
+
if (!diagnostics)
|
|
283
|
+
break;
|
|
284
|
+
const used = (d.u / 1024) | 0;
|
|
285
|
+
const total = (d.t / 1024) | 0;
|
|
286
|
+
const free = total - used;
|
|
287
|
+
const parts = [`heap: ${used}/${total}KB, free: ${free}KB`];
|
|
288
|
+
if (typeof d.f === 'number') {
|
|
289
|
+
parts.push(`sysFree: ${(d.f / 1024) | 0}KB`);
|
|
290
|
+
}
|
|
291
|
+
if (typeof d.mf === 'number') {
|
|
292
|
+
parts.push(`sysMinFree: ${(d.mf / 1024) | 0}KB`);
|
|
293
|
+
}
|
|
294
|
+
// eslint-disable-next-line no-console
|
|
295
|
+
console.error(dim(` [${parts.join(', ')}]`));
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function renderLeakReport(result) {
|
|
301
|
+
const chip = result.chip ?? 'unknown';
|
|
302
|
+
switch (result.heapBaselineAction) {
|
|
303
|
+
case 'created':
|
|
304
|
+
// eslint-disable-next-line no-console
|
|
305
|
+
console.error(` ${dim(`wrote heap-baseline for ${chip}: ${formatBytes(result.heapBaselineStored ?? 0)}`)}`);
|
|
306
|
+
break;
|
|
307
|
+
case 'updated':
|
|
308
|
+
// eslint-disable-next-line no-console
|
|
309
|
+
console.error(` ${dim(`updated heap-baseline for ${chip}: ${formatBytes(result.heapBaselineStored ?? 0)}`)}`);
|
|
310
|
+
break;
|
|
311
|
+
case 'exceeded': {
|
|
312
|
+
const over = (result.heapDelta ?? 0) - (result.heapBaselineStored ?? 0);
|
|
313
|
+
// eslint-disable-next-line no-console
|
|
314
|
+
console.error(` ${yellow(`⚠ heap-baseline exceeded for ${chip}: +${formatBytes(over)} over ${formatBytes(result.heapBaselineStored ?? 0)}. Re-run with --update-heap-baselines to accept.`)}`);
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
case 'stale': {
|
|
318
|
+
const under = (result.heapBaselineStored ?? 0) - (result.heapDelta ?? 0);
|
|
319
|
+
// eslint-disable-next-line no-console
|
|
320
|
+
console.error(` ${dim(`heap-baseline stale for ${chip}: now ${formatBytes(result.heapDelta ?? 0)} (stored ${formatBytes(result.heapBaselineStored ?? 0)}, -${formatBytes(under)}). Re-run with --update-heap-baselines to tighten.`)}`);
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
case 'ok':
|
|
324
|
+
default:
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
if ((result.timerDelta ?? 0) > 0) {
|
|
328
|
+
const n = result.timerDelta;
|
|
329
|
+
// eslint-disable-next-line no-console
|
|
330
|
+
console.error(` ${yellow(`⚠ ${n} leaked timer${n === 1 ? '' : 's'}`)}`);
|
|
331
|
+
}
|
|
332
|
+
if ((result.pendingDelta ?? 0) > 0) {
|
|
333
|
+
const n = result.pendingDelta;
|
|
334
|
+
// eslint-disable-next-line no-console
|
|
335
|
+
console.error(` ${yellow(`⚠ ${n} in-flight HTTP request${n === 1 ? '' : 's'} at teardown`)}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function renderFileSummary(result, _relPath) {
|
|
339
|
+
if (result.error) {
|
|
340
|
+
// eslint-disable-next-line no-console
|
|
341
|
+
console.error(` ${red('ERROR')}: ${result.error}`);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const parts = [];
|
|
345
|
+
if (result.passed > 0)
|
|
346
|
+
parts.push(green(`${result.passed} passed`));
|
|
347
|
+
if (result.failed > 0)
|
|
348
|
+
parts.push(red(`${result.failed} failed`));
|
|
349
|
+
if (result.skipped > 0)
|
|
350
|
+
parts.push(yellow(`${result.skipped} skipped`));
|
|
351
|
+
if (result.todo > 0)
|
|
352
|
+
parts.push(blue(`${result.todo} todo`));
|
|
353
|
+
// eslint-disable-next-line no-console
|
|
354
|
+
console.error(` ${parts.join(', ')} ${dim(`(${result.duration}ms)`)}`);
|
|
355
|
+
}
|
|
356
|
+
function formatDuration(ms) {
|
|
357
|
+
if (ms < 1000)
|
|
358
|
+
return `${ms}ms`;
|
|
359
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
360
|
+
}
|
|
361
|
+
function formatBytes(n) {
|
|
362
|
+
const abs = Math.abs(n);
|
|
363
|
+
if (abs < 1024)
|
|
364
|
+
return `${n}B`;
|
|
365
|
+
const kb = n / 1024;
|
|
366
|
+
if (abs < 1024 * 1024) {
|
|
367
|
+
return Number.isInteger(kb) ? `${kb}KB` : `${kb.toFixed(1)}KB`;
|
|
368
|
+
}
|
|
369
|
+
const mb = n / (1024 * 1024);
|
|
370
|
+
return Number.isInteger(mb) ? `${mb}MB` : `${mb.toFixed(1)}MB`;
|
|
371
|
+
}
|
|
372
|
+
function renderAlertSummary(results, cwd) {
|
|
373
|
+
const exceeded = results.filter((r) => r.heapBaselineAction === 'exceeded');
|
|
374
|
+
const stale = results.filter((r) => r.heapBaselineAction === 'stale');
|
|
375
|
+
const timerLeaks = results.filter((r) => (r.timerDelta ?? 0) > 0);
|
|
376
|
+
const httpLeaks = results.filter((r) => (r.pendingDelta ?? 0) > 0);
|
|
377
|
+
if (exceeded.length === 0 &&
|
|
378
|
+
stale.length === 0 &&
|
|
379
|
+
timerLeaks.length === 0 &&
|
|
380
|
+
httpLeaks.length === 0) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const rel = (f) => pathlib.relative(cwd, f);
|
|
384
|
+
// eslint-disable-next-line no-console
|
|
385
|
+
console.error(`\n${bold('Alerts:')}`);
|
|
386
|
+
if (exceeded.length > 0) {
|
|
387
|
+
const items = exceeded
|
|
388
|
+
.map((r) => `${rel(r.file)} (+${formatBytes((r.heapDelta ?? 0) - (r.heapBaselineStored ?? 0))})`)
|
|
389
|
+
.join(', ');
|
|
390
|
+
// eslint-disable-next-line no-console
|
|
391
|
+
console.error(` ${yellow(`⚠ heap exceeded: ${items}`)}`);
|
|
392
|
+
// eslint-disable-next-line no-console
|
|
393
|
+
console.error(` ${dim('Re-run with --update-heap-baselines to accept.')}`);
|
|
394
|
+
}
|
|
395
|
+
if (stale.length > 0) {
|
|
396
|
+
const items = stale
|
|
397
|
+
.map((r) => `${rel(r.file)} (-${formatBytes((r.heapBaselineStored ?? 0) - (r.heapDelta ?? 0))})`)
|
|
398
|
+
.join(', ');
|
|
399
|
+
// eslint-disable-next-line no-console
|
|
400
|
+
console.error(` ${dim(`heap stale: ${items}`)}`);
|
|
401
|
+
}
|
|
402
|
+
if (timerLeaks.length > 0) {
|
|
403
|
+
const items = timerLeaks.map((r) => `${rel(r.file)} (${r.timerDelta})`).join(', ');
|
|
404
|
+
// eslint-disable-next-line no-console
|
|
405
|
+
console.error(` ${yellow(`⚠ leaked timers: ${items}`)}`);
|
|
406
|
+
}
|
|
407
|
+
if (httpLeaks.length > 0) {
|
|
408
|
+
const items = httpLeaks.map((r) => `${rel(r.file)} (${r.pendingDelta})`).join(', ');
|
|
409
|
+
// eslint-disable-next-line no-console
|
|
410
|
+
console.error(` ${yellow(`⚠ in-flight HTTP: ${items}`)}`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function renderAggregate(totals, fileCount, totalMs) {
|
|
414
|
+
const total = totals.passed + totals.failed + totals.skipped + totals.todo;
|
|
415
|
+
const status = totals.failed === 0 ? green(bold('PASS')) : red(bold('FAIL'));
|
|
416
|
+
const parts = [];
|
|
417
|
+
if (totals.passed > 0)
|
|
418
|
+
parts.push(green(`${totals.passed} passed`));
|
|
419
|
+
if (totals.failed > 0)
|
|
420
|
+
parts.push(red(`${totals.failed} failed`));
|
|
421
|
+
if (totals.skipped > 0)
|
|
422
|
+
parts.push(yellow(`${totals.skipped} skipped`));
|
|
423
|
+
if (totals.todo > 0)
|
|
424
|
+
parts.push(blue(`${totals.todo} todo`));
|
|
425
|
+
// eslint-disable-next-line no-console
|
|
426
|
+
console.error(`\n${status} ${parts.join(', ')} (${total} tests across ${fileCount} files) ${dim(formatDuration(totalMs))}`);
|
|
427
|
+
}
|
|
428
|
+
// No interactive Ink component yet (non-interactive only for now)
|
|
429
|
+
export default function _Test() {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
//# sourceMappingURL=test.js.map
|