Adds `ERROR_PackageMustContainAPackageOrAKeyboard` and corresponding
unit tests. A couple of unit tests tweaked as their fixtures were no
longer valid!
This is a transfer of the functionality in the legacy package compiler;
we could go much further in verifying file types and excluding certain
files, but that's a big design session. For now, just refreshed to
include the set of Keyman for Windows and Keyman Engine for Windows
files which are most likely to be accidentally included.
Adds WARN_RedistFileShouldNotBeInPackage and WARN_DocFileDangerous and
corresponding unit tests and constant declarations.
Adds checks for bcp47 tag metadata for keyboards and lexical models --
both validity and minimality. Adds `ERROR_LanguageTagIsNotValid` and
`WARN_LanguageTagIsNotMinimal` messages and corresponding unit tests.
This was implemented by extending the existing duplicate id check, so
renamed that function accordingly.
Downgrades `Warn_KeyboardFileHasNoKeyboardVersion` to
`Info_KeyboardFileHasNoKeyboardVersion`, because this is not an error,
or even something wrong necessarily; it's just something it's good to be
aware of. Updates unit test for kmc to cater for the extra message.
Adds `WARN_KeyboardVersionsDoNotMatch` and
`WARN_KeyboardVersionsDoNotMatchPackageVersion`.
Adds unit tests. Several other 'invalid' packages needed corrections
after adding this validation. Note that one unit test was deleted
because it could never be satisfied after adding this validation step.
Refactor the `extractKeyboardVersionFromKmx` function into a new class
and add extra version checking. This caused a bit of a cascade of test
failures due to some of the 'invalid' fixtures actually being invalid
in multiple ways, so the fixtures have been corrected to only be wrong
in a single way -- the way they are supposed to be broken. This means
additional fixture files in the 'invalid' folder.
Now updates keyboard version metadata for all keyboards in the package.
Upgrades `WARN_FollowKeyboardVersionButNoKeyboards` to
`ERROR_FollowKeyboardVersionButNoKeyboards`, as this leads to invalid
package metadata on build.
Renames `ERROR_KeyboardFileNotFound` to
`ERROR_KeyboardContentFileNotFound` to better reflect that no `<File>`
in the package is found to match a given `<Keyboard>` entry.
Adds `ERROR_KeyboardFileNotFound` when a referenced .kmx does not exist.
Adds and updates corresponding unit tests.
developer:
- update wasm machinery in kmc-kmn to be more self contained
- improve exception situation in wasm functions
common:
- compilerErrorFormatCode() for formatting the raw code such as for tests
- compilerExceptionToString() for formatting exceptions in messages
for: #7234
Adds `WARN_PackageNameDoesNotFollowKeyboardConventions` and
`WARN_PackageNameDoesNotFollowLexicalModelConventions`, refactoring as
required to test filenames, and adds unit tests for same.
Adds a package-validation.ts module, plus adds a call to the validation
step in the compilers.
Rearranges the kmc-package files to match other compilers better.
Removes `default` from exports.
And finally, adds ERROR_PackageCannotContainBothModelsAndKeyboards and
WARN_PackageShouldNotRepeatLanguages messages, plus tests.