tshet-uinh-js
tshet-uinh-js copied to clipboard
[WIP]
Bundle type declaration to avoid exposing internal types and enforce encapsulation
TODOs
- Convert Unicode escapes in outputted
index.d.tsinto actual code points Alternatively, userollup-plugin-dts
- Alternatively, use
rollup-plugin-dts
We've used rollup-plugin-dts before, but it ~~didn't build the correct module structure~~ (edit: I've tried again. It does now, but it doesn't preserve the docs for any exported name, only showing wierd aliases), and it's not in active development for some time.
Nonetheless, I like the idea that we build multiple target formats. (btw do we really need the CJS target? I understand that the UMD one is for single-file distribution, and the ESM one for pakage managers. CJS just seems redundant 🤔
CJS just seems redundant 🤔
Actually I once thought so too (but nevertheless merged that PR. I forgot the reason why). Let’s remove it
I would like to try @microsoft/api-extractor, but I don’t think I’ll have the time to dig into it anytime soon. Help me take a look into it if you’ve got the time (unless you don’t think doubling the file size (before gzip) is a problem) 😄
@syimyuzya I don’t think the entire type definition is currently in a usable state: https://arethetypeswrong.github.io/?p=tshet-uinh%400.15.1 So it seems crucial to give it a fix soon.
P.S. Be careful not to make the same mistake I made with the library mentioned above, which is a problem Masquerading as ESM/CJS: https://arethetypeswrong.github.io/?p=to-jyutping%403.1.1
I just found that the ESM build in this configuration is also bundled into a single file 🤔
~~Is this really desired, as the UMD build already serves this purpose~~? edit: I got it. That's also for browser usage but with ESM.