icu4x
icu4x copied to clipboard
Packaging for JavaScript
This issue tracks tasks that need to be completed for ICU4X to be easily included by JavaScript clients.
For people landing on this thread for the first time: Long story short, ICU4X is a new modular i18n library written in Rust. In order to deploy it on the Web (and possibly in Node.js), we have invested time in WebAssembly bindings that enable JavaScript clients to use ICU4X as if it were a native JavaScript library. The next step, where we would like to start engaging more with folks like you, is how to package up all the work we've done into a polished, modular package that can be easily integrated into all types of JavaScript apps.
Some open questions include:
- How do WebAssembly libraries integrate into popular JS serving frameworks like Webpack?
- Are there examples of other WASM-as-a-library packages that we can reference?
- Can we perform tree-shaking, i.e., by taking the WASM APIs that are reachable from JS code and pruning out unreachable WASM code?
Additional sub-tasks:
- [x] Figure out object lifetime and memory growth beyond the finalization registry
- [x] Test on frontend and integration with Webpack, etc.
- [ ] Consider adding an Intl object for easy polyfills
- [ ] Consider supporting Temporal APIs (https://github.com/unicode-org/icu4x/issues/1174)
- [ ] Publish on npm (note: I reserved the icu4x package name and org)
A fair bit has happened since this issue was filed. We have a working JS wrapper over ICU4X via WebAssembly. What we don't have is a nice way to package it up and ship it on npm.
@devsnek Would you be able to advise and/or contribute on getting ICU4X for JS over the finish line?
Discussion:
- @robertbastian - Not sure if we have time to make a fully polished npm release; maybe we can release a 0.9 on npm when we release Rust 1.0?
- @dminor - I like that solution. We should do some work to facilitate JS users, but we don't have the expertise in our team to make it polished. It should not detract from the Rust release.
- @sffc - I like this approach as well; it can help us develop a community of contributors in JS if we publish a "beta" release on npm.
- @Manishearth - Perhaps we can do some recruiting for an expert in this area.
- @sffc - We should consult with @devsnek (CC'd above).
@sffc my interest in icu4x comes from it being a possibility for implementing intl/temporal in engine262, so within the bounds of that (which i haven't touched since november, so i'll need to regain some context there) i can try to give feedback and small fixes but i don't have the bandwidth to spearhead this.
As a reminder of the impact of this issue, nearly 2/3 of developers use npm, according to the 2022 Stack Overflow Developer Survey:
https://survey.stackoverflow.co/2022/#section-most-popular-technologies-other-tools