Headless Yomitan engine for Entei / Tauri: Japanese text utilities, deinflection
and the lookup Translator, with no chrome.*, document or extension runtime.
Maintenance Commitment: We actively maintain this package for the sake of our Entei immersion platform, keeping upstream Yomitan language/deinflection parity intact while ensuring zero DOM or browser-extension runtime dependencies.
import {
convertHiraganaToKatakana,
distributeFurigana,
createJapaneseLanguageTransformer,
createTranslator,
} from '@gorakudo/yomitan-headless';
distributeFurigana('食べる', 'たべる');
// [{text: '食', reading: 'た'}, {text: 'べる', reading: ''}]
const transformer = createJapaneseLanguageTransformer();
transformer.transform('食べた').map((r) => r.text); // ['食べた', '食べる', ...]
// Any store implementing the headless `DictionaryDatabase` contract works.
const translator = createTranslator(myDatabase);
const {dictionaryEntries} = await translator.findTerms('simple', '食べた', options);src/index.ts— everything: kana conversion, furigana distribution, mora/pitch helpers,japaneseTransforms,LanguageTransformer,MultiLanguageTransformer,Translator, text processors/language metadata, and thecreate*factories.src/types.ts— DOM-free contracts:DictionaryDatabase,TermEntry,KanjiEntry,Tag,TextScannerLike,ScanOptions, ...dist/index.js— single-file ESM bundle (JSON inlined), safe for Node/Tauri.dist/index.d.ts— self-contained type entry point (declarations for our sources and the vendor modules they re-export live indist/types/**). Consumers need neitherallowJsnor thevendor/checkout.
vendor/yomitanis a git submodule pinned to commitac1d839(Yomitan 26.11.2.0). Initialise it withgit submodule update --init --recursive. Only its gitignored build outputext/lib/*is materialised byscripts/prepare-vendor.mjs(every.jsfromdev/libis copied), because the vendor language modules import../../../lib/kanji-processor.jsby relative path.- Runtime packages
kanji-processorandhangul-jsare installed in this repo and resolved fromext/libshims — the full Yomitan repo is never built. kanji-processorimports JSON without import attributes, so native Node ESM cannot load the vendor sources directly. Vitest inlines it (server.deps.inline), andnpm run buildinlines it intodist/index.js.
| script | purpose |
|---|---|
npm test |
Vitest unit tests (test/**/*.test.ts only) |
npm run typecheck |
tsc --noEmit |
npm run build |
esbuild bundle → dist/index.js, tsc → dist/index.d.ts |
npm run prepare-vendor |
materialise vendor/yomitan/ext/lib shims |