mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 08:37:42 +00:00
Merge pull request #12149 from keymanapp/refactor/web/12147_types
refactor(web): move `lm-message-types` → `predictive-text/types` 🏗️
This commit is contained in:
commit
d2662ffef8
14 changed files with 31 additions and 36 deletions
|
|
@ -10,7 +10,6 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
|
|||
|
||||
#
|
||||
# TODO: future modules may include
|
||||
# :lm-message-types \
|
||||
# :sentry-manager \
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"outDir": "build/",
|
||||
"sourceMap": true,
|
||||
"lib": ["es6"],
|
||||
"target": "es6"
|
||||
},
|
||||
"include": ["./*.ts"],
|
||||
"exclude": ["test.ts"]
|
||||
}
|
||||
|
|
@ -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" },
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -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" ],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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" },
|
||||
|
|
|
|||
11
web/src/engine/predictive-text/types/tsconfig.json
Normal file
11
web/src/engine/predictive-text/types/tsconfig.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "build/",
|
||||
"tsBuildInfoFile": "build/tsconfig.tsbuildinfo",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["./*.ts"],
|
||||
"exclude": ["test.ts"]
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"references": [
|
||||
{ "path": "../../../../../../common/web/utils" },
|
||||
{ "path": "../../../../../../common/models/types"},
|
||||
{ "path": "../../../../../../common/web/lm-message-types"}
|
||||
{ "path": "../../types"}
|
||||
],
|
||||
"include" : [ "./*.ts" ],
|
||||
"exclude" : [
|
||||
|
|
|
|||
|
|
@ -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" }
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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 <test-file> | -p <phrase> [-p <phrase> ...]] (-f <model-file> | <model-id>)')
|
||||
.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) {
|
||||
|
|
@ -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" },
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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" },
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue