I have some fairly complicated Javascript that generates a web UI as well as utilizes WASM compiled from C that I'd like to publish as an NPM package. How should I do this?
I know this is an open-ended question, and I'm not simply asking how to create an NPM package. I know how to do that. I'm more asking how to create an NPM package that includes both functional (no-UI) and UI components. The code doesn't need a web browser to run and update the UI elements, but removing all the code that does that UI updating would be non-trivial and even more difficult to separate into another package.
Most npm packages I see don't tend to include much HTML/UI generation code, and tend to be purely functional, which makes sense for practicality and simplicity's sake.
Unfortunately, because the UI parts of the code are so intermingled with the functional parts (it's an audio histogram/fft generation and visualization library), it's not really practical to completely remove the UI elements to a separate package. Even if I were to, it would probably worsen performance, since there are some loops used by both the UI and data processing sides that I can efficiently re-use with them being closely integrated, which would be much more difficult to do if they were in separate packages.
Is it a mistake for me to even consider trying to bundle it altogether? Or is there a good way to do that with NPM?