diff --git a/common/web/build.sh b/common/web/build.sh index 554b1e8ebb..fbc015613f 100755 --- a/common/web/build.sh +++ b/common/web/build.sh @@ -10,7 +10,6 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" # # TODO: future modules may include -# :lm-message-types \ # :sentry-manager \ # diff --git a/common/web/lm-message-types/tsconfig.json b/common/web/lm-message-types/tsconfig.json deleted file mode 100644 index 559b764980..0000000000 --- a/common/web/lm-message-types/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "outDir": "build/", - "sourceMap": true, - "lib": ["es6"], - "target": "es6" - }, - "include": ["./*.ts"], - "exclude": ["test.ts"] -} diff --git a/common/web/lm-worker/tsconfig.json b/common/web/lm-worker/tsconfig.json index f439e96940..95b403c768 100644 --- a/common/web/lm-worker/tsconfig.json +++ b/common/web/lm-worker/tsconfig.json @@ -13,7 +13,7 @@ "references": [ // types { "path": "../../models/types" }, - { "path": "../lm-message-types" }, + { "path": "../../../web/src/engine/predictive-text/types" }, // modules { "path": "../keyman-version" }, { "path": "../utils" }, diff --git a/package-lock.json b/package-lock.json index ad53581202..99a3d2f934 100644 --- a/package-lock.json +++ b/package-lock.json @@ -198,7 +198,7 @@ "typescript": "^5.4.5" } }, - "common/web/lm-message-types": { + "web/src/engine/predictive-text/types": { "name": "@keymanapp/lm-message-types", "license": "MIT", "devDependencies": { @@ -2896,7 +2896,7 @@ "link": true }, "node_modules/@keymanapp/lm-message-types": { - "resolved": "common/web/lm-message-types", + "resolved": "web/src/engine/predictive-text/types", "link": true }, "node_modules/@keymanapp/lm-worker": { diff --git a/tsconfig.base.json b/tsconfig.base.json index c4e0599eef..7f69376372 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -31,7 +31,7 @@ "@keymanapp/models-templates": ["./common/models/templates"], "@keymanapp/models-wordbreakers": ["./common/models/wordbreakers"], "@keymanapp/web-utils": ["./common/web/utils"], - "@keymanapp/lm-message-types": ["./common/web/lm-message-types"], + "@keymanapp/lm-message-types": ["./web/src/engine/predictive-text/types"], "@keymanapp/keyman-version": ["./common/web/keyman-version"], "@keymanapp/ldml-keyboard-constants": [ "./core/include/ldml" ], } diff --git a/tsconfig.json b/tsconfig.json index 42b3fd1a99..252fd738dc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,6 @@ { "path": "./common/web/gesture-recognizer/tsconfig.json" }, { "path": "./common/web/gesture-recognizer/src/tools/unit-test-resources/tsconfig.json" }, { "path": "./common/web/keyman-version" }, - { "path": "./common/web/lm-message-types/" }, { "path": "./common/web/lm-worker/" }, { "path": "./common/web/recorder/tsconfig.json" }, { "path": "./common/web/sentry-manager/src/tsconfig.json" }, @@ -42,6 +41,7 @@ { "path": "./resources/build/version/" }, { "path": "./web/src/tsconfig.all.json" }, + { "path": "./web/src/engine/predictive-text/types/" }, { "path": "./web/src/engine/predictive-text/worker-main/tsconfig.all.json" }, // { "path": "./web/tools/recorder/tsconfig.json" }, // { "path": "./web/tools/sourcemap-root/tsconfig.json" }, diff --git a/common/web/lm-message-types/message.d.ts b/web/src/engine/predictive-text/types/message.d.ts similarity index 100% rename from common/web/lm-message-types/message.d.ts rename to web/src/engine/predictive-text/types/message.d.ts diff --git a/common/web/lm-message-types/package.json b/web/src/engine/predictive-text/types/package.json similarity index 100% rename from common/web/lm-message-types/package.json rename to web/src/engine/predictive-text/types/package.json diff --git a/web/src/engine/predictive-text/types/tsconfig.json b/web/src/engine/predictive-text/types/tsconfig.json new file mode 100644 index 0000000000..8b87ca2667 --- /dev/null +++ b/web/src/engine/predictive-text/types/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "baseUrl": "./", + "outDir": "build/", + "tsBuildInfoFile": "build/tsconfig.tsbuildinfo", + "rootDir": "./src" + }, + "include": ["./*.ts"], + "exclude": ["test.ts"] +} diff --git a/web/src/engine/predictive-text/worker-main/src/tsconfig.json b/web/src/engine/predictive-text/worker-main/src/tsconfig.json index 9c7a1f47ee..edf6195b3a 100644 --- a/web/src/engine/predictive-text/worker-main/src/tsconfig.json +++ b/web/src/engine/predictive-text/worker-main/src/tsconfig.json @@ -10,7 +10,7 @@ "references": [ { "path": "../../../../../../common/web/utils" }, { "path": "../../../../../../common/models/types"}, - { "path": "../../../../../../common/web/lm-message-types"} + { "path": "../../types"} ], "include" : [ "./*.ts" ], "exclude" : [ diff --git a/web/src/engine/predictive-text/worker-main/tsconfig.all.json b/web/src/engine/predictive-text/worker-main/tsconfig.all.json index f86c081542..722ce0114b 100644 --- a/web/src/engine/predictive-text/worker-main/tsconfig.all.json +++ b/web/src/engine/predictive-text/worker-main/tsconfig.all.json @@ -15,7 +15,7 @@ "references": [ { "path": "../../../../../common/web/utils" }, { "path": "../../../../../common/models/types"}, - { "path": "../../../../../common/web/lm-message-types"}, + { "path": "../types"}, { "path": "src/node" }, { "path": "src/web" } ], diff --git a/web/src/test/manual/predictive-text/index.js b/web/src/test/manual/predictive-text/index.mjs similarity index 96% rename from web/src/test/manual/predictive-text/index.js rename to web/src/test/manual/predictive-text/index.mjs index 605ed2939c..33398a6957 100755 --- a/web/src/test/manual/predictive-text/index.js +++ b/web/src/test/manual/predictive-text/index.mjs @@ -5,16 +5,17 @@ * model. */ -const fs = require('fs'); -const path = require('path'); -const readline = require('readline'); +import fs from 'fs'; +import path from 'path'; +import readline from 'readline'; +import vm from 'vm'; -const {EventIterator} = require('event-iterator'); -const program = require('commander'); +import {EventIterator} from 'event-iterator'; +import program from 'commander'; // Load the most recent LMLayer code locally. -const LMLayer = require('../../../engine/predictive-text/worker-main'); - +import { LMLayer } from 'keyman/engine/predictive-text/worker-main'; +import { LMLayerWorker } from '@keymanapp/lm-worker'; ///////////////////////////////// Constants ///////////////////////////////// @@ -22,7 +23,7 @@ const WORKER_DEBUG = false; const EXIT_USAGE = 1; /** "Control sequence introducer" for ANSI escape codes: */ -const CSI = '\033['; +const CSI = '\u001b['; /** * ANSI escape codes to deal with the screen and the cursor. * See https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_sequences @@ -47,8 +48,7 @@ main(); function main() { // Command line options: program - .name(require('./package.json').name) - .version(require('./package.json').version) + .name('lmlayer-cli') .usage('[-i | -p [-p ...]] (-f | )') .description('CLI for trying lexical models.') .arguments('[model-id]') @@ -330,9 +330,6 @@ async function asyncRepl(modelFile) { function createAsyncWorker() { - // XXX: import the LMLayerWorker directly -- I know where it is built. - const LMLayerWorker = require('../../../engine/predictive-text/build/intermediate'); - const vm = require('vm'); let worker = { postMessage(message) { diff --git a/web/src/tools/testing/recorder-core/tsconfig.json b/web/src/tools/testing/recorder-core/tsconfig.json index 920536eeee..01e1431945 100644 --- a/web/src/tools/testing/recorder-core/tsconfig.json +++ b/web/src/tools/testing/recorder-core/tsconfig.json @@ -16,7 +16,7 @@ "references": [ { "path": "../../../../../common/web/keyman-version" }, { "path": "../../../../../common/web/utils/" }, - { "path": "../../../../../common/web/lm-message-types" }, + { "path": "../../../engine/predictive-text/types" }, { "path": "../../../engine/js-processor" }, { "path": "../../../engine/keyboard" }, ], diff --git a/web/src/tools/testing/recorder/tsconfig.json b/web/src/tools/testing/recorder/tsconfig.json index f5974b5738..e25a4f6034 100644 --- a/web/src/tools/testing/recorder/tsconfig.json +++ b/web/src/tools/testing/recorder/tsconfig.json @@ -12,8 +12,8 @@ "references": [ { "path": "../../../../../common/web/keyman-version" }, { "path": "../../../../../common/web/utils" }, - { "path": "../../../../../common/web/lm-message-types" }, - { "path": "../../../../../web/src/app/browser" }, + { "path": "../../../engine/predictive-text/types" }, + { "path": "../../../app/browser" }, { "path": "../recorder-core" }, { "path": "../../../engine/keyboard" }, ]