Skip to content

Conversation

@eagleoflqj
Copy link
Contributor

libchewing uses chewing-cli to generate binary dictionaries from text files. When cross build (e.g. for wasm), the cli is not a natively-executable program, so the generation step needs to be skipped. Dictionaries can still be built natively and copied to wasm package.
The PR introduces BUILD_DATA that defaults to ON so that current behavior is preserved and it's easier to skip the data generation step.
BUILD_DOC is not as important as BUILD_DATA but also provides some convenience, as I'm not distributing man pages to the website that runs chewing wasm.

@codecov
Copy link

codecov bot commented Dec 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.06%. Comparing base (51fb091) to head (08655eb).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #789   +/-   ##
=======================================
  Coverage   92.06%   92.06%           
=======================================
  Files          37       37           
  Lines        9252     9252           
=======================================
  Hits         8518     8518           
  Misses        734      734           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kanru
Copy link
Member

kanru commented Dec 29, 2025

Thanks!

I'm very interested in your wasm build and how you plan to use it! Does the wasm build work out of the box?

@kanru kanru merged commit 8dc118c into chewing:master Dec 29, 2025
12 checks passed
@eagleoflqj eagleoflqj deleted the option branch December 29, 2025 02:56
@eagleoflqj
Copy link
Contributor Author

I'm very interested in your wasm build and how you plan to use it!

I've deployed wasm build of fcitx5-chewing to https://fcitx-contrib.github.io/online/
Usage: Click Plugin Manager button and download chewing, then upload it to the rectangle area. Select chewing input method and get the same experience with desktop fcitx5-chewing.

Does the wasm build work out of the box?

Wasm build could have multi-thread disabled or enabled. I choose to disable it so that it can be ran without specific HTTP response headers (COEP and COOP) set by server, in the hope that it can be embedded in more websites. That means for every usage of multi-thread, I have to patch it to be single-thread. See my current patch for libchewing as an example, in which I change the thread spawn to a direct function call.

@kanru
Copy link
Member

kanru commented Dec 29, 2025

Thanks. This is so cool!

If you'd like to contribute a wasm patch I will merge it. I was planning to add a wasm demo on the website anyway 😄

P.S. I played a bit and it seems the current version is using built-in fallback dictionary instead of the files from the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants