- Means add-on authors should not need to inject any code in their build
- Should be more flexible - we can export multiple libraries if we wish,
and don't have to worry about require() being clobbered by old add-ons.
In order to split backend.proto into a more manageable size, the protobuf
handling needed to be updated. This took more time than I would have
liked, as each language handles protobuf differently:
- The Python Protobuf code ignores "package" directives, and relies
solely on how the files are laid out on disk. While it would have been
nice to keep the generated files in a private subpackage, Protobuf gets
confused if the files are located in a location that does not match
their original .proto layout, so the old approach of storing them in
_backend/ will not work. They now clutter up pylib/anki instead. I'm
rather annoyed by that, but alternatives seem to be having to add an extra
level to the Protobuf path, making the other languages suffer, or trying
to hack around the issue by munging sys.modules.
- Protobufjs fails to expose packages if they don't start with a capital
letter, despite the fact that lowercase packages are the norm in most
languages :-( This required a patch to fix.
- Rust was the easiest, as Prost is relatively straightforward compared
to Google's tools.
The Protobuf files are now stored in /proto/anki, with a separate package
for each file. I've split backend.proto into a few files as a test, but
the majority of that work is still to come.
The Python Protobuf building is a bit of a hack at the moment, hard-coding
"proto" as the top level folder, but it seems to get the job done for now.
Also changed the workspace name, as there seems to be a number of Bazel
repos moving away from the more awkward reverse DNS naming style.
- prettier's formatting has changed, so files needed to be reformatted
- dart is spitting out deprecation warnings like:
254 │ 2: $spacer / 2,
│ ^^^^^^^^^^^
╵
bazel-out/darwin-fastbuild/bin/ts/sass/bootstrap/_variables.scss 254:6 @import
ts/sass/button_mixins.scss 2:9 @use
ts/components/ColorPicker.svelte 2:5 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div($grid-gutter-width, 2)
As far as I can tell, the existing code was transforming the encoded
protobuf data into UTF8, and we're just lucky it wasn't causing problems
with the small message we were sending.
Switching to lodash-es caused Jest to fail. The standard Jest workflow
would be to transpile things with Bazel, but we can do it faster by
bundling with esbuild.
the log in lib.test.ts has revealed numbers are being set as Long instead
of JS numbers, and the published workaround for it is not working :-(
- try out bootstrap modals - they're not perfect, but let's see how
they go for now. Won't be hard to switch to bridge commands if required.
- handle adding/renaming/removing
- add a class to manage the state
It looks like the templated_args change only masked the error last time;
Jest seems broken on Windows with both the patched .24 version, latest
stable, and the new beta version too, presumably because symlinks are
being handled differently on Windows somehow. It might be possible to
hack around the issue by patching the following file, but I'm not sure:
https://github.com/facebook/jest/blob/master/packages/jest-haste-map/src/crawlers/node.ts