Repository navigation
Conversation
com.glyph.hunspell registers a spell-check engine (ctx.spellcheck.registerEngine, API 0.28.0) so every dictionary is checked by Hunspell, compiled to WebAssembly, instead of the app's built-in checker, which ignores compound flags. It runs in the app context because the editor checks each word synchronously, and loads its engine on the first dictionary checked: main.js imports assets/hunspell.js from a blob URL and hands it assets/hunspell.wasm as bytes. The affix file is always read as UTF-8, and the .dic word count is replaced by the lines it holds, so a dictionary claiming millions of words cannot inflate the shared heap. assets/hunspell.js is built from src/ with esbuild; LICENSE carries MPL 1.1 for Hunspell and hunspell-wasm and MIT for the Emscripten runtime. The dictionary word lists now run on the plugin's committed build, so the repo-level test package and the smoke job's install step go away. The German README says to install the plugin for compound words, and the API reference, recipe, ecosystem page and contributing guide describe engines.
This was referenced Nov 13, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the official Hunspell engine plugin (
com.glyph.hunspell). It registers a spell-check engine throughctx.spellcheck.registerEngine(plugin API 0.28.0), so every installed dictionary is checked by Hunspell, compiled to WebAssembly, instead of the app's built-in checker. The built-in checker ignores compound flags, so German needs this plugin for Fußball, Kindergarten and every other compound.Refs hamidfzm/glyph#1052 (closed by hamidfzm/glyph#1071, the app side).
Changes
plugins/com.glyph.hunspell/:main.js(hand-written) registers the engine, which loads on the first dictionary checked:assets/hunspell.jsis imported from a blob URL and handedassets/hunspell.wasmas bytes fromctx.assets.readBinary. A failed load is dropped so the next dictionary retries. The affix file is always read as UTF-8 (the app hands over decoded text), and the.dicword count is replaced by the lines it holds, counted without splitting the file, so a few bytes claiming 500 million words cannot hold the shared heap at 2 GB. Unsandboxed, since the editor checks each word synchronously; no permissions.assets/hunspell.jsis built fromsrc/hunspell.jswith esbuild (build.mjs;hunspell-wasm0.3.0 and esbuild pinned in the plugin's own lockfile), andassets/hunspell.wasmis copied from the package.LICENSEcarries MPL 1.1 for Hunspell and hunspell-wasm (chosen from LGPL 2.0, GPL 2.0 or MPL 1.1) and MIT for the Emscripten runtime, and ships in the package.main.test.mjs: compound begin/middle/end parts, compound-only parts, homonyms, suffixes permitted in compounds, suggestions, added words, encodings, the word-count bound (the heap stays under 64 MiB, where trusting the count reaches 460 MiB for 100 million), malformed dictionaries, and activation: one engine load for dictionaries loading together, and a retry after a failed read.scripts/dictionaries.test.mjsnow checks the German, Spanish and Persian word lists with the plugin's committed build, so the repo-level test package (package.json,package-lock.json) and the smoke job's install step go away.docs/ecosystem.mdsays why the engine lives here rather than in the app;docs/contributing.mddescribes the smoke job.plugin.jsoncarries the placeholdersha256; the release job rewritespackageUrland the digest.index.json,index/, anddocs/plugin-catalog.mdregenerated withscripts/build-index.mjs.Testing
node --testat the root: 46 passing, including the plugin's tests and the three word lists, with nothing installed.node scripts/check-plugins.mjspasses, and a freshscripts/build-index.mjsleaves the committed index unchanged.npm ci --ignore-scripts && npm run buildin the plugin folder reproduces the committed assets.main.jsimported from a blob URL loads its assets, compiles the WebAssembly and checks compounds, accented capitals and suggestions; the same probe fails when the CSP allows no WebAssembly compile.