Commit graph

299 commits

Author SHA1 Message Date
Marc Durdin
0f390d47cc chore(common): maintenance on build scripts - cd
Fixes #11324.

* Always `cd "$THIS_SCRIPT_PATH"`
* Remove unnecessary `cd` from all build.sh
* Remove unnecessary `set -eu` from all build.sh (and `# set -x`)
* Replace old build-utils.sh incantation in a few build.sh scripts
2024-05-02 15:54:29 +07:00
Marc Durdin
02f9ce15c4 fix(developer): handle buffer boundaries in four cases
Fixes #11092.

Addresses buffer boundary tests for four cases, so a fatal error is not
returned to the user:
* character range too long (U+1234 .. U+2468)
* extended string too long ('abcde...xxxxx')
* outs too long (store(foo) .... outs(bar))
* virtual key expansion too long ([K_A] .. [K_Z] ...)

See #11136 for additional work arising.
2024-04-02 14:51:33 +07:00
Marc Durdin
2e2af5b0fa refactor(developer): tidy up the sourcemap path fixup 2024-03-25 10:23:14 +07:00
Marc Durdin
287a43ae91 chore(developer): try /dist path 2024-03-25 06:06:45 +07:00
Marc Durdin
2ce8dc5147 chore(developer): test alternate frame patchup 2024-03-22 13:27:53 +07:00
Marc Durdin
03491f5b7e chore(developer): use rewriteFrames integration in kmc 2024-03-22 11:55:04 +07:00
Marc Durdin
310504adb7
Merge pull request #10918 from keymanapp/chore/developer/consolidate-help-links
chore(developer): consolidate external links in Developer messages
2024-03-05 16:07:01 +07:00
Marc Durdin
987a17071d chore(developer): tiny refactor redux 2024-03-04 12:45:28 +07:00
Marc Durdin
90d39f9eaa chore(developer): tiny refactor of urls 2024-03-04 12:44:48 +07:00
Marc Durdin
e64103a02f chore(developer): consolidate external links in Developer messages
Establishes keyman-urls.ts as a single place for any links to external
websites.

I searched all .ts files in Keyman Developer source and replaced
references to websites with function calls here. Note that the names of
individual functions within this class can be easily changed as needed,
as the hard part was the consolidation.
2024-03-04 12:38:07 +07:00
Marc Durdin
9776aa7dbf fix(developer): move osk.ts from developer-utils to kmc-kmn
Fixes #10872. Modifies #10845.

developer-utils is also used by server. Because osk.ts depends on
common-types, this introduced a transitive dependency for
developer-utils. Packaging server for deployment as part of Keyman
Developer is fragile and we need to hand-code our internal dependencies,
as npm bundling struggles with in-repo dependencies. So we need to avoid
introducing extra dependencies into developer-utils at this time.

It turns out that osk.ts is used by kmc-kmn and kmc-analyze. kmc-analyze
already has a dependency on kmc-kmn, so it makes sense to put it there.
2024-03-01 08:47:04 +07:00
Marc Durdin
5062bbad98 feat(developer): adds kmc message command
Realtes to #10207.

Adds a new `kmc message` command which prints detailed information about
any or all compiler messages, in JSON, text, or markdown formats.

Markdown format is emitted to file in a structured way to be deployed to
the help site automatically (coming in a subsequent commit).
2024-02-29 11:05:27 +07:00
Marc Durdin
c7afed7201 refactor(developer): split messages with callstacks into separate generator
Relates to #10207.

In order to include message detail in messages, it is helpful to split
out the exception messages which have a separate parameter, so that
parameter at the same position can be the message detail.

Introduces the CompilerMessageSpecWithException function which takes an
exceptionVar parameter to achieve this differentiation.
2024-02-28 11:34:49 +07:00
Marc Durdin
70a50f0f67 refactor(developer): move osk module from common-types to developer-utils
This module is used only by Keyman Developer compiler. It was originally
in common-types because we didn't have a shared module for Developer.

Moving it to @keymanapp/developer-utils in order to improve its
documentation.
2024-02-26 14:57:27 +07:00
Marc Durdin
a8d0d8454c feat(developer): add api documentation to build
Relates to #10207.

Adds the `api` action to build.sh for each affected module. The `api`
action for each module will generate the api metadata files, and then
the markdown files are generated by /developer/build.sh api.

Note that developer-utils, kmc, and kmcmplib have no api documentation
at this time (and kmcmplib is not Typescript so would need separate
tooling anyway).
2024-02-26 11:45:36 +07:00
Marc Durdin
457275e46f fix(developer): ensure fatal errors report message or made non-fatal
Fixes #10678.

Some messages have been reduced to ERROR instead of FATAL, as they are
not internal compiler errors.

Where fatal messages are raised, the message will now be reported
through correctly to Sentry.
2024-02-20 11:10:39 +07:00
Marc Durdin
898310e6df fix(developer): kmc exit needs to wait for Sentry
Fixes #10488:

1. Use a consistent `exitProcess()` function so that we always wait for Sentry to do its thing.
2. Make `KeymanSentry.isEnabled()` non-async because it is synchronous.
3. Remove duplicate initialization of `KeymanSentry` in kmc.ts.
2024-01-30 14:41:11 +07:00
Marc Durdin
d2580c6a73
Merge pull request #10258 from keymanapp/feat/developer/10150-control-message-severity
feat(developer): add `-m` parameter to kmc to control message severity
2024-01-16 14:01:27 +11:00
Steven R. Loomis
54c77e2de9
Merge pull request #10300 from keymanapp/fix/developer/10291-layer-errs-epic-ldml
fix(developer): quell internal error when  a section fails 🙀
2024-01-02 17:05:00 -06:00
Steven R. Loomis
21a7680278 fix(developer): quell internal error when a section fails 🙀
- when a required section is missing, only throw an internal error IF we haven't already flagged a problem.  for example, if 'vars' fails to compile because of a problem, and we already have an error on file, then don't throw an internal error that 'bksp' depends on uninitialized 'vars'.

- mimic this flow in the test helpers.

- add a test case for this in the test helpers, in test-tran

- add a strictError flag to say that no additional errs are allowed.

Fixes: #10291
2023-12-21 22:14:54 -06:00
Marc Durdin
0ebc5d6aab feat(developer): add -m parameter to control message display
Fixes #10150.

This feature adds a command line parameter to kmc to control the
severity of INFO, HINT and WARN level messages. The severity of any of
these messages can be reduced all the way to INFO, or even disabled, or
increased to ERROR. The compiler and the reporter will honour the new
code and fail builds when failure-level codes are encountered.

Inputs are validated against all the available compiler messages in all
modules. This also provides a good pathway for automated future
documentation generation of compiler messages.

In order to process the input parameters cleanly, have refactored some
of kmc's build command logic.

This commit increases code coverage for kmc to roughly 50%.
2023-12-14 13:17:29 +07:00
Marc Durdin
3d250fecc0 chore(developer): ensure unit tests have default options set 2023-12-12 07:38:13 +07:00
Marc Durdin
89254296db chore(developer): honor prompt to upgrade in kmc
Fixes #10162.
2023-12-11 21:17:00 +07:00
Marc Durdin
ff87042974 chore(developer): make getOption synchronous 2023-12-11 21:16:16 +07:00
Marc Durdin
e57766d1b1 feat(developer): retry on locked file when reading options 2023-12-11 21:00:51 +07:00
Marc Durdin
67379f4603 feat(developer): use ~/.keymandeveloper/options.json for TS sentry 2023-12-11 16:01:56 +07:00
Marc Durdin
4f9f71da3c chore(developer): add build.sh dep 2023-12-02 06:25:01 +07:00
Marc Durdin
c520918646 chore(developer): support publish and pack in build.sh 2023-12-02 05:49:16 +07:00
Marc Durdin
662ed0e50c fix(common): publish @keymanapp/developer-utils as npm module
Fixes #10111.
2023-12-01 14:05:51 +07:00
Marc Durdin
e983818bda feat(developer): warn on usage of virtual keys in rule output
Fixes #10059.

Use of the unsupported and undocumented virtual key output, that doesn't
work in recent Keyman versions, at all, now results in a build warning.

Only a warning, because it did kinda work in old versions of Keyman.
2023-11-23 15:13:56 +10:00
Marc Durdin
946dcdabdf
Merge pull request #9940 from keymanapp/fix/developer/9939-sentry-support-in-server
fix(developer): Sentry in Server should honour reporting settings
2023-11-06 17:55:56 +11:00
Marc Durdin
8e6252c7de fix(developer): move KeymanSentry to developer-utils
Relates to #9939. Splits KeymanSentry.ts into common functionality in
developer-utils, and TestKeymanSentry.ts.
2023-11-05 06:57:01 +07:00
Marc Durdin
6f6e07975b chore(developer): remove compile.pas and CompileErrorCodes.pas
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.
2023-11-02 13:12:28 +07:00
Marc Durdin
8c1f3c4783 fix(developer): raise error if virtual key in context string
Fixes #7880.

Virtual keys have never been allowed in context. This should be an error
in a keyboard. Note: virtual keys in output are officially unsupported
but still kinda sorta a little bit work in Windows -- but I doubt they
will ever be officially supported.

Also includes small side journey to tidy up names and constants for two
other tests (error_duplicate_group and error_duplicate_store).
2023-10-31 14:04:26 +07:00
Marc Durdin
8d00d60ddc fix(developer): ignore whitespace at end of LICENSE.md 2023-10-18 05:40:29 +07:00
Marc Durdin
928bd2a7cd chore(common): fixup tsconfig for common/web/utils 2023-10-06 14:48:28 +07:00
Marc Durdin
6c944cff65 chore: Merge branch 'epic/package-metadata' into chore/merge-master-into-package-metadata 2023-10-06 11:52:13 +07:00
Marc Durdin
d4e4992714 chore(common): cleanup final Typescript non-ESM metadata
Fixes #9262.
2023-10-04 12:55:51 +07:00
Marc Durdin
94be7bb60c chore(developer): validate emitted .keyboard_info and fix keys
Fixes #9620.

.keyboard_info keys emitted from kmc-keyboard-info had the wrong format
for the example.keys object, which I discovered when I applied the
validation to the kmc-keyboard-info output.
2023-09-25 15:53:20 +07:00
Marc Durdin
fd9b131307 chore(developer): remove Package Installer UI from TIKE 2023-09-25 10:27:59 +07:00
Marc Durdin
4c07b6c49c feat(developer): remove kmcmpdll 2023-09-02 12:25:29 +04:00
Marc Durdin
fb165a3f95 feat(developer): use kmc instead of kmlmc in TIKE
First step of integration of kmc into TIKE, establishing base classes
and replacing the lexical model compiler wrapper with them.
2023-09-01 18:16:25 +04:00
Marc Durdin
508588ef26 chore(developer): developer-utils as private package 2023-09-01 15:58:22 +07:00
Marc Durdin
232c918c31 feat(developer): support isRTL and license fields in .model_info
Adds support for calculating isRTL and license fields in .model_info
compiler.

Also:
* establishes @keymanapp/developer-utils shared module
* moves license validation into @keymanapp/developer-utils
* refactors kmc-model-info to a class and general cleanup
2023-08-29 16:37:37 +10:00
Marc Durdin
887bea8289
chore: address review comments
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2023-07-21 12:39:02 +10:00
Marc Durdin
0ec7ae8ccf fix(developer): reduce KM0208A to info severity
Fixes #9296.

208A in kmcmplib is the awkwardly-named CWARN_Info. We now have an
'info' severity in kmc, so this tidies that up (we can keep the same
flag in kmcmplib for now).
2023-07-19 12:54:20 +07:00
Marc Durdin
e2dc338ef1 refactor(developer): remove node dependencies from kmc-model-info
Fixes #9286.

Refactors the use of path and fs into the standard kmc callbacks pattern
and adds `callbacks.fileSize()`, which is needed for populating the
metadata file.

Turns on eslint test for node dependencies for kmc-model-info.
2023-07-18 14:02:04 +07:00
Marc Durdin
568a8141dd chore(common): additional cleanup on schema loading 2023-07-12 13:11:06 +07:00
Marc Durdin
de1c171f46 chore(developer): cleanup compiler messages in kmc
Fixes #8795.
Relates to #9090.

Cleans up and makes consistent compiler messages in kmc, and related
unit tests.

Adds support for colorized messages.

After installing chalk for ansi coloring in kmc, @types/node needed to
be brought in sync with the Typescript version, per the suggestion of
checking against `npm dist-tags @types/node`,found in a discussion at
https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/64262#discussioncomment-4905069

Additional tidying up includes:
* Deprecating a set of functions in compiler-interfaces, bringing them
  together under a new CompilerError class.
  Separating CompilerErrorSeverity and CompilerErrorMask enums.
* Making CompilerError.formatEvent (formerly compilerEventFormat) print
  messages in the same format as NodeCompilerCallbacks (sans coloring).
* Adding a wrapper class for CompilerCallbacks that manages the filename
  reporting, used currently exclusively by kmc itself.
2023-07-10 15:13:48 +07:00
Marc Durdin
cbc5b13034 fix(developer): keep kmc-kmn messages within namespace
Fixes #8998.

kmc-kmn messages were broken down into sub-namespaces, but the range
overlapped the reserved namespace mask range. Fixed the message values,
added a new test to the verifyCompilerMessagesObject function to verify
that messages don't creep outside their namespace, and defined new
masks (in CompilerErrorSeverity enum... hmm) to help.

I opted to remove the leading `0` in the messages for kmc-kmn as I had
to correct a number of them anyway, but not the messages in remaining
units at this time (it's not an error, but just slightly misleading as
we only have 12 bits, not 16 to play with).

It is safe to reassign these messages as they were only assigned in 17.0
alpha.
2023-06-13 06:22:15 +07:00