mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
refactor(web): move predictive-text → worker-main
This moves `common/predictive-text/` → `web/src/engine/predictive-text/worker-main/`. This also moves `common/test/predictive-text/` → `web/src/test/manual/predictive-text/`. Note though that this testing tool is still broken. Fixes: #12134
This commit is contained in:
parent
170ac4bb6b
commit
b9aa9ccd8c
50 changed files with 101 additions and 86 deletions
|
|
@ -1 +0,0 @@
|
|||
The presence of this file tells CI to use the new builder_ style parameters for build.sh and unit_tests/test.sh.
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"extends": "../../web/tsconfig.kmw-main-base.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "../build/obj",
|
||||
"tsBuildInfoFile": "../build/obj/tsconfig.tsbuildinfo",
|
||||
"rootDir": "./"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../../web/utils" },
|
||||
{ "path": "../../models/types"},
|
||||
{ "path": "../../models/wordbreakers"},
|
||||
{ "path": "../../web/lm-message-types"},
|
||||
{ "path": "../../models/templates"}
|
||||
],
|
||||
"include" : [ "./*.ts" ],
|
||||
"exclude" : [
|
||||
"node",
|
||||
"web",
|
||||
"index.ts" // It's handled by the final layer.
|
||||
]
|
||||
}
|
||||
|
|
@ -3,30 +3,30 @@
|
|||
#
|
||||
# @darcywong00 @mcdurdin @ermshiperete @rc-swag @SabineSIL @sgschantz
|
||||
|
||||
/android/ @darcywong00 @sgschantz
|
||||
/android/ @darcywong00 @sgschantz
|
||||
|
||||
/common/ @mcdurdin @rc-swag
|
||||
/core/ @mcdurdin @rc-swag
|
||||
/common/lexical-model-types/ @jahorton @mcdurdin
|
||||
/common/models/ @jahorton @mcdurdin
|
||||
/common/predictive-text/ @jahorton @mcdurdin
|
||||
/common/schemas/ @mcdurdin @jahorton
|
||||
/common/test/ @mcdurdin @ermshiperete
|
||||
/common/web/ @jahorton @mcdurdin
|
||||
/common/ @mcdurdin @rc-swag
|
||||
/core/ @mcdurdin @rc-swag
|
||||
/common/lexical-model-types/ @jahorton @mcdurdin
|
||||
/common/models/ @jahorton @mcdurdin
|
||||
/common/schemas/ @mcdurdin @jahorton
|
||||
/common/test/ @mcdurdin @ermshiperete
|
||||
/common/web/ @jahorton @mcdurdin
|
||||
|
||||
/developer/ @mcdurdin @darcywong00
|
||||
/docs/ @mcdurdin @jahorton
|
||||
/ios/ @sgschantz @jahorton
|
||||
/linux/ @ermshiperete @darcywong00
|
||||
/mac/ @sgschantz @SabineSIL
|
||||
/developer/ @mcdurdin @darcywong00
|
||||
/docs/ @mcdurdin @jahorton
|
||||
/ios/ @sgschantz @jahorton
|
||||
/linux/ @ermshiperete @darcywong00
|
||||
/mac/ @sgschantz @SabineSIL
|
||||
|
||||
/oem/firstvoices/android/ @darcywong00 @sgschantz
|
||||
/oem/firstvoices/common/ @mcdurdin @rc-swag
|
||||
/oem/firstvoices/ios/ @sgschantz @jahorton
|
||||
/oem/firstvoices/windows/ @rc-swag @ermshiperete
|
||||
/resources/ @mcdurdin @jahorton
|
||||
/oem/firstvoices/android/ @darcywong00 @sgschantz
|
||||
/oem/firstvoices/common/ @mcdurdin @rc-swag
|
||||
/oem/firstvoices/ios/ @sgschantz @jahorton
|
||||
/oem/firstvoices/windows/ @rc-swag @ermshiperete
|
||||
/resources/ @mcdurdin @jahorton
|
||||
|
||||
# Web is currently shared between Eberhard and Joshua:
|
||||
/web/ @ermshiperete @jahorton
|
||||
/web/ @ermshiperete @jahorton
|
||||
/web/src/engine/predictive-text/ @jahorton @mcdurdin
|
||||
|
||||
/windows/ @rc-swag @ermshiperete
|
||||
/windows/ @rc-swag @ermshiperete
|
||||
|
|
|
|||
|
|
@ -30,28 +30,37 @@ cp -a debian ../
|
|||
cd ..
|
||||
echo "3.0 (native)" > debian/source/format
|
||||
dch keyman --newversion "${VERSION}" --force-bad-version --nomultimaint
|
||||
dpkg-source --tar-ignore=*~ --tar-ignore=.git --tar-ignore=.gitattributes \
|
||||
--tar-ignore=.gitignore --tar-ignore=experiments --tar-ignore=debian \
|
||||
--tar-ignore=.github --tar-ignore=.vscode --tar-ignore=android \
|
||||
dpkg-source --tar-ignore=*~ \
|
||||
--tar-ignore=.git \
|
||||
--tar-ignore=.gitattributes \
|
||||
--tar-ignore=.gitignore \
|
||||
--tar-ignore=experiments \
|
||||
--tar-ignore=debian \
|
||||
--tar-ignore=.github \
|
||||
--tar-ignore=.vscode \
|
||||
--tar-ignore=android \
|
||||
--tar-ignore=.devcontainer \
|
||||
--tar-ignore=artifacts \
|
||||
\
|
||||
--tar-ignore=common/models \
|
||||
--tar-ignore=common/predictive-text \
|
||||
--tar-ignore=common/resources \
|
||||
--tar-ignore=common/schemas \
|
||||
--tar-ignore=common/test/keyboards/build.* \
|
||||
--tar-ignore=common/test/predictive-text \
|
||||
--tar-ignore=common/test/resources \
|
||||
--tar-ignore=common/web \
|
||||
--tar-ignore=common/windows \
|
||||
\
|
||||
--tar-ignore=core/build \
|
||||
--tar-ignore=developer --tar-ignore=docs --tar-ignore=ios \
|
||||
--tar-ignore=developer \
|
||||
--tar-ignore=docs \
|
||||
--tar-ignore=ios \
|
||||
--tar-ignore=linux/keyman-config/keyman_config/version.py \
|
||||
--tar-ignore=linux/keyman-config/buildtools/build-langtags.py --tar-ignore=__pycache__ \
|
||||
--tar-ignore=linux/keyman-config/buildtools/build-langtags.py \
|
||||
--tar-ignore=__pycache__ \
|
||||
--tar-ignore=linux/help \
|
||||
--tar-ignore=mac --tar-ignore=node_modules --tar-ignore=oem \
|
||||
--tar-ignore=mac \
|
||||
--tar-ignore=node_modules \
|
||||
--tar-ignore=oem \
|
||||
--tar-ignore=linux/build \
|
||||
--tar-ignore=linux/builddebs \
|
||||
--tar-ignore=linux/ibus-keyman/build \
|
||||
|
|
@ -60,11 +69,17 @@ dpkg-source --tar-ignore=*~ --tar-ignore=.git --tar-ignore=.gitattributes \
|
|||
--tar-ignore=resources/environment.sh \
|
||||
--tar-ignore=resources/git-hooks \
|
||||
--tar-ignore=resources/scopes \
|
||||
--tar-ignore=resources/build/*.lua --tar-ignore=resources/build/jq* \
|
||||
--tar-ignore=resources/build/*.lua \
|
||||
--tar-ignore=resources/build/jq* \
|
||||
--tar-ignore=results \
|
||||
--tar-ignore=tmp \
|
||||
--tar-ignore=web --tar-ignore=windows --tar-ignore=keyman_1* \
|
||||
--tar-ignore=dist --tar-ignore=VERSION -Zgzip -b .
|
||||
--tar-ignore=web \
|
||||
--tar-ignore=windows \
|
||||
--tar-ignore=keyman_1* \
|
||||
--tar-ignore=dist \
|
||||
--tar-ignore=VERSION \
|
||||
\
|
||||
-Zgzip -b .
|
||||
mv ../keyman_"${VERSION}".tar.gz linux/dist/keyman-"${VERSION}".tar.gz
|
||||
echo "3.0 (quilt)" > debian/source/format
|
||||
cd "$BASEDIR"
|
||||
|
|
|
|||
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -25,9 +25,9 @@
|
|||
"common/test/resources",
|
||||
"common/tools/*",
|
||||
"common/web/*",
|
||||
"common/predictive-text",
|
||||
"common/tools/hextobin",
|
||||
"web"
|
||||
"web",
|
||||
"web/src/engine/predictive-text/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@keymanapp/common-types": "file:common/web/types",
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
"typescript": "^5.4.5"
|
||||
}
|
||||
},
|
||||
"common/predictive-text": {
|
||||
"web/src/engine/predictive-text/worker-main": {
|
||||
"name": "@keymanapp/lexical-model-layer",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
@ -2892,7 +2892,7 @@
|
|||
"link": true
|
||||
},
|
||||
"node_modules/@keymanapp/lexical-model-layer": {
|
||||
"resolved": "common/predictive-text",
|
||||
"resolved": "web/src/engine/predictive-text/worker-main",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@keymanapp/lm-message-types": {
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@
|
|||
"common/test/resources",
|
||||
"common/tools/*",
|
||||
"common/web/*",
|
||||
"common/predictive-text",
|
||||
"common/tools/hextobin",
|
||||
"web"
|
||||
"web",
|
||||
"web/src/engine/predictive-text/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@keymanapp/common-types": "file:common/web/types",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
{ "path": "./common/models/templates/tsconfig.json" },
|
||||
{ "path": "./common/models/types/tsconfig.json" },
|
||||
{ "path": "./common/models/wordbreakers/tsconfig.json" },
|
||||
{ "path": "./common/predictive-text/tsconfig.all.json" },
|
||||
{ "path": "./common/tools/hextobin/" },
|
||||
|
||||
{ "path": "./common/web/gesture-recognizer/tsconfig.json" },
|
||||
|
|
@ -43,6 +42,7 @@
|
|||
{ "path": "./resources/build/version/" },
|
||||
|
||||
{ "path": "./web/src/tsconfig.all.json" },
|
||||
{ "path": "./web/src/engine/predictive-text/worker-main/tsconfig.all.json" },
|
||||
// { "path": "./web/tools/recorder/tsconfig.json" },
|
||||
// { "path": "./web/tools/sourcemap-root/tsconfig.json" },
|
||||
]
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ graph TD;
|
|||
LMWorker["@keymanapp/lm-worker<br>(/common/web/lm-worker)"];
|
||||
LMWorker-->Models;
|
||||
LMWorker-->Wordbreakers;
|
||||
LMLayer["@keymanapp/lexical-model-layer<br>(/common/predictive-text)"];
|
||||
LMLayer["@keymanapp/lexical-model-layer<br>(/web/src/engine/predictive-text/worker-main)"];
|
||||
LMLayer-->LMWorker;
|
||||
Gestures["@keymanapp/gesture-recognizer<br>(/common/web/gesture-recognizer)"];
|
||||
Gestures-->WebUtils;
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ builder_describe "Builds engine modules for Keyman Engine for Web (KMW)." \
|
|||
":engine/dom-utils A common subset of function used for DOM calculations, layout, etc" \
|
||||
":engine/events Specialized classes utilized to support KMW API events" \
|
||||
":engine/element-wrappers Subset used to integrate with website elements" \
|
||||
":engine/interfaces Subset used to configure KMW" \
|
||||
":engine/js-processor Build JS processor for KMW" \
|
||||
":engine/keyboard Builds KMW's keyboard-loading and caching code" \
|
||||
":engine/keyboard-storage Subset used to collate keyboards and request them from the cloud" \
|
||||
":engine/main Builds all common code used by KMW's app/-level targets" \
|
||||
":engine/osk Builds the Web OSK module" \
|
||||
":engine/interfaces Subset used to configure KMW" \
|
||||
":engine/predictive-text=src/engine/predictive-text/worker-main Builds KMW's predictive text module" \
|
||||
":samples Builds all needed resources for the KMW sample-page set" \
|
||||
":tools Builds engine-related development resources" \
|
||||
":test-pages=src/test/manual Builds resources needed for the KMW manual testing pages" \
|
||||
|
|
@ -59,12 +60,13 @@ builder_describe_outputs \
|
|||
build:engine/dom-utils "/web/build/engine/dom-utils/obj/index.js" \
|
||||
build:engine/events "/web/build/engine/events/lib/index.mjs" \
|
||||
build:engine/element-wrappers "/web/build/engine/element-wrappers/lib/index.mjs" \
|
||||
build:engine/interfaces "/web/build/engine/interfaces/lib/index.mjs" \
|
||||
build:engine/js-processor "/web/build/engine/js-processor/lib/index.mjs" \
|
||||
build:engine/keyboard "/web/build/engine/keyboard/lib/index.mjs" \
|
||||
build:engine/keyboard-storage "/web/build/engine/keyboard-storage/lib/index.mjs" \
|
||||
build:engine/main "/web/build/engine/main/lib/index.mjs" \
|
||||
build:engine/osk "/web/build/engine/osk/lib/index.mjs" \
|
||||
build:engine/interfaces "/web/build/engine/interfaces/lib/index.mjs" \
|
||||
build:engine/predictive-text "/web/src/engine/predictive-text/worker-main/build/lib/web/index.mjs" \
|
||||
build:samples "/web/src/samples/simplest/keymanweb.js" \
|
||||
build:tools "/web/build/tools/building/sourcemap-root/index.js" \
|
||||
build:test-pages "/web/build/test-resources/sentry-manager.js"
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ SUBPROJECT_NAME=engine/main
|
|||
builder_describe "Builds the Keyman Engine for Web's common top-level base classes." \
|
||||
"@/common/web/keyman-version" \
|
||||
"@/web/src/engine/keyboard" \
|
||||
"@/common/predictive-text" \
|
||||
"@/web/src/engine/interfaces build" \
|
||||
"@/web/src/engine/device-detect build" \
|
||||
"@/web/src/engine/js-processor build" \
|
||||
"@/web/src/engine/keyboard-storage build" \
|
||||
"@/web/src/engine/osk build" \
|
||||
"@/web/src/engine/predictive-text/worker-main" \
|
||||
"@/developer/src/kmc-model test" \
|
||||
"clean" \
|
||||
"configure" \
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
## START STANDARD BUILD SCRIPT INCLUDE
|
||||
# adjust relative paths as necessary
|
||||
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
|
||||
. "${THIS_SCRIPT%/*}/../../resources/build/builder.inc.sh"
|
||||
. "${THIS_SCRIPT%/*}/../../../../../resources/build/builder.inc.sh"
|
||||
## END STANDARD BUILD SCRIPT INCLUDE
|
||||
|
||||
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
|
||||
|
|
@ -31,7 +31,7 @@ builder_describe "Builds the lm-layer module" \
|
|||
|
||||
builder_describe_outputs \
|
||||
configure /node_modules \
|
||||
build /common/predictive-text/build/lib/web/index.mjs # is built by the final step.
|
||||
build /web/src/engine/predictive-text/worker-main/build/lib/web/index.mjs # is built by the final step.
|
||||
|
||||
builder_parse "$@"
|
||||
|
||||
|
|
@ -48,8 +48,8 @@ function do_build() {
|
|||
tsc -b ./tsconfig.all.json
|
||||
|
||||
# esbuild-bundled products at this level are not intended to be used for anything but testing.
|
||||
$BUNDLE_CMD "${KEYMAN_ROOT}/common/predictive-text/build/obj/web/index.js" \
|
||||
--out "${KEYMAN_ROOT}/common/predictive-text/build/lib/web/index.mjs" \
|
||||
$BUNDLE_CMD "${KEYMAN_ROOT}/web/src/engine/predictive-text/worker-main/build/obj/web/index.js" \
|
||||
--out "${KEYMAN_ROOT}/web/src/engine/predictive-text/worker-main/build/lib/web/index.mjs" \
|
||||
--format esm
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": "../../../web/tsconfig.kmw-main-base.json",
|
||||
"extends": "../../../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
// The Worker class needs access to the `new` keyword, else Node will throw an
|
||||
// error when constructing the Worker for unit tests. ES6 is sufficient.
|
||||
23
web/src/engine/predictive-text/worker-main/src/tsconfig.json
Normal file
23
web/src/engine/predictive-text/worker-main/src/tsconfig.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"extends": "../../../../../tsconfig.base.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "../build/obj",
|
||||
"tsBuildInfoFile": "../build/obj/tsconfig.tsbuildinfo",
|
||||
"rootDir": "./"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../../../../../../common/web/utils" },
|
||||
{ "path": "../../../../../../common/models/types"},
|
||||
{ "path": "../../../../../../common/models/wordbreakers"},
|
||||
{ "path": "../../../../../../common/web/lm-message-types"},
|
||||
{ "path": "../../../../../../common/models/templates"}
|
||||
],
|
||||
"include" : [ "./*.ts" ],
|
||||
"exclude" : [
|
||||
"node",
|
||||
"web",
|
||||
"index.ts" // It's handled by the final layer.
|
||||
]
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"extends": "../../../web/tsconfig.kmw-main-base.json",
|
||||
"extends": "../../../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["es6", "DOM"],
|
||||
"baseUrl": "../",
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
// require separate sub-tsconfigs, both of which require common references. The multi-config
|
||||
// setup in this project and its subfolders ensure all modules can compile cleanly and in the
|
||||
// necessary compilation order.
|
||||
"extends": "../web/tsconfig.kmw-main-base.json",
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
},
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "../web/utils" },
|
||||
{ "path": "../models/types"},
|
||||
{ "path": "../models/wordbreakers"},
|
||||
{ "path": "../web/lm-message-types"},
|
||||
{ "path": "../models/templates"},
|
||||
{ "path": "../../../../../common/web/utils" },
|
||||
{ "path": "../../../../../common/models/types"},
|
||||
{ "path": "../../../../../common/models/wordbreakers"},
|
||||
{ "path": "../../../../../common/web/lm-message-types"},
|
||||
{ "path": "../../../../../common/models/templates"},
|
||||
{ "path": "src/node" },
|
||||
{ "path": "src/web" }
|
||||
],
|
||||
|
|
@ -7,7 +7,7 @@ import { dirname, resolve } from 'path';
|
|||
import { sessionStabilityReporter } from '@keymanapp/common-test-resources/test-runner-stability-reporter.mjs';
|
||||
|
||||
const dir = dirname(fileURLToPath(import.meta.url));
|
||||
const KEYMAN_ROOT = resolve(dir, '../../../../');
|
||||
const KEYMAN_ROOT = resolve(dir, '../../../../../../../');
|
||||
|
||||
/** @type {import('@web/test-runner').TestRunnerConfig} */
|
||||
export default {
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
## START STANDARD BUILD SCRIPT INCLUDE
|
||||
# adjust relative paths as necessary
|
||||
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
|
||||
. "${THIS_SCRIPT%/*}/../../../resources/build/build-utils.sh"
|
||||
. "${THIS_SCRIPT%/*}/../../../../../../resources/build/build-utils.sh"
|
||||
## END STANDARD BUILD SCRIPT INCLUDE
|
||||
|
||||
. "$KEYMAN_ROOT/resources/build/build-utils-ci.inc.sh"
|
||||
|
|
@ -9,10 +9,9 @@ Install
|
|||
**NOTE**: Requires Node >= 10.0
|
||||
|
||||
First, ensure that Keyman web and the LMLayer are built. You can run the
|
||||
build script in `/web/source` to do this for you:
|
||||
build script in `/web` to do this for you:
|
||||
|
||||
cd ../../../web/source
|
||||
./build.sh
|
||||
../../../../web/build.sh
|
||||
|
||||
Then, you can install locally with `npm`:
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ const {EventIterator} = require('event-iterator');
|
|||
const program = require('commander');
|
||||
|
||||
// Load the most recent LMLayer code locally.
|
||||
const LMLayer = require('../../predictive-text');
|
||||
const LMLayer = require('../../../engine/predictive-text/worker-main');
|
||||
|
||||
|
||||
///////////////////////////////// Constants /////////////////////////////////
|
||||
|
|
@ -331,7 +331,7 @@ async function asyncRepl(modelFile) {
|
|||
|
||||
function createAsyncWorker() {
|
||||
// XXX: import the LMLayerWorker directly -- I know where it is built.
|
||||
const LMLayerWorker = require('../../predictive-text/build/intermediate');
|
||||
const LMLayerWorker = require('../../../engine/predictive-text/build/intermediate');
|
||||
const vm = require('vm');
|
||||
|
||||
let worker = {
|
||||
Loading…
Add table
Reference in a new issue