refactor(web): move sentry-manager and es-bundling to common

sentry-manager is used by Keyman Engine for Android and Keyman Engine
for iOS, but not directly by KeymanWeb, nor does it have any
dependencies on /web. So it does not make sense to keep it under /web.

es-bundling is used by sentry-manager and potentially other /common/web
tools in the future, so moving it under /common/tools makes it more
consistent in the future.

This is part of simplifying the web source tree; these changes do not
make significant build performance differences at this time.

Test-bot: skip
This commit is contained in:
Marc Durdin 2025-11-06 15:20:00 +01:00
parent 2e51955055
commit 86a903dcf5
43 changed files with 143 additions and 222 deletions

View file

@ -23,7 +23,7 @@ JUNIT_RESULTS="##teamcity[importData type='junit' path='keyman\android\KMEA\app\
builder_describe "Builds Keyman Engine for Android." \
"@/web/src/app/webview" \
"@/web/src/engine/sentry-manager" \
"@/common/web/sentry-manager" \
"clean" \
"configure" \
"build" \
@ -81,7 +81,7 @@ if builder_start_action build:engine; then
cp "$KEYMAN_WEB_ROOT/build/app/resources/osk/kmwosk.css" "$ENGINE_ASSETS/kmwosk.css"
cp "$KEYMAN_WEB_ROOT/build/app/resources/osk/globe-hint.css" "$ENGINE_ASSETS/globe-hint.css"
cp "$KEYMAN_WEB_ROOT/build/app/resources/osk/keymanweb-osk.ttf" "$ENGINE_ASSETS/keymanweb-osk.ttf"
cp "$KEYMAN_ROOT/web/src/engine/sentry-manager/build/lib/index.js" "$ENGINE_ASSETS/keyman-sentry.js"
cp "$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js" "$ENGINE_ASSETS/keyman-sentry.js"
echo "Copying es6-shim polyfill"
cp "$KEYMAN_ROOT/node_modules/es6-shim/es6-shim.min.js" "$ENGINE_ASSETS/es6-shim.min.js"

1
common/tools/es-bundling/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/*

View file

@ -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/builder-full.inc.sh"
. "${THIS_SCRIPT%/*}/../../../resources/build/builder-full.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE
. "$KEYMAN_ROOT/resources/build/utils.inc.sh"
@ -11,17 +11,17 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
################################ Main script ################################
builder_describe "Builds KMW's esbuild-oriented common configuration & tooling" \
builder_describe "esbuild style bundling tooling for web and common/web" \
"clean" \
"configure" \
"build"
builder_describe_outputs \
configure /node_modules \
build /web/src/tools/es-bundling/build/index.mjs
build /common/tools/es-bundling/build/index.mjs
builder_parse "$@"
builder_run_action configure node_select_version_and_npm_ci
builder_run_action clean rm -rf build/
builder_run_action build tsc -b tsconfig.json
builder_run_action build tsc -b

View file

@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.base.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"outDir": "build/",

View file

@ -0,0 +1,35 @@
#!/usr/bin/env bash
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../resources/build/builder-full.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE
. "${KEYMAN_ROOT}/resources/build/utils.inc.sh"
. "${KEYMAN_ROOT}/resources/build/node.inc.sh"
builder_describe "Sentry error reporting module for embedded Keyman Engine for Web" \
"@/common/tools/es-bundling" \
"@/common/web/keyman-version" \
clean configure build
builder_describe_outputs \
configure /node_modules \
build /common/web/sentry-manager/build/lib/index.js
builder_parse "$@"
# ---------------------------------------------------------------------------------
function do_build() {
tsc --build "./tsconfig.json"
node_es_bundle "${KEYMAN_ROOT}/common/web/sentry-manager/build/obj/src/index.js" \
--out "${KEYMAN_ROOT}/common/web/sentry-manager/build/lib/index.js" \
--sourceRoot "@keymanapp/keyman/common/web/sentry-manager/build/lib/"
}
builder_run_action clean rm -rf build/
builder_run_action configure node_select_version_and_npm_ci
builder_run_action build do_build

View file

@ -0,0 +1,14 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./",
"lib": ["es6", "dom"],
"outDir": "./build/obj",
"rootDir": "./",
"tsBuildInfoFile": "./build/obj/tsconfig.tsbuildinfo",
},
"include": [
"src/*.ts"
]
}

View file

@ -12,7 +12,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
builder_describe "Builds Keyman Engine for use on iOS devices - iPhone and iPad." \
"@/web/src/app/webview build" \
"@/web/src/engine/sentry-manager build" \
"@/common/web/sentry-manager build" \
"clean" \
"configure" \
"build" \
@ -106,7 +106,7 @@ function update_bundle ( ) {
cp "$KMW_RESOURCES/osk/kmwosk.css" "$BUNDLE_PATH/kmwosk.css"
cp "$KMW_RESOURCES/osk/keymanweb-osk.ttf" "$BUNDLE_PATH/keymanweb-osk.ttf"
cp "$KMW_PRODUCT/keymanweb-webview.js" "$BUNDLE_PATH/keymanweb-webview.js"
cp "$KEYMAN_ROOT/web/src/engine/sentry-manager/build/lib/index.js" "$BUNDLE_PATH/keyman-sentry.js"
cp "$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js" "$BUNDLE_PATH/keyman-sentry.js"
}
# First things first - update our dependencies.

111
package-lock.json generated
View file

@ -27,6 +27,7 @@
"common/test/resources",
"common/web/keyman-version",
"common/web/langtags",
"common/web/sentry-manager",
"common/web/types",
"common/tools/sourcemap-path-remapper",
"common/tools/hextobin",
@ -139,6 +140,16 @@
"typescript": "^5.4.5"
}
},
"common/web/sentry-manager": {
"license": "MIT",
"dependencies": {
"@keymanapp/keyman-version": "*",
"@sentry/browser": "^8.55.0"
},
"devDependencies": {
"typescript": "^5.4.5"
}
},
"common/web/types": {
"name": "@keymanapp/common-types",
"license": "MIT",
@ -1766,7 +1777,7 @@
"link": true
},
"node_modules/@keymanapp/web-sentry-manager": {
"resolved": "web/src/engine/sentry-manager",
"resolved": "common/web/sentry-manager",
"link": true
},
"node_modules/@mdn/browser-compat-data": {
@ -2901,7 +2912,6 @@
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.55.0.tgz",
"integrity": "sha512-ROgqtQfpH/82AQIpESPqPQe0UyWywKJsmVIqi3c5Fh+zkds5LUxnssTj3yNd1x+kxaPDVB023jAP+3ibNgeNDw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@sentry/core": "8.55.0"
@ -2910,21 +2920,10 @@
"node": ">=14.18"
}
},
"node_modules/@sentry-internal/browser-utils/node_modules/@sentry/core": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.55.0.tgz",
"integrity": "sha512-6g7jpbefjHYs821Z+EBJ8r4Z7LT5h80YSWRJaylGS4nW5W5Z2KXzpdnyFarv37O7QjauzVC2E+PABmpkw5/JGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.18"
}
},
"node_modules/@sentry-internal/feedback": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.55.0.tgz",
"integrity": "sha512-cP3BD/Q6pquVQ+YL+rwCnorKuTXiS9KXW8HNKu4nmmBAyf7urjs+F6Hr1k9MXP5yQ8W3yK7jRWd09Yu6DHWOiw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@sentry/core": "8.55.0"
@ -2933,21 +2932,10 @@
"node": ">=14.18"
}
},
"node_modules/@sentry-internal/feedback/node_modules/@sentry/core": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.55.0.tgz",
"integrity": "sha512-6g7jpbefjHYs821Z+EBJ8r4Z7LT5h80YSWRJaylGS4nW5W5Z2KXzpdnyFarv37O7QjauzVC2E+PABmpkw5/JGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.18"
}
},
"node_modules/@sentry-internal/replay": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.55.0.tgz",
"integrity": "sha512-roCDEGkORwolxBn8xAKedybY+Jlefq3xYmgN2fr3BTnsXjSYOPC7D1/mYqINBat99nDtvgFvNfRcZPiwwZ1hSw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@sentry-internal/browser-utils": "8.55.0",
@ -2961,7 +2949,6 @@
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.55.0.tgz",
"integrity": "sha512-nIkfgRWk1091zHdu4NbocQsxZF1rv1f7bbp3tTIlZYbrH62XVZosx5iHAuZG0Zc48AETLE7K4AX9VGjvQj8i9w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@sentry-internal/replay": "8.55.0",
@ -2971,26 +2958,6 @@
"node": ">=14.18"
}
},
"node_modules/@sentry-internal/replay-canvas/node_modules/@sentry/core": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.55.0.tgz",
"integrity": "sha512-6g7jpbefjHYs821Z+EBJ8r4Z7LT5h80YSWRJaylGS4nW5W5Z2KXzpdnyFarv37O7QjauzVC2E+PABmpkw5/JGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.18"
}
},
"node_modules/@sentry-internal/replay/node_modules/@sentry/core": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.55.0.tgz",
"integrity": "sha512-6g7jpbefjHYs821Z+EBJ8r4Z7LT5h80YSWRJaylGS4nW5W5Z2KXzpdnyFarv37O7QjauzVC2E+PABmpkw5/JGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.18"
}
},
"node_modules/@sentry-internal/tracing": {
"version": "7.108.0",
"resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.108.0.tgz",
@ -3035,6 +3002,22 @@
"node": ">=8"
}
},
"node_modules/@sentry/browser": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.55.0.tgz",
"integrity": "sha512-1A31mCEWCjaMxJt6qGUK+aDnLDcK6AwLAZnqpSchNysGni1pSn1RWSmk9TBF8qyTds5FH8B31H480uxMPUJ7Cw==",
"license": "MIT",
"dependencies": {
"@sentry-internal/browser-utils": "8.55.0",
"@sentry-internal/feedback": "8.55.0",
"@sentry-internal/replay": "8.55.0",
"@sentry-internal/replay-canvas": "8.55.0",
"@sentry/core": "8.55.0"
},
"engines": {
"node": ">=14.18"
}
},
"node_modules/@sentry/cli": {
"version": "2.31.0",
"resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.31.0.tgz",
@ -3179,6 +3162,15 @@
"node": ">=10"
}
},
"node_modules/@sentry/core": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.55.0.tgz",
"integrity": "sha512-6g7jpbefjHYs821Z+EBJ8r4Z7LT5h80YSWRJaylGS4nW5W5Z2KXzpdnyFarv37O7QjauzVC2E+PABmpkw5/JGA==",
"license": "MIT",
"engines": {
"node": ">=14.18"
}
},
"node_modules/@sentry/node": {
"version": "7.108.0",
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.108.0.tgz",
@ -14180,33 +14172,6 @@
"tsx": "^4.19.0"
}
},
"web/node_modules/@sentry/browser": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.55.0.tgz",
"integrity": "sha512-1A31mCEWCjaMxJt6qGUK+aDnLDcK6AwLAZnqpSchNysGni1pSn1RWSmk9TBF8qyTds5FH8B31H480uxMPUJ7Cw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@sentry-internal/browser-utils": "8.55.0",
"@sentry-internal/feedback": "8.55.0",
"@sentry-internal/replay": "8.55.0",
"@sentry-internal/replay-canvas": "8.55.0",
"@sentry/core": "8.55.0"
},
"engines": {
"node": ">=14.18"
}
},
"web/node_modules/@sentry/core": {
"version": "8.55.0",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.55.0.tgz",
"integrity": "sha512-6g7jpbefjHYs821Z+EBJ8r4Z7LT5h80YSWRJaylGS4nW5W5Z2KXzpdnyFarv37O7QjauzVC2E+PABmpkw5/JGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.18"
}
},
"web/src/common/web-utils": {
"name": "@keymanapp/web-utils",
"extraneous": true,
@ -14315,7 +14280,7 @@
},
"web/src/engine/sentry-manager": {
"name": "@keymanapp/web-sentry-manager",
"dev": true,
"extraneous": true,
"license": "MIT",
"dependencies": {
"@keymanapp/keyman-version": "*",

View file

@ -51,6 +51,7 @@
"common/test/resources",
"common/web/keyman-version",
"common/web/langtags",
"common/web/sentry-manager",
"common/web/types",
"common/tools/sourcemap-path-remapper",
"common/tools/hextobin",

View file

@ -77,3 +77,7 @@ _node_select_version_with_nvm() {
builder_die "Attempted to select node.js version $REQUIRED_NODE_VERSION but found $CURRENT_NODE_VERSION instead"
fi
}
node_es_bundle() {
node "${KEYMAN_ROOT}/common/tools/es-bundling/build/common-bundle.mjs" "$@"
}

View file

@ -4,6 +4,7 @@
{ "path": "./common/tools/hextobin/" },
{ "path": "./common/web/sentry-manager" },
{ "path": "./common/web/keyman-version" },
{ "path": "./common/web/langtags" },
{ "path": "./common/web/types" },

View file

@ -9,12 +9,14 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
## END STANDARD BUILD SCRIPT INCLUDE
. "$KEYMAN_ROOT/resources/build/utils.inc.sh"
. "$KEYMAN_ROOT/resources/build/node.inc.sh"
# ################################ Main script ################################
builder_set_child_base src
builder_describe "Builds engine modules for Keyman Engine for Web (KMW)." \
\
"@/common/tools/es-bundling" \
"@/resources/tools/check-markdown test:help" \
\
"clean" \
@ -58,8 +60,6 @@ builder_describe_outputs \
build:tools "/web/build/tools/building/sourcemap-root/index.js" \
build:test-pages "/web/build/test-resources/sentry-manager.js"
BUNDLE_CMD="node ${KEYMAN_ROOT}/web/src/tools/es-bundling/build/common-bundle.mjs"
#### Build action definitions ####
# We can run all clean & configure actions at once without much issue.
@ -84,7 +84,7 @@ precompile() {
# types built-in to Node aren't available, and @web/test-runner doesn't do
# treeshaking when loading the imports. We work around by pre-compiling.
for f in "${DIR}"/*.js; do
${BUNDLE_CMD} "${f}" \
node_es_bundle "${f}" \
--out "${f%.js}".mjs \
--format esm
done

View file

@ -24,6 +24,7 @@ cd "${THIS_SCRIPT_PATH}"
S_KEYMAN_COM=
builder_describe "CI processes for Keyman Engine for Web releases (KMW)." \
"@/common/web/sentry-manager" \
"@/web/src/tools/building/sourcemap-root prepare:s.keyman.com" \
"build" \
"test Runs all unit tests" \
@ -69,10 +70,10 @@ function build_action() {
if builder_is_ci_build && builder_is_ci_build_level_release; then
# Upload the sentry-configuration engine used by the mobile apps to sentry
# Also, clean 'em first.
for sourcemap in "${KEYMAN_ROOT}/web/src/engine/sentry-manager/build/lib/"*.map; do
for sourcemap in "${KEYMAN_ROOT}/common/web/sentry-manager/build/lib/"*.map; do
node "${KEYMAN_ROOT}/web/build/tools/building/sourcemap-root/index.js" null "${sourcemap}" --clean
done
web_sentry_upload "${KEYMAN_ROOT}/web/src/engine/sentry-manager/build/lib/"
web_sentry_upload "${KEYMAN_ROOT}/common/web/sentry-manager/build/lib/"
# And, of course, the main build-products too
web_sentry_upload "${KEYMAN_ROOT}/web/build/app/webview/release/"

View file

@ -1,8 +1,6 @@
#!/usr/bin/env bash
#
BUNDLE_CMD="node $KEYMAN_ROOT/web/src/tools/es-bundling/build/common-bundle.mjs"
# Compiles all build products corresponding to the specified target.
# This should be called from the working directory of a child project's
# build script.

View file

@ -14,6 +14,7 @@ SUBPROJECT_NAME=app/browser
# ################################ Main script ################################
builder_describe "Builds the Keyman Engine for Web's website-integrating version for use in non-puppeted browsers." \
"@/common/tools/es-bundling" \
"@/web/src/engine build" \
"@/web/src/tools/building/sourcemap-root" \
"clean" \
@ -48,13 +49,13 @@ compile_and_copy() {
BUILD_ROOT="${KEYMAN_ROOT}/web/build/app/browser"
SRC_ROOT="${KEYMAN_ROOT}/web/src/app/browser/src"
$BUNDLE_CMD "${SRC_ROOT}/debug-main.js" \
node_es_bundle "${SRC_ROOT}/debug-main.js" \
--out "${BUILD_ROOT}/debug/keymanweb.js" \
--charset "utf8" \
--sourceRoot "@keymanapp/keyman/web/build/app/browser/debug" \
--target "es6"
$BUNDLE_CMD "${SRC_ROOT}/release-main.js" \
node_es_bundle "${SRC_ROOT}/release-main.js" \
--out "${BUILD_ROOT}/release/keymanweb.js" \
--charset "utf8" \
--profile "${BUILD_ROOT}/filesize-profile.log" \
@ -62,7 +63,7 @@ compile_and_copy() {
--minify \
--target "es6"
$BUNDLE_CMD "${BUILD_ROOT}/obj/test-index.js" \
node_es_bundle "${BUILD_ROOT}/obj/test-index.js" \
--out "${BUILD_ROOT}/lib/index.mjs" \
--charset "utf8" \
--sourceRoot "@keymanapp/keyman/web/build/app/browser/lib" \

View file

@ -48,14 +48,14 @@ compile_and_copy() {
BUILD_ROOT="${KEYMAN_ROOT}/web/build/app/ui"
types=(button float toggle toolbar)
for type in ${types[@]}
for type in "${types[@]}"
do
filename="kmwui${type}"
$BUNDLE_CMD "${BUILD_ROOT}/obj/$filename.js" \
node_es_bundle "${BUILD_ROOT}/obj/$filename.js" \
--out "${BUILD_ROOT}/debug/$filename.js" \
--sourceRoot "@keymanapp/keyman/web/build/app/ui/debug"
$BUNDLE_CMD "${BUILD_ROOT}/obj/$filename.js" \
node_es_bundle "${BUILD_ROOT}/obj/$filename.js" \
--out "${BUILD_ROOT}/release/$filename.js" \
--sourceRoot "@keymanapp/keyman/web/build/app/ui/release" \
--minify

View file

@ -14,6 +14,7 @@ SUBPROJECT_NAME=app/webview
# ################################ Main script ################################
builder_describe "Builds the Keyman Engine for Web's puppetable version designed for use within WebViews." \
"@/common/tools/es-bundling" \
"@/web/src/engine build" \
"@/web/src/tools/building/sourcemap-root" \
"clean" \
@ -43,13 +44,13 @@ compile_and_copy() {
BUILD_ROOT="${KEYMAN_ROOT}/web/build/app/webview"
SRC_ROOT="${KEYMAN_ROOT}/web/src/app/webview/src"
$BUNDLE_CMD "${SRC_ROOT}/debug-main.js" \
node_es_bundle "${SRC_ROOT}/debug-main.js" \
--out "${BUILD_ROOT}/debug/keymanweb-webview.js" \
--charset "utf8" \
--sourceRoot "@keymanapp/keyman/web/build/app/webview/debug" \
--target "es6"
$BUNDLE_CMD "${SRC_ROOT}/release-main.js" \
node_es_bundle "${SRC_ROOT}/release-main.js" \
--out "${BUILD_ROOT}/release/keymanweb-webview.js" \
--charset "utf8" \
--profile "${BUILD_ROOT}/filesize-profile.log" \

View file

@ -6,7 +6,7 @@
*/
import esbuild from 'esbuild';
import { iifeConfiguration, prepareTslibTreeshaking } from '../../tools/es-bundling/build/index.mjs';
import { iifeConfiguration, prepareTslibTreeshaking } from '../../../../common/tools/es-bundling/build/index.mjs';
const commonConfig = {
...iifeConfiguration,

View file

@ -15,15 +15,13 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
SUBPROJECT_NAME=common/web-utils
BUILD_DIR="/web/build/common/web-utils"
BUNDLE_CMD="node ${KEYMAN_ROOT}/web/src/tools/es-bundling/build/common-bundle.mjs"
################################ Main script ################################
builder_describe \
"Compiles the web-oriented utility function module." \
"@/common/tools/es-bundling" \
"@/common/web/keyman-version" \
"@/common/web/types" \
"@/web/src/tools/es-bundling" \
clean configure build test
builder_describe_outputs \
@ -41,7 +39,7 @@ function do_build() {
# One of the functions (timedPromise) is quite helpful for automated testing, even in the DOM.
# So, to make sure it's easily-accessible for the DOM-based tests...
${BUNDLE_CMD} "${KEYMAN_ROOT}/${BUILD_DIR}/obj/index.js" \
node_es_bundle "${KEYMAN_ROOT}/${BUILD_DIR}/obj/index.js" \
--out "${KEYMAN_ROOT}/${BUILD_DIR}/lib/index.mjs" \
--format esm
}

View file

@ -16,6 +16,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
builder_describe "Builds Keyman Engine for Web (KMW)" \
"@/core:wasm" \
"@/common/tools/es-bundling" \
"@/web/src/engine/predictive-text" \
"@/web/src/common/web-utils" \
"clean" \
@ -57,9 +58,8 @@ do_build () {
# So... tsc does declaration-bundling on its own pretty well, at least for local development.
tsc --emitDeclarationOnly --outFile "${KEYMAN_ROOT}/web/build/engine/lib/index.d.ts" -p "."
node "${KEYMAN_ROOT}/web/src/tools/es-bundling/build/common-bundle.mjs" \
"${KEYMAN_ROOT}/web/build/engine/obj/index.js" \
--out "${KEYMAN_ROOT}/web/build/engine/lib/index.mjs" \
node_es_bundle "${KEYMAN_ROOT}/web/build/engine/obj/index.js" \
--out "${KEYMAN_ROOT}/web/build/engine/lib/index.mjs" \
--format esm
# TODO-web-core: should this be in test/?

View file

@ -28,11 +28,6 @@ builder_describe "Builds predictive-text components used within Keyman Engine fo
builder_parse "$@"
config=release
if builder_is_debug_build; then
config=debug
fi
builder_describe_outputs \
configure "/node_modules" \
build:templates "/web/src/engine/predictive-text/build/obj/index.js" \
@ -40,8 +35,6 @@ builder_describe_outputs \
build:worker-main "/web/src/engine/worker-main/build/obj/lmlayer.js" \
build:worker-thread "/web/src/engine/worker-thread/build/obj/worker-main.wrapped.js"
BUNDLE_CMD="node ${KEYMAN_ROOT}/web/src/tools/es-bundling/build/common-bundle.mjs"
#### Build action definitions ####
# We can run all clean & configure actions at once without much issue.

View file

@ -18,7 +18,6 @@ SUBPROJECT_NAME=engine/predictive-text/templates
builder_describe "Builds the predictive-text model template implementation module" \
"@/web/src/common/web-utils" \
"@/web/src/tools/es-bundling" \
"@../wordbreakers" \
"clean" \
"configure" \

View file

@ -14,14 +14,12 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$KEYMAN_ROOT/resources/build/utils.inc.sh"
. "$KEYMAN_ROOT/resources/build/node.inc.sh"
BUNDLE_CMD="node $KEYMAN_ROOT/web/src/tools/es-bundling/build/common-bundle.mjs"
################################ Main script ################################
builder_describe "Builds the lm-layer module" \
"@/common/tools/es-bundling" \
"@/common/web/keyman-version" \
"@/common/web/types" \
"@/web/src/tools/es-bundling" \
"@/web/src/engine/predictive-text/worker-thread" \
"clean" \
"configure" \
@ -47,7 +45,7 @@ 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}/web/src/engine/predictive-text/worker-main/build/obj/web/index.js" \
node_es_bundle "${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
}

View file

@ -13,14 +13,9 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$KEYMAN_ROOT/resources/build/node.inc.sh"
. "$KEYMAN_ROOT/web/common.inc.sh"
WORKER_OUTPUT=build/obj
WORKER_OUTPUT_FILENAME=build/lib/worker-main.js
INTERMEDIATE=./build/intermediate
LIB=./build/lib
bundle_cmd="node ${KEYMAN_ROOT}/web/src/tools/es-bundling/build/common-bundle.mjs"
SRCMAP_CLEANER="node $KEYMAN_ROOT/web/build/tools/building/sourcemap-root/index.js"
################################ Main script ################################
@ -29,9 +24,9 @@ SUBPROJECT_NAME=engine/predictive-text/worker-thread
builder_describe \
"Compiles the Language Modeling Layer for common use in predictive text and autocorrective applications." \
"@/common/tools/es-bundling" \
"@/common/web/keyman-version" \
"@/web/src/tools/building/sourcemap-root" \
"@/web/src/tools/es-bundling" \
"@../wordbreakers" \
"@../templates" \
configure clean build test \
@ -62,7 +57,7 @@ function do_build() {
# The ES6 target needs no polyfills - we go straight to the wrapped version.
$bundle_cmd src/main/worker-main.ts \
node_es_bundle src/main/worker-main.ts \
--out $INTERMEDIATE/worker-main.js \
--charset "utf8" \
--target "es6" \
@ -73,7 +68,7 @@ function do_build() {
$INTERMEDIATE/worker-main.js.map \
--clean
$bundle_cmd src/main/worker-main.ts \
node_es_bundle src/main/worker-main.ts \
--out $INTERMEDIATE/worker-main.min.js \
--minify \
--charset "utf8" \

View file

@ -1,17 +0,0 @@
# 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
**/.idea/**/*.xml
**/*.iml
**/*.kpj.user

View file

@ -1,47 +0,0 @@
#!/usr/bin/env bash
#
# Compiles sentry manager
#
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../../resources/build/builder-full.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE
. "${KEYMAN_ROOT}/web/common.inc.sh"
. "${KEYMAN_ROOT}/resources/build/utils.inc.sh"
. "$KEYMAN_ROOT/resources/build/node.inc.sh"
builder_describe "Builds the Sentry-reporting module used with Keyman Engine for Web" \
"@/common/web/keyman-version" \
clean configure build
builder_describe_outputs \
configure /node_modules \
build /web/src/engine/sentry-manager/build/lib/index.js
builder_parse "$@"
### CLEAN ACTIONS
if builder_start_action clean; then
rm -rf build/
builder_finish_action success clean
fi
### CONFIGURE ACTIONS
if builder_start_action configure; then
node_select_version_and_npm_ci
builder_finish_action success configure
fi
if builder_start_action build; then
tsc --build "$THIS_SCRIPT_PATH/src/tsconfig.json"
$BUNDLE_CMD "${KEYMAN_ROOT}/web/src/engine/sentry-manager/build/obj/index.js" \
--out "${KEYMAN_ROOT}/web/src/engine/sentry-manager/build/lib/index.js" \
--sourceRoot "@keymanapp/keyman/web/src/engine/sentry-manager/build/lib/"
builder_finish_action success build
fi

View file

@ -1,13 +0,0 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"lib": ["es6", "dom"],
"outDir": "../build/obj",
"rootDir": "./",
"tsBuildInfoFile": "../build/obj/tsconfig.tsbuildinfo",
},
"include": [
"*.ts"
]
}

View file

@ -11,7 +11,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
# ################################ Main script ################################
builder_describe "Builds the Keyman Engine for Web's sample page setups." \
"@/web/src/engine/sentry-manager build" \
"@/common/web/sentry-manager build" \
"@/web/src/app/browser build" \
"@/web/src/app/ui build" \
"@/web/src/tools build" \
@ -32,8 +32,8 @@ builder_describe_outputs \
#### Resource paths ####
SENTRY_MANAGER_SRC="$KEYMAN_ROOT/web/src/engine/sentry-manager/build/lib/index.js"
SENTRY_MANAGER_MAP="$KEYMAN_ROOT/web/src/engine/sentry-manager/build/lib/index.js.map"
SENTRY_MANAGER_SRC="$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js"
SENTRY_MANAGER_MAP="$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js.map"
#### Build action definitions ####
@ -43,7 +43,7 @@ SENTRY_MANAGER_MAP="$KEYMAN_ROOT/web/src/engine/sentry-manager/build/lib/index.j
function do_copy() {
mkdir -p "$KEYMAN_ROOT/$DEST"
# The next four lines are needed for the sentry-integration manual test page.
# The next two lines are needed for the sentry-integration manual test page.
cp "$SENTRY_MANAGER_SRC" "$KEYMAN_ROOT/$DEST/sentry-manager.js"
cp "$SENTRY_MANAGER_MAP" "$KEYMAN_ROOT/$DEST/sentry-manager.js.map"

View file

@ -10,8 +10,8 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
builder_describe "Builds a debug-host page simulating Keyman Android's WebView setup for KMW use" \
"@/common/web/keyman-version" \
"@/common/web/sentry-manager" \
"@/web/src/app/webview" \
"@/web/src/engine/sentry-manager" \
clean configure build
builder_describe_outputs \
@ -45,7 +45,7 @@ if builder_start_action build; then
cp "$KEYMAN_ROOT/web/build/app/resources/osk/keymanweb-osk.ttf" "host/keymanweb-osk.ttf"
# We shouldn't rely on a prior Android build for these files! We can retrieve them separately.
cp "$KEYMAN_ROOT/web/src/engine/sentry-manager/build/lib/index.js" "host/keyman-sentry.js"
cp "$KEYMAN_ROOT/common/web/sentry-manager/build/lib/index.js" "host/keyman-sentry.js"
cp "$KEYMAN_ROOT/node_modules/es6-shim/es6-shim.min.js" "host/es6-shim.min.js"
# Test keyboards

View file

@ -20,7 +20,6 @@ builder_describe "Builds the Keyman Engine for Web's development & unit-testing
"build" \
"test" \
":bulk_rendering=testing/bulk_rendering Builds the bulk-rendering tool used to validate changes to OSK display code" \
":es-bundling Builds code used to esbundle Web engine artifacts for browser consumption" \
":recorder=testing/recorder Builds the KMW recorder tool used for development of unit-test resources" \
":sourcemap-root=building/sourcemap-root Builds the sourcemap-cleaning tool used during minification of app/ builds" \
":test-utils=testing/test-utils Builds the test-utils module" \

View file

@ -16,6 +16,7 @@ SUBPROJECT_NAME=tools/testing/bulk_rendering
################################ Main script ################################
builder_describe "Builds a 'bulk renderer' that loads all the cloud keyboards from api.keyman.com and renders each of them to a document." \
"@/common/tools/es-bundling" \
"@/web/src/common/web-utils build" \
"@/web/src/app/browser build" \
"@/web/src/app/ui build" \
@ -32,7 +33,7 @@ builder_parse "$@"
function do_build ( ) {
tsc --build "$THIS_SCRIPT_PATH/tsconfig.json" $builder_verbose
$BUNDLE_CMD "${KEYMAN_ROOT}/web/build/$SUBPROJECT_NAME/obj/renderer_core.js" \
node_es_bundle "${KEYMAN_ROOT}/web/build/$SUBPROJECT_NAME/obj/renderer_core.js" \
--out "${KEYMAN_ROOT}/web/build/$SUBPROJECT_NAME/lib/bulk_render.js" \
--sourceRoot "@keymanapp/keyman/web/build/$SUBPROJECT_NAME/lib/"

View file

@ -8,8 +8,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$KEYMAN_ROOT/web/common.inc.sh"
. "$KEYMAN_ROOT/resources/build/utils.inc.sh"
BUNDLE_CMD="node $KEYMAN_ROOT/web/src/tools/es-bundling/build/common-bundle.mjs"
. "$KEYMAN_ROOT/resources/build/node.inc.sh"
# BASE_DIR="/web/src/engine/osk/gesture-processor"
BUILD_DIR=/web/build/tools/testing/gesture-processor
@ -17,6 +16,7 @@ BUILD_DIR=/web/build/tools/testing/gesture-processor
################################ Main script ################################
builder_describe "Testing-oriented tools for the Gesture Processor module of web-based Keyman OSKs" \
"@/common/tools/es-bundling" \
"clean" \
"build" \
":fixture The HTML-element fixture and CSS fixture used for both user-testing and unit-testing" \
@ -69,7 +69,7 @@ function do_build_fixture() {
function do_build_testmodule() {
compile "" "${THIS_SCRIPT_PATH}/unit-test-resources" "${KEYMAN_ROOT}/${BUILD_DIR}/unit-test-resources"
$BUNDLE_CMD "${KEYMAN_ROOT}/${BUILD_DIR}/unit-test-resources/obj/index.js" \
node_es_bundle "${KEYMAN_ROOT}/${BUILD_DIR}/unit-test-resources/obj/index.js" \
--out "${KEYMAN_ROOT}/${BUILD_DIR}/unit-test-resources/lib/index.mjs" \
--format "esm"
}

View file

@ -1,7 +0,0 @@
import esbuild from 'esbuild';
import { esmConfiguration, bundleObjEntryPoints } from '../../../../../../tools/es-bundling/build/index.mjs';
await esbuild.build({
...esmConfiguration,
...bundleObjEntryPoints('lib', '../../../build/tools/obj/index.js')
});

View file

@ -16,6 +16,7 @@ SUBPROJECT_NAME=tools/testing/recorder
################################ Main script ################################
builder_describe "Builds the Keyman Engine for Web's test-sequence recording tool" \
"@/common/tools/es-bundling" \
"@/common/web/keyman-version" \
"@/web/src/engine" \
"@../recorder-core" \
@ -33,7 +34,7 @@ do_build ( ) {
compile $SUBPROJECT_NAME
# Base product - the main keyboard processor
$BUNDLE_CMD "${KEYMAN_ROOT}/web/build/$SUBPROJECT_NAME/obj/index.js" \
node_es_bundle "${KEYMAN_ROOT}/web/build/$SUBPROJECT_NAME/obj/index.js" \
--out "${KEYMAN_ROOT}/web/build/$SUBPROJECT_NAME/lib/index.mjs" \
--format esm
}

View file

@ -15,7 +15,6 @@
{ "path": "engine/predictive-text/worker-main/tsconfig.all.json" },
{ "path": "engine/predictive-text/worker-thread" },
{ "path": "tools/testing/gesture-processor/unit-test-resources" },
{ "path": "engine/sentry-manager/src" },
{ "path": "tools/testing/recorder" },
// { "path": "tools/sourcemap-root/tsconfig.json" },