Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(web): move lm-worker β†’ worker-thread πŸ—οΈ #12150

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions common/web/lm-worker/tsconfig.json

This file was deleted.

101 changes: 50 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-worker/" },
{ "path": "./common/web/recorder/tsconfig.json" },
{ "path": "./common/web/sentry-manager/src/tsconfig.json" },
{ "path": "./common/web/types/" },
Expand Down Expand Up @@ -43,6 +42,7 @@
{ "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/src/engine/predictive-text/worker-thread" },
// { "path": "./web/tools/recorder/tsconfig.json" },
// { "path": "./web/tools/sourcemap-root/tsconfig.json" },
]
Expand Down
2 changes: 1 addition & 1 deletion web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ graph TD;
Wordbreakers["@keymanapp/models-wordbreakers<br>(/common/models/wordbreakers)"];
Models["@keymanapp/models-templates<br>(/common/models/templates)"];
Models-->WebUtils;
LMWorker["@keymanapp/lm-worker<br>(/common/web/lm-worker)"];
LMWorker["@keymanapp/lm-worker<br>(/web/src/engine/predictive-text/worker-thread)"];
LMWorker-->Models;
LMWorker-->Wordbreakers;
LMLayer["@keymanapp/lexical-model-layer<br>(/web/src/engine/predictive-text/worker-main)"];
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/browser/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ compile_and_copy() {
local PROFILE_DEST="$KEYMAN_ROOT/web/build/profiling/"
mkdir -p "$PROFILE_DEST"
cp "${BUILD_ROOT}/filesize-profile.log" "$PROFILE_DEST/web-engine-filesize.log"
cp "$KEYMAN_ROOT/common/web/lm-worker/build/filesize-profile.log" "$PROFILE_DEST/lm-worker-filesize.log"
cp "$KEYMAN_ROOT/web/src/engine/predictive-text/worker-thread/build/filesize-profile.log" "$PROFILE_DEST/lm-worker-filesize.log"
}

builder_run_action configure verify_npm_setup
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/predictive-text/worker-main/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ BUNDLE_CMD="node $KEYMAN_ROOT/common/web/es-bundling/build/common-bundle.mjs"
builder_describe "Builds the lm-layer module" \
"@/common/web/keyman-version" \
"@/common/web/es-bundling" \
"@/common/web/lm-worker" \
"@/web/src/engine/predictive-text/worker-thread" \
"clean" \
"configure" \
"build" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ if builder_start_action test:libraries; then
"$KEYMAN_ROOT/common/models/templates/build.sh" test $TEST_OPTS
popd

pushd "$KEYMAN_ROOT/common/web/lm-worker"
pushd "$KEYMAN_ROOT/web/src/engine/predictive-text/worker-thread"
echo
echo "### Running ${BUILDER_TERM_START}common/web/lm-worker${BUILDER_TERM_END} tests"
echo "### Running ${BUILDER_TERM_START}web/src/engine/predictive-text/worker-thread${BUILDER_TERM_END} tests"
./build.sh test $TEST_OPTS
popd

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ let fullWorkerConcatenation = concatScriptsAndSourcemaps(sourceFileSet, destFile
// New stage: cleaning the sourcemaps

// Sources are being passed into the sourcemap concatenator via our working directory.
let sourceRoot = '@keymanapp/keyman/common/web/lm-worker/';
let sourceRoot = '@keymanapp/keyman/web/src/engine/predictive-text/worker-thread/';
fullWorkerConcatenation.sourcemapJSON.sourceRoot = sourceRoot;

// End "cleaning the sourcemaps"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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"
Expand All @@ -17,7 +17,7 @@ WORKER_OUTPUT_FILENAME=build/lib/worker-main.js
INTERMEDIATE=./build/intermediate
LIB=./build/lib

bundle_cmd="node ../es-bundling/build/common-bundle.mjs"
bundle_cmd="node ${KEYMAN_ROOT}/common/web/es-bundling/build/common-bundle.mjs"

SRCMAP_CLEANER="node $KEYMAN_ROOT/web/build/tools/building/sourcemap-root/index.js"

Expand All @@ -34,7 +34,7 @@ builder_describe \

builder_describe_outputs \
configure /node_modules \
build /common/web/lm-worker/$LIB/worker-main.wrapped.min.js
build "/web/src/engine/predictive-text/worker-thread/${LIB}/worker-main.wrapped.min.js"

builder_parse "$@"

Expand Down Expand Up @@ -65,7 +65,7 @@ function do_build() {
$bundle_cmd src/main/worker-main.ts \
--out $INTERMEDIATE/worker-main.js \
--target "es6" \
--sourceRoot '@keymanapp/keyman/common/web/lm-worker/src/main'
--sourceRoot '@keymanapp/keyman/web/src/engine/predictive-text/worker-thread/src/main'

$SRCMAP_CLEANER \
$INTERMEDIATE/worker-main.js.map \
Expand All @@ -77,7 +77,7 @@ function do_build() {
--minify \
--profile build/filesize-profile.log \
--target "es6" \
--sourceRoot '@keymanapp/keyman/common/web/lm-worker/src/main'
--sourceRoot '@keymanapp/keyman/web/src/engine/predictive-text/worker-thread/src/main'

$SRCMAP_CLEANER \
$INTERMEDIATE/worker-main.min.js.map \
Expand Down
32 changes: 32 additions & 0 deletions web/src/engine/predictive-text/worker-thread/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"extends": "../../../../tsconfig.base.json",

"compilerOptions": {
"baseUrl": "./",
"outDir": "build/obj",
"tsBuildInfoFile": "build/obj/tsconfig.tsbuildinfo",
"rootDir": "./src/main",
// To help better support legacy Android devices
"downlevelIteration": true,
// Facilitates & simplifies stitching together the worker sourcemaps during the polyfill-concatenation step.
"inlineSourceMap": true,
// May not be set at the same time as the prior setting.
"sourceMap": false,

// As this one is the one that directly interfaces with the worker (from the inside)
"lib": ["webworker", "es6"],
},
"references": [
// types
{ "path": "../../../../../common/models/types" },
{ "path": "../types" },
// modules
{ "path": "../../../../../common/web/keyman-version" },
{ "path": "../../../../../common/web/utils" },
{ "path": "../../../../../common/models/templates" },
{ "path": "../../../../../common/models/wordbreakers" },
],
"include": [
"src/main/**/*.ts"
]
}
Loading