Closed simbo1905 closed 1 year ago
Looks like the problem is that require('random-strings')
does require('crypto')
which is over 600k in size. It only uses:
randomBytes = new Buffer(0); while (randomBytes.length < maxLength) { readBytes = crypto.pseudoRandomBytes(maxLength - randomBytes.length); randomBytes = Buffer.concat([randomBytes, readBytes]); }
So we simply need to polyfill crypto.pseudoRandomBytes
Okay, I am not going to fix this, as it is six years old and browsers have great support for crypto.pseudoRandomBytes as shown at Web_Crypto_API
Browserify applied to
client.js
created a >600k file. Browserify applied to the original thinbus js from the Java project creates a 28k file. Rather than try to optimiseclient.js
(which actually just the original thinbus js with canonical npm dependencies) the original is shipped as an additional client version inbrowser.js
.This ticket is the task to rationalise down to one client version of a reasonable size. Issue #3 is to rewrite this codebase to be TypeScript and in a more functional programming style. At which point the plan is to make
client.ts
the one true client and fiddle around with browserify to get it to generate a small browser friendly UMDclient.js
.