Commit graph

4256 commits

Author SHA1 Message Date
Joshua Horton
87fff31212 change(developer): clean up developer/src/kmc-model linter issues
The model-defaults.ts file is excluded because that code actually lands in models and could have unwanted side-effects on the oldest Android devices we support.
2025-04-30 09:35:55 +07:00
Joshua Horton
63ad1a8fff change(developer): clean up developer/src/kmc-ldml linter issues 2025-04-30 09:20:12 +07:00
Joshua Horton
da7bfc0982 change(developer): clean up developer/src/kmc-kmn linter issues 2025-04-30 09:18:45 +07:00
Marc Durdin
9d2db4faf3 maint(common): consolidate standard.meson.build configuration
Use a shared function standard_meson_build to prep the
resources/meson.build folder for consistency. A future cleanup would be
to use meson-utils.inc.sh for all meson build scripts.
2025-04-30 09:16:43 +07:00
Joshua Horton
6b8c90c191 change(developer): clean up developer/src/kmc-analyze linter issues 2025-04-30 09:16:22 +07:00
Joshua Horton
d92ef04049 change(developer): clean up developer/src/kmc linter issues 2025-04-30 09:15:34 +07:00
Marc Durdin
f8917d2454 maint(common): cleanup meson versioning
* Adds `VERSION_WITH_TAG` variable to standard.meson.build
* Consistently uses `file('VERSION.md')` to retrieve version number

Note that VERSION_WITH_TAG is not yet used but should be used for
version tagged files later.
2025-04-30 08:23:05 +07:00
Steven R. Loomis
0edbbec981 Merge remote-tracking branch 'upstream/master' into feat/developer/10622-xml-parse-line-numbers-epic-ldml 2025-04-26 14:41:54 -05:00
Marc Durdin
4f829f5c8f chore: Merge remote-tracking branch 'origin/master' into chore/merge-beta-to-master-b18s5 2025-04-21 07:13:35 +07:00
Steven R. Loomis
e003612ea0 feat(developer): update for line numbers
- remove resolver complexity in callback subclasses
- call LDMLKeyboardXMLSourceFileReader.eventResolver.resolve() statically from ldml-compiler-messages

Fixes: #10622
2025-04-10 17:22:51 -05:00
Steven R. Loomis
64bcfc66e9 Merge remote-tracking branch 'upstream/master' into feat/developer/10622-xml-parse-line-numbers-epic-ldml 2025-04-10 17:02:05 -05:00
Steven R. Loomis
53fd228d08 feat(developer): update for line numbers
- fix windows path specific issue in test

Fixes: #10622
2025-04-03 17:24:57 -05:00
Steven R. Loomis
11f77ed876 feat(developer): update for line numbers
- fix ts issue on reader

Fixes: #10622
2025-04-03 16:47:04 -05:00
Steven R. Loomis
8d438283c6 feat(developer): update for line numbers
- split out LineFinder to separate class

Fixes: #10622
2025-04-03 16:40:53 -05:00
Steven R. Loomis
1f2b8463f5 chore(developer): deps: update to fast-xml-parser@5.1.0 (Metadata branch)
Fixes: #10622
2025-04-03 12:15:20 -05:00
Marc Durdin
21486882eb
Apply suggestions from code review 2025-04-03 16:44:36 +02:00
Marc Durdin
838aea52ed refactor(developer): consolidate project loader
Consolidates project loading code from kmc and kmc-copy, in preparation
for kmc-test epic. This leaves open a change we need to make to
CompilerCallbacks, to consolidate the fsAsync and net callbacks into
CompilerCallbacks as a first-class part of CompilerCallbacks. We will
then need to start to move all the fs and net callback interactions to
the async model across all kmc modules, at some point.
2025-04-03 11:37:54 +07:00
Marc Durdin
cf16c37869 refactor(developer): move sentry and developer options into console apps
Move the sentry dependency out of developer-utils and into the console
apps kmc and server, in process of making sure that developer-utils has
no node dependencies.

Also copy the options.ts module into kmc and server, for the same
reason.

This first step duplicates two units, options.ts and KeymanSentry.ts. We
do need to refactor this again later to avoid this duplication (maybe
via yet another internal package?)
2025-04-03 09:56:46 +07:00
Marc Durdin
70838ff1ac refactor(developer): rename to developer-utils-messages.ts
Renames common-messages.ts to developer-utils-messages.ts. This was
split from /common/web/types, but the messages module retained the old
name, which was confusing (two modules with same name).
2025-04-03 09:26:27 +07:00
Marc Durdin
ac6eb0b767 chore: use explicit node: prefix for node imports
This makes it easier for us to enumerate modules that have node
dependencies. There may be others I have not yet picked up.
2025-04-03 08:01:08 +07:00
Marc Durdin
da5b05a195
Merge pull request #13640 from keymanapp/fix/developer/13600-follow-remove-redundant-lm-fields-from-kps
fix(developer): remove redundant Name and RTL fields from .kps `LexicalModel`
2025-04-03 05:40:32 +07:00
Marc Durdin
a4f33caf65
Merge pull request #13600 from keymanapp/fix/developer/13576-13593-remove-redundant-keyboard-fields-from-kps
fix(developer): remove redundant keyboard fields from .kps
2025-04-03 05:40:18 +07:00
Marc Durdin
0f05da957f fix(developer): remove redundant Name and RTL fields from .kps LexicalModel
Follows on from the similar changes to `Keyboard` fields in #13600. This
deprecates the `RTL` and `Name` fields. `RTL` was never used. `Name` was
written but never presented to end users, so effectively irrelevant.
`Name` also was present in `File.Description` (already deprecated) for
the corresponding model.js _and_ `Info.Name`, so doubly redundant.

Also updates the schema documentation to mark the deprecated fields.

Relates-to: #13600
2025-04-02 05:39:09 +07:00
Steven R. Loomis
29f387bebe Merge remote-tracking branch 'upstream/master' into feat/developer/10622-xml-parse-line-numbers-epic-ldml 2025-03-31 16:16:10 -05:00
Steven R. Loomis
0c290bd37a feat(developer): update for line numbers
- update to metadata branch of fast-xml-parser
- restructure metadata handling
- use type safety for fast-xml-parser options

Fixes: #10622
2025-03-31 16:11:19 -05:00
Marc Durdin
9c1c417457 fix(developer): add special handling for 'und' in kmc-keyboard-info
This is a workaround for missing 'und' language tag.

`(new Intl.Locale('und')).language` returns `undefined` in V8, as of 31
March 2025. This means we cannot rely on `Intl.Locale` to parse the
bcp47 string for us. The implemented workaround is to replace `und` with
a known-good language subtag, and then swap it back out in later
processing.

Also adds unit test and new warning messages for invalid language tags
that were exposed during testing of this.

Fixes: #13610
2025-03-31 12:30:05 +07:00
Marc Durdin
ab59fa29b4
Merge branch 'master' into chore/b18s4-merge-beta-to-master 2025-03-29 05:41:03 +07:00
Marc Durdin
a52437c407 chore: Merge branch 'master' into chore/b18s4-merge-beta-to-master 2025-03-29 05:38:08 +07:00
Marc Durdin
f9739e5e9b chore(developer): remove unreferenced kps fields from test 2025-03-29 04:21:41 +07:00
Marc Durdin
de5a02f8ce chore(developer): rewrap detail on semver LDML message 2025-03-29 04:14:38 +07:00
Marc Durdin
dbfe03aa8e chore(developer): improve kmc-ldml 'invalid version' message
Suggested by @Nnyny. Give more detail on the semantic version format for
keyboard version, as well as details on the limitations to semver
imposed by the Keyman toolchain.
2025-03-28 15:01:11 +07:00
Marc Durdin
86d457837f chore(developer): remove unreferenced fields from kmc-generate test fixtures
Relates-to: #13576
2025-03-28 14:59:07 +07:00
Marc Durdin
52d016fe7c chore(developer): remove redundant fields from kps reader unit test
Note: the round-trip test still passes because the XML data passes
basically unmodified through, even though we make no reference to the
fields in the code.

Fixes: #13576
2025-03-28 14:27:08 +07:00
Marc Durdin
9dabcc0306 fix(developer): remove redundant keyboard fields from .kps
The fields 'name', 'version', and 'rtl' were defined in the .kps file,
but were not actually used by the compiler, as kmc-package reads the
metadata from the keyboard file rather than relying on this data, which
often is out of date. This led to confusion for keyboard authors, so
this change removes that metadata from the package.

The one visible side-effect (apart from the data disappearing from
future .kps files) is that the package editor no longer shows this
metadata in the Keyboards view (but as it may be out-of-date, this is
probably a good thing).

Fixes: #13576
Fixes: #13593
2025-03-28 14:07:23 +07:00
Steven R. Loomis
8aa9219410 Merge remote-tracking branch 'upstream/master' into feat/developer/10622-xml-parse-line-numbers-epic-ldml 2025-03-27 16:02:45 -05:00
Steven R. Loomis
4f22ab0d9e
Merge pull request #13516 from keymanapp/chore/developer/ldmlcov
chore(developer): improve ldml code coverage 🙀
2025-03-24 17:16:34 -05:00
Steven R. Loomis
18e7686b3e chore(developer): fix build message per review comment
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-03-24 12:29:32 -05:00
Marc Durdin
86102c405e
Merge pull request #13191 from keymanapp/dependabot/npm_and_yarn/esbuild-0.25.0
chore(deps-dev): bump esbuild from 0.18.20 to 0.25.0
2025-03-24 11:22:00 +07:00
Marc Durdin
9080d156dc chore(developer): use 'statement' instead of 'command' for messages about kmn statements
In compiler messages, for a long time we have inconsistently used
'command' instead of 'statement' when referring to kmn statements. The
kmn language documentation uses 'statement' fairly consistently.
2025-03-22 05:58:06 +07:00
Steven R. Loomis
692ea6ee9e feat(core): improve kmxplus validation tests
- update basic.txt to include the kvk section #12402
- use run() instead of compile()
- move compile()+serialize to a separate subtest
2025-03-21 17:11:03 -05:00
Marc Durdin
bc4462a312
Merge pull request #13532 from keymanapp/fix/developer/13455-ERROR_TextBeforeOrAfterNulInOutput
fix(developer): add validation of `nul` usage in output part of rule
2025-03-19 06:12:54 +07:00
Steven R. Loomis
4e3379c698 feat(core): improve kmxplus validation tests
- ratchet required coverage level to 90%!
- comment out failing run() test though - run() adds an embedded .kvk

Fixes: #9446
2025-03-18 11:50:28 -05:00
Marc Durdin
fdd219a481 chore(developer): remove mozhi_malayalam.kmx from baseline fixtures
This is required because it includes rules with nul and other output.
2025-03-18 12:16:40 +07:00
Marc Durdin
5683b370fe fix(developer): add validation of nul usage in output part of rule
If `nul` is used in the output part of a rule, then text or
text-emitting statements cannot also be included in the output of that
rule. This was not enforced in earlier versions of Keyman.

Adds a unit test for the enhanced validation.

Fixes: #13455
Relates-to: keymanapp/keyboards#3379
2025-03-18 09:54:06 +07:00
Marc Durdin
d4540e3c68 chore(developer): use caps for constants in xml-utils 2025-03-17 12:19:10 +07:00
Marc Durdin
7d5c98ddba fix(developer): bump fast-xml-parser to 5.0.9
This is a major dependency version bump (4.5.0 to 5.0.9) which we would
normally avoid during beta. However, we need the fix
NaturalIntelligence/fast-xml-parser#725 for hex escapes in XML, which is
incorporated in 5.0.9.

I have assessed the other changes to fast-xml-parser and found no
breaking changes for us, but I tightened the types in xml-utils
declarations and found some minor inconsistencies which appear to have
no impact, and which I have corrected:
* wrong type in unused parameter to `tagValueProcessor`
* reference to unused property `options.emptyTag`

While doing this, I consolidated the common options for the parser in
order to verify consistency, but made no changes to the resolved
parsing/building options.

Added a test to ldml keyboard reading, to verify that numeric strings
are treated as strings, given the divergence in the `numberParseOptions`
option, and it shows that numeric strings are treated as strings.

Fixes: #13348
2025-03-17 06:22:29 +07:00
Marc Durdin
96a96bef15 fix(developer): add units tests to verify non-BMP numeric entities in XML reader
fast-xml-reader has a bug with numeric entities. See:
  https://github.com/NaturalIntelligence/fast-xml-parser/issues/725

This commit adds a unit test to verify that non-BMP numeric entities
will be parsed correctly. It will fail until we update the
fast-xml-parser dependency.

Relates-to: #13348
2025-03-17 05:50:47 +07:00
Steven R. Loomis
7487a6bbbe chore(developer): improve code coverage
- add a test for LdmlKeyboardCompiler.run()
- exclude generated abnf files from coverage
2025-03-14 17:20:23 -05:00
Marc Durdin
780ca714a1 chore(developer): reduce kmc-ldml coverage threshold to 75%
kmc-ldml no longer meets the 90% coverage threshold with recent changes
in 19.0-alpha. With the fix from #13418, this now causes the build to
fail. Coverage should be increased with additional tests in kmc-ldml,
but this is a stopgap to allow builds to continue to pass.
2025-03-14 09:48:45 +07:00
Marc Durdin
1a0b830c0b
Merge branch 'master' into chore/b18s3-merge-beta-to-master 2025-03-14 08:54:50 +07:00