diff --git a/android/KMEA/build.sh b/android/KMEA/build.sh index f4d7705815..28d9877285 100755 --- a/android/KMEA/build.sh +++ b/android/KMEA/build.sh @@ -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" diff --git a/common/tools/es-bundling/.gitignore b/common/tools/es-bundling/.gitignore new file mode 100644 index 0000000000..07ed7069a2 --- /dev/null +++ b/common/tools/es-bundling/.gitignore @@ -0,0 +1 @@ +build/* \ No newline at end of file diff --git a/web/src/tools/es-bundling/README.md b/common/tools/es-bundling/README.md similarity index 100% rename from web/src/tools/es-bundling/README.md rename to common/tools/es-bundling/README.md diff --git a/web/src/tools/es-bundling/build.sh b/common/tools/es-bundling/build.sh similarity index 68% rename from web/src/tools/es-bundling/build.sh rename to common/tools/es-bundling/build.sh index 3a05714120..8ff7f035f4 100755 --- a/web/src/tools/es-bundling/build.sh +++ b/common/tools/es-bundling/build.sh @@ -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 diff --git a/web/src/tools/es-bundling/src/classTreeshaker.mts b/common/tools/es-bundling/src/classTreeshaker.mts similarity index 100% rename from web/src/tools/es-bundling/src/classTreeshaker.mts rename to common/tools/es-bundling/src/classTreeshaker.mts diff --git a/web/src/tools/es-bundling/src/common-bundle.mts b/common/tools/es-bundling/src/common-bundle.mts similarity index 100% rename from web/src/tools/es-bundling/src/common-bundle.mts rename to common/tools/es-bundling/src/common-bundle.mts diff --git a/web/src/tools/es-bundling/src/configuration.mts b/common/tools/es-bundling/src/configuration.mts similarity index 100% rename from web/src/tools/es-bundling/src/configuration.mts rename to common/tools/es-bundling/src/configuration.mts diff --git a/web/src/tools/es-bundling/src/index.mts b/common/tools/es-bundling/src/index.mts similarity index 100% rename from web/src/tools/es-bundling/src/index.mts rename to common/tools/es-bundling/src/index.mts diff --git a/web/src/tools/es-bundling/src/tslibTreeshaking.mts b/common/tools/es-bundling/src/tslibTreeshaking.mts similarity index 100% rename from web/src/tools/es-bundling/src/tslibTreeshaking.mts rename to common/tools/es-bundling/src/tslibTreeshaking.mts diff --git a/web/src/tools/es-bundling/tsconfig.json b/common/tools/es-bundling/tsconfig.json similarity index 81% rename from web/src/tools/es-bundling/tsconfig.json rename to common/tools/es-bundling/tsconfig.json index b0338768aa..5870280035 100644 --- a/web/src/tools/es-bundling/tsconfig.json +++ b/common/tools/es-bundling/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../tsconfig.base.json", "compilerOptions": { "allowSyntheticDefaultImports": true, "outDir": "build/", diff --git a/common/web/sentry-manager/build.sh b/common/web/sentry-manager/build.sh new file mode 100755 index 0000000000..4e725290e4 --- /dev/null +++ b/common/web/sentry-manager/build.sh @@ -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 + diff --git a/web/src/engine/sentry-manager/package.json b/common/web/sentry-manager/package.json similarity index 100% rename from web/src/engine/sentry-manager/package.json rename to common/web/sentry-manager/package.json diff --git a/web/src/engine/sentry-manager/src/index.ts b/common/web/sentry-manager/src/index.ts similarity index 100% rename from web/src/engine/sentry-manager/src/index.ts rename to common/web/sentry-manager/src/index.ts diff --git a/common/web/sentry-manager/tsconfig.json b/common/web/sentry-manager/tsconfig.json new file mode 100644 index 0000000000..0967154d90 --- /dev/null +++ b/common/web/sentry-manager/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/ios/engine/build.sh b/ios/engine/build.sh index 39bd26118c..9b98249b9b 100755 --- a/ios/engine/build.sh +++ b/ios/engine/build.sh @@ -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. diff --git a/package-lock.json b/package-lock.json index a92887b136..76485081c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", @@ -1764,7 +1775,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": { @@ -2899,7 +2910,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" @@ -2908,21 +2918,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" @@ -2931,21 +2930,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", @@ -2959,7 +2947,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", @@ -2969,26 +2956,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", @@ -3033,6 +3000,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", @@ -3177,6 +3160,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", @@ -14178,33 +14170,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, @@ -14313,7 +14278,7 @@ }, "web/src/engine/sentry-manager": { "name": "@keymanapp/web-sentry-manager", - "dev": true, + "extraneous": true, "license": "MIT", "dependencies": { "@keymanapp/keyman-version": "*", diff --git a/package.json b/package.json index d7c083c198..e33fd5b41b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/resources/build/node.inc.sh b/resources/build/node.inc.sh index cf4da8131c..4d70f2445b 100644 --- a/resources/build/node.inc.sh +++ b/resources/build/node.inc.sh @@ -82,3 +82,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" "$@" +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index c9e8f3dc60..c28cddb80f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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" }, diff --git a/web/build.sh b/web/build.sh index e1dee7d941..022e2c2781 100755 --- a/web/build.sh +++ b/web/build.sh @@ -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 diff --git a/web/ci.sh b/web/ci.sh index 02545cf447..25001c3d02 100755 --- a/web/ci.sh +++ b/web/ci.sh @@ -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/" diff --git a/web/common.inc.sh b/web/common.inc.sh index eafbf29ae2..b587bf99ab 100644 --- a/web/common.inc.sh +++ b/web/common.inc.sh @@ -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. diff --git a/web/src/app/browser/build.sh b/web/src/app/browser/build.sh index fff0236901..13d0f954e4 100755 --- a/web/src/app/browser/build.sh +++ b/web/src/app/browser/build.sh @@ -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" \ diff --git a/web/src/app/ui/build.sh b/web/src/app/ui/build.sh index 36c6f3d4e5..72c6377c09 100755 --- a/web/src/app/ui/build.sh +++ b/web/src/app/ui/build.sh @@ -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 diff --git a/web/src/app/webview/build.sh b/web/src/app/webview/build.sh index 9735d816c2..790e8d2aef 100755 --- a/web/src/app/webview/build.sh +++ b/web/src/app/webview/build.sh @@ -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" \ diff --git a/web/src/app/webview/map-polyfill-bundler.js b/web/src/app/webview/map-polyfill-bundler.js index 72b7a83243..257f897e70 100644 --- a/web/src/app/webview/map-polyfill-bundler.js +++ b/web/src/app/webview/map-polyfill-bundler.js @@ -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, diff --git a/web/src/common/web-utils/build.sh b/web/src/common/web-utils/build.sh index 1106ace477..f569e379b7 100755 --- a/web/src/common/web-utils/build.sh +++ b/web/src/common/web-utils/build.sh @@ -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 } diff --git a/web/src/engine/build.sh b/web/src/engine/build.sh index 3ff9461c40..fb71c30853 100755 --- a/web/src/engine/build.sh +++ b/web/src/engine/build.sh @@ -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/? diff --git a/web/src/engine/predictive-text/build.sh b/web/src/engine/predictive-text/build.sh index f4872bcd7f..1d48d302cc 100755 --- a/web/src/engine/predictive-text/build.sh +++ b/web/src/engine/predictive-text/build.sh @@ -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. diff --git a/web/src/engine/predictive-text/templates/build.sh b/web/src/engine/predictive-text/templates/build.sh index 8119b5a365..3fa4b75a29 100755 --- a/web/src/engine/predictive-text/templates/build.sh +++ b/web/src/engine/predictive-text/templates/build.sh @@ -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" \ diff --git a/web/src/engine/predictive-text/worker-main/build.sh b/web/src/engine/predictive-text/worker-main/build.sh index 0fc63bfb32..0abb4db7ee 100755 --- a/web/src/engine/predictive-text/worker-main/build.sh +++ b/web/src/engine/predictive-text/worker-main/build.sh @@ -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 } diff --git a/web/src/engine/predictive-text/worker-thread/build.sh b/web/src/engine/predictive-text/worker-thread/build.sh index 25276eaa6e..663088c298 100755 --- a/web/src/engine/predictive-text/worker-thread/build.sh +++ b/web/src/engine/predictive-text/worker-thread/build.sh @@ -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" \ diff --git a/web/src/engine/sentry-manager/.gitignore b/web/src/engine/sentry-manager/.gitignore deleted file mode 100644 index a5025863e3..0000000000 --- a/web/src/engine/sentry-manager/.gitignore +++ /dev/null @@ -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 \ No newline at end of file diff --git a/web/src/engine/sentry-manager/build.sh b/web/src/engine/sentry-manager/build.sh deleted file mode 100755 index 1054e152bc..0000000000 --- a/web/src/engine/sentry-manager/build.sh +++ /dev/null @@ -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 diff --git a/web/src/engine/sentry-manager/src/tsconfig.json b/web/src/engine/sentry-manager/src/tsconfig.json deleted file mode 100644 index 7bb42bdb40..0000000000 --- a/web/src/engine/sentry-manager/src/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../../../../tsconfig.base.json", - "compilerOptions": { - "lib": ["es6", "dom"], - "outDir": "../build/obj", - "rootDir": "./", - "tsBuildInfoFile": "../build/obj/tsconfig.tsbuildinfo", - }, - - "include": [ - "*.ts" - ] -} \ No newline at end of file diff --git a/web/src/test/manual/build.sh b/web/src/test/manual/build.sh index 99875fd98d..522636870e 100755 --- a/web/src/test/manual/build.sh +++ b/web/src/test/manual/build.sh @@ -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/keyboards" - # 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" diff --git a/web/src/test/manual/embed/android-harness/build.sh b/web/src/test/manual/embed/android-harness/build.sh index d672fd4489..81d141bc23 100755 --- a/web/src/test/manual/embed/android-harness/build.sh +++ b/web/src/test/manual/embed/android-harness/build.sh @@ -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 diff --git a/web/src/tools/build.sh b/web/src/tools/build.sh index 246b013803..c057a75093 100755 --- a/web/src/tools/build.sh +++ b/web/src/tools/build.sh @@ -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" \ diff --git a/web/src/tools/testing/bulk_rendering/build.sh b/web/src/tools/testing/bulk_rendering/build.sh index 3ed494c73b..c2e42dd96f 100755 --- a/web/src/tools/testing/bulk_rendering/build.sh +++ b/web/src/tools/testing/bulk_rendering/build.sh @@ -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/" diff --git a/web/src/tools/testing/gesture-processor/build.sh b/web/src/tools/testing/gesture-processor/build.sh index 30d7ea3297..a557245674 100755 --- a/web/src/tools/testing/gesture-processor/build.sh +++ b/web/src/tools/testing/gesture-processor/build.sh @@ -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" } diff --git a/web/src/tools/testing/gesture-processor/unit-test-resources/build-bundler.js b/web/src/tools/testing/gesture-processor/unit-test-resources/build-bundler.js deleted file mode 100644 index 4603b338ad..0000000000 --- a/web/src/tools/testing/gesture-processor/unit-test-resources/build-bundler.js +++ /dev/null @@ -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') -}); \ No newline at end of file diff --git a/web/src/tools/testing/recorder/build.sh b/web/src/tools/testing/recorder/build.sh index c8ac22380f..92db811915 100755 --- a/web/src/tools/testing/recorder/build.sh +++ b/web/src/tools/testing/recorder/build.sh @@ -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 } diff --git a/web/src/tsconfig.all.json b/web/src/tsconfig.all.json index fa882d6f2d..5c67a919c4 100644 --- a/web/src/tsconfig.all.json +++ b/web/src/tsconfig.all.json @@ -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" },