This is a lightweight Chinese character-to-pinyin library that I currently use in conjunction with slug.
Polyphonic characters and tones are not supported.
pnpm add @cicara/tiny-pinyin
import pinyin from "@cicara/tiny-pinyin";
pinyin.convertToPinyin("ๅฎ่ฃ
ๅไฝฟ็จ", " "); // an zhuang he shi yong