Commit graph

155 commits

Author SHA1 Message Date
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
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
a52437c407 chore: Merge branch 'master' into chore/b18s4-merge-beta-to-master 2025-03-29 05:38:08 +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
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
Marc Durdin
1a0b830c0b
Merge branch 'master' into chore/b18s3-merge-beta-to-master 2025-03-14 08:54:50 +07:00
Marc Durdin
d2b457b2e4 fix(developer): load Keyman Developer options in Server before use
Fixes: #13420
2025-03-10 06:28:39 +07:00
Marc Durdin
060189a1ab chore(developer): drop coverage threshold for developer-utils to 45% 2025-03-05 00:24:41 +03:00
Steven R. Loomis
0ba005a55b feat(developer): line number symbols
- improve and simplify lookup algorithm
- add test for override filename on imports

Fixes: #10622
2025-03-04 09:34:47 -06:00
Steven R. Loomis
92e16b90a0 feat(developer): line number symbols
- move file read bottleneck out of compiler.ts into the LDML XML reader
- move the eventresolver into the LDML XML reader
- add XML_FILENAME_SYMBOL - for tagging when an object is from a different file than the default
(such as with an import)

Fixes: #10622
2025-03-03 19:12:34 -06:00
Steven R. Loomis
b015221814 feat(developer): line number symbols
- change special symbol to XML_START_INDEX_SYMBOL
- use an array of line lengths rather than an array of strings for the file info
- add an EventResolver interface to the callbacks, such that it has an opportunity to resolve events

Fixes: #10622
2025-03-03 17:08:40 -06:00
Steven R. Loomis
1febf9a0de
Update developer/src/common/web/utils/src/xml-utils.ts
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-03-03 13:18:02 -06:00
Steven R. Loomis
d7cb7b63a3 feat(developer): add an EventResolver
- it's a hook to the hook to allow the LDML compiler to resolve error message line numbers
- TODO still not extra performant, but maybe the right separation of concerns

Fixes: #10622
2025-03-03 13:14:41 -06:00
Steven R. Loomis
3e73a3f081 feat(developer): add CompilerEvent.offset
- per review, keep this as a separate field.

Fixes: #10622
2025-03-03 12:36:42 -06:00
Steven R. Loomis
4d9ea2db2d feat(developer): work around line number symbols
- add KeymanXMLReader.removeSymbols() and call it from tests

Fixes: #10622
2025-02-28 14:24:12 -06:00
Steven R. Loomis
819d9bf562 feat(developer): API for resolving line numbers for messages
- change to use a different fast-xml-parser PR, https://github.com/NaturalIntelligence/fast-xml-parser/pull/729

Fixes: #10622
2025-02-28 12:08:31 -06:00
Steven R. Loomis
c4ca359d18 feat(developer): API for resolving line numbers for messages
- add 'column' to CompilerEvent
- Add a LdmlCompilerMessages.col() function to set the column number
- add a LdmlCompilerMessages.resolveLineNumber() to map offsets to line number

Fixes: #10622
2025-02-28 09:27:25 -06:00
Steven R. Loomis
b60c64c3d3 feat(developer): test for line number extension to xml-utils
Fixes: #10622
2025-02-27 16:42:41 -06:00
Steven R. Loomis
ec68e74bde feat(developer): add experimental char-offset data
Depends on PR https://github.com/NaturalIntelligence/fast-xml-parser/pull/728 so uses srl repository "temporarily"

Fixes: #10622
2025-02-27 16:24:21 -06:00
Steven R. Loomis
b59bb6d4de feat(developer): serialize KMXPlus into XML 🍒
Cherry pick of #12969
> feat(developer): serialize KMXPlus (back) into XML 🗼

(cherry picked from commit f93c45c9e8 #12969)

Fixes: #12874
2025-02-10 12:12:12 -06:00
Marc Durdin
bd4633333b feat(developer): improve compiler messages and user interface
* Add unit test to verify the format of message detail strings
  (max line length of 80 chars)
* Add unit test to verify non-null, non-empty message strings
* Tidy up a number of messages (to pass unit tests)
* Add message details for all kmw compiler messages
* Add a clickable link for the TIKE message window for each message
  so that explanations and further message details are more accessible
  to authors (`kmc message` is already available for command-line users)
* Fixes a number of minor issues with the messages window in TIKE,
  mostly relating to when popup menu commands are enabled and how
  messages are selected.

Fixes: #13134
2025-02-07 08:46:46 +07:00
Marc Durdin
2df63dddae
Merge pull request #13075 from keymanapp/fix/developer/13072-make-kmc-log-options-consistent
fix(developer): make kmc log options consistent across all commands
2025-02-05 11:30:10 +07:00
Marc Durdin
9db0d086dc
Merge pull request #13113 from keymanapp/feat/developer/kmc-include-command-line-in-sentry-reports
feat(developer): include command line in kmc sentry reports
2025-02-04 11:43:12 +07:00
Marc Durdin
05c17e3439 feat(developer): include command line in kmc sentry reports
In order to reproduce kmc errors, it's very helpful to know how it was
instantiated. This change includes the command line call for kmc. This
includes things such as a keyboard filename and may include file paths,
but does not include private personal information or secrets.
2025-02-03 09:53:45 +07:00
Steven R. Loomis
622900a5d8 chore(developer): LDML update issue
- test needed to be updated

Fixes: #11307
2025-01-30 23:42:10 -06:00
Steven R. Loomis
b54ea40770 chore(developer): update comments per review
- note that 45,46,47 are the same data and so aliased

Fixes: #11307
2025-01-30 23:13:36 -06:00
Steven R. Loomis
b35ba06a2b chore(developer): remove workaround for base=""
Fixes: #12749
2025-01-30 15:48:02 -06:00
Steven R. Loomis
b741a88ca0 chore(core,developer): treat CLDR v45, 46, 46.1, 47 as 46
Fixes: #11307
2025-01-30 15:42:30 -06:00
Steven R. Loomis
2c32fb7903 chore(resources, developer,core): CLDR 46 and workaround
Fixes: #11307
- import from CLDR 46, mostly unchanged

Fixes: #12749
- workaround LDML DTD bug CLDR-18138 where base= does not imply base=cldr
2025-01-30 15:41:34 -06:00
Marc Durdin
d2aa22ff75 fix(developer): make kmc log options consistent across all commands
Makes the `--log-format`, `--log-level`, and `--color`/`--no-color`
options available for all commands and DRYs out some of the options
processing for consistency. This has positive impact in particular on
the Generator classes which removes the need for several unit tests as
the interface can now be checked at compile time.

Fixes: #13072
Unblocks: #13073
2025-01-30 09:20:29 +07:00
Marc Durdin
a08f1aca6e feat(developer): add 'verbose' and 'debug' log levels to kmc
Adds 'verbose' and 'debug' log levels and corresponding error severity
levels. This means the internal error severity values have changed to
match - 'info' is now 2 instead of 0.

Fixes: #12975
2025-01-22 08:58:13 +07:00
Marc Durdin
3ad0dec493 chore(developer): validate keyboard and model IDs in kmc-generate
Fixes: #12957
2025-01-21 12:41:52 +07:00
Marc Durdin
45a6291a3e refactor(developer): move ttfInfo to developer-utils
We will need ttfInfo in kmc-package, so move it to the shared module.
2025-01-20 09:19:47 +07:00
Marc Durdin
dad1df3194 fix(developer): ensure license parameter is required and add tests
Some additional items arose from this:

* Adds a command-line-tests unit test which does some basic sanity tests
  on `kmc`.
* Cleans up some of the error reporting infrastructure in `kmc` to
  ensure that thrown errors are handled better.
* Removes redundant subshell from `builder_run_action`.

Fixes: #12846
2025-01-13 15:10:31 +07:00
Marc Durdin
7be5c62e3b
Merge pull request #12773 from keymanapp/chore/developer/12746-kmc-copy-full-gh-url-to-master
change(developer): use full github url in kmc copy parameters 🍒
2024-12-06 08:01:34 +01:00
Marc Durdin
72d0bac0ee
Merge pull request #12775 from keymanapp/chore/rename-test-callbacks
chore: rename TestCompilerCallbacks.ts
2024-12-05 23:51:40 +01:00
Marc Durdin
389ef7f001 chore: rename TestCompilerCallbacks.ts
There was confusion with two implementations of TestCompilerCallbacks.
Turns out one of them wasn't used.
2024-12-05 13:04:27 +07:00
Marc Durdin
170282bba7 chore: address review comments 2024-12-05 09:23:27 +07:00