Commit graph

3216 commits

Author SHA1 Message Date
Marc Durdin
18c4ac5bb2
Merge pull request #8850 from keymanapp/refactor/developer/wasm-compiler-interface
refactor(developer): compiler interface part 1 for wasm
2023-05-26 18:43:24 +10:00
Marc Durdin
d1d6dc5d99 refactor(developer): compiler interface part 1 for wasm
This starts the refactor of the .kmn compiler interfaces for WASM,
moving more file writes into typescript and out of the compiler. Adds a
cleaner binding and structures for passing compile metadata back to
typescript for additional build steps (e.g. kvk, js builds).

Will rebase the Typescript-based KMW compiler onto this so it can start
to benefit from the refactoring.

* Fixes a minor issue with loading a .kvks file with an empty flags set.
* Adds a writeFileSync method to the compiler callback interfaces.
* Adds an e2e compiler test to verify that .kmx and .kvk are both
  correctly compiled.
2023-05-23 15:26:28 +07:00
Ross
1d3fc99b28 chore(windows): Merge branch 'master' into chore/windows/5442/remove-legacy-keyman-core 2023-05-17 10:27:56 +10:00
Steven R. Loomis
1937552f39 Merge remote-tracking branch 'upstream/master' into feat/developer-234-uset-wasm-epic-ldml 2023-05-12 08:44:19 -05:00
Marc Durdin
7982bd955c
Merge pull request #8729 from keymanapp/chore/developer/move-package-formats-to-common-types
chore(developer): move package formats to common/web/types
2023-05-12 12:25:19 +10:00
Steven R. Loomis
6317583528 feat(developer): kmc-kmn: wasm and error message updates 🙀
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
2023-05-11 10:37:46 -05:00
Marc Durdin
53ccdbe241 chore(developer): move package formats to common/web/types
Package file interfaces were stored in developer/kmc-package but belong
better now in common/web/types.
2023-05-09 15:48:50 +07:00
Marc Durdin
4838ba1ffe chore: rename kmc-keyboard to kmc-ldml
Part of #8719.
2023-05-09 14:08:45 +07:00
Eberhard Beilharz
b84915f745
Merge pull request #8510 from keymanapp/fix/linux/tests
fix(linux): Fix linux tests
2023-05-08 11:14:36 +02:00
Eberhard Beilharz
a7630a0265
fix(linux): Fix linux tests 2023-05-05 10:55:45 +02:00
Marc Durdin
292886479f
Merge pull request #8698 from keymanapp/chore/common/8693-set-eu-all-build-scripts
chore(common): `set -eu` in build-utils.sh
2023-05-05 13:18:52 +10:00
Marc Durdin
4a2062ecfb
fix(common): predictive-text unit_tests further builder_term fixes 2023-05-02 21:35:42 +10:00
Marc Durdin
57cf6e07db chore(common): fix typo in build script 2023-05-02 12:41:38 +07:00
Marc Durdin
4eca9c3ecf
Merge pull request #8692 from keymanapp/chore/common/8485-common-and-resources-tests
chore(common): run common and resources tests
2023-05-02 15:17:38 +10:00
Marc Durdin
74f9276695 chore(common): run common and resources tests
This sets us up to run all common/ and resources/ tests from a single
script, common/build.sh. This test will be run on each platform for all
changes made in common/ or resources/.

Also renamed files and paths for consistency in resources/ and updated
tests accordingly.
2023-04-28 14:07:34 +07:00
Steven R. Loomis
07392ed460 feat(developer): update tests and reader for transforms 🙀
- not working yet, but 'update' some XML

for #7377
2023-04-27 12:21:03 -05:00
Marc Durdin
f2bc55bb31
Merge pull request #8674 from keymanapp/refactor/developer/callbacks-instead-of-direct-fs
refactor(developer): use callbacks to avoid direct fs access in kmc-package
2023-04-27 17:56:47 +10:00
Marc Durdin
983d5076f9
Merge pull request #8666 from keymanapp/chore/developer/kmc-keyboard-web-compatible
chore(developer): kmc-keyboard should not use any node-specific modules
2023-04-27 17:56:23 +10:00
Marc Durdin
e02f4670a7
Merge pull request #8665 from keymanapp/chore/developer/add-eslint-baseline
chore(developer): add eslint devDependency for kmc
2023-04-27 17:56:14 +10:00
Marc Durdin
6fb9b72437 fix(developer): project relative path calculation and add test 2023-04-26 15:56:00 +07:00
Marc Durdin
5e0471f0b7 refactor(developer): use callbacks to avoid direct fs access in kmc-package
Fixes #8644.

This is a signficant cleanup and refactor of code that was accessing the
fs or path modules in Node directly. Given we want to be able to run
these modules on web as well in the future, it is important that we
avoid that.

This also redesigns the CompilerCallback interfaces to provide Node-like
interfaces for path and fs, with a minimal set of functions. The aim
here is to provide a surface that will hopefully match a future
web-based component such as path-browserify without significant
retooling of the kmc-* modules.

Enables linting for common/web/types and turns on the
eslintNoNodeImports checks for that module and kmc-package.

Note: Buffer is still in use in a few places also, so we'll need to
refactor that in a future commit.
2023-04-26 12:31:50 +07:00
Steven R. Loomis
79afbd75ae fix(developer): fix jis scan codes 🙀
- also see discussion in https://github.com/keymanapp/keyman/pull/8513

for #8552
2023-04-25 17:40:20 -05:00
Marc Durdin
5f9ccab4ce refactor(common): move basename func to common/web/types
This is the best place for it for now. Later we may move elsewhere.
2023-04-25 14:49:45 +07:00
Marc Durdin
ac39427f60 chore(developer): add eslint devDependency for kmc
Adds eslint, effectively disabled, to infrastructure for all of kmc.

Note that eslintNoNodeImports.js will be used in the next commit, for
verifying #8644.
2023-04-25 13:44:56 +07:00
Darcy Wong
1189482569 Merge pull request #8660 from keymanapp/chore/common/move-the-99-keyboard
chore(common): Move the_99 test fixture keyboard
2023-04-25 10:51:00 +07:00
Darcy Wong
a3e685d12a chore(common): Rename folder 2023-04-25 09:51:03 +07:00
Darcy Wong
64c6bfbbe9 chore(common): Ignore build/ folders 2023-04-25 09:10:30 +07:00
Darcy Wong
3d221381fe chore(common): Skip issue folder 2023-04-25 07:33:41 +07:00
Darcy Wong
91c9cbf61d chore(common): Skip issue folder 2023-04-25 07:18:23 +07:00
Darcy Wong
aa218d4896 chore(common): cd to $THIS_DIR 2023-04-25 07:09:28 +07:00
Darcy Wong
92670f4100 chore(common): Fix issue number 2023-04-24 15:30:41 +07:00
Darcy Wong
f216673f54 chore(common): Update path 2023-04-24 15:09:00 +07:00
Darcy Wong
23f1e79d2f chore(common): Move the_99 test keyboard to issue folder 2023-04-24 15:06:53 +07:00
Marc Durdin
f9c818f103 chore(common): update dependency paths 2023-04-24 08:51:39 +07:00
Marc Durdin
cf4022ac8a feat(developer): use CompilerEvent for messages in all of kmc
Cleans up majority of remaining kmc-* modules to use CompilerEvent
messages instead of console.log and friends, adding
InfrastructureMessages class for kmc CLI messages.

Consolidates schema loading functions into a single `loadSchema`
function in the CompilerCallbacks interface and implementations.

Moves responsibility for instantiating NodeCompilerCallbacks out of
each individual BuildActivity and into higher level modules.

Fixes return value for failing builds.
2023-04-24 07:26:43 +07:00
Ross
4019a79676 chore(windows): address review comments 2023-04-21 18:43:50 +10:00
Marc Durdin
66a7a6fc4e feat(developer): support FollowKeyboardVersion in kmc-package
Fixes #7340.

Removes the unused <Version> element from <LexicalModel> element in the
.kps schema. (This needs to be copied to api.keyman.com also.)

Updates compiler to check for <FollowKeyboardVersion> and read the
version data from the .kmx in that case.

Unit tests updated. Some of the fixtures were incorrect as they had
<FollowKeyboardVersion> set for model-type packages or packages that
contained no keyboards. Fixed.
2023-04-21 14:04:06 +07:00
Marc Durdin
8ec69471dc feat(common): kmx file reader
Read a .kmx file into memory in Typescript. Currently only reads stores
from the file, as these are the most common things needed for other
processes. Will add support for reading other metadata and rules in
future when required.
2023-04-21 11:52:18 +07:00
Marc Durdin
e0ed058e89 refactor(developer): kmc-model to use CompilerEvent
Replaces the existing error reporting in kmc-model with CompilerEvent
style messages. Some of the existing error reporting was kinda nice, but
consistency trumps pretty here.

One downside at present is the global filename and line variables in the
model-compiler-errors.ts unit. This is fragile, and should probably be
refactored further in the future.

Where it made sense, I converted various throws into ModelCompilerError
instances. If it appeared to be an internal error, I left it as-is, but
the external API interfaces wrap all unknown exceptions and convert them
into a compiler error message, so these APIs (compileModel and
loadFromFilename) now have a guarantee that they will never throw.

At this point, all of the error messages in the model compiler are
unrecoverable -- they will halt the compile entirely. However, the
pathway is there to support recoverable errors through the normal
callbacks.reportMessage mechanisms.

The message-counting mechanism is currently missing from this, as it
belongs in the API consumer, rather than in the low-level reporting
infrastructure. This means that models with large numbers of warnings
are going to generate scads of messages for now.

Note that the _users_ of CompilerCallbacks are subject to change in the
future, once we have all the compilers using the callbacks.
2023-04-20 16:40:04 +07:00
Marc Durdin
39d473fb2d refactor(developer): move comperr.h to kmn_compiler_errors.h
Consolidates the two copies of comperr.h (they were identical) and
moves to a common folder. Updates all references to comperr.h, except
for one github commit ref.
2023-04-20 13:20:29 +07:00
Joshua Horton
4588fbcb68
Merge pull request #8629 from keymanapp/fix/common/web/pred-text-test-dependency
chore(web): sets kmc-model as dependency of input-processor test action
2023-04-20 11:24:25 +07:00
Marc Durdin
cc187ce858
Merge pull request #8628 from keymanapp/feat/developer/8150-non-binary-kvk-file-warning
feat(developer): warn if .kps file includes a non-binary .kvk file
2023-04-20 13:46:11 +10:00
Marc Durdin
7d14ab4870
Merge pull request #8625 from keymanapp/feat/developer/kmc-kmn-use-new-message-infrastructure
feat(developer): use new message infrastructure in kmc-kmn
2023-04-20 13:45:01 +10:00
Joshua A. Horton
78562a0bd9 chore(web): cleanup per PR reviews 2023-04-20 10:30:49 +07:00
Marc Durdin
2f7407b4b8 feat(developer): warn if .kps file includes a non-binary .kvk file
Relates to #8150.

Legacy .kmp compiler would transform xml-format .kvk files into a binary
.kvk file; now we want that to remain the responsibility of the keyboard
compiler, so we'll warn the few users who are still doing this.
2023-04-19 15:32:29 +07:00
Joshua A. Horton
66da792319 chore(web): sets kmc-model as dependency of input-processor test action 2023-04-19 14:26:44 +07:00
Marc Durdin
66542f6323 feat(developer): use new message infrastructure in kmc-kmn
Moves to using the `reportMessage` callback for reporting all errors in
kmc-kmn.

This required some patching to common/web/types in order to get the new
constants in place and add support for line numbers to `CompilerEvent`,
so at the same time I refactored `compilerErrorSeverityName` into the
module.

After the refactor, coverage tests were failing because they included
the test/ folder, so cleaned that up at the same time.
2023-04-19 10:13:14 +07:00
Marc Durdin
b58ac8fe4a fix(developer): package editor no longer loses RTL flag for LMs
Fixes #8595.
2023-04-18 05:40:50 +07:00
Marc Durdin
501cf03dc2 chore(common): update description for 'build.sh pack' 2023-04-12 14:18:31 +07:00
Marc Durdin
3265a714f2 chore(common): add missing deps and files for npm publish
The build/ folder for most packages was missing due to being listed in
.gitignore.

Also, @keymanapp/ldml-keyboard-constants package was not being published
despite being a dependency of @keymanapp/kmc-keyboard.

Instead of relying on npm's use of .gitignore / .npmignore (which has
seriously wonky behaviours), we list the files that should be included
in package.json.

NPM Wonky behaviours: it seems that .npmignore causes .gitignore in the
same folder to be ignored. But, higher level .gitignore files still
affect the files included in the package, which makes
specification-by-exclusion painful (negating exclusions, etc). We do not
recommend use of .npmignore anywhere for this reason.
2023-04-12 14:05:05 +07:00