From 93608080a4da4ce84df38c35b0796ae8bc6127f4 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Thu, 18 Jul 2024 23:23:28 -0400 Subject: [PATCH] 0.10.9: emscripten 3.1.63 --- checksum | 4 ++-- librime | 2 +- librime-lua | 2 +- librime_patch | 15 +-------------- opencc_patch | 23 ++++++++++++++++++----- package.json | 46 +++++++++++++++++++++++----------------------- wasm/api.cpp | 42 ++++++++++++++++++++++-------------------- 7 files changed, 68 insertions(+), 66 deletions(-) diff --git a/checksum b/checksum index cca871f..5fe164f 100644 --- a/checksum +++ b/checksum @@ -1,3 +1,3 @@ 05e34aaf2b388a96e6a52fb941e5299f public/rime.data -1985fb80ba5768f171d0108174c98abe public/rime.js -baecfa3a5f7f5fbf2aa7837d3952747a public/rime.wasm +aa1a409d9f050280b4be5f08d2e0becd public/rime.js +b9203c3a3b8f638431a99e0f3e630e93 public/rime.wasm diff --git a/librime b/librime index a1c8144..f6dd300 160000 --- a/librime +++ b/librime @@ -1 +1 @@ -Subproject commit a1c814443264b49a3b8633ebf89071c6ca667a94 +Subproject commit f6dd30059e78bfbf6d48788ef35daea8f5806e1d diff --git a/librime-lua b/librime-lua index 43229d7..7be6974 160000 --- a/librime-lua +++ b/librime-lua @@ -1 +1 @@ -Subproject commit 43229d766f1e0f3198f61dc9d2e38bc1f921387f +Subproject commit 7be6974b6d81c116bba39f6707dc640f6636fa4e diff --git a/librime_patch b/librime_patch index 9a2662c..bc4ba93 100644 --- a/librime_patch +++ b/librime_patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 53f9d537..64dfdba1 100644 +index e167e228..9df29c9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.12) @@ -102,19 +102,6 @@ index bb68bcdb..4ef84beb 100644 bool page_down_cycle() const { return page_down_cycle_; } const string& select_keys() const { return select_keys_; } void set_select_keys(const string& keys) { select_keys_ = keys; } -diff --git a/src/rime_api.h b/src/rime_api.h -index 44b2ea3f..d106a197 100644 ---- a/src/rime_api.h -+++ b/src/rime_api.h -@@ -422,6 +422,8 @@ RIME_API const char* RimeGetSyncDir(void); - - RIME_API const char* RimeGetUserId(void); - -+RIME_API Bool RimeChangePage(RimeSessionId session_id, Bool backward); -+ - /*! The API structure - * RimeApi is for rime v1.0+ - */ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 090a0fc0..a24cd51f 100644 --- a/tools/CMakeLists.txt diff --git a/opencc_patch b/opencc_patch index aa1fc2e..93de66d 100644 --- a/opencc_patch +++ b/opencc_patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index ee08591..24da933 100644 +index 1acb75a..b9b49da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -127,12 +127,23 @@ add_definitions( +@@ -152,12 +152,23 @@ add_definitions( -DPACKAGE_NAME="${PACKAGE_NAME}" ) @@ -27,7 +27,7 @@ index ee08591..24da933 100644 if (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-O0 -g3) endif () -@@ -196,9 +207,6 @@ endif() +@@ -221,9 +232,6 @@ endif() ######## Subdirectories add_subdirectory(src) @@ -37,11 +37,24 @@ index ee08591..24da933 100644 ######## Testing +diff --git a/deps/rapidjson-1.1.0/rapidjson/document.h b/deps/rapidjson-1.1.0/rapidjson/document.h +index e3e20df..ad362a6 100644 +--- a/deps/rapidjson-1.1.0/rapidjson/document.h ++++ b/deps/rapidjson-1.1.0/rapidjson/document.h +@@ -322,7 +322,7 @@ struct GenericStringRef { + operator const Ch *() const { return s; } + + const Ch* const s; //!< plain CharType pointer +- const SizeType length; //!< length of the string (excluding the trailing NULL terminator) ++ SizeType length; //!< length of the string (excluding the trailing NULL terminator) + + private: + //! Disallow construction from non-const array diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index c0a0b10..b8cdc73 100644 +index 75eda02..c7bb8c5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -184,5 +184,3 @@ if (ENABLE_BENCHMARK) +@@ -204,5 +204,3 @@ if (ENABLE_BENCHMARK) endif() # Subdir diff --git a/package.json b/package.json index 71faf48..ba8f687 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@libreservice/my-rime", - "version": "0.10.8", + "version": "0.10.9", "files": [ "dist" ], @@ -40,52 +40,52 @@ "preview": "vite preview --host" }, "devDependencies": { - "@codemirror/language": "^6.10.1", + "@codemirror/language": "^6.10.2", "@codemirror/legacy-modes": "^6.4.0", "@libreservice/lazy-cache": "^0.1.2", - "@libreservice/micro-plum": "^0.2.2", + "@libreservice/micro-plum": "^0.2.3", "@libreservice/my-widget": "^0.1.4", "@libreservice/my-worker": "^0.4.2", "@libreservice/wasm-code": "^0.1.5", - "@playwright/test": "^1.43.1", + "@playwright/test": "^1.45.2", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-replace": "^5.0.5", + "@rollup/plugin-replace": "^5.0.7", "@types/js-yaml": "^4.0.9", - "@typescript-eslint/eslint-plugin": "^7.8.0", - "@typescript-eslint/parser": "^7.8.0", + "@typescript-eslint/eslint-plugin": "^7.16.1", + "@typescript-eslint/parser": "^7.16.1", "@vicons/fa": "^0.12.0", "@vicons/fluent": "^0.12.0", "@vicons/material": "^0.12.0", - "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue": "^5.0.5", "client-zip": "^2.4.5", "emoji-regex": "^10.3.0", - "esbuild": "^0.20.2", - "eslint": "^8.56.0", + "esbuild": "^0.23.0", + "eslint": "^8.57.0", "eslint-config-standard": "^17.1.0", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-n": "^17.4.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-vue": "^9.25.0", - "glob": "^10.3.12", + "eslint-plugin-n": "^17.9.0", + "eslint-plugin-promise": "^6.4.0", + "eslint-plugin-vue": "^9.27.0", + "glob": "^11.0.0", "idb": "^8.0.0", "js-yaml": "^4.1.0", "luaparse": "^0.3.1", - "naive-ui": "^2.38.2", - "rimraf": "^5.0.5", - "rollup": "^4.17.2", + "naive-ui": "^2.39.0", + "rimraf": "^6.0.1", + "rollup": "^4.18.1", "rollup-plugin-esbuild": "^6.1.1", "rppi": "^0.1.0", "textarea-caret": "^3.1.0", "ts-node": "^10.9.2", - "tslib": "^2.6.2", - "typescript": "^5.4.5", - "vite": "^5.2.11", + "tslib": "^2.6.3", + "typescript": "^5.5.3", + "vite": "^5.3.4", "vite-plugin-pwa": "^0.20.0", "vite-plugin-run": "0.4.1", "vooks": "^0.2.12", - "vue": "^3.4.26", - "vue-router": "^4.3.2", - "vue-tsc": "^2.0.16" + "vue": "^3.4.32", + "vue-router": "^4.4.0", + "vue-tsc": "^2.0.26" } } diff --git a/wasm/api.cpp b/wasm/api.cpp index fc134c0..1680b9b 100644 --- a/wasm/api.cpp +++ b/wasm/api.cpp @@ -9,6 +9,8 @@ namespace my_rime { enum { COMMITTED, ACCEPTED, REJECTED, UNHANDLED }; +auto api = rime_get_api(); + RimeTraits traits = {0}; RimeSessionId session_id; RimeCommit commit; @@ -42,14 +44,14 @@ void handler(void *context_object, RimeSessionId session_id, if (std::string(message_value) == "success") { deployed = true; RimeSchemaList schemas; - RimeGetSchemaList(&schemas); + api->get_schema_list(&schemas); for (size_t i = 0; i < schemas.size; ++i) { boost::json::object obj; obj["id"] = schemas.list[i].schema_id; obj["name"] = schemas.list[i].name; schema_array.push_back(obj); } - RimeFreeSchemaList(&schemas); + api->free_schema_list(&schemas); } EM_ASM(_deployStatus(UTF8ToString($0), UTF8ToString($1)), message_value, to_json(schema_array)); @@ -59,14 +61,14 @@ void handler(void *context_object, RimeSessionId session_id, std::string get_schema_name(std::string schema) { return schema_name[schema]; } void start_rime() { - RimeInitialize(&traits); - RimeSetNotificationHandler(handler, NULL); + api->initialize(&traits); + api->set_notification_handler(handler, NULL); rime_started = true; } void stop_rime() { - RimeDestroySession(session_id); - RimeFinalize(); + api->destroy_session(session_id); + api->finalize(); rime_started = false; } @@ -89,13 +91,13 @@ const char *post_process() { if (updated_schema.size()) { obj["updatedSchema"] = updated_schema; } - RimeFreeCommit(&commit); - Bool has_committed = RimeGetCommit(session_id, &commit); + api->free_commit(&commit); + Bool has_committed = api->get_commit(session_id, &commit); if (has_committed) { obj["committed"] = commit.text; } - RimeFreeContext(&context); - RimeGetContext(session_id, &context); + api->free_context(&context); + api->get_context(session_id, &context); if (context.composition.length > 0) { auto &composition = context.composition; std::string pre_edit = composition.preedit; @@ -141,7 +143,7 @@ const char *post_process() { extern "C" { void set_option(const char *option, int value) { - RimeSetOption(session_id, option, value); + api->set_option(session_id, option, value); } void init() { @@ -149,7 +151,7 @@ void init() { traits.shared_data_dir = "/usr/share/rime-data"; traits.user_data_dir = "/rime"; traits.app_name = "My RIME"; - RimeSetup(&traits); + api->setup(&traits); RIME_STRUCT_INIT(RimeCommit, commit); RIME_STRUCT_INIT(RimeContext, context); } @@ -162,19 +164,19 @@ void set_page_size(int size) { page_size = size; } const char *process(const char *input) { pre_process(); - RimeSimulateKeySequence(session_id, input); + api->simulate_key_sequence(session_id, input); return post_process(); } const char *select_candidate_on_current_page(int index) { pre_process(); - RimeSelectCandidateOnCurrentPage(session_id, index); + api->select_candidate_on_current_page(session_id, index); return post_process(); } const char *change_page(bool backward) { pre_process(); - RimeChangePage(session_id, backward); + api->change_page(session_id, backward); return post_process(); } @@ -182,19 +184,19 @@ void set_ime(const char *ime) { if (rime_started) { // Need to reset session when using F4 to select a schema // not available yet. - RimeDestroySession(session_id); + api->destroy_session(session_id); } else { start_rime(); } - session_id = RimeCreateSession(); - RimeSelectSchema(session_id, ime); + session_id = api->create_session(); + api->select_schema(session_id, ime); } void deploy() { stop_rime(); start_rime(); - RimeStartMaintenance(true); - session_id = RimeCreateSession(); + api->start_maintenance(true); + session_id = api->create_session(); } void reset() {