mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-15 12:07:42 +00:00
Merge pull request #7299 from keymanapp/feat/developer/epic-ldml/7277-merge-kmc-and-kmlmc
feat(developer): merge kmc and kmlmc 🙀
This commit is contained in:
commit
12c81f718f
225 changed files with 5744 additions and 3579 deletions
39
.github/labeler.yml
vendored
39
.github/labeler.yml
vendored
|
|
@ -5,15 +5,15 @@
|
|||
# common ones. The others are commented out. There is still some variance between
|
||||
# folder names and labels; consider this documentation of that ;-)
|
||||
|
||||
docs: docs/**
|
||||
|
||||
#
|
||||
# Add labels based on changed files using actions/labeler
|
||||
#
|
||||
|
||||
android/: android/**
|
||||
android/app/: android/KMAPro/**
|
||||
#android/browser/:
|
||||
android/engine/: android/KMEA/**
|
||||
#android/resources/:
|
||||
android/samples/: android/Samples/**
|
||||
|
||||
common/:
|
||||
|
|
@ -33,41 +33,34 @@ core/:
|
|||
|
||||
developer/:
|
||||
- developer/**
|
||||
- windows/src/developer/**
|
||||
|
||||
developer/compilers/:
|
||||
- windows/src/developer/kmcomp/**
|
||||
- developer/src/kmlmc/**
|
||||
- developer/src/kmcomp/**
|
||||
- developer/src/kmcmpdll/**
|
||||
- developer/src/kmc/**
|
||||
- developer/src/kmc-*/**
|
||||
|
||||
developer/ide/:
|
||||
- windows/src/developer/TIKE/**
|
||||
- developer/src/server/**
|
||||
- developer/src/tike/**
|
||||
|
||||
# developer/resources/
|
||||
# developer/tools/
|
||||
|
||||
ios/: ios/**
|
||||
ios/app/: ios/keyman/**
|
||||
# ios/browser/
|
||||
ios/engine/: ios/engine/**
|
||||
# ios/resources/
|
||||
ios/samples/: ios/samples/**
|
||||
|
||||
linux/: linux/**
|
||||
linux/config/: linux/keyman-config/**
|
||||
linux/engine/:
|
||||
- linux/ibus-keyman/**
|
||||
- linux/ibus-kmfl/**
|
||||
- linux/kmflcomp/**
|
||||
- linux/libkmfl/**
|
||||
- linux/scim_kmfl_imengine/**
|
||||
# linux/resources/
|
||||
# linux/samples/
|
||||
- linux/legacy/ibus-kmfl/**
|
||||
- linux/legacy/kmflcomp/**
|
||||
- linux/legacy/libkmfl/**
|
||||
|
||||
mac/: mac/**
|
||||
# mac/config/:
|
||||
mac/engine/: mac/**
|
||||
# mac/resources/
|
||||
# mac/samples/
|
||||
# mac/engine/: mac/**
|
||||
|
||||
oem/: oem/**
|
||||
oem/fv/: oem/firstvoices/**
|
||||
|
|
@ -78,15 +71,9 @@ oem/fv/windows/: oem/firstvoices/windows/**
|
|||
web/: web/**
|
||||
# web/bookmarklet/
|
||||
web/engine/: web/source/**
|
||||
# web/resources/
|
||||
web/ui/: web/source/kmwui*
|
||||
web/samples/: web/samples/**
|
||||
|
||||
# Somewhat messy since we try and exclude Developer :)
|
||||
windows/:
|
||||
- any: ['windows/**', '!windows/src/developer/**']
|
||||
|
||||
windows/: windows/**
|
||||
windows/config/: windows/src/desktop/**
|
||||
windows/engine/: windows/src/engine/**
|
||||
# windows/resources/
|
||||
# windows/samples/
|
||||
|
|
|
|||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -165,6 +165,7 @@ resources/environment.sh
|
|||
/core/VERSION.md
|
||||
|
||||
**/node_modules/
|
||||
tsconfig.tsbuildinfo
|
||||
|
||||
# Windows system files
|
||||
Thumbs.db
|
||||
|
|
@ -172,3 +173,8 @@ Thumbs.db
|
|||
# Temporary file for logging scripts in xcode runs, see build-utils.sh for
|
||||
# details
|
||||
/xcodebuild-scripts.log
|
||||
|
||||
#
|
||||
# Code coverage tools for JS/TS - nyc and c8
|
||||
#
|
||||
.nyc_output/
|
||||
|
|
|
|||
6
.nycrc.json
Normal file
6
.nycrc.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"check-coverage": true,
|
||||
"temp-directory": ".nyc_output",
|
||||
"lines": 90,
|
||||
"reporter": "text"
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/keymanapp/keyman#readme",
|
||||
"devDependencies": {
|
||||
"@keymanapp/lexical-model-compiler": "*",
|
||||
"@keymanapp/kmc": "*",
|
||||
"@keymanapp/resources-gosh": "*",
|
||||
"@types/node": "^11.9.4",
|
||||
"chai": "^4.3.4",
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ if [ $FETCH_DEPS = true ]; then
|
|||
fi
|
||||
|
||||
# Ensures that the lexical model compiler has been built locally.
|
||||
echo_heading "Preparing Lexical Model Compiler for test use"
|
||||
pushd "$KEYMAN_ROOT/developer/src/kmlmc/"
|
||||
echo_heading "Preparing Lexical Model Compiler (kmc-model) for test use"
|
||||
pushd "$KEYMAN_ROOT/developer/src/kmc-model/"
|
||||
./build.sh
|
||||
popd
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ var vm = require("vm");
|
|||
* Unit tests for the Dummy prediction model.
|
||||
*/
|
||||
|
||||
var LexicalModelCompiler = require('../../../../../developer/src/kmlmc/dist/lexical-model-compiler/lexical-model-compiler').default;
|
||||
// TODO: this relies on esbuild output for lexical-model-compiler; later should use import
|
||||
var LexicalModelCompiler = require('../../../../../developer/src/kmc-model/build/cjs-src/lexical-model-compiler.cjs').default;
|
||||
var path = require('path');
|
||||
|
||||
let InputProcessor = require('../../build/index.bundled.js');
|
||||
|
|
@ -49,7 +50,7 @@ describe('LanguageProcessor', function() {
|
|||
describe('.predict', function() {
|
||||
let compiler = new LexicalModelCompiler();
|
||||
const MODEL_ID = 'example.qaa.trivial';
|
||||
const PATH = path.join(__dirname, '../../../../../developer/src/kmlmc/tests/fixtures', MODEL_ID);
|
||||
const PATH = path.join(__dirname, '../../../../../developer/src/kmc-model/test/fixtures', MODEL_ID);
|
||||
|
||||
describe('using angle brackets for quotes', function() {
|
||||
let modelCode = compiler.generateLexicalModelCode(MODEL_ID, {
|
||||
|
|
|
|||
5
common/web/keyman-version/.gitignore
vendored
5
common/web/keyman-version/.gitignore
vendored
|
|
@ -1,2 +1,5 @@
|
|||
# version.inc.ts is generated during the build
|
||||
version.inc.ts
|
||||
version.inc.ts
|
||||
|
||||
# keyman-version.mts (esm clone of version.inc.ts) is generated during the build
|
||||
keyman-version.mts
|
||||
|
|
@ -37,7 +37,24 @@ if builder_has_action clean; then
|
|||
fi
|
||||
|
||||
if builder_has_action build; then
|
||||
# Generate index.ts
|
||||
# Generate keyman-version.mts
|
||||
echo "
|
||||
// Generated by common/web/keyman-version/build.sh
|
||||
export default class KEYMAN_VERSION {
|
||||
static readonly VERSION = \"$VERSION\";
|
||||
static readonly VERSION_RELEASE =\"$VERSION_RELEASE\";
|
||||
static readonly VERSION_MAJOR = \"$VERSION_MAJOR\";
|
||||
static readonly VERSION_MINOR = \"$VERSION_MINOR\";
|
||||
static readonly VERSION_PATCH = \"$VERSION_PATCH\";
|
||||
static readonly TIER =\"$TIER\";
|
||||
static readonly VERSION_TAG = \"$VERSION_TAG\";
|
||||
static readonly VERSION_WITH_TAG = \"$VERSION_WITH_TAG\";
|
||||
static readonly VERSION_ENVIRONMENT = \"$VERSION_ENVIRONMENT\";
|
||||
static readonly SENTRY_RELEASE = \"release-$VERSION_WITH_TAG\";
|
||||
}
|
||||
" > ./keyman-version.mts
|
||||
|
||||
# Generate version.inc.ts -- used by TypeScript code that isn't yet modular
|
||||
echo "
|
||||
// Generated by common/web/keyman-version/build.sh
|
||||
namespace com.keyman {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
"name": "@keymanapp/keyman-version",
|
||||
"description": "Keyman global version data",
|
||||
"main": "./build/index.js",
|
||||
"exports": "./build/index.js",
|
||||
"exports": {
|
||||
".": "./build/index.js",
|
||||
"./keyman-version.mjs": "./build/keyman-version.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "echo 'Building @keymanapp/keyman-version' && tsc -b",
|
||||
"clean": "tsc -b --clean"
|
||||
|
|
|
|||
18
common/web/keyman-version/tsconfig.esm.json
Normal file
18
common/web/keyman-version/tsconfig.esm.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../../tsconfig-base.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"allowJs": false,
|
||||
"declaration": true,
|
||||
"module": "es2020",
|
||||
"outDir": "./build/",
|
||||
"baseUrl": ".",
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"lib": ["es6"],
|
||||
"target": "es6",
|
||||
},
|
||||
"include": [
|
||||
"keyman-version.mts"
|
||||
]
|
||||
}
|
||||
0
common/windows/cef-checkout.sh
Normal file → Executable file
0
common/windows/cef-checkout.sh
Normal file → Executable file
0
common/windows/mkver.sh
Normal file → Executable file
0
common/windows/mkver.sh
Normal file → Executable file
|
|
@ -25,7 +25,7 @@ foreach kbd : tests
|
|||
)
|
||||
|
||||
configure_file(
|
||||
command: kmc_cmd + ['@INPUT@', '--outFile', '@OUTPUT@'],
|
||||
command: kmc_cmd + ['@INPUT@', '--out-file', '@OUTPUT@'],
|
||||
output: kbd + '.kmx',
|
||||
input: kbd + '.xml'
|
||||
)
|
||||
|
|
|
|||
6
developer/src/.gitignore
vendored
6
developer/src/.gitignore
vendored
|
|
@ -31,7 +31,6 @@ inst/setup.inf
|
|||
inst/setup.zip
|
||||
inst/templates.wxs
|
||||
inst/xml.wxs
|
||||
inst/kmlmc.wxs
|
||||
inst/kmc.wxs
|
||||
|
||||
# /developer/TIKE/
|
||||
|
|
@ -87,7 +86,8 @@ tds_file.txt
|
|||
# Breakpad files generated for Sentry
|
||||
**/*.sym
|
||||
|
||||
|
||||
|
||||
# All kmc projects have build/ folders
|
||||
kmc/build/
|
||||
kmc-*/build/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ DEVELOPER_PROGRAM=$(DEVELOPER_ROOT)\bin
|
|||
DEVELOPER_OUTLIB=$(DEVELOPER_ROOT)\lib
|
||||
DEVELOPER_DEBUGPATH=$(DEVELOPER_ROOT)\debug
|
||||
|
||||
KEYMAN_MODELCOMPILER_ROOT=$(DEVELOPER_ROOT)\src\kmlmc
|
||||
KEYMAN_LDMLKEYBOARDCOMPILER_ROOT=$(DEVELOPER_ROOT)\src\kmc
|
||||
|
||||
|
||||
DEVELOPER_DELPHIDPKPARAMS=-Q -B -GD -VT -^$C+ -^$D+ -^$J+ -^$L+ -^$O+ -^$Q- -^$R- -^$W+ -^$Y+ -E. $(DELPHIWARNINGS) -I$(DELPHIINCLUDES) -U$(DELPHIINCLUDES) -R$(DELPHIINCLUDES) -NSVcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Web;Soap;Winapi;System.Win -LE$(DEVELOPER_OUTLIB) -LN$(DEVELOPER_OUTLIB) -NSData -NUobj\Win32\$(TARGET_PATH)
|
||||
DEVELOPER_DCC32DPK=cmd /c "$(DCC32PATH)\dcc32.exe" $(DEVELOPER_DELPHIDPKPARAMS)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
#
|
||||
|
||||
!ifdef NODELPHI
|
||||
TARGETS=build-tools kmcmpdll kmanalyze kmdecomp server kmlmc kmc
|
||||
TARGETS=build-tools kmcmpdll kmanalyze kmdecomp server kmc
|
||||
!else
|
||||
TARGETS=build-tools kmcmpdll kmcomp kmanalyze kmconvert tike samples setup inst kmdecomp server kmlmc kmc
|
||||
TARGETS=build-tools kmcmpdll kmcomp kmanalyze kmconvert tike samples setup inst kmdecomp server kmc
|
||||
!endif
|
||||
|
||||
EXCLUDEPATHDEFINES=1
|
||||
|
|
@ -65,12 +65,24 @@ server: .virtual
|
|||
cd $(DEVELOPER_ROOT)\src\server
|
||||
$(MAKE) $(TARGET)
|
||||
|
||||
kmlmc: .virtual
|
||||
cd $(DEVELOPER_ROOT)\src\kmlmc
|
||||
kmc: kmc-keyboard kmc-model kmc-model-info kmc-package
|
||||
cd $(DEVELOPER_ROOT)\src\kmc
|
||||
$(MAKE) $(TARGET)
|
||||
|
||||
kmc: .virtual
|
||||
cd $(DEVELOPER_ROOT)\src\kmc
|
||||
kmc-keyboard: .virtual
|
||||
cd $(DEVELOPER_ROOT)\src\kmc-keyboard
|
||||
$(MAKE) $(TARGET)
|
||||
|
||||
kmc-model: .virtual
|
||||
cd $(DEVELOPER_ROOT)\src\kmc-model
|
||||
$(MAKE) $(TARGET)
|
||||
|
||||
kmc-model-info: .virtual
|
||||
cd $(DEVELOPER_ROOT)\src\kmc-model-info
|
||||
$(MAKE) $(TARGET)
|
||||
|
||||
kmc-package: .virtual
|
||||
cd $(DEVELOPER_ROOT)\src\kmc-package
|
||||
$(MAKE) $(TARGET)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ Building and signing of the installation archive keymandeveloper.msi.
|
|||
|
||||
### src/inst/node
|
||||
|
||||
Contains a minimal distribution of node.js intended just for compiling lexical
|
||||
models. If more dependencies are required, then the developer will be expected
|
||||
to install node.js themselves; this gets users going without requiring a large
|
||||
installer or a full node.js install.
|
||||
Contains a minimal distribution of node.js intended just for running kmc. If
|
||||
more dependencies are required, then the developer will be expected to install
|
||||
node.js themselves; this gets users going without requiring a large installer or
|
||||
a full node.js install.
|
||||
|
||||
## src/kmanalyze - kmanalyze.exe
|
||||
|
||||
|
|
@ -66,27 +66,33 @@ Unsupported utility decompiles a Keyman .kmx keyboard. It will produce a .kmn
|
|||
source file and optionally a .ico or .bmp image. see kmdecomp/kmdecomp.md for
|
||||
details.
|
||||
|
||||
## src/kmlmc
|
||||
## src/kmc
|
||||
|
||||
node-based compilers for lexical models
|
||||
node-based next generation compiler, hosts kmc, kmlmi, kmlmc, kmlmp
|
||||
|
||||
### src/kmlmc/kmlmc - Lexical Model Compiler
|
||||
### src/kmc-keyboard - LDML Keyboard Compiler
|
||||
|
||||
Next Generation keyboard compiler package - LDML keyboards only at present.
|
||||
Command line access through kmc.
|
||||
|
||||
### src/kmc-model - Lexical Model Compiler
|
||||
|
||||
The Lexical Model Compiler, kmlmc, runs on nodeJS on all supported desktop
|
||||
platforms.
|
||||
platforms. Command line access through kmc/kmlmc.
|
||||
|
||||
### src/kmlmc/kmlmp - Package Compiler
|
||||
### src/kmc-package - Package Compiler
|
||||
|
||||
The package compiler is broadly compatible with the kmcomp .kps package
|
||||
compiler. However at this stage it is only tested with lexical models, and use
|
||||
with keyboards (either .js or .kmx) is not tested or supported. It is likely in
|
||||
the future that the kmcomp .kps compiler will be deprecated in favour of this
|
||||
one.
|
||||
one. Command line access through kmc/kmlmp.
|
||||
|
||||
### src/kmlmc/kmlmi - Model Info Compiler
|
||||
### src/kmc-model-info - Model Info Compiler
|
||||
|
||||
Merges .model_info files for use on the Keyman Cloud lexical model repository
|
||||
at https://github.com/keymanapp/lexical-models.
|
||||
Merges .model_info files for use on the Keyman Cloud lexical model repository at
|
||||
https://github.com/keymanapp/lexical-models. Command line access through
|
||||
kmc/kmlmi.
|
||||
|
||||
## src/samples
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ uses
|
|||
const
|
||||
SLexicalModelExtension = '.model.js';
|
||||
|
||||
// The model ID SHOULD adhere to this pattern (see also developer/src/kmlmc/index.ts):
|
||||
// The model ID SHOULD adhere to this pattern (see also developer/src/kmc-model):
|
||||
// author .bcp47 .uniq
|
||||
MODEL_ID_PATTERN_JS = '^[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_-]*\.[a-z_][a-z0-9_]*\.model\.js$';
|
||||
MODEL_ID_PATTERN_TS = '^[a-z_][a-z0-9_]*\.[a-z_][a-z0-9_-]*\.[a-z_][a-z0-9_]*\.model\.ts$';
|
||||
|
|
@ -70,7 +70,7 @@ end;
|
|||
|
||||
class function TLexicalModelUtils.DoesPackageFilenameFollowLexicalModelConventions(
|
||||
const Name: string): Boolean;
|
||||
// The model ID SHOULD adhere to this pattern (see also developer/src/kmlmc/index.ts):
|
||||
// The model ID SHOULD adhere to this pattern (see also developer/src/kmc-model):
|
||||
// author .bcp47 .uniq
|
||||
begin
|
||||
Result := TRegEx.IsMatch(ExtractFileName(Name), MODEL_ID_PATTERN_PACKAGE);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
DEVELOPER_FILES=kmdev.wixobj xml.wixobj cef.wixobj templates.wixobj kmlmc.wixobj server.wixobj kmc.wixobj
|
||||
DEVELOPER_FILES=kmdev.wixobj xml.wixobj cef.wixobj templates.wixobj server.wixobj kmc.wixobj
|
||||
|
||||
setup:
|
||||
#
|
||||
|
|
@ -60,7 +60,7 @@ clean:
|
|||
-del /Q xml.wxs
|
||||
-del /Q cef.wxs
|
||||
-del /Q templates.wxs
|
||||
-del /Q kmlmc.wxs
|
||||
-del /Q kmc.wxs
|
||||
|
||||
test-releaseexists:
|
||||
cd $(DEVELOPER_ROOT)\src\inst
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ KEYMAN_WIX_TEMP_BASE=$(TEMP)\keyman_wix_build
|
|||
KEYMAN_WIX_TEMP_XML=$(TEMP)\keyman_wix_build\xml
|
||||
KEYMAN_WIX_TEMP_CEF=$(TEMP)\keyman_wix_build\cef
|
||||
KEYMAN_WIX_TEMP_TEMPLATES=$(TEMP)\keyman_wix_build\templates
|
||||
KEYMAN_WIX_TEMP_MODELCOMPILER=$(TEMP)\keyman_wix_build\ModelCompiler
|
||||
KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER=$(TEMP)\keyman_wix_build\LDMLKeyboardCompiler
|
||||
KEYMAN_WIX_TEMP_KMC=$(TEMP)\keyman_wix_build\kmc
|
||||
KEYMAN_WIX_TEMP_SERVER=$(TEMP)\keyman_wix_build\Server
|
||||
|
||||
KEYMAN_WIX_KMDEV_SERVER=$(DEVELOPER_ROOT)\bin\server
|
||||
|
|
@ -31,16 +30,15 @@ copykmdev: makeinstaller make-kmcomp-install-zip
|
|||
test-releaseexists:
|
||||
if exist $(DEVELOPER_ROOT)\release\$Version\keymandeveloper*.msi echo. & echo Release $Version already exists. Delete it or update VERSION.md and try again & exit 1
|
||||
|
||||
candle: heat-cef heat-xml heat-templates heat-model-compiler heat-server heat-ldml-keyboard-compiler
|
||||
candle: heat-cef heat-xml heat-templates heat-server heat-kmc
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease kmdev.wxs
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dXmlSourceDir=$(DEVELOPER_ROOT)\src\tike\xml xml.wxs
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dCefSourceDir=$(KEYMAN_CEF4DELPHI_ROOT) cef.wxs
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dTemplatesSourceDir=$(KEYMAN_DEVELOPER_TEMPLATES_ROOT) templates.wxs
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dModelCompilerSourceDir=$(KEYMAN_WIX_TEMP_MODELCOMPILER) kmlmc.wxs
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dLDMLKeyboardCompilerSourceDir=$(KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER) kmc.wxs
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dkmcSourceDir=$(KEYMAN_WIX_TEMP_KMC) kmc.wxs
|
||||
$(WIXCANDLE) -dVERSION=$VersionWin -dRELEASE=$VersionRelease -dServerSourceDir=$(KEYMAN_WIX_KMDEV_SERVER) server.wxs
|
||||
|
||||
clean-heat: clean-heat-model-compiler clean-heat-ldml-keyboard-compiler
|
||||
clean-heat: clean-heat-kmc
|
||||
|
||||
heat-xml:
|
||||
# We copy the files to a temp folder in order to exclude thumbs.db, .vs, etc from harvesting
|
||||
|
|
@ -81,33 +79,20 @@ heat-server:
|
|||
# When we candle/light build, we can grab the source files from the proper root so go ahead and delete the temp folder again
|
||||
-rmdir /s/q $(KEYMAN_WIX_TEMP_SERVER)
|
||||
|
||||
heat-ldml-keyboard-compiler:
|
||||
cd $(KEYMAN_LDMLKEYBOARDCOMPILER_ROOT)
|
||||
heat-kmc:
|
||||
cd $(DEVELOPER_ROOT)\src\kmc
|
||||
# Build the distributable package
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh bundle --build-path "$(KEYMAN_WIX_TEMP_BASE)"
|
||||
mkdir $(KEYMAN_WIX_TEMP_KMC)
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh bundle --build-path "$(KEYMAN_WIX_TEMP_KMC)"
|
||||
|
||||
# Build the .wxs file
|
||||
cd $(DEVELOPER_ROOT)\src\inst
|
||||
$(WIXHEAT) dir $(KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER) -o kmc.wxs -ag -cg LDMLKeyboardCompiler -dr INSTALLDIR -var var.LDMLKeyboardCompilerSourceDir -wx -nologo
|
||||
$(WIXHEAT) dir $(KEYMAN_WIX_TEMP_KMC) -o kmc.wxs -ag -cg kmc -dr INSTALLDIR -var var.kmcSourceDir -wx -nologo
|
||||
|
||||
clean-heat-ldml-keyboard-compiler:
|
||||
clean-heat-kmc:
|
||||
# the production build generates files that are not in source, e.g. .ps1 scripts
|
||||
# When we candle/light build, we can grab the source files from the proper root so go ahead and delete the temp folder again
|
||||
-rmdir /s/q $(KEYMAN_WIX_TEMP_LDMLKEYBOARDCOMPILER)
|
||||
|
||||
heat-model-compiler:
|
||||
cd $(KEYMAN_MODELCOMPILER_ROOT)
|
||||
# Build the distributable package
|
||||
$(GIT_BASH_FOR_KEYMAN) bundle.sh --build-path "$(KEYMAN_WIX_TEMP_BASE)"
|
||||
|
||||
# Build the .wxs file
|
||||
cd $(DEVELOPER_ROOT)\src\inst
|
||||
$(WIXHEAT) dir $(KEYMAN_WIX_TEMP_MODELCOMPILER) -o kmlmc.wxs -ag -cg ModelCompiler -dr INSTALLDIR -var var.ModelCompilerSourceDir -wx -nologo
|
||||
|
||||
clean-heat-model-compiler:
|
||||
# the production build generates files that are not in source, e.g. .ps1 scripts
|
||||
# When we candle/light build, we can grab the source files from the proper root so go ahead and delete the temp folder again
|
||||
-rmdir /s/q $(KEYMAN_WIX_TEMP_MODELCOMPILER)
|
||||
-rmdir /s/q $(KEYMAN_WIX_TEMP_KMC)
|
||||
|
||||
makeinstaller:
|
||||
cd $(DEVELOPER_ROOT)\src\inst
|
||||
|
|
|
|||
|
|
@ -363,8 +363,7 @@
|
|||
<ComponentGroupRef Id="XML" />
|
||||
<ComponentGroupRef Id="CEF" />
|
||||
<ComponentGroupRef Id="Templates" />
|
||||
<ComponentGroupRef Id="ModelCompiler" />
|
||||
<ComponentGroupRef Id="LDMLKeyboardCompiler" />
|
||||
<ComponentGroupRef Id="kmc" />
|
||||
<ComponentGroupRef Id="Node" />
|
||||
<ComponentGroupRef Id="KeymanDevSentryComponents" />
|
||||
<ComponentGroupRef Id="Server" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@rem This script avoids path dependencies for node for distribution
|
||||
@rem with Keyman Developer. When used on platforms other than Windows,
|
||||
@rem node can be used directly with the compiler (`npm link` will setup).
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\LDMLKeyboardCompiler\build\kmc.js" %*
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\kmc\kmc.cjs" %*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@rem This script avoids path dependencies for node for distribution
|
||||
@rem with Keyman Developer. When used on platforms other than Windows,
|
||||
@rem node can be used directly with the compiler (`npm link` will setup).
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\ModelCompiler\dist\kmlmc.js" %*
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\kmc\kmlmc.cjs" %*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@rem This script avoids path dependencies for node for distribution
|
||||
@rem with Keyman Developer. When used on platforms other than Windows,
|
||||
@rem node can be used directly with the compiler (`npm link` will setup).
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\ModelCompiler\dist\kmlmi.js" %*
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\kmc\kmlmi.cjs" %*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@rem This script avoids path dependencies for node for distribution
|
||||
@rem with Keyman Developer. When used on platforms other than Windows,
|
||||
@rem node can be used directly with the compiler (`npm link` will setup).
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\ModelCompiler\dist\kmlmp.js" %*
|
||||
@"%~dp0\node.js\node.exe" "%~dp0\kmc\kmlmp.cjs" %*
|
||||
|
|
|
|||
39
developer/src/kmc-keyboard/Makefile
Normal file
39
developer/src/kmc-keyboard/Makefile
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#
|
||||
# Keyman Developer - kmc Keyboard Compiler Makefile
|
||||
#
|
||||
|
||||
!include ..\Defines.mak
|
||||
|
||||
# We do configure here because parent Makefile calls this first; other
|
||||
# kmc and kmc-* makefiles don't do it
|
||||
build: configure .virtual
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh build
|
||||
|
||||
configure: .virtual
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh configure
|
||||
|
||||
clean: .virtual
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh clean
|
||||
|
||||
test: .virtual
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh test
|
||||
|
||||
# build.sh bundle must be run from shell as it requires a temp folder to be
|
||||
# passed in. See inst/download.in.mak for instantiation.
|
||||
|
||||
publish: .virtual
|
||||
$(GIT_BASH_FOR_KEYMAN) build.sh publish
|
||||
|
||||
signcode:
|
||||
@rem nothing to do
|
||||
|
||||
wrap-symbols:
|
||||
@rem nothing to do
|
||||
|
||||
test-manifest:
|
||||
@rem nothing to do
|
||||
|
||||
install:
|
||||
@rem nothing to do
|
||||
|
||||
!include ..\Target.mak
|
||||
83
developer/src/kmc-keyboard/build.sh
Executable file
83
developer/src/kmc-keyboard/build.sh
Executable file
|
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Compiles the kmc keyboard compiler.
|
||||
#
|
||||
|
||||
# Exit on command failure and when using unset variables:
|
||||
set -eu
|
||||
|
||||
## START STANDARD BUILD SCRIPT INCLUDE
|
||||
# adjust relative paths as necessary
|
||||
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
|
||||
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
|
||||
## END STANDARD BUILD SCRIPT INCLUDE
|
||||
|
||||
cd "$THIS_SCRIPT_PATH"
|
||||
|
||||
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
|
||||
|
||||
builder_describe "Build Keyman kmc Keyboard Compiler module" \
|
||||
"configure" \
|
||||
"build" \
|
||||
"clean" \
|
||||
"test" \
|
||||
"build-fixtures builds test fixtures for manual examination" \
|
||||
"publish publish to npm" \
|
||||
"--dry-run,-n don't actually publish, just dry run"
|
||||
|
||||
builder_parse "$@"
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_has_action clean; then
|
||||
rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_report success clean
|
||||
else
|
||||
# We need the schema file at runtime and bundled, so always copy it for all actions except `clean`
|
||||
mkdir -p "$THIS_SCRIPT_PATH/build/src/"
|
||||
cp "$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard.schema.json" "$THIS_SCRIPT_PATH/build/src/"
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_has_action configure; then
|
||||
verify_npm_setup
|
||||
builder_report success configure
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_has_action build; then
|
||||
npm run build
|
||||
builder_report success build
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_has_action build-fixtures; then
|
||||
# Build basic.kmx and emit its checksum
|
||||
mkdir -p ./build/test/fixtures
|
||||
node . ./test/fixtures/basic.xml --no-compiler-version --debug --out-file ./build/test/fixtures/basic-xml.kmx
|
||||
printf "${COLOR_GREY}Checksum for basic-xml.kmx: ${COLOR_PURPLE}%s${COLOR_RESET}\n" \
|
||||
"$(xxd -g 1 -l 12 ./build/test/fixtures/basic-xml.kmx | cut -d' ' -f 10-13)"
|
||||
|
||||
# Generate a binary file from basic.txt for comparison purposes
|
||||
node ../../../common/tools/hextobin/build/hextobin.js ./test/fixtures/basic.txt ./build/test/fixtures/basic-txt.kmx
|
||||
|
||||
builder_report success build-fixtures
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_has_action test; then
|
||||
npm test
|
||||
builder_report success test
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_has_action publish; then
|
||||
. "$KEYMAN_ROOT/resources/build/npm-publish.inc.sh"
|
||||
npm_publish
|
||||
builder_report success publish
|
||||
fi
|
||||
54
developer/src/kmc-keyboard/package.json
Normal file
54
developer/src/kmc-keyboard/package.json
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "@keymanapp/kmc-keyboard",
|
||||
"description": "Keyman Developer keyboard compiler",
|
||||
"keywords": [
|
||||
"keyboard",
|
||||
"keyman",
|
||||
"ldml",
|
||||
"unicode"
|
||||
],
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./build/src/main.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"test": "cd test && tsc -b && cd .. && c8 mocha",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"author": "Marc Durdin <marc@keyman.com> (https://github.com/mcdurdin)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/keymanapp/keyman/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@keymanapp/keyman-version": "*",
|
||||
"ajv": "^8.11.0",
|
||||
"crc-32": "^1.2.2",
|
||||
"restructure": "^3.0.0",
|
||||
"semver": "^7.3.7",
|
||||
"xml2js": "^0.4.19"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^10.14.6",
|
||||
"@types/xml2js": "^0.4.5",
|
||||
"c8": "^7.12.0",
|
||||
"chai": "^4.3.4",
|
||||
"chalk": "^2.4.2",
|
||||
"mocha": "^8.4.0",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.5.4"
|
||||
},
|
||||
"mocha": {
|
||||
"spec": "build/test/**/test-*.js",
|
||||
"require": [
|
||||
"source-map-support/register"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/keymanapp/keyman.git"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { Bksp, BkspItem, BkspItemFlags, GlobalSections } from "../kmx/kmx-plus";
|
||||
import { LKBackspace, LKBackspaces } from "../ldml-keyboard/ldml-keyboard-xml";
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import { Bksp, BkspItem, BkspItemFlags, GlobalSections } from "../kmx/kmx-plus.js";
|
||||
import { LKBackspace, LKBackspaces } from "../ldml-keyboard/ldml-keyboard-xml.js";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
|
||||
export class BkspCompiler extends SectionCompiler {
|
||||
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
import KMXPlusFile, { Elem, Strs } from '../kmx/kmx-plus';
|
||||
import LDMLKeyboardXMLSourceFile from '../ldml-keyboard/ldml-keyboard-xml';
|
||||
import LDMLKeyboardXMLSourceFileReader from '../ldml-keyboard/ldml-keyboard-xml-reader';
|
||||
import { BkspCompiler } from './bksp';
|
||||
import CompilerCallbacks from './callbacks';
|
||||
import CompilerOptions from './compiler-options';
|
||||
import { KeysCompiler } from './keys';
|
||||
import { LocaCompiler } from './loca';
|
||||
import { CompilerMessages } from './messages';
|
||||
import { MetaCompiler } from './meta';
|
||||
import { NameCompiler } from './name';
|
||||
import { OrdrCompiler } from './ordr';
|
||||
import { FinlCompiler, TranCompiler } from './tran';
|
||||
import { VkeyCompiler } from './vkey';
|
||||
import KMXPlusFile, { Elem, Strs } from '../kmx/kmx-plus.js';
|
||||
import LDMLKeyboardXMLSourceFile from '../ldml-keyboard/ldml-keyboard-xml.js';
|
||||
import LDMLKeyboardXMLSourceFileReader from '../ldml-keyboard/ldml-keyboard-xml-reader.js';
|
||||
import { BkspCompiler } from './bksp.js';
|
||||
import CompilerCallbacks from './callbacks.js';
|
||||
import CompilerOptions from './compiler-options.js';
|
||||
import { KeysCompiler } from './keys.js';
|
||||
import { LocaCompiler } from './loca.js';
|
||||
import { CompilerMessages } from './messages.js';
|
||||
import { MetaCompiler } from './meta.js';
|
||||
import { NameCompiler } from './name.js';
|
||||
import { OrdrCompiler } from './ordr.js';
|
||||
import { FinlCompiler, TranCompiler } from './tran.js';
|
||||
import { VkeyCompiler } from './vkey.js';
|
||||
|
||||
const SECTION_COMPILERS = [
|
||||
BkspCompiler,
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
||||
import { GlobalSections, Keys } from '../kmx/kmx-plus';
|
||||
import * as LDMLKeyboard from '../ldml-keyboard/ldml-keyboard-xml';
|
||||
import { USVirtualKeyMap } from "../ldml-keyboard/virtual-key-constants";
|
||||
import { CompilerMessages } from './messages';
|
||||
import { GlobalSections, Keys } from '../kmx/kmx-plus.js';
|
||||
import * as LDMLKeyboard from '../ldml-keyboard/ldml-keyboard-xml.js';
|
||||
import { USVirtualKeyMap } from "../ldml-keyboard/virtual-key-constants.js";
|
||||
import { CompilerMessages } from './messages.js';
|
||||
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
|
||||
export class KeysCompiler extends SectionCompiler {
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { GlobalSections, Loca } from "../kmx/kmx-plus";
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import { CompilerMessages } from "./messages";
|
||||
import { LKKeyboard } from "../ldml-keyboard/ldml-keyboard-xml";
|
||||
import { GlobalSections, Loca } from "../kmx/kmx-plus.js";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
import { CompilerMessages } from "./messages.js";
|
||||
import { LKKeyboard } from "../ldml-keyboard/ldml-keyboard-xml.js";
|
||||
|
||||
export class LocaCompiler extends SectionCompiler {
|
||||
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { GlobalSections, KeyboardSettings, Meta, Meta_NormalizationForm } from "../kmx/kmx-plus";
|
||||
import { isValidEnumValue } from "../util/util";
|
||||
import { CompilerMessages } from "./messages";
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import * as semver from "semver";
|
||||
import { GlobalSections, KeyboardSettings, Meta, Meta_NormalizationForm } from "../kmx/kmx-plus.js";
|
||||
import { isValidEnumValue } from "../util/util.js";
|
||||
import { CompilerMessages } from "./messages.js";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
import semver from "semver";
|
||||
|
||||
export class MetaCompiler extends SectionCompiler {
|
||||
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
import KMXFile, { KEYBOARD } from "../kmx/kmx";
|
||||
import { KMXPlusData } from "../kmx/kmx-plus";
|
||||
import CompilerOptions from "./compiler-options";
|
||||
|
||||
const KEYMAN_VERSION = require("@keymanapp/keyman-version").KEYMAN_VERSION;
|
||||
import KMXFile, { KEYBOARD } from "../kmx/kmx.js";
|
||||
import { KMXPlusData } from "../kmx/kmx-plus.js";
|
||||
import CompilerOptions from "./compiler-options.js";
|
||||
import KEYMAN_VERSION from "@keymanapp/keyman-version/keyman-version.mjs";
|
||||
|
||||
export default class KMXPlusMetadataCompiler {
|
||||
/**
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { GlobalSections, Name } from "../kmx/kmx-plus";
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import { GlobalSections, Name } from "../kmx/kmx-plus.js";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
|
||||
export class NameCompiler extends SectionCompiler {
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { GlobalSections, Ordr, OrdrItem } from "../kmx/kmx-plus";
|
||||
import { LKReorder, LKReorders } from "../ldml-keyboard/ldml-keyboard-xml";
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import { GlobalSections, Ordr, OrdrItem } from "../kmx/kmx-plus.js";
|
||||
import { LKReorder, LKReorders } from "../ldml-keyboard/ldml-keyboard-xml.js";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
|
||||
export class OrdrCompiler extends SectionCompiler {
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { GlobalSections, Section } from "../kmx/kmx-plus";
|
||||
import LDMLKeyboardXMLSourceFile, { LKKeyboard } from "../ldml-keyboard/ldml-keyboard-xml";
|
||||
import CompilerCallbacks from "./callbacks";
|
||||
import { GlobalSections, Section } from "../kmx/kmx-plus.js";
|
||||
import LDMLKeyboardXMLSourceFile, { LKKeyboard } from "../ldml-keyboard/ldml-keyboard-xml.js";
|
||||
import CompilerCallbacks from "./callbacks.js";
|
||||
import { SectionIdent } from '@keymanapp/ldml-keyboard-constants';
|
||||
|
||||
/* istanbul ignore next */
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { Finl, FinlItem, GlobalSections, Tran, TranItem, TranItemFlags } from "../kmx/kmx-plus";
|
||||
import LDMLKeyboardXMLSourceFile, { LKTransform, LKTransforms } from "../ldml-keyboard/ldml-keyboard-xml";
|
||||
import CompilerCallbacks from "./callbacks";
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import { Finl, FinlItem, GlobalSections, Tran, TranItem, TranItemFlags } from "../kmx/kmx-plus.js";
|
||||
import LDMLKeyboardXMLSourceFile, { LKTransform, LKTransforms } from "../ldml-keyboard/ldml-keyboard-xml.js";
|
||||
import CompilerCallbacks from "./callbacks.js";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
|
||||
type TransformCompilerType = 'simple' | 'final';
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { Vkey } from "../kmx/kmx-plus";
|
||||
import { LdmlVkeyNames } from "../ldml-keyboard/virtual-key-constants";
|
||||
import { CompilerMessages } from "./messages";
|
||||
import { SectionCompiler } from "./section-compiler";
|
||||
import { Vkey } from "../kmx/kmx-plus.js";
|
||||
import { LdmlVkeyNames } from "../ldml-keyboard/virtual-key-constants.js";
|
||||
import { CompilerMessages } from "./messages.js";
|
||||
import { SectionCompiler } from "./section-compiler.js";
|
||||
|
||||
export class VkeyCompiler extends SectionCompiler {
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
||||
import { Strs, StrsItem } from './kmx-plus';
|
||||
import { Strs, StrsItem } from './kmx-plus.js';
|
||||
|
||||
export enum ElemElementFlags {
|
||||
none = 0,
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import * as r from 'restructure';
|
||||
import * as crc32 from 'crc-32';
|
||||
import KMXFile, { GROUP, KEY, STORE } from './kmx';
|
||||
import KMXPlusFile from './kmx-plus';
|
||||
import KMXPlusBuilder from './kmx-plus-builder/kmx-plus-builder';
|
||||
import crc32 from 'crc-32';
|
||||
import KMXFile, { GROUP, KEY, STORE } from './kmx.js';
|
||||
import KMXPlusFile from './kmx-plus.js';
|
||||
import KMXPlusBuilder from './kmx-plus-builder/kmx-plus-builder.js';
|
||||
|
||||
// These type-checking structures are here to ensure that
|
||||
// we match the structures from kmx.ts in the generator
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { ElementString } from "../element-string";
|
||||
import { Elem } from "../kmx-plus";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { ElementString } from "../element-string.js";
|
||||
import { Elem } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* elem section
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KeyFlags, KMXPlusData } from "../kmx-plus";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { KeyFlags, KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* keys section
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
------------------------------------------------------------------ */
|
||||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/**
|
||||
* Builder for the 'loca' section
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
------------------------------------------------------------------ */
|
||||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/**
|
||||
* Builder for the 'meta' section
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
------------------------------------------------------------------ */
|
||||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/**
|
||||
* Builder for the 'name' section
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { KMXPlusData } from "../kmx-plus";
|
||||
import { build_elem_index, BUILDER_ELEM } from "./build-elem";
|
||||
import { BUILDER_STRS } from "./build-strs";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { build_elem_index, BUILDER_ELEM } from "./build-elem.js";
|
||||
import { BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* ordr section
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* sect section
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { Strs, StrsItem } from "../kmx-plus";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { Strs, StrsItem } from "../kmx-plus.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* strs section
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
||||
import { Bksp, Finl, Tran } from "../kmx-plus";
|
||||
import { build_elem_index, BUILDER_ELEM } from "./build-elem";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs";
|
||||
import { BUILDER_SECTION } from "./builder-section";
|
||||
import { Bksp, Finl, Tran } from "../kmx-plus.js";
|
||||
import { build_elem_index, BUILDER_ELEM } from "./build-elem.js";
|
||||
import { build_strs_index, BUILDER_STRS } from "./build-strs.js";
|
||||
import { BUILDER_SECTION } from "./builder-section.js";
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* tran section
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
||||
import { KMXPlusData } from "../kmx-plus";
|
||||
import { BUILDER_SECTION } from './builder-section';
|
||||
import { KMXPlusData } from "../kmx-plus.js";
|
||||
import { BUILDER_SECTION } from './builder-section.js';
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* vkey section
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
import * as r from 'restructure';
|
||||
import KMXPlusFile from "../kmx-plus";
|
||||
import KMXPlusFile from "../kmx-plus.js";
|
||||
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
||||
import { BUILDER_SECTION } from './builder-section';
|
||||
import { BUILDER_SECT, build_sect } from './build-sect';
|
||||
import { BUILDER_KEYS, build_keys } from './build-keys';
|
||||
import { BUILDER_LOCA, build_loca } from './build-loca';
|
||||
import { BUILDER_META, build_meta } from './build-meta';
|
||||
import { BUILDER_NAME, build_name } from './build-name';
|
||||
import { BUILDER_STRS, build_strs } from './build-strs';
|
||||
import { BUILDER_VKEY, build_vkey } from './build-vkey';
|
||||
import { BUILDER_TRAN, build_tran } from './build-tran';
|
||||
import { BUILDER_ELEM, build_elem } from './build-elem';
|
||||
import { BUILDER_ORDR, build_ordr } from './build-ordr';
|
||||
import { BUILDER_SECTION } from './builder-section.js';
|
||||
import { BUILDER_SECT, build_sect } from './build-sect.js';
|
||||
import { BUILDER_KEYS, build_keys } from './build-keys.js';
|
||||
import { BUILDER_LOCA, build_loca } from './build-loca.js';
|
||||
import { BUILDER_META, build_meta } from './build-meta.js';
|
||||
import { BUILDER_NAME, build_name } from './build-name.js';
|
||||
import { BUILDER_STRS, build_strs } from './build-strs.js';
|
||||
import { BUILDER_VKEY, build_vkey } from './build-vkey.js';
|
||||
import { BUILDER_TRAN, build_tran } from './build-tran.js';
|
||||
import { BUILDER_ELEM, build_elem } from './build-elem.js';
|
||||
import { BUILDER_ORDR, build_ordr } from './build-ordr.js';
|
||||
|
||||
type BUILDER_BKSP = BUILDER_TRAN;
|
||||
type BUILDER_FINL = BUILDER_TRAN;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
||||
import * as r from 'restructure';
|
||||
import { ElementString } from './element-string';
|
||||
import { ElementString } from './element-string.js';
|
||||
|
||||
import KMXFile from './kmx';
|
||||
import KMXFile from './kmx.js';
|
||||
|
||||
// Implementation of file structures from /core/src/ldml/C7043_ldml.md
|
||||
// Writer in kmx-builder.ts
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import * as xml2js from 'xml2js';
|
||||
import LDMLKeyboardXMLSourceFile from './ldml-keyboard-xml';
|
||||
import CompilerCallbacks from '../compiler/callbacks';
|
||||
import LDMLKeyboardXMLSourceFile from './ldml-keyboard-xml.js';
|
||||
import CompilerCallbacks from '../compiler/callbacks.js';
|
||||
import Ajv from 'ajv';
|
||||
import { CompilerMessages } from '../compiler/messages';
|
||||
import { CompilerMessages } from '../compiler/messages.js';
|
||||
|
||||
export default class LDMLKeyboardXMLSourceFileReader {
|
||||
private readonly callbacks: CompilerCallbacks;
|
||||
7
developer/src/kmc-keyboard/src/main.ts
Normal file
7
developer/src/kmc-keyboard/src/main.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
export { default as Compiler } from './compiler/compiler.js';
|
||||
export { CompilerEvent, default as CompilerCallbacks } from './compiler/callbacks.js';
|
||||
export { default as CompilerOptions } from './compiler/compiler-options.js';
|
||||
export { CompilerMessages, CompilerErrorSeverity } from './compiler/messages.js';
|
||||
export { default as KMXPlusMetadataCompiler } from './compiler/metadata-compiler.js';
|
||||
export { default as KMXBuilder } from './kmx/kmx-builder.js';
|
||||
|
|
@ -3,14 +3,15 @@
|
|||
*/
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { SectionCompiler } from '../../src/keyman/compiler/section-compiler';
|
||||
import KMXPlusFile, { Elem, GlobalSections, Section, Strs } from '../../src/keyman/kmx/kmx-plus';
|
||||
import LDMLKeyboardXMLSourceFileReader from '../../src/keyman/ldml-keyboard/ldml-keyboard-xml-reader';
|
||||
import { CompilerEvent } from '../../src/keyman/compiler/callbacks';
|
||||
import Compiler from '../../src/keyman/compiler/compiler';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { SectionCompiler } from '../../src/compiler/section-compiler.js';
|
||||
import KMXPlusFile, { Elem, GlobalSections, Section, Strs } from '../../src/kmx/kmx-plus.js';
|
||||
import LDMLKeyboardXMLSourceFileReader from '../../src/ldml-keyboard/ldml-keyboard-xml-reader.js';
|
||||
import { CompilerEvent } from '../../src/compiler/callbacks.js';
|
||||
import Compiler from '../../src/compiler/compiler.js';
|
||||
import { assert } from 'chai';
|
||||
import KMXPlusMetadataCompiler from '../../src/keyman/compiler/metadata-compiler';
|
||||
import CompilerOptions from '../../src/keyman/compiler/compiler-options';
|
||||
import KMXPlusMetadataCompiler from '../../src/compiler/metadata-compiler.js';
|
||||
import CompilerOptions from '../../src/compiler/compiler-options.js';
|
||||
|
||||
/**
|
||||
* Builds a path to the fixture with the given path components.
|
||||
|
|
@ -20,7 +21,7 @@ import CompilerOptions from '../../src/keyman/compiler/compiler-options';
|
|||
* @param components One or more path components.
|
||||
*/
|
||||
export function makePathToFixture(...components: string[]): string {
|
||||
return path.join(__dirname, '..', '..', '..', 'test', 'fixtures', ...components);
|
||||
return fileURLToPath(new URL(path.join('..', '..', '..', 'test', 'fixtures', ...components), import.meta.url));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ export class CompilerCallbacks {
|
|||
this.messages.push(event);
|
||||
}
|
||||
loadLdmlKeyboardSchema(): Buffer {
|
||||
return fs.readFileSync(path.join(__dirname, '..', '..', 'src', 'ldml-keyboard.schema.json'));
|
||||
return fs.readFileSync(new URL(path.join('..', '..', 'src', 'ldml-keyboard.schema.json'), import.meta.url));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import 'mocha';
|
||||
import {assert} from 'chai';
|
||||
import {CompilerCallbacks, makePathToFixture} from '../helpers/index';
|
||||
import LDMLKeyboardXMLSourceFileReader from '../../src/keyman/ldml-keyboard/ldml-keyboard-xml-reader';
|
||||
import { CompilerMessages } from '../../src/keyman/compiler/messages';
|
||||
import {CompilerCallbacks, makePathToFixture} from '../helpers/index.js';
|
||||
import LDMLKeyboardXMLSourceFileReader from '../../src/ldml-keyboard/ldml-keyboard-xml-reader.js';
|
||||
import { CompilerMessages } from '../../src/compiler/messages.js';
|
||||
|
||||
describe('ldml keyboard xml reader tests', function() {
|
||||
this.slow(500); // 0.5 sec -- json schema validation takes a while
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import 'mocha';
|
||||
import { assert } from 'chai';
|
||||
import { BkspCompiler } from '../src/keyman/compiler/bksp';
|
||||
import { CompilerCallbacks, loadSectionFixture } from './helpers';
|
||||
import { Bksp, BkspItemFlags } from '../src/keyman/kmx/kmx-plus';
|
||||
import { BkspCompiler } from '../src/compiler/bksp.js';
|
||||
import { CompilerCallbacks, loadSectionFixture } from './helpers/index.js';
|
||||
import { Bksp, BkspItemFlags } from '../src/kmx/kmx-plus.js';
|
||||
//import { CompilerMessages } from './keyman/compiler/messages';
|
||||
|
||||
describe('bksp', function () {
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
import 'mocha';
|
||||
import {assert} from 'chai';
|
||||
import hextobin from '@keymanapp/hextobin';
|
||||
import KMXBuilder from '../src/keyman/kmx/kmx-builder';
|
||||
import {checkMessages, compileKeyboard, CompilerCallbacks, makePathToFixture} from './helpers/index';
|
||||
import x_hextobin from '@keymanapp/hextobin';
|
||||
import KMXBuilder from '../src/kmx/kmx-builder.js';
|
||||
import {checkMessages, compileKeyboard, CompilerCallbacks, makePathToFixture} from './helpers/index.js';
|
||||
|
||||
// const __filename = fileURLToPath(import.meta.url);
|
||||
const hextobin = (x_hextobin as any).default;
|
||||
|
||||
describe('compiler-tests', function() {
|
||||
this.slow(500); // 0.5 sec -- json schema validation takes a while
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue