harfbuzzjs icon indicating copy to clipboard operation
harfbuzzjs copied to clipboard

refactor: support esm & typescript

Open Jackie1210 opened this issue 2 years ago • 4 comments

Hi, there! This is a satori contributor, currently satori has a lot of issues releated to font where we use opentype.js to render font. We are looking for a better font renderer so that we can make satori better(see https://github.com/vercel/satori/issues/83).

Based on bg above, I find this lib has following problems:

  • not friendly with typescript
  • not support esm

To make this lib a modern lib, i make this PR. Looking forward to your feedback~

Jackie1210 avatar Aug 09 '23 13:08 Jackie1210

CC @shuding

Jackie1210 avatar Aug 09 '23 13:08 Jackie1210

cc @chearon

behdad avatar Aug 09 '23 15:08 behdad

I definitely think it would be great to have the JS parts written in TypeScript. I'm not sure about all of the rest. Since this library is framework-agnostic I wonder if the React stuff belongs in a separate demo repo. I can try to make a real review soon.

chearon avatar Aug 10 '23 21:08 chearon

@chearon Don't worry about react stuff which is just a playground. I have make this lib a monorepo and react stuff will not affect final bundle result of harfbuzzjs. What I do is just translate original example code to a vite-react demo repo. If needed, I am pleased to refine playground for better DX.

Jackie1210 avatar Aug 11 '23 00:08 Jackie1210