Fixes#9848.
Root cause of #9848 is unknown, because the cache state file was filled
with nul bytes. It is unclear how that could have happened, but seems
likely to be external interference.
The cascade was that Server failed to start because it would crash when
attempting to load the cache state file. So this fix resolves that by
handling invalid file exceptions.
Fixes#9939.
Uses refactored KeymanSentry.ts in developer-utils and updates the
loader in Server to run from that.
The changes to tray.ts and friends are required to deal with a top-level
await issue with the shutdown call.
The top-level await issue is described in detail at
https://marc.durdin.net/2023/11/dynamic-import-on-node-js-with-circular-dependencies-leads-to-interesting-failure-modes/
tl;dr: shutdown needed to do a proper Sentry shutdown. The shutdown code
was in index.ts. This led to a circular dependency and caused a silent
and abrupt exit code 13 in Node.js. Moved shutdown code into shutdown.ts
to resolve this.
Adds line number context for:
* Error_VirtualCharacterKeysNotSupportedInKeymanWeb
* Error_VirtualKeysNotValidForMnemonicLayouts
* Warn_ExtendedShiftFlagsNotSupportedInKeymanWeb
* Hint_UnreachableKeyCode
* Warn_HelpFileMissing
* Warn_EmbedJsFileMissing
* Error_NotAnyRequiresVersion14
Line number metadata is not easily accessible where the following
messages are generated, so these are a potential future improvement:
* Warn_OptionStoreNameInvalid
* Error_NotSupportedInKeymanWebStore
Fixes#9931.
Provide additional line and file context for some KeymanWeb
compiler messages. This change requires debug data in the intermediate
kmx data provided to the kmw compiler, which should have no impact on
the final .js if debug=false.
This commit only addresses line number data in
Error_NotSupportedInKeymanWebContext and
Error_NotSupportedInKeymanWebOutput.
There are other compiler messages which could benefit from this data:
* Warn_OptionStoreNameInvalid
* Error_VirtualCharacterKeysNotSupportedInKeymanWeb
* Error_VirtualKeysNotValidForMnemonicLayouts
* Warn_ExtendedShiftFlagsNotSupportedInKeymanWeb
* Hint_UnreachableKeyCode
* Error_NotSupportedInKeymanWebStore
* Warn_HelpFileMissing
* Warn_EmbedJsFileMissing
* Error_NotAnyRequiresVersion14
Given we've just run a build, this (a) seems unnecessary, and (b) seems
to go wrong in some circumstances anyway, e.g.
https://build.palaso.org/buildConfiguration/Keyman_Developer_Release/421326?buildTab=log&focusLine=19936&linesState=18839&logView=flowAware:
```
07:01:29 > @keymanapp/kmc@17.0.205-alpha prepublishOnly
07:01:29 > npm run build
07:01:29
07:01:31
07:01:31 > @keymanapp/kmc@17.0.205-alpha build
07:01:31 > tsc -b
07:01:31
07:01:35 ../../../common/web/types/build/src/kmx/kmx.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts.
07:01:35 ../../../common/web/types/build/src/kmx/kmx.d.ts(1,2): error TS1345: An expression of type 'void' cannot be tested for truthiness.
...
```
Fixes#9930.
* Fixes the index offset calculation, with +1 for >=v10.0 keyboards and
-1 for <v10.0 keyboards (difference is because older version keyboards
have context offsets calculated in the opposite direction). Note that
this happened because the `CODE_CONTEXTEX` index is stored in memory
as 0-based in kmc, but was 1-based in kmcomp.
* Adds unit tests for v9.0 and v10.0 keyboards for `context(n)` in
context.
* Adds unit tests for v9.0 and v10.0 keyboards for `context(n)` in
output. These were already correct but now we can be assured that
they are being tested.
* Enables code coverage for kmw-compiler, and sets a lower threshold for
pass because coverage is still just over 70%.
Fixes#9923.
These are no longer used because we now use kmc for builds. This also
means that the kmcomp-x64-structures test is no longer required, because
that was used to keep the Delphi and C++ structures in sync.
There are some minor details around error message identifiers that are
still present in a handful of places, but they are work for another
time.
Fixes#7851.
Note that this fixes the selection pop issue with duplicate ids in some
scenarios but not all. For example, the undo stack doesn't have enough
detail at this point to be able to track this. This fix addresses the
most egregious issue relating to key size adjustment and similar.
Fixes#8000.
In earlier versions of KeymanWeb, it was assumed that layer switch keys
would not necessarily need an identifier, as they would not be
generating a standard KeymanWeb key event. However, this assumption does
not really hold, so we should be warning on missing identifiers for
layer switch keys.
Renames two messages.ts to kmn-compiler-messages.ts and
kmw-compiler-messages.ts, as otherwise confusion reigns.
Also a minor cleanup of the error messages from touch layout processing,
to clarify message names and return appropriate message for missing
layout file.
Fixes#9845.
It seems that the logic for `osk-always-visible` is not quite right on
touch devices -- the OSK disappears on blur but remains touchable -- so
presses in the OSK region emit key events. For Keyman Developer Server,
the simple workaround is to only use `<body class="osk-always-visible">`
when on desktop devices.
We should review the logic for `osk-always-visible` in KeymanWeb, so
that this issue does not arise on touch devices. This patch addresses
the issue in Keyman Developer Server, and matches the behaviour we want
on touch devices in any case, as we don't really want the OSK visible
when blurred, unlike on desktop.
Fixes#7852.
When undo is run in the layout builder, it is better to keep the user's
selected presentation if possible. (The selected presentation is not
stored in the undo stack, but is a view property affected by the
currently selected platform.)