A (simple, very basic) Jabber/XMPP client for KaiOS [WIP]
Go to file
Badri Sunderarajan 18d8fbdd69
Bump ConverseJS from 9.1.1 to 10.1.7 and *make it work*
This was somewhat harder than you'd imagine, because ConverseJS
and Strophe have changed a bit in the meantime. Nothing major, but
a small change had unintended consequences.

Some backstory: we use Rollup for bundling Convo into a format
that KaiOS' ageing engine can understand. The bad news: due to
a weird bug/issue/something, Rollup doesn't like the UMD format
that ConverseJS dependency Strophe bundles into. This bug has
been affecting a lot of people and has been extensively documented
in issues like this one:

https://github.com/rollup/rollup-plugin-commonjs/issues/139

(I think Strophe also bundles into other formats, but for some
reason the default one picked by Rollup is dist/strophe.umd.js
that it then immediately raises a complaint about).

The good news was that @converse/headless was inadvertently
sidestepping this issue because it imported the Strophe object
from a specific file in Strophe's src like this:

    import { Strophe } from 'strophe.js/src/strophe';

which completely bypassed the problematic dist folder. Since
Rollup eventually bundled everything anyway, reading from source
to start with wasn't a problem.

The bad news was that, at some point, ConverseJS was updated to
use a newer version of Strophe. Unfortunately, the new Strophe
had renamed its src/strophe.js to src/index.js:

26f94b15f0

That is in itself a good practice, but it broke the import in
@converse/headless, which was still looking for the old file
instead of the new one.

Not a big problem either; a few days later @converse/headless
implemented the best practice of importing straight from
'strophe' instead of trying to specify where exacly to import
from, allowing the Strophe package to take on that job:

72f659cd1a

The only problem is, that "take it from wherever the package
decides" proved disastrous for Convo's Rollup setup, because
Rollup stopped looking in src/ at all. Instead, it went straight
to the dist/ folder like any sensible bundler would do. Except
that the first option in the dist/ folder happened to be the
strophe.umd.js file that Rollup had issues with as mentioned in
the beginning of this commit message!

I didn't know all this backstory at the time. All I knew was that
Rollup was producing the somewhat cryptic error:

    'Strophe' is not exported by node_modules/strophe.js/dist/strophe.umd.js

which made no sense to me because of course it was!

With some DuckDuckGo'ing I realised that this is a not uncommon
problem with UMD packages in Rollup when using the commonjs
plugin. But though the problem was quite common, the workarounds
weren't. None of the workarounds (I wouldn't deign to call them
solutions) that were described, semi-described, or hinted-at
worked for me.

After sleeping over it, I decided to inspect the ConverseJS code
and see what exacly changed, which is when I realised the whole
setup described above.

The hacky solution implemented here is to override the clean

    import { ... } from 'strophe.js';

statements with the more explicit

    import { ... } from 'strophe.js/src';

...which is at least somewhat cleaner, given that 'strophe.js/src'
automatically resolves to 'strophe.js/src/index.js'.

In conclusion: bumping to a newer version of a JavaScript
dependency, despite being a seemingly innocous task, can be way
more complicated than you'd expect!
2024-03-26 17:14:21 +05:30
public Tweak chat bubble selection and metadata colours 2024-03-24 21:44:39 +05:30
src Style tweak: make all but selected list icons rounded 2024-03-24 23:12:50 +05:30
.gitignore
COPYING
README.md
package.json Bump ConverseJS from 9.1.1 to 10.1.7 and *make it work* 2024-03-26 17:14:21 +05:30
rollup.config.js Bump ConverseJS from 9.1.1 to 10.1.7 and *make it work* 2024-03-26 17:14:21 +05:30
tsconfig.json
yarn.lock Bump ConverseJS from 9.1.1 to 10.1.7 and *make it work* 2024-03-26 17:14:21 +05:30

README.md

Convo

A (simple, very basic) Jabber/XMPP client for KaiOS

Development and testing

yarn dev builds the app in watch mode and serves the site. Great for testing it out in a desktop browser.

Deploying to a device

  1. Connect your device to your computer and make sure it appears in WebIDE.
  2. yarn build
  3. In WebIDE, load the /public folder as a packaged app.

Credits and Licensing