The wasm bundle used in json_typegen_web and the npm package is quite big, currently ~1.3 MB. A large portion of that is the regex crate. A quick test of removing it (and the Inflector crate, as it depends on it) reduced the bundle size to ~400 KB.
If it turns out to be too hard to completely remove, a quick test with regex = { version = "1.3", default-features = false, features = ["std"] } yielded a wasm bundle of ~800 KB. This solution would only require a simple fork of Inflector, to match versions and features of regex.
Places where regex is currently used:
lib.rs handle_pub_in_name - Has been considered removed already
generation/typescript.rs is_ts_identifier - Could easily be rewritten without regex
generation/* Inflector::to_singular - Somewhat hard to replace, but it's already a slight issue that we don't have control over how field names are converted to type names.
The wasm bundle used in json_typegen_web and the npm package is quite big, currently ~1.3 MB. A large portion of that is the
regex
crate. A quick test of removing it (and theInflector
crate, as it depends on it) reduced the bundle size to ~400 KB.If it turns out to be too hard to completely remove, a quick test with
regex = { version = "1.3", default-features = false, features = ["std"] }
yielded a wasm bundle of ~800 KB. This solution would only require a simple fork ofInflector
, to match versions and features ofregex
.Places where
regex
is currently used:handle_pub_in_name
- Has been considered removed alreadyis_ts_identifier
- Could easily be rewritten without regexInflector::to_singular
- Somewhat hard to replace, but it's already a slight issue that we don't have control over how field names are converted to type names.