Since we are using jsdom, the emscripten generated code doesn't use
the node filesystem lookup for .wasm files. But then it falls back to
node for file:// urls, but this doesn't work because node treats file:
as a drive letter.
We can work around this by modifying the node path.normalize() function
to return the correct path.
Fixes: https://github.com/pybricks/pybricks-code/issues/1584
Some user events trigger react dom changes. These need to be wrapped in
act() to avoid a warning printed to the console. To be save, we wrap
all instances.
Jest added support for wasm imports which broke our tests. In the mean
time, Webpack 5 added a new asset inclusion mechanism that can work
around this and removes the need for our existing webpack workaround.
This makes the required changes needed to make the editor components
and sagas lazy-load to improve the time before the first render of the
app.
This is done by making sure we only import types from the monaco editor
module anywhere other than the saga and the component modules and using
React.lazy to lazy-load the component and start the sagas.
This cuts the main bundle time to less than 1/2 so load time should be
over twice as fast now.
This adds support to the BLE Pybricks Profile v1.2.0. This includes a
new method to download and run programs and a new file format for the
user program.
Code for the old download and run is kept for backwards compatibility.
However, the PnP ID characteristic is no longer optional, so the
minimum Pybricks Profile is now v1.1.0.
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].
[1]: https://phryneas.de/redux-typescript-no-discriminating-union