Merge pull request #3008 from keymanapp/change/web/engine/input-processor-package

change(web/engine): spins core/web/input-processor package off from KeymanWeb
This commit is contained in:
Joshua Horton 2020-04-29 17:06:50 +07:00 • committed by GitHub
commit 3c077bcb19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 574 additions and 101 deletions

View file

@ -0,0 +1,18 @@
# Build products
src/environment.inc.ts
# Legacy build folders.
output/
build/
embedded/
# Current build output folder (matches standard node publish location).
dist/
# Other local files.
node_modules/
unit_tests/modernizr.js
source/environment.inc.ts
.idea/**/*.xml
*.iml
*.kpj.user

View file

@ -0,0 +1,21 @@
# Keyman: Keyboard Processor Module
The Original Code is (C) 2017-2020 SIL International
The Keyboard Processor module is an internal component of KeymanWeb, seen within this repo at /web/.
## Minimum Compilation Requirements
* A local installation of [Node.js](https://nodejs.org/) v8.9+.
* Builds will call `npm install` to automatically install further necessary build dependencies.
* Linux users can run the following to update to LTS version of nodejs
```
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs
```
**********************************************************************
The build script may be found at src/build.sh.

View file

@ -0,0 +1,318 @@
{
"name": "@keymanapp/input-processor",
"version": "14.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "11.15.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.15.10.tgz",
"integrity": "sha512-FHli7aK/ViA02vbWKmiNejJW4BCJxCVb6macS5gi71fST+UrrdqcES6Lh5rx23hU1QCBeUNXfPquYr9jJv7FuA=="
},
"arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
},
"assertion-error": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
"dev": true
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"browser-stdout": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true
},
"buffer-from": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
},
"chai": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
"dev": true,
"requires": {
"assertion-error": "^1.1.0",
"check-error": "^1.0.2",
"deep-eql": "^3.0.1",
"get-func-name": "^2.0.0",
"pathval": "^1.1.0",
"type-detect": "^4.0.5"
}
},
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true
},
"commander": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
"dev": true,
"requires": {
"type-detect": "^4.0.0"
}
},
"diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"eventemitter3": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz",
"integrity": "sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg=="
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"get-func-name": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
"dev": true
},
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"growl": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
"dev": true
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"he": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=",
"dev": true
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
"make-error": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
"minimist": "0.0.8"
}
},
"mocha": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz",
"integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==",
"dev": true,
"requires": {
"browser-stdout": "1.3.1",
"commander": "2.15.1",
"debug": "3.1.0",
"diff": "3.5.0",
"escape-string-regexp": "1.0.5",
"glob": "7.1.2",
"growl": "1.10.5",
"he": "1.1.1",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
"supports-color": "5.4.0"
},
"dependencies": {
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true
}
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"pathval": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
},
"source-map-support": {
"version": "0.5.16",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz",
"integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
},
"ts-node": {
"version": "8.8.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz",
"integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==",
"requires": {
"arg": "^4.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.6",
"yn": "3.1.1"
}
},
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
},
"typescript": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"yn": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
}
}
}

View file

@ -0,0 +1,38 @@
{
"name": "@keymanapp/input-processor",
"version": "14.0.0",
"description": "The core text and prediction processing engine for KeymanWeb",
"repository": {
"type": "git",
"url": "git+https://github.com/keymanapp/keyman.git"
},
"keywords": [
"input",
"languages",
"keyboards"
],
"author": "SIL International",
"license": "MIT",
"bugs": {
"url": "https://github.com/keymanapp/keyman/issues"
},
"homepage": "https://github.com/keymanapp/keyman#readme",
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^5.2.0",
"typescript": "^3.7.2"
},
"scripts": {
"lerna": "cd ../ && npm run lerna --",
"tsc": "tsc",
"test": "bash ./unit_tests/test.sh"
},
"dependencies": {
"@keymanapp/keyboard-processor": "^14.0.0",
"@keymanapp/lexical-model-layer": "^14.0.0",
"@keymanapp/lexical-model-types": "^0.0.0",
"@types/node": "^11.9.4",
"eventemitter3": "^4.0.0",
"ts-node": "^8.0.2"
}
}

View file

@ -0,0 +1,91 @@
#! /bin/bash
#
# Compile KeymanWeb's 'keyboard-processor' module, one of the components of Web's 'core' module.
#
## 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"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
## END STANDARD BUILD SCRIPT INCLUDE
# This script runs from its own folder
cd "$(dirname "$THIS_SCRIPT")"
display_usage ( ) {
echo "build.sh [-skip-package-install | -S] [-test]"
echo
echo " -test to compile for testing without re-fetching external dependencies"
echo " or recompiling the lm-layer module."
echo " -skip-package-install (or -S) skips the `lerna bootstrap` dependency check."
echo ""
echo " If more than one target is specified, the last one will take precedence."
exit 1
}
# Establish default build parameters
set_default_vars ( ) {
BUILD_LMLAYER=true
BUILD_CORE=true
FETCH_DEPS=true
}
set_default_vars
# Parse args
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-test)
set_default_vars
BUILD_LMLAYER=false
FETCH_DEPS=false
;;
-skip-package-install|-S)
set_default_vars
FETCH_DEPS=false
;;
esac
shift # past argument
done
# Generates a linkable TS file; defined in resources/build-utils.sh.
exportEnvironmentDefinitionTS
if [ $FETCH_DEPS = true ]; then
verify_npm_setup
fi
if [ $BUILD_LMLAYER = true ]; then
FLAGS="-skip-package-install"
# Ensure that the LMLayer compiles properly, readying the build product for comsumption by KMW.
cd ../../../../predictive-text/
echo ""
echo "Compiling the Language Modeling layer module..."
./build.sh $FLAGS || fail "Failed to compile the language modeling layer module."
cd ../core/web/input-processor/src
# TODO: Move this back to KMW's main build script. Consider it part of the dependency update.
echo "Language Modeling layer compilation successful."
echo ""
fi
if [ $BUILD_CORE = true ]; then
FLAGS="-skip-package-install"
# Ensure that the KeyboardProcessor module compiles properly.
cd ../../keyboard-processor/src
echo ""
echo "Compiling Keyboard Processor module..."
./build.sh $FLAGS || fail "Dependency build failed; aborting"
cd ../../input-processor/src
echo "Keyboard Processor module compilation successful."
echo ""
fi
# Compile web's `keyboard-processor` module.
echo "Compiling Input Processor module..."
npm run tsc -- -p src/tsconfig.json || fail "Failed to compile the core/web/input-processor module."
echo "Input Processor module compilation successful."
echo ""

View file

@ -1,6 +1,5 @@
// Defines a 'polyfill' of sorts for NPM's events module
/// <reference path="../includes/events.ts" />
/// <reference path="../includes/lmMsgs.d.ts" />
/// <reference path="../../node_modules/@keymanapp/keyboard-processor/src/text/keyboardProcessor.ts" />
/// <reference path="prediction/languageProcessor.ts" />

View file

@ -1,3 +1,8 @@
///<reference path="../../../node_modules/@keymanapp/lexical-model-layer/embedded_worker.d.ts" />
///<reference path="../../../node_modules/@keymanapp/lexical-model-layer/message.d.ts" />
///<reference path="../../../node_modules/@keymanapp/lexical-model-layer/index.ts" />
///<reference path="../../includes/events.ts" />
namespace com.keyman.text.prediction {
export interface ModelSpec {
/**

View file

@ -2,17 +2,17 @@
"compilerOptions": {
"allowJs": true,
"module": "none",
"outDir": "../intermediate/",
"outDir": "../dist/",
"inlineSources": true,
"sourceMap": true,
"sourceRoot": "/keyman/",
"target": "es5",
"types": ["node"],
"lib": ["es6"],
"outFile": "../intermediate/web-core/index.js"
"outFile": "../dist/index.js"
},
"files": [
"includes/node-lmlayer.ts",
"../node_modules/@keymanapp/lexical-model-layer/node-defaultWorker.ts",
"text/inputProcessor.ts"
]
}

View file

@ -13,6 +13,6 @@ dist/
node_modules/
unit_tests/modernizr.js
source/environment.inc.ts
**/.idea/**/*.xml
**/*.iml
**/*.kpj.user
.idea/**/*.xml
*.iml
*.kpj.user

View file

@ -13,10 +13,41 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA
# This script runs from its own folder
cd "$(dirname "$THIS_SCRIPT")"
verify_npm_setup
display_usage ( ) {
echo "build.sh [-skip-package-install | -S] [-test]"
echo
echo " -skip-package-install (or -S) skips the `lerna bootstrap` dependency check."
echo " Intended for use when this script is called by another build script."
echo ""
echo " If more than one target is specified, the last one will take precedence."
exit 1
}
# Establish default build parameters
set_default_vars ( ) {
FETCH_DEPS=true
}
set_default_vars
# Parse args
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-skip-package-install|-S)
set_default_vars
FETCH_DEPS=false
;;
esac
shift # past argument
done
if [ $FETCH_DEPS = true ]; then
verify_npm_setup
fi
# Generates a linkable TS file; defined in resources/build-utils.sh.
exportEnvironmentDefinitionTS
# Compile web's `keyboard-processor` module.
npm run tsc -- -p src/tsconfig.json
npm run tsc -- -p src/tsconfig.json || fail "Failed to compile the core/web/keyboard-processor module."

View file

@ -85,13 +85,14 @@ clean ( ) {
}
display_usage ( ) {
echo "Usage: $0 [-clean] [-test | -tdd]"
echo "Usage: $0 [-clean] [-skip-package-install | -S] [-test | -tdd]"
echo " $0 -help"
echo
echo " -clean to erase pre-existing build products before a re-build"
echo " -help displays this screen and exits"
echo " -tdd skips dependency updates, builds, then runs unit tests only"
echo " -test runs unit and integration tests after building"
echo " -clean to erase pre-existing build products before a re-build"
echo " -help displays this screen and exits"
echo " -skip-package-install (or -S) skips dependency updates"
echo " -tdd skips dependency updates, builds, then runs unit tests only"
echo " -test runs unit and integration tests after building"
}
# Creates embedded_worker.js. Must be run after the worker is built for the
@ -149,6 +150,9 @@ while [[ $# -gt 0 ]] ; do
display_usage
exit
;;
-skip-package-install|-S)
fetch_deps=false
;;
-test)
run_tests=1
;;

View file

@ -1,5 +1,6 @@
{
"packages": [
"common/core/web/input-processor",
"common/core/web/keyboard-processor",
"common/predictive-text",
"common/lexical-model-types",

View file

@ -9,7 +9,8 @@
},
"files": [
"../node_modules/@keymanapp/keyboard-processor/src/utils/version.ts",
"../node_modules/@keyman/language-modeling-layer/message.d.ts",
"../node_modules/@keymanapp/keyboard-processor/src/text/engineDeviceSpec.ts",
"../node_modules/@keymanapp/lexical-model-layer/message.d.ts",
"renderer_core.ts"
]
}

View file

@ -47,6 +47,7 @@
"modernizr": "modernizr"
},
"dependencies": {
"@keymanapp/input-processor": "^14.0.0",
"@keymanapp/keyboard-processor": "^14.0.0",
"@keymanapp/lexical-model-layer": "^14.0.0",
"@keymanapp/lexical-model-types": "^0.0.0",

View file

@ -1,19 +0,0 @@
#! /bin/bash
#
# Compile KeymanWeb's 'keyboard-processor' module, one of the components of Web's 'core' module.
#
## 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
# This script runs from its own folder
cd "$(dirname "$THIS_SCRIPT")"
# Generates a linkable TS file; defined in resources/build-utils.sh.
exportEnvironmentDefinitionTS
# Compile web's `keyboard-processor` module.
npm run tsc -- -p source/web-core.tsconfig.json

View file

@ -227,6 +227,7 @@ set_default_vars ( ) {
BUILD_DEBUG_EMBED=false
BUILD_COREWEB=true
DO_MINIFY=true
FETCH_DEPS=true
}
if [[ $# = 0 ]]; then
@ -256,6 +257,7 @@ while [[ $# -gt 0 ]] ; do
BUILD_UI=false
BUILD_EMBED=false
BUILD_FULLWEB=false
FETCH_DEPS=false
;;
-embed)
set_default_vars
@ -296,8 +298,13 @@ readonly BUILD_DEBUG_EMBED
readonly BUILD_COREWEB
readonly DO_MINIFY
# Ensure the dependencies are downloaded. --no-optional should help block fsevents warnings.
verify_npm_setup
if [ $FETCH_DEPS = true ]; then
# Ensure the dependencies are downloaded.
verify_npm_setup
echo "Copying testing resource ${PREDICTIVE_TEXT_SOURCE} to ${PREDICTIVE_TEXT_OUTPUT}"
cp "${PREDICTIVE_TEXT_SOURCE}" "${PREDICTIVE_TEXT_OUTPUT}" || fail "Failed to copy predictive text model"
fi
if [ $DO_MINIFY = true ]; then
# NPM install is required for the file to be present.
@ -307,33 +314,27 @@ if [ $DO_MINIFY = true ]; then
exit 1
fi
# Also, build our sourcemap-root tool for cleaning up the minified version's sourcemaps.
echo "Compiling build tools for minified build products"
$compiler --build "source/$minified_sourcemap_cleaner/tsconfig.json"
assert "$minified_sourcemap_cleaner/index.js"
fi
if [ $BUILD_LMLAYER = true ]; then
# Ensure that the LMLayer compiles properly, readying the build product for comsumption by KMW.
cd ../../common/predictive-text/
echo ""
echo "Compiling the Language Modeling layer module..."
./build.sh || fail "Failed to compile the language modeling layer module."
cd ../../web/source
echo "Copying ${PREDICTIVE_TEXT_SOURCE} to ${PREDICTIVE_TEXT_OUTPUT}"
cp "${PREDICTIVE_TEXT_SOURCE}" "${PREDICTIVE_TEXT_OUTPUT}" || fail "Failed to copy predictive text model"
echo "Language Modeling layer compilation successful."
echo ""
if [ $FETCH_DEPS = true ]; then
# Also, build our sourcemap-root tool for cleaning up the minified version's sourcemaps.
echo "Compiling build tools for minified build products"
$compiler --build "source/$minified_sourcemap_cleaner/tsconfig.json"
assert "$minified_sourcemap_cleaner/index.js"
fi
fi
if [ $BUILD_CORE = true ]; then
# Ensure that the KeyboardProcessor module compiles properly.
cd ../../common/core/web/keyboard-processor/src
CORE_FLAGS="-skip-package-install"
if [ $BUILD_LMLAYER = false ]; then
CORE_FLAGS="$CORE_FLAGS -test"
fi
# Ensure that the Input Processor module compiles properly.
cd ../../common/core/web/input-processor/src
echo ""
echo "Compiling KMW's Keyboard Processor module..."
./build.sh || fail "Failed to compile the core/web/keyboard-processor module."
echo "${TERM_HEADING}Compiling local KeymanWeb dependencies...${NORMAL}"
./build.sh $CORE_FLAGS || fail "Failed to compile KeymanWeb dependencies"
cd $WORKING_DIRECTORY
echo "Keyboard Processor module compilation successful."
echo "${TERM_HEADING}Local KeymanWeb dependency compilations completed successfully.${NORMAL}"
echo ""
fi

View file

@ -1,7 +1,5 @@
// Defines the TouchAliasElement merged type.
/// <reference path="../touchAliasElement.ts" />
// Defines the OutputTarget interface.
/// <reference path="../../../node_modules/@keymanapp/keyboard-processor/src/text/outputTarget.ts" />
namespace com.keyman.dom.targets {
export class TouchAlias extends OutputTarget {

View file

@ -1,5 +1,3 @@
// References the KMW string extensions.
/// <reference path="../../node_modules/@keymanapp/keyboard-processor/src/text/kmwstring.ts" />
// References extra HTML definitions not included by default in TS.
/// <reference path="../kmwexthtml.ts" />
// References device-specific code checks (separable module from KMW)

View file

@ -1,11 +0,0 @@
/**
* Defines the reference-path tags necessary to link properly with common/predictive-text.
*/
// Defines the main interface of the Language Modeling Layer (LMLayer) and its original typing information.
///<reference path="../../node_modules/@keymanapp/lexical-model-layer/embedded_worker.d.ts" />
///<reference path="../../node_modules/@keymanapp/lexical-model-layer/web-defaultWorker.ts" />
///<reference path="../../node_modules/@keymanapp/lexical-model-layer/index.ts" />
// We DO need the embedded_worker.d.ts file - since we're directly linking into the LMLayer's code,
// we need the typedef for the embedded worker to be linked.

View file

@ -1 +0,0 @@
///<reference path="../../../common/predictive-text/message.d.ts" />

View file

@ -1,11 +0,0 @@
/**
* Defines the reference-path tags necessary to link properly with common/predictive-text.
*/
// Defines the main interface of the Language Modeling Layer (LMLayer) and its original typing information.
///<reference path="../../node_modules/@keymanapp/lexical-model-layer/embedded_worker.d.ts" />
///<reference path="../../node_modules/@keymanapp/lexical-model-layer/node-defaultWorker.ts" />
///<reference path="../../node_modules/@keymanapp/lexical-model-layer/index.ts" />
// We DO need the embedded_worker.d.ts file - since we're directly linking into the LMLayer's code,
// we need the typedef for the embedded worker to be linked.

View file

@ -7,7 +7,7 @@
// Defines the web-page interface object.
/// <reference path="singleton.ts" />
// Defines the core text processor.
/// <reference path="text/inputProcessor.ts" />
/// <reference path="../node_modules/@keymanapp/input-processor/src/text/inputProcessor.ts" />
// Extends KeyboardInterface with DOM-oriented offerings.
/// <reference path="text/domKbdInterface.ts" />
// Defines the web-page interface object.

View file

@ -1,7 +1,5 @@
// Includes version-related functionality
/// <reference path="../node_modules/@keymanapp/keyboard-processor/src/text/outputTarget.ts" />
///<reference path="utils/styleConstants.ts" />
/// <reference path="../node_modules/@keymanapp/keyboard-processor/src/text/engineDeviceSpec.ts" />
// The Device object definition -------------------------------------------------

View file

@ -4,8 +4,6 @@
/// <reference path="kmwdevice.ts" />
// Includes the DOM utils, since our UI modules need access to certain methods here.
/// <reference path="dom/utils.ts" />
// Include other important utils
/// <reference path="../node_modules/@keymanapp/keyboard-processor/src/utils/deepCopy.ts" />
namespace com.keyman {
class DOMEventTracking {

View file

@ -1,6 +1,4 @@
/// <reference path="../kmwexthtml.ts" /> // Includes KMW-added property declaration extensions for HTML elements.
// Includes the default layout specification.
/// <reference path="../../node_modules/@keymanapp/keyboard-processor/src/keyboards/defaultLayouts.ts" />
// Includes the touch-mode language picker UI.
/// <reference path="languageMenu.ts" />
// Includes the banner

View file

@ -1,4 +1,3 @@
/// <reference path="../../node_modules/@keymanapp/keyboard-processor/src/keyboards/activeLayout.ts" />
/// <reference path="preProcessor.ts" />
namespace com.keyman.osk {

View file

@ -1,5 +1,3 @@
/// <reference path="../../node_modules/@keymanapp/keyboard-processor/src/text/kbdInterface.ts" />
/*
* This file defines DOM-specific keyboard API that is not available in headless mode, extending web-core's
* base KeyboardInterface offerings.

View file

@ -1,5 +1,3 @@
// Defines the text processing KMW core.
/// <reference path="../../../node_modules/@keymanapp/keyboard-processor/src/text/keyboardProcessor.ts" />
// Defines the KeyboardManager and its related types.
///<reference path="../../keyboards/kmwkeyboards.ts" />

View file

@ -10,7 +10,7 @@
"files": [
"../node_modules/@keymanapp/keyboard-processor/src/text/outputTarget.ts",
"../node_modules/@keymanapp/keyboard-processor/src/utils/version.ts",
"../node_modules/@keymanapp/language-modeling-layer/message.d.ts",
"../node_modules/@keymanapp/lexical-model-layer/message.d.ts",
"dom/targets/wrapElement.ts"
]
}

View file

@ -4,7 +4,7 @@
"outFile": "../intermediate/keyman.js"
},
"files": [
"includes/dom-lmlayer.ts",
"../node_modules/@keymanapp/lexical-model-layer/web-defaultWorker.ts",
"kmwbase.ts",
"keymanweb.ts",
"kmwembedded.ts",

View file

@ -9,7 +9,8 @@
},
"files": [
"../node_modules/@keymanapp/keyboard-processor/src/utils/version.ts",
"../node_modules/@keymanapp/language-modeling-layer/message.d.ts",
"../node_modules/@keymanapp/keyboard-processor/src/text/engineDeviceSpec.ts",
"../node_modules/@keymanapp/lexical-model-layer/message.d.ts",
"recorder_InputEvents.ts"
]
}

View file

@ -4,7 +4,7 @@
"outFile": "../intermediate/keymanweb.js"
},
"files": [
"includes/dom-lmlayer.ts",
"../node_modules/@keymanapp/lexical-model-layer/web-defaultWorker.ts",
"kmwbase.ts",
"keymanweb.ts",
"kmwnative.ts",