Anki/ts
Damien Elmes 6941bccde4 Add support for proto3 optional scalars
Protobuf 3.15 introduced support for marking scalar fields like
uint32 as optional, and all of our tooling appears to support it
now. This allows us to use simple optional/null checks in our Rust/
TypeScript code, without having to resort to an inner message.

I had to apply a minor patch to protobufjs to get this working with
the json-module output; this has also been submitted upstream:
https://github.com/protobufjs/protobuf.js/pull/1693

I've modified CardStatsResponse as an example of the new syntax.

One thing to note: while the Rust and TypeScript bindings use optional/
null fields, as that is the norm in those languages, Google's Python
bindings are not very Pythonic. Referencing an optional field that is
missing will yield the default value, and a separate HasField() call
is required, eg:

```
>>> from anki.stats_pb2 import CardStatsResponse as R
... msg = R.FromString(b"")
... print(msg.first_review)
... print(msg.HasField("first_review"))
0
False
```
2022-02-27 19:42:06 +10:00
..
card-info Add support for proto3 optional scalars 2022-02-27 19:42:06 +10:00
change-notetype Consider using --force-message for ts/protobuf.bzl (#1694) 2022-02-27 17:35:07 +10:00
components Fix insert media always insert at the start (on Windows) (#1684) 2022-02-25 10:59:06 +10:00
congrats add back support for custom mount point in congrats screen 2022-02-17 16:28:48 +10:00
deck-options Consider using --force-message for ts/protobuf.bzl (#1694) 2022-02-27 17:35:07 +10:00
domlib Move all buttons to our custom inline surrounding (#1682) 2022-02-22 22:17:22 +10:00
editable Fix Mathjax sometimes being deleted even though it's not selected (#1696) 2022-02-27 17:58:01 +10:00
editor Consider using --force-message for ts/protobuf.bzl (#1694) 2022-02-27 17:35:07 +10:00
graphs Consider using --force-message for ts/protobuf.bzl (#1694) 2022-02-27 17:35:07 +10:00
html-filter Use eslint for sorting our imports (#1637) 2022-02-04 18:36:34 +10:00
lib Add support for proto3 optional scalars 2022-02-27 19:42:06 +10:00
patches Add support for proto3 optional scalars 2022-02-27 19:42:06 +10:00
reviewer fix reviewer_extras 2022-02-14 18:46:50 +10:00
sql_format run buildifier/buildozer to tidy up BUILD files 2021-12-14 09:18:24 +10:00
svelte Improved add-on extension API (#1626) 2022-02-03 14:52:11 +10:00
sveltelib Fix plain text (#1689) 2022-02-25 11:14:26 +10:00
.eslintrc.js Use eslint for sorting our imports (#1637) 2022-02-04 18:36:34 +10:00
.gitignore Update eslint to 4.22.0 2021-04-22 19:19:39 +02:00
BUILD.bazel Remove individual .html files + other refactorings (#1588) 2022-01-16 15:05:35 +10:00
compile_sass.bzl Remove individual .html files + other refactorings (#1588) 2022-01-16 15:05:35 +10:00
copy.bzl include sourcemaps for pages/* in dev builds 2021-04-20 17:33:46 +10:00
esbuild.bzl update to latest rules_nodejs & switch to ts_project 2021-10-01 12:52:53 +10:00
eslint.bzl Use eslint for sorting our imports (#1637) 2022-02-04 18:36:34 +10:00
format.sh prettier: don't depend on system node being available 2021-11-25 07:14:15 +10:00
generate_page.bzl Remove individual .html files + other refactorings (#1588) 2022-01-16 15:05:35 +10:00
jest.bzl Update to Jest 28 alpha 2022-02-25 16:20:50 +10:00
jest.config.js update to latest rules_nodejs & switch to ts_project 2021-10-01 12:52:53 +10:00
licenses.json Update JS deps 2022-02-25 15:29:49 +10:00
page.html Remove individual .html files + other refactorings (#1588) 2022-01-16 15:05:35 +10:00
prettier.bzl prettier: don't depend on system node being available 2021-11-25 07:14:15 +10:00
proto.bzl update to latest rules_nodejs & switch to ts_project 2021-10-01 12:52:53 +10:00
protobuf-no-long.js add a hack to avoid Long.js in Jest tests 2021-04-17 17:05:48 +10:00
protobuf.bzl Consider using --force-message for ts/protobuf.bzl (#1694) 2022-02-27 17:35:07 +10:00
README.md add add.sh helper for adding dependency and updating licenses 2020-12-31 12:20:51 +10:00
tsconfig.json switch convenience symlinks to .bazel/ 2022-01-24 11:06:02 +10:00
typescript.bzl Refactor i18n (#1405) 2021-10-07 23:31:49 +10:00
update-licenses.sh fix update-licenses.sh 2021-12-03 20:35:53 +10:00
update.sh add add.sh helper for adding dependency and updating licenses 2020-12-31 12:20:51 +10:00
vendor.bzl copy_bootstrap_css/icons were unused 2022-01-15 20:35:11 +10:00
yarn.sh Replace individual d3 libraries with encompassing d3 2021-01-30 00:00:22 +01:00

Anki's TypeScript and Sass dependencies. Some TS/JS code is also stored separately in ../qt/aqt/data/web/.

To update all dependencies:

./update.sh

To add a new dev dependency, use something like:

./add.sh -D @rollup/plugin-alias